[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZF6DHOtnr/AfYxML@google.com>
Date: Fri, 12 May 2023 11:19:53 -0700
From: Stanislav Fomichev <sdf@...gle.com>
To: Larysa Zaremba <larysa.zaremba@...el.com>
Cc: bpf@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Jakub Kicinski <kuba@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
Anatoly Burakov <anatoly.burakov@...el.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Magnus Karlsson <magnus.karlsson@...il.com>,
Maryam Tahhan <mtahhan@...hat.com>, xdp-hints@...-project.net,
netdev@...r.kernel.org, intel-wired-lan@...ts.osuosl.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RESEND bpf-next 06/15] ice: Support HW timestamp hint
On 05/12, Larysa Zaremba wrote:
> Use previously refactored code and create a function
> that allows XDP code to read HW timestamp.
>
> HW timestamp is the first supported hint in the driver,
> so also add xdp_metadata_ops.
>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@...el.com>
> ---
> drivers/net/ethernet/intel/ice/ice.h | 2 ++
> drivers/net/ethernet/intel/ice/ice_main.c | 1 +
> drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 22 +++++++++++++++++++
> 3 files changed, 25 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
> index aa32111afd6e..ba1bb8392db1 100644
> --- a/drivers/net/ethernet/intel/ice/ice.h
> +++ b/drivers/net/ethernet/intel/ice/ice.h
> @@ -962,4 +962,6 @@ static inline void ice_clear_rdma_cap(struct ice_pf *pf)
> set_bit(ICE_FLAG_UNPLUG_AUX_DEV, pf->flags);
> clear_bit(ICE_FLAG_RDMA_ENA, pf->flags);
> }
> +
> +extern const struct xdp_metadata_ops ice_xdp_md_ops;
> #endif /* _ICE_H_ */
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index a1f7c8edc22f..cda6c4a80737 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -3378,6 +3378,7 @@ static void ice_set_ops(struct ice_vsi *vsi)
>
> netdev->netdev_ops = &ice_netdev_ops;
> netdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic;
> + netdev->xdp_metadata_ops = &ice_xdp_md_ops;
> ice_set_ethtool_ops(netdev);
>
> if (vsi->type != ICE_VSI_PF)
> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> index 2515f5f7a2b6..e9589cadf811 100644
> --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> @@ -537,3 +537,25 @@ void ice_finalize_xdp_rx(struct ice_tx_ring *xdp_ring, unsigned int xdp_res,
> spin_unlock(&xdp_ring->tx_lock);
> }
> }
> +
> +/**
> + * ice_xdp_rx_hw_ts - HW timestamp XDP hint handler
> + * @ctx: XDP buff pointer
> + * @ts_ns: destination address
> + *
> + * Copy HW timestamp (if available) to the destination address.
> + */
> +static int ice_xdp_rx_hw_ts(const struct xdp_md *ctx, u64 *ts_ns)
> +{
> + const struct ice_xdp_buff *xdp_ext = (void *)ctx;
> +
> + if (!ice_ptp_copy_rx_hwts_from_desc(xdp_ext->rx_ring,
> + xdp_ext->eop_desc, ts_ns))
> + return -EOPNOTSUPP;
Per Jesper's recent update, should this be ENODATA?
Powered by blists - more mailing lists