[PATCH linux dev-6.6 v2 3/3] net: mctp: usb: Port for kernel 6.6

Santosh Puranik santosh.puranik.ibm at gmail.com
Thu May 8 03:38:06 AEST 2025


From: Santosh Puranik <spuranik at nvidia.com>

Fix the way the mctp usb binding driver records netdev stats.

Signed-off-by: Santosh Puranik <santosh.puranik.ibm at gmail.com>
---
 drivers/net/mctp/mctp-usb.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mctp/mctp-usb.c b/drivers/net/mctp/mctp-usb.c
index e8d4b01c3f34..c398aa45e40d 100644
--- a/drivers/net/mctp/mctp-usb.c
+++ b/drivers/net/mctp/mctp-usb.c
@@ -48,16 +48,17 @@ static void mctp_usb_out_complete(struct urb *urb)
 	case -ECONNRESET:
 	case -ESHUTDOWN:
 	case -EPROTO:
-		dev_dstats_tx_dropped(netdev);
+		netdev->stats.tx_dropped++;
 		break;
 	case 0:
-		dev_dstats_tx_add(netdev, skb->len);
+		netdev->stats.tx_packets++;
+		netdev->stats.tx_bytes += skb->len;
 		netif_wake_queue(netdev);
 		consume_skb(skb);
 		return;
 	default:
 		netdev_dbg(netdev, "unexpected tx urb status: %d\n", status);
-		dev_dstats_tx_dropped(netdev);
+		netdev->stats.tx_dropped++;
 	}
 
 	kfree_skb(skb);
@@ -105,7 +106,7 @@ static netdev_tx_t mctp_usb_start_xmit(struct sk_buff *skb,
 	return NETDEV_TX_OK;
 
 err_drop:
-	dev_dstats_tx_dropped(dev);
+	dev->stats.tx_dropped++;
 	kfree_skb(skb);
 	return NETDEV_TX_OK;
 }
@@ -223,7 +224,8 @@ static void mctp_usb_in_complete(struct urb *urb)
 			skb_trim(skb, pkt_len);
 		}
 
-		dev_dstats_rx_add(netdev, skb->len);
+		netdev->stats.rx_packets++;
+		netdev->stats.rx_bytes += skb->len;
 
 		skb->protocol = htons(ETH_P_MCTP);
 		skb_reset_network_header(skb);
@@ -295,7 +297,6 @@ static void mctp_usb_netdev_setup(struct net_device *dev)
 	dev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
 	dev->flags = IFF_NOARP;
 	dev->netdev_ops = &mctp_usb_netdev_ops;
-	dev->pcpu_stat_type = NETDEV_PCPU_STAT_DSTATS;
 }
 
 static int mctp_usb_probe(struct usb_interface *intf,
-- 
2.39.5



More information about the openbmc mailing list