linux device drivers 2nd edition phần 9

đặc biệt là nếu dữ liệu được chuyển giao sẽ không được sử dụng một lần nữa trong tương lai gần. Ví dụ, sao lưu đĩa thường đọc rất nhiều dữ liệu từ đĩa một cách chính xác một lần, sau đó quên nó. Chạy bản sao lưu thông qua một giao diện thô sẽ tránh điền vào các hệ thống với bộ đệm cache dữ liệu vô ích. | MAC Address Resolution error memory corruption is so harmful to the system that the developers decided to take definitive action. In practice you shouldn t need to check the available space if the buffer has been correctly allocated. Since drivers usually get the packet size before allocating a buffer only a severely broken driver will put too much data in the buffer and a panic might be seen as due punishment. int skb_headroom struct sk_buff skb Returns the amount of space available in front of data that is how many octets one can push to the buffer. void skb_reserve struct sk_buff skb int len This function increments both data and tail. The function can be used to reserve headroom before filling the buffer. Most Ethernet interfaces reserve 2 bytes in front of the packet thus the IP header is aligned on a 16-byte boundary after a 14-byte Ethernet header. snull does this as well although the instruction was not shown in Packet Reception to avoid introducing extra concepts at that point. unsigned char skb_pull struct sk_buff skb int len Removes data from the head of the packet. The driver won t need to use this function but it is included here for completeness. It decrements skb- len and increments skb- data this is how the hardware header Ethernet or equivalent is stripped from the beginning of incoming packets. The kernel defines several other functions that act on socket buffers but they are meant to be used in higher layers of networking code and the driver won t need them. MAC Address Resolution An interesting issue with Ethernet communication is how to associate the MAC addresses the interface s unique hardware ID with the IP number. Most protocols have a similar problem but we concentrate on the Ethernet-like case here. We ll try to offer a complete description of the issue so we will show three situations ARP Ethernet headers without ARP like plp and non-Ethernet headers. Using ARP with Ethernet The usual way to deal with address resolution is by using ARP .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
48    85    2    22-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.