On Sun, 15 Nov 1998, Olaf Meyer wrote: > I'm modfying the WaveLAN ethernet device driver in order > to get some Quality of Service guarantees. To this end > I have to control the timing when packets get transmitted. > I therefore cannot transmit packets when net_bh wants > to transmit them. > > I first tried returning 1 from the hard_start_xmit routine > and then resending packets at a later point similar to > dev_tint. This did not work, since I did not set the > tbusy flag. Thanks to Kaz and Alan, who pointed this > out to me :-) The tbusy flag isn't the only secret. :) In older kernels, you had to set a special flag, skb->free, in a newly allocated struct sk_buff. Failing to set this flag to 1 results in a kernel memory leak because the buffer won't be freed properly. I believe this behavior is gone in recent kernels, but it's still there in 2.0. Watch out!!! > I'm now trying to figure out a more sophisticated way > of doing this. I think setting the tbusy flag and returning 1 > is a bad idea as well. It's not necessarily bad. You can adopt a strategy whereby after each transmission, you set the driver to tbusy=1 indefinitely. Then, in the logic of a special timer function, you can decide to ``unbusy'' the driver and then do a mark_bh(NET_BH). Of course, timer functions can't be called more than once every jiffy! So this strategy would set an upper limit your packet sending rate. > Can I do the following? When hard_start_xmit gets called > and I want to delay the transmission, can I just return 0, > but not free the skb yet? I then put it on a list, Yes, absolutely! > which I maintain on my own. I then send it at a later time > and free the skb. Is there anything wrong with this approach? Not at all. Your driver owns the packet once it returns zero. You can do anything with it you want. You should put a reasonable upper limit on the length of the list, or you could cause memory overruns. When that upper limit is reached, set tbusy = 1 and don't accept any more packets. Then when your list reaches some low water mark, set tbusy = 0 and mark_bh(NET_BH) to have more packets kicked down to your hard_xmit function. - To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to [EMAIL PROTECTED]