From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mail.toke.dk (Postfix) with ESMTPS id 32C4EA157C2 for ; Mon, 3 Jul 2023 20:16:57 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=STyNxAMi DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688408217; x=1719944217; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ayfS2LVGc6/nbW0AJN+KpZpfWs/kbOymmnuN6lTzg3o=; b=STyNxAMifAJYIMosRH1qUTEgxCBaEvmH8gLrE98geTMRkmQ0m/j1QkV3 zMsSu9pnq0CKqu2aEKXnyKrp2Vw563AzuB0DTjVwfGDW9DmFX4icZfPJf wRlnnYevEVCphI8b6Xe8yVL36niDnXwBpom0E2poqAmNi3RDLB+7rh+9y 3hR3ZlF3Li8swlCDewJMjLLZixMpzRgRUV6dBx++3k5l5sMoLD+IGvHdX 5pHPRF3KrtC97UAp64cQHRTpuNKAtiUdELv/rn014ZjBqu2fU+1EJrKdh Xgr35DliSt3AJHjLS8IPn0av4OfJmZLHIfJSFf/bWxR6sEyT/jL1XmiNW A==; X-IronPort-AV: E=McAfee;i="6600,9927,10760"; a="428982943" X-IronPort-AV: E=Sophos;i="6.01,178,1684825200"; d="scan'208";a="428982943" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2023 11:16:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10760"; a="753816420" X-IronPort-AV: E=Sophos;i="6.01,178,1684825200"; d="scan'208";a="753816420" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orsmga001.jf.intel.com with ESMTP; 03 Jul 2023 11:16:51 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 6D66135833; Mon, 3 Jul 2023 19:16:50 +0100 (IST) From: Larysa Zaremba To: bpf@vger.kernel.org Date: Mon, 3 Jul 2023 20:12:14 +0200 Message-ID: <20230703181226.19380-9-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230703181226.19380-1-larysa.zaremba@intel.com> References: <20230703181226.19380-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: CHQSFKY5DXJWFHRCIQCRBHY6XX5YEZO4 X-Message-ID-Hash: CHQSFKY5DXJWFHRCIQCRBHY6XX5YEZO4 X-MailFrom: larysa.zaremba@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Larysa Zaremba , ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] [PATCH bpf-next v2 08/20] ice: Support XDP hints in AF_XDP ZC mode List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In AF_XDP ZC, xdp_buff is not stored on ring, instead it is provided by xsk_pool. Space for metadata sources right after such buffers was already reserved in commit 94ecc5ca4dbf ("xsk: Add cb area to struct xdp_buff_xsk"). This makes the implementation rather straightforward. Update AF_XDP ZC packet processing to support XDP hints. Signed-off-by: Larysa Zaremba --- drivers/net/ethernet/intel/ice/ice_xsk.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c index 730b059e6759..197ebefc6307 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -705,16 +705,25 @@ static int ice_xmit_xdp_tx_zc(struct xdp_buff *xdp, * @xdp: xdp_buff used as input to the XDP program * @xdp_prog: XDP program to run * @xdp_ring: ring to be used for XDP_TX action + * @rx_desc: packet descriptor * * Returns any of ICE_XDP_{PASS, CONSUMED, TX, REDIR} */ static int ice_run_xdp_zc(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp, - struct bpf_prog *xdp_prog, struct ice_tx_ring *xdp_ring) + struct bpf_prog *xdp_prog, struct ice_tx_ring *xdp_ring, + union ice_32b_rx_flex_desc *rx_desc) { int err, result = ICE_XDP_PASS; u32 act; + /* We can safely convert xdp_buff_xsk to ice_xdp_buff, + * because there are XSK_PRIV_MAX bytes reserved in xdp_buff_xsk + * right after xdp_buff, for our private use. + * Macro insures we do not go above the limit. + */ + XSK_CHECK_PRIV_TYPE(struct ice_xdp_buff); + ice_xdp_meta_set_desc(xdp, rx_desc); act = bpf_prog_run_xdp(xdp_prog, xdp); if (likely(act == XDP_REDIRECT)) { @@ -813,7 +822,8 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget) xsk_buff_set_size(xdp, size); xsk_buff_dma_sync_for_cpu(xdp, rx_ring->xsk_pool); - xdp_res = ice_run_xdp_zc(rx_ring, xdp, xdp_prog, xdp_ring); + xdp_res = ice_run_xdp_zc(rx_ring, xdp, xdp_prog, xdp_ring, + rx_desc); if (likely(xdp_res & (ICE_XDP_TX | ICE_XDP_REDIR))) { xdp_xmit |= xdp_res; } else if (xdp_res == ICE_XDP_EXIT) { -- 2.41.0