From patchwork Tue Apr 23 10:24:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corinna Vinschen X-Patchwork-Id: 13639717 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79DF2381AD for ; Tue, 23 Apr 2024 10:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713867893; cv=none; b=eurMQZFbbeXKulEbXBYdVk9z5HT5pmlKXy5vMK9+plwXDg/QPa8445g1Sl+bs8Qk15cTWEtE683TKuINSU31AlIg77RilTNxNG8LJkewTn8GQH5o1sH0LPtfzIBYJGwqdhw/ly6AwRZHbQpve3SakSXE37/q1boR1yKD8aAmfw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713867893; c=relaxed/simple; bh=wS3oClzzrDf+uJ+ItKJDbEVykFqq7JB3tyjSIMb9i4Y=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=I2b5nPqe7ZDRMia6NOx8e5g+SC5sxmifKL21q4o1EEiijdkIZs5ozjmwp52E8FGZgSq6Jcn12Xwi57KwItYONriO347WSPfsARLBi0ehRJ51Uygf+1Ge1OSYXkxpGNXp3uOaoQ3OYmwEC9iGJvuiKMPIFxNRwRabBTRMEXjFXn0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PGv81DpS; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PGv81DpS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713867891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=TlA1wYh3gUjJTOs9PplfnS/DRdE9om0csvqcDnlkLf8=; b=PGv81DpSKNts38w6/Msrzef1Y1B9bNj0+N/PdAZqct4x1ErAjsT10+Jfr0FKdr95+zXFz7 +5pjn8m4x83m9JU6aWiZa+q0cMXYImxV3ja4/NB51EXza3X8nUAmoxZawiX0z92kcMEgjb PxOIyk3ug8K3mJyVp0p2T1bcfF1Bvco= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-615-rsb7kCBkOvW8gIp_12clWw-1; Tue, 23 Apr 2024 06:24:48 -0400 X-MC-Unique: rsb7kCBkOvW8gIp_12clWw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78E4E802E4D; Tue, 23 Apr 2024 10:24:48 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.194.197]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57AA944048; Tue, 23 Apr 2024 10:24:48 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 0A9ACA80BA0; Tue, 23 Apr 2024 12:24:47 +0200 (CEST) From: Corinna Vinschen To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Subject: [PATCH] igb: cope with large MAX_SKB_FRAGS. Date: Tue, 23 Apr 2024 12:24:46 +0200 Message-ID: <20240423102446.901450-1-vinschen@redhat.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Patchwork-Delegate: kuba@kernel.org From: Paolo Abeni Sabrina reports that the igb driver does not cope well with large MAX_SKB_FRAG values: setting MAX_SKB_FRAG to 45 causes payload corruption on TX. The root cause of the issue is that the driver does not take into account properly the (possibly large) shared info size when selecting the ring layout, and will try to fit two packets inside the same 4K page even when the 1st fraglist will trump over the 2nd head. Address the issue forcing the driver to fit a single packet per page, leaving there enough room to store the (currently) largest possible skb_shared_info. Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAG") Reported-by: Jan Tluka Reported-by: Jirka Hladky Reported-by: Sabrina Dubroca Tested-by: Sabrina Dubroca Tested-by: Corinna Vinschen Signed-off-by: Paolo Abeni Reviewed-by: Jiri Pirko --- drivers/net/ethernet/intel/igb/igb_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index a3f100769e39..22fb2c322bca 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -4833,6 +4833,7 @@ static void igb_set_rx_buffer_len(struct igb_adapter *adapter, #if (PAGE_SIZE < 8192) if (adapter->max_frame_size > IGB_MAX_FRAME_BUILD_SKB || + SKB_HEAD_ALIGN(adapter->max_frame_size) > (PAGE_SIZE / 2) || rd32(E1000_RCTL) & E1000_RCTL_SBP) set_ring_uses_large_buffer(rx_ring); #endif