|
@@ -115,18 +115,6 @@
|
|
|
#endif /* CONFIG_NET_RADIO */
|
|
|
#include <asm/current.h>
|
|
|
|
|
|
-/* This define, if set, will randomly drop a packet when congestion
|
|
|
- * is more than moderate. It helps fairness in the multi-interface
|
|
|
- * case when one of them is a hog, but it kills performance for the
|
|
|
- * single interface case so it is off now by default.
|
|
|
- */
|
|
|
-#undef RAND_LIE
|
|
|
-
|
|
|
-/* Setting this will sample the queue lengths and thus congestion
|
|
|
- * via a timer instead of as each packet is received.
|
|
|
- */
|
|
|
-#undef OFFLINE_SAMPLE
|
|
|
-
|
|
|
/*
|
|
|
* The list of packet types we will receive (as opposed to discard)
|
|
|
* and the routines to invoke.
|
|
@@ -159,11 +147,6 @@ static DEFINE_SPINLOCK(ptype_lock);
|
|
|
static struct list_head ptype_base[16]; /* 16 way hashed list */
|
|
|
static struct list_head ptype_all; /* Taps */
|
|
|
|
|
|
-#ifdef OFFLINE_SAMPLE
|
|
|
-static void sample_queue(unsigned long dummy);
|
|
|
-static struct timer_list samp_timer = TIMER_INITIALIZER(sample_queue, 0, 0);
|
|
|
-#endif
|
|
|
-
|
|
|
/*
|
|
|
* The @dev_base list is protected by @dev_base_lock and the rtln
|
|
|
* semaphore.
|
|
@@ -1365,69 +1348,10 @@ out:
|
|
|
|
|
|
int netdev_max_backlog = 300;
|
|
|
int weight_p = 64; /* old backlog weight */
|
|
|
-/* These numbers are selected based on intuition and some
|
|
|
- * experimentatiom, if you have more scientific way of doing this
|
|
|
- * please go ahead and fix things.
|
|
|
- */
|
|
|
-int no_cong_thresh = 10;
|
|
|
-int no_cong = 20;
|
|
|
-int lo_cong = 100;
|
|
|
-int mod_cong = 290;
|
|
|
|
|
|
DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, };
|
|
|
|
|
|
|
|
|
-static void get_sample_stats(int cpu)
|
|
|
-{
|
|
|
-#ifdef RAND_LIE
|
|
|
- unsigned long rd;
|
|
|
- int rq;
|
|
|
-#endif
|
|
|
- struct softnet_data *sd = &per_cpu(softnet_data, cpu);
|
|
|
- int blog = sd->input_pkt_queue.qlen;
|
|
|
- int avg_blog = sd->avg_blog;
|
|
|
-
|
|
|
- avg_blog = (avg_blog >> 1) + (blog >> 1);
|
|
|
-
|
|
|
- if (avg_blog > mod_cong) {
|
|
|
- /* Above moderate congestion levels. */
|
|
|
- sd->cng_level = NET_RX_CN_HIGH;
|
|
|
-#ifdef RAND_LIE
|
|
|
- rd = net_random();
|
|
|
- rq = rd % netdev_max_backlog;
|
|
|
- if (rq < avg_blog) /* unlucky bastard */
|
|
|
- sd->cng_level = NET_RX_DROP;
|
|
|
-#endif
|
|
|
- } else if (avg_blog > lo_cong) {
|
|
|
- sd->cng_level = NET_RX_CN_MOD;
|
|
|
-#ifdef RAND_LIE
|
|
|
- rd = net_random();
|
|
|
- rq = rd % netdev_max_backlog;
|
|
|
- if (rq < avg_blog) /* unlucky bastard */
|
|
|
- sd->cng_level = NET_RX_CN_HIGH;
|
|
|
-#endif
|
|
|
- } else if (avg_blog > no_cong)
|
|
|
- sd->cng_level = NET_RX_CN_LOW;
|
|
|
- else /* no congestion */
|
|
|
- sd->cng_level = NET_RX_SUCCESS;
|
|
|
-
|
|
|
- sd->avg_blog = avg_blog;
|
|
|
-}
|
|
|
-
|
|
|
-#ifdef OFFLINE_SAMPLE
|
|
|
-static void sample_queue(unsigned long dummy)
|
|
|
-{
|
|
|
-/* 10 ms 0r 1ms -- i don't care -- JHS */
|
|
|
- int next_tick = 1;
|
|
|
- int cpu = smp_processor_id();
|
|
|
-
|
|
|
- get_sample_stats(cpu);
|
|
|
- next_tick += jiffies;
|
|
|
- mod_timer(&samp_timer, next_tick);
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* netif_rx - post buffer to the network code
|
|
|
* @skb: buffer to post
|
|
@@ -1476,11 +1400,8 @@ int netif_rx(struct sk_buff *skb)
|
|
|
enqueue:
|
|
|
dev_hold(skb->dev);
|
|
|
__skb_queue_tail(&queue->input_pkt_queue, skb);
|
|
|
-#ifndef OFFLINE_SAMPLE
|
|
|
- get_sample_stats(this_cpu);
|
|
|
-#endif
|
|
|
local_irq_restore(flags);
|
|
|
- return queue->cng_level;
|
|
|
+ return NET_RX_SUCCESS;
|
|
|
}
|
|
|
|
|
|
if (queue->throttle)
|
|
@@ -3300,8 +3221,6 @@ static int __init net_dev_init(void)
|
|
|
queue = &per_cpu(softnet_data, i);
|
|
|
skb_queue_head_init(&queue->input_pkt_queue);
|
|
|
queue->throttle = 0;
|
|
|
- queue->cng_level = 0;
|
|
|
- queue->avg_blog = 10; /* arbitrary non-zero */
|
|
|
queue->completion_queue = NULL;
|
|
|
INIT_LIST_HEAD(&queue->poll_list);
|
|
|
set_bit(__LINK_STATE_START, &queue->backlog_dev.state);
|
|
@@ -3310,11 +3229,6 @@ static int __init net_dev_init(void)
|
|
|
atomic_set(&queue->backlog_dev.refcnt, 1);
|
|
|
}
|
|
|
|
|
|
-#ifdef OFFLINE_SAMPLE
|
|
|
- samp_timer.expires = jiffies + (10 * HZ);
|
|
|
- add_timer(&samp_timer);
|
|
|
-#endif
|
|
|
-
|
|
|
dev_boot_phase = 0;
|
|
|
|
|
|
open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL);
|