LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-13-2006, 10:33 AM   #1
shrishailnk
Member
 
Registered: Mar 2006
Posts: 47

Rep: Reputation: 15
altering qdisc_restart


hello,

for some reasons i need to dequeue 'n' pkts to an array
and then transfer them .
To implement this i made following changes in qdisc_restart net/sched/sch_generic.h

But many errors while rebooting,
the error shows sequence of function calls starting frm
qdisc_restart
then,
kernel panic
interrupt - not syncing (i don remember exactly)

please help me, ( do i need to handle watch_dog_timers,
if i m delaying pkt delivery)

int qdisc_restart(struct net_device *dev)
{
struct Qdisc *q = dev->qdisc;
int no_pkt=4;
struct sk_buff *skb,*skbn[no_pkt];
int cnt=0;

/* Dequeue packet to an array */
printk("\n\n\n\n COLLECTING TO AN ARRAY: \n\n\n");

while(cnt<no_pkt) {
if ((skb = q->dequeue(q)) != NULL) {
/* collecting into an array*/
skbn[cnt++]=skb;
}
else
break;
}
spin_unlock(&dev->queue_lock);


/* no_pkt holds num of packets in the array skbn[]*/
no_pkt=cnt;
cnt=0;

/* send all the packets collected into the array */
while(cnt++<no_pkt) {
if (spin_trylock(&dev->xmit_lock)) {
/* Remember that the driver is grabbed by us. */
dev->xmit_lock_owner = smp_processor_id();

/*already released queue */
//spin_unlock(&dev->queue_lock);

if (!netif_queue_stopped(dev)) {
if (netdev_nit)
dev_queue_xmit_nit(skbn[cnt], dev);

if (dev->hard_start_xmit(skbn[cnt], dev) == 0) {
dev->xmit_lock_owner = -1;
spin_unlock(&dev->xmit_lock);

spin_lock(&dev->queue_lock);
return -1;
}

}

/* Release the driver */
dev->xmit_lock_owner = -1;
spin_unlock(&dev->xmit_lock);
spin_lock(&dev->queue_lock);
q = dev->qdisc;
} else {
/* So, someone grabbed the driver. */
/* It may be transient configuration error,
when hard_start_xmit() recurses. We detect
it by checking xmit owner and drop the
packet when deadloop is detected.
*/
if (dev->xmit_lock_owner == smp_processor_id()) {
kfree_skb(skbn[cnt]);
if (net_ratelimit())
printk(KERN_DEBUG "Dead loop on netdevice %s, fix it urgently!\n", dev->name);
return -1;
}
netdev_rx_stat[smp_processor_id()].cpu_collision++;
}

/* Device kicked us out
This is possible in three cases:

0. driver is locked
1. fastroute is enabled
2. device cannot determine busy state
before start of transmission (f.e. dialout)
3. device is buggy (ppp)
*/

q->ops->requeue(skbn[cnt], q);
netif_schedule(dev);
return 1;
}
return q->q.qlen;
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
qdisc_restart shrishailnk Programming 2 04-13-2006 07:51 AM
Altering cursor size dogpatch Programming 4 12-02-2005 01:57 AM
altering cd command, can it be done? glingon Linux - Software 9 11-24-2004 08:47 PM
altering .iso's adam_boz Linux - General 9 11-05-2002 10:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration