[BUG/PATCH] CONFIG_NET_HW_FLOWCONTROL and SMP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




[I've already sent this mail to the linux-kernel mailing-list but
realized I should have sent it to linux-net. Sorry.]

Hi,
by testing the CONFIG_NET_HW_FLOWCONTROL (NIC Hardware throttling) on
a SMP system, I found a bug in net/core/dev.c : the netdev_dropping
variable can be set to a negative value (the result is that a CPU can
be locked in "throttle" state).
This bug seems to exist in 2.4 and in 2.6 kernels.

Here's a typical scenario :

- Throttling --> (CPU 0)queue->throttle==1 && (CPU 1)queue->throttle==1
     && netdev_dropping == 2
- 1st packet Unthrottle ( in net_rx_action() ), received by CPU 0
     --> (CPU 0)queue->throttle==1 && (CPU 1)queue->throttle==1
     && netdev_dropping == 1
- 2nd packet Unthrottle ( in net_rx_action() ), received by CPU 0
     --> (CPU 0)queue->throttle==0 && (CPU 1)queue->throttle==1
     && netdev_dropping == 0
- 3nd packet Unthrottle ( in net_rx_action() ), received by CPU 1
     --> (CPU 0)queue->throttle==0 && (CPU 1)queue->throttle==0
     && netdev_dropping == -1

and so on...

The problem is that the (CPU)queue->throttle should be set to zero every
time the netdev_dropping variable is decremented.


Here's a patch for the 2.4.19 kernel (tested with success) :

--- linux-2.4.19/net/core/dev.c.orig     Mon Sep 29 12:49:14 2003
+++ linux-2.4.19/net/core/dev.c    Tue Sep 23 18:35:35 2003
@@ -1519,8 +1519,8 @@

 #ifdef CONFIG_NET_HW_FLOWCONTROL
     if (queue->throttle && queue->input_pkt_queue.qlen < no_cong_thresh ) {
+         queue->throttle = 0;
          if (atomic_dec_and_test(&netdev_dropping)) {
-              queue->throttle = 0;
               netdev_wakeup();
               goto softnet_break;
          }




I haven't done a patch for 2.4.22 (as we currently use 2.4.19) but the same
modification should be applied around lines 1572 to 1577 of net/core/dev.c

For 2.6.0-test5, the lines to modified are arount 1631 to 1637.

Regards,
---
Daniel FAGES
ARKOON Network Security    http://www.arkoon.net


-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux