Re: [RFC bpf-next 02/23] ice: make RX HW timestamp reading code more reusable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> > > ---
> > >  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
> > > 
> > > 




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux