net: wwan: iosm: fix netdev tx stats
Subsystems (4)
PATCH 4/5 net: wwan: iosm: fix netdev tx stats
Update tx stats on successful packet consume, drop.
--- drivers/net/wwan/iosm/iosm_ipc_wwan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wwan/iosm/iosm_ipc_wwan.c +4 -1
@@ -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 */
Signature · 1 line
2.25.1
Quoted 12 lines · M Chetan Kumar
Update tx stats on successful packet consume, drop.
Signed-off-by M Chetan Kumar <[email protected]>--- drivers/net/wwan/iosm/iosm_ipc_wwan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/wwan/iosm/iosm_ipc_wwan.c +0
-0
drivers/net/wwan/iosm/iosm_ipc_wwan.c static int ipc_wwan_link_transmit(struct sk_buff *skb, · line 127
Quoted 5 lines
drivers/net/wwan/iosm/iosm_ipc_wwan.c +2
-0@@ -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.
Quoted 14 lines
drivers/net/wwan/iosm/iosm_ipc_wwan.c +2
-1ret =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 */
Quoted 16 lines · Eric Dumazet
Quoted 13 lines · M Chetan Kumar
Update tx stats on successful packet consume, drop.
Signed-off-by M Chetan Kumar <[email protected]>--- drivers/net/wwan/iosm/iosm_ipc_wwan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/wwan/iosm/iosm_ipc_wwan.c +0
-0@@ -123,6 +123,8 @@ static int ipc_wwan_link_transmit(struct sk_buff *skb,
Quoted 8 lines
drivers/net/wwan/iosm/iosm_ipc_wwan.c static int ipc_wwan_link_transmit(struct sk_buff *skb, · line 127
Quoted 4 lines
drivers/net/wwan/iosm/iosm_ipc_wwan.c +2
-0/* 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->lenmight 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