aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
diff options
context:
space:
mode:
authorYunsheng Lin <linyunsheng@huawei.com>2021-03-29 11:57:53 +0800
committerDavid S. Miller <davem@davemloft.net>2021-03-29 13:21:01 -0700
commit97b9e5c131f16e2e487139ba596f9e6df927ae87 (patch)
tree4903660ca6c15d25af0436b3e4f046b97df5c703 /drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
parentnet: hns3: expand the tc config command (diff)
downloadlinux-dev-97b9e5c131f16e2e487139ba596f9e6df927ae87.tar.xz
linux-dev-97b9e5c131f16e2e487139ba596f9e6df927ae87.zip
net: hns3: add stats logging when skb padding fails
skb_put_padto() may fails because of memory failure, sw_err_cnt is already used to log memory failure in hns3_skb_linearize(), so use it to log the memory failure for skb_put_padto() too. Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns3/hns3_enet.c')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_enet.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 5e08ac9fac7c..f59cd719b5b4 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -1567,6 +1567,11 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
/* Hardware can only handle short frames above 32 bytes */
if (skb_put_padto(skb, HNS3_MIN_TX_LEN)) {
hns3_tx_doorbell(ring, 0, !netdev_xmit_more());
+
+ u64_stats_update_begin(&ring->syncp);
+ ring->stats.sw_err_cnt++;
+ u64_stats_update_end(&ring->syncp);
+
return NETDEV_TX_OK;
}