hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/core/netpoll.c
....@@ -137,6 +137,20 @@
137137 }
138138 }
139139
140
+static int netif_local_xmit_active(struct net_device *dev)
141
+{
142
+ int i;
143
+
144
+ for (i = 0; i < dev->num_tx_queues; i++) {
145
+ struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
146
+
147
+ if (READ_ONCE(txq->xmit_lock_owner) == smp_processor_id())
148
+ return 1;
149
+ }
150
+
151
+ return 0;
152
+}
153
+
140154 static void poll_one_napi(struct napi_struct *napi)
141155 {
142156 int work;
....@@ -183,7 +197,10 @@
183197 if (!ni || down_trylock(&ni->dev_lock))
184198 return;
185199
186
- if (!netif_running(dev)) {
200
+ /* Some drivers will take the same locks in poll and xmit,
201
+ * we can't poll if local CPU is already in xmit.
202
+ */
203
+ if (!netif_running(dev) || netif_local_xmit_active(dev)) {
187204 up(&ni->dev_lock);
188205 return;
189206 }