outlines the processing of data on the NIC driver, and then the flow of the packet continues down. The last function of the NIC driver is netif_receive_skb. Let's start with it. For the sake of simplicity, the pre-compiled code int netif_receive_skb(struct sk_buff *skb) (net/core/dev.c){struct packet_type *ptype, *pt_prev;int ret = NET_RX_DROP;unsigned short type;//received Timestamp if (!skb->stamp.tv_sec)net_timestamp(&skb->stamp);//If dev->master is present. Then update the corresponding pointer skb_bond(skb); //update the CPU's receiving statistics __get_cpu_var(netdev_rx_stat).total++;skb->h.raw = skb->nh.raw = skb->data;skb-> ;mac_len = skb->nh.raw - skb->mac.raw;pt_prev = NULL;rcu_read_lock();//Modules for all protocols list_for_each_entry_rcu(ptype, &ptype_all, list) {if (!ptype- >dev |
|
Ptype->dev == skb->dev) {if (pt_prev)
ret = deliver_skb(skb, pt_prev);pt_prev = ptype;}}//Slice processing handle_diverter(skb);//bridge processing if (handle_bridge(&skb, &pt_prev, &ret)) goto out; type = skb->protocol; //for the protocol call the corresponding module processing. List_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) {if (ptype->type == type &&(!ptype->dev |
|
Ptype->dev == skb->dev)) {if (pt_prev)
ret = deliver_skb(skb, pt_prev);pt_prev = ptype;}}if (pt_prev) {ret = pt_prev-> ;func(skb, skb->dev, pt_prev);} else {kfree_skb(skb);/* Jamal, now you will not able to escape explaining* me how you were going to use this. :-)*/ret = NET_RX_DROP;}out:rcu_read_unlock();return ret;} This function mainly completes fragment reassembly, bridge processing, and calls different transport layer processing modules according to different protocols. The focus of this section is to outline the implementation and processing of linux bridges. The transport layer protocol layering will be given in subsequent chapters. Enter the bridge processing code: #if defined(CONFIG_BRIDGE) |
|
Defined (CONFIG_BRIDGE_MODULE) (net/core/dev.c)int (*br_handle_frame_hook)(struct net_bridge_port *p, struct sk_buff **pskb);static __inline__ int handle_bridge(struct sk_buff **pskb,struct packet_type **pt_prev, int * Ret) {struct net_bridge_port *port; //loopback interface? Non-Ethernet interface? If ((*pskb)->pkt_type == PACKET_LOOPBACK |
|
(port = rcu_dereference((*pskb)->dev->br_port)) == NULL)return 0;if (*pt_prev) {*ret = deliver_skb(*pskb, *pt_prev);*pt_prev = NULL;}
//br_handle_frame_hook is a global function pointer return br_handle_frame_hook(port, pskb);}#else#define handle_bridge(skb, pt_prev, ret) (0)#endif can be seen from this. If the bridge mode is selected during compilation, it will enter the processing module of the bridge. Otherwise, it is just an empty function and returns directly. What is the function represented by br_handle_frame_hook? What is the data processing framework of the bridge? Ha ha. This is the problem that we are analyzing today.
STM32F103VCT6 comes with two 12-bit DAC, DAC conversion speed has not been found, some people say th
First time when the basic network configuration is 1. Check the network mac address first[root@cento
Linux kernel is very stable, but it is still inevitable to encounter a crash, get the memory image w
1. Disable root user login ssh #vi /etc/ssh/sshd_config Change PermitRootLogin yes to PermitRootLog
Discussion on fence devices in RHCS
Linux system command make, clean usage explain
Some powerful shell commands use basic tutorials
Linux instance recovery file deleted
View IO busy process ID under Linux
Parse the Linux root file system mount process
Deploy SSH application on Linux operating system
How to add/remove FTP users and set permissions in Linux?
Linux to the desktop still takes
How Win10 IE adds a website to the compatibility mode list
How to configure print server and printer under win 2003
What should I do if the win8 system DOS command prompt fails?
Win8 laptop wireless or wired network connection when prompted "network restricted" how to do
Win10 new browser Edge browser user manual
Mount command: Linux external storage media mounting method
Rune Master Raiders: Master advanced and props description
Windows System Disk Encryption Tutorial