int(*read_status)(struct phy_device *phydev); int(*ack_interrupt)(struct phy_device *phydev); int(*config_intr)(struct phy_device *phydev); int(*did_interrupt)(struct phy_device *phydev); void(*remove)(struct phy_device *phydev); int(*match_phy_device)(struct phy_device *phydev...
nf_hook(proto, hooknum, net, skb, dev, in, out) staticinlineintnf_hook(u_int8_tpf,unsignedinthook, struct net *net,struct sock *sk, struct sk_buff *skb,struct net_device *indev, struct net_device *outdev,int(*okfn)(struct net *, struct sock *, struct sk_buff *)) { structnf...
9、对一个struct net_device以太网网络设备进行初始化: void ether_setup(struct net_device *dev); EXPORT_SYMBOL(ether_setup); 1conststructheader_ops eth_header_ops ___cacheline_aligned ={2.create =eth_header,3.parse =eth_header_parse,4.rebuild =eth_rebuild_header,5.cache =eth_header_cache...
int test_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *dev = (struct net_device *)ptr; switch(event) { caseNETDEV_UP: if(dev && dev->name) printk("dev[%s] is up\n",dev->name); break; caseNETDEV_DOWN: if(dev && dev->name)...
u8 tos, struct net_device *dev) { ... res = ip_route_input_slow(skb, daddr, saddr, tos, dev); returnres; } 这里记着 ip_route_input_slow 就行了,后面我们再看。 1.3 linux 路由小结 路由在内核协议栈中的位置可以用如下一张图来表示。
*/ u32 hash_mix; // lo 网络设备 struct net_device *loopback_dev; /* The loopback */ /* core fib_rules */ struct list_head rules_ops; struct netns_core core; struct netns_mib mib; struct netns_packet packet; struct netns_unix unx; struct netns_nexthop nexthop; struct netns_ipv4...
struct net_device *netdev; /* net device handle (wifi%d) */ struct net_device_stats devstats; /* net 
netdevice.h (include\linux): * LL_ALLOCATED_SPACE also takes into account the tailroom the device netdevice.h (include\linux):#define LL_ALLOCATED_SPACE(dev) \ netpoll.c (net\core): send_skb = find_skb(np, size + LL_ALLOCATED_SPACE(np->dev), ...
1.分配一个网络设备函数,即分配一个struct net_device结构体: alloc_netdev(sizeof_priv, name, setup); 这个alloc_netdev()函数本质上是一个宏定义: #define alloc_netdev(sizeof_priv, name, setup) \ alloc_netdev_mq(sizeof_priv, name, setup, 1) ...
int eth_header(struct sk_buff *skb, struct net_device *dev, u16 type, void *daddr, void *saddr, unsigned len) EXPORT_SYMBOL(eth_header); skb : 将要去修改的struct sk_buff; dev : 原网络设备 type: 网络层的协议类型 daddr:目的MAC地址 ...