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 }