2008年8月12日 星期二

wireless traffic have higher priority than eth0 traffic on linux-2.6.16

Situation:

test0

bridge eth0+ra0(ap mode), vsftp+IDE HD, linux-2.6.16,
wireless client access ftp server on LAN (wireless->bridge->eth0, bridge traffic, all in kernel mode)
3 client from eth0 access ftp server on the DUT (eth0->bridge->localhost, localhost traffic, user mode involved)

Wireless traffic seems have high priority to those from eth0. Wireless traffic takes all the bandwidth that it need, eth0 traffic can only take the rest.


test1
wireless client access ftp server on the DUT => all traffic are localhost traffic. But wireless traffic seems have the same problem.


test2: Redo test0 and test1 with linux-2.6.24.
test0: wireless traffic is higher than eth0 traffic, but not all.
test1: wireless and eth0 traffic share the traffic bandwidth averagely.


It's seems like some kind of scheduling problem, that 2.6.24 doesn't have.
But share all bandwidth averagely is not what our customer want, they want the localhost access get the hightest priority.

Solution
user mode
an user mode application to limit the wireless data rate to some point with respect to the number of ftp server access count of localhost.

reference netmon-0.2, sysmon-0.1

kernel mode
Queue the bridge traffic, let the localhost traffic go directly. Transmit the packets in the queue ONLY IF we have spare bandwidth.

reference
linux-2.6.16/net/core/netpoll.c
static void queue_process(void *p)
{
unsigned long flags;
struct sk_buff *skb;

while (queue_head) {
spin_lock_irqsave(&queue_lock, flags);

skb = queue_head;
queue_head = skb->next;
if (skb == queue_tail)
queue_head = NULL;

queue_depth--;

spin_unlock_irqrestore(&queue_lock, flags);

dev_queue_xmit(skb);
}
}

static DECLARE_WORK(send_queue, queue_process, NULL);

沒有留言: