On Wed, Sep 23, 2020 at 10:35:30PM +0200, Horatiu Vultur wrote:
> The 09/23/2020 20:22, Vladimir Oltean wrote:
> > On Wed, Sep 23, 2020 at 10:08:00PM +0200, Horatiu Vultur wrote:
> > > The 09/23/2020 14:24, Vladimir Oltean wrote:
> > > > +               if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
> > > > +                       struct sk_buff *clone;
> > > > +
> > > > +                       clone = skb_clone_sk(skb);
> > > > +                       if (!clone) {
> > > > +                               kfree_skb(skb);
> > > > +                               return NETDEV_TX_OK;
> > >
> > > Why do you return NETDEV_TX_OK?
> > > Because the frame is not sent yet.
> >
> > I suppose I _could_ increment the tx_dropped counters, if that's what
> > you mean.
>
> Yeah, something like that I was thinking.
>
> Also I am just thinking, not sure if it is correct but, can you return
> NETDEV_TX_BUSY and not free the skb?
>

Do you have a use case for NETDEV_TX_BUSY instead of plain dropping the
skb, some situation where it would be better?

I admit I haven't tested this particular code path, but my intuition
tells me that under OOM, the last thing you need is some networking
driver just trying and trying again to send a packet.

Documentation/networking/driver.rst:

1) The ndo_start_xmit method must not return NETDEV_TX_BUSY under
   any normal circumstances.  It is considered a hard error unless
   there is no way your device can tell ahead of time when it's
   transmit function will become busy.

Looking up the uses of NETDEV_TX_BUSY, I see pretty much only congestion
type of events.

Thanks,
-Vladimir

Reply via email to