[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200923204548.k2f44gjl7s4dwoim@skbuf>
Date: Wed, 23 Sep 2020 20:45:48 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: Horatiu Vultur <horatiu.vultur@...rochip.com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"Y.b. Lu" <yangbo.lu@....com>,
Xiaoliang Yang <xiaoliang.yang_1@....com>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
Claudiu Manoil <claudiu.manoil@....com>,
"alexandre.belloni@...tlin.com" <alexandre.belloni@...tlin.com>,
"andrew@...n.ch" <andrew@...n.ch>,
"vivien.didelot@...il.com" <vivien.didelot@...il.com>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"richardcochran@...il.com" <richardcochran@...il.com>
Subject: Re: [PATCH net-next] net: mscc: ocelot: always pass skb clone to
ocelot_port_add_txtstamp_skb
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
Powered by blists - more mailing lists