From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mail.toke.dk (Postfix) with ESMTPS id 2E5429B3333 for ; Fri, 4 Nov 2022 15:38:34 +0100 (CET) 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=B5Ba6W4f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667572720; x=1699108720; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5Qz6/3spwrqUoYTSX0DPgHA9Qlrgln4MaaCK1iydmAI=; b=B5Ba6W4fSyoxmRH3D4pmsk12QGpeH0pOZpbmk8Ox+bNWHYZ3FmdqXsSU cdH+5O0SqZ67VpU4/XlFETiiTMNGvGUkVqzc4xUDTV6nS5zJUgAE7YuVx Mj+qs+37XhxAFF3hPqEvBNlsBxz5UOdvfxkiu62UOo75mApxXaCFL4AzS GviGD6IvtmmPGym4u22dFr/7BuPL2o9vFSdUzrqB2EOAVSlRuvASjoZjr 6rOn/SiU3+8DWJPiVam9h4zuN78jO95TkVa4zHNNb+fq89W2n4iGJl0N7 brRVt6vraVwbZSZ2LaQ7ov/wYAaKDw4ERB/v1OP0evhzcBHlkFtnjRGgc A==; X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="336683981" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="336683981" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 07:38:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="704101828" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="704101828" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by fmsmga004.fm.intel.com with ESMTP; 04 Nov 2022 07:38:19 -0700 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 2A4EcHMF021328; Fri, 4 Nov 2022 14:38:17 GMT From: Alexander Lobakin To: Stanislav Fomichev Date: Fri, 4 Nov 2022 15:35:47 +0100 Message-Id: <20221104143547.3575615-1-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221104032532.1615099-11-sdf@google.com> References: <20221104032532.1615099-1-sdf@google.com> <20221104032532.1615099-11-sdf@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit Message-ID-Hash: OIAM7Z4UNW7HG3BWPSGWMXMPO2RDDJ3P X-Message-ID-Hash: OIAM7Z4UNW7HG3BWPSGWMXMPO2RDDJ3P X-MailFrom: alexandr.lobakin@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: Alexander Lobakin , bpf@vger.kernel.org, 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, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.5 Precedence: list Subject: [xdp-hints] Re: [RFC bpf-next v2 10/14] ice: Support rx timestamp metadata for xdp List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Stanislav Fomichev Date: Thu,3 Nov 2022 20:25:28 -0700 > COMPILE-TESTED ONLY! > > Cc: John Fastabend > Cc: David Ahern > Cc: Martin KaFai Lau > Cc: Jakub Kicinski > Cc: Willem de Bruijn > Cc: Jesper Dangaard Brouer > Cc: Anatoly Burakov > Cc: Alexander Lobakin > Cc: Magnus Karlsson > Cc: Maryam Tahhan > Cc: xdp-hints@xdp-project.net > Cc: netdev@vger.kernel.org > Signed-off-by: Stanislav Fomichev > --- > drivers/net/ethernet/intel/ice/ice.h | 5 ++ > drivers/net/ethernet/intel/ice/ice_main.c | 1 + > drivers/net/ethernet/intel/ice/ice_txrx.c | 75 +++++++++++++++++++++++ > 3 files changed, 81 insertions(+) > > diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h > index f88ee051e71c..c51a392d64a4 100644 > --- a/drivers/net/ethernet/intel/ice/ice.h > +++ b/drivers/net/ethernet/intel/ice/ice.h > @@ -925,6 +925,11 @@ int ice_open_internal(struct net_device *netdev); > int ice_stop(struct net_device *netdev); > void ice_service_task_schedule(struct ice_pf *pf); > > +struct bpf_insn; > +struct bpf_patch; > +void ice_unroll_kfunc(const struct bpf_prog *prog, u32 func_id, > + struct bpf_patch *patch); > + > /** > * ice_set_rdma_cap - enable RDMA support > * @pf: PF struct > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c > index 1f27dc20b4f1..8ddc6851ef86 100644 > --- a/drivers/net/ethernet/intel/ice/ice_main.c > +++ b/drivers/net/ethernet/intel/ice/ice_main.c > @@ -9109,4 +9109,5 @@ static const struct net_device_ops ice_netdev_ops = { > .ndo_xdp_xmit = ice_xdp_xmit, > .ndo_xsk_wakeup = ice_xsk_wakeup, > .ndo_get_devlink_port = ice_get_devlink_port, > + .ndo_unroll_kfunc = ice_unroll_kfunc, > }; > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c > index 1b6afa168501..e9b5e883753e 100644 > --- a/drivers/net/ethernet/intel/ice/ice_txrx.c > +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1098,8 +1099,80 @@ ice_is_non_eop(struct ice_rx_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc) > > struct ice_xdp_buff { > struct xdp_buff xdp; > + struct ice_rx_ring *rx_ring; > + union ice_32b_rx_flex_desc *rx_desc; > }; > > +void ice_unroll_kfunc(const struct bpf_prog *prog, u32 func_id, > + struct bpf_patch *patch) > +{ > + if (func_id == xdp_metadata_kfunc_id(XDP_METADATA_KFUNC_EXPORT_TO_SKB)) { > + return xdp_metadata_export_to_skb(prog, patch); Hey, FYI, our team wants to write a follow-up patch with ice support added, not like a draft, more of a mature code. I'm thinking of calling ice C function which would process Rx descriptors from that BPF code from the unrolling callback -- otherwise, implementing a couple hundred C code lines from ice_txrx_lib.c would be a bit too much :D > + } else if (func_id == xdp_metadata_kfunc_id(XDP_METADATA_KFUNC_RX_TIMESTAMP_SUPPORTED)) { > + /* return true; */ > + bpf_patch_append(patch, BPF_MOV64_IMM(BPF_REG_0, 1)); > + } else if (func_id == xdp_metadata_kfunc_id(XDP_METADATA_KFUNC_RX_TIMESTAMP)) { [...] > -- > 2.38.1.431.g37b22c650d-goog Thanks, Olek