| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From 7207c6eaead4fbcf6dfec2a185550cd30aba5071 Mon Sep 17 00:00:00 2001 |
| 2 | From: Camelia Groza <camelia.groza@nxp.com> |
| 3 | Date: Thu, 7 Sep 2017 14:49:09 +0300 |
| 4 | Subject: [PATCH] sdk_dpaa: update the xmit timestamp to avoid watchdog |
| 5 | timeouts |
| 6 | |
| 7 | Update txq0's trans_start in order to prevent the netdev watchdog from |
| 8 | triggering too quickly. Since we set the LLTX flag, the stack won't update |
| 9 | the jiffies for other tx queues. Prevent the watchdog from checking the |
| 10 | other tx queues by adding the NETIF_HW_ACCEL_MQ flag. |
| 11 | |
| 12 | Signed-off-by: Camelia Groza <camelia.groza@nxp.com> |
| 13 | --- |
| 14 | drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c | 3 +++ |
| 15 | drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c | 1 + |
| 16 | include/linux/netdev_features.h | 2 ++ |
| 17 | net/sched/sch_generic.c | 7 +++++++ |
| 18 | 4 files changed, 13 insertions(+) |
| 19 | |
| 20 | --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c |
| 21 | +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c |
| 22 | @@ -772,6 +772,9 @@ static int dpa_private_netdev_init(struc |
| 23 | /* Advertise GRO support */ |
| 24 | net_dev->features |= NETIF_F_GRO; |
| 25 | |
| 26 | + /* Advertise NETIF_F_HW_ACCEL_MQ to avoid Tx timeout warnings */ |
| 27 | + net_dev->features |= NETIF_F_HW_ACCEL_MQ; |
| 28 | + |
| 29 | return dpa_netdev_init(net_dev, mac_addr, tx_timeout); |
| 30 | } |
| 31 | |
| 32 | --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c |
| 33 | +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c |
| 34 | @@ -1140,6 +1140,7 @@ int __hot dpa_tx_extended(struct sk_buff |
| 35 | if (unlikely(dpa_xmit(priv, percpu_stats, &fd, egress_fq, conf_fq) < 0)) |
| 36 | goto xmit_failed; |
| 37 | |
| 38 | + netif_trans_update(net_dev); |
| 39 | return NETDEV_TX_OK; |
| 40 | |
| 41 | xmit_failed: |
| 42 | --- a/include/linux/netdev_features.h |
| 43 | +++ b/include/linux/netdev_features.h |
| 44 | @@ -77,6 +77,7 @@ enum { |
| 45 | NETIF_F_RX_UDP_TUNNEL_PORT_BIT, /* Offload of RX port for UDP tunnels */ |
| 46 | NETIF_F_HW_TLS_TX_BIT, /* Hardware TLS TX offload */ |
| 47 | NETIF_F_HW_TLS_RX_BIT, /* Hardware TLS RX offload */ |
| 48 | + NETIF_F_HW_ACCEL_MQ_BIT, /* Hardware-accelerated multiqueue */ |
| 49 | |
| 50 | NETIF_F_GRO_HW_BIT, /* Hardware Generic receive offload */ |
| 51 | NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */ |
| 52 | @@ -150,6 +151,7 @@ enum { |
| 53 | #define NETIF_F_GSO_UDP_L4 __NETIF_F(GSO_UDP_L4) |
| 54 | #define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX) |
| 55 | #define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX) |
| 56 | +#define NETIF_F_HW_ACCEL_MQ __NETIF_F(HW_ACCEL_MQ) |
| 57 | |
| 58 | /* Finds the next feature with the highest number of the range of start-1 till 0. |
| 59 | */ |
| 60 | --- a/net/sched/sch_generic.c |
| 61 | +++ b/net/sched/sch_generic.c |
| 62 | @@ -465,6 +465,13 @@ static void dev_watchdog(struct timer_li |
| 63 | txq->trans_timeout++; |
| 64 | break; |
| 65 | } |
| 66 | + |
| 67 | + /* Devices with HW_ACCEL_MQ have multiple txqs |
| 68 | + * but update only the first one's transmission |
| 69 | + * timestamp so avoid checking the rest. |
| 70 | + */ |
| 71 | + if (dev->features & NETIF_F_HW_ACCEL_MQ) |
| 72 | + break; |
| 73 | } |
| 74 | |
| 75 | if (some_queue_timedout) { |