From patchwork Tue Apr 23 13:47:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corinna Vinschen X-Patchwork-Id: 1926596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=x0mU9H/c; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP3N30kW7z1ySm for ; Tue, 23 Apr 2024 23:47:45 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2EE2860895; Tue, 23 Apr 2024 13:47:43 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id OZE6qQMM8eHv; Tue, 23 Apr 2024 13:47:42 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7ACE9608FA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1713880062; bh=hMZp7vYlgNuZhS/jUXjj83MHWi0SFemcDgb6WZEyykI=; h=From:To:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=x0mU9H/cpD+27GEG7Eh1tAxTnPC9FC56rmqcA0Eu29wNzJLXijRPVleYhL1Js7U02 aUTplIYhtojZzV1ksCPDHB98TH/Ux3VzdPsevQ4CqoXvV4jKvWWGl5nUIHLwi7SRl3 2M8vBtok4Cft8EBE3DncukKBsdx0bL8tg1P414B457JYOcz4p/cMzlGTlNti0xyG1S wgF1WRv2hVmtyGApNqff+Wd9e1ib0FlDa45DVMNRj68ZRwCn0KxkGaFJescA4FIUvi KuWOaTZx0QBf6DAFqfa/q+r1IdTuNCHMMW9CcK7576itjAyOOLVf4sG+tTfo76jIjJ GrfcAYtI6C3wQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 7ACE9608FA; Tue, 23 Apr 2024 13:47:42 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 80DFB1BF390 for ; Tue, 23 Apr 2024 13:47:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6B89E404E2 for ; Tue, 23 Apr 2024 13:47:40 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id udnaMMGSiP0J for ; Tue, 23 Apr 2024 13:47:39 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=vinschen@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org D83CD40338 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D83CD40338 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id D83CD40338 for ; Tue, 23 Apr 2024 13:47:38 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-473-Rxv05-80N6mL9QIoHLVtCw-1; Tue, 23 Apr 2024 09:47:34 -0400 X-MC-Unique: Rxv05-80N6mL9QIoHLVtCw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 4BAC13C3D0C5; Tue, 23 Apr 2024 13:47:33 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.194.197]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF92D200A5C5; Tue, 23 Apr 2024 13:47:32 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 88233A80CED; Tue, 23 Apr 2024 15:47:31 +0200 (CEST) From: Corinna Vinschen To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org Date: Tue, 23 Apr 2024 15:47:31 +0200 Message-ID: <20240423134731.918157-1-vinschen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713880057; 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=hMZp7vYlgNuZhS/jUXjj83MHWi0SFemcDgb6WZEyykI=; b=TxpO4Pw/6d8A+ibfJXVCGMOFudJtwKMVo1U+Z2t5MPq0tZWwHVajvPRAe1MIMB9Ge42lgs e+NZ3MrNYbF1IK2THU+pGmAhNQu6gKQVogdwgl8Dm9Qbp7foI/wpebqT5rG0cCQxQxHjNL re0dlKmmep48IOQKeMSK51cgTXJ28G0= X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TxpO4Pw/ Subject: [Intel-wired-lan] [PATCH net v2] igb: cope with large MAX_SKB_FRAGS X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Xing , Nikolay Aleksandrov , Eric Dumazet , Tony Nguyen , Jakub Kicinski , Paolo Abeni , "David S . Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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_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 --- v2: fix subject, add a simple reproducer 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