From patchwork Sat Dec 28 00:10:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Daley X-Patchwork-Id: 13922181 Received: from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75]) (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 C29A1635 for ; Sat, 28 Dec 2024 00:12:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=173.37.86.75 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735344727; cv=none; b=E3VRdjCN9D04N1fSZ/m6uEyaKBJeqBE6/7nDVYx90rTXFMe2dsMSx9ZFklA3h7yfPNunnS1pg5yPHL8qQ/+oy3/ZVpXcb7IfAXtcMEhCXa9bh2SDMCYrazrdHkNJ8SKY/YH1WfhGZbjRZEcrcpIfZd1pvPWKy1QxlSZ0pembKWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735344727; c=relaxed/simple; bh=JafIP02PO98uLZKXO0izV+3usrl3hFYSBRFV6/i6/pU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=PSOaBe3iQ6S12bY7LvvjSHtoZS07lyqAXCIOcyJLGFiX7xU/kYBQUDpmm0H796MDmNU3VCPPhtKB7QvCt6PqziXPYDWiivWvdtABMTp6X3daNOV6DLI5voRK+MbwNuNwiSf8t9aGzDGJf1ldktm7LTSgxSMoHDOYlCz1taa+AQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cisco.com; spf=pass smtp.mailfrom=cisco.com; dkim=pass (1024-bit key) header.d=cisco.com header.i=@cisco.com header.b=DRv2sg0o; arc=none smtp.client-ip=173.37.86.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cisco.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cisco.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=cisco.com header.i=@cisco.com header.b="DRv2sg0o" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=2266; q=dns/txt; s=iport; t=1735344725; x=1736554325; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=kKCGtv0yJ7J7+k1hTKbyErreujSmpcX/Lt98Wk7ACsg=; b=DRv2sg0ou+fsBMSEt7dXSb1+boDzLWksXjnbmXTqrq8amnilQkAb/ek2 FTbEZnghdWRF1VVb3y1lEMAms7t/qlalBC5bbqWG4y6iNlcVXDe7p7WmR h+J8VOQIVNLmvPSRjqMtzlR6cyUes87HcRNNlsc349q3uZEs1E2qT23sR 8=; X-CSE-ConnectionGUID: 4ejswKsdRhiraQy94VOKlw== X-CSE-MsgGUID: 8Zvg1p1qQuepciEL6+D+8A== X-IPAS-Result: A0BcAwDJQG9n/4r/Ja1aglyCS4FPQ0iNUYhynhsUgREDVg8BAQEPRAQBAYUHinACJjQJDgECBAEBAQEDAgMBAQEBAQEBAQEBAQsBAQUBAQECAQcFgQ4ThgiGXTYBRoEMMhKDAYJlA7E5giyBAd4zgW2BSIVrh19whHcnG4FJRIQOb4QpZ4V3BIIfF4EngUCDeJ5ySIEhA1ksAVUTDQoLBwWBOToDIgwLDAsUHBUCgR6BAhQGFQSBC0U9gkppSTcCDQI2giAkWIJNhReEXoRWgklVgnuCF3yBGoIlQAMLGA1IESw3Bg4bBj5uB5xfRoNzgQ4BE2grHVEUPgIRkyGSFaEDhCSBY59jGjOqUph8IqNtN4RmgWc8gVkzGggbFYMiUhkPji0WtSAlMjwCBwsBAQMJjzYGgXcBAQ IronPort-Data: A9a23:PQlD/anmjPjYJEQoUosw4A3o5gyjJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xIbUD3VOvuKa2uhfookaI619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Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.12,269,1728950400"; d="scan'208";a="300780815" Received: from rcdn-l-core-01.cisco.com ([173.37.255.138]) by rcdn-iport-4.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 28 Dec 2024 00:10:57 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-l-core-01.cisco.com (Postfix) with ESMTP id 9A3421800029F; Sat, 28 Dec 2024 00:10:57 +0000 (GMT) Received: by cisco.com (Postfix, from userid 392789) id 70F1620F2003; Fri, 27 Dec 2024 16:10:57 -0800 (PST) From: John Daley To: benve@cisco.com, satishkh@cisco.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org Cc: John Daley Subject: [PATCH net-next v3 0/6] enic: Use Page Pool API for receiving packets Date: Fri, 27 Dec 2024 16:10:49 -0800 Message-Id: <20241228001055.12707-1-johndale@cisco.com> X-Mailer: git-send-email 2.35.2 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: rcdn-l-core-01.cisco.com X-Patchwork-Delegate: kuba@kernel.org When the MTU is less than PAGE_SIZE, use the Page Pool API for RX. The Page Pool API improves bandwidth and CPU overhead by recycling pages instead of allocating new buffers in the driver. Also, page pool fragment allocation for smaller MTUs allow multiple packets to share a page. Since older hardware does not support receiving packets into multiple discontiguous pages, the original RX path where netdev_alloc_skb_ip_align() is used for buffer allocation is now used only when MTU > PAGE_SIZE. Function pointers are used to select functions based on the MTU. Some refactoring was done so that common code can be shared. The refactored functions and the new functions using page pool are in a new file called enic_rq.c. Fixed bug in the RX adaptive coalescing and did a minor cleanup. Signed-off-by: John Daley --- Changes in v2: - Fixed a valid warning found by build_clang where a variable was used before it was initialized. The warnings in include/linux/mm.h were not addressed since they do not appear to be realated to this patchset. Changes in v3: - Moved a function to before where is was and removed the forward declaration. Reworded a commit message. No functional changes. John Daley (6): enic: Refactor RX path common code into helper functions enic: Remove an unnecessary parameter from function enic_queue_rq_desc enic: Use function pointers for buf alloc, free and RQ service enic: Use the Page Pool API for RX when MTU is less than page size enic: Move RX coalescing set function enic: Obtain the Link speed only after the link comes up drivers/net/ethernet/cisco/enic/Makefile | 2 +- drivers/net/ethernet/cisco/enic/enic.h | 15 + .../net/ethernet/cisco/enic/enic_ethtool.c | 1 + drivers/net/ethernet/cisco/enic/enic_main.c | 229 ++++++--------- drivers/net/ethernet/cisco/enic/enic_res.h | 10 +- drivers/net/ethernet/cisco/enic/enic_rq.c | 261 ++++++++++++++++++ drivers/net/ethernet/cisco/enic/enic_rq.h | 27 ++ drivers/net/ethernet/cisco/enic/vnic_rq.h | 2 + 8 files changed, 401 insertions(+), 146 deletions(-) create mode 100644 drivers/net/ethernet/cisco/enic/enic_rq.c create mode 100644 drivers/net/ethernet/cisco/enic/enic_rq.h