Registering Network Device Driver’s Routines

dev_hard_start_xmit() is the beginning of the all device specific transmission routines. Device specific routines are executed asynchonously by the kernel. Such routines are callbacks defined in the network device driver’s codes. For Realtek devices we a have structure like this one:

static const struct net_device_ops rtl_netdev_ops = {
 .ndo_open = rtl_open,
 .ndo_stop = rtl8169_close,
 .ndo_get_stats64 = rtl8169_get_stats64,
 .ndo_start_xmit = rtl8169_start_xmit,
 .ndo_tx_timeout = rtl8169_tx_timeout,
 .ndo_validate_addr = eth_validate_addr,
 .ndo_change_mtu = rtl8169_change_mtu,
 .ndo_fix_features = rtl8169_fix_features,
 .ndo_set_features = rtl8169_set_features,
 .ndo_set_mac_address = rtl_set_mac_address,
 .ndo_do_ioctl = rtl8169_ioctl,
 .ndo_set_rx_mode = rtl_set_rx_mode,
 .ndo_poll_controller = rtl8169_netpoll,

Similarly, we would have something like that for virtual Ethernet drivers (veth) and other ones in the Linux kernel.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s