[PATCH] Linux Device Driver for Xilinx LL TEMAC 10/100/1000 Ethernet NIC

Sergey Temerkhanov temerkhanov at yandex.ru
Sat Aug 23 02:14:01 EST 2008


On Tuesday 19 August 2008 13:34:04 David H. Lynch Jr. wrote:
> +               switch (ip->protocol) {
> +               case IPPROTO_TCP:
> +                       start = sizeof(struct iphdr) + ETH_HLEN;
> +                       insert = sizeof(struct iphdr) + ETH_HLEN + 16;
> +                       length = ip->tot_len - sizeof(struct iphdr);
> +                       headlen = ETH_HLEN
> +                               + sizeof(struct iphdr)
> +                               + sizeof(struct tcphdr);
> +                       break;
> +               case IPPROTO_UDP:
> +                       start = sizeof(struct iphdr) + ETH_HLEN;
> +                       insert = sizeof(struct iphdr) + ETH_HLEN + 6;
> +                       length = ip->tot_len - sizeof(struct iphdr);
> +                       headlen = ETH_HLEN
> +                               + sizeof(struct iphdr)
> +                               + sizeof(struct udphdr);
> +                       break;
> +               default:
> +                       break;
> +               }

Why all these calculations instead of skb_transport_offset(skb) and 
skb->csum_offset usage?



More information about the Linuxppc-embedded mailing list