From patchwork Thu Jul 18 08:56:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corinna Vinschen X-Patchwork-Id: 13736262 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 3F9FD7F484 for ; Thu, 18 Jul 2024 08:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721293005; cv=none; b=b3BJXxew3DBnbGd5Xhte2hIVU2z0J0V6ILx51Gvy2K0Bkylm+5plbWORCmfqOn/gbPkdg4Gg3GwCbvYooHIJ4vlLtt1fwwvOtnCQ73ULpJI1x0V/i8zT2PFkL+w0nGzsZRDLLONhJj6DzKzG7mdq8eMzOQ2rjCJVT58jLKPf8sM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721293005; c=relaxed/simple; bh=OypfG3gE5lBqvsJ7lQXciPmFJDsRAMS1OSI4crIBEsQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EVeD6h6UTBrccXvEjyO9XZ8dVnEXznlWjFuttgBxnFLmmw6o8p10Xi27XoqY5NHCbGYl3Gcn7cvZpXlDW/RVBRSA6/BsfyAAFK2VkXo+/5vrh2Rkk6sJGq8am3CZyHMeRB2mkmY9nqQLRTTEksx3oTuKiXyU1at5JHf5g94z98w= 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=fR97kKwA; arc=none smtp.client-ip=170.10.133.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="fR97kKwA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721293002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=kY9XX4Ug6bOZxHPTPt1uJFHl+uMLZ8/gOTrfu25TnWo=; b=fR97kKwAbPusVRzQNw85KcqkkcixyZbzySTZ0CMfCtX4C4rcDtx3L/IqLChcxLY0cTBmbZ n9K6xLM9+BUOXxAPODibQeMYLOWghwzo7gLfIn4W2ruuoJUIfEUYJVW4cAg5niDfWp6Hl6 cGpeymwGHEvTYzcoaQVuxM8YcOGbrXY= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-564-7Rf40grtP0CVRje7UxI4kw-1; Thu, 18 Jul 2024 04:56:39 -0400 X-MC-Unique: 7Rf40grtP0CVRje7UxI4kw-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0F71A1955D4F; Thu, 18 Jul 2024 08:56:37 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.193.237]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6969B195605A; Thu, 18 Jul 2024 08:56:36 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id E7076A80D05; Thu, 18 Jul 2024 10:56:33 +0200 (CEST) From: Corinna Vinschen To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Eric Dumazet Cc: linux-kernel@vger.kernel.org, Nikolay Aleksandrov , Jason Xing , Paolo Abeni , Jakub Kicinski , "David S . Miller" , Tony Nguyen , Jesse Brandeburg Subject: [PATCH net v3] igb: cope with large MAX_SKB_FRAGS. Date: Thu, 18 Jul 2024 10:56:33 +0200 Message-ID: <20240718085633.1285322-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.0 on 10.30.177.40 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. An easy reproducer is to run ssh to connect to the machine. With MAX_SKB_FRAGS=17 it works, with MAX_SKB_FRAGS=45 it fails. 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_FRAGS") 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: Eric Dumazet Reviewed-by: Tony Nguyen Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- v2: fix subject, add a simple reproducer v3: fix Fixes, tested with all MTUs from 1200 to 1280 per Eric's suggestion 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 11be39f435f3..232d6cb836a9 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -4808,6 +4808,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