Chapter 3 : Network Device Driver

  1. Write a Linux kernel module to implement a network device driver; Use below APIs

    alloc_netdev_mqs
    register_netdevice
    
    struct net_device_ops ndd_dev_ops = {
            .ndo_open               = ndd_open,
            .ndo_stop               = ndd_stop,
            .ndo_uninit             = ndd_uninit,
            .ndo_start_xmit         = ndd_start_xmit,
            .ndo_set_rx_mode        = ndd_set_multicast_list,
            .ndo_set_mac_address    = ndd_change_mac,
            .ndo_select_queue       = ndd_netdev_select_queue,
            .ndo_get_stats64        = ndd_get_stats64,
    };
    
    unregister_netdevice
    
    register_netdevice_notifier
    unregister_netdevice_notifier
    
    register_inetaddr_notifier
    register_inet6addr_notifier
    
    unregister_inetaddr_notifier
    unregister_inet6addr_notifier
    
    netif_carrier_on
    netif_carrier_off
    
    netif_wake_subqueue
    netif_start_subqueue
    netif_stop_subqueue
    
    netif_tx_start_all_queues
    netif_tx_stop_all_queues
    
    netif_addr_lock_bh
    netif_addr_unlock_bh
    
  2. Write a Linux network device driver which implements a SKB Queue * Perform insertion, deletion of a node into this SKB queue via /proc * Perform display of this SKB queue via /proc

    __skb_queue_head_init
    skb_queue_head
    skb_queue_tail
    skb_dequeue
    __skb_unlink
    __skb_queue_purge
    
    skb_queue_len
    skb_get_queue_mapping
    skb_queue_is_last
    skb_queue_walk
    skb_queue_walk_safe
    skb_queue_next
    skb_queue_empty
    skb_queue_splice_init
    skb_queue_splice_tail_init
    skb_peek
    skb_peek_tail
    skb_list_walk_safe
    
    skb_mark_not_on_list
    kfree_skb_list
    
  3. Write a Linux network device driver to perform SKB operations to transmit & recieve a packet

    dev_alloc_skb
    skb_reserve
    skb_pull
    skb_put
    skb_put_data
    skb_put_zero
    skb_push
    skb_trim
    skb_tailroom
    skb_clone
    skb_cloned
    skb_copy
    skb_headroom
    skb_set_mac_header
    skb_set_network_header
    skb_set_transport_header
    skb_reset_mac_header
    
    netif_receive_skb
    netif_rx