Re: linux kernel 2.6.9-rc4, skb->mac.ethernet => eth_hdr(skb) issues.
emil <[email protected]> Fri, 15 Oct 2004 09:56:48 +0200
| Newsgroups | gmane.linux.drivers.at76c503a.user |
|---|---|
| Message-ID | <[email protected]> |
I got it working now. But I'm not sure it's the correct way of doing things. =) Patch attached. /Emil L.
eth_hdr_2.patch
(text/plain, 2.3 KB)
Index: at76c503.c
===================================================================
RCS file: /cvsroot/at76c503a/at76c503a/at76c503.c,v
retrieving revision 1.71
diff -r1.71 at76c503.c
180a181,184
> #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 9)
> # define eth_hdr(s) (s)->mac.ethernet
> #endif
>
3858c3862
< struct ethhdr *eth_hdr;
---
> struct ethhdr *eth_hdr_p;
3881,3883c3885,3887
< eth_hdr = (struct ethhdr *)skb->data;
< if (!memcmp(eth_hdr->h_source, src_addr, ETH_ALEN) &&
< !memcmp(eth_hdr->h_dest, dest_addr, ETH_ALEN)) {
---
> eth_hdr_p = (struct ethhdr *)skb->data;
> if (!memcmp(eth_hdr_p->h_source, src_addr, ETH_ALEN) &&
> !memcmp(eth_hdr_p->h_dest, dest_addr, ETH_ALEN)) {
3914,3915c3918,3920
< eth_hdr = (struct ethhdr *)(skb->data-sizeof(struct ethhdr));
< skb->mac.ethernet = eth_hdr;
---
> eth_hdr_p = (struct ethhdr *)(skb->data-sizeof(struct ethhdr));
> //eth_hdr(skb) = eth_hdr_p;
> skb->mac.raw=(unsigned char *)eth_hdr_p;
3917c3922
< /* This needs to be done in this order (eth_hdr->h_dest may
---
> /* This needs to be done in this order (eth_hdr_p->h_dest may
3919,3920c3924,3925
< memcpy(eth_hdr->h_source, src_addr, ETH_ALEN);
< memcpy(eth_hdr->h_dest, dest_addr, ETH_ALEN);
---
> memcpy(eth_hdr_p->h_source, src_addr, ETH_ALEN);
> memcpy(eth_hdr_p->h_dest, dest_addr, ETH_ALEN);
3922c3927
< eth_hdr->h_proto = proto;
---
> eth_hdr_p->h_proto = proto;
3925,3926c3930,3931
< if (ntohs(eth_hdr->h_proto) > 1518) {
< skb->protocol = eth_hdr->h_proto;
---
> if (ntohs(eth_hdr_p->h_proto) > 1518) {
> skb->protocol = eth_hdr_p->h_proto;
3940,3941c3945,3946
< hex2str(da, skb->mac.ethernet->h_dest, ETH_ALEN, ':'),
< hex2str(sa, skb->mac.ethernet->h_source, ETH_ALEN, ':'),
---
> hex2str(da, eth_hdr(skb)->h_dest, ETH_ALEN, ':'),
> hex2str(sa, eth_hdr(skb)->h_source, ETH_ALEN, ':'),
3956c3961
< struct ethhdr *eth_hdr;
---
> struct ethhdr *eth_hdr_p;
3971,3973c3976,3978
< eth_hdr = (struct ethhdr *)skb->data;
< if (!memcmp(eth_hdr->h_source, src_addr, ETH_ALEN) &&
< !memcmp(eth_hdr->h_dest, dest_addr, ETH_ALEN)) {
---
> eth_hdr_p = (struct ethhdr *)skb->data;
> if (!memcmp(eth_hdr_p->h_source, src_addr, ETH_ALEN) &&
> !memcmp(eth_hdr_p->h_dest, dest_addr, ETH_ALEN)) {
3977c3982
< proto = eth_hdr->h_proto;
---
> proto = eth_hdr_p->h_proto;