From patchwork Wed Dec 8 14:06:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 1565224 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J8JsN32qMz9sR4 for ; Thu, 9 Dec 2021 01:07:52 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 676A560E90; Wed, 8 Dec 2021 14:07:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gNuaXIVuC7bm; Wed, 8 Dec 2021 14:07:48 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 4165860A82; Wed, 8 Dec 2021 14:07:48 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 407FD1BF2F8 for ; Wed, 8 Dec 2021 14:07:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 3C79783E62 for ; Wed, 8 Dec 2021 14:07:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uZ7kqVipaSIr for ; Wed, 8 Dec 2021 14:07:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by smtp1.osuosl.org (Postfix) with ESMTPS id 47A9F83E57 for ; Wed, 8 Dec 2021 14:07:38 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10191"; a="301218227" X-IronPort-AV: E=Sophos;i="5.88,189,1635231600"; d="scan'208";a="301218227" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2021 06:07:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,189,1635231600"; d="scan'208";a="479908986" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by orsmga002.jf.intel.com with ESMTP; 08 Dec 2021 06:07:28 -0800 Received: from newjersey.igk.intel.com (newjersey.igk.intel.com [10.102.20.203]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 1B8E7Quc009548; Wed, 8 Dec 2021 14:07:26 GMT From: Alexander Lobakin To: intel-wired-lan@lists.osuosl.org Date: Wed, 8 Dec 2021 15:06:53 +0100 Message-Id: <20211208140702.642741-1-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH v4 net-next 0/9] net: intel: napi_alloc_skb() vs metadata 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: Song Liu , Jesper Dangaard Brouer , Daniel Borkmann , Yonghong Song , Martin KaFai Lau , John Fastabend , Alexei Starovoitov , Andrii Nakryiko , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , netdev@vger.kernel.org, Jakub Kicinski , KP Singh , bpf@vger.kernel.org, "David S. Miller" , linux-kernel@vger.kernel.org Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" This is an interpolation of [0] to other Intel Ethernet drivers (and is (re)based on its code). The main aim is to keep XDP metadata not only in case with build_skb(), but also when we do napi_alloc_skb() + memcpy(). All Intel drivers suffers from the same here: - metadata gets lost on XDP_PASS in legacy-rx; - excessive headroom allocation on XSK Rx to skbs; - metadata gets lost on XSK Rx to skbs. Those get especially actual in XDP Hints upcoming. I couldn't have addressed the first one for all Intel drivers due to that they don't reserve any headroom for now in legacy-rx mode even with XDP enabled. This is hugely wrong, but requires quite a bunch of work and a separate series. Luckily, ice doesn't suffer from that. igc has 1 and 3 already fixed in [0]. From v3 ([1]): - fix driver name and ixgbe_construct_skb() function name in the commit message of #9 (Jesper); - no functional changes. From v2 (unreleased upstream): - tweaked 007 to pass bi->xdp directly and simplify code (Maciej); - picked Michal's Reviewed-by. From v1 (unreleased upstream): - drop "fixes" of legacy-rx for i40e, igb and ixgbe since they have another flaw regarding headroom (see above); - drop igc cosmetic fixes since they landed upstream incorporated into Jesper's commits; - picked one Acked-by from Maciej. [0] https://lore.kernel.org/netdev/163700856423.565980.10162564921347693758.stgit@firesoul [1] https://lore.kernel.org/netdev/20211207205536.563550-1-alexandr.lobakin@intel.com Alexander Lobakin (9): i40e: don't reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb i40e: respect metadata on XSK Rx to skb ice: respect metadata in legacy-rx/ice_construct_skb() ice: don't reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb ice: respect metadata on XSK Rx to skb igc: don't reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb ixgbe: pass bi->xdp to ixgbe_construct_skb_zc() directly ixgbe: don't reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb ixgbe: respect metadata on XSK Rx to skb drivers/net/ethernet/intel/i40e/i40e_xsk.c | 16 +++++++----- drivers/net/ethernet/intel/ice/ice_txrx.c | 15 ++++++++--- drivers/net/ethernet/intel/ice/ice_xsk.c | 16 +++++++----- drivers/net/ethernet/intel/igc/igc_main.c | 13 +++++----- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 27 ++++++++++++-------- 5 files changed, 54 insertions(+), 33 deletions(-) Tested-by: Kiran Bhandare A Contingent Worker at Intel