diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2005-06-23 23:10:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-23 23:10:00 -0400 |
commit | 34008d8c631d067caffa136313260525f3ae48a2 (patch) | |
tree | 171436c170fb7df649f8bf7cb95391f6d844bd03 | |
parent | c1ebcdb8c422cd73f54bcd2b9953e443a47667e5 (diff) |
[NET]: Remove obsolete netif_rx congestion sensing mechanism.
Remove the congestion sensing mechanism from netif_rx, and always
return either full or empty. Almost no driver checks the return value
from netif_rx, and those that do only use it for debug messages.
The original design of netif_rx was to do flow control based on the
receive queue, but NAPI has supplanted this and no driver uses the
feedback.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netdevice.h | 2 | ||||
-rw-r--r-- | net/core/dev.c | 88 | ||||
-rw-r--r-- | net/core/sysctl_net_core.c | 36 |
3 files changed, 1 insertions, 125 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c2e15e381a58..718ad579c65c 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -558,8 +558,6 @@ static inline int unregister_gifconf(unsigned int family) | |||
558 | struct softnet_data | 558 | struct softnet_data |
559 | { | 559 | { |
560 | int throttle; | 560 | int throttle; |
561 | int cng_level; | ||
562 | int avg_blog; | ||
563 | struct sk_buff_head input_pkt_queue; | 561 | struct sk_buff_head input_pkt_queue; |
564 | struct list_head poll_list; | 562 | struct list_head poll_list; |
565 | struct net_device *output_queue; | 563 | struct net_device *output_queue; |
diff --git a/net/core/dev.c b/net/core/dev.c index 4f1ae2efe872..3156df699f01 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -115,18 +115,6 @@ | |||
115 | #endif /* CONFIG_NET_RADIO */ | 115 | #endif /* CONFIG_NET_RADIO */ |
116 | #include <asm/current.h> | 116 | #include <asm/current.h> |
117 | 117 | ||
118 | /* This define, if set, will randomly drop a packet when congestion | ||
119 | * is more than moderate. It helps fairness in the multi-interface | ||
120 | * case when one of them is a hog, but it kills performance for the | ||
121 | * single interface case so it is off now by default. | ||
122 | */ | ||
123 | #undef RAND_LIE | ||
124 | |||
125 | /* Setting this will sample the queue lengths and thus congestion | ||
126 | * via a timer instead of as each packet is received. | ||
127 | */ | ||
128 | #undef OFFLINE_SAMPLE | ||
129 | |||
130 | /* | 118 | /* |
131 | * The list of packet types we will receive (as opposed to discard) | 119 | * The list of packet types we will receive (as opposed to discard) |
132 | * and the routines to invoke. | 120 | * and the routines to invoke. |
@@ -159,11 +147,6 @@ static DEFINE_SPINLOCK(ptype_lock); | |||
159 | static struct list_head ptype_base[16]; /* 16 way hashed list */ | 147 | static struct list_head ptype_base[16]; /* 16 way hashed list */ |
160 | static struct list_head ptype_all; /* Taps */ | 148 | static struct list_head ptype_all; /* Taps */ |
161 | 149 | ||
162 | #ifdef OFFLINE_SAMPLE | ||
163 | static void sample_queue(unsigned long dummy); | ||
164 | static struct timer_list samp_timer = TIMER_INITIALIZER(sample_queue, 0, 0); | ||
165 | #endif | ||
166 | |||
167 | /* | 150 | /* |
168 | * The @dev_base list is protected by @dev_base_lock and the rtln | 151 | * The @dev_base list is protected by @dev_base_lock and the rtln |
169 | * semaphore. | 152 | * semaphore. |
@@ -1365,69 +1348,10 @@ out: | |||
1365 | 1348 | ||
1366 | int netdev_max_backlog = 300; | 1349 | int netdev_max_backlog = 300; |
1367 | int weight_p = 64; /* old backlog weight */ | 1350 | int weight_p = 64; /* old backlog weight */ |
1368 | /* These numbers are selected based on intuition and some | ||
1369 | * experimentatiom, if you have more scientific way of doing this | ||
1370 | * please go ahead and fix things. | ||
1371 | */ | ||
1372 | int no_cong_thresh = 10; | ||
1373 | int no_cong = 20; | ||
1374 | int lo_cong = 100; | ||
1375 | int mod_cong = 290; | ||
1376 | 1351 | ||
1377 | DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, }; | 1352 | DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, }; |
1378 | 1353 | ||
1379 | 1354 | ||
1380 | static void get_sample_stats(int cpu) | ||
1381 | { | ||
1382 | #ifdef RAND_LIE | ||
1383 | unsigned long rd; | ||
1384 | int rq; | ||
1385 | #endif | ||
1386 | struct softnet_data *sd = &per_cpu(softnet_data, cpu); | ||
1387 | int blog = sd->input_pkt_queue.qlen; | ||
1388 | int avg_blog = sd->avg_blog; | ||
1389 | |||
1390 | avg_blog = (avg_blog >> 1) + (blog >> 1); | ||
1391 | |||
1392 | if (avg_blog > mod_cong) { | ||
1393 | /* Above moderate congestion levels. */ | ||
1394 | sd->cng_level = NET_RX_CN_HIGH; | ||
1395 | #ifdef RAND_LIE | ||
1396 | rd = net_random(); | ||
1397 | rq = rd % netdev_max_backlog; | ||
1398 | if (rq < avg_blog) /* unlucky bastard */ | ||
1399 | sd->cng_level = NET_RX_DROP; | ||
1400 | #endif | ||
1401 | } else if (avg_blog > lo_cong) { | ||
1402 | sd->cng_level = NET_RX_CN_MOD; | ||
1403 | #ifdef RAND_LIE | ||
1404 | rd = net_random(); | ||
1405 | rq = rd % netdev_max_backlog; | ||
1406 | if (rq < avg_blog) /* unlucky bastard */ | ||
1407 | sd->cng_level = NET_RX_CN_HIGH; | ||
1408 | #endif | ||
1409 | } else if (avg_blog > no_cong) | ||
1410 | sd->cng_level = NET_RX_CN_LOW; | ||
1411 | else /* no congestion */ | ||
1412 | sd->cng_level = NET_RX_SUCCESS; | ||
1413 | |||
1414 | sd->avg_blog = avg_blog; | ||
1415 | } | ||
1416 | |||
1417 | #ifdef OFFLINE_SAMPLE | ||
1418 | static void sample_queue(unsigned long dummy) | ||
1419 | { | ||
1420 | /* 10 ms 0r 1ms -- i don't care -- JHS */ | ||
1421 | int next_tick = 1; | ||
1422 | int cpu = smp_processor_id(); | ||
1423 | |||
1424 | get_sample_stats(cpu); | ||
1425 | next_tick += jiffies; | ||
1426 | mod_timer(&samp_timer, next_tick); | ||
1427 | } | ||
1428 | #endif | ||
1429 | |||
1430 | |||
1431 | /** | 1355 | /** |
1432 | * netif_rx - post buffer to the network code | 1356 | * netif_rx - post buffer to the network code |
1433 | * @skb: buffer to post | 1357 | * @skb: buffer to post |
@@ -1476,11 +1400,8 @@ int netif_rx(struct sk_buff *skb) | |||
1476 | enqueue: | 1400 | enqueue: |
1477 | dev_hold(skb->dev); | 1401 | dev_hold(skb->dev); |
1478 | __skb_queue_tail(&queue->input_pkt_queue, skb); | 1402 | __skb_queue_tail(&queue->input_pkt_queue, skb); |
1479 | #ifndef OFFLINE_SAMPLE | ||
1480 | get_sample_stats(this_cpu); | ||
1481 | #endif | ||
1482 | local_irq_restore(flags); | 1403 | local_irq_restore(flags); |
1483 | return queue->cng_level; | 1404 | return NET_RX_SUCCESS; |
1484 | } | 1405 | } |
1485 | 1406 | ||
1486 | if (queue->throttle) | 1407 | if (queue->throttle) |
@@ -3300,8 +3221,6 @@ static int __init net_dev_init(void) | |||
3300 | queue = &per_cpu(softnet_data, i); | 3221 | queue = &per_cpu(softnet_data, i); |
3301 | skb_queue_head_init(&queue->input_pkt_queue); | 3222 | skb_queue_head_init(&queue->input_pkt_queue); |
3302 | queue->throttle = 0; | 3223 | queue->throttle = 0; |
3303 | queue->cng_level = 0; | ||
3304 | queue->avg_blog = 10; /* arbitrary non-zero */ | ||
3305 | queue->completion_queue = NULL; | 3224 | queue->completion_queue = NULL; |
3306 | INIT_LIST_HEAD(&queue->poll_list); | 3225 | INIT_LIST_HEAD(&queue->poll_list); |
3307 | set_bit(__LINK_STATE_START, &queue->backlog_dev.state); | 3226 | set_bit(__LINK_STATE_START, &queue->backlog_dev.state); |
@@ -3310,11 +3229,6 @@ static int __init net_dev_init(void) | |||
3310 | atomic_set(&queue->backlog_dev.refcnt, 1); | 3229 | atomic_set(&queue->backlog_dev.refcnt, 1); |
3311 | } | 3230 | } |
3312 | 3231 | ||
3313 | #ifdef OFFLINE_SAMPLE | ||
3314 | samp_timer.expires = jiffies + (10 * HZ); | ||
3315 | add_timer(&samp_timer); | ||
3316 | #endif | ||
3317 | |||
3318 | dev_boot_phase = 0; | 3232 | dev_boot_phase = 0; |
3319 | 3233 | ||
3320 | open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL); | 3234 | open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL); |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 76e9987474ca..fff63643a35c 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -14,10 +14,6 @@ | |||
14 | 14 | ||
15 | extern int netdev_max_backlog; | 15 | extern int netdev_max_backlog; |
16 | extern int weight_p; | 16 | extern int weight_p; |
17 | extern int no_cong_thresh; | ||
18 | extern int no_cong; | ||
19 | extern int lo_cong; | ||
20 | extern int mod_cong; | ||
21 | extern int net_msg_cost; | 17 | extern int net_msg_cost; |
22 | extern int net_msg_burst; | 18 | extern int net_msg_burst; |
23 | 19 | ||
@@ -85,38 +81,6 @@ ctl_table core_table[] = { | |||
85 | .proc_handler = &proc_dointvec | 81 | .proc_handler = &proc_dointvec |
86 | }, | 82 | }, |
87 | { | 83 | { |
88 | .ctl_name = NET_CORE_NO_CONG_THRESH, | ||
89 | .procname = "no_cong_thresh", | ||
90 | .data = &no_cong_thresh, | ||
91 | .maxlen = sizeof(int), | ||
92 | .mode = 0644, | ||
93 | .proc_handler = &proc_dointvec | ||
94 | }, | ||
95 | { | ||
96 | .ctl_name = NET_CORE_NO_CONG, | ||
97 | .procname = "no_cong", | ||
98 | .data = &no_cong, | ||
99 | .maxlen = sizeof(int), | ||
100 | .mode = 0644, | ||
101 | .proc_handler = &proc_dointvec | ||
102 | }, | ||
103 | { | ||
104 | .ctl_name = NET_CORE_LO_CONG, | ||
105 | .procname = "lo_cong", | ||
106 | .data = &lo_cong, | ||
107 | .maxlen = sizeof(int), | ||
108 | .mode = 0644, | ||
109 | .proc_handler = &proc_dointvec | ||
110 | }, | ||
111 | { | ||
112 | .ctl_name = NET_CORE_MOD_CONG, | ||
113 | .procname = "mod_cong", | ||
114 | .data = &mod_cong, | ||
115 | .maxlen = sizeof(int), | ||
116 | .mode = 0644, | ||
117 | .proc_handler = &proc_dointvec | ||
118 | }, | ||
119 | { | ||
120 | .ctl_name = NET_CORE_MSG_COST, | 84 | .ctl_name = NET_CORE_MSG_COST, |
121 | .procname = "message_cost", | 85 | .procname = "message_cost", |
122 | .data = &net_msg_cost, | 86 | .data = &net_msg_cost, |