* [PATCH 4/5] net: wwan: iosm: fix netdev tx stats
@ 2021-06-30 18:27 M Chetan Kumar
2021-06-30 20:36 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: M Chetan Kumar @ 2021-06-30 18:27 UTC (permalink / raw
To: netdev; +Cc: kuba, davem, johannes, krishna.c.sudi, linuxwwan
Update tx stats on successful packet consume, drop.
Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com>
---
drivers/net/wwan/iosm/iosm_ipc_wwan.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wwan/iosm/iosm_ipc_wwan.c b/drivers/net/wwan/iosm/iosm_ipc_wwan.c
index 84e37c4b0f74..561944a33725 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_wwan.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_wwan.c
@@ -123,6 +123,8 @@ static int ipc_wwan_link_transmit(struct sk_buff *skb,
/* Return code of zero is success */
if (ret == 0) {
+ netdev->stats.tx_packets++;
+ netdev->stats.tx_bytes += skb->len;
ret = NETDEV_TX_OK;
} else if (ret == -EBUSY) {
ret = NETDEV_TX_BUSY;
@@ -140,7 +142,8 @@ static int ipc_wwan_link_transmit(struct sk_buff *skb,
ret);
dev_kfree_skb_any(skb);
- return ret;
+ netdev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
}
/* Ops structure for wwan net link */
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5] net: wwan: iosm: fix netdev tx stats
2021-06-30 18:27 [PATCH 4/5] net: wwan: iosm: fix netdev tx stats M Chetan Kumar
@ 2021-06-30 20:36 ` Eric Dumazet
2021-07-01 5:30 ` Kumar, M Chetan
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2021-06-30 20:36 UTC (permalink / raw
To: M Chetan Kumar, netdev; +Cc: kuba, davem, johannes, krishna.c.sudi, linuxwwan
On 6/30/21 8:27 PM, M Chetan Kumar wrote:
> Update tx stats on successful packet consume, drop.
>
> Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com>
> ---
> drivers/net/wwan/iosm/iosm_ipc_wwan.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_wwan.c b/drivers/net/wwan/iosm/iosm_ipc_wwan.c
> index 84e37c4b0f74..561944a33725 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_wwan.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_wwan.c
> @@ -123,6 +123,8 @@ static int ipc_wwan_link_transmit(struct sk_buff *skb,
>
> /* Return code of zero is success */
> if (ret == 0) {
> + netdev->stats.tx_packets++;
> + netdev->stats.tx_bytes += skb->len;
What makes you think skb has not been consumed already ?
It seems clear it has been given, this thread can not expect skb has not been mangled/freed.
skb->len might now contain garbage, or even crash the kernel under appropriate debug features.
> ret = NETDEV_TX_OK;
> } else if (ret == -EBUSY) {
> ret = NETDEV_TX_BUSY;
> @@ -140,7 +142,8 @@ static int ipc_wwan_link_transmit(struct sk_buff *skb,
> ret);
>
> dev_kfree_skb_any(skb);
> - return ret;
> + netdev->stats.tx_dropped++;
> + return NETDEV_TX_OK;
> }
>
> /* Ops structure for wwan net link */
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5] net: wwan: iosm: fix netdev tx stats
2021-06-30 20:36 ` Eric Dumazet
@ 2021-07-01 5:30 ` Kumar, M Chetan
0 siblings, 0 replies; 3+ messages in thread
From: Kumar, M Chetan @ 2021-07-01 5:30 UTC (permalink / raw
To: Eric Dumazet, M Chetan Kumar, netdev
Cc: kuba, davem, johannes, krishna.c.sudi, linuxwwan
On 7/1/2021 2:06 AM, Eric Dumazet wrote:
>
>
> On 6/30/21 8:27 PM, M Chetan Kumar wrote:
>> Update tx stats on successful packet consume, drop.
>>
>> Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com>
>> ---
>> drivers/net/wwan/iosm/iosm_ipc_wwan.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wwan/iosm/iosm_ipc_wwan.c b/drivers/net/wwan/iosm/iosm_ipc_wwan.c
>> index 84e37c4b0f74..561944a33725 100644
>> --- a/drivers/net/wwan/iosm/iosm_ipc_wwan.c
>> +++ b/drivers/net/wwan/iosm/iosm_ipc_wwan.c
>> @@ -123,6 +123,8 @@ static int ipc_wwan_link_transmit(struct sk_buff *skb,
>>
>> /* Return code of zero is success */
>> if (ret == 0) {
>> + netdev->stats.tx_packets++;
>> + netdev->stats.tx_bytes += skb->len;
>
> What makes you think skb has not been consumed already ?
> It seems clear it has been given, this thread can not expect skb has not been mangled/freed.
> skb->len might now contain garbage, or even crash the kernel under appropriate debug features.
Ya. there could be a possibility skb might have been dequeued from ul_list and
UL task is already processing it. We can't rule out.
Will backup skb->len to local var and use it for tx_bytes update.
Regards,
Chetan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-01 5:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-30 18:27 [PATCH 4/5] net: wwan: iosm: fix netdev tx stats M Chetan Kumar
2021-06-30 20:36 ` Eric Dumazet
2021-07-01 5:30 ` Kumar, M Chetan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).