> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Paul Thomas
> Sent: Tuesday, March 12, 2019 1:05 PM
> To: [email protected]
> Subject: Re: [PATCH] Check for SKBTX_HW_TSTAMP in macb driver
>
> On Tue, Mar 12, 2019 at 3:51 PM Paul Thomas <[email protected]> wrote:
> >
> > Make sure SKBTX_HW_TSTAMP (i.e. SOF_TIMESTAMPING_TX_HARDWARE) has
> been enabled for this skb
> > This is a concept for discussion, more testing is needed.
> > It does fix the issue where normal socks that aren't expecting a timestamp
> > will not
> wake
> > up on select.
> > ---
> > drivers/net/ethernet/cadence/macb_main.c | 12 +++++++-----
> > 1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/cadence/macb_main.c
> b/drivers/net/ethernet/cadence/macb_main.c
> > index ad099fd01b45..b2f184fc1370 100644
> > --- a/drivers/net/ethernet/cadence/macb_main.c
> > +++ b/drivers/net/ethernet/cadence/macb_main.c
> > @@ -898,11 +898,13 @@ static void macb_tx_interrupt(struct macb_queue
> *queue)
> >
> > /* First, update TX stats if needed */
> > if (skb) {
> > - if (gem_ptp_do_txstamp(queue, skb, desc) ==
> > 0) {
> > - /* skb now belongs to timestamp
> > buffer
> > - * and will be removed later
> > - */
> I think the above does the same thing as if CONFIG_MACB_USE_HWSTAMP is
> undefined regarding cleanup, so there is no extra cleanup if the
> gem_ptp_do_txstamp() path isn't taken, but I wasn't sure about the
> "skb now belongs to the timestamp buffer" if we don't go down that
> path.
The path they're taking here seems a bit weird... I suspect the function
gem_ptp_do_txstamp is doing something.
Normally the driver should use something like skb_get to obtain a reference to
the skb.
However, the main goal of this patch is correct.
Thanks,
Jake
> > - tx_skb->skb = NULL;
> > + if(unlikely(skb_shinfo(skb)->tx_flags &
> > SKBTX_HW_TSTAMP)) {
> This looks like how other drivers are doing things
> > + if (gem_ptp_do_txstamp(queue, skb,
> > desc) == 0) {
> > + /* skb now belongs to
> > timestamp buffer
> > + * and will be removed later
> > + */
> > + tx_skb->skb = NULL;
> > + }
> > }
> > netdev_vdbg(bp->dev, "skb %u (data %p) TX
> > complete\n",
> > macb_tx_ring_wrap(bp, tail),
> > --
> > 2.17.1
> >