Hi Michael Renzmann; On Thu, 29 Jan 2004, Michael Renzmann wrote: > Is it possible, either for the device driver itself or for a userspace > program, to get information about how many packets are currently queued > for a given network interface? Yes, if a small extension to the scheduler in question is carried out. You may add a variable counting packets in the enqueue () and dequeue(), and either write this to the /proc file system or poll the result with the help from tc. Look at sch_fifo.c, it counts packets in the queue. But it does not report it any further. Lars > > Let's describe it a little more in detail: > > I have a network interface eth0 in my linux box. Now I apply traffic > shaping to that interface, for example the outgoing traffic is shaped > down to 1 MBit/s. There is an application that creates packets which are > meant to be sent out via eth0, and the application creates its packets > with a much higher rate than 1 MBit/s. This would result in the shaper > enqueuing packets for eth0 and, sooner or later, in dropping some of the > packets if the queue is full. > > So I want to slow down the rate at which the application creates its > packets. The easiest way would be to take a look at the "traffic > control" queues for eth0 and check their current state. When the queue > is filled up to a specified level, the application should stop creation > of new packets until the queue has been emptied. (*) > > So, is there any way for my application to check the state of the > eth0-queues? Or is this possible for the driver of eth0 (as I'm in > control of this driver, I could implement a way to pass the needed > information down to the application if necessary)? > > Next question: if I understood the concepts of the "traffic control" > system correctly, one could add several queues to a single device. Is > there any way to simply get the total amount of packets that are waiting > in all attached queues? Or would I need to check each queue and sum up > the values? Using class based queuing you may isolate each queue from each other and count packets each queue holds. On the other hand, if you want the total amount of queued packets, then a global variable would help you. > And last question: what kind of information can I get about the > currently enqueued packets? Just the amount of packets that are > enqueued, or only the amount of enqueued bytes, or both? You may obtain both. > I'd appreciate any kind of help very much. Pointers to existing > documentation welcome - I didn't find the answers in the docs I found, > but maybe I just didn't search well enough (or in the wrong places)? > > Thanks in advance. > > Bye, Mike > > (*) In other words: I want to have the effects of slowing down the > traffic generation of my application without having to care about the > actual implementation of the traffic shaping. In my special case this > makes sense and would save me a lot of work. > > _______________________________________________ > LARTC mailing list / LARTC@xxxxxxxxxxxxxxx > http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/ > _______________________________________________ LARTC mailing list / LARTC@xxxxxxxxxxxxxxx http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/