Linux Network card driver programming (1)

Source: Internet
Author: User

One. Network Card driver Architecture analysis

1. Linux Network Subsystem

#系统调用接口层

Provides a unified way for applications to access the network subsystem.

#协议无关层

Provides a common way to use the Transport layer protocol.

#协议栈的实现

Implementing a specific network protocol

#设备无关层

Common interface for protocol and device-driven communication

#设备驱动程序

2. Important Data structures

2.1 Network card description structure

In the Linux kernel, each NIC is described by a "net_device" structure, and some of the key members are:

#char Name[ifnamsiz]

Device name, such as: eth%d

#unsigned Long Base_addr

I/O base Address

#const struct Net_device_ops *netdev_ops;

2.2 Network card Operation Collection

Description: Similar to the file_operations structure in character device drivers, the NET_DEVICE_OPS structure records the operations supported by the NIC.

static const struct Net_device_ops Dm9000_netdev_ops =

{

. ndo_open= Dm9000_open,

. ndo_stop= Dm9000_stop,

. ndo_start_xmit= Dm9000_start_xmit,

. ndo_do_ioctl= Dm9000_ioctl,

. ndo_validate_addr= Eth_validate_addr,

. ndo_set_mac_address= Eth_mac_addr,

};

2.3 Network Packets

Each network packet in the Linux kernel is described by a socket buffer struct struct sk_buff,

That is, a SK_BUFF structure is a network packet, and pointers to Sk_buff are often called SKB.

3. Network Card driver Architecture analysis

1. cs8900.c

     

Linux Network card driver programming (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.