e1000收包的调试
来源:互联网 发布:淘宝购买iphone7p美版 编辑:程序博客网 时间:2024/06/05 08:48
4018 /**
4019 * e1000_receive_skb - helper function to handle rx indications
4020 * @adapter: board private structure
4021 * @status: descriptor status field as written by hardware
4022 * @vlan: descriptor vlan field as written by hardware (no le/be conversion)
4023 * @skb: pointer to sk_buff to be indicated to stack
4024 */
4025 static void e1000_receive_skb(struct e1000_adapter *adapter, u8 status,
4026 __le16 vlan, struct sk_buff *skb)
4027 {
4028 // debug code begin
4029 struct ethhdr *eh = (struct ethhdr *)skb->data;
4030 struct iphdr *iph;
4031 struct tcphdr *th;
4032 //printk(KERN_ALERT "src=%02x%02x%02x%02x%02x%02x, dst=%02x%02x%02x%02x%02x%02x, proto=%04x\n",
4033 // eh->h_source[5], eh->h_source[4], eh->h_source[3], eh->h_source[2], eh->h_source[1], eh->h_source[0],
4034 // eh->h_dest[5], eh->h_source[4], eh->h_source[3], eh->h_source[2], eh->h_source[1], eh->h_source[0],
4035 // eh->h_proto);
4036 if (eh->h_proto == htons(ETH_P_IP))
4037 {
4038 iph = (struct iphdr *)(skb->data + ETH_HLEN);
4039 //if (ph->ihl < 5 || iph->version != 4)
4040 if (iph->ihl >= 5 && iph->version == 4)
4041 {
4042 if (iph->protocol == IPPROTO_TCP)
4043 {
4044 th = (struct tcphdr *)(skb->data + ETH_HLEN + iph->ihl*4);
4045 if (ntohs(th->source) == 12345 || ntohs(th->dest) == 12345)
4046 printk(KERN_ALERT "TCP src=%d, dst=%d, len=%d, seq=%u, ack_seq=%u\n",
4047 ntohs(th->source), ntohs(th->dest), ntohs(iph->tot_len), ntohl(th->seq), ntohl(th->ack_seq));
4048 }
4049 }
4050 }
4051 // debug code end
4052
4053 skb->protocol = eth_type_trans(skb, adapter->netdev);
4054
4055 if (status & E1000_RXD_STAT_VP) {
4056 u16 vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK;
4057
4058 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
4059 }
4060 napi_gro_receive(&adapter->napi, skb);
4061 }
4019 * e1000_receive_skb - helper function to handle rx indications
4020 * @adapter: board private structure
4021 * @status: descriptor status field as written by hardware
4022 * @vlan: descriptor vlan field as written by hardware (no le/be conversion)
4023 * @skb: pointer to sk_buff to be indicated to stack
4024 */
4025 static void e1000_receive_skb(struct e1000_adapter *adapter, u8 status,
4026 __le16 vlan, struct sk_buff *skb)
4027 {
4028 // debug code begin
4029 struct ethhdr *eh = (struct ethhdr *)skb->data;
4030 struct iphdr *iph;
4031 struct tcphdr *th;
4032 //printk(KERN_ALERT "src=%02x%02x%02x%02x%02x%02x, dst=%02x%02x%02x%02x%02x%02x, proto=%04x\n",
4033 // eh->h_source[5], eh->h_source[4], eh->h_source[3], eh->h_source[2], eh->h_source[1], eh->h_source[0],
4034 // eh->h_dest[5], eh->h_source[4], eh->h_source[3], eh->h_source[2], eh->h_source[1], eh->h_source[0],
4035 // eh->h_proto);
4036 if (eh->h_proto == htons(ETH_P_IP))
4037 {
4038 iph = (struct iphdr *)(skb->data + ETH_HLEN);
4039 //if (ph->ihl < 5 || iph->version != 4)
4040 if (iph->ihl >= 5 && iph->version == 4)
4041 {
4042 if (iph->protocol == IPPROTO_TCP)
4043 {
4044 th = (struct tcphdr *)(skb->data + ETH_HLEN + iph->ihl*4);
4045 if (ntohs(th->source) == 12345 || ntohs(th->dest) == 12345)
4046 printk(KERN_ALERT "TCP src=%d, dst=%d, len=%d, seq=%u, ack_seq=%u\n",
4047 ntohs(th->source), ntohs(th->dest), ntohs(iph->tot_len), ntohl(th->seq), ntohl(th->ack_seq));
4048 }
4049 }
4050 }
4051 // debug code end
4052
4053 skb->protocol = eth_type_trans(skb, adapter->netdev);
4054
4055 if (status & E1000_RXD_STAT_VP) {
4056 u16 vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK;
4057
4058 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
4059 }
4060 napi_gro_receive(&adapter->napi, skb);
4061 }
0 0
- e1000收包的调试
- e1000驱动收包描述符和skb
- E1000 VNIC和TAP的数据结构关系
- e1000 napi
- 调试你的包(DebugYourPackages)
- 关于VMware 的默认网卡是e1000还是79c970(vlance)的问题
- 没有安装Silverlight管理的调试包
- BPL包无法调试的问题
- BPL包无法调试的问题
- BPL包无法调试的问题
- IOS抓包 Charles 的调试
- eclipse调试libs下的jar包
- BPL包无法调试的问题
- 第三方包的调试方法
- Xcode真机调试包的路径
- e1000驱动学习总结
- e1000相关资料
- e1000网卡驱动分析
- pzhu 1080: 修电脑 (Dijkstra 算法)
- Simpsons' Hidden Talents hdu2594 kmp
- [LeetCode]566. Reshape the Matrix
- Node.js建站之安装express(一)
- Linux 64位安装32位运行库(解决RK3399 make kernel.img error)
- e1000收包的调试
- 深克隆和浅克隆
- CSDN日报20170501 ——《我的春招总结》
- HDU1162(prim)
- Win环境中Python的第三方库安装遇到编码问题
- python爬取网页内容
- acl 的 access -list 命令
- stm32时钟系统复习
- (仿qq空间)个人博客