[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZPdHnCTQgwce0Byh@boxer>
Date: Tue, 5 Sep 2023 17:22:04 +0200
From: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
To: Larysa Zaremba <larysa.zaremba@...el.com>
CC: <bpf@...r.kernel.org>, <ast@...nel.org>, <daniel@...earbox.net>,
<andrii@...nel.org>, <martin.lau@...ux.dev>, <song@...nel.org>, <yhs@...com>,
<john.fastabend@...il.com>, <kpsingh@...nel.org>, <sdf@...gle.com>,
<haoluo@...gle.com>, <jolsa@...nel.org>, David Ahern <dsahern@...il.com>,
Jakub Kicinski <kuba@...nel.org>, Willem de Bruijn <willemb@...gle.com>,
Jesper Dangaard Brouer <brouer@...hat.com>, Anatoly Burakov
<anatoly.burakov@...el.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>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>, Alexei Starovoitov
<alexei.starovoitov@...il.com>, Simon Horman <simon.horman@...igine.com>,
Tariq Toukan <tariqt@...lanox.com>, Saeed Mahameed <saeedm@...lanox.com>
Subject: Re: [RFC bpf-next 02/23] ice: make RX HW timestamp reading code more
reusable
On Mon, Sep 04, 2023 at 06:29:03PM +0200, Larysa Zaremba wrote:
> On Mon, Sep 04, 2023 at 04:56:32PM +0200, Maciej Fijalkowski wrote:
> > On Thu, Aug 24, 2023 at 09:26:41PM +0200, Larysa Zaremba wrote:
> > > Previously, we only needed RX HW timestamp in skb path,
> > > hence all related code was written with skb in mind.
> > > But with the addition of XDP hints via kfuncs to the ice driver,
> > > the same logic will be needed in .xmo_() callbacks.
> > >
> > > Put generic process of reading RX HW timestamp from a descriptor
> > > into a separate function.
> > > Move skb-related code into another source file.
> > >
> > > Signed-off-by: Larysa Zaremba <larysa.zaremba@...el.com>
> > > ---
> > > drivers/net/ethernet/intel/ice/ice_ptp.c | 24 ++++++------------
> > > drivers/net/ethernet/intel/ice/ice_ptp.h | 15 ++++++-----
> > > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 25 ++++++++++++++++++-
> > > 3 files changed, 41 insertions(+), 23 deletions(-)
> > >
> > >
(...)
> > > +/**
> > > + * ice_ptp_rx_hwts_to_skb - Put RX timestamp into skb
> > > + * @rx_ring: Ring to get the VSI info
> > > + * @rx_desc: Receive descriptor
> > > + * @skb: Particular skb to send timestamp with
> > > + *
> > > + * The timestamp is in ns, so we must convert the result first.
> > > + */
> > > +static void
> > > +ice_ptp_rx_hwts_to_skb(struct ice_rx_ring *rx_ring,
> > > + const union ice_32b_rx_flex_desc *rx_desc,
> > > + struct sk_buff *skb)
> > > +{
> > > + u64 ts_ns, cached_time;
> > > +
> > > + cached_time = READ_ONCE(rx_ring->cached_phctime);
> >
> > any reason for not reading cached_phctime within ice_ptp_get_rx_hwts?
> >
>
> Not at this point, but later for hints, this is read from the xdp_buff tail
> instead of ring.
>
> But maybe it would be actually better to leave cached time where it used to be
> for now and instead later in hint patch replace rx_ring with ice_pkt_ctx in
> ice_ptp_get_rx_hwts(). I guess that would look better.
Yes, that's what I was trying to say mostly. Thanks.
>
> > > + ts_ns = ice_ptp_get_rx_hwts(rx_desc, cached_time);
> > > +
> > > + *skb_hwtstamps(skb) = (struct skb_shared_hwtstamps){
> > > + .hwtstamp = ns_to_ktime(ts_ns),
> > > + };
> > > +}
> > > +
> > > /**
> > > * ice_process_skb_fields - Populate skb header fields from Rx descriptor
> > > * @rx_ring: Rx descriptor ring packet is being transacted on
> > > @@ -209,7 +232,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring,
> > > ice_rx_csum(rx_ring, skb, rx_desc, ptype);
> > >
> > > if (rx_ring->ptp_rx)
> > > - ice_ptp_rx_hwtstamp(rx_ring, rx_desc, skb);
> > > + ice_ptp_rx_hwts_to_skb(rx_ring, rx_desc, skb);
> > > }
> > >
> > > /**
> > > --
> > > 2.41.0
> > >
> > >
Powered by blists - more mailing lists