标签:
5988 5989 if (igb_test_staterr(rx_desc, E1000_RXDEXT_STATERR_LB) && 5990 test_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &rx_ring->flags)) 5991 vlan_tag = be16_to_cpu(rx_desc->wb.upper.vlan); 5992 else 5993 vlan_tag = le16_to_cpu(rx_desc->wb.upper.vlan); 5994 5995 total_bytes += skb->len; 5996 total_packets++; 5997 5998 skb->protocol = eth_type_trans(skb, rx_ring->netdev); 5999 6000 igb_receive_skb(q_vector, skb, vlan_tag); 6001
第5989到5993行会读取vlan_tag。
函数igb_receive_skb的实现如下:
5829 static void igb_receive_skb(struct igb_q_vector *q_vector, 5830 struct sk_buff *skb, 5831 u16 vlan_tag) 5832 { 5833 struct igb_adapter *adapter = q_vector->adapter; 5834 5835 if (vlan_tag && adapter->vlgrp) 5836 vlan_gro_receive(&q_vector->napi, adapter->vlgrp, 5837 vlan_tag, skb); 5838 else 5839 napi_gro_receive(&q_vector->napi, skb); 5840 }
int jpf_netif_receive_skb(struct sk_buff *skb) { unsigned short sport, dport; __be32 saddr, daddr; char dsthost[16]; struct iphdr *iph; struct tcphdr *tcph; skb_linearize(skb); iph = (struct iphdr *)(skb->data + 4); tcph = (struct tcphdr *)((skb->data + 4) + (iph->ihl << 2)); if (iph->protocol == IPPROTO_TCP) { sport = tcph->source; dport = tcph->dest; saddr = iph->saddr; daddr = iph->daddr; snprintf(dsthost, 16, "%pI4", &daddr); printk(KERN_INFO "ip is:%s", dsthost); } jprobe_return(); return 0; } struct jprobe jps_netif_receive_skb = { .entry = jpf_netif_receive_skb, .kp = { .symbol_name = "netif_receive_skb", }, };
标签:
原文地址:http://www.cnblogs.com/lxgeek/p/4895464.html