Re: questions about network device drivers

Alan Cox (alan@lxorguk.ukuu.org.uk)
30 Jul 2002 16:48:46 +0100


On Tue, 2002-07-30 at 15:15, Abraham vd Merwe wrote:
> hard_start_xmit() method
> ========================
>
> when should this function return 0 and when should it return 1 and in which
> cases should it do netif_stop_queue() and/or free the dev_kfree_skb() ?

0 - OK
1 - I am busy, give me it later.

If you return 1 be sure to netif_stop_queue. The netif_wake_queue will
continue transmission

> is there any way to control alignment of sk_buff's that gets passed to this
> function? e.g. if I want the buffer to be aligned on 16-bit boundary and/or
> be padded to a 16-bit boundary - is there any way to tell the kernel to pass
> the driver buffers with those characterestics?

There is not. You can expect just about every packet to be 16bit aligned

> when errors occur that have details error fields in the net_device_stats
> structure, am I supposed to increment both the total error count and the
> detailed error count or both? also, what about dropped packets?

total and specific error.

dropped - not sure. Its not a precise science since cards vary
themselves how their hardware accounts such things

> tx_timeout() method
> =================
>
> there is no way to return an error in the tx_timeout method. what should I
> do when an error occurs in that function (e.g. I'm unable to reset the
> controller)? panic? that seems a bit excessive...

Try again ? If that fails I guess you initiate the self destruct
sequence for just that driver.

>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/