diff options
author | Paul Mackerras <paulus@samba.org> | 2007-04-29 22:38:01 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-29 22:38:01 -0400 |
commit | 49e1900d4cc2e7bcecb681fe60f0990bec2dcce8 (patch) | |
tree | 253801ebf57e0a23856a2c7be129c2c178f62fdf /drivers/net | |
parent | 34f6d749c0a328817d5e36274e53121c1db734dc (diff) | |
parent | b9099ff63c75216d6ca10bce5a1abcd9293c27e6 (diff) |
Merge branch 'linux-2.6' into for-2.6.22
Diffstat (limited to 'drivers/net')
241 files changed, 1175 insertions, 1225 deletions
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index 06e33786078d..4bee99ba7dbb 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c | |||
@@ -735,7 +735,6 @@ static void el_receive(struct net_device *dev) | |||
735 | else | 735 | else |
736 | { | 736 | { |
737 | skb_reserve(skb,2); /* Force 16 byte alignment */ | 737 | skb_reserve(skb,2); /* Force 16 byte alignment */ |
738 | skb->dev = dev; | ||
739 | /* | 738 | /* |
740 | * The read increments through the bytes. The interrupt | 739 | * The read increments through the bytes. The interrupt |
741 | * handler will fix the pointer when it returns to | 740 | * handler will fix the pointer when it returns to |
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c index 702bfb2a5e99..e985a85a5623 100644 --- a/drivers/net/3c505.c +++ b/drivers/net/3c505.c | |||
@@ -615,7 +615,6 @@ static void receive_packet(struct net_device *dev, int len) | |||
615 | if (test_and_set_bit(0, (void *) &adapter->dmaing)) | 615 | if (test_and_set_bit(0, (void *) &adapter->dmaing)) |
616 | printk(KERN_ERR "%s: rx blocked, DMA in progress, dir %d\n", dev->name, adapter->current_dma.direction); | 616 | printk(KERN_ERR "%s: rx blocked, DMA in progress, dir %d\n", dev->name, adapter->current_dma.direction); |
617 | 617 | ||
618 | skb->dev = dev; | ||
619 | adapter->current_dma.direction = 0; | 618 | adapter->current_dma.direction = 0; |
620 | adapter->current_dma.length = rlen; | 619 | adapter->current_dma.length = rlen; |
621 | adapter->current_dma.skb = skb; | 620 | adapter->current_dma.skb = skb; |
@@ -1026,7 +1025,7 @@ static int send_packet(struct net_device *dev, struct sk_buff *skb) | |||
1026 | adapter->current_dma.start_time = jiffies; | 1025 | adapter->current_dma.start_time = jiffies; |
1027 | 1026 | ||
1028 | if ((unsigned long)(skb->data + nlen) >= MAX_DMA_ADDRESS || nlen != skb->len) { | 1027 | if ((unsigned long)(skb->data + nlen) >= MAX_DMA_ADDRESS || nlen != skb->len) { |
1029 | memcpy(adapter->dma_buffer, skb->data, nlen); | 1028 | skb_copy_from_linear_data(skb, adapter->dma_buffer, nlen); |
1030 | memset(adapter->dma_buffer+skb->len, 0, nlen-skb->len); | 1029 | memset(adapter->dma_buffer+skb->len, 0, nlen-skb->len); |
1031 | target = isa_virt_to_bus(adapter->dma_buffer); | 1030 | target = isa_virt_to_bus(adapter->dma_buffer); |
1032 | } | 1031 | } |
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index 54e1d5aebed3..eed4299dc426 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c | |||
@@ -873,7 +873,6 @@ static void el16_rx(struct net_device *dev) | |||
873 | } | 873 | } |
874 | 874 | ||
875 | skb_reserve(skb,2); | 875 | skb_reserve(skb,2); |
876 | skb->dev = dev; | ||
877 | 876 | ||
878 | /* 'skb->data' points to the start of sk_buff data area. */ | 877 | /* 'skb->data' points to the start of sk_buff data area. */ |
879 | memcpy_fromio(skb_put(skb,pkt_len), data_frame + 10, pkt_len); | 878 | memcpy_fromio(skb_put(skb,pkt_len), data_frame + 10, pkt_len); |
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index f791bf026e51..c7511c4d3b68 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c | |||
@@ -1091,7 +1091,6 @@ el3_rx(struct net_device *dev) | |||
1091 | printk("Receiving packet size %d status %4.4x.\n", | 1091 | printk("Receiving packet size %d status %4.4x.\n", |
1092 | pkt_len, rx_status); | 1092 | pkt_len, rx_status); |
1093 | if (skb != NULL) { | 1093 | if (skb != NULL) { |
1094 | skb->dev = dev; | ||
1095 | skb_reserve(skb, 2); /* Align IP on 16 byte */ | 1094 | skb_reserve(skb, 2); /* Align IP on 16 byte */ |
1096 | 1095 | ||
1097 | /* 'skb->data' points to the start of sk_buff data area. */ | 1096 | /* 'skb->data' points to the start of sk_buff data area. */ |
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index c307ce66145c..290166d5e7d1 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c | |||
@@ -1292,7 +1292,6 @@ static int corkscrew_rx(struct net_device *dev) | |||
1292 | printk("Receiving packet size %d status %4.4x.\n", | 1292 | printk("Receiving packet size %d status %4.4x.\n", |
1293 | pkt_len, rx_status); | 1293 | pkt_len, rx_status); |
1294 | if (skb != NULL) { | 1294 | if (skb != NULL) { |
1295 | skb->dev = dev; | ||
1296 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1295 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1297 | /* 'skb_put()' points to the start of sk_buff data area. */ | 1296 | /* 'skb_put()' points to the start of sk_buff data area. */ |
1298 | insl(ioaddr + RX_FIFO, | 1297 | insl(ioaddr + RX_FIFO, |
@@ -1363,7 +1362,6 @@ static int boomerang_rx(struct net_device *dev) | |||
1363 | copying to a properly sized skbuff. */ | 1362 | copying to a properly sized skbuff. */ |
1364 | if (pkt_len < rx_copybreak | 1363 | if (pkt_len < rx_copybreak |
1365 | && (skb = dev_alloc_skb(pkt_len + 4)) != 0) { | 1364 | && (skb = dev_alloc_skb(pkt_len + 4)) != 0) { |
1366 | skb->dev = dev; | ||
1367 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1365 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1368 | /* 'skb_put()' points to the start of sk_buff data area. */ | 1366 | /* 'skb_put()' points to the start of sk_buff data area. */ |
1369 | memcpy(skb_put(skb, pkt_len), | 1367 | memcpy(skb_put(skb, pkt_len), |
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c index 17d61eb0a7e5..da1a22c13865 100644 --- a/drivers/net/3c523.c +++ b/drivers/net/3c523.c | |||
@@ -988,7 +988,6 @@ static void elmc_rcv_int(struct net_device *dev) | |||
988 | rbd->status = 0; | 988 | rbd->status = 0; |
989 | skb = (struct sk_buff *) dev_alloc_skb(totlen + 2); | 989 | skb = (struct sk_buff *) dev_alloc_skb(totlen + 2); |
990 | if (skb != NULL) { | 990 | if (skb != NULL) { |
991 | skb->dev = dev; | ||
992 | skb_reserve(skb, 2); /* 16 byte alignment */ | 991 | skb_reserve(skb, 2); /* 16 byte alignment */ |
993 | skb_put(skb,totlen); | 992 | skb_put(skb,totlen); |
994 | eth_copy_and_sum(skb, (char *) p->base+(unsigned long) rbd->buffer,totlen,0); | 993 | eth_copy_and_sum(skb, (char *) p->base+(unsigned long) rbd->buffer,totlen,0); |
@@ -1146,7 +1145,7 @@ static int elmc_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1146 | 1145 | ||
1147 | if (len != skb->len) | 1146 | if (len != skb->len) |
1148 | memset((char *) p->xmit_cbuffs[p->xmit_count], 0, ETH_ZLEN); | 1147 | memset((char *) p->xmit_cbuffs[p->xmit_count], 0, ETH_ZLEN); |
1149 | memcpy((char *) p->xmit_cbuffs[p->xmit_count], (char *) (skb->data), skb->len); | 1148 | skb_copy_from_linear_data(skb, (char *) p->xmit_cbuffs[p->xmit_count], skb->len); |
1150 | 1149 | ||
1151 | #if (NUM_XMIT_BUFFS == 1) | 1150 | #if (NUM_XMIT_BUFFS == 1) |
1152 | #ifdef NO_NOPCOMMANDS | 1151 | #ifdef NO_NOPCOMMANDS |
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c index 6c7437e60bd2..c7b571be20e0 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c | |||
@@ -1189,7 +1189,6 @@ static void mc32_rx_ring(struct net_device *dev) | |||
1189 | } | 1189 | } |
1190 | 1190 | ||
1191 | skb->protocol=eth_type_trans(skb,dev); | 1191 | skb->protocol=eth_type_trans(skb,dev); |
1192 | skb->dev=dev; | ||
1193 | dev->last_rx = jiffies; | 1192 | dev->last_rx = jiffies; |
1194 | lp->net_stats.rx_packets++; | 1193 | lp->net_stats.rx_packets++; |
1195 | lp->net_stats.rx_bytes += length; | 1194 | lp->net_stats.rx_bytes += length; |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index b406ecfa7268..80924f76dee8 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -2414,7 +2414,6 @@ static int vortex_rx(struct net_device *dev) | |||
2414 | printk(KERN_DEBUG "Receiving packet size %d status %4.4x.\n", | 2414 | printk(KERN_DEBUG "Receiving packet size %d status %4.4x.\n", |
2415 | pkt_len, rx_status); | 2415 | pkt_len, rx_status); |
2416 | if (skb != NULL) { | 2416 | if (skb != NULL) { |
2417 | skb->dev = dev; | ||
2418 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 2417 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
2419 | /* 'skb_put()' points to the start of sk_buff data area. */ | 2418 | /* 'skb_put()' points to the start of sk_buff data area. */ |
2420 | if (vp->bus_master && | 2419 | if (vp->bus_master && |
@@ -2491,7 +2490,6 @@ boomerang_rx(struct net_device *dev) | |||
2491 | /* Check if the packet is long enough to just accept without | 2490 | /* Check if the packet is long enough to just accept without |
2492 | copying to a properly sized skbuff. */ | 2491 | copying to a properly sized skbuff. */ |
2493 | if (pkt_len < rx_copybreak && (skb = dev_alloc_skb(pkt_len + 2)) != 0) { | 2492 | if (pkt_len < rx_copybreak && (skb = dev_alloc_skb(pkt_len + 2)) != 0) { |
2494 | skb->dev = dev; | ||
2495 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 2493 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
2496 | pci_dma_sync_single_for_cpu(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); | 2494 | pci_dma_sync_single_for_cpu(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); |
2497 | /* 'skb_put()' points to the start of sk_buff data area. */ | 2495 | /* 'skb_put()' points to the start of sk_buff data area. */ |
diff --git a/drivers/net/7990.c b/drivers/net/7990.c index 1b3d11ed6cff..d396f996af57 100644 --- a/drivers/net/7990.c +++ b/drivers/net/7990.c | |||
@@ -331,7 +331,6 @@ static int lance_rx (struct net_device *dev) | |||
331 | return 0; | 331 | return 0; |
332 | } | 332 | } |
333 | 333 | ||
334 | skb->dev = dev; | ||
335 | skb_reserve (skb, 2); /* 16 byte align */ | 334 | skb_reserve (skb, 2); /* 16 byte align */ |
336 | skb_put (skb, len); /* make room */ | 335 | skb_put (skb, len); /* make room */ |
337 | eth_copy_and_sum(skb, | 336 | eth_copy_and_sum(skb, |
@@ -568,7 +567,7 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
568 | 567 | ||
569 | if (skb->len < ETH_ZLEN) | 568 | if (skb->len < ETH_ZLEN) |
570 | memset((char *)&ib->tx_buf[entry][0], 0, ETH_ZLEN); | 569 | memset((char *)&ib->tx_buf[entry][0], 0, ETH_ZLEN); |
571 | memcpy ((char *)&ib->tx_buf [entry][0], skb->data, skblen); | 570 | skb_copy_from_linear_data(skb, &ib->tx_buf[entry][0], skblen); |
572 | 571 | ||
573 | /* Now, give the packet to the lance */ | 572 | /* Now, give the packet to the lance */ |
574 | ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN); | 573 | ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN); |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 12c8453f44bc..e8c9f27817b0 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -573,7 +573,6 @@ rx_status_loop: | |||
573 | } | 573 | } |
574 | 574 | ||
575 | skb_reserve(new_skb, RX_OFFSET); | 575 | skb_reserve(new_skb, RX_OFFSET); |
576 | new_skb->dev = dev; | ||
577 | 576 | ||
578 | pci_unmap_single(cp->pdev, mapping, | 577 | pci_unmap_single(cp->pdev, mapping, |
579 | buflen, PCI_DMA_FROMDEVICE); | 578 | buflen, PCI_DMA_FROMDEVICE); |
@@ -807,7 +806,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
807 | if (mss) | 806 | if (mss) |
808 | flags |= LargeSend | ((mss & MSSMask) << MSSShift); | 807 | flags |= LargeSend | ((mss & MSSMask) << MSSShift); |
809 | else if (skb->ip_summed == CHECKSUM_PARTIAL) { | 808 | else if (skb->ip_summed == CHECKSUM_PARTIAL) { |
810 | const struct iphdr *ip = skb->nh.iph; | 809 | const struct iphdr *ip = ip_hdr(skb); |
811 | if (ip->protocol == IPPROTO_TCP) | 810 | if (ip->protocol == IPPROTO_TCP) |
812 | flags |= IPCS | TCPCS; | 811 | flags |= IPCS | TCPCS; |
813 | else if (ip->protocol == IPPROTO_UDP) | 812 | else if (ip->protocol == IPPROTO_UDP) |
@@ -826,7 +825,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
826 | u32 first_len, first_eor; | 825 | u32 first_len, first_eor; |
827 | dma_addr_t first_mapping; | 826 | dma_addr_t first_mapping; |
828 | int frag, first_entry = entry; | 827 | int frag, first_entry = entry; |
829 | const struct iphdr *ip = skb->nh.iph; | 828 | const struct iphdr *ip = ip_hdr(skb); |
830 | 829 | ||
831 | /* We must give this initial chunk to the device last. | 830 | /* We must give this initial chunk to the device last. |
832 | * Otherwise we could race with the device. | 831 | * Otherwise we could race with the device. |
@@ -1082,7 +1081,6 @@ static int cp_refill_rx (struct cp_private *cp) | |||
1082 | if (!skb) | 1081 | if (!skb) |
1083 | goto err_out; | 1082 | goto err_out; |
1084 | 1083 | ||
1085 | skb->dev = cp->dev; | ||
1086 | skb_reserve(skb, RX_OFFSET); | 1084 | skb_reserve(skb, RX_OFFSET); |
1087 | 1085 | ||
1088 | mapping = pci_map_single(cp->pdev, skb->data, cp->rx_buf_sz, | 1086 | mapping = pci_map_single(cp->pdev, skb->data, cp->rx_buf_sz, |
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 99304b2aa86e..a844b1fe2dc4 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -1904,10 +1904,10 @@ static __inline__ void wrap_copy(struct sk_buff *skb, const unsigned char *ring, | |||
1904 | u32 left = RX_BUF_LEN - offset; | 1904 | u32 left = RX_BUF_LEN - offset; |
1905 | 1905 | ||
1906 | if (size > left) { | 1906 | if (size > left) { |
1907 | memcpy(skb->data, ring + offset, left); | 1907 | skb_copy_to_linear_data(skb, ring + offset, left); |
1908 | memcpy(skb->data+left, ring, size - left); | 1908 | skb_copy_to_linear_data_offset(skb, left, ring, size - left); |
1909 | } else | 1909 | } else |
1910 | memcpy(skb->data, ring + offset, size); | 1910 | skb_copy_to_linear_data(skb, ring + offset, size); |
1911 | } | 1911 | } |
1912 | #endif | 1912 | #endif |
1913 | 1913 | ||
@@ -2013,7 +2013,6 @@ no_early_rx: | |||
2013 | 2013 | ||
2014 | skb = dev_alloc_skb (pkt_size + 2); | 2014 | skb = dev_alloc_skb (pkt_size + 2); |
2015 | if (likely(skb)) { | 2015 | if (likely(skb)) { |
2016 | skb->dev = dev; | ||
2017 | skb_reserve (skb, 2); /* 16 byte align the IP fields. */ | 2016 | skb_reserve (skb, 2); /* 16 byte align the IP fields. */ |
2018 | #if RX_BUF_IDX == 3 | 2017 | #if RX_BUF_IDX == 3 |
2019 | wrap_copy(skb, rx_ring, ring_offset+4, pkt_size); | 2018 | wrap_copy(skb, rx_ring, ring_offset+4, pkt_size); |
diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 640d7ca2ebcf..3ff1155459a3 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -830,7 +830,6 @@ memory_squeeze: | |||
830 | lp->stats.rx_dropped++; | 830 | lp->stats.rx_dropped++; |
831 | } | 831 | } |
832 | else { | 832 | else { |
833 | skb->dev = dev; | ||
834 | if (!rx_in_place) { | 833 | if (!rx_in_place) { |
835 | /* 16 byte align the data fields */ | 834 | /* 16 byte align the data fields */ |
836 | skb_reserve(skb, 2); | 835 | skb_reserve(skb, 2); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 753695b624b3..890c85e2b4ae 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2263,6 +2263,7 @@ config GIANFAR | |||
2263 | tristate "Gianfar Ethernet" | 2263 | tristate "Gianfar Ethernet" |
2264 | depends on 85xx || 83xx || PPC_86xx | 2264 | depends on 85xx || 83xx || PPC_86xx |
2265 | select PHYLIB | 2265 | select PHYLIB |
2266 | select CRC32 | ||
2266 | help | 2267 | help |
2267 | This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx, | 2268 | This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx, |
2268 | and MPC86xx family of chips, and the FEC on the 8540. | 2269 | and MPC86xx family of chips, and the FEC on the 8540. |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 33af833667da..58527322a39d 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -206,7 +206,7 @@ obj-$(CONFIG_TR) += tokenring/ | |||
206 | obj-$(CONFIG_WAN) += wan/ | 206 | obj-$(CONFIG_WAN) += wan/ |
207 | obj-$(CONFIG_ARCNET) += arcnet/ | 207 | obj-$(CONFIG_ARCNET) += arcnet/ |
208 | obj-$(CONFIG_NET_PCMCIA) += pcmcia/ | 208 | obj-$(CONFIG_NET_PCMCIA) += pcmcia/ |
209 | obj-$(CONFIG_NET_RADIO) += wireless/ | 209 | obj-y += wireless/ |
210 | obj-$(CONFIG_NET_TULIP) += tulip/ | 210 | obj-$(CONFIG_NET_TULIP) += tulip/ |
211 | obj-$(CONFIG_HAMRADIO) += hamradio/ | 211 | obj-$(CONFIG_HAMRADIO) += hamradio/ |
212 | obj-$(CONFIG_IRDA) += irda/ | 212 | obj-$(CONFIG_IRDA) += irda/ |
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index d76548e75350..1226cbba0450 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c | |||
@@ -320,7 +320,6 @@ static int lance_rx (struct net_device *dev) | |||
320 | return 0; | 320 | return 0; |
321 | } | 321 | } |
322 | 322 | ||
323 | skb->dev = dev; | ||
324 | skb_reserve (skb, 2); /* 16 byte align */ | 323 | skb_reserve (skb, 2); /* 16 byte align */ |
325 | skb_put (skb, len); /* make room */ | 324 | skb_put (skb, len); /* make room */ |
326 | eth_copy_and_sum(skb, | 325 | eth_copy_and_sum(skb, |
@@ -599,7 +598,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
599 | ib->btx_ring [entry].length = (-len) | 0xf000; | 598 | ib->btx_ring [entry].length = (-len) | 0xf000; |
600 | ib->btx_ring [entry].misc = 0; | 599 | ib->btx_ring [entry].misc = 0; |
601 | 600 | ||
602 | memcpy ((char *)&ib->tx_buf [entry][0], skb->data, skblen); | 601 | skb_copy_from_linear_data(skb, &ib->tx_buf [entry][0], skblen); |
603 | 602 | ||
604 | /* Clear the slack of the packet, do I need this? */ | 603 | /* Clear the slack of the packet, do I need this? */ |
605 | if (len != skblen) | 604 | if (len != skblen) |
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index 7138e0e025bc..7122b7ba8d61 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c | |||
@@ -2027,7 +2027,6 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm) | |||
2027 | */ | 2027 | */ |
2028 | csum = retdesc->tcp_udp_csum; | 2028 | csum = retdesc->tcp_udp_csum; |
2029 | 2029 | ||
2030 | skb->dev = dev; | ||
2031 | skb->protocol = eth_type_trans(skb, dev); | 2030 | skb->protocol = eth_type_trans(skb, dev); |
2032 | 2031 | ||
2033 | /* | 2032 | /* |
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index 962c954c2d56..675fe918421b 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c | |||
@@ -798,9 +798,7 @@ static int amd8111e_rx_poll(struct net_device *dev, int * budget) | |||
798 | pci_unmap_single(lp->pci_dev,lp->rx_dma_addr[rx_index], | 798 | pci_unmap_single(lp->pci_dev,lp->rx_dma_addr[rx_index], |
799 | lp->rx_buff_len-2, PCI_DMA_FROMDEVICE); | 799 | lp->rx_buff_len-2, PCI_DMA_FROMDEVICE); |
800 | skb_put(skb, pkt_len); | 800 | skb_put(skb, pkt_len); |
801 | skb->dev = dev; | ||
802 | lp->rx_skbuff[rx_index] = new_skb; | 801 | lp->rx_skbuff[rx_index] = new_skb; |
803 | new_skb->dev = dev; | ||
804 | lp->rx_dma_addr[rx_index] = pci_map_single(lp->pci_dev, | 802 | lp->rx_dma_addr[rx_index] = pci_map_single(lp->pci_dev, |
805 | new_skb->data, | 803 | new_skb->data, |
806 | lp->rx_buff_len-2, | 804 | lp->rx_buff_len-2, |
@@ -926,9 +924,7 @@ static int amd8111e_rx(struct net_device *dev) | |||
926 | pci_unmap_single(lp->pci_dev,lp->rx_dma_addr[rx_index], | 924 | pci_unmap_single(lp->pci_dev,lp->rx_dma_addr[rx_index], |
927 | lp->rx_buff_len-2, PCI_DMA_FROMDEVICE); | 925 | lp->rx_buff_len-2, PCI_DMA_FROMDEVICE); |
928 | skb_put(skb, pkt_len); | 926 | skb_put(skb, pkt_len); |
929 | skb->dev = dev; | ||
930 | lp->rx_skbuff[rx_index] = new_skb; | 927 | lp->rx_skbuff[rx_index] = new_skb; |
931 | new_skb->dev = dev; | ||
932 | lp->rx_dma_addr[rx_index] = pci_map_single(lp->pci_dev, | 928 | lp->rx_dma_addr[rx_index] = pci_map_single(lp->pci_dev, |
933 | new_skb->data, lp->rx_buff_len-2,PCI_DMA_FROMDEVICE); | 929 | new_skb->data, lp->rx_buff_len-2,PCI_DMA_FROMDEVICE); |
934 | 930 | ||
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c index dba5e5165452..da6ffa8cd81e 100644 --- a/drivers/net/appletalk/cops.c +++ b/drivers/net/appletalk/cops.c | |||
@@ -853,9 +853,9 @@ static void cops_rx(struct net_device *dev) | |||
853 | return; | 853 | return; |
854 | } | 854 | } |
855 | 855 | ||
856 | skb->mac.raw = skb->data; /* Point to entire packet. */ | 856 | skb_reset_mac_header(skb); /* Point to entire packet. */ |
857 | skb_pull(skb,3); | 857 | skb_pull(skb,3); |
858 | skb->h.raw = skb->data; /* Point to data (Skip header). */ | 858 | skb_reset_transport_header(skb); /* Point to data (Skip header). */ |
859 | 859 | ||
860 | /* Update the counters. */ | 860 | /* Update the counters. */ |
861 | lp->stats.rx_packets++; | 861 | lp->stats.rx_packets++; |
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c index 2ea44ce49810..6a6cbd331a16 100644 --- a/drivers/net/appletalk/ltpc.c +++ b/drivers/net/appletalk/ltpc.c | |||
@@ -770,13 +770,13 @@ static int sendup_buffer (struct net_device *dev) | |||
770 | skb->data[0] = dnode; | 770 | skb->data[0] = dnode; |
771 | skb->data[1] = snode; | 771 | skb->data[1] = snode; |
772 | skb->data[2] = llaptype; | 772 | skb->data[2] = llaptype; |
773 | skb->mac.raw = skb->data; /* save pointer to llap header */ | 773 | skb_reset_mac_header(skb); /* save pointer to llap header */ |
774 | skb_pull(skb,3); | 774 | skb_pull(skb,3); |
775 | 775 | ||
776 | /* copy ddp(s,e)hdr + contents */ | 776 | /* copy ddp(s,e)hdr + contents */ |
777 | memcpy(skb->data,(void*)ltdmabuf,len); | 777 | skb_copy_to_linear_data(skb, ltdmabuf, len); |
778 | 778 | ||
779 | skb->h.raw = skb->data; | 779 | skb_reset_transport_header(skb); |
780 | 780 | ||
781 | stats->rx_packets++; | 781 | stats->rx_packets++; |
782 | stats->rx_bytes+=skb->len; | 782 | stats->rx_bytes+=skb->len; |
@@ -917,13 +917,14 @@ static int ltpc_xmit(struct sk_buff *skb, struct net_device *dev) | |||
917 | 917 | ||
918 | int i; | 918 | int i; |
919 | struct lt_sendlap cbuf; | 919 | struct lt_sendlap cbuf; |
920 | unsigned char *hdr; | ||
920 | 921 | ||
921 | cbuf.command = LT_SENDLAP; | 922 | cbuf.command = LT_SENDLAP; |
922 | cbuf.dnode = skb->data[0]; | 923 | cbuf.dnode = skb->data[0]; |
923 | cbuf.laptype = skb->data[2]; | 924 | cbuf.laptype = skb->data[2]; |
924 | skb_pull(skb,3); /* skip past LLAP header */ | 925 | skb_pull(skb,3); /* skip past LLAP header */ |
925 | cbuf.length = skb->len; /* this is host order */ | 926 | cbuf.length = skb->len; /* this is host order */ |
926 | skb->h.raw=skb->data; | 927 | skb_reset_transport_header(skb); |
927 | 928 | ||
928 | if(debug & DEBUG_UPPER) { | 929 | if(debug & DEBUG_UPPER) { |
929 | printk("command "); | 930 | printk("command "); |
@@ -932,11 +933,13 @@ static int ltpc_xmit(struct sk_buff *skb, struct net_device *dev) | |||
932 | printk("\n"); | 933 | printk("\n"); |
933 | } | 934 | } |
934 | 935 | ||
935 | do_write(dev,&cbuf,sizeof(cbuf),skb->h.raw,skb->len); | 936 | hdr = skb_transport_header(skb); |
937 | do_write(dev, &cbuf, sizeof(cbuf), hdr, skb->len); | ||
936 | 938 | ||
937 | if(debug & DEBUG_UPPER) { | 939 | if(debug & DEBUG_UPPER) { |
938 | printk("sent %d ddp bytes\n",skb->len); | 940 | printk("sent %d ddp bytes\n",skb->len); |
939 | for(i=0;i<skb->len;i++) printk("%02x ",skb->h.raw[i]); | 941 | for (i = 0; i < skb->len; i++) |
942 | printk("%02x ", hdr[i]); | ||
940 | printk("\n"); | 943 | printk("\n"); |
941 | } | 944 | } |
942 | 945 | ||
diff --git a/drivers/net/arcnet/arc-rawmode.c b/drivers/net/arcnet/arc-rawmode.c index 6318814a11a8..e0a18e7c73cb 100644 --- a/drivers/net/arcnet/arc-rawmode.c +++ b/drivers/net/arcnet/arc-rawmode.c | |||
@@ -110,7 +110,7 @@ static void rx(struct net_device *dev, int bufnum, | |||
110 | 110 | ||
111 | pkt = (struct archdr *) skb->data; | 111 | pkt = (struct archdr *) skb->data; |
112 | 112 | ||
113 | skb->mac.raw = skb->data; | 113 | skb_reset_mac_header(skb); |
114 | skb_pull(skb, ARC_HDR_SIZE); | 114 | skb_pull(skb, ARC_HDR_SIZE); |
115 | 115 | ||
116 | /* up to sizeof(pkt->soft) has already been copied from the card */ | 116 | /* up to sizeof(pkt->soft) has already been copied from the card */ |
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 83004fdab0a4..681e20b8466f 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c | |||
@@ -519,9 +519,12 @@ static int arcnet_header(struct sk_buff *skb, struct net_device *dev, | |||
519 | * real header when we do rebuild_header. | 519 | * real header when we do rebuild_header. |
520 | */ | 520 | */ |
521 | *(uint16_t *) skb_push(skb, 2) = type; | 521 | *(uint16_t *) skb_push(skb, 2) = type; |
522 | if (skb->nh.raw - skb->mac.raw != 2) | 522 | /* |
523 | * XXX: Why not use skb->mac_len? | ||
524 | */ | ||
525 | if (skb->network_header - skb->mac_header != 2) | ||
523 | BUGMSG(D_NORMAL, "arcnet_header: Yikes! diff (%d) is not 2!\n", | 526 | BUGMSG(D_NORMAL, "arcnet_header: Yikes! diff (%d) is not 2!\n", |
524 | (int)(skb->nh.raw - skb->mac.raw)); | 527 | (int)(skb->network_header - skb->mac_header)); |
525 | return -2; /* return error -- can't transmit yet! */ | 528 | return -2; /* return error -- can't transmit yet! */ |
526 | } | 529 | } |
527 | else { | 530 | else { |
@@ -554,11 +557,13 @@ static int arcnet_rebuild_header(struct sk_buff *skb) | |||
554 | unsigned short type; | 557 | unsigned short type; |
555 | uint8_t daddr=0; | 558 | uint8_t daddr=0; |
556 | struct ArcProto *proto; | 559 | struct ArcProto *proto; |
557 | 560 | /* | |
558 | if (skb->nh.raw - skb->mac.raw != 2) { | 561 | * XXX: Why not use skb->mac_len? |
562 | */ | ||
563 | if (skb->network_header - skb->mac_header != 2) { | ||
559 | BUGMSG(D_NORMAL, | 564 | BUGMSG(D_NORMAL, |
560 | "rebuild_header: shouldn't be here! (hdrsize=%d)\n", | 565 | "rebuild_header: shouldn't be here! (hdrsize=%d)\n", |
561 | (int)(skb->nh.raw - skb->mac.raw)); | 566 | (int)(skb->network_header - skb->mac_header)); |
562 | return 0; | 567 | return 0; |
563 | } | 568 | } |
564 | type = *(uint16_t *) skb_pull(skb, 2); | 569 | type = *(uint16_t *) skb_pull(skb, 2); |
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index 66485585ab39..cc4610db6395 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c | |||
@@ -122,10 +122,8 @@ static void rx(struct net_device *dev, int bufnum, | |||
122 | } | 122 | } |
123 | skb_put(skb, length + ARC_HDR_SIZE + sizeof(int)); | 123 | skb_put(skb, length + ARC_HDR_SIZE + sizeof(int)); |
124 | skb->dev = dev; | 124 | skb->dev = dev; |
125 | 125 | skb_reset_mac_header(skb); | |
126 | pkt = (struct archdr *) skb->data; | 126 | pkt = (struct archdr *)skb_mac_header(skb); |
127 | |||
128 | skb->mac.raw = skb->data; | ||
129 | skb_pull(skb, ARC_HDR_SIZE); | 127 | skb_pull(skb, ARC_HDR_SIZE); |
130 | 128 | ||
131 | /* up to sizeof(pkt->soft) has already been copied from the card */ | 129 | /* up to sizeof(pkt->soft) has already been copied from the card */ |
@@ -270,13 +268,13 @@ static int ack_tx(struct net_device *dev, int acked) | |||
270 | skb_put(ackskb, length + ARC_HDR_SIZE ); | 268 | skb_put(ackskb, length + ARC_HDR_SIZE ); |
271 | ackskb->dev = dev; | 269 | ackskb->dev = dev; |
272 | 270 | ||
273 | ackpkt = (struct archdr *) ackskb->data; | 271 | skb_reset_mac_header(ackskb); |
274 | 272 | ackpkt = (struct archdr *)skb_mac_header(ackskb); | |
275 | ackskb->mac.raw = ackskb->data; | ||
276 | /* skb_pull(ackskb, ARC_HDR_SIZE); */ | 273 | /* skb_pull(ackskb, ARC_HDR_SIZE); */ |
277 | 274 | ||
278 | 275 | ||
279 | memcpy(ackpkt, lp->outgoing.skb->data, ARC_HDR_SIZE+sizeof(struct arc_cap)); | 276 | skb_copy_from_linear_data(lp->outgoing.skb, ackpkt, |
277 | ARC_HDR_SIZE + sizeof(struct arc_cap)); | ||
280 | ackpkt->soft.cap.proto=0; /* using protocol 0 for acknowledge */ | 278 | ackpkt->soft.cap.proto=0; /* using protocol 0 for acknowledge */ |
281 | ackpkt->soft.cap.mes.ack=acked; | 279 | ackpkt->soft.cap.mes.ack=acked; |
282 | 280 | ||
diff --git a/drivers/net/arcnet/rfc1051.c b/drivers/net/arcnet/rfc1051.c index 6d6c69f036ef..2de8877ece29 100644 --- a/drivers/net/arcnet/rfc1051.c +++ b/drivers/net/arcnet/rfc1051.c | |||
@@ -94,7 +94,7 @@ static unsigned short type_trans(struct sk_buff *skb, struct net_device *dev) | |||
94 | int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE; | 94 | int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE; |
95 | 95 | ||
96 | /* Pull off the arcnet header. */ | 96 | /* Pull off the arcnet header. */ |
97 | skb->mac.raw = skb->data; | 97 | skb_reset_mac_header(skb); |
98 | skb_pull(skb, hdr_size); | 98 | skb_pull(skb, hdr_size); |
99 | 99 | ||
100 | if (pkt->hard.dest == 0) | 100 | if (pkt->hard.dest == 0) |
diff --git a/drivers/net/arcnet/rfc1201.c b/drivers/net/arcnet/rfc1201.c index bee34226abfa..460a095000c2 100644 --- a/drivers/net/arcnet/rfc1201.c +++ b/drivers/net/arcnet/rfc1201.c | |||
@@ -96,7 +96,7 @@ static unsigned short type_trans(struct sk_buff *skb, struct net_device *dev) | |||
96 | int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE; | 96 | int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE; |
97 | 97 | ||
98 | /* Pull off the arcnet header. */ | 98 | /* Pull off the arcnet header. */ |
99 | skb->mac.raw = skb->data; | 99 | skb_reset_mac_header(skb); |
100 | skb_pull(skb, hdr_size); | 100 | skb_pull(skb, hdr_size); |
101 | 101 | ||
102 | if (pkt->hard.dest == 0) | 102 | if (pkt->hard.dest == 0) |
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c index 9dfc09b181c1..a0e68e718531 100644 --- a/drivers/net/ariadne.c +++ b/drivers/net/ariadne.c | |||
@@ -743,7 +743,6 @@ static int ariadne_rx(struct net_device *dev) | |||
743 | } | 743 | } |
744 | 744 | ||
745 | 745 | ||
746 | skb->dev = dev; | ||
747 | skb_reserve(skb,2); /* 16 byte align */ | 746 | skb_reserve(skb,2); /* 16 byte align */ |
748 | skb_put(skb,pkt_len); /* Make room */ | 747 | skb_put(skb,pkt_len); /* Make room */ |
749 | eth_copy_and_sum(skb, (char *)priv->rx_buff[entry], pkt_len,0); | 748 | eth_copy_and_sum(skb, (char *)priv->rx_buff[entry], pkt_len,0); |
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c index ddd12d44ff22..8f0d7ce503c9 100644 --- a/drivers/net/arm/am79c961a.c +++ b/drivers/net/arm/am79c961a.c | |||
@@ -526,7 +526,6 @@ am79c961_rx(struct net_device *dev, struct dev_priv *priv) | |||
526 | skb = dev_alloc_skb(len + 2); | 526 | skb = dev_alloc_skb(len + 2); |
527 | 527 | ||
528 | if (skb) { | 528 | if (skb) { |
529 | skb->dev = dev; | ||
530 | skb_reserve(skb, 2); | 529 | skb_reserve(skb, 2); |
531 | 530 | ||
532 | am_readbuffer(dev, pktaddr, skb_put(skb, len), len); | 531 | am_readbuffer(dev, pktaddr, skb_put(skb, len), len); |
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index 1621b8fe35cf..152fa7a042b8 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
@@ -858,7 +858,6 @@ static void at91ether_rx(struct net_device *dev) | |||
858 | skb_reserve(skb, 2); | 858 | skb_reserve(skb, 2); |
859 | memcpy(skb_put(skb, pktlen), p_recv, pktlen); | 859 | memcpy(skb_put(skb, pktlen), p_recv, pktlen); |
860 | 860 | ||
861 | skb->dev = dev; | ||
862 | skb->protocol = eth_type_trans(skb, dev); | 861 | skb->protocol = eth_type_trans(skb, dev); |
863 | dev->last_rx = jiffies; | 862 | dev->last_rx = jiffies; |
864 | lp->stats.rx_bytes += pktlen; | 863 | lp->stats.rx_bytes += pktlen; |
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index dd698b033a62..2438c5bff237 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
@@ -255,7 +255,6 @@ static int ep93xx_rx(struct net_device *dev, int *budget) | |||
255 | 255 | ||
256 | skb = dev_alloc_skb(length + 2); | 256 | skb = dev_alloc_skb(length + 2); |
257 | if (likely(skb != NULL)) { | 257 | if (likely(skb != NULL)) { |
258 | skb->dev = dev; | ||
259 | skb_reserve(skb, 2); | 258 | skb_reserve(skb, 2); |
260 | dma_sync_single(NULL, ep->descs->rdesc[entry].buf_addr, | 259 | dma_sync_single(NULL, ep->descs->rdesc[entry].buf_addr, |
261 | length, DMA_FROM_DEVICE); | 260 | length, DMA_FROM_DEVICE); |
diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c index a2921882eba8..f075cebe84ad 100644 --- a/drivers/net/arm/ether1.c +++ b/drivers/net/arm/ether1.c | |||
@@ -875,7 +875,6 @@ ether1_recv_done (struct net_device *dev) | |||
875 | skb = dev_alloc_skb (length + 2); | 875 | skb = dev_alloc_skb (length + 2); |
876 | 876 | ||
877 | if (skb) { | 877 | if (skb) { |
878 | skb->dev = dev; | ||
879 | skb_reserve (skb, 2); | 878 | skb_reserve (skb, 2); |
880 | 879 | ||
881 | ether1_readbuffer (dev, skb_put (skb, length), rbd.rbd_bufl, length); | 880 | ether1_readbuffer (dev, skb_put (skb, length), rbd.rbd_bufl, length); |
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c index 841178343a07..32da2eb9bcee 100644 --- a/drivers/net/arm/ether3.c +++ b/drivers/net/arm/ether3.c | |||
@@ -661,7 +661,6 @@ if (next_ptr < RX_START || next_ptr >= RX_END) { | |||
661 | if (skb) { | 661 | if (skb) { |
662 | unsigned char *buf; | 662 | unsigned char *buf; |
663 | 663 | ||
664 | skb->dev = dev; | ||
665 | skb_reserve(skb, 2); | 664 | skb_reserve(skb, 2); |
666 | buf = skb_put(skb, length); | 665 | buf = skb_put(skb, length); |
667 | ether3_readbuffer(dev, buf + 12, length - 12); | 666 | ether3_readbuffer(dev, buf + 12, length - 12); |
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index 56ae8babd919..bed8e0ebaf19 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c | |||
@@ -768,7 +768,6 @@ net_rx(struct net_device *dev) | |||
768 | lp->stats.rx_dropped++; | 768 | lp->stats.rx_dropped++; |
769 | break; | 769 | break; |
770 | } | 770 | } |
771 | skb->dev = dev; | ||
772 | skb_reserve(skb,2); | 771 | skb_reserve(skb,2); |
773 | 772 | ||
774 | insw(ioaddr + DATAPORT, skb_put(skb,pkt_len), (pkt_len + 1) >> 1); | 773 | insw(ioaddr + DATAPORT, skb_put(skb,pkt_len), (pkt_len + 1) >> 1); |
diff --git a/drivers/net/atari_bionet.c b/drivers/net/atari_bionet.c index 4e3bf6a1f22c..3d87bd2b4194 100644 --- a/drivers/net/atari_bionet.c +++ b/drivers/net/atari_bionet.c | |||
@@ -453,7 +453,8 @@ bionet_send_packet(struct sk_buff *skb, struct net_device *dev) { | |||
453 | stdma_lock(bionet_intr, NULL); | 453 | stdma_lock(bionet_intr, NULL); |
454 | local_irq_restore(flags); | 454 | local_irq_restore(flags); |
455 | if( !STRAM_ADDR(buf+length-1) ) { | 455 | if( !STRAM_ADDR(buf+length-1) ) { |
456 | memcpy(nic_packet->buffer, skb->data, length); | 456 | skb_copy_from_linear_data(skb, nic_packet->buffer, |
457 | length); | ||
457 | buf = (unsigned long)&((struct nic_pkt_s *)phys_nic_packet)->buffer; | 458 | buf = (unsigned long)&((struct nic_pkt_s *)phys_nic_packet)->buffer; |
458 | } | 459 | } |
459 | 460 | ||
@@ -544,13 +545,13 @@ bionet_poll_rx(struct net_device *dev) { | |||
544 | break; | 545 | break; |
545 | } | 546 | } |
546 | 547 | ||
547 | skb->dev = dev; | ||
548 | skb_reserve( skb, 2 ); /* 16 Byte align */ | 548 | skb_reserve( skb, 2 ); /* 16 Byte align */ |
549 | skb_put( skb, pkt_len ); /* make room */ | 549 | skb_put( skb, pkt_len ); /* make room */ |
550 | 550 | ||
551 | /* 'skb->data' points to the start of sk_buff data area. | 551 | /* 'skb->data' points to the start of sk_buff data area. |
552 | */ | 552 | */ |
553 | memcpy(skb->data, nic_packet->buffer, pkt_len); | 553 | skb_copy_to_linear_data(skb, nic_packet->buffer, |
554 | pkt_len); | ||
554 | skb->protocol = eth_type_trans( skb, dev ); | 555 | skb->protocol = eth_type_trans( skb, dev ); |
555 | netif_rx(skb); | 556 | netif_rx(skb); |
556 | dev->last_rx = jiffies; | 557 | dev->last_rx = jiffies; |
diff --git a/drivers/net/atari_pamsnet.c b/drivers/net/atari_pamsnet.c index 3b5436149286..54714409a09b 100644 --- a/drivers/net/atari_pamsnet.c +++ b/drivers/net/atari_pamsnet.c | |||
@@ -717,7 +717,8 @@ pamsnet_send_packet(struct sk_buff *skb, struct net_device *dev) { | |||
717 | 717 | ||
718 | local_irq_restore(flags); | 718 | local_irq_restore(flags); |
719 | if( !STRAM_ADDR(buf+length-1) ) { | 719 | if( !STRAM_ADDR(buf+length-1) ) { |
720 | memcpy(nic_packet->buffer, skb->data, length); | 720 | skb_copy_from_linear_data(skb, nic_packet->buffer, |
721 | length); | ||
721 | buf = (unsigned long)phys_nic_packet; | 722 | buf = (unsigned long)phys_nic_packet; |
722 | } | 723 | } |
723 | 724 | ||
@@ -792,7 +793,8 @@ pamsnet_poll_rx(struct net_device *dev) { | |||
792 | 793 | ||
793 | /* 'skb->data' points to the start of sk_buff data area. | 794 | /* 'skb->data' points to the start of sk_buff data area. |
794 | */ | 795 | */ |
795 | memcpy(skb->data, nic_packet->buffer, pkt_len); | 796 | skb_copy_to_linear_data(skb, nic_packet->buffer, |
797 | pkt_len); | ||
796 | netif_rx(skb); | 798 | netif_rx(skb); |
797 | dev->last_rx = jiffies; | 799 | dev->last_rx = jiffies; |
798 | lp->stats.rx_packets++; | 800 | lp->stats.rx_packets++; |
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c index 7e37ac86a69a..dfa8b9ba4c80 100644 --- a/drivers/net/atarilance.c +++ b/drivers/net/atarilance.c | |||
@@ -1047,7 +1047,6 @@ static int lance_rx( struct net_device *dev ) | |||
1047 | pkt_len ); | 1047 | pkt_len ); |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | skb->dev = dev; | ||
1051 | skb_reserve( skb, 2 ); /* 16 byte align */ | 1050 | skb_reserve( skb, 2 ); /* 16 byte align */ |
1052 | skb_put( skb, pkt_len ); /* Make room */ | 1051 | skb_put( skb, pkt_len ); /* Make room */ |
1053 | lp->memcpy_f( skb->data, PKTBUF_ADDR(head), pkt_len ); | 1052 | lp->memcpy_f( skb->data, PKTBUF_ADDR(head), pkt_len ); |
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 8606eac5bec8..4b1d4d153ecf 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -408,7 +408,6 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter, | |||
408 | static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter) | 408 | static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter) |
409 | { | 409 | { |
410 | struct atl1_rfd_ring *rfd_ring = &adapter->rfd_ring; | 410 | struct atl1_rfd_ring *rfd_ring = &adapter->rfd_ring; |
411 | struct net_device *netdev = adapter->netdev; | ||
412 | struct pci_dev *pdev = adapter->pdev; | 411 | struct pci_dev *pdev = adapter->pdev; |
413 | struct page *page; | 412 | struct page *page; |
414 | unsigned long offset; | 413 | unsigned long offset; |
@@ -444,7 +443,6 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter) | |||
444 | * the 14 byte MAC header is removed | 443 | * the 14 byte MAC header is removed |
445 | */ | 444 | */ |
446 | skb_reserve(skb, NET_IP_ALIGN); | 445 | skb_reserve(skb, NET_IP_ALIGN); |
447 | skb->dev = netdev; | ||
448 | 446 | ||
449 | buffer_info->alloced = 1; | 447 | buffer_info->alloced = 1; |
450 | buffer_info->skb = skb; | 448 | buffer_info->skb = skb; |
@@ -1296,19 +1294,21 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
1296 | } | 1294 | } |
1297 | 1295 | ||
1298 | if (skb->protocol == ntohs(ETH_P_IP)) { | 1296 | if (skb->protocol == ntohs(ETH_P_IP)) { |
1299 | skb->nh.iph->tot_len = 0; | 1297 | struct iphdr *iph = ip_hdr(skb); |
1300 | skb->nh.iph->check = 0; | 1298 | |
1301 | skb->h.th->check = | 1299 | iph->tot_len = 0; |
1302 | ~csum_tcpudp_magic(skb->nh.iph->saddr, | 1300 | iph->check = 0; |
1303 | skb->nh.iph->daddr, 0, | 1301 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
1304 | IPPROTO_TCP, 0); | 1302 | iph->daddr, 0, |
1305 | ipofst = skb->nh.raw - skb->data; | 1303 | IPPROTO_TCP, |
1304 | 0); | ||
1305 | ipofst = skb_network_offset(skb); | ||
1306 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ | 1306 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ |
1307 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; | 1307 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; |
1308 | 1308 | ||
1309 | tso->tsopl |= (skb->nh.iph->ihl & | 1309 | tso->tsopl |= (iph->ihl & |
1310 | CSUM_PARAM_IPHL_MASK) << CSUM_PARAM_IPHL_SHIFT; | 1310 | CSUM_PARAM_IPHL_MASK) << CSUM_PARAM_IPHL_SHIFT; |
1311 | tso->tsopl |= ((skb->h.th->doff << 2) & | 1311 | tso->tsopl |= (tcp_hdrlen(skb) & |
1312 | TSO_PARAM_TCPHDRLEN_MASK) << TSO_PARAM_TCPHDRLEN_SHIFT; | 1312 | TSO_PARAM_TCPHDRLEN_MASK) << TSO_PARAM_TCPHDRLEN_SHIFT; |
1313 | tso->tsopl |= (skb_shinfo(skb)->gso_size & | 1313 | tso->tsopl |= (skb_shinfo(skb)->gso_size & |
1314 | TSO_PARAM_MSS_MASK) << TSO_PARAM_MSS_SHIFT; | 1314 | TSO_PARAM_MSS_MASK) << TSO_PARAM_MSS_SHIFT; |
@@ -1327,8 +1327,8 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
1327 | u8 css, cso; | 1327 | u8 css, cso; |
1328 | 1328 | ||
1329 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 1329 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
1330 | cso = skb->h.raw - skb->data; | 1330 | cso = skb_transport_offset(skb); |
1331 | css = (skb->h.raw + skb->csum_offset) - skb->data; | 1331 | css = cso + skb->csum_offset; |
1332 | if (unlikely(cso & 0x1)) { | 1332 | if (unlikely(cso & 0x1)) { |
1333 | printk(KERN_DEBUG "%s: payload offset != even number\n", | 1333 | printk(KERN_DEBUG "%s: payload offset != even number\n", |
1334 | atl1_driver_name); | 1334 | atl1_driver_name); |
@@ -1370,8 +1370,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, | |||
1370 | 1370 | ||
1371 | if (tcp_seg) { | 1371 | if (tcp_seg) { |
1372 | /* TSO/GSO */ | 1372 | /* TSO/GSO */ |
1373 | proto_hdr_len = | 1373 | proto_hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1374 | ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | ||
1375 | buffer_info->length = proto_hdr_len; | 1374 | buffer_info->length = proto_hdr_len; |
1376 | page = virt_to_page(skb->data); | 1375 | page = virt_to_page(skb->data); |
1377 | offset = (unsigned long)skb->data & ~PAGE_MASK; | 1376 | offset = (unsigned long)skb->data & ~PAGE_MASK; |
@@ -1563,8 +1562,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1563 | mss = skb_shinfo(skb)->gso_size; | 1562 | mss = skb_shinfo(skb)->gso_size; |
1564 | if (mss) { | 1563 | if (mss) { |
1565 | if (skb->protocol == htons(ETH_P_IP)) { | 1564 | if (skb->protocol == htons(ETH_P_IP)) { |
1566 | proto_hdr_len = ((skb->h.raw - skb->data) + | 1565 | proto_hdr_len = (skb_transport_offset(skb) + |
1567 | (skb->h.th->doff << 2)); | 1566 | tcp_hdrlen(skb)); |
1568 | if (unlikely(proto_hdr_len > len)) { | 1567 | if (unlikely(proto_hdr_len > len)) { |
1569 | dev_kfree_skb_any(skb); | 1568 | dev_kfree_skb_any(skb); |
1570 | return NETDEV_TX_OK; | 1569 | return NETDEV_TX_OK; |
diff --git a/drivers/net/atp.c b/drivers/net/atp.c index 2d306fcb7f36..18aba838c1ff 100644 --- a/drivers/net/atp.c +++ b/drivers/net/atp.c | |||
@@ -793,7 +793,6 @@ static void net_rx(struct net_device *dev) | |||
793 | lp->stats.rx_dropped++; | 793 | lp->stats.rx_dropped++; |
794 | goto done; | 794 | goto done; |
795 | } | 795 | } |
796 | skb->dev = dev; | ||
797 | 796 | ||
798 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 797 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
799 | read_block(ioaddr, pkt_len, skb_put(skb,pkt_len), dev->if_port); | 798 | read_block(ioaddr, pkt_len, skb_put(skb,pkt_len), dev->if_port); |
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 69ae229b680e..d10fb80e9a63 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
@@ -1125,7 +1125,7 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev) | |||
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | pDB = aup->tx_db_inuse[aup->tx_head]; | 1127 | pDB = aup->tx_db_inuse[aup->tx_head]; |
1128 | memcpy((void *)pDB->vaddr, skb->data, skb->len); | 1128 | skb_copy_from_linear_data(skb, pDB->vaddr, skb->len); |
1129 | if (skb->len < ETH_ZLEN) { | 1129 | if (skb->len < ETH_ZLEN) { |
1130 | for (i=skb->len; i<ETH_ZLEN; i++) { | 1130 | for (i=skb->len; i<ETH_ZLEN; i++) { |
1131 | ((char *)pDB->vaddr)[i] = 0; | 1131 | ((char *)pDB->vaddr)[i] = 0; |
@@ -1205,7 +1205,6 @@ static int au1000_rx(struct net_device *dev) | |||
1205 | aup->stats.rx_dropped++; | 1205 | aup->stats.rx_dropped++; |
1206 | continue; | 1206 | continue; |
1207 | } | 1207 | } |
1208 | skb->dev = dev; | ||
1209 | skb_reserve(skb, 2); /* 16 byte IP header align */ | 1208 | skb_reserve(skb, 2); /* 16 byte IP header align */ |
1210 | eth_copy_and_sum(skb, | 1209 | eth_copy_and_sum(skb, |
1211 | (unsigned char *)pDB->vaddr, frmlen, 0); | 1210 | (unsigned char *)pDB->vaddr, frmlen, 0); |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index d742bfe24471..879a2fff474e 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -825,12 +825,11 @@ static int b44_rx(struct b44 *bp, int budget) | |||
825 | if (copy_skb == NULL) | 825 | if (copy_skb == NULL) |
826 | goto drop_it_no_recycle; | 826 | goto drop_it_no_recycle; |
827 | 827 | ||
828 | copy_skb->dev = bp->dev; | ||
829 | skb_reserve(copy_skb, 2); | 828 | skb_reserve(copy_skb, 2); |
830 | skb_put(copy_skb, len); | 829 | skb_put(copy_skb, len); |
831 | /* DMA sync done above, copy just the actual packet */ | 830 | /* DMA sync done above, copy just the actual packet */ |
832 | memcpy(copy_skb->data, skb->data+bp->rx_offset, len); | 831 | skb_copy_from_linear_data_offset(skb, bp->rx_offset, |
833 | 832 | copy_skb->data, len); | |
834 | skb = copy_skb; | 833 | skb = copy_skb; |
835 | } | 834 | } |
836 | skb->ip_summed = CHECKSUM_NONE; | 835 | skb->ip_summed = CHECKSUM_NONE; |
@@ -1007,7 +1006,8 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1007 | goto err_out; | 1006 | goto err_out; |
1008 | } | 1007 | } |
1009 | 1008 | ||
1010 | memcpy(skb_put(bounce_skb, len), skb->data, skb->len); | 1009 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), |
1010 | skb->len); | ||
1011 | dev_kfree_skb_any(skb); | 1011 | dev_kfree_skb_any(skb); |
1012 | skb = bounce_skb; | 1012 | skb = bounce_skb; |
1013 | } | 1013 | } |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index c143304dcff5..4612725965df 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -715,7 +715,6 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id) | |||
715 | if (skb != NULL) { | 715 | if (skb != NULL) { |
716 | nb -= ETHERCRC; | 716 | nb -= ETHERCRC; |
717 | skb_put(skb, nb); | 717 | skb_put(skb, nb); |
718 | skb->dev = dev; | ||
719 | skb->protocol = eth_type_trans(skb, dev); | 718 | skb->protocol = eth_type_trans(skb, dev); |
720 | netif_rx(skb); | 719 | netif_rx(skb); |
721 | dev->last_rx = jiffies; | 720 | dev->last_rx = jiffies; |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 0b7aded8dcfd..f98a2205a090 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -54,8 +54,8 @@ | |||
54 | 54 | ||
55 | #define DRV_MODULE_NAME "bnx2" | 55 | #define DRV_MODULE_NAME "bnx2" |
56 | #define PFX DRV_MODULE_NAME ": " | 56 | #define PFX DRV_MODULE_NAME ": " |
57 | #define DRV_MODULE_VERSION "1.5.7" | 57 | #define DRV_MODULE_VERSION "1.5.8" |
58 | #define DRV_MODULE_RELDATE "March 29, 2007" | 58 | #define DRV_MODULE_RELDATE "April 24, 2007" |
59 | 59 | ||
60 | #define RUN_AT(x) (jiffies + (x)) | 60 | #define RUN_AT(x) (jiffies + (x)) |
61 | 61 | ||
@@ -1884,10 +1884,8 @@ bnx2_rx_int(struct bnx2 *bp, int budget) | |||
1884 | goto reuse_rx; | 1884 | goto reuse_rx; |
1885 | 1885 | ||
1886 | /* aligned copy */ | 1886 | /* aligned copy */ |
1887 | memcpy(new_skb->data, | 1887 | skb_copy_from_linear_data_offset(skb, bp->rx_offset - 2, |
1888 | skb->data + bp->rx_offset - 2, | 1888 | new_skb->data, len + 2); |
1889 | len + 2); | ||
1890 | |||
1891 | skb_reserve(new_skb, 2); | 1889 | skb_reserve(new_skb, 2); |
1892 | skb_put(new_skb, len); | 1890 | skb_put(new_skb, len); |
1893 | 1891 | ||
@@ -3421,6 +3419,9 @@ bnx2_init_chip(struct bnx2 *bp) | |||
3421 | val = REG_RD(bp, BNX2_MQ_CONFIG); | 3419 | val = REG_RD(bp, BNX2_MQ_CONFIG); |
3422 | val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE; | 3420 | val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE; |
3423 | val |= BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE_256; | 3421 | val |= BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE_256; |
3422 | if (CHIP_ID(bp) == CHIP_ID_5709_A0 || CHIP_ID(bp) == CHIP_ID_5709_A1) | ||
3423 | val |= BNX2_MQ_CONFIG_HALT_DIS; | ||
3424 | |||
3424 | REG_WR(bp, BNX2_MQ_CONFIG, val); | 3425 | REG_WR(bp, BNX2_MQ_CONFIG, val); |
3425 | 3426 | ||
3426 | val = 0x10000 + (MAX_CID_CNT * MB_KERNEL_CTX_SIZE); | 3427 | val = 0x10000 + (MAX_CID_CNT * MB_KERNEL_CTX_SIZE); |
@@ -4510,6 +4511,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4510 | if ((mss = skb_shinfo(skb)->gso_size) && | 4511 | if ((mss = skb_shinfo(skb)->gso_size) && |
4511 | (skb->len > (bp->dev->mtu + ETH_HLEN))) { | 4512 | (skb->len > (bp->dev->mtu + ETH_HLEN))) { |
4512 | u32 tcp_opt_len, ip_tcp_len; | 4513 | u32 tcp_opt_len, ip_tcp_len; |
4514 | struct iphdr *iph; | ||
4513 | 4515 | ||
4514 | if (skb_header_cloned(skb) && | 4516 | if (skb_header_cloned(skb) && |
4515 | pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { | 4517 | pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { |
@@ -4517,25 +4519,23 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4517 | return NETDEV_TX_OK; | 4519 | return NETDEV_TX_OK; |
4518 | } | 4520 | } |
4519 | 4521 | ||
4520 | tcp_opt_len = ((skb->h.th->doff - 5) * 4); | ||
4521 | vlan_tag_flags |= TX_BD_FLAGS_SW_LSO; | 4522 | vlan_tag_flags |= TX_BD_FLAGS_SW_LSO; |
4522 | 4523 | ||
4523 | tcp_opt_len = 0; | 4524 | tcp_opt_len = 0; |
4524 | if (skb->h.th->doff > 5) { | 4525 | if (tcp_hdr(skb)->doff > 5) |
4525 | tcp_opt_len = (skb->h.th->doff - 5) << 2; | 4526 | tcp_opt_len = tcp_optlen(skb); |
4526 | } | 4527 | |
4527 | ip_tcp_len = (skb->nh.iph->ihl << 2) + sizeof(struct tcphdr); | 4528 | ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); |
4528 | 4529 | ||
4529 | skb->nh.iph->check = 0; | 4530 | iph = ip_hdr(skb); |
4530 | skb->nh.iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); | 4531 | iph->check = 0; |
4531 | skb->h.th->check = | 4532 | iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); |
4532 | ~csum_tcpudp_magic(skb->nh.iph->saddr, | 4533 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
4533 | skb->nh.iph->daddr, | 4534 | iph->daddr, 0, |
4534 | 0, IPPROTO_TCP, 0); | 4535 | IPPROTO_TCP, 0); |
4535 | 4536 | if (tcp_opt_len || (iph->ihl > 5)) { | |
4536 | if (tcp_opt_len || (skb->nh.iph->ihl > 5)) { | 4537 | vlan_tag_flags |= ((iph->ihl - 5) + |
4537 | vlan_tag_flags |= ((skb->nh.iph->ihl - 5) + | 4538 | (tcp_opt_len >> 2)) << 8; |
4538 | (tcp_opt_len >> 2)) << 8; | ||
4539 | } | 4539 | } |
4540 | } | 4540 | } |
4541 | else | 4541 | else |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index ccbdf81c6599..878eee58f12a 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -6518,6 +6518,7 @@ struct bnx2 { | |||
6518 | #define CHIP_ID_5708_B0 0x57081000 | 6518 | #define CHIP_ID_5708_B0 0x57081000 |
6519 | #define CHIP_ID_5708_B1 0x57081010 | 6519 | #define CHIP_ID_5708_B1 0x57081010 |
6520 | #define CHIP_ID_5709_A0 0x57090000 | 6520 | #define CHIP_ID_5709_A0 0x57090000 |
6521 | #define CHIP_ID_5709_A1 0x57090010 | ||
6521 | 6522 | ||
6522 | #define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf) | 6523 | #define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf) |
6523 | 6524 | ||
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 3fb354d9c515..7e03f41ae2c2 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -884,8 +884,8 @@ static int ad_lacpdu_send(struct port *port) | |||
884 | } | 884 | } |
885 | 885 | ||
886 | skb->dev = slave->dev; | 886 | skb->dev = slave->dev; |
887 | skb->mac.raw = skb->data; | 887 | skb_reset_mac_header(skb); |
888 | skb->nh.raw = skb->data + ETH_HLEN; | 888 | skb->network_header = skb->mac_header + ETH_HLEN; |
889 | skb->protocol = PKT_TYPE_LACPDU; | 889 | skb->protocol = PKT_TYPE_LACPDU; |
890 | skb->priority = TC_PRIO_CONTROL; | 890 | skb->priority = TC_PRIO_CONTROL; |
891 | 891 | ||
@@ -928,8 +928,8 @@ static int ad_marker_send(struct port *port, struct marker *marker) | |||
928 | skb_reserve(skb, 16); | 928 | skb_reserve(skb, 16); |
929 | 929 | ||
930 | skb->dev = slave->dev; | 930 | skb->dev = slave->dev; |
931 | skb->mac.raw = skb->data; | 931 | skb_reset_mac_header(skb); |
932 | skb->nh.raw = skb->data + ETH_HLEN; | 932 | skb->network_header = skb->mac_header + ETH_HLEN; |
933 | skb->protocol = PKT_TYPE_LACPDU; | 933 | skb->protocol = PKT_TYPE_LACPDU; |
934 | 934 | ||
935 | marker_header = (struct marker_header *)skb_put(skb, length); | 935 | marker_header = (struct marker_header *)skb_put(skb, length); |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 217a2eedee0a..92c3b6f6a8e7 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -104,10 +104,15 @@ struct arp_pkt { | |||
104 | }; | 104 | }; |
105 | #pragma pack() | 105 | #pragma pack() |
106 | 106 | ||
107 | static inline struct arp_pkt *arp_pkt(const struct sk_buff *skb) | ||
108 | { | ||
109 | return (struct arp_pkt *)skb_network_header(skb); | ||
110 | } | ||
111 | |||
107 | /* Forward declaration */ | 112 | /* Forward declaration */ |
108 | static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]); | 113 | static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]); |
109 | 114 | ||
110 | static inline u8 _simple_hash(u8 *hash_start, int hash_size) | 115 | static inline u8 _simple_hash(const u8 *hash_start, int hash_size) |
111 | { | 116 | { |
112 | int i; | 117 | int i; |
113 | u8 hash = 0; | 118 | u8 hash = 0; |
@@ -613,7 +618,7 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip) | |||
613 | static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond) | 618 | static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond) |
614 | { | 619 | { |
615 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 620 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
616 | struct arp_pkt *arp = (struct arp_pkt *)skb->nh.raw; | 621 | struct arp_pkt *arp = arp_pkt(skb); |
617 | struct slave *assigned_slave; | 622 | struct slave *assigned_slave; |
618 | struct rlb_client_info *client_info; | 623 | struct rlb_client_info *client_info; |
619 | u32 hash_index = 0; | 624 | u32 hash_index = 0; |
@@ -701,7 +706,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon | |||
701 | */ | 706 | */ |
702 | static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) | 707 | static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) |
703 | { | 708 | { |
704 | struct arp_pkt *arp = (struct arp_pkt *)skb->nh.raw; | 709 | struct arp_pkt *arp = arp_pkt(skb); |
705 | struct slave *tx_slave = NULL; | 710 | struct slave *tx_slave = NULL; |
706 | 711 | ||
707 | if (arp->op_code == __constant_htons(ARPOP_REPLY)) { | 712 | if (arp->op_code == __constant_htons(ARPOP_REPLY)) { |
@@ -890,8 +895,8 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]) | |||
890 | data = skb_put(skb, size); | 895 | data = skb_put(skb, size); |
891 | memcpy(data, &pkt, size); | 896 | memcpy(data, &pkt, size); |
892 | 897 | ||
893 | skb->mac.raw = data; | 898 | skb_reset_mac_header(skb); |
894 | skb->nh.raw = data + ETH_HLEN; | 899 | skb->network_header = skb->mac_header + ETH_HLEN; |
895 | skb->protocol = pkt.type; | 900 | skb->protocol = pkt.type; |
896 | skb->priority = TC_PRIO_CONTROL; | 901 | skb->priority = TC_PRIO_CONTROL; |
897 | skb->dev = slave->dev; | 902 | skb->dev = slave->dev; |
@@ -1263,10 +1268,10 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev) | |||
1263 | int hash_size = 0; | 1268 | int hash_size = 0; |
1264 | int do_tx_balance = 1; | 1269 | int do_tx_balance = 1; |
1265 | u32 hash_index = 0; | 1270 | u32 hash_index = 0; |
1266 | u8 *hash_start = NULL; | 1271 | const u8 *hash_start = NULL; |
1267 | int res = 1; | 1272 | int res = 1; |
1268 | 1273 | ||
1269 | skb->mac.raw = (unsigned char *)skb->data; | 1274 | skb_reset_mac_header(skb); |
1270 | eth_data = eth_hdr(skb); | 1275 | eth_data = eth_hdr(skb); |
1271 | 1276 | ||
1272 | /* make sure that the curr_active_slave and the slaves list do | 1277 | /* make sure that the curr_active_slave and the slaves list do |
@@ -1280,15 +1285,18 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev) | |||
1280 | } | 1285 | } |
1281 | 1286 | ||
1282 | switch (ntohs(skb->protocol)) { | 1287 | switch (ntohs(skb->protocol)) { |
1283 | case ETH_P_IP: | 1288 | case ETH_P_IP: { |
1289 | const struct iphdr *iph = ip_hdr(skb); | ||
1290 | |||
1284 | if ((memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) || | 1291 | if ((memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) || |
1285 | (skb->nh.iph->daddr == ip_bcast) || | 1292 | (iph->daddr == ip_bcast) || |
1286 | (skb->nh.iph->protocol == IPPROTO_IGMP)) { | 1293 | (iph->protocol == IPPROTO_IGMP)) { |
1287 | do_tx_balance = 0; | 1294 | do_tx_balance = 0; |
1288 | break; | 1295 | break; |
1289 | } | 1296 | } |
1290 | hash_start = (char*)&(skb->nh.iph->daddr); | 1297 | hash_start = (char *)&(iph->daddr); |
1291 | hash_size = sizeof(skb->nh.iph->daddr); | 1298 | hash_size = sizeof(iph->daddr); |
1299 | } | ||
1292 | break; | 1300 | break; |
1293 | case ETH_P_IPV6: | 1301 | case ETH_P_IPV6: |
1294 | if (memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) { | 1302 | if (memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) { |
@@ -1296,8 +1304,8 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev) | |||
1296 | break; | 1304 | break; |
1297 | } | 1305 | } |
1298 | 1306 | ||
1299 | hash_start = (char*)&(skb->nh.ipv6h->daddr); | 1307 | hash_start = (char *)&(ipv6_hdr(skb)->daddr); |
1300 | hash_size = sizeof(skb->nh.ipv6h->daddr); | 1308 | hash_size = sizeof(ipv6_hdr(skb)->daddr); |
1301 | break; | 1309 | break; |
1302 | case ETH_P_IPX: | 1310 | case ETH_P_IPX: |
1303 | if (ipx_hdr(skb)->ipx_checksum != | 1311 | if (ipx_hdr(skb)->ipx_checksum != |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index e4724d874e7c..cea3783c92c5 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2524,7 +2524,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack | |||
2524 | (2 * sizeof(u32))))) | 2524 | (2 * sizeof(u32))))) |
2525 | goto out_unlock; | 2525 | goto out_unlock; |
2526 | 2526 | ||
2527 | arp = skb->nh.arph; | 2527 | arp = arp_hdr(skb); |
2528 | if (arp->ar_hln != dev->addr_len || | 2528 | if (arp->ar_hln != dev->addr_len || |
2529 | skb->pkt_type == PACKET_OTHERHOST || | 2529 | skb->pkt_type == PACKET_OTHERHOST || |
2530 | skb->pkt_type == PACKET_LOOPBACK || | 2530 | skb->pkt_type == PACKET_LOOPBACK || |
@@ -3476,7 +3476,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb, | |||
3476 | struct net_device *bond_dev, int count) | 3476 | struct net_device *bond_dev, int count) |
3477 | { | 3477 | { |
3478 | struct ethhdr *data = (struct ethhdr *)skb->data; | 3478 | struct ethhdr *data = (struct ethhdr *)skb->data; |
3479 | struct iphdr *iph = skb->nh.iph; | 3479 | struct iphdr *iph = ip_hdr(skb); |
3480 | u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl); | 3480 | u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl); |
3481 | int layer4_xor = 0; | 3481 | int layer4_xor = 0; |
3482 | 3482 | ||
@@ -3640,9 +3640,8 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev) | |||
3640 | read_lock_bh(&bond->lock); | 3640 | read_lock_bh(&bond->lock); |
3641 | 3641 | ||
3642 | bond_for_each_slave(bond, slave, i) { | 3642 | bond_for_each_slave(bond, slave, i) { |
3643 | if (slave->dev->get_stats) { | 3643 | sstats = slave->dev->get_stats(slave->dev); |
3644 | sstats = slave->dev->get_stats(slave->dev); | 3644 | if (sstats) { |
3645 | |||
3646 | stats->rx_packets += sstats->rx_packets; | 3645 | stats->rx_packets += sstats->rx_packets; |
3647 | stats->rx_bytes += sstats->rx_bytes; | 3646 | stats->rx_bytes += sstats->rx_bytes; |
3648 | stats->rx_errors += sstats->rx_errors; | 3647 | stats->rx_errors += sstats->rx_errors; |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index c8126484c2be..4aec747d9e43 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -1995,7 +1995,6 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, | |||
1995 | return -1; | 1995 | return -1; |
1996 | 1996 | ||
1997 | *skbref = skb; | 1997 | *skbref = skb; |
1998 | skb->dev = cp->dev; | ||
1999 | skb_reserve(skb, swivel); | 1998 | skb_reserve(skb, swivel); |
2000 | 1999 | ||
2001 | p = skb->data; | 2000 | p = skb->data; |
@@ -2822,10 +2821,8 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring, | |||
2822 | 2821 | ||
2823 | ctrl = 0; | 2822 | ctrl = 0; |
2824 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2823 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2825 | u64 csum_start_off, csum_stuff_off; | 2824 | const u64 csum_start_off = skb_transport_offset(skb); |
2826 | 2825 | const u64 csum_stuff_off = csum_start_off + skb->csum_offset; | |
2827 | csum_start_off = (u64) (skb->h.raw - skb->data); | ||
2828 | csum_stuff_off = csum_start_off + skb->csum_offset; | ||
2829 | 2826 | ||
2830 | ctrl = TX_DESC_CSUM_EN | | 2827 | ctrl = TX_DESC_CSUM_EN | |
2831 | CAS_BASE(TX_DESC_CSUM_START, csum_start_off) | | 2828 | CAS_BASE(TX_DESC_CSUM_START, csum_start_off) | |
@@ -2849,8 +2846,8 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring, | |||
2849 | ctrl | TX_DESC_SOF, 0); | 2846 | ctrl | TX_DESC_SOF, 0); |
2850 | entry = TX_DESC_NEXT(ring, entry); | 2847 | entry = TX_DESC_NEXT(ring, entry); |
2851 | 2848 | ||
2852 | memcpy(tx_tiny_buf(cp, ring, entry), skb->data + | 2849 | skb_copy_from_linear_data_offset(skb, len - tabort, |
2853 | len - tabort, tabort); | 2850 | tx_tiny_buf(cp, ring, entry), tabort); |
2854 | mapping = tx_tiny_map(cp, ring, entry, tentry); | 2851 | mapping = tx_tiny_map(cp, ring, entry, tentry); |
2855 | cas_write_txd(cp, ring, entry, mapping, tabort, ctrl, | 2852 | cas_write_txd(cp, ring, entry, mapping, tabort, ctrl, |
2856 | (nr_frags == 0)); | 2853 | (nr_frags == 0)); |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 326d4a665123..e4f874a70fe5 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -1062,7 +1062,7 @@ static inline struct sk_buff *get_packet(struct pci_dev *pdev, | |||
1062 | pci_unmap_addr(ce, dma_addr), | 1062 | pci_unmap_addr(ce, dma_addr), |
1063 | pci_unmap_len(ce, dma_len), | 1063 | pci_unmap_len(ce, dma_len), |
1064 | PCI_DMA_FROMDEVICE); | 1064 | PCI_DMA_FROMDEVICE); |
1065 | memcpy(skb->data, ce->skb->data, len); | 1065 | skb_copy_from_linear_data(ce->skb, skb->data, len); |
1066 | pci_dma_sync_single_for_device(pdev, | 1066 | pci_dma_sync_single_for_device(pdev, |
1067 | pci_unmap_addr(ce, dma_addr), | 1067 | pci_unmap_addr(ce, dma_addr), |
1068 | pci_unmap_len(ce, dma_len), | 1068 | pci_unmap_len(ce, dma_len), |
@@ -1379,12 +1379,11 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) | |||
1379 | } | 1379 | } |
1380 | __skb_pull(skb, sizeof(*p)); | 1380 | __skb_pull(skb, sizeof(*p)); |
1381 | 1381 | ||
1382 | skb->dev = adapter->port[p->iff].dev; | ||
1383 | skb->dev->last_rx = jiffies; | 1382 | skb->dev->last_rx = jiffies; |
1384 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); | 1383 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); |
1385 | st->rx_packets++; | 1384 | st->rx_packets++; |
1386 | 1385 | ||
1387 | skb->protocol = eth_type_trans(skb, skb->dev); | 1386 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); |
1388 | if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff && | 1387 | if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff && |
1389 | skb->protocol == htons(ETH_P_IP) && | 1388 | skb->protocol == htons(ETH_P_IP) && |
1390 | (skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) { | 1389 | (skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) { |
@@ -1866,14 +1865,14 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1866 | 1865 | ||
1867 | ++st->tx_tso; | 1866 | ++st->tx_tso; |
1868 | 1867 | ||
1869 | eth_type = skb->nh.raw - skb->data == ETH_HLEN ? | 1868 | eth_type = skb_network_offset(skb) == ETH_HLEN ? |
1870 | CPL_ETH_II : CPL_ETH_II_VLAN; | 1869 | CPL_ETH_II : CPL_ETH_II_VLAN; |
1871 | 1870 | ||
1872 | hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr)); | 1871 | hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr)); |
1873 | hdr->opcode = CPL_TX_PKT_LSO; | 1872 | hdr->opcode = CPL_TX_PKT_LSO; |
1874 | hdr->ip_csum_dis = hdr->l4_csum_dis = 0; | 1873 | hdr->ip_csum_dis = hdr->l4_csum_dis = 0; |
1875 | hdr->ip_hdr_words = skb->nh.iph->ihl; | 1874 | hdr->ip_hdr_words = ip_hdr(skb)->ihl; |
1876 | hdr->tcp_hdr_words = skb->h.th->doff; | 1875 | hdr->tcp_hdr_words = tcp_hdr(skb)->doff; |
1877 | hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type, | 1876 | hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type, |
1878 | skb_shinfo(skb)->gso_size)); | 1877 | skb_shinfo(skb)->gso_size)); |
1879 | hdr->len = htonl(skb->len - sizeof(*hdr)); | 1878 | hdr->len = htonl(skb->len - sizeof(*hdr)); |
@@ -1913,7 +1912,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1913 | 1912 | ||
1914 | if (!(adapter->flags & UDP_CSUM_CAPABLE) && | 1913 | if (!(adapter->flags & UDP_CSUM_CAPABLE) && |
1915 | skb->ip_summed == CHECKSUM_PARTIAL && | 1914 | skb->ip_summed == CHECKSUM_PARTIAL && |
1916 | skb->nh.iph->protocol == IPPROTO_UDP) { | 1915 | ip_hdr(skb)->protocol == IPPROTO_UDP) { |
1917 | if (unlikely(skb_checksum_help(skb))) { | 1916 | if (unlikely(skb_checksum_help(skb))) { |
1918 | pr_debug("%s: unable to do udp checksum\n", dev->name); | 1917 | pr_debug("%s: unable to do udp checksum\n", dev->name); |
1919 | dev_kfree_skb_any(skb); | 1918 | dev_kfree_skb_any(skb); |
@@ -1926,7 +1925,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1926 | */ | 1925 | */ |
1927 | if ((unlikely(!adapter->sge->espibug_skb[dev->if_port]))) { | 1926 | if ((unlikely(!adapter->sge->espibug_skb[dev->if_port]))) { |
1928 | if (skb->protocol == htons(ETH_P_ARP) && | 1927 | if (skb->protocol == htons(ETH_P_ARP) && |
1929 | skb->nh.arph->ar_op == htons(ARPOP_REQUEST)) { | 1928 | arp_hdr(skb)->ar_op == htons(ARPOP_REQUEST)) { |
1930 | adapter->sge->espibug_skb[dev->if_port] = skb; | 1929 | adapter->sge->espibug_skb[dev->if_port] = skb; |
1931 | /* We want to re-use this skb later. We | 1930 | /* We want to re-use this skb later. We |
1932 | * simply bump the reference count and it | 1931 | * simply bump the reference count and it |
@@ -2096,10 +2095,14 @@ static void espibug_workaround_t204(unsigned long data) | |||
2096 | 0x0, 0x7, 0x43, 0x0, 0x0, 0x0 | 2095 | 0x0, 0x7, 0x43, 0x0, 0x0, 0x0 |
2097 | }; | 2096 | }; |
2098 | 2097 | ||
2099 | memcpy(skb->data + sizeof(struct cpl_tx_pkt), | 2098 | skb_copy_to_linear_data_offset(skb, |
2100 | ch_mac_addr, ETH_ALEN); | 2099 | sizeof(struct cpl_tx_pkt), |
2101 | memcpy(skb->data + skb->len - 10, | 2100 | ch_mac_addr, |
2102 | ch_mac_addr, ETH_ALEN); | 2101 | ETH_ALEN); |
2102 | skb_copy_to_linear_data_offset(skb, | ||
2103 | skb->len - 10, | ||
2104 | ch_mac_addr, | ||
2105 | ETH_ALEN); | ||
2103 | skb->cb[0] = 0xff; | 2106 | skb->cb[0] = 0xff; |
2104 | } | 2107 | } |
2105 | 2108 | ||
@@ -2126,10 +2129,14 @@ static void espibug_workaround(unsigned long data) | |||
2126 | if (!skb->cb[0]) { | 2129 | if (!skb->cb[0]) { |
2127 | u8 ch_mac_addr[ETH_ALEN] = | 2130 | u8 ch_mac_addr[ETH_ALEN] = |
2128 | {0x0, 0x7, 0x43, 0x0, 0x0, 0x0}; | 2131 | {0x0, 0x7, 0x43, 0x0, 0x0, 0x0}; |
2129 | memcpy(skb->data + sizeof(struct cpl_tx_pkt), | 2132 | skb_copy_to_linear_data_offset(skb, |
2130 | ch_mac_addr, ETH_ALEN); | 2133 | sizeof(struct cpl_tx_pkt), |
2131 | memcpy(skb->data + skb->len - 10, ch_mac_addr, | 2134 | ch_mac_addr, |
2132 | ETH_ALEN); | 2135 | ETH_ALEN); |
2136 | skb_copy_to_linear_data_offset(skb, | ||
2137 | skb->len - 10, | ||
2138 | ch_mac_addr, | ||
2139 | ETH_ALEN); | ||
2133 | skb->cb[0] = 0xff; | 2140 | skb->cb[0] = 0xff; |
2134 | } | 2141 | } |
2135 | 2142 | ||
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 8eb571276000..5bdf5ca85a65 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -1348,7 +1348,8 @@ e100_rx(struct net_device *dev) | |||
1348 | 1348 | ||
1349 | #ifdef ETHDEBUG | 1349 | #ifdef ETHDEBUG |
1350 | printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n", | 1350 | printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n", |
1351 | skb->head, skb->data, skb->tail, skb->end); | 1351 | skb->head, skb->data, skb_tail_pointer(skb), |
1352 | skb_end_pointer(skb)); | ||
1352 | printk("copying packet to 0x%x.\n", skb_data_ptr); | 1353 | printk("copying packet to 0x%x.\n", skb_data_ptr); |
1353 | #endif | 1354 | #endif |
1354 | 1355 | ||
@@ -1375,7 +1376,6 @@ e100_rx(struct net_device *dev) | |||
1375 | myNextRxDesc->descr.buf = L1_CACHE_ALIGN(virt_to_phys(myNextRxDesc->skb->data)); | 1376 | myNextRxDesc->descr.buf = L1_CACHE_ALIGN(virt_to_phys(myNextRxDesc->skb->data)); |
1376 | } | 1377 | } |
1377 | 1378 | ||
1378 | skb->dev = dev; | ||
1379 | skb->protocol = eth_type_trans(skb, dev); | 1379 | skb->protocol = eth_type_trans(skb, dev); |
1380 | 1380 | ||
1381 | /* Send the packet to the upper layers */ | 1381 | /* Send the packet to the upper layers */ |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 4612f71a7106..9774bb1b3e80 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -1004,7 +1004,6 @@ skip_this_frame: | |||
1004 | return; | 1004 | return; |
1005 | } | 1005 | } |
1006 | skb_reserve(skb, 2); /* longword align L3 header */ | 1006 | skb_reserve(skb, 2); /* longword align L3 header */ |
1007 | skb->dev = dev; | ||
1008 | 1007 | ||
1009 | if (bp + length > lp->end_dma_buff) { | 1008 | if (bp + length > lp->end_dma_buff) { |
1010 | int semi_cnt = lp->end_dma_buff - bp; | 1009 | int semi_cnt = lp->end_dma_buff - bp; |
@@ -1702,7 +1701,6 @@ net_rx(struct net_device *dev) | |||
1702 | return; | 1701 | return; |
1703 | } | 1702 | } |
1704 | skb_reserve(skb, 2); /* longword align L3 header */ | 1703 | skb_reserve(skb, 2); /* longword align L3 header */ |
1705 | skb->dev = dev; | ||
1706 | 1704 | ||
1707 | readwords(ioaddr, RX_FRAME_PORT, skb_put(skb, length), length >> 1); | 1705 | readwords(ioaddr, RX_FRAME_PORT, skb_put(skb, length), length >> 1); |
1708 | if (length & 1) | 1706 | if (length & 1) |
diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h index e14862b43d17..483a594210a7 100644 --- a/drivers/net/cxgb3/cxgb3_defs.h +++ b/drivers/net/cxgb3/cxgb3_defs.h | |||
@@ -67,7 +67,10 @@ static inline union listen_entry *stid2entry(const struct tid_info *t, | |||
67 | static inline struct t3c_tid_entry *lookup_tid(const struct tid_info *t, | 67 | static inline struct t3c_tid_entry *lookup_tid(const struct tid_info *t, |
68 | unsigned int tid) | 68 | unsigned int tid) |
69 | { | 69 | { |
70 | return tid < t->ntids ? &(t->tid_tab[tid]) : NULL; | 70 | struct t3c_tid_entry *t3c_tid = tid < t->ntids ? |
71 | &(t->tid_tab[tid]) : NULL; | ||
72 | |||
73 | return (t3c_tid && t3c_tid->client) ? t3c_tid : NULL; | ||
71 | } | 74 | } |
72 | 75 | ||
73 | /* | 76 | /* |
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c index 48649244673e..ebcf35e4cf5b 100644 --- a/drivers/net/cxgb3/cxgb3_offload.c +++ b/drivers/net/cxgb3/cxgb3_offload.c | |||
@@ -508,6 +508,7 @@ void cxgb3_queue_tid_release(struct t3cdev *tdev, unsigned int tid) | |||
508 | 508 | ||
509 | spin_lock_bh(&td->tid_release_lock); | 509 | spin_lock_bh(&td->tid_release_lock); |
510 | p->ctx = (void *)td->tid_release_list; | 510 | p->ctx = (void *)td->tid_release_list; |
511 | p->client = NULL; | ||
511 | td->tid_release_list = p; | 512 | td->tid_release_list = p; |
512 | if (!p->ctx) | 513 | if (!p->ctx) |
513 | schedule_work(&td->tid_release_task); | 514 | schedule_work(&td->tid_release_task); |
@@ -623,7 +624,8 @@ static int do_act_open_rpl(struct t3cdev *dev, struct sk_buff *skb) | |||
623 | struct t3c_tid_entry *t3c_tid; | 624 | struct t3c_tid_entry *t3c_tid; |
624 | 625 | ||
625 | t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); | 626 | t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); |
626 | if (t3c_tid->ctx && t3c_tid->client && t3c_tid->client->handlers && | 627 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client && |
628 | t3c_tid->client->handlers && | ||
627 | t3c_tid->client->handlers[CPL_ACT_OPEN_RPL]) { | 629 | t3c_tid->client->handlers[CPL_ACT_OPEN_RPL]) { |
628 | return t3c_tid->client->handlers[CPL_ACT_OPEN_RPL] (dev, skb, | 630 | return t3c_tid->client->handlers[CPL_ACT_OPEN_RPL] (dev, skb, |
629 | t3c_tid-> | 631 | t3c_tid-> |
@@ -642,7 +644,7 @@ static int do_stid_rpl(struct t3cdev *dev, struct sk_buff *skb) | |||
642 | struct t3c_tid_entry *t3c_tid; | 644 | struct t3c_tid_entry *t3c_tid; |
643 | 645 | ||
644 | t3c_tid = lookup_stid(&(T3C_DATA(dev))->tid_maps, stid); | 646 | t3c_tid = lookup_stid(&(T3C_DATA(dev))->tid_maps, stid); |
645 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 647 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
646 | t3c_tid->client->handlers[p->opcode]) { | 648 | t3c_tid->client->handlers[p->opcode]) { |
647 | return t3c_tid->client->handlers[p->opcode] (dev, skb, | 649 | return t3c_tid->client->handlers[p->opcode] (dev, skb, |
648 | t3c_tid->ctx); | 650 | t3c_tid->ctx); |
@@ -660,7 +662,7 @@ static int do_hwtid_rpl(struct t3cdev *dev, struct sk_buff *skb) | |||
660 | struct t3c_tid_entry *t3c_tid; | 662 | struct t3c_tid_entry *t3c_tid; |
661 | 663 | ||
662 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); | 664 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); |
663 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 665 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
664 | t3c_tid->client->handlers[p->opcode]) { | 666 | t3c_tid->client->handlers[p->opcode]) { |
665 | return t3c_tid->client->handlers[p->opcode] | 667 | return t3c_tid->client->handlers[p->opcode] |
666 | (dev, skb, t3c_tid->ctx); | 668 | (dev, skb, t3c_tid->ctx); |
@@ -689,6 +691,28 @@ static int do_cr(struct t3cdev *dev, struct sk_buff *skb) | |||
689 | } | 691 | } |
690 | } | 692 | } |
691 | 693 | ||
694 | /* | ||
695 | * Returns an sk_buff for a reply CPL message of size len. If the input | ||
696 | * sk_buff has no other users it is trimmed and reused, otherwise a new buffer | ||
697 | * is allocated. The input skb must be of size at least len. Note that this | ||
698 | * operation does not destroy the original skb data even if it decides to reuse | ||
699 | * the buffer. | ||
700 | */ | ||
701 | static struct sk_buff *cxgb3_get_cpl_reply_skb(struct sk_buff *skb, size_t len, | ||
702 | int gfp) | ||
703 | { | ||
704 | if (likely(!skb_cloned(skb))) { | ||
705 | BUG_ON(skb->len < len); | ||
706 | __skb_trim(skb, len); | ||
707 | skb_get(skb); | ||
708 | } else { | ||
709 | skb = alloc_skb(len, gfp); | ||
710 | if (skb) | ||
711 | __skb_put(skb, len); | ||
712 | } | ||
713 | return skb; | ||
714 | } | ||
715 | |||
692 | static int do_abort_req_rss(struct t3cdev *dev, struct sk_buff *skb) | 716 | static int do_abort_req_rss(struct t3cdev *dev, struct sk_buff *skb) |
693 | { | 717 | { |
694 | union opcode_tid *p = cplhdr(skb); | 718 | union opcode_tid *p = cplhdr(skb); |
@@ -696,30 +720,39 @@ static int do_abort_req_rss(struct t3cdev *dev, struct sk_buff *skb) | |||
696 | struct t3c_tid_entry *t3c_tid; | 720 | struct t3c_tid_entry *t3c_tid; |
697 | 721 | ||
698 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); | 722 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); |
699 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 723 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
700 | t3c_tid->client->handlers[p->opcode]) { | 724 | t3c_tid->client->handlers[p->opcode]) { |
701 | return t3c_tid->client->handlers[p->opcode] | 725 | return t3c_tid->client->handlers[p->opcode] |
702 | (dev, skb, t3c_tid->ctx); | 726 | (dev, skb, t3c_tid->ctx); |
703 | } else { | 727 | } else { |
704 | struct cpl_abort_req_rss *req = cplhdr(skb); | 728 | struct cpl_abort_req_rss *req = cplhdr(skb); |
705 | struct cpl_abort_rpl *rpl; | 729 | struct cpl_abort_rpl *rpl; |
730 | struct sk_buff *reply_skb; | ||
731 | unsigned int tid = GET_TID(req); | ||
732 | u8 cmd = req->status; | ||
733 | |||
734 | if (req->status == CPL_ERR_RTX_NEG_ADVICE || | ||
735 | req->status == CPL_ERR_PERSIST_NEG_ADVICE) | ||
736 | goto out; | ||
706 | 737 | ||
707 | struct sk_buff *skb = | 738 | reply_skb = cxgb3_get_cpl_reply_skb(skb, |
708 | alloc_skb(sizeof(struct cpl_abort_rpl), GFP_ATOMIC); | 739 | sizeof(struct |
709 | if (!skb) { | 740 | cpl_abort_rpl), |
741 | GFP_ATOMIC); | ||
742 | |||
743 | if (!reply_skb) { | ||
710 | printk("do_abort_req_rss: couldn't get skb!\n"); | 744 | printk("do_abort_req_rss: couldn't get skb!\n"); |
711 | goto out; | 745 | goto out; |
712 | } | 746 | } |
713 | skb->priority = CPL_PRIORITY_DATA; | 747 | reply_skb->priority = CPL_PRIORITY_DATA; |
714 | __skb_put(skb, sizeof(struct cpl_abort_rpl)); | 748 | __skb_put(reply_skb, sizeof(struct cpl_abort_rpl)); |
715 | rpl = cplhdr(skb); | 749 | rpl = cplhdr(reply_skb); |
716 | rpl->wr.wr_hi = | 750 | rpl->wr.wr_hi = |
717 | htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL)); | 751 | htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL)); |
718 | rpl->wr.wr_lo = htonl(V_WR_TID(GET_TID(req))); | 752 | rpl->wr.wr_lo = htonl(V_WR_TID(tid)); |
719 | OPCODE_TID(rpl) = | 753 | OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, tid)); |
720 | htonl(MK_OPCODE_TID(CPL_ABORT_RPL, GET_TID(req))); | 754 | rpl->cmd = cmd; |
721 | rpl->cmd = req->status; | 755 | cxgb3_ofld_send(dev, reply_skb); |
722 | cxgb3_ofld_send(dev, skb); | ||
723 | out: | 756 | out: |
724 | return CPL_RET_BUF_DONE; | 757 | return CPL_RET_BUF_DONE; |
725 | } | 758 | } |
@@ -732,7 +765,7 @@ static int do_act_establish(struct t3cdev *dev, struct sk_buff *skb) | |||
732 | struct t3c_tid_entry *t3c_tid; | 765 | struct t3c_tid_entry *t3c_tid; |
733 | 766 | ||
734 | t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); | 767 | t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); |
735 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 768 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
736 | t3c_tid->client->handlers[CPL_ACT_ESTABLISH]) { | 769 | t3c_tid->client->handlers[CPL_ACT_ESTABLISH]) { |
737 | return t3c_tid->client->handlers[CPL_ACT_ESTABLISH] | 770 | return t3c_tid->client->handlers[CPL_ACT_ESTABLISH] |
738 | (dev, skb, t3c_tid->ctx); | 771 | (dev, skb, t3c_tid->ctx); |
@@ -750,7 +783,7 @@ static int do_trace(struct t3cdev *dev, struct sk_buff *skb) | |||
750 | skb->protocol = htons(0xffff); | 783 | skb->protocol = htons(0xffff); |
751 | skb->dev = dev->lldev; | 784 | skb->dev = dev->lldev; |
752 | skb_pull(skb, sizeof(*p)); | 785 | skb_pull(skb, sizeof(*p)); |
753 | skb->mac.raw = skb->data; | 786 | skb_reset_mac_header(skb); |
754 | netif_receive_skb(skb); | 787 | netif_receive_skb(skb); |
755 | return 0; | 788 | return 0; |
756 | } | 789 | } |
@@ -762,7 +795,7 @@ static int do_term(struct t3cdev *dev, struct sk_buff *skb) | |||
762 | struct t3c_tid_entry *t3c_tid; | 795 | struct t3c_tid_entry *t3c_tid; |
763 | 796 | ||
764 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); | 797 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); |
765 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 798 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
766 | t3c_tid->client->handlers[opcode]) { | 799 | t3c_tid->client->handlers[opcode]) { |
767 | return t3c_tid->client->handlers[opcode] (dev, skb, | 800 | return t3c_tid->client->handlers[opcode] (dev, skb, |
768 | t3c_tid->ctx); | 801 | t3c_tid->ctx); |
@@ -961,7 +994,7 @@ void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) | |||
961 | for (tid = 0; tid < ti->ntids; tid++) { | 994 | for (tid = 0; tid < ti->ntids; tid++) { |
962 | te = lookup_tid(ti, tid); | 995 | te = lookup_tid(ti, tid); |
963 | BUG_ON(!te); | 996 | BUG_ON(!te); |
964 | if (te->ctx && te->client && te->client->redirect) { | 997 | if (te && te->ctx && te->client && te->client->redirect) { |
965 | update_tcb = te->client->redirect(te->ctx, old, new, e); | 998 | update_tcb = te->client->redirect(te->ctx, old, new, e); |
966 | if (update_tcb) { | 999 | if (update_tcb) { |
967 | l2t_hold(L2DATA(tdev), e); | 1000 | l2t_hold(L2DATA(tdev), e); |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 027ab2c3825c..3666586a4831 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -661,7 +661,7 @@ static inline struct sk_buff *get_imm_packet(const struct rsp_desc *resp) | |||
661 | 661 | ||
662 | if (skb) { | 662 | if (skb) { |
663 | __skb_put(skb, IMMED_PKT_SIZE); | 663 | __skb_put(skb, IMMED_PKT_SIZE); |
664 | memcpy(skb->data, resp->imm_data, IMMED_PKT_SIZE); | 664 | skb_copy_to_linear_data(skb, resp->imm_data, IMMED_PKT_SIZE); |
665 | } | 665 | } |
666 | return skb; | 666 | return skb; |
667 | } | 667 | } |
@@ -897,11 +897,11 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
897 | d->flit[2] = 0; | 897 | d->flit[2] = 0; |
898 | cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO); | 898 | cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO); |
899 | hdr->cntrl = htonl(cntrl); | 899 | hdr->cntrl = htonl(cntrl); |
900 | eth_type = skb->nh.raw - skb->data == ETH_HLEN ? | 900 | eth_type = skb_network_offset(skb) == ETH_HLEN ? |
901 | CPL_ETH_II : CPL_ETH_II_VLAN; | 901 | CPL_ETH_II : CPL_ETH_II_VLAN; |
902 | tso_info |= V_LSO_ETH_TYPE(eth_type) | | 902 | tso_info |= V_LSO_ETH_TYPE(eth_type) | |
903 | V_LSO_IPHDR_WORDS(skb->nh.iph->ihl) | | 903 | V_LSO_IPHDR_WORDS(ip_hdr(skb)->ihl) | |
904 | V_LSO_TCPHDR_WORDS(skb->h.th->doff); | 904 | V_LSO_TCPHDR_WORDS(tcp_hdr(skb)->doff); |
905 | hdr->lso_info = htonl(tso_info); | 905 | hdr->lso_info = htonl(tso_info); |
906 | flits = 3; | 906 | flits = 3; |
907 | } else { | 907 | } else { |
@@ -913,7 +913,8 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
913 | if (skb->len <= WR_LEN - sizeof(*cpl)) { | 913 | if (skb->len <= WR_LEN - sizeof(*cpl)) { |
914 | q->sdesc[pidx].skb = NULL; | 914 | q->sdesc[pidx].skb = NULL; |
915 | if (!skb->data_len) | 915 | if (!skb->data_len) |
916 | memcpy(&d->flit[2], skb->data, skb->len); | 916 | skb_copy_from_linear_data(skb, &d->flit[2], |
917 | skb->len); | ||
917 | else | 918 | else |
918 | skb_copy_bits(skb, 0, &d->flit[2], skb->len); | 919 | skb_copy_bits(skb, 0, &d->flit[2], skb->len); |
919 | 920 | ||
@@ -1319,16 +1320,19 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, | |||
1319 | /* Only TX_DATA builds SGLs */ | 1320 | /* Only TX_DATA builds SGLs */ |
1320 | 1321 | ||
1321 | from = (struct work_request_hdr *)skb->data; | 1322 | from = (struct work_request_hdr *)skb->data; |
1322 | memcpy(&d->flit[1], &from[1], skb->h.raw - skb->data - sizeof(*from)); | 1323 | memcpy(&d->flit[1], &from[1], |
1324 | skb_transport_offset(skb) - sizeof(*from)); | ||
1323 | 1325 | ||
1324 | flits = (skb->h.raw - skb->data) / 8; | 1326 | flits = skb_transport_offset(skb) / 8; |
1325 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; | 1327 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; |
1326 | sgl_flits = make_sgl(skb, sgp, skb->h.raw, skb->tail - skb->h.raw, | 1328 | sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), |
1329 | skb->tail - skb->transport_header, | ||
1327 | adap->pdev); | 1330 | adap->pdev); |
1328 | if (need_skb_unmap()) { | 1331 | if (need_skb_unmap()) { |
1329 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); | 1332 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); |
1330 | skb->destructor = deferred_unmap_destructor; | 1333 | skb->destructor = deferred_unmap_destructor; |
1331 | ((struct unmap_info *)skb->cb)->len = skb->tail - skb->h.raw; | 1334 | ((struct unmap_info *)skb->cb)->len = (skb->tail - |
1335 | skb->transport_header); | ||
1332 | } | 1336 | } |
1333 | 1337 | ||
1334 | write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, | 1338 | write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, |
@@ -1349,8 +1353,8 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb) | |||
1349 | if (skb->len <= WR_LEN && cnt == 0) | 1353 | if (skb->len <= WR_LEN && cnt == 0) |
1350 | return 1; /* packet fits as immediate data */ | 1354 | return 1; /* packet fits as immediate data */ |
1351 | 1355 | ||
1352 | flits = (skb->h.raw - skb->data) / 8; /* headers */ | 1356 | flits = skb_transport_offset(skb) / 8; /* headers */ |
1353 | if (skb->tail != skb->h.raw) | 1357 | if (skb->tail != skb->transport_header) |
1354 | cnt++; | 1358 | cnt++; |
1355 | return flits_to_desc(flits + sgl_len(cnt)); | 1359 | return flits_to_desc(flits + sgl_len(cnt)); |
1356 | } | 1360 | } |
@@ -1620,7 +1624,9 @@ static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq, | |||
1620 | unsigned int gather_idx) | 1624 | unsigned int gather_idx) |
1621 | { | 1625 | { |
1622 | rq->offload_pkts++; | 1626 | rq->offload_pkts++; |
1623 | skb->mac.raw = skb->nh.raw = skb->h.raw = skb->data; | 1627 | skb_reset_mac_header(skb); |
1628 | skb_reset_network_header(skb); | ||
1629 | skb_reset_transport_header(skb); | ||
1624 | 1630 | ||
1625 | if (rq->polling) { | 1631 | if (rq->polling) { |
1626 | rx_gather[gather_idx++] = skb; | 1632 | rx_gather[gather_idx++] = skb; |
@@ -1684,9 +1690,8 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq, | |||
1684 | struct port_info *pi; | 1690 | struct port_info *pi; |
1685 | 1691 | ||
1686 | skb_pull(skb, sizeof(*p) + pad); | 1692 | skb_pull(skb, sizeof(*p) + pad); |
1687 | skb->dev = adap->port[p->iff]; | ||
1688 | skb->dev->last_rx = jiffies; | 1693 | skb->dev->last_rx = jiffies; |
1689 | skb->protocol = eth_type_trans(skb, skb->dev); | 1694 | skb->protocol = eth_type_trans(skb, adap->port[p->iff]); |
1690 | pi = netdev_priv(skb->dev); | 1695 | pi = netdev_priv(skb->dev); |
1691 | if (pi->rx_csum_offload && p->csum_valid && p->csum == 0xffff && | 1696 | if (pi->rx_csum_offload && p->csum_valid && p->csum == 0xffff && |
1692 | !p->fragment) { | 1697 | !p->fragment) { |
@@ -1717,11 +1722,11 @@ static void skb_data_init(struct sk_buff *skb, struct sge_fl_page *p, | |||
1717 | { | 1722 | { |
1718 | skb->len = len; | 1723 | skb->len = len; |
1719 | if (len <= SKB_DATA_SIZE) { | 1724 | if (len <= SKB_DATA_SIZE) { |
1720 | memcpy(skb->data, p->va, len); | 1725 | skb_copy_to_linear_data(skb, p->va, len); |
1721 | skb->tail += len; | 1726 | skb->tail += len; |
1722 | put_page(p->frag.page); | 1727 | put_page(p->frag.page); |
1723 | } else { | 1728 | } else { |
1724 | memcpy(skb->data, p->va, SKB_DATA_SIZE); | 1729 | skb_copy_to_linear_data(skb, p->va, SKB_DATA_SIZE); |
1725 | skb_shinfo(skb)->frags[0].page = p->frag.page; | 1730 | skb_shinfo(skb)->frags[0].page = p->frag.page; |
1726 | skb_shinfo(skb)->frags[0].page_offset = | 1731 | skb_shinfo(skb)->frags[0].page_offset = |
1727 | p->frag.page_offset + SKB_DATA_SIZE; | 1732 | p->frag.page_offset + SKB_DATA_SIZE; |
@@ -1767,7 +1772,7 @@ static struct sk_buff *get_packet(struct adapter *adap, struct sge_fl *fl, | |||
1767 | __skb_put(skb, len); | 1772 | __skb_put(skb, len); |
1768 | pci_dma_sync_single_for_cpu(adap->pdev, mapping, len, | 1773 | pci_dma_sync_single_for_cpu(adap->pdev, mapping, len, |
1769 | PCI_DMA_FROMDEVICE); | 1774 | PCI_DMA_FROMDEVICE); |
1770 | memcpy(skb->data, sd->t.skb->data, len); | 1775 | skb_copy_from_linear_data(sd->t.skb, skb->data, len); |
1771 | pci_dma_sync_single_for_device(adap->pdev, mapping, len, | 1776 | pci_dma_sync_single_for_device(adap->pdev, mapping, len, |
1772 | PCI_DMA_FROMDEVICE); | 1777 | PCI_DMA_FROMDEVICE); |
1773 | } else if (!drop_thres) | 1778 | } else if (!drop_thres) |
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index d83f075ef2d7..fb485d0a43d8 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -1523,19 +1523,25 @@ static int mac_intr_handler(struct adapter *adap, unsigned int idx) | |||
1523 | */ | 1523 | */ |
1524 | int t3_phy_intr_handler(struct adapter *adapter) | 1524 | int t3_phy_intr_handler(struct adapter *adapter) |
1525 | { | 1525 | { |
1526 | static const int intr_gpio_bits[] = { 8, 0x20 }; | 1526 | u32 mask, gpi = adapter_info(adapter)->gpio_intr; |
1527 | |||
1528 | u32 i, cause = t3_read_reg(adapter, A_T3DBG_INT_CAUSE); | 1527 | u32 i, cause = t3_read_reg(adapter, A_T3DBG_INT_CAUSE); |
1529 | 1528 | ||
1530 | for_each_port(adapter, i) { | 1529 | for_each_port(adapter, i) { |
1531 | if (cause & intr_gpio_bits[i]) { | 1530 | struct port_info *p = adap2pinfo(adapter, i); |
1532 | struct cphy *phy = &adap2pinfo(adapter, i)->phy; | 1531 | |
1533 | int phy_cause = phy->ops->intr_handler(phy); | 1532 | mask = gpi - (gpi & (gpi - 1)); |
1533 | gpi -= mask; | ||
1534 | |||
1535 | if (!(p->port_type->caps & SUPPORTED_IRQ)) | ||
1536 | continue; | ||
1537 | |||
1538 | if (cause & mask) { | ||
1539 | int phy_cause = p->phy.ops->intr_handler(&p->phy); | ||
1534 | 1540 | ||
1535 | if (phy_cause & cphy_cause_link_change) | 1541 | if (phy_cause & cphy_cause_link_change) |
1536 | t3_link_changed(adapter, i); | 1542 | t3_link_changed(adapter, i); |
1537 | if (phy_cause & cphy_cause_fifo_error) | 1543 | if (phy_cause & cphy_cause_fifo_error) |
1538 | phy->fifo_errors++; | 1544 | p->phy.fifo_errors++; |
1539 | } | 1545 | } |
1540 | } | 1546 | } |
1541 | 1547 | ||
diff --git a/drivers/net/de600.c b/drivers/net/de600.c index e547ce14eefe..dae97b860daa 100644 --- a/drivers/net/de600.c +++ b/drivers/net/de600.c | |||
@@ -359,7 +359,6 @@ static void de600_rx_intr(struct net_device *dev) | |||
359 | } | 359 | } |
360 | /* else */ | 360 | /* else */ |
361 | 361 | ||
362 | skb->dev = dev; | ||
363 | skb_reserve(skb,2); /* Align */ | 362 | skb_reserve(skb,2); /* Align */ |
364 | 363 | ||
365 | /* 'skb->data' points to the start of sk_buff data area. */ | 364 | /* 'skb->data' points to the start of sk_buff data area. */ |
diff --git a/drivers/net/de620.c b/drivers/net/de620.c index b6ad0cb50552..dc4892426174 100644 --- a/drivers/net/de620.c +++ b/drivers/net/de620.c | |||
@@ -697,7 +697,6 @@ static int de620_rx_intr(struct net_device *dev) | |||
697 | } | 697 | } |
698 | else { /* Yep! Go get it! */ | 698 | else { /* Yep! Go get it! */ |
699 | skb_reserve(skb,2); /* Align */ | 699 | skb_reserve(skb,2); /* Align */ |
700 | skb->dev = dev; | ||
701 | /* skb->data points to the start of sk_buff data area */ | 700 | /* skb->data points to the start of sk_buff data area */ |
702 | buffer = skb_put(skb,size); | 701 | buffer = skb_put(skb,size); |
703 | /* copy the packet into the buffer */ | 702 | /* copy the packet into the buffer */ |
diff --git a/drivers/net/declance.c b/drivers/net/declance.c index 9f7e1db8ce62..95d854e2295c 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c | |||
@@ -616,7 +616,6 @@ static int lance_rx(struct net_device *dev) | |||
616 | } | 616 | } |
617 | lp->stats.rx_bytes += len; | 617 | lp->stats.rx_bytes += len; |
618 | 618 | ||
619 | skb->dev = dev; | ||
620 | skb_reserve(skb, 2); /* 16 byte align */ | 619 | skb_reserve(skb, 2); /* 16 byte align */ |
621 | skb_put(skb, len); /* make room */ | 620 | skb_put(skb, len); /* make room */ |
622 | 621 | ||
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index 07d2731c1aa8..571d82f8008c 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c | |||
@@ -3091,13 +3091,13 @@ static void dfx_rcv_queue_process( | |||
3091 | { | 3091 | { |
3092 | /* Receive buffer allocated, pass receive packet up */ | 3092 | /* Receive buffer allocated, pass receive packet up */ |
3093 | 3093 | ||
3094 | memcpy(skb->data, p_buff + RCV_BUFF_K_PADDING, pkt_len+3); | 3094 | skb_copy_to_linear_data(skb, |
3095 | p_buff + RCV_BUFF_K_PADDING, | ||
3096 | pkt_len + 3); | ||
3095 | } | 3097 | } |
3096 | 3098 | ||
3097 | skb_reserve(skb,3); /* adjust data field so that it points to FC byte */ | 3099 | skb_reserve(skb,3); /* adjust data field so that it points to FC byte */ |
3098 | skb_put(skb, pkt_len); /* pass up packet length, NOT including CRC */ | 3100 | skb_put(skb, pkt_len); /* pass up packet length, NOT including CRC */ |
3099 | skb->dev = bp->dev; /* pass up device pointer */ | ||
3100 | |||
3101 | skb->protocol = fddi_type_trans(skb, bp->dev); | 3101 | skb->protocol = fddi_type_trans(skb, bp->dev); |
3102 | bp->rcv_total_bytes += skb->len; | 3102 | bp->rcv_total_bytes += skb->len; |
3103 | netif_rx(skb); | 3103 | netif_rx(skb); |
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 5113eef755b9..183497020bfc 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -1044,7 +1044,6 @@ static int depca_rx(struct net_device *dev) | |||
1044 | unsigned char *buf; | 1044 | unsigned char *buf; |
1045 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1045 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1046 | buf = skb_put(skb, pkt_len); | 1046 | buf = skb_put(skb, pkt_len); |
1047 | skb->dev = dev; | ||
1048 | if (entry < lp->rx_old) { /* Wrapped buffer */ | 1047 | if (entry < lp->rx_old) { /* Wrapped buffer */ |
1049 | len = (lp->rxRingMask - lp->rx_old + 1) * RX_BUFF_SZ; | 1048 | len = (lp->rxRingMask - lp->rx_old + 1) * RX_BUFF_SZ; |
1050 | memcpy_fromio(buf, lp->rx_buff[lp->rx_old], len); | 1049 | memcpy_fromio(buf, lp->rx_buff[lp->rx_old], len); |
@@ -1491,8 +1490,9 @@ static void __init depca_platform_probe (void) | |||
1491 | depca_io_ports[i].device = pldev; | 1490 | depca_io_ports[i].device = pldev; |
1492 | 1491 | ||
1493 | if (platform_device_add(pldev)) { | 1492 | if (platform_device_add(pldev)) { |
1494 | platform_device_put(pldev); | ||
1495 | depca_io_ports[i].device = NULL; | 1493 | depca_io_ports[i].device = NULL; |
1494 | pldev->dev.platform_data = NULL; | ||
1495 | platform_device_put(pldev); | ||
1496 | continue; | 1496 | continue; |
1497 | } | 1497 | } |
1498 | 1498 | ||
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index a79520295fd0..df62c0232f36 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c | |||
@@ -503,7 +503,6 @@ dgrs_rcv_frame( | |||
503 | /* discarding the frame */ | 503 | /* discarding the frame */ |
504 | goto out; | 504 | goto out; |
505 | } | 505 | } |
506 | skb->dev = devN; | ||
507 | skb_reserve(skb, 2); /* Align IP header */ | 506 | skb_reserve(skb, 2); /* Align IP header */ |
508 | 507 | ||
509 | again: | 508 | again: |
@@ -742,7 +741,7 @@ static int dgrs_start_xmit(struct sk_buff *skb, struct net_device *devN) | |||
742 | } | 741 | } |
743 | 742 | ||
744 | amt = min_t(unsigned int, len, rbdp->size - count); | 743 | amt = min_t(unsigned int, len, rbdp->size - count); |
745 | memcpy( (char *) S2H(rbdp->buf) + count, skb->data + i, amt); | 744 | skb_copy_from_linear_data_offset(skb, i, S2H(rbdp->buf) + count, amt); |
746 | i += amt; | 745 | i += amt; |
747 | count += amt; | 746 | count += amt; |
748 | len -= amt; | 747 | len -= amt; |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 9d446a0fe0bf..74ec64a1625d 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -504,7 +504,6 @@ rio_timer (unsigned long data) | |||
504 | break; | 504 | break; |
505 | } | 505 | } |
506 | np->rx_skbuff[entry] = skb; | 506 | np->rx_skbuff[entry] = skb; |
507 | skb->dev = dev; | ||
508 | /* 16 byte align the IP header */ | 507 | /* 16 byte align the IP header */ |
509 | skb_reserve (skb, 2); | 508 | skb_reserve (skb, 2); |
510 | np->rx_ring[entry].fraginfo = | 509 | np->rx_ring[entry].fraginfo = |
@@ -575,7 +574,6 @@ alloc_list (struct net_device *dev) | |||
575 | dev->name); | 574 | dev->name); |
576 | break; | 575 | break; |
577 | } | 576 | } |
578 | skb->dev = dev; /* Mark as being used by this device. */ | ||
579 | skb_reserve (skb, 2); /* 16 byte align the IP header. */ | 577 | skb_reserve (skb, 2); /* 16 byte align the IP header. */ |
580 | /* Rubicon now supports 40 bits of addressing space. */ | 578 | /* Rubicon now supports 40 bits of addressing space. */ |
581 | np->rx_ring[i].fraginfo = | 579 | np->rx_ring[i].fraginfo = |
@@ -866,7 +864,6 @@ receive_packet (struct net_device *dev) | |||
866 | DMA_48BIT_MASK, | 864 | DMA_48BIT_MASK, |
867 | np->rx_buf_sz, | 865 | np->rx_buf_sz, |
868 | PCI_DMA_FROMDEVICE); | 866 | PCI_DMA_FROMDEVICE); |
869 | skb->dev = dev; | ||
870 | /* 16 byte align the IP header */ | 867 | /* 16 byte align the IP header */ |
871 | skb_reserve (skb, 2); | 868 | skb_reserve (skb, 2); |
872 | eth_copy_and_sum (skb, | 869 | eth_copy_and_sum (skb, |
@@ -910,7 +907,6 @@ receive_packet (struct net_device *dev) | |||
910 | break; | 907 | break; |
911 | } | 908 | } |
912 | np->rx_skbuff[entry] = skb; | 909 | np->rx_skbuff[entry] = skb; |
913 | skb->dev = dev; | ||
914 | /* 16 byte align the IP header */ | 910 | /* 16 byte align the IP header */ |
915 | skb_reserve (skb, 2); | 911 | skb_reserve (skb, 2); |
916 | np->rx_ring[entry].fraginfo = | 912 | np->rx_ring[entry].fraginfo = |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 615d2b14efa7..8cc1174e7f64 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -954,7 +954,6 @@ dm9000_rx(struct net_device *dev) | |||
954 | /* Move data from DM9000 */ | 954 | /* Move data from DM9000 */ |
955 | if (GoodPacket | 955 | if (GoodPacket |
956 | && ((skb = dev_alloc_skb(RxLen + 4)) != NULL)) { | 956 | && ((skb = dev_alloc_skb(RxLen + 4)) != NULL)) { |
957 | skb->dev = dev; | ||
958 | skb_reserve(skb, 2); | 957 | skb_reserve(skb, 2); |
959 | rdptr = (u8 *) skb_put(skb, RxLen - 4); | 958 | rdptr = (u8 *) skb_put(skb, RxLen - 4); |
960 | 959 | ||
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 0cefef5e3f06..4d0e0aea72bf 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1769,7 +1769,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | |||
1769 | 1769 | ||
1770 | /* Align, init, and map the RFD. */ | 1770 | /* Align, init, and map the RFD. */ |
1771 | skb_reserve(rx->skb, NET_IP_ALIGN); | 1771 | skb_reserve(rx->skb, NET_IP_ALIGN); |
1772 | memcpy(rx->skb->data, &nic->blank_rfd, sizeof(struct rfd)); | 1772 | skb_copy_to_linear_data(rx->skb, &nic->blank_rfd, sizeof(struct rfd)); |
1773 | rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data, | 1773 | rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data, |
1774 | RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); | 1774 | RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); |
1775 | 1775 | ||
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 1d08e937af82..9267f16b1b32 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -409,25 +409,21 @@ e1000_release_hw_control(struct e1000_adapter *adapter) | |||
409 | { | 409 | { |
410 | uint32_t ctrl_ext; | 410 | uint32_t ctrl_ext; |
411 | uint32_t swsm; | 411 | uint32_t swsm; |
412 | uint32_t extcnf; | ||
413 | 412 | ||
414 | /* Let firmware taken over control of h/w */ | 413 | /* Let firmware taken over control of h/w */ |
415 | switch (adapter->hw.mac_type) { | 414 | switch (adapter->hw.mac_type) { |
416 | case e1000_82571: | ||
417 | case e1000_82572: | ||
418 | case e1000_80003es2lan: | ||
419 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
420 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
421 | ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); | ||
422 | break; | ||
423 | case e1000_82573: | 415 | case e1000_82573: |
424 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 416 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
425 | E1000_WRITE_REG(&adapter->hw, SWSM, | 417 | E1000_WRITE_REG(&adapter->hw, SWSM, |
426 | swsm & ~E1000_SWSM_DRV_LOAD); | 418 | swsm & ~E1000_SWSM_DRV_LOAD); |
419 | break; | ||
420 | case e1000_82571: | ||
421 | case e1000_82572: | ||
422 | case e1000_80003es2lan: | ||
427 | case e1000_ich8lan: | 423 | case e1000_ich8lan: |
428 | extcnf = E1000_READ_REG(&adapter->hw, CTRL_EXT); | 424 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); |
429 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | 425 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, |
430 | extcnf & ~E1000_CTRL_EXT_DRV_LOAD); | 426 | ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); |
431 | break; | 427 | break; |
432 | default: | 428 | default: |
433 | break; | 429 | break; |
@@ -450,26 +446,21 @@ e1000_get_hw_control(struct e1000_adapter *adapter) | |||
450 | { | 446 | { |
451 | uint32_t ctrl_ext; | 447 | uint32_t ctrl_ext; |
452 | uint32_t swsm; | 448 | uint32_t swsm; |
453 | uint32_t extcnf; | ||
454 | 449 | ||
455 | /* Let firmware know the driver has taken over */ | 450 | /* Let firmware know the driver has taken over */ |
456 | switch (adapter->hw.mac_type) { | 451 | switch (adapter->hw.mac_type) { |
457 | case e1000_82571: | ||
458 | case e1000_82572: | ||
459 | case e1000_80003es2lan: | ||
460 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
461 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
462 | ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); | ||
463 | break; | ||
464 | case e1000_82573: | 452 | case e1000_82573: |
465 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 453 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
466 | E1000_WRITE_REG(&adapter->hw, SWSM, | 454 | E1000_WRITE_REG(&adapter->hw, SWSM, |
467 | swsm | E1000_SWSM_DRV_LOAD); | 455 | swsm | E1000_SWSM_DRV_LOAD); |
468 | break; | 456 | break; |
457 | case e1000_82571: | ||
458 | case e1000_82572: | ||
459 | case e1000_80003es2lan: | ||
469 | case e1000_ich8lan: | 460 | case e1000_ich8lan: |
470 | extcnf = E1000_READ_REG(&adapter->hw, EXTCNF_CTRL); | 461 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); |
471 | E1000_WRITE_REG(&adapter->hw, EXTCNF_CTRL, | 462 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, |
472 | extcnf | E1000_EXTCNF_CTRL_SWFLAG); | 463 | ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); |
473 | break; | 464 | break; |
474 | default: | 465 | default: |
475 | break; | 466 | break; |
@@ -522,14 +513,15 @@ e1000_release_manageability(struct e1000_adapter *adapter) | |||
522 | } | 513 | } |
523 | } | 514 | } |
524 | 515 | ||
525 | int | 516 | /** |
526 | e1000_up(struct e1000_adapter *adapter) | 517 | * e1000_configure - configure the hardware for RX and TX |
518 | * @adapter = private board structure | ||
519 | **/ | ||
520 | static void e1000_configure(struct e1000_adapter *adapter) | ||
527 | { | 521 | { |
528 | struct net_device *netdev = adapter->netdev; | 522 | struct net_device *netdev = adapter->netdev; |
529 | int i; | 523 | int i; |
530 | 524 | ||
531 | /* hardware has been reset, we need to reload some things */ | ||
532 | |||
533 | e1000_set_multi(netdev); | 525 | e1000_set_multi(netdev); |
534 | 526 | ||
535 | e1000_restore_vlan(adapter); | 527 | e1000_restore_vlan(adapter); |
@@ -548,14 +540,20 @@ e1000_up(struct e1000_adapter *adapter) | |||
548 | } | 540 | } |
549 | 541 | ||
550 | adapter->tx_queue_len = netdev->tx_queue_len; | 542 | adapter->tx_queue_len = netdev->tx_queue_len; |
543 | } | ||
544 | |||
545 | int e1000_up(struct e1000_adapter *adapter) | ||
546 | { | ||
547 | /* hardware has been reset, we need to reload some things */ | ||
548 | e1000_configure(adapter); | ||
549 | |||
550 | clear_bit(__E1000_DOWN, &adapter->flags); | ||
551 | 551 | ||
552 | #ifdef CONFIG_E1000_NAPI | 552 | #ifdef CONFIG_E1000_NAPI |
553 | netif_poll_enable(netdev); | 553 | netif_poll_enable(adapter->netdev); |
554 | #endif | 554 | #endif |
555 | e1000_irq_enable(adapter); | 555 | e1000_irq_enable(adapter); |
556 | 556 | ||
557 | clear_bit(__E1000_DOWN, &adapter->flags); | ||
558 | |||
559 | /* fire a link change interrupt to start the watchdog */ | 557 | /* fire a link change interrupt to start the watchdog */ |
560 | E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_LSC); | 558 | E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_LSC); |
561 | return 0; | 559 | return 0; |
@@ -640,15 +638,15 @@ e1000_down(struct e1000_adapter *adapter) | |||
640 | * reschedule our watchdog timer */ | 638 | * reschedule our watchdog timer */ |
641 | set_bit(__E1000_DOWN, &adapter->flags); | 639 | set_bit(__E1000_DOWN, &adapter->flags); |
642 | 640 | ||
641 | #ifdef CONFIG_E1000_NAPI | ||
642 | netif_poll_disable(netdev); | ||
643 | #endif | ||
643 | e1000_irq_disable(adapter); | 644 | e1000_irq_disable(adapter); |
644 | 645 | ||
645 | del_timer_sync(&adapter->tx_fifo_stall_timer); | 646 | del_timer_sync(&adapter->tx_fifo_stall_timer); |
646 | del_timer_sync(&adapter->watchdog_timer); | 647 | del_timer_sync(&adapter->watchdog_timer); |
647 | del_timer_sync(&adapter->phy_info_timer); | 648 | del_timer_sync(&adapter->phy_info_timer); |
648 | 649 | ||
649 | #ifdef CONFIG_E1000_NAPI | ||
650 | netif_poll_disable(netdev); | ||
651 | #endif | ||
652 | netdev->tx_queue_len = adapter->tx_queue_len; | 650 | netdev->tx_queue_len = adapter->tx_queue_len; |
653 | adapter->link_speed = 0; | 651 | adapter->link_speed = 0; |
654 | adapter->link_duplex = 0; | 652 | adapter->link_duplex = 0; |
@@ -1410,21 +1408,17 @@ e1000_open(struct net_device *netdev) | |||
1410 | return -EBUSY; | 1408 | return -EBUSY; |
1411 | 1409 | ||
1412 | /* allocate transmit descriptors */ | 1410 | /* allocate transmit descriptors */ |
1413 | if ((err = e1000_setup_all_tx_resources(adapter))) | 1411 | err = e1000_setup_all_tx_resources(adapter); |
1412 | if (err) | ||
1414 | goto err_setup_tx; | 1413 | goto err_setup_tx; |
1415 | 1414 | ||
1416 | /* allocate receive descriptors */ | 1415 | /* allocate receive descriptors */ |
1417 | if ((err = e1000_setup_all_rx_resources(adapter))) | 1416 | err = e1000_setup_all_rx_resources(adapter); |
1418 | goto err_setup_rx; | ||
1419 | |||
1420 | err = e1000_request_irq(adapter); | ||
1421 | if (err) | 1417 | if (err) |
1422 | goto err_req_irq; | 1418 | goto err_setup_rx; |
1423 | 1419 | ||
1424 | e1000_power_up_phy(adapter); | 1420 | e1000_power_up_phy(adapter); |
1425 | 1421 | ||
1426 | if ((err = e1000_up(adapter))) | ||
1427 | goto err_up; | ||
1428 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; | 1422 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
1429 | if ((adapter->hw.mng_cookie.status & | 1423 | if ((adapter->hw.mng_cookie.status & |
1430 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { | 1424 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { |
@@ -1437,12 +1431,33 @@ e1000_open(struct net_device *netdev) | |||
1437 | e1000_check_mng_mode(&adapter->hw)) | 1431 | e1000_check_mng_mode(&adapter->hw)) |
1438 | e1000_get_hw_control(adapter); | 1432 | e1000_get_hw_control(adapter); |
1439 | 1433 | ||
1434 | /* before we allocate an interrupt, we must be ready to handle it. | ||
1435 | * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt | ||
1436 | * as soon as we call pci_request_irq, so we have to setup our | ||
1437 | * clean_rx handler before we do so. */ | ||
1438 | e1000_configure(adapter); | ||
1439 | |||
1440 | err = e1000_request_irq(adapter); | ||
1441 | if (err) | ||
1442 | goto err_req_irq; | ||
1443 | |||
1444 | /* From here on the code is the same as e1000_up() */ | ||
1445 | clear_bit(__E1000_DOWN, &adapter->flags); | ||
1446 | |||
1447 | #ifdef CONFIG_E1000_NAPI | ||
1448 | netif_poll_enable(netdev); | ||
1449 | #endif | ||
1450 | |||
1451 | e1000_irq_enable(adapter); | ||
1452 | |||
1453 | /* fire a link status change interrupt to start the watchdog */ | ||
1454 | E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_LSC); | ||
1455 | |||
1440 | return E1000_SUCCESS; | 1456 | return E1000_SUCCESS; |
1441 | 1457 | ||
1442 | err_up: | ||
1443 | e1000_power_down_phy(adapter); | ||
1444 | e1000_free_irq(adapter); | ||
1445 | err_req_irq: | 1458 | err_req_irq: |
1459 | e1000_release_hw_control(adapter); | ||
1460 | e1000_power_down_phy(adapter); | ||
1446 | e1000_free_all_rx_resources(adapter); | 1461 | e1000_free_all_rx_resources(adapter); |
1447 | err_setup_rx: | 1462 | err_setup_rx: |
1448 | e1000_free_all_tx_resources(adapter); | 1463 | e1000_free_all_tx_resources(adapter); |
@@ -2887,33 +2902,30 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2887 | return err; | 2902 | return err; |
2888 | } | 2903 | } |
2889 | 2904 | ||
2890 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | 2905 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
2891 | mss = skb_shinfo(skb)->gso_size; | 2906 | mss = skb_shinfo(skb)->gso_size; |
2892 | if (skb->protocol == htons(ETH_P_IP)) { | 2907 | if (skb->protocol == htons(ETH_P_IP)) { |
2893 | skb->nh.iph->tot_len = 0; | 2908 | struct iphdr *iph = ip_hdr(skb); |
2894 | skb->nh.iph->check = 0; | 2909 | iph->tot_len = 0; |
2895 | skb->h.th->check = | 2910 | iph->check = 0; |
2896 | ~csum_tcpudp_magic(skb->nh.iph->saddr, | 2911 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
2897 | skb->nh.iph->daddr, | 2912 | iph->daddr, 0, |
2898 | 0, | 2913 | IPPROTO_TCP, |
2899 | IPPROTO_TCP, | 2914 | 0); |
2900 | 0); | ||
2901 | cmd_length = E1000_TXD_CMD_IP; | 2915 | cmd_length = E1000_TXD_CMD_IP; |
2902 | ipcse = skb->h.raw - skb->data - 1; | 2916 | ipcse = skb_transport_offset(skb) - 1; |
2903 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 2917 | } else if (skb->protocol == htons(ETH_P_IPV6)) { |
2904 | skb->nh.ipv6h->payload_len = 0; | 2918 | ipv6_hdr(skb)->payload_len = 0; |
2905 | skb->h.th->check = | 2919 | tcp_hdr(skb)->check = |
2906 | ~csum_ipv6_magic(&skb->nh.ipv6h->saddr, | 2920 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
2907 | &skb->nh.ipv6h->daddr, | 2921 | &ipv6_hdr(skb)->daddr, |
2908 | 0, | 2922 | 0, IPPROTO_TCP, 0); |
2909 | IPPROTO_TCP, | ||
2910 | 0); | ||
2911 | ipcse = 0; | 2923 | ipcse = 0; |
2912 | } | 2924 | } |
2913 | ipcss = skb->nh.raw - skb->data; | 2925 | ipcss = skb_network_offset(skb); |
2914 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; | 2926 | ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data; |
2915 | tucss = skb->h.raw - skb->data; | 2927 | tucss = skb_transport_offset(skb); |
2916 | tucso = (void *)&(skb->h.th->check) - (void *)skb->data; | 2928 | tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data; |
2917 | tucse = 0; | 2929 | tucse = 0; |
2918 | 2930 | ||
2919 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | | 2931 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | |
@@ -2954,7 +2966,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2954 | uint8_t css; | 2966 | uint8_t css; |
2955 | 2967 | ||
2956 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 2968 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
2957 | css = skb->h.raw - skb->data; | 2969 | css = skb_transport_offset(skb); |
2958 | 2970 | ||
2959 | i = tx_ring->next_to_use; | 2971 | i = tx_ring->next_to_use; |
2960 | buffer_info = &tx_ring->buffer_info[i]; | 2972 | buffer_info = &tx_ring->buffer_info[i]; |
@@ -2962,7 +2974,8 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2962 | 2974 | ||
2963 | context_desc->lower_setup.ip_config = 0; | 2975 | context_desc->lower_setup.ip_config = 0; |
2964 | context_desc->upper_setup.tcp_fields.tucss = css; | 2976 | context_desc->upper_setup.tcp_fields.tucss = css; |
2965 | context_desc->upper_setup.tcp_fields.tucso = css + skb->csum; | 2977 | context_desc->upper_setup.tcp_fields.tucso = |
2978 | css + skb->csum_offset; | ||
2966 | context_desc->upper_setup.tcp_fields.tucse = 0; | 2979 | context_desc->upper_setup.tcp_fields.tucse = 0; |
2967 | context_desc->tcp_seg_setup.data = 0; | 2980 | context_desc->tcp_seg_setup.data = 0; |
2968 | context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); | 2981 | context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); |
@@ -3296,7 +3309,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
3296 | /* TSO Workaround for 82571/2/3 Controllers -- if skb->data | 3309 | /* TSO Workaround for 82571/2/3 Controllers -- if skb->data |
3297 | * points to just header, pull a few bytes of payload from | 3310 | * points to just header, pull a few bytes of payload from |
3298 | * frags into skb->data */ | 3311 | * frags into skb->data */ |
3299 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | 3312 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
3300 | if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { | 3313 | if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { |
3301 | switch (adapter->hw.mac_type) { | 3314 | switch (adapter->hw.mac_type) { |
3302 | unsigned int pull_size; | 3315 | unsigned int pull_size; |
@@ -3307,7 +3320,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
3307 | * NOTE: this is a TSO only workaround | 3320 | * NOTE: this is a TSO only workaround |
3308 | * if end byte alignment not correct move us | 3321 | * if end byte alignment not correct move us |
3309 | * into the next dword */ | 3322 | * into the next dword */ |
3310 | if ((unsigned long)(skb->tail - 1) & 4) | 3323 | if ((unsigned long)(skb_tail_pointer(skb) - 1) & 4) |
3311 | break; | 3324 | break; |
3312 | /* fall through */ | 3325 | /* fall through */ |
3313 | case e1000_82571: | 3326 | case e1000_82571: |
@@ -3363,12 +3376,9 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
3363 | (adapter->hw.mac_type == e1000_82573)) | 3376 | (adapter->hw.mac_type == e1000_82573)) |
3364 | e1000_transfer_dhcp_info(adapter, skb); | 3377 | e1000_transfer_dhcp_info(adapter, skb); |
3365 | 3378 | ||
3366 | local_irq_save(flags); | 3379 | if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags)) |
3367 | if (!spin_trylock(&tx_ring->tx_lock)) { | ||
3368 | /* Collision - tell upper layer to requeue */ | 3380 | /* Collision - tell upper layer to requeue */ |
3369 | local_irq_restore(flags); | ||
3370 | return NETDEV_TX_LOCKED; | 3381 | return NETDEV_TX_LOCKED; |
3371 | } | ||
3372 | 3382 | ||
3373 | /* need: count + 2 desc gap to keep tail from touching | 3383 | /* need: count + 2 desc gap to keep tail from touching |
3374 | * head, otherwise try next time */ | 3384 | * head, otherwise try next time */ |
@@ -3796,7 +3806,7 @@ e1000_intr_msi(int irq, void *data) | |||
3796 | 3806 | ||
3797 | for (i = 0; i < E1000_MAX_INTR; i++) | 3807 | for (i = 0; i < E1000_MAX_INTR; i++) |
3798 | if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & | 3808 | if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
3799 | e1000_clean_tx_irq(adapter, adapter->tx_ring))) | 3809 | !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
3800 | break; | 3810 | break; |
3801 | 3811 | ||
3802 | if (likely(adapter->itr_setting & 3)) | 3812 | if (likely(adapter->itr_setting & 3)) |
@@ -3899,7 +3909,7 @@ e1000_intr(int irq, void *data) | |||
3899 | 3909 | ||
3900 | for (i = 0; i < E1000_MAX_INTR; i++) | 3910 | for (i = 0; i < E1000_MAX_INTR; i++) |
3901 | if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & | 3911 | if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
3902 | e1000_clean_tx_irq(adapter, adapter->tx_ring))) | 3912 | !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
3903 | break; | 3913 | break; |
3904 | 3914 | ||
3905 | if (likely(adapter->itr_setting & 3)) | 3915 | if (likely(adapter->itr_setting & 3)) |
@@ -3949,7 +3959,7 @@ e1000_clean(struct net_device *poll_dev, int *budget) | |||
3949 | poll_dev->quota -= work_done; | 3959 | poll_dev->quota -= work_done; |
3950 | 3960 | ||
3951 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 3961 | /* If no Tx and not enough Rx work done, exit the polling mode */ |
3952 | if ((tx_cleaned && (work_done < work_to_do)) || | 3962 | if ((!tx_cleaned && (work_done == 0)) || |
3953 | !netif_running(poll_dev)) { | 3963 | !netif_running(poll_dev)) { |
3954 | quit_polling: | 3964 | quit_polling: |
3955 | if (likely(adapter->itr_setting & 3)) | 3965 | if (likely(adapter->itr_setting & 3)) |
@@ -3979,7 +3989,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
3979 | #ifdef CONFIG_E1000_NAPI | 3989 | #ifdef CONFIG_E1000_NAPI |
3980 | unsigned int count = 0; | 3990 | unsigned int count = 0; |
3981 | #endif | 3991 | #endif |
3982 | boolean_t cleaned = TRUE; | 3992 | boolean_t cleaned = FALSE; |
3983 | unsigned int total_tx_bytes=0, total_tx_packets=0; | 3993 | unsigned int total_tx_bytes=0, total_tx_packets=0; |
3984 | 3994 | ||
3985 | i = tx_ring->next_to_clean; | 3995 | i = tx_ring->next_to_clean; |
@@ -4013,10 +4023,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
4013 | #ifdef CONFIG_E1000_NAPI | 4023 | #ifdef CONFIG_E1000_NAPI |
4014 | #define E1000_TX_WEIGHT 64 | 4024 | #define E1000_TX_WEIGHT 64 |
4015 | /* weight of a sort for tx, to avoid endless transmit cleanup */ | 4025 | /* weight of a sort for tx, to avoid endless transmit cleanup */ |
4016 | if (count++ == E1000_TX_WEIGHT) { | 4026 | if (count++ == E1000_TX_WEIGHT) break; |
4017 | cleaned = FALSE; | ||
4018 | break; | ||
4019 | } | ||
4020 | #endif | 4027 | #endif |
4021 | } | 4028 | } |
4022 | 4029 | ||
@@ -4230,9 +4237,12 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
4230 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); | 4237 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); |
4231 | if (new_skb) { | 4238 | if (new_skb) { |
4232 | skb_reserve(new_skb, NET_IP_ALIGN); | 4239 | skb_reserve(new_skb, NET_IP_ALIGN); |
4233 | memcpy(new_skb->data - NET_IP_ALIGN, | 4240 | skb_copy_to_linear_data_offset(new_skb, |
4234 | skb->data - NET_IP_ALIGN, | 4241 | -NET_IP_ALIGN, |
4235 | length + NET_IP_ALIGN); | 4242 | (skb->data - |
4243 | NET_IP_ALIGN), | ||
4244 | (length + | ||
4245 | NET_IP_ALIGN)); | ||
4236 | /* save the skb in buffer_info as good */ | 4246 | /* save the skb in buffer_info as good */ |
4237 | buffer_info->skb = skb; | 4247 | buffer_info->skb = skb; |
4238 | skb = new_skb; | 4248 | skb = new_skb; |
@@ -4394,7 +4404,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
4394 | PCI_DMA_FROMDEVICE); | 4404 | PCI_DMA_FROMDEVICE); |
4395 | vaddr = kmap_atomic(ps_page->ps_page[0], | 4405 | vaddr = kmap_atomic(ps_page->ps_page[0], |
4396 | KM_SKB_DATA_SOFTIRQ); | 4406 | KM_SKB_DATA_SOFTIRQ); |
4397 | memcpy(skb->tail, vaddr, l1); | 4407 | memcpy(skb_tail_pointer(skb), vaddr, l1); |
4398 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); | 4408 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); |
4399 | pci_dma_sync_single_for_device(pdev, | 4409 | pci_dma_sync_single_for_device(pdev, |
4400 | ps_page_dma->ps_page_dma[0], | 4410 | ps_page_dma->ps_page_dma[0], |
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index b4463094c93a..39654e1e2bed 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c | |||
@@ -1591,7 +1591,6 @@ eepro_rx(struct net_device *dev) | |||
1591 | 1591 | ||
1592 | break; | 1592 | break; |
1593 | } | 1593 | } |
1594 | skb->dev = dev; | ||
1595 | skb_reserve(skb,2); | 1594 | skb_reserve(skb,2); |
1596 | 1595 | ||
1597 | if (lp->version == LAN595) | 1596 | if (lp->version == LAN595) |
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index e28bb1e38f8d..6c267c38df97 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c | |||
@@ -1793,7 +1793,6 @@ speedo_rx(struct net_device *dev) | |||
1793 | copying to a properly sized skbuff. */ | 1793 | copying to a properly sized skbuff. */ |
1794 | if (pkt_len < rx_copybreak | 1794 | if (pkt_len < rx_copybreak |
1795 | && (skb = dev_alloc_skb(pkt_len + 2)) != 0) { | 1795 | && (skb = dev_alloc_skb(pkt_len + 2)) != 0) { |
1796 | skb->dev = dev; | ||
1797 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1796 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1798 | /* 'skb_put()' points to the start of sk_buff data area. */ | 1797 | /* 'skb_put()' points to the start of sk_buff data area. */ |
1799 | pci_dma_sync_single_for_cpu(sp->pdev, sp->rx_ring_dma[entry], | 1798 | pci_dma_sync_single_for_cpu(sp->pdev, sp->rx_ring_dma[entry], |
@@ -1805,8 +1804,9 @@ speedo_rx(struct net_device *dev) | |||
1805 | eth_copy_and_sum(skb, sp->rx_skbuff[entry]->data, pkt_len, 0); | 1804 | eth_copy_and_sum(skb, sp->rx_skbuff[entry]->data, pkt_len, 0); |
1806 | skb_put(skb, pkt_len); | 1805 | skb_put(skb, pkt_len); |
1807 | #else | 1806 | #else |
1808 | memcpy(skb_put(skb, pkt_len), sp->rx_skbuff[entry]->data, | 1807 | skb_copy_from_linear_data(sp->rx_skbuff[entry], |
1809 | pkt_len); | 1808 | skb_put(skb, pkt_len), |
1809 | pkt_len); | ||
1810 | #endif | 1810 | #endif |
1811 | pci_dma_sync_single_for_device(sp->pdev, sp->rx_ring_dma[entry], | 1811 | pci_dma_sync_single_for_device(sp->pdev, sp->rx_ring_dma[entry], |
1812 | sizeof(struct RxFD) + pkt_len, | 1812 | sizeof(struct RxFD) + pkt_len, |
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index 3868b8031266..8aaf5ec0c360 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c | |||
@@ -976,7 +976,6 @@ static void eexp_hw_rx_pio(struct net_device *dev) | |||
976 | lp->stats.rx_dropped++; | 976 | lp->stats.rx_dropped++; |
977 | break; | 977 | break; |
978 | } | 978 | } |
979 | skb->dev = dev; | ||
980 | skb_reserve(skb, 2); | 979 | skb_reserve(skb, 2); |
981 | outw(pbuf+10, ioaddr+READ_PTR); | 980 | outw(pbuf+10, ioaddr+READ_PTR); |
982 | insw(ioaddr+DATAPORT, skb_put(skb,pkt_len),(pkt_len+1)>>1); | 981 | insw(ioaddr+DATAPORT, skb_put(skb,pkt_len),(pkt_len+1)>>1); |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 0e4042bc0a48..58364a0ff378 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -391,8 +391,8 @@ static int ehea_poll(struct net_device *dev, int *budget) | |||
391 | if (!skb) | 391 | if (!skb) |
392 | break; | 392 | break; |
393 | } | 393 | } |
394 | memcpy(skb->data, ((char*)cqe) + 64, | 394 | skb_copy_to_linear_data(skb, ((char*)cqe) + 64, |
395 | cqe->num_bytes_transfered - 4); | 395 | cqe->num_bytes_transfered - 4); |
396 | ehea_fill_skb(dev, skb, cqe); | 396 | ehea_fill_skb(dev, skb, cqe); |
397 | } else if (rq == 2) { /* RQ2 */ | 397 | } else if (rq == 2) { /* RQ2 */ |
398 | skb = get_skb_by_index(skb_arr_rq2, | 398 | skb = get_skb_by_index(skb_arr_rq2, |
@@ -1262,8 +1262,8 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr) | |||
1262 | static inline void write_ip_start_end(struct ehea_swqe *swqe, | 1262 | static inline void write_ip_start_end(struct ehea_swqe *swqe, |
1263 | const struct sk_buff *skb) | 1263 | const struct sk_buff *skb) |
1264 | { | 1264 | { |
1265 | swqe->ip_start = (u8)(((u64)skb->nh.iph) - ((u64)skb->data)); | 1265 | swqe->ip_start = skb_network_offset(skb); |
1266 | swqe->ip_end = (u8)(swqe->ip_start + skb->nh.iph->ihl * 4 - 1); | 1266 | swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1); |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | static inline void write_tcp_offset_end(struct ehea_swqe *swqe, | 1269 | static inline void write_tcp_offset_end(struct ehea_swqe *swqe, |
@@ -1300,13 +1300,13 @@ static void write_swqe2_TSO(struct sk_buff *skb, | |||
1300 | /* copy only eth/ip/tcp headers to immediate data and | 1300 | /* copy only eth/ip/tcp headers to immediate data and |
1301 | * the rest of skb->data to sg1entry | 1301 | * the rest of skb->data to sg1entry |
1302 | */ | 1302 | */ |
1303 | headersize = ETH_HLEN + (skb->nh.iph->ihl * 4) + (skb->h.th->doff * 4); | 1303 | headersize = ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb); |
1304 | 1304 | ||
1305 | skb_data_size = skb->len - skb->data_len; | 1305 | skb_data_size = skb->len - skb->data_len; |
1306 | 1306 | ||
1307 | if (skb_data_size >= headersize) { | 1307 | if (skb_data_size >= headersize) { |
1308 | /* copy immediate data */ | 1308 | /* copy immediate data */ |
1309 | memcpy(imm_data, skb->data, headersize); | 1309 | skb_copy_from_linear_data(skb, imm_data, headersize); |
1310 | swqe->immediate_data_length = headersize; | 1310 | swqe->immediate_data_length = headersize; |
1311 | 1311 | ||
1312 | if (skb_data_size > headersize) { | 1312 | if (skb_data_size > headersize) { |
@@ -1337,7 +1337,7 @@ static void write_swqe2_nonTSO(struct sk_buff *skb, | |||
1337 | */ | 1337 | */ |
1338 | if (skb_data_size >= SWQE2_MAX_IMM) { | 1338 | if (skb_data_size >= SWQE2_MAX_IMM) { |
1339 | /* copy immediate data */ | 1339 | /* copy immediate data */ |
1340 | memcpy(imm_data, skb->data, SWQE2_MAX_IMM); | 1340 | skb_copy_from_linear_data(skb, imm_data, SWQE2_MAX_IMM); |
1341 | 1341 | ||
1342 | swqe->immediate_data_length = SWQE2_MAX_IMM; | 1342 | swqe->immediate_data_length = SWQE2_MAX_IMM; |
1343 | 1343 | ||
@@ -1350,7 +1350,7 @@ static void write_swqe2_nonTSO(struct sk_buff *skb, | |||
1350 | swqe->descriptors++; | 1350 | swqe->descriptors++; |
1351 | } | 1351 | } |
1352 | } else { | 1352 | } else { |
1353 | memcpy(imm_data, skb->data, skb_data_size); | 1353 | skb_copy_from_linear_data(skb, imm_data, skb_data_size); |
1354 | swqe->immediate_data_length = skb_data_size; | 1354 | swqe->immediate_data_length = skb_data_size; |
1355 | } | 1355 | } |
1356 | } | 1356 | } |
@@ -1688,6 +1688,7 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev, | |||
1688 | struct ehea_swqe *swqe, u32 lkey) | 1688 | struct ehea_swqe *swqe, u32 lkey) |
1689 | { | 1689 | { |
1690 | if (skb->protocol == htons(ETH_P_IP)) { | 1690 | if (skb->protocol == htons(ETH_P_IP)) { |
1691 | const struct iphdr *iph = ip_hdr(skb); | ||
1691 | /* IPv4 */ | 1692 | /* IPv4 */ |
1692 | swqe->tx_control |= EHEA_SWQE_CRC | 1693 | swqe->tx_control |= EHEA_SWQE_CRC |
1693 | | EHEA_SWQE_IP_CHECKSUM | 1694 | | EHEA_SWQE_IP_CHECKSUM |
@@ -1697,15 +1698,15 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev, | |||
1697 | 1698 | ||
1698 | write_ip_start_end(swqe, skb); | 1699 | write_ip_start_end(swqe, skb); |
1699 | 1700 | ||
1700 | if (skb->nh.iph->protocol == IPPROTO_UDP) { | 1701 | if (iph->protocol == IPPROTO_UDP) { |
1701 | if ((skb->nh.iph->frag_off & IP_MF) || | 1702 | if ((iph->frag_off & IP_MF) || |
1702 | (skb->nh.iph->frag_off & IP_OFFSET)) | 1703 | (iph->frag_off & IP_OFFSET)) |
1703 | /* IP fragment, so don't change cs */ | 1704 | /* IP fragment, so don't change cs */ |
1704 | swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM; | 1705 | swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM; |
1705 | else | 1706 | else |
1706 | write_udp_offset_end(swqe, skb); | 1707 | write_udp_offset_end(swqe, skb); |
1707 | 1708 | ||
1708 | } else if (skb->nh.iph->protocol == IPPROTO_TCP) { | 1709 | } else if (iph->protocol == IPPROTO_TCP) { |
1709 | write_tcp_offset_end(swqe, skb); | 1710 | write_tcp_offset_end(swqe, skb); |
1710 | } | 1711 | } |
1711 | 1712 | ||
@@ -1731,10 +1732,11 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev, | |||
1731 | int i; | 1732 | int i; |
1732 | 1733 | ||
1733 | if (skb->protocol == htons(ETH_P_IP)) { | 1734 | if (skb->protocol == htons(ETH_P_IP)) { |
1735 | const struct iphdr *iph = ip_hdr(skb); | ||
1734 | /* IPv4 */ | 1736 | /* IPv4 */ |
1735 | write_ip_start_end(swqe, skb); | 1737 | write_ip_start_end(swqe, skb); |
1736 | 1738 | ||
1737 | if (skb->nh.iph->protocol == IPPROTO_TCP) { | 1739 | if (iph->protocol == IPPROTO_TCP) { |
1738 | swqe->tx_control |= EHEA_SWQE_CRC | 1740 | swqe->tx_control |= EHEA_SWQE_CRC |
1739 | | EHEA_SWQE_IP_CHECKSUM | 1741 | | EHEA_SWQE_IP_CHECKSUM |
1740 | | EHEA_SWQE_TCP_CHECKSUM | 1742 | | EHEA_SWQE_TCP_CHECKSUM |
@@ -1742,9 +1744,9 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev, | |||
1742 | 1744 | ||
1743 | write_tcp_offset_end(swqe, skb); | 1745 | write_tcp_offset_end(swqe, skb); |
1744 | 1746 | ||
1745 | } else if (skb->nh.iph->protocol == IPPROTO_UDP) { | 1747 | } else if (iph->protocol == IPPROTO_UDP) { |
1746 | if ((skb->nh.iph->frag_off & IP_MF) || | 1748 | if ((iph->frag_off & IP_MF) || |
1747 | (skb->nh.iph->frag_off & IP_OFFSET)) | 1749 | (iph->frag_off & IP_OFFSET)) |
1748 | /* IP fragment, so don't change cs */ | 1750 | /* IP fragment, so don't change cs */ |
1749 | swqe->tx_control |= EHEA_SWQE_CRC | 1751 | swqe->tx_control |= EHEA_SWQE_CRC |
1750 | | EHEA_SWQE_IMM_DATA_PRESENT; | 1752 | | EHEA_SWQE_IMM_DATA_PRESENT; |
@@ -1770,10 +1772,11 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev, | |||
1770 | /* copy (immediate) data */ | 1772 | /* copy (immediate) data */ |
1771 | if (nfrags == 0) { | 1773 | if (nfrags == 0) { |
1772 | /* data is in a single piece */ | 1774 | /* data is in a single piece */ |
1773 | memcpy(imm_data, skb->data, skb->len); | 1775 | skb_copy_from_linear_data(skb, imm_data, skb->len); |
1774 | } else { | 1776 | } else { |
1775 | /* first copy data from the skb->data buffer ... */ | 1777 | /* first copy data from the skb->data buffer ... */ |
1776 | memcpy(imm_data, skb->data, skb->len - skb->data_len); | 1778 | skb_copy_from_linear_data(skb, imm_data, |
1779 | skb->len - skb->data_len); | ||
1777 | imm_data += skb->len - skb->data_len; | 1780 | imm_data += skb->len - skb->data_len; |
1778 | 1781 | ||
1779 | /* ... then copy data from the fragments */ | 1782 | /* ... then copy data from the fragments */ |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 3a6a83d3ee1c..4e3f14c9c717 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -934,7 +934,6 @@ static void epic_init_ring(struct net_device *dev) | |||
934 | ep->rx_skbuff[i] = skb; | 934 | ep->rx_skbuff[i] = skb; |
935 | if (skb == NULL) | 935 | if (skb == NULL) |
936 | break; | 936 | break; |
937 | skb->dev = dev; /* Mark as being used by this device. */ | ||
938 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ | 937 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ |
939 | ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, | 938 | ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, |
940 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); | 939 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); |
@@ -1199,7 +1198,6 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1199 | to a minimally-sized skbuff. */ | 1198 | to a minimally-sized skbuff. */ |
1200 | if (pkt_len < rx_copybreak | 1199 | if (pkt_len < rx_copybreak |
1201 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1200 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1202 | skb->dev = dev; | ||
1203 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1201 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1204 | pci_dma_sync_single_for_cpu(ep->pci_dev, | 1202 | pci_dma_sync_single_for_cpu(ep->pci_dev, |
1205 | ep->rx_ring[entry].bufaddr, | 1203 | ep->rx_ring[entry].bufaddr, |
@@ -1236,7 +1234,6 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1236 | skb = ep->rx_skbuff[entry] = dev_alloc_skb(ep->rx_buf_sz); | 1234 | skb = ep->rx_skbuff[entry] = dev_alloc_skb(ep->rx_buf_sz); |
1237 | if (skb == NULL) | 1235 | if (skb == NULL) |
1238 | break; | 1236 | break; |
1239 | skb->dev = dev; /* Mark as being used by this device. */ | ||
1240 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1237 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1241 | ep->rx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, | 1238 | ep->rx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, |
1242 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1239 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); |
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c index 93283e386f3a..04abf59e5007 100644 --- a/drivers/net/eth16i.c +++ b/drivers/net/eth16i.c | |||
@@ -1175,7 +1175,6 @@ static void eth16i_rx(struct net_device *dev) | |||
1175 | break; | 1175 | break; |
1176 | } | 1176 | } |
1177 | 1177 | ||
1178 | skb->dev = dev; | ||
1179 | skb_reserve(skb,2); | 1178 | skb_reserve(skb,2); |
1180 | 1179 | ||
1181 | /* | 1180 | /* |
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c index 714ea1176ec7..cb0792c187ba 100644 --- a/drivers/net/ewrk3.c +++ b/drivers/net/ewrk3.c | |||
@@ -993,7 +993,6 @@ static int ewrk3_rx(struct net_device *dev) | |||
993 | 993 | ||
994 | if ((skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 994 | if ((skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
995 | unsigned char *p; | 995 | unsigned char *p; |
996 | skb->dev = dev; | ||
997 | skb_reserve(skb, 2); /* Align to 16 bytes */ | 996 | skb_reserve(skb, 2); /* Align to 16 bytes */ |
998 | p = skb_put(skb, pkt_len); | 997 | p = skb_put(skb, pkt_len); |
999 | 998 | ||
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 38a13f440530..abe9b089c610 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c | |||
@@ -1719,7 +1719,6 @@ static int netdev_rx(struct net_device *dev) | |||
1719 | to a minimally-sized skbuff. */ | 1719 | to a minimally-sized skbuff. */ |
1720 | if (pkt_len < rx_copybreak && | 1720 | if (pkt_len < rx_copybreak && |
1721 | (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1721 | (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1722 | skb->dev = dev; | ||
1723 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1722 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1724 | pci_dma_sync_single_for_cpu(np->pci_dev, | 1723 | pci_dma_sync_single_for_cpu(np->pci_dev, |
1725 | np->cur_rx->buffer, | 1724 | np->cur_rx->buffer, |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 6764281b4531..255b09124e11 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -647,7 +647,6 @@ while (!((status = bdp->cbd_sc) & BD_ENET_RX_EMPTY)) { | |||
647 | printk("%s: Memory squeeze, dropping packet.\n", dev->name); | 647 | printk("%s: Memory squeeze, dropping packet.\n", dev->name); |
648 | fep->stats.rx_dropped++; | 648 | fep->stats.rx_dropped++; |
649 | } else { | 649 | } else { |
650 | skb->dev = dev; | ||
651 | skb_put(skb,pkt_len-4); /* Make room */ | 650 | skb_put(skb,pkt_len-4); /* Make room */ |
652 | eth_copy_and_sum(skb, data, pkt_len-4, 0); | 651 | eth_copy_and_sum(skb, data, pkt_len-4, 0); |
653 | skb->protocol=eth_type_trans(skb,dev); | 652 | skb->protocol=eth_type_trans(skb,dev); |
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c index 77f747a5afa7..e824d5d231af 100644 --- a/drivers/net/fec_8xx/fec_main.c +++ b/drivers/net/fec_8xx/fec_main.c | |||
@@ -551,7 +551,9 @@ static int fec_enet_rx_common(struct net_device *dev, int *budget) | |||
551 | skbn = dev_alloc_skb(pkt_len + 2); | 551 | skbn = dev_alloc_skb(pkt_len + 2); |
552 | if (skbn != NULL) { | 552 | if (skbn != NULL) { |
553 | skb_reserve(skbn, 2); /* align IP header */ | 553 | skb_reserve(skbn, 2); /* align IP header */ |
554 | memcpy(skbn->data, skb->data, pkt_len); | 554 | skb_copy_from_linear_data(skb |
555 | skbn->data, | ||
556 | pkt_len); | ||
555 | /* swap */ | 557 | /* swap */ |
556 | skbt = skb; | 558 | skbt = skb; |
557 | skb = skbn; | 559 | skb = skbn; |
@@ -561,7 +563,6 @@ static int fec_enet_rx_common(struct net_device *dev, int *budget) | |||
561 | skbn = dev_alloc_skb(ENET_RX_FRSIZE); | 563 | skbn = dev_alloc_skb(ENET_RX_FRSIZE); |
562 | 564 | ||
563 | if (skbn != NULL) { | 565 | if (skbn != NULL) { |
564 | skb->dev = dev; | ||
565 | skb_put(skb, pkt_len); /* Make room */ | 566 | skb_put(skb, pkt_len); /* Make room */ |
566 | skb->protocol = eth_type_trans(skb, dev); | 567 | skb->protocol = eth_type_trans(skb, dev); |
567 | received++; | 568 | received++; |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index d04214e4e581..7a018027fcc0 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -1385,11 +1385,12 @@ static int nv_alloc_rx(struct net_device *dev) | |||
1385 | while (np->put_rx.orig != less_rx) { | 1385 | while (np->put_rx.orig != less_rx) { |
1386 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); | 1386 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); |
1387 | if (skb) { | 1387 | if (skb) { |
1388 | skb->dev = dev; | ||
1389 | np->put_rx_ctx->skb = skb; | 1388 | np->put_rx_ctx->skb = skb; |
1390 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, skb->data, | 1389 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, |
1391 | skb->end-skb->data, PCI_DMA_FROMDEVICE); | 1390 | skb->data, |
1392 | np->put_rx_ctx->dma_len = skb->end-skb->data; | 1391 | skb_tailroom(skb), |
1392 | PCI_DMA_FROMDEVICE); | ||
1393 | np->put_rx_ctx->dma_len = skb_tailroom(skb); | ||
1393 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); | 1394 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); |
1394 | wmb(); | 1395 | wmb(); |
1395 | np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); | 1396 | np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); |
@@ -1416,11 +1417,12 @@ static int nv_alloc_rx_optimized(struct net_device *dev) | |||
1416 | while (np->put_rx.ex != less_rx) { | 1417 | while (np->put_rx.ex != less_rx) { |
1417 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); | 1418 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); |
1418 | if (skb) { | 1419 | if (skb) { |
1419 | skb->dev = dev; | ||
1420 | np->put_rx_ctx->skb = skb; | 1420 | np->put_rx_ctx->skb = skb; |
1421 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, skb->data, | 1421 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, |
1422 | skb->end-skb->data, PCI_DMA_FROMDEVICE); | 1422 | skb->data, |
1423 | np->put_rx_ctx->dma_len = skb->end-skb->data; | 1423 | skb_tailroom(skb), |
1424 | PCI_DMA_FROMDEVICE); | ||
1425 | np->put_rx_ctx->dma_len = skb_tailroom(skb); | ||
1424 | np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32; | 1426 | np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32; |
1425 | np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF; | 1427 | np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF; |
1426 | wmb(); | 1428 | wmb(); |
@@ -1604,8 +1606,9 @@ static void nv_drain_rx(struct net_device *dev) | |||
1604 | wmb(); | 1606 | wmb(); |
1605 | if (np->rx_skb[i].skb) { | 1607 | if (np->rx_skb[i].skb) { |
1606 | pci_unmap_single(np->pci_dev, np->rx_skb[i].dma, | 1608 | pci_unmap_single(np->pci_dev, np->rx_skb[i].dma, |
1607 | np->rx_skb[i].skb->end-np->rx_skb[i].skb->data, | 1609 | (skb_end_pointer(np->rx_skb[i].skb) - |
1608 | PCI_DMA_FROMDEVICE); | 1610 | np->rx_skb[i].skb->data), |
1611 | PCI_DMA_FROMDEVICE); | ||
1609 | dev_kfree_skb(np->rx_skb[i].skb); | 1612 | dev_kfree_skb(np->rx_skb[i].skb); |
1610 | np->rx_skb[i].skb = NULL; | 1613 | np->rx_skb[i].skb = NULL; |
1611 | } | 1614 | } |
@@ -4376,11 +4379,12 @@ static int nv_loopback_test(struct net_device *dev) | |||
4376 | ret = 0; | 4379 | ret = 0; |
4377 | goto out; | 4380 | goto out; |
4378 | } | 4381 | } |
4382 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, | ||
4383 | skb_tailroom(tx_skb), | ||
4384 | PCI_DMA_FROMDEVICE); | ||
4379 | pkt_data = skb_put(tx_skb, pkt_len); | 4385 | pkt_data = skb_put(tx_skb, pkt_len); |
4380 | for (i = 0; i < pkt_len; i++) | 4386 | for (i = 0; i < pkt_len; i++) |
4381 | pkt_data[i] = (u8)(i & 0xff); | 4387 | pkt_data[i] = (u8)(i & 0xff); |
4382 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, | ||
4383 | tx_skb->end-tx_skb->data, PCI_DMA_FROMDEVICE); | ||
4384 | 4388 | ||
4385 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 4389 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
4386 | np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); | 4390 | np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); |
@@ -4437,7 +4441,7 @@ static int nv_loopback_test(struct net_device *dev) | |||
4437 | } | 4441 | } |
4438 | 4442 | ||
4439 | pci_unmap_page(np->pci_dev, test_dma_addr, | 4443 | pci_unmap_page(np->pci_dev, test_dma_addr, |
4440 | tx_skb->end-tx_skb->data, | 4444 | (skb_end_pointer(tx_skb) - tx_skb->data), |
4441 | PCI_DMA_TODEVICE); | 4445 | PCI_DMA_TODEVICE); |
4442 | dev_kfree_skb_any(tx_skb); | 4446 | dev_kfree_skb_any(tx_skb); |
4443 | out: | 4447 | out: |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 4a05c14bf7ec..e2ddd617493a 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -160,7 +160,8 @@ static int fs_enet_rx_napi(struct net_device *dev, int *budget) | |||
160 | skbn = dev_alloc_skb(pkt_len + 2); | 160 | skbn = dev_alloc_skb(pkt_len + 2); |
161 | if (skbn != NULL) { | 161 | if (skbn != NULL) { |
162 | skb_reserve(skbn, 2); /* align IP header */ | 162 | skb_reserve(skbn, 2); /* align IP header */ |
163 | memcpy(skbn->data, skb->data, pkt_len); | 163 | skb_copy_from_linear_data(skb, |
164 | skbn->data, pkt_len); | ||
164 | /* swap */ | 165 | /* swap */ |
165 | skbt = skb; | 166 | skbt = skb; |
166 | skb = skbn; | 167 | skb = skbn; |
@@ -170,7 +171,6 @@ static int fs_enet_rx_napi(struct net_device *dev, int *budget) | |||
170 | skbn = dev_alloc_skb(ENET_RX_FRSIZE); | 171 | skbn = dev_alloc_skb(ENET_RX_FRSIZE); |
171 | 172 | ||
172 | if (skbn != NULL) { | 173 | if (skbn != NULL) { |
173 | skb->dev = dev; | ||
174 | skb_put(skb, pkt_len); /* Make room */ | 174 | skb_put(skb, pkt_len); /* Make room */ |
175 | skb->protocol = eth_type_trans(skb, dev); | 175 | skb->protocol = eth_type_trans(skb, dev); |
176 | received++; | 176 | received++; |
@@ -294,7 +294,8 @@ static int fs_enet_rx_non_napi(struct net_device *dev) | |||
294 | skbn = dev_alloc_skb(pkt_len + 2); | 294 | skbn = dev_alloc_skb(pkt_len + 2); |
295 | if (skbn != NULL) { | 295 | if (skbn != NULL) { |
296 | skb_reserve(skbn, 2); /* align IP header */ | 296 | skb_reserve(skbn, 2); /* align IP header */ |
297 | memcpy(skbn->data, skb->data, pkt_len); | 297 | skb_copy_from_linear_data(skb, |
298 | skbn->data, pkt_len); | ||
298 | /* swap */ | 299 | /* swap */ |
299 | skbt = skb; | 300 | skbt = skb; |
300 | skb = skbn; | 301 | skb = skbn; |
@@ -304,7 +305,6 @@ static int fs_enet_rx_non_napi(struct net_device *dev) | |||
304 | skbn = dev_alloc_skb(ENET_RX_FRSIZE); | 305 | skbn = dev_alloc_skb(ENET_RX_FRSIZE); |
305 | 306 | ||
306 | if (skbn != NULL) { | 307 | if (skbn != NULL) { |
307 | skb->dev = dev; | ||
308 | skb_put(skb, pkt_len); /* Make room */ | 308 | skb_put(skb, pkt_len); /* Make room */ |
309 | skb->protocol = eth_type_trans(skb, dev); | 309 | skb->protocol = eth_type_trans(skb, dev); |
310 | received++; | 310 | received++; |
@@ -516,7 +516,6 @@ void fs_init_bds(struct net_device *dev) | |||
516 | break; | 516 | break; |
517 | } | 517 | } |
518 | fep->rx_skbuff[i] = skb; | 518 | fep->rx_skbuff[i] = skb; |
519 | skb->dev = dev; | ||
520 | CBDW_BUFADDR(bdp, | 519 | CBDW_BUFADDR(bdp, |
521 | dma_map_single(fep->dev, skb->data, | 520 | dma_map_single(fep->dev, skb->data, |
522 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 521 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index d981d4c41dd3..b666a0cc0642 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -942,18 +942,18 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb) | |||
942 | 942 | ||
943 | /* Tell the controller what the protocol is */ | 943 | /* Tell the controller what the protocol is */ |
944 | /* And provide the already calculated phcs */ | 944 | /* And provide the already calculated phcs */ |
945 | if (skb->nh.iph->protocol == IPPROTO_UDP) { | 945 | if (ip_hdr(skb)->protocol == IPPROTO_UDP) { |
946 | flags |= TXFCB_UDP; | 946 | flags |= TXFCB_UDP; |
947 | fcb->phcs = skb->h.uh->check; | 947 | fcb->phcs = udp_hdr(skb)->check; |
948 | } else | 948 | } else |
949 | fcb->phcs = skb->h.th->check; | 949 | fcb->phcs = udp_hdr(skb)->check; |
950 | 950 | ||
951 | /* l3os is the distance between the start of the | 951 | /* l3os is the distance between the start of the |
952 | * frame (skb->data) and the start of the IP hdr. | 952 | * frame (skb->data) and the start of the IP hdr. |
953 | * l4os is the distance between the start of the | 953 | * l4os is the distance between the start of the |
954 | * l3 hdr and the l4 hdr */ | 954 | * l3 hdr and the l4 hdr */ |
955 | fcb->l3os = (u16)(skb->nh.raw - skb->data - GMAC_FCB_LEN); | 955 | fcb->l3os = (u16)(skb_network_offset(skb) - GMAC_FCB_LEN); |
956 | fcb->l4os = (u16)(skb->h.raw - skb->nh.raw); | 956 | fcb->l4os = skb_network_header_len(skb); |
957 | 957 | ||
958 | fcb->flags = flags; | 958 | fcb->flags = flags; |
959 | } | 959 | } |
@@ -1295,8 +1295,6 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp) | |||
1295 | */ | 1295 | */ |
1296 | skb_reserve(skb, alignamount); | 1296 | skb_reserve(skb, alignamount); |
1297 | 1297 | ||
1298 | skb->dev = dev; | ||
1299 | |||
1300 | bdp->bufPtr = dma_map_single(NULL, skb->data, | 1298 | bdp->bufPtr = dma_map_single(NULL, skb->data, |
1301 | priv->rx_buffer_size, DMA_FROM_DEVICE); | 1299 | priv->rx_buffer_size, DMA_FROM_DEVICE); |
1302 | 1300 | ||
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index c3c0d67fc383..2521b111b3a5 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c | |||
@@ -1568,7 +1568,6 @@ static int hamachi_rx(struct net_device *dev) | |||
1568 | printk(KERN_ERR "%s: rx_copybreak non-zero " | 1568 | printk(KERN_ERR "%s: rx_copybreak non-zero " |
1569 | "not good with RX_CHECKSUM\n", dev->name); | 1569 | "not good with RX_CHECKSUM\n", dev->name); |
1570 | #endif | 1570 | #endif |
1571 | skb->dev = dev; | ||
1572 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1571 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1573 | pci_dma_sync_single_for_cpu(hmp->pci_dev, | 1572 | pci_dma_sync_single_for_cpu(hmp->pci_dev, |
1574 | hmp->rx_ring[entry].addr, | 1573 | hmp->rx_ring[entry].addr, |
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index 59214e74b9cf..30baf6ecfc63 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c | |||
@@ -75,12 +75,14 @@ | |||
75 | #include <linux/ioport.h> | 75 | #include <linux/ioport.h> |
76 | #include <linux/string.h> | 76 | #include <linux/string.h> |
77 | #include <linux/init.h> | 77 | #include <linux/init.h> |
78 | #include <asm/uaccess.h> | ||
79 | #include <asm/io.h> | ||
80 | #include <linux/hdlcdrv.h> | 78 | #include <linux/hdlcdrv.h> |
81 | #include <linux/baycom.h> | 79 | #include <linux/baycom.h> |
82 | #include <linux/jiffies.h> | 80 | #include <linux/jiffies.h> |
83 | 81 | ||
82 | #include <asm/uaccess.h> | ||
83 | #include <asm/io.h> | ||
84 | #include <asm/irq.h> | ||
85 | |||
84 | /* --------------------------------------------------------------------- */ | 86 | /* --------------------------------------------------------------------- */ |
85 | 87 | ||
86 | #define BAYCOM_DEBUG | 88 | #define BAYCOM_DEBUG |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index d2542697e298..656f2789c9ba 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -282,7 +282,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev) | |||
282 | } | 282 | } |
283 | 283 | ||
284 | skb->protocol = ax25_type_trans(skb, dev); | 284 | skb->protocol = ax25_type_trans(skb, dev); |
285 | skb->nh.raw = skb->data; | 285 | skb_reset_network_header(skb); |
286 | dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0); | 286 | dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0); |
287 | bpq->stats.tx_packets++; | 287 | bpq->stats.tx_packets++; |
288 | bpq->stats.tx_bytes+=skb->len; | 288 | bpq->stats.tx_bytes+=skb->len; |
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c index 0fbb414b5a4d..3be8c5047599 100644 --- a/drivers/net/hamradio/dmascc.c +++ b/drivers/net/hamradio/dmascc.c | |||
@@ -930,7 +930,7 @@ static int scc_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
930 | 930 | ||
931 | /* Transfer data to DMA buffer */ | 931 | /* Transfer data to DMA buffer */ |
932 | i = priv->tx_head; | 932 | i = priv->tx_head; |
933 | memcpy(priv->tx_buf[i], skb->data + 1, skb->len - 1); | 933 | skb_copy_from_linear_data_offset(skb, 1, priv->tx_buf[i], skb->len - 1); |
934 | priv->tx_len[i] = skb->len - 1; | 934 | priv->tx_len[i] = skb->len - 1; |
935 | 935 | ||
936 | /* Clear interrupts while we touch our circular buffers */ | 936 | /* Clear interrupts while we touch our circular buffers */ |
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c index f5a17ad9d3d6..b33adc6a340b 100644 --- a/drivers/net/hamradio/hdlcdrv.c +++ b/drivers/net/hamradio/hdlcdrv.c | |||
@@ -317,7 +317,9 @@ void hdlcdrv_transmitter(struct net_device *dev, struct hdlcdrv_state *s) | |||
317 | dev_kfree_skb_irq(skb); | 317 | dev_kfree_skb_irq(skb); |
318 | break; | 318 | break; |
319 | } | 319 | } |
320 | memcpy(s->hdlctx.buffer, skb->data+1, pkt_len); | 320 | skb_copy_from_linear_data_offset(skb, 1, |
321 | s->hdlctx.buffer, | ||
322 | pkt_len); | ||
321 | dev_kfree_skb_irq(skb); | 323 | dev_kfree_skb_irq(skb); |
322 | s->hdlctx.bp = s->hdlctx.buffer; | 324 | s->hdlctx.bp = s->hdlctx.buffer; |
323 | append_crc_ccitt(s->hdlctx.buffer, pkt_len); | 325 | append_crc_ccitt(s->hdlctx.buffer, pkt_len); |
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index ee3ea4fa729f..467559debfd6 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c | |||
@@ -638,7 +638,9 @@ static void yam_tx_byte(struct net_device *dev, struct yam_port *yp) | |||
638 | dev_kfree_skb_any(skb); | 638 | dev_kfree_skb_any(skb); |
639 | break; | 639 | break; |
640 | } | 640 | } |
641 | memcpy(yp->tx_buf, skb->data + 1, yp->tx_len); | 641 | skb_copy_from_linear_data_offset(skb, 1, |
642 | yp->tx_buf, | ||
643 | yp->tx_len); | ||
642 | dev_kfree_skb_any(skb); | 644 | dev_kfree_skb_any(skb); |
643 | yp->tx_count = 0; | 645 | yp->tx_count = 0; |
644 | yp->tx_crcl = 0x21; | 646 | yp->tx_crcl = 0x21; |
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index 7dc5185aa2c0..8118a6750b61 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -1816,7 +1816,6 @@ static void hp100_rx(struct net_device *dev) | |||
1816 | u_char *ptr; | 1816 | u_char *ptr; |
1817 | 1817 | ||
1818 | skb_reserve(skb,2); | 1818 | skb_reserve(skb,2); |
1819 | skb->dev = dev; | ||
1820 | 1819 | ||
1821 | /* ptr to start of the sk_buff data area */ | 1820 | /* ptr to start of the sk_buff data area */ |
1822 | skb_put(skb, pkt_len); | 1821 | skb_put(skb, pkt_len); |
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index dd8ad8746825..3d82d46f4998 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c | |||
@@ -1338,7 +1338,7 @@ static inline int emac_rx_sg_append(struct ocp_enet_private *dev, int slot) | |||
1338 | dev_kfree_skb(dev->rx_sg_skb); | 1338 | dev_kfree_skb(dev->rx_sg_skb); |
1339 | dev->rx_sg_skb = NULL; | 1339 | dev->rx_sg_skb = NULL; |
1340 | } else { | 1340 | } else { |
1341 | cacheable_memcpy(dev->rx_sg_skb->tail, | 1341 | cacheable_memcpy(skb_tail_pointer(dev->rx_sg_skb), |
1342 | dev->rx_skb[slot]->data, len); | 1342 | dev->rx_skb[slot]->data, len); |
1343 | skb_put(dev->rx_sg_skb, len); | 1343 | skb_put(dev->rx_sg_skb, len); |
1344 | emac_recycle_rx_skb(dev, slot, len); | 1344 | emac_recycle_rx_skb(dev, slot, len); |
@@ -1398,7 +1398,6 @@ static int emac_poll_rx(void *param, int budget) | |||
1398 | 1398 | ||
1399 | skb_put(skb, len); | 1399 | skb_put(skb, len); |
1400 | push_packet: | 1400 | push_packet: |
1401 | skb->dev = dev->ndev; | ||
1402 | skb->protocol = eth_type_trans(skb, dev->ndev); | 1401 | skb->protocol = eth_type_trans(skb, dev->ndev); |
1403 | emac_rx_csum(dev, skb, ctrl); | 1402 | emac_rx_csum(dev, skb, ctrl); |
1404 | 1403 | ||
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 3f946c811511..fe85d6fcba33 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c | |||
@@ -601,7 +601,6 @@ static void irqrx_handler(struct net_device *dev) | |||
601 | 601 | ||
602 | /* set up skb fields */ | 602 | /* set up skb fields */ |
603 | 603 | ||
604 | skb->dev = dev; | ||
605 | skb->protocol = eth_type_trans(skb, dev); | 604 | skb->protocol = eth_type_trans(skb, dev); |
606 | skb->ip_summed = CHECKSUM_NONE; | 605 | skb->ip_summed = CHECKSUM_NONE; |
607 | 606 | ||
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 458db0538a9a..0573fcfcb2c4 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -798,7 +798,6 @@ static int ibmveth_poll(struct net_device *netdev, int *budget) | |||
798 | 798 | ||
799 | skb_reserve(skb, offset); | 799 | skb_reserve(skb, offset); |
800 | skb_put(skb, length); | 800 | skb_put(skb, length); |
801 | skb->dev = netdev; | ||
802 | skb->protocol = eth_type_trans(skb, netdev); | 801 | skb->protocol = eth_type_trans(skb, netdev); |
803 | 802 | ||
804 | netif_receive_skb(skb); /* send it up */ | 803 | netif_receive_skb(skb); /* send it up */ |
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 4ad780719a84..f749e07c6425 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -633,8 +633,6 @@ static inline void ioc3_rx(struct ioc3_private *ip) | |||
633 | 633 | ||
634 | ip->rx_skbs[rx_entry] = NULL; /* Poison */ | 634 | ip->rx_skbs[rx_entry] = NULL; /* Poison */ |
635 | 635 | ||
636 | new_skb->dev = priv_netdev(ip); | ||
637 | |||
638 | /* Because we reserve afterwards. */ | 636 | /* Because we reserve afterwards. */ |
639 | skb_put(new_skb, (1664 + RX_OFFSET)); | 637 | skb_put(new_skb, (1664 + RX_OFFSET)); |
640 | rxb = (struct ioc3_erxbuf *) new_skb->data; | 638 | rxb = (struct ioc3_erxbuf *) new_skb->data; |
@@ -940,7 +938,6 @@ static void ioc3_alloc_rings(struct net_device *dev) | |||
940 | } | 938 | } |
941 | 939 | ||
942 | ip->rx_skbs[i] = skb; | 940 | ip->rx_skbs[i] = skb; |
943 | skb->dev = dev; | ||
944 | 941 | ||
945 | /* Because we reserve afterwards. */ | 942 | /* Because we reserve afterwards. */ |
946 | skb_put(skb, (1664 + RX_OFFSET)); | 943 | skb_put(skb, (1664 + RX_OFFSET)); |
@@ -1396,9 +1393,9 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1396 | * manually. | 1393 | * manually. |
1397 | */ | 1394 | */ |
1398 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1395 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1399 | int proto = ntohs(skb->nh.iph->protocol); | 1396 | const struct iphdr *ih = ip_hdr(skb); |
1397 | const int proto = ntohs(ih->protocol); | ||
1400 | unsigned int csoff; | 1398 | unsigned int csoff; |
1401 | struct iphdr *ih = skb->nh.iph; | ||
1402 | uint32_t csum, ehsum; | 1399 | uint32_t csum, ehsum; |
1403 | uint16_t *eh; | 1400 | uint16_t *eh; |
1404 | 1401 | ||
@@ -1425,11 +1422,11 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1425 | csoff = ETH_HLEN + (ih->ihl << 2); | 1422 | csoff = ETH_HLEN + (ih->ihl << 2); |
1426 | if (proto == IPPROTO_UDP) { | 1423 | if (proto == IPPROTO_UDP) { |
1427 | csoff += offsetof(struct udphdr, check); | 1424 | csoff += offsetof(struct udphdr, check); |
1428 | skb->h.uh->check = csum; | 1425 | udp_hdr(skb)->check = csum; |
1429 | } | 1426 | } |
1430 | if (proto == IPPROTO_TCP) { | 1427 | if (proto == IPPROTO_TCP) { |
1431 | csoff += offsetof(struct tcphdr, check); | 1428 | csoff += offsetof(struct tcphdr, check); |
1432 | skb->h.th->check = csum; | 1429 | tcp_hdr(skb)->check = csum; |
1433 | } | 1430 | } |
1434 | 1431 | ||
1435 | w0 = ETXD_DOCHECKSUM | (csoff << ETXD_CHKOFF_SHIFT); | 1432 | w0 = ETXD_DOCHECKSUM | (csoff << ETXD_CHKOFF_SHIFT); |
@@ -1446,7 +1443,7 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1446 | 1443 | ||
1447 | if (len <= 104) { | 1444 | if (len <= 104) { |
1448 | /* Short packet, let's copy it directly into the ring. */ | 1445 | /* Short packet, let's copy it directly into the ring. */ |
1449 | memcpy(desc->data, skb->data, skb->len); | 1446 | skb_copy_from_linear_data(skb, desc->data, skb->len); |
1450 | if (len < ETH_ZLEN) { | 1447 | if (len < ETH_ZLEN) { |
1451 | /* Very short packet, pad with zeros at the end. */ | 1448 | /* Very short packet, pad with zeros at the end. */ |
1452 | memset(desc->data + len, 0, ETH_ZLEN - len); | 1449 | memset(desc->data + len, 0, ETH_ZLEN - len); |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c index cebf8c374bc5..f9c889c0dd07 100644 --- a/drivers/net/irda/ali-ircc.c +++ b/drivers/net/irda/ali-ircc.c | |||
@@ -1472,9 +1472,8 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1472 | 1472 | ||
1473 | self->stats.tx_bytes += skb->len; | 1473 | self->stats.tx_bytes += skb->len; |
1474 | 1474 | ||
1475 | memcpy(self->tx_fifo.queue[self->tx_fifo.free].start, skb->data, | 1475 | skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start, |
1476 | skb->len); | 1476 | skb->len); |
1477 | |||
1478 | self->tx_fifo.len++; | 1477 | self->tx_fifo.len++; |
1479 | self->tx_fifo.free++; | 1478 | self->tx_fifo.free++; |
1480 | 1479 | ||
@@ -1924,7 +1923,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self) | |||
1924 | 1923 | ||
1925 | /* Copy frame without CRC, CRC is removed by hardware*/ | 1924 | /* Copy frame without CRC, CRC is removed by hardware*/ |
1926 | skb_put(skb, len); | 1925 | skb_put(skb, len); |
1927 | memcpy(skb->data, self->rx_buff.data, len); | 1926 | skb_copy_to_linear_data(skb, self->rx_buff.data, len); |
1928 | 1927 | ||
1929 | /* Move to next frame */ | 1928 | /* Move to next frame */ |
1930 | self->rx_buff.data += len; | 1929 | self->rx_buff.data += len; |
@@ -1932,7 +1931,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self) | |||
1932 | self->stats.rx_packets++; | 1931 | self->stats.rx_packets++; |
1933 | 1932 | ||
1934 | skb->dev = self->netdev; | 1933 | skb->dev = self->netdev; |
1935 | skb->mac.raw = skb->data; | 1934 | skb_reset_mac_header(skb); |
1936 | skb->protocol = htons(ETH_P_IRDA); | 1935 | skb->protocol = htons(ETH_P_IRDA); |
1937 | netif_rx(skb); | 1936 | netif_rx(skb); |
1938 | self->netdev->last_rx = jiffies; | 1937 | self->netdev->last_rx = jiffies; |
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c index 37914dc5b90e..4dbdfaaf37bf 100644 --- a/drivers/net/irda/au1k_ir.c +++ b/drivers/net/irda/au1k_ir.c | |||
@@ -526,7 +526,7 @@ static int au1k_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) | |||
526 | 526 | ||
527 | if (aup->speed == 4000000) { | 527 | if (aup->speed == 4000000) { |
528 | /* FIR */ | 528 | /* FIR */ |
529 | memcpy((void *)pDB->vaddr, skb->data, skb->len); | 529 | skb_copy_from_linear_data(skb, pDB->vaddr, skb->len); |
530 | ptxd->count_0 = skb->len & 0xff; | 530 | ptxd->count_0 = skb->len & 0xff; |
531 | ptxd->count_1 = (skb->len >> 8) & 0xff; | 531 | ptxd->count_1 = (skb->len >> 8) & 0xff; |
532 | 532 | ||
@@ -604,9 +604,9 @@ static int au1k_irda_rx(struct net_device *dev) | |||
604 | skb_put(skb, count); | 604 | skb_put(skb, count); |
605 | else | 605 | else |
606 | skb_put(skb, count-2); | 606 | skb_put(skb, count-2); |
607 | memcpy(skb->data, (void *)pDB->vaddr, count-2); | 607 | skb_copy_to_linear_data(skb, pDB->vaddr, count - 2); |
608 | skb->dev = dev; | 608 | skb->dev = dev; |
609 | skb->mac.raw = skb->data; | 609 | skb_reset_mac_header(skb); |
610 | skb->protocol = htons(ETH_P_IRDA); | 610 | skb->protocol = htons(ETH_P_IRDA); |
611 | netif_rx(skb); | 611 | netif_rx(skb); |
612 | prxd->count_0 = 0; | 612 | prxd->count_0 = 0; |
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 11af0ae7510e..3ca47bf6dfec 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c | |||
@@ -1119,7 +1119,7 @@ dumpbufs(skb->data,skb->len,'>'); | |||
1119 | else | 1119 | else |
1120 | { | 1120 | { |
1121 | len = skb->len; | 1121 | len = skb->len; |
1122 | memcpy (self->tx_bufs[self->txs], skb->data, len); | 1122 | skb_copy_from_linear_data(skb, self->tx_bufs[self->txs], len); |
1123 | } | 1123 | } |
1124 | self->ring->tx[self->txs].len = len & 0x0fff; | 1124 | self->ring->tx[self->txs].len = len & 0x0fff; |
1125 | 1125 | ||
@@ -1282,11 +1282,11 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<'); | |||
1282 | skb_reserve (skb, 1); | 1282 | skb_reserve (skb, 1); |
1283 | 1283 | ||
1284 | skb_put (skb, len); | 1284 | skb_put (skb, len); |
1285 | memcpy (skb->data, self->rx_bufs[self->rxs], len); | 1285 | skb_copy_to_linear_data(skb, self->rx_bufs[self->rxs], |
1286 | 1286 | len); | |
1287 | self->stats.rx_packets++; | 1287 | self->stats.rx_packets++; |
1288 | skb->dev = self->netdev; | 1288 | skb->dev = self->netdev; |
1289 | skb->mac.raw = skb->data; | 1289 | skb_reset_mac_header(skb); |
1290 | skb->protocol = htons (ETH_P_IRDA); | 1290 | skb->protocol = htons (ETH_P_IRDA); |
1291 | } | 1291 | } |
1292 | else | 1292 | else |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 1d510bdc9b84..0ac240ca905b 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -441,7 +441,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
441 | goto drop; | 441 | goto drop; |
442 | } | 442 | } |
443 | 443 | ||
444 | memcpy(self->tx_buff + self->header_length, skb->data, skb->len); | 444 | skb_copy_from_linear_data(skb, self->tx_buff + self->header_length, skb->len); |
445 | 445 | ||
446 | /* Change setting for next frame */ | 446 | /* Change setting for next frame */ |
447 | if (self->capability & IUC_STIR421X) { | 447 | if (self->capability & IUC_STIR421X) { |
@@ -902,7 +902,7 @@ static void irda_usb_receive(struct urb *urb) | |||
902 | 902 | ||
903 | if(docopy) { | 903 | if(docopy) { |
904 | /* Copy packet, so we can recycle the original */ | 904 | /* Copy packet, so we can recycle the original */ |
905 | memcpy(newskb->data, skb->data, urb->actual_length); | 905 | skb_copy_from_linear_data(skb, newskb->data, urb->actual_length); |
906 | /* Deliver this new skb */ | 906 | /* Deliver this new skb */ |
907 | dataskb = newskb; | 907 | dataskb = newskb; |
908 | /* And hook the old skb to the URB | 908 | /* And hook the old skb to the URB |
@@ -921,7 +921,7 @@ static void irda_usb_receive(struct urb *urb) | |||
921 | 921 | ||
922 | /* Ask the networking layer to queue the packet for the IrDA stack */ | 922 | /* Ask the networking layer to queue the packet for the IrDA stack */ |
923 | dataskb->dev = self->netdev; | 923 | dataskb->dev = self->netdev; |
924 | dataskb->mac.raw = dataskb->data; | 924 | skb_reset_mac_header(dataskb); |
925 | dataskb->protocol = htons(ETH_P_IRDA); | 925 | dataskb->protocol = htons(ETH_P_IRDA); |
926 | len = dataskb->len; | 926 | len = dataskb->len; |
927 | netif_rx(dataskb); | 927 | netif_rx(dataskb); |
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index f0c61f3b2a82..0de867288a47 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c | |||
@@ -200,14 +200,14 @@ static inline int mcs_setup_transceiver_vishay(struct mcs_cb *mcs) | |||
200 | /* Setup a communication between mcs7780 and agilent chip. */ | 200 | /* Setup a communication between mcs7780 and agilent chip. */ |
201 | static inline int mcs_setup_transceiver_agilent(struct mcs_cb *mcs) | 201 | static inline int mcs_setup_transceiver_agilent(struct mcs_cb *mcs) |
202 | { | 202 | { |
203 | IRDA_WARNING("This transceiver type is not supported yet."); | 203 | IRDA_WARNING("This transceiver type is not supported yet.\n"); |
204 | return 1; | 204 | return 1; |
205 | } | 205 | } |
206 | 206 | ||
207 | /* Setup a communication between mcs7780 and sharp chip. */ | 207 | /* Setup a communication between mcs7780 and sharp chip. */ |
208 | static inline int mcs_setup_transceiver_sharp(struct mcs_cb *mcs) | 208 | static inline int mcs_setup_transceiver_sharp(struct mcs_cb *mcs) |
209 | { | 209 | { |
210 | IRDA_WARNING("This transceiver type is not supported yet."); | 210 | IRDA_WARNING("This transceiver type is not supported yet.\n"); |
211 | return 1; | 211 | return 1; |
212 | } | 212 | } |
213 | 213 | ||
@@ -279,7 +279,7 @@ static inline int mcs_setup_transceiver(struct mcs_cb *mcs) | |||
279 | break; | 279 | break; |
280 | 280 | ||
281 | default: | 281 | default: |
282 | IRDA_WARNING("Unknown transceiver type: %d", | 282 | IRDA_WARNING("Unknown transceiver type: %d\n", |
283 | mcs->transceiver_type); | 283 | mcs->transceiver_type); |
284 | ret = 1; | 284 | ret = 1; |
285 | } | 285 | } |
@@ -318,7 +318,7 @@ static inline int mcs_setup_transceiver(struct mcs_cb *mcs) | |||
318 | return ret; | 318 | return ret; |
319 | 319 | ||
320 | error: | 320 | error: |
321 | IRDA_ERROR("%s", msg); | 321 | IRDA_ERROR("%s\n", msg); |
322 | return ret; | 322 | return ret; |
323 | } | 323 | } |
324 | 324 | ||
@@ -353,7 +353,7 @@ static unsigned mcs_wrap_fir_skb(const struct sk_buff *skb, __u8 *buf) | |||
353 | buf[0] = len & 0xff; | 353 | buf[0] = len & 0xff; |
354 | buf[1] = (len >> 8) & 0xff; | 354 | buf[1] = (len >> 8) & 0xff; |
355 | /* copy the data into the tx buffer. */ | 355 | /* copy the data into the tx buffer. */ |
356 | memcpy(buf+2, skb->data, skb->len); | 356 | skb_copy_from_linear_data(skb, buf + 2, skb->len); |
357 | /* put the fcs in the last four bytes in little endian order. */ | 357 | /* put the fcs in the last four bytes in little endian order. */ |
358 | buf[len - 4] = fcs & 0xff; | 358 | buf[len - 4] = fcs & 0xff; |
359 | buf[len - 3] = (fcs >> 8) & 0xff; | 359 | buf[len - 3] = (fcs >> 8) & 0xff; |
@@ -377,7 +377,7 @@ static unsigned mcs_wrap_mir_skb(const struct sk_buff *skb, __u8 *buf) | |||
377 | buf[0] = len & 0xff; | 377 | buf[0] = len & 0xff; |
378 | buf[1] = (len >> 8) & 0xff; | 378 | buf[1] = (len >> 8) & 0xff; |
379 | /* copy the data */ | 379 | /* copy the data */ |
380 | memcpy(buf+2, skb->data, skb->len); | 380 | skb_copy_from_linear_data(skb, buf + 2, skb->len); |
381 | /* put the fcs in last two bytes in little endian order. */ | 381 | /* put the fcs in last two bytes in little endian order. */ |
382 | buf[len - 2] = fcs & 0xff; | 382 | buf[len - 2] = fcs & 0xff; |
383 | buf[len - 1] = (fcs >> 8) & 0xff; | 383 | buf[len - 1] = (fcs >> 8) & 0xff; |
@@ -426,9 +426,9 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len) | |||
426 | } | 426 | } |
427 | 427 | ||
428 | skb_reserve(skb, 1); | 428 | skb_reserve(skb, 1); |
429 | memcpy(skb->data, buf, new_len); | 429 | skb_copy_to_linear_data(skb, buf, new_len); |
430 | skb_put(skb, new_len); | 430 | skb_put(skb, new_len); |
431 | skb->mac.raw = skb->data; | 431 | skb_reset_mac_header(skb); |
432 | skb->protocol = htons(ETH_P_IRDA); | 432 | skb->protocol = htons(ETH_P_IRDA); |
433 | skb->dev = mcs->netdev; | 433 | skb->dev = mcs->netdev; |
434 | 434 | ||
@@ -479,9 +479,9 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len) | |||
479 | } | 479 | } |
480 | 480 | ||
481 | skb_reserve(skb, 1); | 481 | skb_reserve(skb, 1); |
482 | memcpy(skb->data, buf, new_len); | 482 | skb_copy_to_linear_data(skb, buf, new_len); |
483 | skb_put(skb, new_len); | 483 | skb_put(skb, new_len); |
484 | skb->mac.raw = skb->data; | 484 | skb_reset_mac_header(skb); |
485 | skb->protocol = htons(ETH_P_IRDA); | 485 | skb->protocol = htons(ETH_P_IRDA); |
486 | skb->dev = mcs->netdev; | 486 | skb->dev = mcs->netdev; |
487 | 487 | ||
@@ -587,7 +587,7 @@ static int mcs_speed_change(struct mcs_cb *mcs) | |||
587 | } while(cnt++ < 100 && (rval & MCS_IRINTX)); | 587 | } while(cnt++ < 100 && (rval & MCS_IRINTX)); |
588 | 588 | ||
589 | if(cnt >= 100) { | 589 | if(cnt >= 100) { |
590 | IRDA_ERROR("unable to change speed"); | 590 | IRDA_ERROR("unable to change speed\n"); |
591 | ret = -EIO; | 591 | ret = -EIO; |
592 | goto error; | 592 | goto error; |
593 | } | 593 | } |
@@ -638,7 +638,7 @@ static int mcs_speed_change(struct mcs_cb *mcs) | |||
638 | 638 | ||
639 | default: | 639 | default: |
640 | ret = 1; | 640 | ret = 1; |
641 | IRDA_WARNING("Unknown transceiver type: %d", | 641 | IRDA_WARNING("Unknown transceiver type: %d\n", |
642 | mcs->transceiver_type); | 642 | mcs->transceiver_type); |
643 | } | 643 | } |
644 | if (unlikely(ret)) | 644 | if (unlikely(ret)) |
@@ -733,7 +733,7 @@ static int mcs_net_open(struct net_device *netdev) | |||
733 | sprintf(hwname, "usb#%d", mcs->usbdev->devnum); | 733 | sprintf(hwname, "usb#%d", mcs->usbdev->devnum); |
734 | mcs->irlap = irlap_open(netdev, &mcs->qos, hwname); | 734 | mcs->irlap = irlap_open(netdev, &mcs->qos, hwname); |
735 | if (!mcs->irlap) { | 735 | if (!mcs->irlap) { |
736 | IRDA_ERROR("mcs7780: irlap_open failed"); | 736 | IRDA_ERROR("mcs7780: irlap_open failed\n"); |
737 | goto error2; | 737 | goto error2; |
738 | } | 738 | } |
739 | 739 | ||
@@ -862,7 +862,7 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
862 | mcs->out_buf, wraplen, mcs_send_irq, mcs); | 862 | mcs->out_buf, wraplen, mcs_send_irq, mcs); |
863 | 863 | ||
864 | if ((ret = usb_submit_urb(mcs->tx_urb, GFP_ATOMIC))) { | 864 | if ((ret = usb_submit_urb(mcs->tx_urb, GFP_ATOMIC))) { |
865 | IRDA_ERROR("failed tx_urb: %d", ret); | 865 | IRDA_ERROR("failed tx_urb: %d\n", ret); |
866 | switch (ret) { | 866 | switch (ret) { |
867 | case -ENODEV: | 867 | case -ENODEV: |
868 | case -EPIPE: | 868 | case -EPIPE: |
@@ -897,7 +897,7 @@ static int mcs_probe(struct usb_interface *intf, | |||
897 | if (!ndev) | 897 | if (!ndev) |
898 | goto error1; | 898 | goto error1; |
899 | 899 | ||
900 | IRDA_DEBUG(1, "MCS7780 USB-IrDA bridge found at %d.", udev->devnum); | 900 | IRDA_DEBUG(1, "MCS7780 USB-IrDA bridge found at %d.\n", udev->devnum); |
901 | 901 | ||
902 | /* what is it realy for? */ | 902 | /* what is it realy for? */ |
903 | SET_MODULE_OWNER(ndev); | 903 | SET_MODULE_OWNER(ndev); |
@@ -905,7 +905,7 @@ static int mcs_probe(struct usb_interface *intf, | |||
905 | 905 | ||
906 | ret = usb_reset_configuration(udev); | 906 | ret = usb_reset_configuration(udev); |
907 | if (ret != 0) { | 907 | if (ret != 0) { |
908 | IRDA_ERROR("mcs7780: usb reset configuration failed"); | 908 | IRDA_ERROR("mcs7780: usb reset configuration failed\n"); |
909 | goto error2; | 909 | goto error2; |
910 | } | 910 | } |
911 | 911 | ||
@@ -950,7 +950,7 @@ static int mcs_probe(struct usb_interface *intf, | |||
950 | if (ret != 0) | 950 | if (ret != 0) |
951 | goto error2; | 951 | goto error2; |
952 | 952 | ||
953 | IRDA_DEBUG(1, "IrDA: Registered MosChip MCS7780 device as %s", | 953 | IRDA_DEBUG(1, "IrDA: Registered MosChip MCS7780 device as %s\n", |
954 | ndev->name); | 954 | ndev->name); |
955 | 955 | ||
956 | mcs->transceiver_type = transceiver_type; | 956 | mcs->transceiver_type = transceiver_type; |
@@ -981,7 +981,7 @@ static void mcs_disconnect(struct usb_interface *intf) | |||
981 | free_netdev(mcs->netdev); | 981 | free_netdev(mcs->netdev); |
982 | 982 | ||
983 | usb_set_intfdata(intf, NULL); | 983 | usb_set_intfdata(intf, NULL); |
984 | IRDA_DEBUG(0, "MCS7780 now disconnected."); | 984 | IRDA_DEBUG(0, "MCS7780 now disconnected.\n"); |
985 | } | 985 | } |
986 | 986 | ||
987 | /* Module insertion */ | 987 | /* Module insertion */ |
@@ -992,7 +992,7 @@ static int __init mcs_init(void) | |||
992 | /* register this driver with the USB subsystem */ | 992 | /* register this driver with the USB subsystem */ |
993 | result = usb_register(&mcs_driver); | 993 | result = usb_register(&mcs_driver); |
994 | if (result) | 994 | if (result) |
995 | IRDA_ERROR("usb_register failed. Error number %d", result); | 995 | IRDA_ERROR("usb_register failed. Error number %d\n", result); |
996 | 996 | ||
997 | return result; | 997 | return result; |
998 | } | 998 | } |
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index 29b5ccd29d0b..d96c89751a71 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c | |||
@@ -1466,9 +1466,8 @@ static int nsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev) | |||
1466 | 1466 | ||
1467 | self->stats.tx_bytes += skb->len; | 1467 | self->stats.tx_bytes += skb->len; |
1468 | 1468 | ||
1469 | memcpy(self->tx_fifo.queue[self->tx_fifo.free].start, skb->data, | 1469 | skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start, |
1470 | skb->len); | 1470 | skb->len); |
1471 | |||
1472 | self->tx_fifo.len++; | 1471 | self->tx_fifo.len++; |
1473 | self->tx_fifo.free++; | 1472 | self->tx_fifo.free++; |
1474 | 1473 | ||
@@ -1869,10 +1868,14 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase) | |||
1869 | /* Copy frame without CRC */ | 1868 | /* Copy frame without CRC */ |
1870 | if (self->io.speed < 4000000) { | 1869 | if (self->io.speed < 4000000) { |
1871 | skb_put(skb, len-2); | 1870 | skb_put(skb, len-2); |
1872 | memcpy(skb->data, self->rx_buff.data, len-2); | 1871 | skb_copy_to_linear_data(skb, |
1872 | self->rx_buff.data, | ||
1873 | len - 2); | ||
1873 | } else { | 1874 | } else { |
1874 | skb_put(skb, len-4); | 1875 | skb_put(skb, len-4); |
1875 | memcpy(skb->data, self->rx_buff.data, len-4); | 1876 | skb_copy_to_linear_data(skb, |
1877 | self->rx_buff.data, | ||
1878 | len - 4); | ||
1876 | } | 1879 | } |
1877 | 1880 | ||
1878 | /* Move to next frame */ | 1881 | /* Move to next frame */ |
@@ -1881,7 +1884,7 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase) | |||
1881 | self->stats.rx_packets++; | 1884 | self->stats.rx_packets++; |
1882 | 1885 | ||
1883 | skb->dev = self->netdev; | 1886 | skb->dev = self->netdev; |
1884 | skb->mac.raw = skb->data; | 1887 | skb_reset_mac_header(skb); |
1885 | skb->protocol = htons(ETH_P_IRDA); | 1888 | skb->protocol = htons(ETH_P_IRDA); |
1886 | netif_rx(skb); | 1889 | netif_rx(skb); |
1887 | self->netdev->last_rx = jiffies; | 1890 | self->netdev->last_rx = jiffies; |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 2272156af31e..fb196fd91855 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -386,12 +386,12 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in | |||
386 | 386 | ||
387 | /* Align IP header to 20 bytes */ | 387 | /* Align IP header to 20 bytes */ |
388 | skb_reserve(skb, 1); | 388 | skb_reserve(skb, 1); |
389 | memcpy(skb->data, si->dma_rx_buff, len); | 389 | skb_copy_to_linear_data(skb, si->dma_rx_buff, len); |
390 | skb_put(skb, len); | 390 | skb_put(skb, len); |
391 | 391 | ||
392 | /* Feed it to IrLAP */ | 392 | /* Feed it to IrLAP */ |
393 | skb->dev = dev; | 393 | skb->dev = dev; |
394 | skb->mac.raw = skb->data; | 394 | skb_reset_mac_header(skb); |
395 | skb->protocol = htons(ETH_P_IRDA); | 395 | skb->protocol = htons(ETH_P_IRDA); |
396 | netif_rx(skb); | 396 | netif_rx(skb); |
397 | 397 | ||
@@ -484,7 +484,7 @@ static int pxa_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) | |||
484 | unsigned long mtt = irda_get_mtt(skb); | 484 | unsigned long mtt = irda_get_mtt(skb); |
485 | 485 | ||
486 | si->dma_tx_buff_len = skb->len; | 486 | si->dma_tx_buff_len = skb->len; |
487 | memcpy(si->dma_tx_buff, skb->data, skb->len); | 487 | skb_copy_from_linear_data(skb, si->dma_tx_buff, skb->len); |
488 | 488 | ||
489 | if (mtt) | 489 | if (mtt) |
490 | while ((unsigned)(OSCR - si->last_oscr)/4 < mtt) | 490 | while ((unsigned)(OSCR - si->last_oscr)/4 < mtt) |
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index 937372d00398..056639f72bec 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
@@ -504,7 +504,7 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev | |||
504 | 504 | ||
505 | skb_put(skb, len); | 505 | skb_put(skb, len); |
506 | skb->dev = dev; | 506 | skb->dev = dev; |
507 | skb->mac.raw = skb->data; | 507 | skb_reset_mac_header(skb); |
508 | skb->protocol = htons(ETH_P_IRDA); | 508 | skb->protocol = htons(ETH_P_IRDA); |
509 | si->stats.rx_packets++; | 509 | si->stats.rx_packets++; |
510 | si->stats.rx_bytes += len; | 510 | si->stats.rx_bytes += len; |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 31c623381ea8..198bf3bfa70f 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -315,6 +315,7 @@ static struct smsc_chip __initdata lpc_chips_flat[] = | |||
315 | { | 315 | { |
316 | /* Base address 0x2E or 0x4E */ | 316 | /* Base address 0x2E or 0x4E */ |
317 | { "47N227", KEY55_1|FIR|SERx4, 0x5a, 0x00 }, | 317 | { "47N227", KEY55_1|FIR|SERx4, 0x5a, 0x00 }, |
318 | { "47N227", KEY55_1|FIR|SERx4, 0x7a, 0x00 }, | ||
318 | { "47N267", KEY55_1|FIR|SERx4, 0x5e, 0x00 }, | 319 | { "47N267", KEY55_1|FIR|SERx4, 0x5e, 0x00 }, |
319 | { NULL } | 320 | { NULL } |
320 | }; | 321 | }; |
@@ -1161,7 +1162,7 @@ static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev) | |||
1161 | self->new_speed = speed; | 1162 | self->new_speed = speed; |
1162 | } | 1163 | } |
1163 | 1164 | ||
1164 | memcpy(self->tx_buff.head, skb->data, skb->len); | 1165 | skb_copy_from_linear_data(skb, self->tx_buff.head, skb->len); |
1165 | 1166 | ||
1166 | self->tx_buff.len = skb->len; | 1167 | self->tx_buff.len = skb->len; |
1167 | self->tx_buff.data = self->tx_buff.head; | 1168 | self->tx_buff.data = self->tx_buff.head; |
@@ -1412,7 +1413,7 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self) | |||
1412 | self->stats.rx_bytes += len; | 1413 | self->stats.rx_bytes += len; |
1413 | 1414 | ||
1414 | skb->dev = self->netdev; | 1415 | skb->dev = self->netdev; |
1415 | skb->mac.raw = skb->data; | 1416 | skb_reset_mac_header(skb); |
1416 | skb->protocol = htons(ETH_P_IRDA); | 1417 | skb->protocol = htons(ETH_P_IRDA); |
1417 | netif_rx(skb); | 1418 | netif_rx(skb); |
1418 | } | 1419 | } |
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index 20d306fea4cb..755aa444a4dd 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include <linux/kthread.h> | 52 | #include <linux/kthread.h> |
53 | #include <linux/freezer.h> | 53 | #include <linux/freezer.h> |
54 | #include <net/irda/irda.h> | 54 | #include <net/irda/irda.h> |
55 | #include <net/irda/irlap.h> | ||
56 | #include <net/irda/irda_device.h> | 55 | #include <net/irda/irda_device.h> |
57 | #include <net/irda/wrapper.h> | 56 | #include <net/irda/wrapper.h> |
58 | #include <net/irda/crc.h> | 57 | #include <net/irda/crc.h> |
@@ -349,7 +348,7 @@ static void fir_eof(struct stir_cb *stir) | |||
349 | } | 348 | } |
350 | skb_reserve(nskb, 1); | 349 | skb_reserve(nskb, 1); |
351 | skb = nskb; | 350 | skb = nskb; |
352 | memcpy(nskb->data, rx_buff->data, len); | 351 | skb_copy_to_linear_data(nskb, rx_buff->data, len); |
353 | } else { | 352 | } else { |
354 | nskb = dev_alloc_skb(rx_buff->truesize); | 353 | nskb = dev_alloc_skb(rx_buff->truesize); |
355 | if (unlikely(!nskb)) { | 354 | if (unlikely(!nskb)) { |
@@ -364,7 +363,7 @@ static void fir_eof(struct stir_cb *stir) | |||
364 | 363 | ||
365 | skb_put(skb, len); | 364 | skb_put(skb, len); |
366 | 365 | ||
367 | skb->mac.raw = skb->data; | 366 | skb_reset_mac_header(skb); |
368 | skb->protocol = htons(ETH_P_IRDA); | 367 | skb->protocol = htons(ETH_P_IRDA); |
369 | skb->dev = stir->netdev; | 368 | skb->dev = stir->netdev; |
370 | 369 | ||
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index c3ed9b3067e5..ff5358574d0a 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c | |||
@@ -925,8 +925,8 @@ static int via_ircc_hard_xmit_fir(struct sk_buff *skb, | |||
925 | 925 | ||
926 | self->tx_fifo.tail += skb->len; | 926 | self->tx_fifo.tail += skb->len; |
927 | self->stats.tx_bytes += skb->len; | 927 | self->stats.tx_bytes += skb->len; |
928 | memcpy(self->tx_fifo.queue[self->tx_fifo.free].start, skb->data, | 928 | skb_copy_from_linear_data(skb, |
929 | skb->len); | 929 | self->tx_fifo.queue[self->tx_fifo.free].start, skb->len); |
930 | self->tx_fifo.len++; | 930 | self->tx_fifo.len++; |
931 | self->tx_fifo.free++; | 931 | self->tx_fifo.free++; |
932 | //F01 if (self->tx_fifo.len == 1) { | 932 | //F01 if (self->tx_fifo.len == 1) { |
@@ -1125,7 +1125,7 @@ static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, | |||
1125 | self->stats.rx_bytes += len; | 1125 | self->stats.rx_bytes += len; |
1126 | self->stats.rx_packets++; | 1126 | self->stats.rx_packets++; |
1127 | skb->dev = self->netdev; | 1127 | skb->dev = self->netdev; |
1128 | skb->mac.raw = skb->data; | 1128 | skb_reset_mac_header(skb); |
1129 | skb->protocol = htons(ETH_P_IRDA); | 1129 | skb->protocol = htons(ETH_P_IRDA); |
1130 | netif_rx(skb); | 1130 | netif_rx(skb); |
1131 | return TRUE; | 1131 | return TRUE; |
@@ -1189,7 +1189,7 @@ F01_E */ | |||
1189 | skb_reserve(skb, 1); | 1189 | skb_reserve(skb, 1); |
1190 | skb_put(skb, len - 4); | 1190 | skb_put(skb, len - 4); |
1191 | 1191 | ||
1192 | memcpy(skb->data, self->rx_buff.data, len - 4); | 1192 | skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4); |
1193 | IRDA_DEBUG(2, "%s(): len=%x.rx_buff=%p\n", __FUNCTION__, | 1193 | IRDA_DEBUG(2, "%s(): len=%x.rx_buff=%p\n", __FUNCTION__, |
1194 | len - 4, self->rx_buff.data); | 1194 | len - 4, self->rx_buff.data); |
1195 | 1195 | ||
@@ -1198,7 +1198,7 @@ F01_E */ | |||
1198 | self->stats.rx_bytes += len; | 1198 | self->stats.rx_bytes += len; |
1199 | self->stats.rx_packets++; | 1199 | self->stats.rx_packets++; |
1200 | skb->dev = self->netdev; | 1200 | skb->dev = self->netdev; |
1201 | skb->mac.raw = skb->data; | 1201 | skb_reset_mac_header(skb); |
1202 | skb->protocol = htons(ETH_P_IRDA); | 1202 | skb->protocol = htons(ETH_P_IRDA); |
1203 | netif_rx(skb); | 1203 | netif_rx(skb); |
1204 | 1204 | ||
@@ -1234,7 +1234,7 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase) | |||
1234 | } | 1234 | } |
1235 | skb_reserve(skb, 1); | 1235 | skb_reserve(skb, 1); |
1236 | skb_put(skb, len - 4 + 1); | 1236 | skb_put(skb, len - 4 + 1); |
1237 | memcpy(skb->data, self->rx_buff.data, len - 4 + 1); | 1237 | skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4 + 1); |
1238 | st_fifo->tail++; | 1238 | st_fifo->tail++; |
1239 | st_fifo->len++; | 1239 | st_fifo->len++; |
1240 | if (st_fifo->tail > MAX_RX_WINDOW) | 1240 | if (st_fifo->tail > MAX_RX_WINDOW) |
@@ -1244,7 +1244,7 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase) | |||
1244 | self->stats.rx_bytes += len; | 1244 | self->stats.rx_bytes += len; |
1245 | self->stats.rx_packets++; | 1245 | self->stats.rx_packets++; |
1246 | skb->dev = self->netdev; | 1246 | skb->dev = self->netdev; |
1247 | skb->mac.raw = skb->data; | 1247 | skb_reset_mac_header(skb); |
1248 | skb->protocol = htons(ETH_P_IRDA); | 1248 | skb->protocol = htons(ETH_P_IRDA); |
1249 | netif_rx(skb); | 1249 | netif_rx(skb); |
1250 | if (st_fifo->len < (MAX_RX_WINDOW + 2)) { | 1250 | if (st_fifo->len < (MAX_RX_WINDOW + 2)) { |
@@ -1303,7 +1303,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase) | |||
1303 | } | 1303 | } |
1304 | skb_reserve(skb, 1); | 1304 | skb_reserve(skb, 1); |
1305 | skb_put(skb, len - 4); | 1305 | skb_put(skb, len - 4); |
1306 | memcpy(skb->data, self->rx_buff.data, len - 4); | 1306 | skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4); |
1307 | 1307 | ||
1308 | IRDA_DEBUG(2, "%s(): len=%x.head=%x\n", __FUNCTION__, | 1308 | IRDA_DEBUG(2, "%s(): len=%x.head=%x\n", __FUNCTION__, |
1309 | len - 4, st_fifo->head); | 1309 | len - 4, st_fifo->head); |
@@ -1313,7 +1313,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase) | |||
1313 | self->stats.rx_bytes += len; | 1313 | self->stats.rx_bytes += len; |
1314 | self->stats.rx_packets++; | 1314 | self->stats.rx_packets++; |
1315 | skb->dev = self->netdev; | 1315 | skb->dev = self->netdev; |
1316 | skb->mac.raw = skb->data; | 1316 | skb_reset_mac_header(skb); |
1317 | skb->protocol = htons(ETH_P_IRDA); | 1317 | skb->protocol = htons(ETH_P_IRDA); |
1318 | netif_rx(skb); | 1318 | netif_rx(skb); |
1319 | } //while | 1319 | } //while |
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index 3457e9d8b667..c4be973867a6 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c | |||
@@ -595,7 +595,7 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd) | |||
595 | rd->skb = NULL; | 595 | rd->skb = NULL; |
596 | skb->dev = ndev; | 596 | skb->dev = ndev; |
597 | memcpy(skb_put(skb,len), rd->buf, len); | 597 | memcpy(skb_put(skb,len), rd->buf, len); |
598 | skb->mac.raw = skb->data; | 598 | skb_reset_mac_header(skb); |
599 | if (in_interrupt()) | 599 | if (in_interrupt()) |
600 | netif_rx(skb); | 600 | netif_rx(skb); |
601 | else | 601 | else |
@@ -993,7 +993,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
993 | goto drop; | 993 | goto drop; |
994 | } | 994 | } |
995 | else | 995 | else |
996 | memcpy(rd->buf, skb->data, len); | 996 | skb_copy_from_linear_data(skb, rd->buf, len); |
997 | } | 997 | } |
998 | 998 | ||
999 | rd->skb = skb; /* remember skb for tx-complete stats */ | 999 | rd->skb = skb; /* remember skb for tx-complete stats */ |
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index 4212657fa4f9..5182e800cc18 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c | |||
@@ -529,7 +529,7 @@ int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev) | |||
529 | /* Decide if we should use PIO or DMA transfer */ | 529 | /* Decide if we should use PIO or DMA transfer */ |
530 | if (self->io.speed > PIO_MAX_SPEED) { | 530 | if (self->io.speed > PIO_MAX_SPEED) { |
531 | self->tx_buff.data = self->tx_buff.head; | 531 | self->tx_buff.data = self->tx_buff.head; |
532 | memcpy(self->tx_buff.data, skb->data, skb->len); | 532 | skb_copy_from_linear_data(skb, self->tx_buff.data, skb->len); |
533 | self->tx_buff.len = skb->len; | 533 | self->tx_buff.len = skb->len; |
534 | 534 | ||
535 | mtt = irda_get_mtt(skb); | 535 | mtt = irda_get_mtt(skb); |
@@ -908,10 +908,14 @@ int w83977af_dma_receive_complete(struct w83977af_ir *self) | |||
908 | /* Copy frame without CRC */ | 908 | /* Copy frame without CRC */ |
909 | if (self->io.speed < 4000000) { | 909 | if (self->io.speed < 4000000) { |
910 | skb_put(skb, len-2); | 910 | skb_put(skb, len-2); |
911 | memcpy(skb->data, self->rx_buff.data, len-2); | 911 | skb_copy_to_linear_data(skb, |
912 | self->rx_buff.data, | ||
913 | len - 2); | ||
912 | } else { | 914 | } else { |
913 | skb_put(skb, len-4); | 915 | skb_put(skb, len-4); |
914 | memcpy(skb->data, self->rx_buff.data, len-4); | 916 | skb_copy_to_linear_data(skb, |
917 | self->rx_buff.data, | ||
918 | len - 4); | ||
915 | } | 919 | } |
916 | 920 | ||
917 | /* Move to next frame */ | 921 | /* Move to next frame */ |
@@ -919,7 +923,7 @@ int w83977af_dma_receive_complete(struct w83977af_ir *self) | |||
919 | self->stats.rx_packets++; | 923 | self->stats.rx_packets++; |
920 | 924 | ||
921 | skb->dev = self->netdev; | 925 | skb->dev = self->netdev; |
922 | skb->mac.raw = skb->data; | 926 | skb_reset_mac_header(skb); |
923 | skb->protocol = htons(ETH_P_IRDA); | 927 | skb->protocol = htons(ETH_P_IRDA); |
924 | netif_rx(skb); | 928 | netif_rx(skb); |
925 | self->netdev->last_rx = jiffies; | 929 | self->netdev->last_rx = jiffies; |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 0e9ba3c3faf7..347d50cd77d4 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -1540,7 +1540,6 @@ static void veth_receive(struct veth_lpar_connection *cnx, | |||
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | skb_put(skb, length); | 1542 | skb_put(skb, length); |
1543 | skb->dev = dev; | ||
1544 | skb->protocol = eth_type_trans(skb, dev); | 1543 | skb->protocol = eth_type_trans(skb, dev); |
1545 | skb->ip_summed = CHECKSUM_NONE; | 1544 | skb->ip_summed = CHECKSUM_NONE; |
1546 | netif_rx(skb); /* send it up */ | 1545 | netif_rx(skb); /* send it up */ |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index afc2ec72529e..dfde80e54aef 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1182,24 +1182,27 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb) | |||
1182 | 1182 | ||
1183 | if (likely(skb_is_gso(skb))) { | 1183 | if (likely(skb_is_gso(skb))) { |
1184 | struct ixgb_buffer *buffer_info; | 1184 | struct ixgb_buffer *buffer_info; |
1185 | struct iphdr *iph; | ||
1186 | |||
1185 | if (skb_header_cloned(skb)) { | 1187 | if (skb_header_cloned(skb)) { |
1186 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); | 1188 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
1187 | if (err) | 1189 | if (err) |
1188 | return err; | 1190 | return err; |
1189 | } | 1191 | } |
1190 | 1192 | ||
1191 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | 1193 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1192 | mss = skb_shinfo(skb)->gso_size; | 1194 | mss = skb_shinfo(skb)->gso_size; |
1193 | skb->nh.iph->tot_len = 0; | 1195 | iph = ip_hdr(skb); |
1194 | skb->nh.iph->check = 0; | 1196 | iph->tot_len = 0; |
1195 | skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr, | 1197 | iph->check = 0; |
1196 | skb->nh.iph->daddr, | 1198 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
1197 | 0, IPPROTO_TCP, 0); | 1199 | iph->daddr, 0, |
1198 | ipcss = skb->nh.raw - skb->data; | 1200 | IPPROTO_TCP, 0); |
1199 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; | 1201 | ipcss = skb_network_offset(skb); |
1200 | ipcse = skb->h.raw - skb->data - 1; | 1202 | ipcso = (void *)&(iph->check) - (void *)skb->data; |
1201 | tucss = skb->h.raw - skb->data; | 1203 | ipcse = skb_transport_offset(skb) - 1; |
1202 | tucso = (void *)&(skb->h.th->check) - (void *)skb->data; | 1204 | tucss = skb_transport_offset(skb); |
1205 | tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data; | ||
1203 | tucse = 0; | 1206 | tucse = 0; |
1204 | 1207 | ||
1205 | i = adapter->tx_ring.next_to_use; | 1208 | i = adapter->tx_ring.next_to_use; |
@@ -1243,7 +1246,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb) | |||
1243 | 1246 | ||
1244 | if(likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 1247 | if(likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
1245 | struct ixgb_buffer *buffer_info; | 1248 | struct ixgb_buffer *buffer_info; |
1246 | css = skb->h.raw - skb->data; | 1249 | css = skb_transport_offset(skb); |
1247 | cso = css + skb->csum_offset; | 1250 | cso = css + skb->csum_offset; |
1248 | 1251 | ||
1249 | i = adapter->tx_ring.next_to_use; | 1252 | i = adapter->tx_ring.next_to_use; |
@@ -2014,9 +2017,12 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
2014 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); | 2017 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); |
2015 | if (new_skb) { | 2018 | if (new_skb) { |
2016 | skb_reserve(new_skb, NET_IP_ALIGN); | 2019 | skb_reserve(new_skb, NET_IP_ALIGN); |
2017 | memcpy(new_skb->data - NET_IP_ALIGN, | 2020 | skb_copy_to_linear_data_offset(new_skb, |
2018 | skb->data - NET_IP_ALIGN, | 2021 | -NET_IP_ALIGN, |
2019 | length + NET_IP_ALIGN); | 2022 | (skb->data - |
2023 | NET_IP_ALIGN), | ||
2024 | (length + | ||
2025 | NET_IP_ALIGN)); | ||
2020 | /* save the skb in buffer_info as good */ | 2026 | /* save the skb in buffer_info as good */ |
2021 | buffer_info->skb = skb; | 2027 | buffer_info->skb = skb; |
2022 | skb = new_skb; | 2028 | skb = new_skb; |
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c index a4eccb11d677..6683afc02aaa 100644 --- a/drivers/net/ixp2000/ixpdev.c +++ b/drivers/net/ixp2000/ixpdev.c | |||
@@ -110,11 +110,10 @@ static int ixpdev_rx(struct net_device *dev, int *budget) | |||
110 | 110 | ||
111 | skb = dev_alloc_skb(desc->pkt_length + 2); | 111 | skb = dev_alloc_skb(desc->pkt_length + 2); |
112 | if (likely(skb != NULL)) { | 112 | if (likely(skb != NULL)) { |
113 | skb->dev = nds[desc->channel]; | ||
114 | skb_reserve(skb, 2); | 113 | skb_reserve(skb, 2); |
115 | eth_copy_and_sum(skb, buf, desc->pkt_length, 0); | 114 | eth_copy_and_sum(skb, buf, desc->pkt_length, 0); |
116 | skb_put(skb, desc->pkt_length); | 115 | skb_put(skb, desc->pkt_length); |
117 | skb->protocol = eth_type_trans(skb, skb->dev); | 116 | skb->protocol = eth_type_trans(skb, nds[desc->channel]); |
118 | 117 | ||
119 | skb->dev->last_rx = jiffies; | 118 | skb->dev->last_rx = jiffies; |
120 | 119 | ||
diff --git a/drivers/net/lance.c b/drivers/net/lance.c index a3843320dbe1..0fe96c85828b 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c | |||
@@ -988,7 +988,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
988 | if (lance_debug > 5) | 988 | if (lance_debug > 5) |
989 | printk("%s: bouncing a high-memory packet (%#x).\n", | 989 | printk("%s: bouncing a high-memory packet (%#x).\n", |
990 | dev->name, (u32)isa_virt_to_bus(skb->data)); | 990 | dev->name, (u32)isa_virt_to_bus(skb->data)); |
991 | memcpy(&lp->tx_bounce_buffs[entry], skb->data, skb->len); | 991 | skb_copy_from_linear_data(skb, &lp->tx_bounce_buffs[entry], skb->len); |
992 | lp->tx_ring[entry].base = | 992 | lp->tx_ring[entry].base = |
993 | ((u32)isa_virt_to_bus((lp->tx_bounce_buffs + entry)) & 0xffffff) | 0x83000000; | 993 | ((u32)isa_virt_to_bus((lp->tx_bounce_buffs + entry)) & 0xffffff) | 0x83000000; |
994 | dev_kfree_skb(skb); | 994 | dev_kfree_skb(skb); |
@@ -1184,7 +1184,6 @@ lance_rx(struct net_device *dev) | |||
1184 | } | 1184 | } |
1185 | break; | 1185 | break; |
1186 | } | 1186 | } |
1187 | skb->dev = dev; | ||
1188 | skb_reserve(skb,2); /* 16 byte align */ | 1187 | skb_reserve(skb,2); /* 16 byte align */ |
1189 | skb_put(skb,pkt_len); /* Make room */ | 1188 | skb_put(skb,pkt_len); /* Make room */ |
1190 | eth_copy_and_sum(skb, | 1189 | eth_copy_and_sum(skb, |
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c index 452863d5d498..0edcd125fd61 100644 --- a/drivers/net/lasi_82596.c +++ b/drivers/net/lasi_82596.c | |||
@@ -801,7 +801,6 @@ memory_squeeze: | |||
801 | lp->stats.rx_dropped++; | 801 | lp->stats.rx_dropped++; |
802 | } | 802 | } |
803 | else { | 803 | else { |
804 | skb->dev = dev; | ||
805 | if (!rx_in_place) { | 804 | if (!rx_in_place) { |
806 | /* 16 byte align the data fields */ | 805 | /* 16 byte align the data fields */ |
807 | dma_sync_single_for_cpu(lp->dev, (dma_addr_t)WSWAPchar(rbd->b_data), PKT_BUF_SZ, DMA_FROM_DEVICE); | 806 | dma_sync_single_for_cpu(lp->dev, (dma_addr_t)WSWAPchar(rbd->b_data), PKT_BUF_SZ, DMA_FROM_DEVICE); |
diff --git a/drivers/net/lib8390.c b/drivers/net/lib8390.c index e726c06b8dc6..5c86e737f954 100644 --- a/drivers/net/lib8390.c +++ b/drivers/net/lib8390.c | |||
@@ -722,7 +722,6 @@ static void ei_receive(struct net_device *dev) | |||
722 | else | 722 | else |
723 | { | 723 | { |
724 | skb_reserve(skb,2); /* IP headers on 16 byte boundaries */ | 724 | skb_reserve(skb,2); /* IP headers on 16 byte boundaries */ |
725 | skb->dev = dev; | ||
726 | skb_put(skb, pkt_len); /* Make room */ | 725 | skb_put(skb, pkt_len); /* Make room */ |
727 | ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame)); | 726 | ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame)); |
728 | skb->protocol=eth_type_trans(skb,dev); | 727 | skb->protocol=eth_type_trans(skb,dev); |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 2b739fd584f1..6ba6ed2b480a 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -75,8 +75,9 @@ static DEFINE_PER_CPU(struct pcpu_lstats, pcpu_lstats); | |||
75 | #ifdef LOOPBACK_TSO | 75 | #ifdef LOOPBACK_TSO |
76 | static void emulate_large_send_offload(struct sk_buff *skb) | 76 | static void emulate_large_send_offload(struct sk_buff *skb) |
77 | { | 77 | { |
78 | struct iphdr *iph = skb->nh.iph; | 78 | struct iphdr *iph = ip_hdr(skb); |
79 | struct tcphdr *th = (struct tcphdr*)(skb->nh.raw + (iph->ihl * 4)); | 79 | struct tcphdr *th = (struct tcphdr *)(skb_network_header(skb) + |
80 | (iph->ihl * 4)); | ||
80 | unsigned int doffset = (iph->ihl + th->doff) * 4; | 81 | unsigned int doffset = (iph->ihl + th->doff) * 4; |
81 | unsigned int mtu = skb_shinfo(skb)->gso_size + doffset; | 82 | unsigned int mtu = skb_shinfo(skb)->gso_size + doffset; |
82 | unsigned int offset = 0; | 83 | unsigned int offset = 0; |
@@ -90,10 +91,11 @@ static void emulate_large_send_offload(struct sk_buff *skb) | |||
90 | if (!nskb) | 91 | if (!nskb) |
91 | break; | 92 | break; |
92 | skb_reserve(nskb, 32); | 93 | skb_reserve(nskb, 32); |
93 | nskb->mac.raw = nskb->data - 14; | 94 | skb_set_mac_header(nskb, -ETH_HLEN); |
94 | nskb->nh.raw = nskb->data; | 95 | skb_reset_network_header(nskb); |
95 | iph = nskb->nh.iph; | 96 | iph = ip_hdr(nskb); |
96 | memcpy(nskb->data, skb->nh.raw, doffset); | 97 | skb_copy_to_linear_data(nskb, skb_network_header(skb), |
98 | doffset); | ||
97 | if (skb_copy_bits(skb, | 99 | if (skb_copy_bits(skb, |
98 | doffset + offset, | 100 | doffset + offset, |
99 | nskb->data + doffset, | 101 | nskb->data + doffset, |
@@ -108,7 +110,7 @@ static void emulate_large_send_offload(struct sk_buff *skb) | |||
108 | memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); | 110 | memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); |
109 | nskb->pkt_type = skb->pkt_type; | 111 | nskb->pkt_type = skb->pkt_type; |
110 | 112 | ||
111 | th = (struct tcphdr*)(nskb->nh.raw + iph->ihl*4); | 113 | th = (struct tcphdr *)(skb_network_header(nskb) + iph->ihl * 4); |
112 | iph->tot_len = htons(frag_size + doffset); | 114 | iph->tot_len = htons(frag_size + doffset); |
113 | iph->id = htons(id); | 115 | iph->id = htons(id); |
114 | iph->check = 0; | 116 | iph->check = 0; |
@@ -137,7 +139,6 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
137 | skb_orphan(skb); | 139 | skb_orphan(skb); |
138 | 140 | ||
139 | skb->protocol = eth_type_trans(skb,dev); | 141 | skb->protocol = eth_type_trans(skb,dev); |
140 | skb->dev = dev; | ||
141 | #ifndef LOOPBACK_MUST_CHECKSUM | 142 | #ifndef LOOPBACK_MUST_CHECKSUM |
142 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 143 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
143 | #endif | 144 | #endif |
@@ -145,7 +146,7 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
145 | #ifdef LOOPBACK_TSO | 146 | #ifdef LOOPBACK_TSO |
146 | if (skb_is_gso(skb)) { | 147 | if (skb_is_gso(skb)) { |
147 | BUG_ON(skb->protocol != htons(ETH_P_IP)); | 148 | BUG_ON(skb->protocol != htons(ETH_P_IP)); |
148 | BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP); | 149 | BUG_ON(ip_hdr(skb)->protocol != IPPROTO_TCP); |
149 | 150 | ||
150 | emulate_large_send_offload(skb); | 151 | emulate_large_send_offload(skb); |
151 | return 0; | 152 | return 0; |
@@ -163,11 +164,9 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
163 | return 0; | 164 | return 0; |
164 | } | 165 | } |
165 | 166 | ||
166 | static struct net_device_stats loopback_stats; | ||
167 | |||
168 | static struct net_device_stats *get_stats(struct net_device *dev) | 167 | static struct net_device_stats *get_stats(struct net_device *dev) |
169 | { | 168 | { |
170 | struct net_device_stats *stats = &loopback_stats; | 169 | struct net_device_stats *stats = &dev->stats; |
171 | unsigned long bytes = 0; | 170 | unsigned long bytes = 0; |
172 | unsigned long packets = 0; | 171 | unsigned long packets = 0; |
173 | int i; | 172 | int i; |
@@ -207,7 +206,6 @@ static const struct ethtool_ops loopback_ethtool_ops = { | |||
207 | struct net_device loopback_dev = { | 206 | struct net_device loopback_dev = { |
208 | .name = "lo", | 207 | .name = "lo", |
209 | .get_stats = &get_stats, | 208 | .get_stats = &get_stats, |
210 | .priv = &loopback_stats, | ||
211 | .mtu = (16 * 1024) + 20 + 20 + 12, | 209 | .mtu = (16 * 1024) + 20 + 20 + 12, |
212 | .hard_start_xmit = loopback_xmit, | 210 | .hard_start_xmit = loopback_xmit, |
213 | .hard_header = eth_header, | 211 | .hard_header = eth_header, |
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c index 177c502f7385..5fc18da1873d 100644 --- a/drivers/net/lp486e.c +++ b/drivers/net/lp486e.c | |||
@@ -676,7 +676,6 @@ i596_rx_one(struct net_device *dev, struct i596_private *lp, | |||
676 | return 1; | 676 | return 1; |
677 | } | 677 | } |
678 | 678 | ||
679 | skb->dev = dev; | ||
680 | memcpy(skb_put(skb,pkt_len), rfd->data, pkt_len); | 679 | memcpy(skb_put(skb,pkt_len), rfd->data, pkt_len); |
681 | 680 | ||
682 | skb->protocol = eth_type_trans(skb,dev); | 681 | skb->protocol = eth_type_trans(skb,dev); |
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c index e960138011c0..90e695d53266 100644 --- a/drivers/net/mac89x0.c +++ b/drivers/net/mac89x0.c | |||
@@ -530,7 +530,6 @@ net_rx(struct net_device *dev) | |||
530 | return; | 530 | return; |
531 | } | 531 | } |
532 | skb_put(skb, length); | 532 | skb_put(skb, length); |
533 | skb->dev = dev; | ||
534 | 533 | ||
535 | memcpy_fromio(skb->data, dev->mem_start + PP_RxFrame, length); | 534 | memcpy_fromio(skb->data, dev->mem_start + PP_RxFrame, length); |
536 | 535 | ||
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 2e9571bf0736..0e04f7ac3f2e 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -357,7 +357,6 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
357 | } | 357 | } |
358 | 358 | ||
359 | skb_reserve(skb, RX_OFFSET); | 359 | skb_reserve(skb, RX_OFFSET); |
360 | skb->dev = bp->dev; | ||
361 | skb->ip_summed = CHECKSUM_NONE; | 360 | skb->ip_summed = CHECKSUM_NONE; |
362 | skb_put(skb, len); | 361 | skb_put(skb, len); |
363 | 362 | ||
@@ -368,9 +367,10 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
368 | BUG_ON(frag != last_frag); | 367 | BUG_ON(frag != last_frag); |
369 | frag_len = len - offset; | 368 | frag_len = len - offset; |
370 | } | 369 | } |
371 | memcpy(skb->data + offset, | 370 | skb_copy_to_linear_data_offset(skb, offset, |
372 | bp->rx_buffers + (RX_BUFFER_SIZE * frag), | 371 | (bp->rx_buffers + |
373 | frag_len); | 372 | (RX_BUFFER_SIZE * frag)), |
373 | frag_len); | ||
374 | offset += RX_BUFFER_SIZE; | 374 | offset += RX_BUFFER_SIZE; |
375 | bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED); | 375 | bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED); |
376 | wmb(); | 376 | wmb(); |
@@ -576,7 +576,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
576 | int i; | 576 | int i; |
577 | dev_dbg(&bp->pdev->dev, | 577 | dev_dbg(&bp->pdev->dev, |
578 | "start_xmit: len %u head %p data %p tail %p end %p\n", | 578 | "start_xmit: len %u head %p data %p tail %p end %p\n", |
579 | skb->len, skb->head, skb->data, skb->tail, skb->end); | 579 | skb->len, skb->head, skb->data, |
580 | skb_tail_pointer(skb), skb_end_pointer(skb)); | ||
580 | dev_dbg(&bp->pdev->dev, | 581 | dev_dbg(&bp->pdev->dev, |
581 | "data:"); | 582 | "data:"); |
582 | for (i = 0; i < 16; i++) | 583 | for (i = 0; i < 16; i++) |
diff --git a/drivers/net/mace.c b/drivers/net/mace.c index 9ec24f0d5d68..b3bd62394958 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c | |||
@@ -939,7 +939,6 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id) | |||
939 | else /* Ethernet header; mace includes FCS */ | 939 | else /* Ethernet header; mace includes FCS */ |
940 | nb -= 8; | 940 | nb -= 8; |
941 | skb_put(skb, nb); | 941 | skb_put(skb, nb); |
942 | skb->dev = dev; | ||
943 | skb->protocol = eth_type_trans(skb, dev); | 942 | skb->protocol = eth_type_trans(skb, dev); |
944 | mp->stats.rx_bytes += skb->len; | 943 | mp->stats.rx_bytes += skb->len; |
945 | netif_rx(skb); | 944 | netif_rx(skb); |
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c index 5d541e873041..27911c07558d 100644 --- a/drivers/net/macmace.c +++ b/drivers/net/macmace.c | |||
@@ -420,8 +420,7 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev) | |||
420 | mp->stats.tx_bytes += skb->len; | 420 | mp->stats.tx_bytes += skb->len; |
421 | 421 | ||
422 | /* We need to copy into our xmit buffer to take care of alignment and caching issues */ | 422 | /* We need to copy into our xmit buffer to take care of alignment and caching issues */ |
423 | 423 | skb_copy_from_linear_data(skb, mp->tx_ring, skb->len); | |
424 | memcpy((void *) mp->tx_ring, skb->data, skb->len); | ||
425 | 424 | ||
426 | /* load the Tx DMA and fire it off */ | 425 | /* load the Tx DMA and fire it off */ |
427 | 426 | ||
@@ -621,7 +620,6 @@ static void mace_dma_rx_frame(struct net_device *dev, struct mace_frame *mf) | |||
621 | skb_reserve(skb,2); | 620 | skb_reserve(skb,2); |
622 | memcpy(skb_put(skb, mf->len), mf->data, mf->len); | 621 | memcpy(skb_put(skb, mf->len), mf->data, mf->len); |
623 | 622 | ||
624 | skb->dev = dev; | ||
625 | skb->protocol = eth_type_trans(skb, dev); | 623 | skb->protocol = eth_type_trans(skb, dev); |
626 | netif_rx(skb); | 624 | netif_rx(skb); |
627 | dev->last_rx = jiffies; | 625 | dev->last_rx = jiffies; |
diff --git a/drivers/net/meth.c b/drivers/net/meth.c index 7e69ca6edd91..0343ea12b299 100644 --- a/drivers/net/meth.c +++ b/drivers/net/meth.c | |||
@@ -421,7 +421,6 @@ static void meth_rx(struct net_device* dev, unsigned long int_status) | |||
421 | /* Write metadata, and then pass to the receive level */ | 421 | /* Write metadata, and then pass to the receive level */ |
422 | skb_put(skb_c, len); | 422 | skb_put(skb_c, len); |
423 | priv->rx_skbs[priv->rx_write] = skb; | 423 | priv->rx_skbs[priv->rx_write] = skb; |
424 | skb_c->dev = dev; | ||
425 | skb_c->protocol = eth_type_trans(skb_c, dev); | 424 | skb_c->protocol = eth_type_trans(skb_c, dev); |
426 | dev->last_rx = jiffies; | 425 | dev->last_rx = jiffies; |
427 | priv->stats.rx_packets++; | 426 | priv->stats.rx_packets++; |
@@ -609,7 +608,7 @@ static void meth_tx_short_prepare(struct meth_private *priv, | |||
609 | 608 | ||
610 | desc->header.raw = METH_TX_CMD_INT_EN | (len-1) | ((128-len) << 16); | 609 | desc->header.raw = METH_TX_CMD_INT_EN | (len-1) | ((128-len) << 16); |
611 | /* maybe I should set whole thing to 0 first... */ | 610 | /* maybe I should set whole thing to 0 first... */ |
612 | memcpy(desc->data.dt + (120 - len), skb->data, skb->len); | 611 | skb_copy_from_linear_data(skb, desc->data.dt + (120 - len), skb->len); |
613 | if (skb->len < len) | 612 | if (skb->len < len) |
614 | memset(desc->data.dt + 120 - len + skb->len, 0, len-skb->len); | 613 | memset(desc->data.dt + 120 - len + skb->len, 0, len-skb->len); |
615 | } | 614 | } |
@@ -627,8 +626,8 @@ static void meth_tx_1page_prepare(struct meth_private *priv, | |||
627 | 626 | ||
628 | /* unaligned part */ | 627 | /* unaligned part */ |
629 | if (unaligned_len) { | 628 | if (unaligned_len) { |
630 | memcpy(desc->data.dt + (120 - unaligned_len), | 629 | skb_copy_from_linear_data(skb, desc->data.dt + (120 - unaligned_len), |
631 | skb->data, unaligned_len); | 630 | unaligned_len); |
632 | desc->header.raw |= (128 - unaligned_len) << 16; | 631 | desc->header.raw |= (128 - unaligned_len) << 16; |
633 | } | 632 | } |
634 | 633 | ||
@@ -653,8 +652,8 @@ static void meth_tx_2page_prepare(struct meth_private *priv, | |||
653 | desc->header.raw = METH_TX_CMD_INT_EN | TX_CATBUF1 | TX_CATBUF2| (skb->len - 1); | 652 | desc->header.raw = METH_TX_CMD_INT_EN | TX_CATBUF1 | TX_CATBUF2| (skb->len - 1); |
654 | /* unaligned part */ | 653 | /* unaligned part */ |
655 | if (unaligned_len){ | 654 | if (unaligned_len){ |
656 | memcpy(desc->data.dt + (120 - unaligned_len), | 655 | skb_copy_from_linear_data(skb, desc->data.dt + (120 - unaligned_len), |
657 | skb->data, unaligned_len); | 656 | unaligned_len); |
658 | desc->header.raw |= (128 - unaligned_len) << 16; | 657 | desc->header.raw |= (128 - unaligned_len) << 16; |
659 | } | 658 | } |
660 | 659 | ||
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c index f42b9e201937..403f63afd201 100644 --- a/drivers/net/mipsnet.c +++ b/drivers/net/mipsnet.c | |||
@@ -101,7 +101,6 @@ static inline ssize_t mipsnet_get_fromdev(struct net_device *dev, size_t count) | |||
101 | if (ioiocpy_frommipsnet(dev, skb_put(skb, len), len)) | 101 | if (ioiocpy_frommipsnet(dev, skb_put(skb, len), len)) |
102 | return -EFAULT; | 102 | return -EFAULT; |
103 | 103 | ||
104 | skb->dev = dev; | ||
105 | skb->protocol = eth_type_trans(skb, dev); | 104 | skb->protocol = eth_type_trans(skb, dev); |
106 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 105 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
107 | 106 | ||
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 8015a7c5b0c9..ab15ecd4b3d6 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -434,7 +434,6 @@ static int mv643xx_eth_receive_queue(struct net_device *dev, int budget) | |||
434 | * received packet | 434 | * received packet |
435 | */ | 435 | */ |
436 | skb_put(skb, pkt_info.byte_cnt - 4); | 436 | skb_put(skb, pkt_info.byte_cnt - 4); |
437 | skb->dev = dev; | ||
438 | 437 | ||
439 | if (pkt_info.cmd_sts & ETH_LAYER_4_CHECKSUM_OK) { | 438 | if (pkt_info.cmd_sts & ETH_LAYER_4_CHECKSUM_OK) { |
440 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 439 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1162,15 +1161,15 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp, | |||
1162 | 1161 | ||
1163 | cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM | | 1162 | cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM | |
1164 | ETH_GEN_IP_V_4_CHECKSUM | | 1163 | ETH_GEN_IP_V_4_CHECKSUM | |
1165 | skb->nh.iph->ihl << ETH_TX_IHL_SHIFT; | 1164 | ip_hdr(skb)->ihl << ETH_TX_IHL_SHIFT; |
1166 | 1165 | ||
1167 | switch (skb->nh.iph->protocol) { | 1166 | switch (ip_hdr(skb)->protocol) { |
1168 | case IPPROTO_UDP: | 1167 | case IPPROTO_UDP: |
1169 | cmd_sts |= ETH_UDP_FRAME; | 1168 | cmd_sts |= ETH_UDP_FRAME; |
1170 | desc->l4i_chk = skb->h.uh->check; | 1169 | desc->l4i_chk = udp_hdr(skb)->check; |
1171 | break; | 1170 | break; |
1172 | case IPPROTO_TCP: | 1171 | case IPPROTO_TCP: |
1173 | desc->l4i_chk = skb->h.th->check; | 1172 | desc->l4i_chk = tcp_hdr(skb)->check; |
1174 | break; | 1173 | break; |
1175 | default: | 1174 | default: |
1176 | BUG(); | 1175 | BUG(); |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index f8efe0e70a6b..16e3c4315e82 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -879,7 +879,7 @@ myri10ge_rx_skb_build(struct sk_buff *skb, u8 * va, | |||
879 | * skb_pull() (for ether_pad and eth_type_trans()) requires | 879 | * skb_pull() (for ether_pad and eth_type_trans()) requires |
880 | * the beginning of the packet in skb_headlen(), move it | 880 | * the beginning of the packet in skb_headlen(), move it |
881 | * manually */ | 881 | * manually */ |
882 | memcpy(skb->data, va, hlen); | 882 | skb_copy_to_linear_data(skb, va, hlen); |
883 | skb_shinfo(skb)->frags[0].page_offset += hlen; | 883 | skb_shinfo(skb)->frags[0].page_offset += hlen; |
884 | skb_shinfo(skb)->frags[0].size -= hlen; | 884 | skb_shinfo(skb)->frags[0].size -= hlen; |
885 | skb->data_len -= hlen; | 885 | skb->data_len -= hlen; |
@@ -1020,7 +1020,6 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, | |||
1020 | skb_shinfo(skb)->nr_frags = 0; | 1020 | skb_shinfo(skb)->nr_frags = 0; |
1021 | } | 1021 | } |
1022 | skb->protocol = eth_type_trans(skb, dev); | 1022 | skb->protocol = eth_type_trans(skb, dev); |
1023 | skb->dev = dev; | ||
1024 | 1023 | ||
1025 | if (mgp->csum_flag) { | 1024 | if (mgp->csum_flag) { |
1026 | if ((skb->protocol == htons(ETH_P_IP)) || | 1025 | if ((skb->protocol == htons(ETH_P_IP)) || |
@@ -2030,7 +2029,7 @@ again: | |||
2030 | odd_flag = 0; | 2029 | odd_flag = 0; |
2031 | flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST); | 2030 | flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST); |
2032 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 2031 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
2033 | cksum_offset = (skb->h.raw - skb->data); | 2032 | cksum_offset = skb_transport_offset(skb); |
2034 | pseudo_hdr_offset = cksum_offset + skb->csum_offset; | 2033 | pseudo_hdr_offset = cksum_offset + skb->csum_offset; |
2035 | /* If the headers are excessively large, then we must | 2034 | /* If the headers are excessively large, then we must |
2036 | * fall back to a software checksum */ | 2035 | * fall back to a software checksum */ |
@@ -2055,7 +2054,7 @@ again: | |||
2055 | * send loop that we are still in the | 2054 | * send loop that we are still in the |
2056 | * header portion of the TSO packet. | 2055 | * header portion of the TSO packet. |
2057 | * TSO header must be at most 134 bytes long */ | 2056 | * TSO header must be at most 134 bytes long */ |
2058 | cum_len = -((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | 2057 | cum_len = -(skb_transport_offset(skb) + tcp_hdrlen(skb)); |
2059 | 2058 | ||
2060 | /* for TSO, pseudo_hdr_offset holds mss. | 2059 | /* for TSO, pseudo_hdr_offset holds mss. |
2061 | * The firmware figures out where to put | 2060 | * The firmware figures out where to put |
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index ee26ef52289f..13444da93273 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c | |||
@@ -368,7 +368,7 @@ static __be16 myri_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
368 | struct ethhdr *eth; | 368 | struct ethhdr *eth; |
369 | unsigned char *rawp; | 369 | unsigned char *rawp; |
370 | 370 | ||
371 | skb->mac.raw = (((unsigned char *)skb->data) + MYRI_PAD_LEN); | 371 | skb_set_mac_header(skb, MYRI_PAD_LEN); |
372 | skb_pull(skb, dev->hard_header_len); | 372 | skb_pull(skb, dev->hard_header_len); |
373 | eth = eth_hdr(skb); | 373 | eth = eth_hdr(skb); |
374 | 374 | ||
@@ -502,7 +502,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
502 | copy_skb->dev = dev; | 502 | copy_skb->dev = dev; |
503 | DRX(("resv_and_put ")); | 503 | DRX(("resv_and_put ")); |
504 | skb_put(copy_skb, len); | 504 | skb_put(copy_skb, len); |
505 | memcpy(copy_skb->data, skb->data, len); | 505 | skb_copy_from_linear_data(skb, copy_skb->data, len); |
506 | 506 | ||
507 | /* Reuse original ring buffer. */ | 507 | /* Reuse original ring buffer. */ |
508 | DRX(("reuse ")); | 508 | DRX(("reuse ")); |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 349b96a3ec4c..a8d7ff2c96ac 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -2289,7 +2289,6 @@ static void netdev_rx(struct net_device *dev, int *work_done, int work_to_do) | |||
2289 | * without copying to a minimally-sized skbuff. */ | 2289 | * without copying to a minimally-sized skbuff. */ |
2290 | if (pkt_len < rx_copybreak | 2290 | if (pkt_len < rx_copybreak |
2291 | && (skb = dev_alloc_skb(pkt_len + RX_OFFSET)) != NULL) { | 2291 | && (skb = dev_alloc_skb(pkt_len + RX_OFFSET)) != NULL) { |
2292 | skb->dev = dev; | ||
2293 | /* 16 byte align the IP header */ | 2292 | /* 16 byte align the IP header */ |
2294 | skb_reserve(skb, RX_OFFSET); | 2293 | skb_reserve(skb, RX_OFFSET); |
2295 | pci_dma_sync_single_for_cpu(np->pci_dev, | 2294 | pci_dma_sync_single_for_cpu(np->pci_dev, |
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c index a53644f6a29b..2b8da0a54998 100644 --- a/drivers/net/netx-eth.c +++ b/drivers/net/netx-eth.c | |||
@@ -168,7 +168,6 @@ static void netx_eth_receive(struct net_device *ndev) | |||
168 | FIFO_PTR_SEGMENT(seg) | FIFO_PTR_FRAMENO(frameno)); | 168 | FIFO_PTR_SEGMENT(seg) | FIFO_PTR_FRAMENO(frameno)); |
169 | 169 | ||
170 | ndev->last_rx = jiffies; | 170 | ndev->last_rx = jiffies; |
171 | skb->dev = ndev; | ||
172 | skb->protocol = eth_type_trans(skb, ndev); | 171 | skb->protocol = eth_type_trans(skb, ndev); |
173 | netif_rx(skb); | 172 | netif_rx(skb); |
174 | priv->stats.rx_packets++; | 173 | priv->stats.rx_packets++; |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 6537574a9cda..0fba8f190762 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include "netxen_nic_hw.h" | 35 | #include "netxen_nic_hw.h" |
36 | #include "netxen_nic_phan_reg.h" | 36 | #include "netxen_nic_phan_reg.h" |
37 | 37 | ||
38 | #include <net/ip.h> | ||
39 | |||
38 | /* PCI Windowing for DDR regions. */ | 40 | /* PCI Windowing for DDR regions. */ |
39 | 41 | ||
40 | #define ADDR_IN_RANGE(addr, low, high) \ | 42 | #define ADDR_IN_RANGE(addr, low, high) \ |
@@ -371,22 +373,21 @@ void netxen_tso_check(struct netxen_adapter *adapter, | |||
371 | struct cmd_desc_type0 *desc, struct sk_buff *skb) | 373 | struct cmd_desc_type0 *desc, struct sk_buff *skb) |
372 | { | 374 | { |
373 | if (desc->mss) { | 375 | if (desc->mss) { |
374 | desc->total_hdr_length = sizeof(struct ethhdr) + | 376 | desc->total_hdr_length = (sizeof(struct ethhdr) + |
375 | ((skb->nh.iph)->ihl * sizeof(u32)) + | 377 | ip_hdrlen(skb) + tcp_hdrlen(skb)); |
376 | ((skb->h.th)->doff * sizeof(u32)); | ||
377 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); | 378 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); |
378 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | 379 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { |
379 | if (skb->nh.iph->protocol == IPPROTO_TCP) { | 380 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) { |
380 | netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); | 381 | netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); |
381 | } else if (skb->nh.iph->protocol == IPPROTO_UDP) { | 382 | } else if (ip_hdr(skb)->protocol == IPPROTO_UDP) { |
382 | netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT); | 383 | netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT); |
383 | } else { | 384 | } else { |
384 | return; | 385 | return; |
385 | } | 386 | } |
386 | } | 387 | } |
387 | adapter->stats.xmitcsummed++; | 388 | adapter->stats.xmitcsummed++; |
388 | desc->tcp_hdr_offset = skb->h.raw - skb->data; | 389 | desc->tcp_hdr_offset = skb_transport_offset(skb); |
389 | desc->ip_hdr_offset = skb->nh.raw - skb->data; | 390 | desc->ip_hdr_offset = skb_network_offset(skb); |
390 | } | 391 | } |
391 | 392 | ||
392 | int netxen_is_flash_supported(struct netxen_adapter *adapter) | 393 | int netxen_is_flash_supported(struct netxen_adapter *adapter) |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index eff965dc5fff..5cd40562da7c 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -1129,7 +1129,6 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
1129 | port->stats.csummed++; | 1129 | port->stats.csummed++; |
1130 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1130 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1131 | } | 1131 | } |
1132 | skb->dev = netdev; | ||
1133 | if (desc_ctx == RCV_DESC_LRO_CTXID) { | 1132 | if (desc_ctx == RCV_DESC_LRO_CTXID) { |
1134 | /* True length was only available on the last pkt */ | 1133 | /* True length was only available on the last pkt */ |
1135 | skb_put(skb, buffer->lro_length); | 1134 | skb_put(skb, buffer->lro_length); |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 7d2525e76abb..ab25c225a07e 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | #include <linux/dma-mapping.h> | 42 | #include <linux/dma-mapping.h> |
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <net/ip.h> | ||
44 | 45 | ||
45 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | 46 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); |
46 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
@@ -778,9 +779,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
778 | if (skb_shinfo(skb)->gso_size > 0) { | 779 | if (skb_shinfo(skb)->gso_size > 0) { |
779 | 780 | ||
780 | no_of_desc++; | 781 | no_of_desc++; |
781 | if (((skb->nh.iph)->ihl * sizeof(u32)) + | 782 | if ((ip_hdrlen(skb) + tcp_hdrlen(skb) + |
782 | ((skb->h.th)->doff * sizeof(u32)) + | 783 | sizeof(struct ethhdr)) > |
783 | sizeof(struct ethhdr) > | ||
784 | (sizeof(struct cmd_desc_type0) - 2)) { | 784 | (sizeof(struct cmd_desc_type0) - 2)) { |
785 | no_of_desc++; | 785 | no_of_desc++; |
786 | } | 786 | } |
@@ -920,8 +920,10 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
920 | /* copy the next 64 bytes - should be enough except | 920 | /* copy the next 64 bytes - should be enough except |
921 | * for pathological case | 921 | * for pathological case |
922 | */ | 922 | */ |
923 | memcpy((void *)hwdesc, (void *)(skb->data) + | 923 | skb_copy_from_linear_data_offset(skb, first_hdr_len, |
924 | first_hdr_len, hdr_len - first_hdr_len); | 924 | hwdesc, |
925 | (hdr_len - | ||
926 | first_hdr_len)); | ||
925 | producer = get_next_index(producer, max_tx_desc_count); | 927 | producer = get_next_index(producer, max_tx_desc_count); |
926 | } | 928 | } |
927 | } | 929 | } |
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c index 8be0d030d6f4..3d5b4232f65f 100644 --- a/drivers/net/ni5010.c +++ b/drivers/net/ni5010.c | |||
@@ -562,7 +562,6 @@ static void ni5010_rx(struct net_device *dev) | |||
562 | return; | 562 | return; |
563 | } | 563 | } |
564 | 564 | ||
565 | skb->dev = dev; | ||
566 | skb_reserve(skb, 2); | 565 | skb_reserve(skb, 2); |
567 | 566 | ||
568 | /* Read packet into buffer */ | 567 | /* Read packet into buffer */ |
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c index a6f4b24b0176..8dbd6d1900b5 100644 --- a/drivers/net/ni52.c +++ b/drivers/net/ni52.c | |||
@@ -934,7 +934,6 @@ static void ni52_rcv_int(struct net_device *dev) | |||
934 | skb = (struct sk_buff *) dev_alloc_skb(totlen+2); | 934 | skb = (struct sk_buff *) dev_alloc_skb(totlen+2); |
935 | if(skb != NULL) | 935 | if(skb != NULL) |
936 | { | 936 | { |
937 | skb->dev = dev; | ||
938 | skb_reserve(skb,2); | 937 | skb_reserve(skb,2); |
939 | skb_put(skb,totlen); | 938 | skb_put(skb,totlen); |
940 | eth_copy_and_sum(skb,(char *) p->base+(unsigned long) rbd->buffer,totlen,0); | 939 | eth_copy_and_sum(skb,(char *) p->base+(unsigned long) rbd->buffer,totlen,0); |
@@ -1183,7 +1182,7 @@ static int ni52_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1183 | else | 1182 | else |
1184 | #endif | 1183 | #endif |
1185 | { | 1184 | { |
1186 | memcpy((char *)p->xmit_cbuffs[p->xmit_count],(char *)(skb->data),skb->len); | 1185 | skb_copy_from_linear_data(skb, (char *) p->xmit_cbuffs[p->xmit_count], skb->len); |
1187 | len = skb->len; | 1186 | len = skb->len; |
1188 | if (len < ETH_ZLEN) { | 1187 | if (len < ETH_ZLEN) { |
1189 | len = ETH_ZLEN; | 1188 | len = ETH_ZLEN; |
diff --git a/drivers/net/ni65.c b/drivers/net/ni65.c index 1578f4d98498..3818edf0ac18 100644 --- a/drivers/net/ni65.c +++ b/drivers/net/ni65.c | |||
@@ -610,7 +610,6 @@ static void *ni65_alloc_mem(struct net_device *dev,char *what,int size,int type) | |||
610 | printk(KERN_WARNING "%s: unable to allocate %s memory.\n",dev->name,what); | 610 | printk(KERN_WARNING "%s: unable to allocate %s memory.\n",dev->name,what); |
611 | return NULL; | 611 | return NULL; |
612 | } | 612 | } |
613 | skb->dev = dev; | ||
614 | skb_reserve(skb,2+16); | 613 | skb_reserve(skb,2+16); |
615 | skb_put(skb,R_BUF_SIZE); /* grab the whole space .. (not necessary) */ | 614 | skb_put(skb,R_BUF_SIZE); /* grab the whole space .. (not necessary) */ |
616 | ptr = skb->data; | 615 | ptr = skb->data; |
@@ -1094,7 +1093,6 @@ static void ni65_recv_intr(struct net_device *dev,int csr0) | |||
1094 | if(skb) | 1093 | if(skb) |
1095 | { | 1094 | { |
1096 | skb_reserve(skb,2); | 1095 | skb_reserve(skb,2); |
1097 | skb->dev = dev; | ||
1098 | #ifdef RCV_VIA_SKB | 1096 | #ifdef RCV_VIA_SKB |
1099 | if( (unsigned long) (skb->data + R_BUF_SIZE) > 0x1000000) { | 1097 | if( (unsigned long) (skb->data + R_BUF_SIZE) > 0x1000000) { |
1100 | skb_put(skb,len); | 1098 | skb_put(skb,len); |
@@ -1178,8 +1176,9 @@ static int ni65_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1178 | if( (unsigned long) (skb->data + skb->len) > 0x1000000) { | 1176 | if( (unsigned long) (skb->data + skb->len) > 0x1000000) { |
1179 | #endif | 1177 | #endif |
1180 | 1178 | ||
1181 | memcpy((char *) p->tmdbounce[p->tmdbouncenum] ,(char *)skb->data, | 1179 | skb_copy_from_linear_data(skb, p->tmdbounce[p->tmdbouncenum], |
1182 | (skb->len > T_BUF_SIZE) ? T_BUF_SIZE : skb->len); | 1180 | skb->len > T_BUF_SIZE ? T_BUF_SIZE : |
1181 | skb->len); | ||
1183 | if (len > skb->len) | 1182 | if (len > skb->len) |
1184 | memset((char *)p->tmdbounce[p->tmdbouncenum]+skb->len, 0, len-skb->len); | 1183 | memset((char *)p->tmdbounce[p->tmdbouncenum]+skb->len, 0, len-skb->len); |
1185 | dev_kfree_skb (skb); | 1184 | dev_kfree_skb (skb); |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 9ec6e9e54f47..6a32338623f1 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -607,7 +607,6 @@ static inline int rx_refill(struct net_device *ndev, gfp_t gfp) | |||
607 | res &= 0xf; | 607 | res &= 0xf; |
608 | skb_reserve(skb, res); | 608 | skb_reserve(skb, res); |
609 | 609 | ||
610 | skb->dev = ndev; | ||
611 | if (gfp != GFP_ATOMIC) | 610 | if (gfp != GFP_ATOMIC) |
612 | spin_lock_irqsave(&dev->rx_info.lock, flags); | 611 | spin_lock_irqsave(&dev->rx_info.lock, flags); |
613 | res = ns83820_add_rx_skb(dev, skb); | 612 | res = ns83820_add_rx_skb(dev, skb); |
@@ -1157,9 +1156,9 @@ again: | |||
1157 | extsts = 0; | 1156 | extsts = 0; |
1158 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1157 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1159 | extsts |= EXTSTS_IPPKT; | 1158 | extsts |= EXTSTS_IPPKT; |
1160 | if (IPPROTO_TCP == skb->nh.iph->protocol) | 1159 | if (IPPROTO_TCP == ip_hdr(skb)->protocol) |
1161 | extsts |= EXTSTS_TCPPKT; | 1160 | extsts |= EXTSTS_TCPPKT; |
1162 | else if (IPPROTO_UDP == skb->nh.iph->protocol) | 1161 | else if (IPPROTO_UDP == ip_hdr(skb)->protocol) |
1163 | extsts |= EXTSTS_UDPPKT; | 1162 | extsts |= EXTSTS_UDPPKT; |
1164 | } | 1163 | } |
1165 | 1164 | ||
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index d670ac74824f..76fe9dd8e841 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -334,8 +334,6 @@ static void pasemi_mac_replenish_rx_ring(struct net_device *dev) | |||
334 | break; | 334 | break; |
335 | } | 335 | } |
336 | 336 | ||
337 | skb->dev = dev; | ||
338 | |||
339 | dma = pci_map_single(mac->dma_pdev, skb->data, skb->len, | 337 | dma = pci_map_single(mac->dma_pdev, skb->data, skb->len, |
340 | PCI_DMA_FROMDEVICE); | 338 | PCI_DMA_FROMDEVICE); |
341 | 339 | ||
@@ -731,16 +729,18 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
731 | dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_SS | XCT_MACTX_CRC_PAD; | 729 | dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_SS | XCT_MACTX_CRC_PAD; |
732 | 730 | ||
733 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 731 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
734 | switch (skb->nh.iph->protocol) { | 732 | const unsigned char *nh = skb_network_header(skb); |
733 | |||
734 | switch (ip_hdr(skb)->protocol) { | ||
735 | case IPPROTO_TCP: | 735 | case IPPROTO_TCP: |
736 | dflags |= XCT_MACTX_CSUM_TCP; | 736 | dflags |= XCT_MACTX_CSUM_TCP; |
737 | dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2); | 737 | dflags |= XCT_MACTX_IPH(skb_network_header_len(skb) >> 2); |
738 | dflags |= XCT_MACTX_IPO(skb->nh.raw - skb->data); | 738 | dflags |= XCT_MACTX_IPO(nh - skb->data); |
739 | break; | 739 | break; |
740 | case IPPROTO_UDP: | 740 | case IPPROTO_UDP: |
741 | dflags |= XCT_MACTX_CSUM_UDP; | 741 | dflags |= XCT_MACTX_CSUM_UDP; |
742 | dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2); | 742 | dflags |= XCT_MACTX_IPH(skb_network_header_len(skb) >> 2); |
743 | dflags |= XCT_MACTX_IPO(skb->nh.raw - skb->data); | 743 | dflags |= XCT_MACTX_IPO(nh - skb->data); |
744 | break; | 744 | break; |
745 | } | 745 | } |
746 | } | 746 | } |
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index 6ca4e4fa6b88..df8998b4f37e 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c | |||
@@ -1344,7 +1344,7 @@ static int netdrv_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
1344 | 1344 | ||
1345 | tp->tx_info[entry].skb = skb; | 1345 | tp->tx_info[entry].skb = skb; |
1346 | /* tp->tx_info[entry].mapping = 0; */ | 1346 | /* tp->tx_info[entry].mapping = 0; */ |
1347 | memcpy (tp->tx_buf[entry], skb->data, skb->len); | 1347 | skb_copy_from_linear_data(skb, tp->tx_buf[entry], skb->len); |
1348 | 1348 | ||
1349 | /* Note: the chip doesn't have auto-pad! */ | 1349 | /* Note: the chip doesn't have auto-pad! */ |
1350 | NETDRV_W32 (TxStatus0 + (entry * sizeof(u32)), | 1350 | NETDRV_W32 (TxStatus0 + (entry * sizeof(u32)), |
@@ -1565,7 +1565,6 @@ static void netdrv_rx_interrupt (struct net_device *dev, | |||
1565 | 1565 | ||
1566 | skb = dev_alloc_skb (pkt_size + 2); | 1566 | skb = dev_alloc_skb (pkt_size + 2); |
1567 | if (skb) { | 1567 | if (skb) { |
1568 | skb->dev = dev; | ||
1569 | skb_reserve (skb, 2); /* 16 byte align the IP fields. */ | 1568 | skb_reserve (skb, 2); /* 16 byte align the IP fields. */ |
1570 | 1569 | ||
1571 | eth_copy_and_sum (skb, &rx_ring[ring_offset + 4], pkt_size, 0); | 1570 | eth_copy_and_sum (skb, &rx_ring[ring_offset + 4], pkt_size, 0); |
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index c7bd9c1c7f31..2b395ee21f75 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -1056,7 +1056,6 @@ static int el3_rx(struct net_device *dev, int worklimit) | |||
1056 | DEBUG(3, " Receiving packet size %d status %4.4x.\n", | 1056 | DEBUG(3, " Receiving packet size %d status %4.4x.\n", |
1057 | pkt_len, rx_status); | 1057 | pkt_len, rx_status); |
1058 | if (skb != NULL) { | 1058 | if (skb != NULL) { |
1059 | skb->dev = dev; | ||
1060 | skb_reserve(skb, 2); | 1059 | skb_reserve(skb, 2); |
1061 | insl(ioaddr+RX_FIFO, skb_put(skb, pkt_len), | 1060 | insl(ioaddr+RX_FIFO, skb_put(skb, pkt_len), |
1062 | ((pkt_len+3)>>2)); | 1061 | ((pkt_len+3)>>2)); |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 461e8274ef69..143ae2ff309e 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -883,7 +883,6 @@ static int el3_rx(struct net_device *dev) | |||
883 | DEBUG(3, " Receiving packet size %d status %4.4x.\n", | 883 | DEBUG(3, " Receiving packet size %d status %4.4x.\n", |
884 | pkt_len, rx_status); | 884 | pkt_len, rx_status); |
885 | if (skb != NULL) { | 885 | if (skb != NULL) { |
886 | skb->dev = dev; | ||
887 | skb_reserve(skb, 2); | 886 | skb_reserve(skb, 2); |
888 | insl(ioaddr+RX_FIFO, skb_put(skb, pkt_len), | 887 | insl(ioaddr+RX_FIFO, skb_put(skb, pkt_len), |
889 | (pkt_len+3)>>2); | 888 | (pkt_len+3)>>2); |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 6139048f8117..808fae1577e0 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -1136,7 +1136,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1136 | ei_block_output(dev, length, skb->data, output_page); | 1136 | ei_block_output(dev, length, skb->data, output_page); |
1137 | else { | 1137 | else { |
1138 | memset(packet, 0, ETH_ZLEN); | 1138 | memset(packet, 0, ETH_ZLEN); |
1139 | memcpy(packet, skb->data, skb->len); | 1139 | skb_copy_from_linear_data(skb, packet, skb->len); |
1140 | ei_block_output(dev, length, packet, output_page); | 1140 | ei_block_output(dev, length, packet, output_page); |
1141 | } | 1141 | } |
1142 | 1142 | ||
@@ -1496,7 +1496,6 @@ static void ei_receive(struct net_device *dev) | |||
1496 | else | 1496 | else |
1497 | { | 1497 | { |
1498 | skb_reserve(skb,2); /* IP headers on 16 byte boundaries */ | 1498 | skb_reserve(skb,2); /* IP headers on 16 byte boundaries */ |
1499 | skb->dev = dev; | ||
1500 | skb_put(skb, pkt_len); /* Make room */ | 1499 | skb_put(skb, pkt_len); /* Make room */ |
1501 | ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame)); | 1500 | ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame)); |
1502 | skb->protocol=eth_type_trans(skb,dev); | 1501 | skb->protocol=eth_type_trans(skb,dev); |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 0d7de617e535..3f93d4933235 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -999,7 +999,6 @@ static void fjn_rx(struct net_device *dev) | |||
999 | lp->stats.rx_dropped++; | 999 | lp->stats.rx_dropped++; |
1000 | break; | 1000 | break; |
1001 | } | 1001 | } |
1002 | skb->dev = dev; | ||
1003 | 1002 | ||
1004 | skb_reserve(skb, 2); | 1003 | skb_reserve(skb, 2); |
1005 | insw(ioaddr + DATAPORT, skb_put(skb, pkt_len), | 1004 | insw(ioaddr + DATAPORT, skb_put(skb, pkt_len), |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 3b707747a811..73da611fd536 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1182,12 +1182,10 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
1182 | skb = dev_alloc_skb(pkt_len+2); | 1182 | skb = dev_alloc_skb(pkt_len+2); |
1183 | 1183 | ||
1184 | if (skb != NULL) { | 1184 | if (skb != NULL) { |
1185 | skb->dev = dev; | ||
1186 | |||
1187 | skb_reserve(skb, 2); | 1185 | skb_reserve(skb, 2); |
1188 | insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1); | 1186 | insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1); |
1189 | if (pkt_len & 1) | 1187 | if (pkt_len & 1) |
1190 | *(skb->tail-1) = inb(ioaddr + AM2150_RCV); | 1188 | *(skb_tail_pointer(skb) - 1) = inb(ioaddr + AM2150_RCV); |
1191 | skb->protocol = eth_type_trans(skb, dev); | 1189 | skb->protocol = eth_type_trans(skb, dev); |
1192 | 1190 | ||
1193 | netif_rx(skb); /* Send the packet to the upper (protocol) layers. */ | 1191 | netif_rx(skb); /* Send the packet to the upper (protocol) layers. */ |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 2561f76033ea..7912dbd14251 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -1669,7 +1669,6 @@ static void smc_rx(struct net_device *dev) | |||
1669 | (packet_length+1)>>1); | 1669 | (packet_length+1)>>1); |
1670 | skb->protocol = eth_type_trans(skb, dev); | 1670 | skb->protocol = eth_type_trans(skb, dev); |
1671 | 1671 | ||
1672 | skb->dev = dev; | ||
1673 | netif_rx(skb); | 1672 | netif_rx(skb); |
1674 | dev->last_rx = jiffies; | 1673 | dev->last_rx = jiffies; |
1675 | smc->stats.rx_packets++; | 1674 | smc->stats.rx_packets++; |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 5879e7c36988..809ec440b8eb 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -1226,7 +1226,6 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
1226 | (pktlen+1)>>1); | 1226 | (pktlen+1)>>1); |
1227 | } | 1227 | } |
1228 | skb->protocol = eth_type_trans(skb, dev); | 1228 | skb->protocol = eth_type_trans(skb, dev); |
1229 | skb->dev = dev; | ||
1230 | netif_rx(skb); | 1229 | netif_rx(skb); |
1231 | dev->last_rx = jiffies; | 1230 | dev->last_rx = jiffies; |
1232 | lp->stats.rx_packets++; | 1231 | lp->stats.rx_packets++; |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 4d94ba7899bf..0791360a6a66 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -1206,7 +1206,6 @@ static void pcnet32_rx_entry(struct net_device *dev, | |||
1206 | PCI_DMA_FROMDEVICE); | 1206 | PCI_DMA_FROMDEVICE); |
1207 | skb_put(skb, pkt_len); | 1207 | skb_put(skb, pkt_len); |
1208 | lp->rx_skbuff[entry] = newskb; | 1208 | lp->rx_skbuff[entry] = newskb; |
1209 | newskb->dev = dev; | ||
1210 | lp->rx_dma_addr[entry] = | 1209 | lp->rx_dma_addr[entry] = |
1211 | pci_map_single(lp->pci_dev, | 1210 | pci_map_single(lp->pci_dev, |
1212 | newskb->data, | 1211 | newskb->data, |
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 66da91bb1388..68c99b4c5255 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c | |||
@@ -276,21 +276,15 @@ static int fixed_mdio_register_device(int number, int speed, int duplex) | |||
276 | artificially, we are binding the driver here by hand; | 276 | artificially, we are binding the driver here by hand; |
277 | it will be the same for all the fixed phys anyway. | 277 | it will be the same for all the fixed phys anyway. |
278 | */ | 278 | */ |
279 | down_write(&phydev->dev.bus->subsys.rwsem); | ||
280 | |||
281 | phydev->dev.driver = &fixed_mdio_driver.driver; | 279 | phydev->dev.driver = &fixed_mdio_driver.driver; |
282 | 280 | ||
283 | err = phydev->dev.driver->probe(&phydev->dev); | 281 | err = phydev->dev.driver->probe(&phydev->dev); |
284 | if(err < 0) { | 282 | if(err < 0) { |
285 | printk(KERN_ERR "Phy %s: problems with fixed driver\n",phydev->dev.bus_id); | 283 | printk(KERN_ERR "Phy %s: problems with fixed driver\n",phydev->dev.bus_id); |
286 | up_write(&phydev->dev.bus->subsys.rwsem); | ||
287 | goto probe_fail; | 284 | goto probe_fail; |
288 | } | 285 | } |
289 | 286 | ||
290 | err = device_bind_driver(&phydev->dev); | 287 | err = device_bind_driver(&phydev->dev); |
291 | |||
292 | up_write(&phydev->dev.bus->subsys.rwsem); | ||
293 | |||
294 | if (err) | 288 | if (err) |
295 | goto probe_fail; | 289 | goto probe_fail; |
296 | 290 | ||
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 7d5b6d1838c8..8f01952c4850 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -208,16 +208,12 @@ struct phy_device *phy_attach(struct net_device *dev, | |||
208 | * exist, and we should use the genphy driver. */ | 208 | * exist, and we should use the genphy driver. */ |
209 | if (NULL == d->driver) { | 209 | if (NULL == d->driver) { |
210 | int err; | 210 | int err; |
211 | down_write(&d->bus->subsys.rwsem); | ||
212 | d->driver = &genphy_driver.driver; | 211 | d->driver = &genphy_driver.driver; |
213 | 212 | ||
214 | err = d->driver->probe(d); | 213 | err = d->driver->probe(d); |
215 | |||
216 | if (err >= 0) | 214 | if (err >= 0) |
217 | err = device_bind_driver(d); | 215 | err = device_bind_driver(d); |
218 | 216 | ||
219 | up_write(&d->bus->subsys.rwsem); | ||
220 | |||
221 | if (err) | 217 | if (err) |
222 | return ERR_PTR(err); | 218 | return ERR_PTR(err); |
223 | } | 219 | } |
@@ -258,11 +254,8 @@ void phy_detach(struct phy_device *phydev) | |||
258 | * was using the generic driver), we unbind the device | 254 | * was using the generic driver), we unbind the device |
259 | * from the generic driver so that there's a chance a | 255 | * from the generic driver so that there's a chance a |
260 | * real driver could be loaded */ | 256 | * real driver could be loaded */ |
261 | if (phydev->dev.driver == &genphy_driver.driver) { | 257 | if (phydev->dev.driver == &genphy_driver.driver) |
262 | down_write(&phydev->dev.bus->subsys.rwsem); | ||
263 | device_release_driver(&phydev->dev); | 258 | device_release_driver(&phydev->dev); |
264 | up_write(&phydev->dev.bus->subsys.rwsem); | ||
265 | } | ||
266 | } | 259 | } |
267 | EXPORT_SYMBOL(phy_detach); | 260 | EXPORT_SYMBOL(phy_detach); |
268 | 261 | ||
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 6bb085f54437..8754cf3356b0 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -546,7 +546,7 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
546 | struct ethhdr *eth; | 546 | struct ethhdr *eth; |
547 | unsigned char *rawp; | 547 | unsigned char *rawp; |
548 | 548 | ||
549 | skb->mac.raw=skb->data; | 549 | skb_reset_mac_header(skb); |
550 | skb_pull(skb,dev->hard_header_len); | 550 | skb_pull(skb,dev->hard_header_len); |
551 | eth = eth_hdr(skb); | 551 | eth = eth_hdr(skb); |
552 | 552 | ||
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 933e2f3c77aa..caabbc408c34 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -802,9 +802,9 @@ process_input_packet(struct asyncppp *ap) | |||
802 | 802 | ||
803 | /* check for address/control and protocol compression */ | 803 | /* check for address/control and protocol compression */ |
804 | p = skb->data; | 804 | p = skb->data; |
805 | if (p[0] == PPP_ALLSTATIONS && p[1] == PPP_UI) { | 805 | if (p[0] == PPP_ALLSTATIONS) { |
806 | /* chop off address/control */ | 806 | /* chop off address/control */ |
807 | if (skb->len < 3) | 807 | if (p[1] != PPP_UI || skb->len < 3) |
808 | goto err; | 808 | goto err; |
809 | p = skb_pull(skb, 2); | 809 | p = skb_pull(skb, 2); |
810 | } | 810 | } |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index ef58e4128782..6d596ca50cfd 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -88,8 +88,6 @@ struct ppp_file { | |||
88 | #define PF_TO_PPP(pf) PF_TO_X(pf, struct ppp) | 88 | #define PF_TO_PPP(pf) PF_TO_X(pf, struct ppp) |
89 | #define PF_TO_CHANNEL(pf) PF_TO_X(pf, struct channel) | 89 | #define PF_TO_CHANNEL(pf) PF_TO_X(pf, struct channel) |
90 | 90 | ||
91 | #define ROUNDUP(n, x) (((n) + (x) - 1) / (x)) | ||
92 | |||
93 | /* | 91 | /* |
94 | * Data structure describing one ppp unit. | 92 | * Data structure describing one ppp unit. |
95 | * A ppp unit corresponds to a ppp network interface device | 93 | * A ppp unit corresponds to a ppp network interface device |
@@ -1297,7 +1295,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1297 | */ | 1295 | */ |
1298 | fragsize = len; | 1296 | fragsize = len; |
1299 | if (nfree > 1) | 1297 | if (nfree > 1) |
1300 | fragsize = ROUNDUP(fragsize, nfree); | 1298 | fragsize = DIV_ROUND_UP(fragsize, nfree); |
1301 | /* nbigger channels get fragsize bytes, the rest get fragsize-1, | 1299 | /* nbigger channels get fragsize bytes, the rest get fragsize-1, |
1302 | except if nbigger==0, then they all get fragsize. */ | 1300 | except if nbigger==0, then they all get fragsize. */ |
1303 | nbigger = len % nfree; | 1301 | nbigger = len % nfree; |
@@ -1685,7 +1683,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1685 | skb_pull_rcsum(skb, 2); | 1683 | skb_pull_rcsum(skb, 2); |
1686 | skb->dev = ppp->dev; | 1684 | skb->dev = ppp->dev; |
1687 | skb->protocol = htons(npindex_to_ethertype[npi]); | 1685 | skb->protocol = htons(npindex_to_ethertype[npi]); |
1688 | skb->mac.raw = skb->data; | 1686 | skb_reset_mac_header(skb); |
1689 | netif_rx(skb); | 1687 | netif_rx(skb); |
1690 | ppp->dev->last_rx = jiffies; | 1688 | ppp->dev->last_rx = jiffies; |
1691 | } | 1689 | } |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index b6f0e9a25e26..5918fab38349 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -594,7 +594,8 @@ ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb) | |||
594 | return NULL; | 594 | return NULL; |
595 | } | 595 | } |
596 | skb_reserve(npkt,2); | 596 | skb_reserve(npkt,2); |
597 | memcpy(skb_put(npkt,skb->len), skb->data, skb->len); | 597 | skb_copy_from_linear_data(skb, |
598 | skb_put(npkt, skb->len), skb->len); | ||
598 | kfree_skb(skb); | 599 | kfree_skb(skb); |
599 | skb = npkt; | 600 | skb = npkt; |
600 | } | 601 | } |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index ebfa2967cd68..6f98834e6ace 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -207,7 +207,7 @@ static inline struct pppox_sock *get_item(unsigned long sid, | |||
207 | 207 | ||
208 | static inline struct pppox_sock *get_item_by_addr(struct sockaddr_pppox *sp) | 208 | static inline struct pppox_sock *get_item_by_addr(struct sockaddr_pppox *sp) |
209 | { | 209 | { |
210 | struct net_device *dev = NULL; | 210 | struct net_device *dev; |
211 | int ifindex; | 211 | int ifindex; |
212 | 212 | ||
213 | dev = dev_get_by_name(sp->sa_addr.pppoe.dev); | 213 | dev = dev_get_by_name(sp->sa_addr.pppoe.dev); |
@@ -218,20 +218,6 @@ static inline struct pppox_sock *get_item_by_addr(struct sockaddr_pppox *sp) | |||
218 | return get_item(sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote, ifindex); | 218 | return get_item(sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote, ifindex); |
219 | } | 219 | } |
220 | 220 | ||
221 | static inline int set_item(struct pppox_sock *po) | ||
222 | { | ||
223 | int i; | ||
224 | |||
225 | if (!po) | ||
226 | return -EINVAL; | ||
227 | |||
228 | write_lock_bh(&pppoe_hash_lock); | ||
229 | i = __set_item(po); | ||
230 | write_unlock_bh(&pppoe_hash_lock); | ||
231 | |||
232 | return i; | ||
233 | } | ||
234 | |||
235 | static inline struct pppox_sock *delete_item(unsigned long sid, char *addr, int ifindex) | 221 | static inline struct pppox_sock *delete_item(unsigned long sid, char *addr, int ifindex) |
236 | { | 222 | { |
237 | struct pppox_sock *ret; | 223 | struct pppox_sock *ret; |
@@ -255,54 +241,53 @@ static inline struct pppox_sock *delete_item(unsigned long sid, char *addr, int | |||
255 | static void pppoe_flush_dev(struct net_device *dev) | 241 | static void pppoe_flush_dev(struct net_device *dev) |
256 | { | 242 | { |
257 | int hash; | 243 | int hash; |
258 | |||
259 | BUG_ON(dev == NULL); | 244 | BUG_ON(dev == NULL); |
260 | 245 | ||
261 | read_lock_bh(&pppoe_hash_lock); | 246 | write_lock_bh(&pppoe_hash_lock); |
262 | for (hash = 0; hash < PPPOE_HASH_SIZE; hash++) { | 247 | for (hash = 0; hash < PPPOE_HASH_SIZE; hash++) { |
263 | struct pppox_sock *po = item_hash_table[hash]; | 248 | struct pppox_sock *po = item_hash_table[hash]; |
264 | 249 | ||
265 | while (po != NULL) { | 250 | while (po != NULL) { |
266 | if (po->pppoe_dev == dev) { | 251 | struct sock *sk = sk_pppox(po); |
267 | struct sock *sk = sk_pppox(po); | 252 | if (po->pppoe_dev != dev) { |
268 | 253 | po = po->next; | |
269 | sock_hold(sk); | 254 | continue; |
270 | po->pppoe_dev = NULL; | 255 | } |
256 | po->pppoe_dev = NULL; | ||
257 | dev_put(dev); | ||
271 | 258 | ||
272 | /* We hold a reference to SK, now drop the | ||
273 | * hash table lock so that we may attempt | ||
274 | * to lock the socket (which can sleep). | ||
275 | */ | ||
276 | read_unlock_bh(&pppoe_hash_lock); | ||
277 | 259 | ||
278 | lock_sock(sk); | 260 | /* We always grab the socket lock, followed by the |
261 | * pppoe_hash_lock, in that order. Since we should | ||
262 | * hold the sock lock while doing any unbinding, | ||
263 | * we need to release the lock we're holding. | ||
264 | * Hold a reference to the sock so it doesn't disappear | ||
265 | * as we're jumping between locks. | ||
266 | */ | ||
279 | 267 | ||
280 | if (sk->sk_state & | 268 | sock_hold(sk); |
281 | (PPPOX_CONNECTED | PPPOX_BOUND)) { | ||
282 | pppox_unbind_sock(sk); | ||
283 | dev_put(dev); | ||
284 | sk->sk_state = PPPOX_ZOMBIE; | ||
285 | sk->sk_state_change(sk); | ||
286 | } | ||
287 | 269 | ||
288 | release_sock(sk); | 270 | write_unlock_bh(&pppoe_hash_lock); |
271 | lock_sock(sk); | ||
289 | 272 | ||
290 | sock_put(sk); | 273 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { |
274 | pppox_unbind_sock(sk); | ||
275 | sk->sk_state = PPPOX_ZOMBIE; | ||
276 | sk->sk_state_change(sk); | ||
277 | } | ||
291 | 278 | ||
292 | read_lock_bh(&pppoe_hash_lock); | 279 | release_sock(sk); |
280 | sock_put(sk); | ||
293 | 281 | ||
294 | /* Now restart from the beginning of this | 282 | /* Restart scan at the beginning of this hash chain. |
295 | * hash chain. We always NULL out pppoe_dev | 283 | * While the lock was dropped the chain contents may |
296 | * so we are guaranteed to make forward | 284 | * have changed. |
297 | * progress. | 285 | */ |
298 | */ | 286 | write_lock_bh(&pppoe_hash_lock); |
299 | po = item_hash_table[hash]; | 287 | po = item_hash_table[hash]; |
300 | continue; | ||
301 | } | ||
302 | po = po->next; | ||
303 | } | 288 | } |
304 | } | 289 | } |
305 | read_unlock_bh(&pppoe_hash_lock); | 290 | write_unlock_bh(&pppoe_hash_lock); |
306 | } | 291 | } |
307 | 292 | ||
308 | static int pppoe_device_event(struct notifier_block *this, | 293 | static int pppoe_device_event(struct notifier_block *this, |
@@ -344,10 +329,10 @@ static struct notifier_block pppoe_notifier = { | |||
344 | static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb) | 329 | static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb) |
345 | { | 330 | { |
346 | struct pppox_sock *po = pppox_sk(sk); | 331 | struct pppox_sock *po = pppox_sk(sk); |
347 | struct pppox_sock *relay_po = NULL; | 332 | struct pppox_sock *relay_po; |
348 | 333 | ||
349 | if (sk->sk_state & PPPOX_BOUND) { | 334 | if (sk->sk_state & PPPOX_BOUND) { |
350 | struct pppoe_hdr *ph = (struct pppoe_hdr *) skb->nh.raw; | 335 | struct pppoe_hdr *ph = pppoe_hdr(skb); |
351 | int len = ntohs(ph->length); | 336 | int len = ntohs(ph->length); |
352 | skb_pull_rcsum(skb, sizeof(struct pppoe_hdr)); | 337 | skb_pull_rcsum(skb, sizeof(struct pppoe_hdr)); |
353 | if (pskb_trim_rcsum(skb, len)) | 338 | if (pskb_trim_rcsum(skb, len)) |
@@ -401,7 +386,7 @@ static int pppoe_rcv(struct sk_buff *skb, | |||
401 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) | 386 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) |
402 | goto out; | 387 | goto out; |
403 | 388 | ||
404 | ph = (struct pppoe_hdr *) skb->nh.raw; | 389 | ph = pppoe_hdr(skb); |
405 | 390 | ||
406 | po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source, dev->ifindex); | 391 | po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source, dev->ifindex); |
407 | if (po != NULL) | 392 | if (po != NULL) |
@@ -433,7 +418,7 @@ static int pppoe_disc_rcv(struct sk_buff *skb, | |||
433 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) | 418 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) |
434 | goto out; | 419 | goto out; |
435 | 420 | ||
436 | ph = (struct pppoe_hdr *) skb->nh.raw; | 421 | ph = pppoe_hdr(skb); |
437 | if (ph->code != PADT_CODE) | 422 | if (ph->code != PADT_CODE) |
438 | goto abort; | 423 | goto abort; |
439 | 424 | ||
@@ -514,36 +499,49 @@ static int pppoe_release(struct socket *sock) | |||
514 | { | 499 | { |
515 | struct sock *sk = sock->sk; | 500 | struct sock *sk = sock->sk; |
516 | struct pppox_sock *po; | 501 | struct pppox_sock *po; |
517 | int error = 0; | ||
518 | 502 | ||
519 | if (!sk) | 503 | if (!sk) |
520 | return 0; | 504 | return 0; |
521 | 505 | ||
522 | if (sock_flag(sk, SOCK_DEAD)) | 506 | lock_sock(sk); |
507 | if (sock_flag(sk, SOCK_DEAD)){ | ||
508 | release_sock(sk); | ||
523 | return -EBADF; | 509 | return -EBADF; |
510 | } | ||
524 | 511 | ||
525 | pppox_unbind_sock(sk); | 512 | pppox_unbind_sock(sk); |
526 | 513 | ||
527 | /* Signal the death of the socket. */ | 514 | /* Signal the death of the socket. */ |
528 | sk->sk_state = PPPOX_DEAD; | 515 | sk->sk_state = PPPOX_DEAD; |
529 | 516 | ||
517 | |||
518 | /* Write lock on hash lock protects the entire "po" struct from | ||
519 | * concurrent updates via pppoe_flush_dev. The "po" struct should | ||
520 | * be considered part of the hash table contents, thus protected | ||
521 | * by the hash table lock */ | ||
522 | write_lock_bh(&pppoe_hash_lock); | ||
523 | |||
530 | po = pppox_sk(sk); | 524 | po = pppox_sk(sk); |
531 | if (po->pppoe_pa.sid) { | 525 | if (po->pppoe_pa.sid) { |
532 | delete_item(po->pppoe_pa.sid, po->pppoe_pa.remote, po->pppoe_ifindex); | 526 | __delete_item(po->pppoe_pa.sid, |
527 | po->pppoe_pa.remote, po->pppoe_ifindex); | ||
533 | } | 528 | } |
534 | 529 | ||
535 | if (po->pppoe_dev) | 530 | if (po->pppoe_dev) { |
536 | dev_put(po->pppoe_dev); | 531 | dev_put(po->pppoe_dev); |
532 | po->pppoe_dev = NULL; | ||
533 | } | ||
537 | 534 | ||
538 | po->pppoe_dev = NULL; | 535 | write_unlock_bh(&pppoe_hash_lock); |
539 | 536 | ||
540 | sock_orphan(sk); | 537 | sock_orphan(sk); |
541 | sock->sk = NULL; | 538 | sock->sk = NULL; |
542 | 539 | ||
543 | skb_queue_purge(&sk->sk_receive_queue); | 540 | skb_queue_purge(&sk->sk_receive_queue); |
541 | release_sock(sk); | ||
544 | sock_put(sk); | 542 | sock_put(sk); |
545 | 543 | ||
546 | return error; | 544 | return 0; |
547 | } | 545 | } |
548 | 546 | ||
549 | 547 | ||
@@ -599,14 +597,18 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
599 | po->pppoe_dev = dev; | 597 | po->pppoe_dev = dev; |
600 | po->pppoe_ifindex = dev->ifindex; | 598 | po->pppoe_ifindex = dev->ifindex; |
601 | 599 | ||
602 | if (!(dev->flags & IFF_UP)) | 600 | write_lock_bh(&pppoe_hash_lock); |
601 | if (!(dev->flags & IFF_UP)){ | ||
602 | write_unlock_bh(&pppoe_hash_lock); | ||
603 | goto err_put; | 603 | goto err_put; |
604 | } | ||
604 | 605 | ||
605 | memcpy(&po->pppoe_pa, | 606 | memcpy(&po->pppoe_pa, |
606 | &sp->sa_addr.pppoe, | 607 | &sp->sa_addr.pppoe, |
607 | sizeof(struct pppoe_addr)); | 608 | sizeof(struct pppoe_addr)); |
608 | 609 | ||
609 | error = set_item(po); | 610 | error = __set_item(po); |
611 | write_unlock_bh(&pppoe_hash_lock); | ||
610 | if (error < 0) | 612 | if (error < 0) |
611 | goto err_put; | 613 | goto err_put; |
612 | 614 | ||
@@ -762,10 +764,10 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, | |||
762 | static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock, | 764 | static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock, |
763 | struct msghdr *m, size_t total_len) | 765 | struct msghdr *m, size_t total_len) |
764 | { | 766 | { |
765 | struct sk_buff *skb = NULL; | 767 | struct sk_buff *skb; |
766 | struct sock *sk = sock->sk; | 768 | struct sock *sk = sock->sk; |
767 | struct pppox_sock *po = pppox_sk(sk); | 769 | struct pppox_sock *po = pppox_sk(sk); |
768 | int error = 0; | 770 | int error; |
769 | struct pppoe_hdr hdr; | 771 | struct pppoe_hdr hdr; |
770 | struct pppoe_hdr *ph; | 772 | struct pppoe_hdr *ph; |
771 | struct net_device *dev; | 773 | struct net_device *dev; |
@@ -799,7 +801,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
799 | 801 | ||
800 | /* Reserve space for headers. */ | 802 | /* Reserve space for headers. */ |
801 | skb_reserve(skb, dev->hard_header_len); | 803 | skb_reserve(skb, dev->hard_header_len); |
802 | skb->nh.raw = skb->data; | 804 | skb_reset_network_header(skb); |
803 | 805 | ||
804 | skb->dev = dev; | 806 | skb->dev = dev; |
805 | 807 | ||
@@ -869,7 +871,8 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) | |||
869 | goto abort; | 871 | goto abort; |
870 | 872 | ||
871 | skb_reserve(skb2, dev->hard_header_len + sizeof(struct pppoe_hdr)); | 873 | skb_reserve(skb2, dev->hard_header_len + sizeof(struct pppoe_hdr)); |
872 | memcpy(skb_put(skb2, skb->len), skb->data, skb->len); | 874 | skb_copy_from_linear_data(skb, skb_put(skb2, skb->len), |
875 | skb->len); | ||
873 | } else { | 876 | } else { |
874 | /* Make a clone so as to not disturb the original skb, | 877 | /* Make a clone so as to not disturb the original skb, |
875 | * give dev_queue_xmit something it can free. | 878 | * give dev_queue_xmit something it can free. |
@@ -884,7 +887,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) | |||
884 | memcpy(ph, &hdr, sizeof(struct pppoe_hdr)); | 887 | memcpy(ph, &hdr, sizeof(struct pppoe_hdr)); |
885 | skb2->protocol = __constant_htons(ETH_P_PPP_SES); | 888 | skb2->protocol = __constant_htons(ETH_P_PPP_SES); |
886 | 889 | ||
887 | skb2->nh.raw = skb2->data; | 890 | skb_reset_network_header(skb2); |
888 | 891 | ||
889 | skb2->dev = dev; | 892 | skb2->dev = dev; |
890 | 893 | ||
@@ -929,10 +932,8 @@ static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
929 | struct msghdr *m, size_t total_len, int flags) | 932 | struct msghdr *m, size_t total_len, int flags) |
930 | { | 933 | { |
931 | struct sock *sk = sock->sk; | 934 | struct sock *sk = sock->sk; |
932 | struct sk_buff *skb = NULL; | 935 | struct sk_buff *skb; |
933 | int error = 0; | 936 | int error = 0; |
934 | int len; | ||
935 | struct pppoe_hdr *ph = NULL; | ||
936 | 937 | ||
937 | if (sk->sk_state & PPPOX_BOUND) { | 938 | if (sk->sk_state & PPPOX_BOUND) { |
938 | error = -EIO; | 939 | error = -EIO; |
@@ -942,26 +943,21 @@ static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
942 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, | 943 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, |
943 | flags & MSG_DONTWAIT, &error); | 944 | flags & MSG_DONTWAIT, &error); |
944 | 945 | ||
945 | if (error < 0) { | 946 | if (error < 0) |
946 | goto end; | 947 | goto end; |
947 | } | ||
948 | 948 | ||
949 | m->msg_namelen = 0; | 949 | m->msg_namelen = 0; |
950 | 950 | ||
951 | if (skb) { | 951 | if (skb) { |
952 | error = 0; | 952 | struct pppoe_hdr *ph = pppoe_hdr(skb); |
953 | ph = (struct pppoe_hdr *) skb->nh.raw; | 953 | const int len = ntohs(ph->length); |
954 | len = ntohs(ph->length); | ||
955 | 954 | ||
956 | error = memcpy_toiovec(m->msg_iov, (unsigned char *) &ph->tag[0], len); | 955 | error = memcpy_toiovec(m->msg_iov, (unsigned char *) &ph->tag[0], len); |
957 | if (error < 0) | 956 | if (error == 0) |
958 | goto do_skb_free; | 957 | error = len; |
959 | error = len; | ||
960 | } | 958 | } |
961 | 959 | ||
962 | do_skb_free: | 960 | kfree_skb(skb); |
963 | if (skb) | ||
964 | kfree_skb(skb); | ||
965 | end: | 961 | end: |
966 | return error; | 962 | return error; |
967 | } | 963 | } |
@@ -991,7 +987,7 @@ out: | |||
991 | 987 | ||
992 | static __inline__ struct pppox_sock *pppoe_get_idx(loff_t pos) | 988 | static __inline__ struct pppox_sock *pppoe_get_idx(loff_t pos) |
993 | { | 989 | { |
994 | struct pppox_sock *po = NULL; | 990 | struct pppox_sock *po; |
995 | int i = 0; | 991 | int i = 0; |
996 | 992 | ||
997 | for (; i < PPPOE_HASH_SIZE; i++) { | 993 | for (; i < PPPOE_HASH_SIZE; i++) { |
diff --git a/drivers/net/pppox.c b/drivers/net/pppox.c index 9315046b3f55..3f8115db4d54 100644 --- a/drivers/net/pppox.c +++ b/drivers/net/pppox.c | |||
@@ -58,7 +58,7 @@ void pppox_unbind_sock(struct sock *sk) | |||
58 | { | 58 | { |
59 | /* Clear connection to ppp device, if attached. */ | 59 | /* Clear connection to ppp device, if attached. */ |
60 | 60 | ||
61 | if (sk->sk_state & (PPPOX_BOUND | PPPOX_ZOMBIE)) { | 61 | if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED | PPPOX_ZOMBIE)) { |
62 | ppp_unregister_channel(&pppox_sk(sk)->chan); | 62 | ppp_unregister_channel(&pppox_sk(sk)->chan); |
63 | sk->sk_state = PPPOX_DEAD; | 63 | sk->sk_state = PPPOX_DEAD; |
64 | } | 64 | } |
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index a8246eb2f8d9..7b80fb7a9d9b 100755 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
@@ -1873,7 +1873,6 @@ static void ql_process_mac_rx_intr(struct ql3_adapter *qdev, | |||
1873 | pci_unmap_len(lrg_buf_cb2, maplen), | 1873 | pci_unmap_len(lrg_buf_cb2, maplen), |
1874 | PCI_DMA_FROMDEVICE); | 1874 | PCI_DMA_FROMDEVICE); |
1875 | prefetch(skb->data); | 1875 | prefetch(skb->data); |
1876 | skb->dev = qdev->ndev; | ||
1877 | skb->ip_summed = CHECKSUM_NONE; | 1876 | skb->ip_summed = CHECKSUM_NONE; |
1878 | skb->protocol = eth_type_trans(skb, qdev->ndev); | 1877 | skb->protocol = eth_type_trans(skb, qdev->ndev); |
1879 | 1878 | ||
@@ -1928,7 +1927,8 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev, | |||
1928 | * Copy the ethhdr from first buffer to second. This | 1927 | * Copy the ethhdr from first buffer to second. This |
1929 | * is necessary for 3022 IP completions. | 1928 | * is necessary for 3022 IP completions. |
1930 | */ | 1929 | */ |
1931 | memcpy(skb_push(skb2, size), skb1->data + VLAN_ID_LEN, size); | 1930 | skb_copy_from_linear_data_offset(skb1, VLAN_ID_LEN, |
1931 | skb_push(skb2, size), size); | ||
1932 | } else { | 1932 | } else { |
1933 | u16 checksum = le16_to_cpu(ib_ip_rsp_ptr->checksum); | 1933 | u16 checksum = le16_to_cpu(ib_ip_rsp_ptr->checksum); |
1934 | if (checksum & | 1934 | if (checksum & |
@@ -1946,7 +1946,6 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev, | |||
1946 | skb2->ip_summed = CHECKSUM_UNNECESSARY; | 1946 | skb2->ip_summed = CHECKSUM_UNNECESSARY; |
1947 | } | 1947 | } |
1948 | } | 1948 | } |
1949 | skb2->dev = qdev->ndev; | ||
1950 | skb2->protocol = eth_type_trans(skb2, qdev->ndev); | 1949 | skb2->protocol = eth_type_trans(skb2, qdev->ndev); |
1951 | 1950 | ||
1952 | netif_receive_skb(skb2); | 1951 | netif_receive_skb(skb2); |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 6a77b8a92245..45876a854f00 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -2284,7 +2284,7 @@ static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev) | |||
2284 | return LargeSend | ((mss & MSSMask) << MSSShift); | 2284 | return LargeSend | ((mss & MSSMask) << MSSShift); |
2285 | } | 2285 | } |
2286 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2286 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2287 | const struct iphdr *ip = skb->nh.iph; | 2287 | const struct iphdr *ip = ip_hdr(skb); |
2288 | 2288 | ||
2289 | if (ip->protocol == IPPROTO_TCP) | 2289 | if (ip->protocol == IPPROTO_TCP) |
2290 | return IPCS | TCPCS; | 2290 | return IPCS | TCPCS; |
@@ -2586,7 +2586,6 @@ rtl8169_rx_interrupt(struct net_device *dev, struct rtl8169_private *tp, | |||
2586 | pci_action(tp->pci_dev, le64_to_cpu(desc->addr), | 2586 | pci_action(tp->pci_dev, le64_to_cpu(desc->addr), |
2587 | tp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 2587 | tp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
2588 | 2588 | ||
2589 | skb->dev = dev; | ||
2590 | skb_put(skb, pkt_size); | 2589 | skb_put(skb, pkt_size); |
2591 | skb->protocol = eth_type_trans(skb, dev); | 2590 | skb->protocol = eth_type_trans(skb, dev); |
2592 | 2591 | ||
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index b7ff484af3e1..df6b73872fdb 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -115,7 +115,6 @@ static int rionet_rx_clean(struct net_device *ndev) | |||
115 | 115 | ||
116 | rnet->rx_skb[i]->data = data; | 116 | rnet->rx_skb[i]->data = data; |
117 | skb_put(rnet->rx_skb[i], RIO_MAX_MSG_SIZE); | 117 | skb_put(rnet->rx_skb[i], RIO_MAX_MSG_SIZE); |
118 | rnet->rx_skb[i]->dev = ndev; | ||
119 | rnet->rx_skb[i]->protocol = | 118 | rnet->rx_skb[i]->protocol = |
120 | eth_type_trans(rnet->rx_skb[i], ndev); | 119 | eth_type_trans(rnet->rx_skb[i], ndev); |
121 | error = netif_rx(rnet->rx_skb[i]); | 120 | error = netif_rx(rnet->rx_skb[i]); |
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index d81536f90df6..25c73d47daad 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
@@ -1029,7 +1029,6 @@ static void rx_int(struct net_device *dev, u32 rxlimit, u32 index) | |||
1029 | goto defer; | 1029 | goto defer; |
1030 | } | 1030 | } |
1031 | } | 1031 | } |
1032 | skb->dev = dev; | ||
1033 | skb->protocol = hippi_type_trans(skb, dev); | 1032 | skb->protocol = hippi_type_trans(skb, dev); |
1034 | 1033 | ||
1035 | netif_rx(skb); /* send it up */ | 1034 | netif_rx(skb); /* send it up */ |
@@ -1452,7 +1451,7 @@ static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1452 | } | 1451 | } |
1453 | skb_reserve(new_skb, 8); | 1452 | skb_reserve(new_skb, 8); |
1454 | skb_put(new_skb, len); | 1453 | skb_put(new_skb, len); |
1455 | memcpy(new_skb->data, skb->data, len); | 1454 | skb_copy_from_linear_data(skb, new_skb->data, len); |
1456 | dev_kfree_skb(skb); | 1455 | dev_kfree_skb(skb); |
1457 | skb = new_skb; | 1456 | skb = new_skb; |
1458 | } | 1457 | } |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 46ebf141ee5a..600d3ff347fc 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -2195,7 +2195,7 @@ static int fill_rxd_3buf(struct s2io_nic *nic, struct RxD_t *rxdp, struct \ | |||
2195 | frag_list->next = NULL; | 2195 | frag_list->next = NULL; |
2196 | tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); | 2196 | tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); |
2197 | frag_list->data = tmp; | 2197 | frag_list->data = tmp; |
2198 | frag_list->tail = tmp; | 2198 | skb_reset_tail_pointer(frag_list); |
2199 | 2199 | ||
2200 | /* Buffer-2 receives L4 data payload */ | 2200 | /* Buffer-2 receives L4 data payload */ |
2201 | ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev, | 2201 | ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev, |
@@ -2349,7 +2349,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2349 | tmp += ALIGN_SIZE; | 2349 | tmp += ALIGN_SIZE; |
2350 | tmp &= ~ALIGN_SIZE; | 2350 | tmp &= ~ALIGN_SIZE; |
2351 | skb->data = (void *) (unsigned long)tmp; | 2351 | skb->data = (void *) (unsigned long)tmp; |
2352 | skb->tail = (void *) (unsigned long)tmp; | 2352 | skb_reset_tail_pointer(skb); |
2353 | 2353 | ||
2354 | if (!(((struct RxD3*)rxdp)->Buffer0_ptr)) | 2354 | if (!(((struct RxD3*)rxdp)->Buffer0_ptr)) |
2355 | ((struct RxD3*)rxdp)->Buffer0_ptr = | 2355 | ((struct RxD3*)rxdp)->Buffer0_ptr = |
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c index 143958f1ef0a..ad94358ece89 100644 --- a/drivers/net/saa9730.c +++ b/drivers/net/saa9730.c | |||
@@ -688,7 +688,6 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
688 | } else { | 688 | } else { |
689 | lp->stats.rx_bytes += len; | 689 | lp->stats.rx_bytes += len; |
690 | lp->stats.rx_packets++; | 690 | lp->stats.rx_packets++; |
691 | skb->dev = dev; | ||
692 | skb_reserve(skb, 2); /* 16 byte align */ | 691 | skb_reserve(skb, 2); /* 16 byte align */ |
693 | skb_put(skb, len); /* make room */ | 692 | skb_put(skb, len); /* make room */ |
694 | eth_copy_and_sum(skb, | 693 | eth_copy_and_sum(skb, |
diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c index b9fa4fbb1398..1de3eec1a792 100644 --- a/drivers/net/sb1000.c +++ b/drivers/net/sb1000.c | |||
@@ -834,7 +834,7 @@ printk("cm0: IP identification: %02x%02x fragment offset: %02x%02x\n", buffer[3 | |||
834 | goto dropped_frame; | 834 | goto dropped_frame; |
835 | } | 835 | } |
836 | skb->dev = dev; | 836 | skb->dev = dev; |
837 | skb->mac.raw = skb->data; | 837 | skb_reset_mac_header(skb); |
838 | skb->protocol = (unsigned short) buffer[NewDatagramHeaderSkip + 16]; | 838 | skb->protocol = (unsigned short) buffer[NewDatagramHeaderSkip + 16]; |
839 | insw(ioaddr, skb_put(skb, NewDatagramDataSize), | 839 | insw(ioaddr, skb_put(skb, NewDatagramDataSize), |
840 | NewDatagramDataSize / 2); | 840 | NewDatagramDataSize / 2); |
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 103c3174ab54..0a3a379b634c 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c | |||
@@ -933,9 +933,6 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) | |||
933 | } | 933 | } |
934 | 934 | ||
935 | sbdma_align_skb(sb_new, SMP_CACHE_BYTES, ETHER_ALIGN); | 935 | sbdma_align_skb(sb_new, SMP_CACHE_BYTES, ETHER_ALIGN); |
936 | |||
937 | /* mark skbuff owned by our device */ | ||
938 | sb_new->dev = d->sbdma_eth->sbm_dev; | ||
939 | } | 936 | } |
940 | else { | 937 | else { |
941 | sb_new = sb; | 938 | sb_new = sb; |
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c index c32c21af3fdd..5b7284c955dc 100644 --- a/drivers/net/sc92031.c +++ b/drivers/net/sc92031.c | |||
@@ -814,7 +814,6 @@ static void _sc92031_rx_tasklet(struct net_device *dev) | |||
814 | memcpy(skb_put(skb, pkt_size), rx_ring + rx_ring_offset, pkt_size); | 814 | memcpy(skb_put(skb, pkt_size), rx_ring + rx_ring_offset, pkt_size); |
815 | } | 815 | } |
816 | 816 | ||
817 | skb->dev = dev; | ||
818 | skb->protocol = eth_type_trans(skb, dev); | 817 | skb->protocol = eth_type_trans(skb, dev); |
819 | dev->last_rx = jiffies; | 818 | dev->last_rx = jiffies; |
820 | netif_rx(skb); | 819 | netif_rx(skb); |
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c index 0d6c95c7aedf..4bce7c4f373c 100644 --- a/drivers/net/seeq8005.c +++ b/drivers/net/seeq8005.c | |||
@@ -550,7 +550,6 @@ static void seeq8005_rx(struct net_device *dev) | |||
550 | lp->stats.rx_dropped++; | 550 | lp->stats.rx_dropped++; |
551 | break; | 551 | break; |
552 | } | 552 | } |
553 | skb->dev = dev; | ||
554 | skb_reserve(skb, 2); /* align data on 16 byte */ | 553 | skb_reserve(skb, 2); /* align data on 16 byte */ |
555 | buf = skb_put(skb,pkt_len); | 554 | buf = skb_put(skb,pkt_len); |
556 | 555 | ||
diff --git a/drivers/net/sgiseeq.c b/drivers/net/sgiseeq.c index 52ed522a234c..d8c9c5d66d4f 100644 --- a/drivers/net/sgiseeq.c +++ b/drivers/net/sgiseeq.c | |||
@@ -318,7 +318,6 @@ static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *sp | |||
318 | skb = dev_alloc_skb(len + 2); | 318 | skb = dev_alloc_skb(len + 2); |
319 | 319 | ||
320 | if (skb) { | 320 | if (skb) { |
321 | skb->dev = dev; | ||
322 | skb_reserve(skb, 2); | 321 | skb_reserve(skb, 2); |
323 | skb_put(skb, len); | 322 | skb_put(skb, len); |
324 | 323 | ||
@@ -535,7 +534,7 @@ static int sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
535 | * entry and the HPC got to the end of the chain before we | 534 | * entry and the HPC got to the end of the chain before we |
536 | * added this new entry and restarted it. | 535 | * added this new entry and restarted it. |
537 | */ | 536 | */ |
538 | memcpy((char *)(long)td->buf_vaddr, skb->data, skblen); | 537 | skb_copy_from_linear_data(skb, (char *)(long)td->buf_vaddr, skblen); |
539 | if (len != skblen) | 538 | if (len != skblen) |
540 | memset((char *)(long)td->buf_vaddr + skb->len, 0, len-skblen); | 539 | memset((char *)(long)td->buf_vaddr + skb->len, 0, len-skblen); |
541 | td->tdma.cntinfo = (len & HPCDMA_BCNT) | | 540 | td->tdma.cntinfo = (len & HPCDMA_BCNT) | |
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 34463ce6f132..bc8de48da313 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
@@ -632,7 +632,6 @@ static int sis190_rx_interrupt(struct net_device *dev, | |||
632 | pci_action(tp->pci_dev, le32_to_cpu(desc->addr), | 632 | pci_action(tp->pci_dev, le32_to_cpu(desc->addr), |
633 | tp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 633 | tp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
634 | 634 | ||
635 | skb->dev = dev; | ||
636 | skb_put(skb, pkt_size); | 635 | skb_put(skb, pkt_size); |
637 | skb->protocol = eth_type_trans(skb, dev); | 636 | skb->protocol = eth_type_trans(skb, dev); |
638 | 637 | ||
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index b3750f284279..2cb2e156c758 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
@@ -1160,7 +1160,6 @@ sis900_init_rx_ring(struct net_device *net_dev) | |||
1160 | buffer */ | 1160 | buffer */ |
1161 | break; | 1161 | break; |
1162 | } | 1162 | } |
1163 | skb->dev = net_dev; | ||
1164 | sis_priv->rx_skbuff[i] = skb; | 1163 | sis_priv->rx_skbuff[i] = skb; |
1165 | sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE; | 1164 | sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE; |
1166 | sis_priv->rx_ring[i].bufptr = pci_map_single(sis_priv->pci_dev, | 1165 | sis_priv->rx_ring[i].bufptr = pci_map_single(sis_priv->pci_dev, |
@@ -1754,6 +1753,25 @@ static int sis900_rx(struct net_device *net_dev) | |||
1754 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; | 1753 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; |
1755 | } else { | 1754 | } else { |
1756 | struct sk_buff * skb; | 1755 | struct sk_buff * skb; |
1756 | struct sk_buff * rx_skb; | ||
1757 | |||
1758 | pci_unmap_single(sis_priv->pci_dev, | ||
1759 | sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE, | ||
1760 | PCI_DMA_FROMDEVICE); | ||
1761 | |||
1762 | /* refill the Rx buffer, what if there is not enought | ||
1763 | * memory for new socket buffer ?? */ | ||
1764 | if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) { | ||
1765 | /* | ||
1766 | * Not enough memory to refill the buffer | ||
1767 | * so we need to recycle the old one so | ||
1768 | * as to avoid creating a memory hole | ||
1769 | * in the rx ring | ||
1770 | */ | ||
1771 | skb = sis_priv->rx_skbuff[entry]; | ||
1772 | sis_priv->stats.rx_dropped++; | ||
1773 | goto refill_rx_ring; | ||
1774 | } | ||
1757 | 1775 | ||
1758 | /* This situation should never happen, but due to | 1776 | /* This situation should never happen, but due to |
1759 | some unknow bugs, it is possible that | 1777 | some unknow bugs, it is possible that |
@@ -1768,14 +1786,11 @@ static int sis900_rx(struct net_device *net_dev) | |||
1768 | break; | 1786 | break; |
1769 | } | 1787 | } |
1770 | 1788 | ||
1771 | pci_unmap_single(sis_priv->pci_dev, | ||
1772 | sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE, | ||
1773 | PCI_DMA_FROMDEVICE); | ||
1774 | /* give the socket buffer to upper layers */ | 1789 | /* give the socket buffer to upper layers */ |
1775 | skb = sis_priv->rx_skbuff[entry]; | 1790 | rx_skb = sis_priv->rx_skbuff[entry]; |
1776 | skb_put(skb, rx_size); | 1791 | skb_put(rx_skb, rx_size); |
1777 | skb->protocol = eth_type_trans(skb, net_dev); | 1792 | rx_skb->protocol = eth_type_trans(rx_skb, net_dev); |
1778 | netif_rx(skb); | 1793 | netif_rx(rx_skb); |
1779 | 1794 | ||
1780 | /* some network statistics */ | 1795 | /* some network statistics */ |
1781 | if ((rx_status & BCAST) == MCAST) | 1796 | if ((rx_status & BCAST) == MCAST) |
@@ -1783,33 +1798,13 @@ static int sis900_rx(struct net_device *net_dev) | |||
1783 | net_dev->last_rx = jiffies; | 1798 | net_dev->last_rx = jiffies; |
1784 | sis_priv->stats.rx_bytes += rx_size; | 1799 | sis_priv->stats.rx_bytes += rx_size; |
1785 | sis_priv->stats.rx_packets++; | 1800 | sis_priv->stats.rx_packets++; |
1786 | 1801 | sis_priv->dirty_rx++; | |
1787 | /* refill the Rx buffer, what if there is not enought | 1802 | refill_rx_ring: |
1788 | * memory for new socket buffer ?? */ | ||
1789 | if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) { | ||
1790 | /* not enough memory for skbuff, this makes a | ||
1791 | * "hole" on the buffer ring, it is not clear | ||
1792 | * how the hardware will react to this kind | ||
1793 | * of degenerated buffer */ | ||
1794 | if (netif_msg_rx_status(sis_priv)) | ||
1795 | printk(KERN_INFO "%s: Memory squeeze," | ||
1796 | "deferring packet.\n", | ||
1797 | net_dev->name); | ||
1798 | sis_priv->rx_skbuff[entry] = NULL; | ||
1799 | /* reset buffer descriptor state */ | ||
1800 | sis_priv->rx_ring[entry].cmdsts = 0; | ||
1801 | sis_priv->rx_ring[entry].bufptr = 0; | ||
1802 | sis_priv->stats.rx_dropped++; | ||
1803 | sis_priv->cur_rx++; | ||
1804 | break; | ||
1805 | } | ||
1806 | skb->dev = net_dev; | ||
1807 | sis_priv->rx_skbuff[entry] = skb; | 1803 | sis_priv->rx_skbuff[entry] = skb; |
1808 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; | 1804 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; |
1809 | sis_priv->rx_ring[entry].bufptr = | 1805 | sis_priv->rx_ring[entry].bufptr = |
1810 | pci_map_single(sis_priv->pci_dev, skb->data, | 1806 | pci_map_single(sis_priv->pci_dev, skb->data, |
1811 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 1807 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
1812 | sis_priv->dirty_rx++; | ||
1813 | } | 1808 | } |
1814 | sis_priv->cur_rx++; | 1809 | sis_priv->cur_rx++; |
1815 | entry = sis_priv->cur_rx % NUM_RX_DESC; | 1810 | entry = sis_priv->cur_rx % NUM_RX_DESC; |
@@ -1836,7 +1831,6 @@ static int sis900_rx(struct net_device *net_dev) | |||
1836 | sis_priv->stats.rx_dropped++; | 1831 | sis_priv->stats.rx_dropped++; |
1837 | break; | 1832 | break; |
1838 | } | 1833 | } |
1839 | skb->dev = net_dev; | ||
1840 | sis_priv->rx_skbuff[entry] = skb; | 1834 | sis_priv->rx_skbuff[entry] = skb; |
1841 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; | 1835 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; |
1842 | sis_priv->rx_ring[entry].bufptr = | 1836 | sis_priv->rx_ring[entry].bufptr = |
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index e94ab256b540..e0a93005e6dc 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -1562,10 +1562,10 @@ struct sk_buff *pMessage) /* pointer to send-message */ | |||
1562 | pTxd->pMBuf = pMessage; | 1562 | pTxd->pMBuf = pMessage; |
1563 | 1563 | ||
1564 | if (pMessage->ip_summed == CHECKSUM_PARTIAL) { | 1564 | if (pMessage->ip_summed == CHECKSUM_PARTIAL) { |
1565 | u16 hdrlen = pMessage->h.raw - pMessage->data; | 1565 | u16 hdrlen = skb_transport_offset(pMessage); |
1566 | u16 offset = hdrlen + pMessage->csum_offset; | 1566 | u16 offset = hdrlen + pMessage->csum_offset; |
1567 | 1567 | ||
1568 | if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) && | 1568 | if ((ipip_hdr(pMessage)->protocol == IPPROTO_UDP) && |
1569 | (pAC->GIni.GIChipRev == 0) && | 1569 | (pAC->GIni.GIChipRev == 0) && |
1570 | (pAC->GIni.GIChipId == CHIP_ID_YUKON)) { | 1570 | (pAC->GIni.GIChipId == CHIP_ID_YUKON)) { |
1571 | pTxd->TBControl = BMU_TCP_CHECK; | 1571 | pTxd->TBControl = BMU_TCP_CHECK; |
@@ -1681,7 +1681,7 @@ struct sk_buff *pMessage) /* pointer to send-message */ | |||
1681 | ** Does the HW need to evaluate checksum for TCP or UDP packets? | 1681 | ** Does the HW need to evaluate checksum for TCP or UDP packets? |
1682 | */ | 1682 | */ |
1683 | if (pMessage->ip_summed == CHECKSUM_PARTIAL) { | 1683 | if (pMessage->ip_summed == CHECKSUM_PARTIAL) { |
1684 | u16 hdrlen = pMessage->h.raw - pMessage->data; | 1684 | u16 hdrlen = skb_transport_offset(pMessage); |
1685 | u16 offset = hdrlen + pMessage->csum_offset; | 1685 | u16 offset = hdrlen + pMessage->csum_offset; |
1686 | 1686 | ||
1687 | Control = BMU_STFWD; | 1687 | Control = BMU_STFWD; |
@@ -1691,7 +1691,7 @@ struct sk_buff *pMessage) /* pointer to send-message */ | |||
1691 | ** opcode for udp is not working in the hardware yet | 1691 | ** opcode for udp is not working in the hardware yet |
1692 | ** (Revision 2.0) | 1692 | ** (Revision 2.0) |
1693 | */ | 1693 | */ |
1694 | if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) && | 1694 | if ((ipip_hdr(pMessage)->protocol == IPPROTO_UDP) && |
1695 | (pAC->GIni.GIChipRev == 0) && | 1695 | (pAC->GIni.GIChipRev == 0) && |
1696 | (pAC->GIni.GIChipId == CHIP_ID_YUKON)) { | 1696 | (pAC->GIni.GIChipId == CHIP_ID_YUKON)) { |
1697 | Control |= BMU_TCP_CHECK; | 1697 | Control |= BMU_TCP_CHECK; |
@@ -2127,7 +2127,7 @@ rx_start: | |||
2127 | (dma_addr_t) PhysAddr, | 2127 | (dma_addr_t) PhysAddr, |
2128 | FrameLength, | 2128 | FrameLength, |
2129 | PCI_DMA_FROMDEVICE); | 2129 | PCI_DMA_FROMDEVICE); |
2130 | memcpy(pNewMsg->data, pMsg, FrameLength); | 2130 | skb_copy_to_linear_data(pNewMsg, pMsg, FrameLength); |
2131 | 2131 | ||
2132 | pci_dma_sync_single_for_device(pAC->PciDev, | 2132 | pci_dma_sync_single_for_device(pAC->PciDev, |
2133 | (dma_addr_t) PhysAddr, | 2133 | (dma_addr_t) PhysAddr, |
@@ -2193,7 +2193,6 @@ rx_start: | |||
2193 | SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC, | 2193 | SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC, |
2194 | FrameLength, pRxPort->PortIndex); | 2194 | FrameLength, pRxPort->PortIndex); |
2195 | 2195 | ||
2196 | pMsg->dev = pAC->dev[pRxPort->PortIndex]; | ||
2197 | pMsg->protocol = eth_type_trans(pMsg, | 2196 | pMsg->protocol = eth_type_trans(pMsg, |
2198 | pAC->dev[pRxPort->PortIndex]); | 2197 | pAC->dev[pRxPort->PortIndex]); |
2199 | netif_rx(pMsg); | 2198 | netif_rx(pMsg); |
@@ -2246,7 +2245,6 @@ rx_start: | |||
2246 | (IFF_PROMISC | IFF_ALLMULTI)) != 0 || | 2245 | (IFF_PROMISC | IFF_ALLMULTI)) != 0 || |
2247 | (ForRlmt & SK_RLMT_RX_PROTOCOL) == | 2246 | (ForRlmt & SK_RLMT_RX_PROTOCOL) == |
2248 | SK_RLMT_RX_PROTOCOL) { | 2247 | SK_RLMT_RX_PROTOCOL) { |
2249 | pMsg->dev = pAC->dev[pRxPort->PortIndex]; | ||
2250 | pMsg->protocol = eth_type_trans(pMsg, | 2248 | pMsg->protocol = eth_type_trans(pMsg, |
2251 | pAC->dev[pRxPort->PortIndex]); | 2249 | pAC->dev[pRxPort->PortIndex]); |
2252 | netif_rx(pMsg); | 2250 | netif_rx(pMsg); |
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c index 9733a11c6146..a7ef6c8b7721 100644 --- a/drivers/net/skfp/skfddi.c +++ b/drivers/net/skfp/skfddi.c | |||
@@ -1680,7 +1680,6 @@ void mac_drv_rx_complete(struct s_smc *smc, volatile struct s_smt_fp_rxd *rxd, | |||
1680 | rxd->rxd_os.skb = NULL; | 1680 | rxd->rxd_os.skb = NULL; |
1681 | skb_trim(skb, len); | 1681 | skb_trim(skb, len); |
1682 | skb->protocol = fddi_type_trans(skb, bp->dev); | 1682 | skb->protocol = fddi_type_trans(skb, bp->dev); |
1683 | skb->dev = bp->dev; /* pass up device pointer */ | ||
1684 | 1683 | ||
1685 | netif_rx(skb); | 1684 | netif_rx(skb); |
1686 | bp->dev->last_rx = jiffies; | 1685 | bp->dev->last_rx = jiffies; |
@@ -1938,7 +1937,7 @@ int mac_drv_rx_init(struct s_smc *smc, int len, int fc, | |||
1938 | } | 1937 | } |
1939 | skb_reserve(skb, 3); | 1938 | skb_reserve(skb, 3); |
1940 | skb_put(skb, len); | 1939 | skb_put(skb, len); |
1941 | memcpy(skb->data, look_ahead, len); | 1940 | skb_copy_to_linear_data(skb, look_ahead, len); |
1942 | 1941 | ||
1943 | // deliver frame to system | 1942 | // deliver frame to system |
1944 | skb->protocol = fddi_type_trans(skb, smc->os.dev); | 1943 | skb->protocol = fddi_type_trans(skb, smc->os.dev); |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index d476a3cc2e94..f1a0e6c0fbdd 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -2654,12 +2654,12 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
2654 | td->dma_hi = map >> 32; | 2654 | td->dma_hi = map >> 32; |
2655 | 2655 | ||
2656 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2656 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2657 | int offset = skb->h.raw - skb->data; | 2657 | const int offset = skb_transport_offset(skb); |
2658 | 2658 | ||
2659 | /* This seems backwards, but it is what the sk98lin | 2659 | /* This seems backwards, but it is what the sk98lin |
2660 | * does. Looks like hardware is wrong? | 2660 | * does. Looks like hardware is wrong? |
2661 | */ | 2661 | */ |
2662 | if (skb->h.ipiph->protocol == IPPROTO_UDP | 2662 | if (ipip_hdr(skb)->protocol == IPPROTO_UDP |
2663 | && hw->chip_rev == 0 && hw->chip_id == CHIP_ID_YUKON) | 2663 | && hw->chip_rev == 0 && hw->chip_id == CHIP_ID_YUKON) |
2664 | control = BMU_TCP_CHECK; | 2664 | control = BMU_TCP_CHECK; |
2665 | else | 2665 | else |
@@ -2950,7 +2950,7 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, | |||
2950 | pci_dma_sync_single_for_cpu(skge->hw->pdev, | 2950 | pci_dma_sync_single_for_cpu(skge->hw->pdev, |
2951 | pci_unmap_addr(e, mapaddr), | 2951 | pci_unmap_addr(e, mapaddr), |
2952 | len, PCI_DMA_FROMDEVICE); | 2952 | len, PCI_DMA_FROMDEVICE); |
2953 | memcpy(skb->data, e->skb->data, len); | 2953 | skb_copy_from_linear_data(e->skb, skb->data, len); |
2954 | pci_dma_sync_single_for_device(skge->hw->pdev, | 2954 | pci_dma_sync_single_for_device(skge->hw->pdev, |
2955 | pci_unmap_addr(e, mapaddr), | 2955 | pci_unmap_addr(e, mapaddr), |
2956 | len, PCI_DMA_FROMDEVICE); | 2956 | len, PCI_DMA_FROMDEVICE); |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 4a009b7b1777..238c2ca34da6 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/ethtool.h> | 32 | #include <linux/ethtool.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/ip.h> | 34 | #include <linux/ip.h> |
35 | #include <net/ip.h> | ||
35 | #include <linux/tcp.h> | 36 | #include <linux/tcp.h> |
36 | #include <linux/in.h> | 37 | #include <linux/in.h> |
37 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
@@ -49,7 +50,7 @@ | |||
49 | #include "sky2.h" | 50 | #include "sky2.h" |
50 | 51 | ||
51 | #define DRV_NAME "sky2" | 52 | #define DRV_NAME "sky2" |
52 | #define DRV_VERSION "1.13" | 53 | #define DRV_VERSION "1.14" |
53 | #define PFX DRV_NAME " " | 54 | #define PFX DRV_NAME " " |
54 | 55 | ||
55 | /* | 56 | /* |
@@ -123,7 +124,10 @@ static const struct pci_device_id sky2_id_table[] = { | |||
123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ | 124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ |
124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */ | 125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */ |
125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */ | 126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */ |
127 | #ifdef broken | ||
128 | /* This device causes data corruption problems that are not resolved */ | ||
126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */ | 129 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */ |
130 | #endif | ||
127 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */ | 131 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */ |
128 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */ | 132 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */ |
129 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ | 133 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ |
@@ -740,12 +744,17 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
740 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) { | 744 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) { |
741 | sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8); | 745 | sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8); |
742 | sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); | 746 | sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); |
743 | if (hw->dev[port]->mtu > ETH_DATA_LEN) { | 747 | |
744 | /* set Tx GMAC FIFO Almost Empty Threshold */ | 748 | /* set Tx GMAC FIFO Almost Empty Threshold */ |
745 | sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR), 0x180); | 749 | sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR), |
746 | /* Disable Store & Forward mode for TX */ | 750 | (ECU_JUMBO_WM << 16) | ECU_AE_THR); |
747 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_STFW_DIS); | 751 | |
748 | } | 752 | if (hw->dev[port]->mtu > ETH_DATA_LEN) |
753 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
754 | TX_JUMBO_ENA | TX_STFW_DIS); | ||
755 | else | ||
756 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
757 | TX_JUMBO_DIS | TX_STFW_ENA); | ||
749 | } | 758 | } |
750 | 759 | ||
751 | } | 760 | } |
@@ -1278,7 +1287,7 @@ static int sky2_up(struct net_device *dev) | |||
1278 | /* Set almost empty threshold */ | 1287 | /* Set almost empty threshold */ |
1279 | if (hw->chip_id == CHIP_ID_YUKON_EC_U | 1288 | if (hw->chip_id == CHIP_ID_YUKON_EC_U |
1280 | && hw->chip_rev == CHIP_REV_YU_EC_U_A0) | 1289 | && hw->chip_rev == CHIP_REV_YU_EC_U_A0) |
1281 | sky2_write16(hw, Q_ADDR(txqaddr[port], Q_AL), 0x1a0); | 1290 | sky2_write16(hw, Q_ADDR(txqaddr[port], Q_AL), ECU_TXFF_LEV); |
1282 | 1291 | ||
1283 | sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, | 1292 | sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, |
1284 | TX_RING_SIZE - 1); | 1293 | TX_RING_SIZE - 1); |
@@ -1383,8 +1392,8 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1383 | /* Check for TCP Segmentation Offload */ | 1392 | /* Check for TCP Segmentation Offload */ |
1384 | mss = skb_shinfo(skb)->gso_size; | 1393 | mss = skb_shinfo(skb)->gso_size; |
1385 | if (mss != 0) { | 1394 | if (mss != 0) { |
1386 | mss += ((skb->h.th->doff - 5) * 4); /* TCP options */ | 1395 | mss += tcp_optlen(skb); /* TCP options */ |
1387 | mss += (skb->nh.iph->ihl * 4) + sizeof(struct tcphdr); | 1396 | mss += ip_hdrlen(skb) + sizeof(struct tcphdr); |
1388 | mss += ETH_HLEN; | 1397 | mss += ETH_HLEN; |
1389 | 1398 | ||
1390 | if (mss != sky2->tx_last_mss) { | 1399 | if (mss != sky2->tx_last_mss) { |
@@ -1412,14 +1421,14 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1412 | 1421 | ||
1413 | /* Handle TCP checksum offload */ | 1422 | /* Handle TCP checksum offload */ |
1414 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1423 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1415 | unsigned offset = skb->h.raw - skb->data; | 1424 | const unsigned offset = skb_transport_offset(skb); |
1416 | u32 tcpsum; | 1425 | u32 tcpsum; |
1417 | 1426 | ||
1418 | tcpsum = offset << 16; /* sum start */ | 1427 | tcpsum = offset << 16; /* sum start */ |
1419 | tcpsum |= offset + skb->csum_offset; /* sum write */ | 1428 | tcpsum |= offset + skb->csum_offset; /* sum write */ |
1420 | 1429 | ||
1421 | ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; | 1430 | ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; |
1422 | if (skb->nh.iph->protocol == IPPROTO_UDP) | 1431 | if (ip_hdr(skb)->protocol == IPPROTO_UDP) |
1423 | ctrl |= UDPTCP; | 1432 | ctrl |= UDPTCP; |
1424 | 1433 | ||
1425 | if (tcpsum != sky2->tx_tcpsum) { | 1434 | if (tcpsum != sky2->tx_tcpsum) { |
@@ -1584,13 +1593,6 @@ static int sky2_down(struct net_device *dev) | |||
1584 | sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), | 1593 | sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), |
1585 | RB_RST_SET | RB_DIS_OP_MD); | 1594 | RB_RST_SET | RB_DIS_OP_MD); |
1586 | 1595 | ||
1587 | /* WA for dev. #4.209 */ | ||
1588 | if (hw->chip_id == CHIP_ID_YUKON_EC_U | ||
1589 | && (hw->chip_rev == CHIP_REV_YU_EC_U_A1 || hw->chip_rev == CHIP_REV_YU_EC_U_B0)) | ||
1590 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
1591 | sky2->speed != SPEED_1000 ? | ||
1592 | TX_STFW_ENA : TX_STFW_DIS); | ||
1593 | |||
1594 | ctrl = gma_read16(hw, port, GM_GP_CTRL); | 1596 | ctrl = gma_read16(hw, port, GM_GP_CTRL); |
1595 | ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA); | 1597 | ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA); |
1596 | gma_write16(hw, port, GM_GP_CTRL, ctrl); | 1598 | gma_write16(hw, port, GM_GP_CTRL, ctrl); |
@@ -1890,6 +1892,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
1890 | { | 1892 | { |
1891 | struct sky2_port *sky2 = netdev_priv(dev); | 1893 | struct sky2_port *sky2 = netdev_priv(dev); |
1892 | struct sky2_hw *hw = sky2->hw; | 1894 | struct sky2_hw *hw = sky2->hw; |
1895 | unsigned port = sky2->port; | ||
1893 | int err; | 1896 | int err; |
1894 | u16 ctl, mode; | 1897 | u16 ctl, mode; |
1895 | u32 imask; | 1898 | u32 imask; |
@@ -1897,9 +1900,8 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
1897 | if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) | 1900 | if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) |
1898 | return -EINVAL; | 1901 | return -EINVAL; |
1899 | 1902 | ||
1900 | /* TSO on Yukon Ultra and MTU > 1500 not supported */ | 1903 | if (new_mtu > ETH_DATA_LEN && hw->chip_id == CHIP_ID_YUKON_FE) |
1901 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && new_mtu > ETH_DATA_LEN) | 1904 | return -EINVAL; |
1902 | dev->features &= ~NETIF_F_TSO; | ||
1903 | 1905 | ||
1904 | if (!netif_running(dev)) { | 1906 | if (!netif_running(dev)) { |
1905 | dev->mtu = new_mtu; | 1907 | dev->mtu = new_mtu; |
@@ -1915,8 +1917,18 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
1915 | 1917 | ||
1916 | synchronize_irq(hw->pdev->irq); | 1918 | synchronize_irq(hw->pdev->irq); |
1917 | 1919 | ||
1918 | ctl = gma_read16(hw, sky2->port, GM_GP_CTRL); | 1920 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) { |
1919 | gma_write16(hw, sky2->port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA); | 1921 | if (new_mtu > ETH_DATA_LEN) { |
1922 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
1923 | TX_JUMBO_ENA | TX_STFW_DIS); | ||
1924 | dev->features &= NETIF_F_TSO | NETIF_F_SG | NETIF_F_IP_CSUM; | ||
1925 | } else | ||
1926 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
1927 | TX_JUMBO_DIS | TX_STFW_ENA); | ||
1928 | } | ||
1929 | |||
1930 | ctl = gma_read16(hw, port, GM_GP_CTRL); | ||
1931 | gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA); | ||
1920 | sky2_rx_stop(sky2); | 1932 | sky2_rx_stop(sky2); |
1921 | sky2_rx_clean(sky2); | 1933 | sky2_rx_clean(sky2); |
1922 | 1934 | ||
@@ -1928,9 +1940,9 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
1928 | if (dev->mtu > ETH_DATA_LEN) | 1940 | if (dev->mtu > ETH_DATA_LEN) |
1929 | mode |= GM_SMOD_JUMBO_ENA; | 1941 | mode |= GM_SMOD_JUMBO_ENA; |
1930 | 1942 | ||
1931 | gma_write16(hw, sky2->port, GM_SERIAL_MODE, mode); | 1943 | gma_write16(hw, port, GM_SERIAL_MODE, mode); |
1932 | 1944 | ||
1933 | sky2_write8(hw, RB_ADDR(rxqaddr[sky2->port], RB_CTRL), RB_ENA_OP_MD); | 1945 | sky2_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD); |
1934 | 1946 | ||
1935 | err = sky2_rx_start(sky2); | 1947 | err = sky2_rx_start(sky2); |
1936 | sky2_write32(hw, B0_IMSK, imask); | 1948 | sky2_write32(hw, B0_IMSK, imask); |
@@ -1938,7 +1950,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
1938 | if (err) | 1950 | if (err) |
1939 | dev_close(dev); | 1951 | dev_close(dev); |
1940 | else { | 1952 | else { |
1941 | gma_write16(hw, sky2->port, GM_GP_CTRL, ctl); | 1953 | gma_write16(hw, port, GM_GP_CTRL, ctl); |
1942 | 1954 | ||
1943 | netif_poll_enable(hw->dev[0]); | 1955 | netif_poll_enable(hw->dev[0]); |
1944 | netif_wake_queue(dev); | 1956 | netif_wake_queue(dev); |
@@ -1959,7 +1971,7 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2, | |||
1959 | skb_reserve(skb, 2); | 1971 | skb_reserve(skb, 2); |
1960 | pci_dma_sync_single_for_cpu(sky2->hw->pdev, re->data_addr, | 1972 | pci_dma_sync_single_for_cpu(sky2->hw->pdev, re->data_addr, |
1961 | length, PCI_DMA_FROMDEVICE); | 1973 | length, PCI_DMA_FROMDEVICE); |
1962 | memcpy(skb->data, re->skb->data, length); | 1974 | skb_copy_from_linear_data(re->skb, skb->data, length); |
1963 | skb->ip_summed = re->skb->ip_summed; | 1975 | skb->ip_summed = re->skb->ip_summed; |
1964 | skb->csum = re->skb->csum; | 1976 | skb->csum = re->skb->csum; |
1965 | pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, | 1977 | pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, |
@@ -2340,26 +2352,22 @@ static void sky2_mac_intr(struct sky2_hw *hw, unsigned port) | |||
2340 | } | 2352 | } |
2341 | } | 2353 | } |
2342 | 2354 | ||
2343 | /* This should never happen it is a fatal situation */ | 2355 | /* This should never happen it is a bug. */ |
2344 | static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port, | 2356 | static void sky2_le_error(struct sky2_hw *hw, unsigned port, |
2345 | const char *rxtx, u32 mask) | 2357 | u16 q, unsigned ring_size) |
2346 | { | 2358 | { |
2347 | struct net_device *dev = hw->dev[port]; | 2359 | struct net_device *dev = hw->dev[port]; |
2348 | struct sky2_port *sky2 = netdev_priv(dev); | 2360 | struct sky2_port *sky2 = netdev_priv(dev); |
2349 | u32 imask; | 2361 | unsigned idx; |
2350 | 2362 | const u64 *le = (q == Q_R1 || q == Q_R2) | |
2351 | printk(KERN_ERR PFX "%s: %s descriptor error (hardware problem)\n", | 2363 | ? (u64 *) sky2->rx_le : (u64 *) sky2->tx_le; |
2352 | dev ? dev->name : "<not registered>", rxtx); | ||
2353 | 2364 | ||
2354 | imask = sky2_read32(hw, B0_IMSK); | 2365 | idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX)); |
2355 | imask &= ~mask; | 2366 | printk(KERN_ERR PFX "%s: descriptor error q=%#x get=%u [%llx] put=%u\n", |
2356 | sky2_write32(hw, B0_IMSK, imask); | 2367 | dev->name, (unsigned) q, idx, (unsigned long long) le[idx], |
2368 | (unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX))); | ||
2357 | 2369 | ||
2358 | if (dev) { | 2370 | sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK); |
2359 | spin_lock(&sky2->phy_lock); | ||
2360 | sky2_link_down(sky2); | ||
2361 | spin_unlock(&sky2->phy_lock); | ||
2362 | } | ||
2363 | } | 2371 | } |
2364 | 2372 | ||
2365 | /* If idle then force a fake soft NAPI poll once a second | 2373 | /* If idle then force a fake soft NAPI poll once a second |
@@ -2383,23 +2391,15 @@ static void sky2_idle(unsigned long arg) | |||
2383 | mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout)); | 2391 | mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout)); |
2384 | } | 2392 | } |
2385 | 2393 | ||
2386 | 2394 | /* Hardware/software error handling */ | |
2387 | static int sky2_poll(struct net_device *dev0, int *budget) | 2395 | static void sky2_err_intr(struct sky2_hw *hw, u32 status) |
2388 | { | 2396 | { |
2389 | struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw; | 2397 | if (net_ratelimit()) |
2390 | int work_limit = min(dev0->quota, *budget); | 2398 | dev_warn(&hw->pdev->dev, "error interrupt status=%#x\n", status); |
2391 | int work_done = 0; | ||
2392 | u32 status = sky2_read32(hw, B0_Y2_SP_EISR); | ||
2393 | 2399 | ||
2394 | if (status & Y2_IS_HW_ERR) | 2400 | if (status & Y2_IS_HW_ERR) |
2395 | sky2_hw_intr(hw); | 2401 | sky2_hw_intr(hw); |
2396 | 2402 | ||
2397 | if (status & Y2_IS_IRQ_PHY1) | ||
2398 | sky2_phy_intr(hw, 0); | ||
2399 | |||
2400 | if (status & Y2_IS_IRQ_PHY2) | ||
2401 | sky2_phy_intr(hw, 1); | ||
2402 | |||
2403 | if (status & Y2_IS_IRQ_MAC1) | 2403 | if (status & Y2_IS_IRQ_MAC1) |
2404 | sky2_mac_intr(hw, 0); | 2404 | sky2_mac_intr(hw, 0); |
2405 | 2405 | ||
@@ -2407,16 +2407,33 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
2407 | sky2_mac_intr(hw, 1); | 2407 | sky2_mac_intr(hw, 1); |
2408 | 2408 | ||
2409 | if (status & Y2_IS_CHK_RX1) | 2409 | if (status & Y2_IS_CHK_RX1) |
2410 | sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1); | 2410 | sky2_le_error(hw, 0, Q_R1, RX_LE_SIZE); |
2411 | 2411 | ||
2412 | if (status & Y2_IS_CHK_RX2) | 2412 | if (status & Y2_IS_CHK_RX2) |
2413 | sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2); | 2413 | sky2_le_error(hw, 1, Q_R2, RX_LE_SIZE); |
2414 | 2414 | ||
2415 | if (status & Y2_IS_CHK_TXA1) | 2415 | if (status & Y2_IS_CHK_TXA1) |
2416 | sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1); | 2416 | sky2_le_error(hw, 0, Q_XA1, TX_RING_SIZE); |
2417 | 2417 | ||
2418 | if (status & Y2_IS_CHK_TXA2) | 2418 | if (status & Y2_IS_CHK_TXA2) |
2419 | sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); | 2419 | sky2_le_error(hw, 1, Q_XA2, TX_RING_SIZE); |
2420 | } | ||
2421 | |||
2422 | static int sky2_poll(struct net_device *dev0, int *budget) | ||
2423 | { | ||
2424 | struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw; | ||
2425 | int work_limit = min(dev0->quota, *budget); | ||
2426 | int work_done = 0; | ||
2427 | u32 status = sky2_read32(hw, B0_Y2_SP_EISR); | ||
2428 | |||
2429 | if (unlikely(status & Y2_IS_ERROR)) | ||
2430 | sky2_err_intr(hw, status); | ||
2431 | |||
2432 | if (status & Y2_IS_IRQ_PHY1) | ||
2433 | sky2_phy_intr(hw, 0); | ||
2434 | |||
2435 | if (status & Y2_IS_IRQ_PHY2) | ||
2436 | sky2_phy_intr(hw, 1); | ||
2420 | 2437 | ||
2421 | work_done = sky2_status_intr(hw, work_limit); | 2438 | work_done = sky2_status_intr(hw, work_limit); |
2422 | if (work_done < work_limit) { | 2439 | if (work_done < work_limit) { |
@@ -2534,16 +2551,14 @@ static void sky2_reset(struct sky2_hw *hw) | |||
2534 | int i; | 2551 | int i; |
2535 | 2552 | ||
2536 | /* disable ASF */ | 2553 | /* disable ASF */ |
2537 | if (hw->chip_id <= CHIP_ID_YUKON_EC) { | 2554 | if (hw->chip_id == CHIP_ID_YUKON_EX) { |
2538 | if (hw->chip_id == CHIP_ID_YUKON_EX) { | 2555 | status = sky2_read16(hw, HCU_CCSR); |
2539 | status = sky2_read16(hw, HCU_CCSR); | 2556 | status &= ~(HCU_CCSR_AHB_RST | HCU_CCSR_CPU_RST_MODE | |
2540 | status &= ~(HCU_CCSR_AHB_RST | HCU_CCSR_CPU_RST_MODE | | 2557 | HCU_CCSR_UC_STATE_MSK); |
2541 | HCU_CCSR_UC_STATE_MSK); | 2558 | sky2_write16(hw, HCU_CCSR, status); |
2542 | sky2_write16(hw, HCU_CCSR, status); | 2559 | } else |
2543 | } else | 2560 | sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET); |
2544 | sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET); | 2561 | sky2_write16(hw, B0_CTST, Y2_ASF_DISABLE); |
2545 | sky2_write16(hw, B0_CTST, Y2_ASF_DISABLE); | ||
2546 | } | ||
2547 | 2562 | ||
2548 | /* do a SW reset */ | 2563 | /* do a SW reset */ |
2549 | sky2_write8(hw, B0_CTST, CS_RST_SET); | 2564 | sky2_write8(hw, B0_CTST, CS_RST_SET); |
@@ -3328,6 +3343,36 @@ static void sky2_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
3328 | regs->len - B3_RI_WTO_R1); | 3343 | regs->len - B3_RI_WTO_R1); |
3329 | } | 3344 | } |
3330 | 3345 | ||
3346 | /* In order to do Jumbo packets on these chips, need to turn off the | ||
3347 | * transmit store/forward. Therefore checksum offload won't work. | ||
3348 | */ | ||
3349 | static int no_tx_offload(struct net_device *dev) | ||
3350 | { | ||
3351 | const struct sky2_port *sky2 = netdev_priv(dev); | ||
3352 | const struct sky2_hw *hw = sky2->hw; | ||
3353 | |||
3354 | return dev->mtu > ETH_DATA_LEN && | ||
3355 | (hw->chip_id == CHIP_ID_YUKON_EX | ||
3356 | || hw->chip_id == CHIP_ID_YUKON_EC_U); | ||
3357 | } | ||
3358 | |||
3359 | static int sky2_set_tx_csum(struct net_device *dev, u32 data) | ||
3360 | { | ||
3361 | if (data && no_tx_offload(dev)) | ||
3362 | return -EINVAL; | ||
3363 | |||
3364 | return ethtool_op_set_tx_csum(dev, data); | ||
3365 | } | ||
3366 | |||
3367 | |||
3368 | static int sky2_set_tso(struct net_device *dev, u32 data) | ||
3369 | { | ||
3370 | if (data && no_tx_offload(dev)) | ||
3371 | return -EINVAL; | ||
3372 | |||
3373 | return ethtool_op_set_tso(dev, data); | ||
3374 | } | ||
3375 | |||
3331 | static const struct ethtool_ops sky2_ethtool_ops = { | 3376 | static const struct ethtool_ops sky2_ethtool_ops = { |
3332 | .get_settings = sky2_get_settings, | 3377 | .get_settings = sky2_get_settings, |
3333 | .set_settings = sky2_set_settings, | 3378 | .set_settings = sky2_set_settings, |
@@ -3343,9 +3388,9 @@ static const struct ethtool_ops sky2_ethtool_ops = { | |||
3343 | .get_sg = ethtool_op_get_sg, | 3388 | .get_sg = ethtool_op_get_sg, |
3344 | .set_sg = ethtool_op_set_sg, | 3389 | .set_sg = ethtool_op_set_sg, |
3345 | .get_tx_csum = ethtool_op_get_tx_csum, | 3390 | .get_tx_csum = ethtool_op_get_tx_csum, |
3346 | .set_tx_csum = ethtool_op_set_tx_csum, | 3391 | .set_tx_csum = sky2_set_tx_csum, |
3347 | .get_tso = ethtool_op_get_tso, | 3392 | .get_tso = ethtool_op_get_tso, |
3348 | .set_tso = ethtool_op_set_tso, | 3393 | .set_tso = sky2_set_tso, |
3349 | .get_rx_csum = sky2_get_rx_csum, | 3394 | .get_rx_csum = sky2_get_rx_csum, |
3350 | .set_rx_csum = sky2_set_rx_csum, | 3395 | .set_rx_csum = sky2_set_rx_csum, |
3351 | .get_strings = sky2_get_strings, | 3396 | .get_strings = sky2_get_strings, |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index ac24bdc42976..5efb5afc45ba 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -288,6 +288,9 @@ enum { | |||
288 | | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1, | 288 | | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1, |
289 | Y2_IS_PORT_2 = Y2_IS_IRQ_PHY2 | Y2_IS_IRQ_MAC2 | 289 | Y2_IS_PORT_2 = Y2_IS_IRQ_PHY2 | Y2_IS_IRQ_MAC2 |
290 | | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2, | 290 | | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2, |
291 | Y2_IS_ERROR = Y2_IS_HW_ERR | | ||
292 | Y2_IS_IRQ_MAC1 | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1 | | ||
293 | Y2_IS_IRQ_MAC2 | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2, | ||
291 | }; | 294 | }; |
292 | 295 | ||
293 | /* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */ | 296 | /* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */ |
@@ -738,6 +741,11 @@ enum { | |||
738 | TX_GMF_RP = 0x0d70,/* 32 bit Tx GMAC FIFO Read Pointer */ | 741 | TX_GMF_RP = 0x0d70,/* 32 bit Tx GMAC FIFO Read Pointer */ |
739 | TX_GMF_RSTP = 0x0d74,/* 32 bit Tx GMAC FIFO Restart Pointer */ | 742 | TX_GMF_RSTP = 0x0d74,/* 32 bit Tx GMAC FIFO Restart Pointer */ |
740 | TX_GMF_RLEV = 0x0d78,/* 32 bit Tx GMAC FIFO Read Level */ | 743 | TX_GMF_RLEV = 0x0d78,/* 32 bit Tx GMAC FIFO Read Level */ |
744 | |||
745 | /* Threshold values for Yukon-EC Ultra and Extreme */ | ||
746 | ECU_AE_THR = 0x0070, /* Almost Empty Threshold */ | ||
747 | ECU_TXFF_LEV = 0x01a0, /* Tx BMU FIFO Level */ | ||
748 | ECU_JUMBO_WM = 0x0080, /* Jumbo Mode Watermark */ | ||
741 | }; | 749 | }; |
742 | 750 | ||
743 | /* Descriptor Poll Timer Registers */ | 751 | /* Descriptor Poll Timer Registers */ |
@@ -1631,6 +1639,9 @@ enum { | |||
1631 | TX_VLAN_TAG_ON = 1<<25,/* enable VLAN tagging */ | 1639 | TX_VLAN_TAG_ON = 1<<25,/* enable VLAN tagging */ |
1632 | TX_VLAN_TAG_OFF = 1<<24,/* disable VLAN tagging */ | 1640 | TX_VLAN_TAG_OFF = 1<<24,/* disable VLAN tagging */ |
1633 | 1641 | ||
1642 | TX_JUMBO_ENA = 1<<23,/* PCI Jumbo Mode enable (Yukon-EC Ultra) */ | ||
1643 | TX_JUMBO_DIS = 1<<22,/* PCI Jumbo Mode enable (Yukon-EC Ultra) */ | ||
1644 | |||
1634 | GMF_WSP_TST_ON = 1<<18,/* Write Shadow Pointer Test On */ | 1645 | GMF_WSP_TST_ON = 1<<18,/* Write Shadow Pointer Test On */ |
1635 | GMF_WSP_TST_OFF = 1<<17,/* Write Shadow Pointer Test Off */ | 1646 | GMF_WSP_TST_OFF = 1<<17,/* Write Shadow Pointer Test Off */ |
1636 | GMF_WSP_STEP = 1<<16,/* Write Shadow Pointer Step/Increment */ | 1647 | GMF_WSP_STEP = 1<<16,/* Write Shadow Pointer Step/Increment */ |
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 2f4b1de7a2b4..65bd20fac820 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
@@ -363,7 +363,7 @@ sl_bump(struct slip *sl) | |||
363 | } | 363 | } |
364 | skb->dev = sl->dev; | 364 | skb->dev = sl->dev; |
365 | memcpy(skb_put(skb,count), sl->rbuff, count); | 365 | memcpy(skb_put(skb,count), sl->rbuff, count); |
366 | skb->mac.raw=skb->data; | 366 | skb_reset_mac_header(skb); |
367 | skb->protocol=htons(ETH_P_IP); | 367 | skb->protocol=htons(ETH_P_IP); |
368 | netif_rx(skb); | 368 | netif_rx(skb); |
369 | sl->dev->last_rx = jiffies; | 369 | sl->dev->last_rx = jiffies; |
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index c95614131980..8a2109a913b6 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
@@ -502,7 +502,6 @@ static inline void smc911x_rcv(struct net_device *dev) | |||
502 | DBG(SMC_DEBUG_PKTS, "%s: Received packet\n", dev->name,); | 502 | DBG(SMC_DEBUG_PKTS, "%s: Received packet\n", dev->name,); |
503 | PRINT_PKT(data, ((pkt_len - 4) <= 64) ? pkt_len - 4 : 64); | 503 | PRINT_PKT(data, ((pkt_len - 4) <= 64) ? pkt_len - 4 : 64); |
504 | dev->last_rx = jiffies; | 504 | dev->last_rx = jiffies; |
505 | skb->dev = dev; | ||
506 | skb->protocol = eth_type_trans(skb, dev); | 505 | skb->protocol = eth_type_trans(skb, dev); |
507 | netif_rx(skb); | 506 | netif_rx(skb); |
508 | lp->stats.rx_packets++; | 507 | lp->stats.rx_packets++; |
@@ -1307,7 +1306,6 @@ smc911x_rx_dma_irq(int dma, void *data) | |||
1307 | lp->current_rx_skb = NULL; | 1306 | lp->current_rx_skb = NULL; |
1308 | PRINT_PKT(skb->data, skb->len); | 1307 | PRINT_PKT(skb->data, skb->len); |
1309 | dev->last_rx = jiffies; | 1308 | dev->last_rx = jiffies; |
1310 | skb->dev = dev; | ||
1311 | skb->protocol = eth_type_trans(skb, dev); | 1309 | skb->protocol = eth_type_trans(skb, dev); |
1312 | netif_rx(skb); | 1310 | netif_rx(skb); |
1313 | lp->stats.rx_packets++; | 1311 | lp->stats.rx_packets++; |
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c index bd6e84506c29..36c1ebadbf20 100644 --- a/drivers/net/smc9194.c +++ b/drivers/net/smc9194.c | |||
@@ -1262,7 +1262,6 @@ static void smc_rcv(struct net_device *dev) | |||
1262 | 1262 | ||
1263 | skb_reserve( skb, 2 ); /* 16 bit alignment */ | 1263 | skb_reserve( skb, 2 ); /* 16 bit alignment */ |
1264 | 1264 | ||
1265 | skb->dev = dev; | ||
1266 | data = skb_put( skb, packet_length); | 1265 | data = skb_put( skb, packet_length); |
1267 | 1266 | ||
1268 | #ifdef USE_32_BIT | 1267 | #ifdef USE_32_BIT |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 49f4b7712ebf..01cc3c742c38 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -568,7 +568,6 @@ static inline void smc_rcv(struct net_device *dev) | |||
568 | PRINT_PKT(data, packet_len - 4); | 568 | PRINT_PKT(data, packet_len - 4); |
569 | 569 | ||
570 | dev->last_rx = jiffies; | 570 | dev->last_rx = jiffies; |
571 | skb->dev = dev; | ||
572 | skb->protocol = eth_type_trans(skb, dev); | 571 | skb->protocol = eth_type_trans(skb, dev); |
573 | netif_rx(skb); | 572 | netif_rx(skb); |
574 | lp->stats.rx_packets++; | 573 | lp->stats.rx_packets++; |
diff --git a/drivers/net/sonic.c b/drivers/net/sonic.c index ed7aa0a5acca..c6320c719931 100644 --- a/drivers/net/sonic.c +++ b/drivers/net/sonic.c | |||
@@ -85,7 +85,6 @@ static int sonic_open(struct net_device *dev) | |||
85 | dev->name); | 85 | dev->name); |
86 | return -ENOMEM; | 86 | return -ENOMEM; |
87 | } | 87 | } |
88 | skb->dev = dev; | ||
89 | /* align IP header unless DMA requires otherwise */ | 88 | /* align IP header unless DMA requires otherwise */ |
90 | if (SONIC_BUS_SCALE(lp->dma_bitmode) == 2) | 89 | if (SONIC_BUS_SCALE(lp->dma_bitmode) == 2) |
91 | skb_reserve(skb, 2); | 90 | skb_reserve(skb, 2); |
@@ -451,7 +450,6 @@ static void sonic_rx(struct net_device *dev) | |||
451 | lp->stats.rx_dropped++; | 450 | lp->stats.rx_dropped++; |
452 | break; | 451 | break; |
453 | } | 452 | } |
454 | new_skb->dev = dev; | ||
455 | /* provide 16 byte IP header alignment unless DMA requires otherwise */ | 453 | /* provide 16 byte IP header alignment unless DMA requires otherwise */ |
456 | if(SONIC_BUS_SCALE(lp->dma_bitmode) == 2) | 454 | if(SONIC_BUS_SCALE(lp->dma_bitmode) == 2) |
457 | skb_reserve(new_skb, 2); | 455 | skb_reserve(new_skb, 2); |
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 3b91af89e4c7..230da14b1b68 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -719,8 +719,8 @@ spider_net_prepare_tx_descr(struct spider_net_card *card, | |||
719 | SPIDER_NET_DESCR_CARDOWNED | SPIDER_NET_DMAC_NOCS; | 719 | SPIDER_NET_DESCR_CARDOWNED | SPIDER_NET_DMAC_NOCS; |
720 | spin_unlock_irqrestore(&chain->lock, flags); | 720 | spin_unlock_irqrestore(&chain->lock, flags); |
721 | 721 | ||
722 | if (skb->protocol == htons(ETH_P_IP)) | 722 | if (skb->protocol == htons(ETH_P_IP) && skb->ip_summed == CHECKSUM_PARTIAL) |
723 | switch (skb->nh.iph->protocol) { | 723 | switch (ip_hdr(skb)->protocol) { |
724 | case IPPROTO_TCP: | 724 | case IPPROTO_TCP: |
725 | hwdescr->dmac_cmd_status |= SPIDER_NET_DMAC_TCP; | 725 | hwdescr->dmac_cmd_status |= SPIDER_NET_DMAC_TCP; |
726 | break; | 726 | break; |
@@ -990,7 +990,6 @@ spider_net_pass_skb_up(struct spider_net_descr *descr, | |||
990 | netdev = card->netdev; | 990 | netdev = card->netdev; |
991 | 991 | ||
992 | skb = descr->skb; | 992 | skb = descr->skb; |
993 | skb->dev = netdev; | ||
994 | skb_put(skb, hwdescr->valid_size); | 993 | skb_put(skb, hwdescr->valid_size); |
995 | 994 | ||
996 | /* the card seems to add 2 bytes of junk in front | 995 | /* the card seems to add 2 bytes of junk in front |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 8bba2e3da7e1..9d6e454a8f98 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -1452,7 +1452,6 @@ static int __netdev_rx(struct net_device *dev, int *quota) | |||
1452 | to a minimally-sized skbuff. */ | 1452 | to a minimally-sized skbuff. */ |
1453 | if (pkt_len < rx_copybreak | 1453 | if (pkt_len < rx_copybreak |
1454 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1454 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1455 | skb->dev = dev; | ||
1456 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1455 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1457 | pci_dma_sync_single_for_cpu(np->pci_dev, | 1456 | pci_dma_sync_single_for_cpu(np->pci_dev, |
1458 | np->rx_info[entry].mapping, | 1457 | np->rx_info[entry].mapping, |
diff --git a/drivers/net/sun3_82586.c b/drivers/net/sun3_82586.c index 4757aa647c7a..396c3d961f88 100644 --- a/drivers/net/sun3_82586.c +++ b/drivers/net/sun3_82586.c | |||
@@ -775,7 +775,6 @@ static void sun3_82586_rcv_int(struct net_device *dev) | |||
775 | skb = (struct sk_buff *) dev_alloc_skb(totlen+2); | 775 | skb = (struct sk_buff *) dev_alloc_skb(totlen+2); |
776 | if(skb != NULL) | 776 | if(skb != NULL) |
777 | { | 777 | { |
778 | skb->dev = dev; | ||
779 | skb_reserve(skb,2); | 778 | skb_reserve(skb,2); |
780 | skb_put(skb,totlen); | 779 | skb_put(skb,totlen); |
781 | eth_copy_and_sum(skb,(char *) p->base+swab32((unsigned long) rbd->buffer),totlen,0); | 780 | eth_copy_and_sum(skb,(char *) p->base+swab32((unsigned long) rbd->buffer),totlen,0); |
@@ -1027,7 +1026,7 @@ static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1027 | memset((char *)p->xmit_cbuffs[p->xmit_count], 0, ETH_ZLEN); | 1026 | memset((char *)p->xmit_cbuffs[p->xmit_count], 0, ETH_ZLEN); |
1028 | len = ETH_ZLEN; | 1027 | len = ETH_ZLEN; |
1029 | } | 1028 | } |
1030 | memcpy((char *)p->xmit_cbuffs[p->xmit_count],(char *)(skb->data),skb->len); | 1029 | skb_copy_from_linear_data(skb, p->xmit_cbuffs[p->xmit_count], skb->len); |
1031 | 1030 | ||
1032 | #if (NUM_XMIT_BUFFS == 1) | 1031 | #if (NUM_XMIT_BUFFS == 1) |
1033 | # ifdef NO_NOPCOMMANDS | 1032 | # ifdef NO_NOPCOMMANDS |
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index 7bee45b42a2c..791e081fdc15 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -629,7 +629,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) | |||
629 | head->length = (-len) | 0xf000; | 629 | head->length = (-len) | 0xf000; |
630 | head->misc = 0; | 630 | head->misc = 0; |
631 | 631 | ||
632 | memcpy( PKTBUF_ADDR(head), (void *)skb->data, skb->len ); | 632 | skb_copy_from_linear_data(skb, PKTBUF_ADDR(head), skb->len); |
633 | if (len != skb->len) | 633 | if (len != skb->len) |
634 | memset(PKTBUF_ADDR(head) + skb->len, 0, len-skb->len); | 634 | memset(PKTBUF_ADDR(head) + skb->len, 0, len-skb->len); |
635 | 635 | ||
@@ -851,10 +851,9 @@ static int lance_rx( struct net_device *dev ) | |||
851 | } | 851 | } |
852 | 852 | ||
853 | 853 | ||
854 | skb->dev = dev; | ||
855 | skb_reserve( skb, 2 ); /* 16 byte align */ | 854 | skb_reserve( skb, 2 ); /* 16 byte align */ |
856 | skb_put( skb, pkt_len ); /* Make room */ | 855 | skb_put( skb, pkt_len ); /* Make room */ |
857 | // memcpy( skb->data, PKTBUF_ADDR(head), pkt_len ); | 856 | // skb_copy_to_linear_data(skb, PKTBUF_ADDR(head), pkt_len); |
858 | eth_copy_and_sum(skb, | 857 | eth_copy_and_sum(skb, |
859 | PKTBUF_ADDR(head), | 858 | PKTBUF_ADDR(head), |
860 | pkt_len, 0); | 859 | pkt_len, 0); |
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c index 18f88853e1e5..2ad8d58dee3b 100644 --- a/drivers/net/sunbmac.c +++ b/drivers/net/sunbmac.c | |||
@@ -855,7 +855,6 @@ static void bigmac_rx(struct bigmac *bp) | |||
855 | drops++; | 855 | drops++; |
856 | goto drop_it; | 856 | goto drop_it; |
857 | } | 857 | } |
858 | copy_skb->dev = bp->dev; | ||
859 | skb_reserve(copy_skb, 2); | 858 | skb_reserve(copy_skb, 2); |
860 | skb_put(copy_skb, len); | 859 | skb_put(copy_skb, len); |
861 | sbus_dma_sync_single_for_cpu(bp->bigmac_sdev, | 860 | sbus_dma_sync_single_for_cpu(bp->bigmac_sdev, |
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index c06ecc8002b9..f51ba31970aa 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -1308,7 +1308,6 @@ static void rx_poll(unsigned long data) | |||
1308 | to a minimally-sized skbuff. */ | 1308 | to a minimally-sized skbuff. */ |
1309 | if (pkt_len < rx_copybreak | 1309 | if (pkt_len < rx_copybreak |
1310 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1310 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1311 | skb->dev = dev; | ||
1312 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1311 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1313 | pci_dma_sync_single_for_cpu(np->pci_dev, | 1312 | pci_dma_sync_single_for_cpu(np->pci_dev, |
1314 | desc->frag[0].addr, | 1313 | desc->frag[0].addr, |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 08ea61db46fe..5da73212ac91 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -64,11 +64,9 @@ | |||
64 | #include <asm/uaccess.h> | 64 | #include <asm/uaccess.h> |
65 | #include <asm/irq.h> | 65 | #include <asm/irq.h> |
66 | 66 | ||
67 | #ifdef __sparc__ | 67 | #ifdef CONFIG_SPARC |
68 | #include <asm/idprom.h> | 68 | #include <asm/idprom.h> |
69 | #include <asm/openprom.h> | 69 | #include <asm/prom.h> |
70 | #include <asm/oplib.h> | ||
71 | #include <asm/pbm.h> | ||
72 | #endif | 70 | #endif |
73 | 71 | ||
74 | #ifdef CONFIG_PPC_PMAC | 72 | #ifdef CONFIG_PPC_PMAC |
@@ -845,11 +843,10 @@ static int gem_rx(struct gem *gp, int work_to_do) | |||
845 | goto drop_it; | 843 | goto drop_it; |
846 | } | 844 | } |
847 | 845 | ||
848 | copy_skb->dev = gp->dev; | ||
849 | skb_reserve(copy_skb, 2); | 846 | skb_reserve(copy_skb, 2); |
850 | skb_put(copy_skb, len); | 847 | skb_put(copy_skb, len); |
851 | pci_dma_sync_single_for_cpu(gp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); | 848 | pci_dma_sync_single_for_cpu(gp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); |
852 | memcpy(copy_skb->data, skb->data, len); | 849 | skb_copy_from_linear_data(skb, copy_skb->data, len); |
853 | pci_dma_sync_single_for_device(gp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); | 850 | pci_dma_sync_single_for_device(gp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); |
854 | 851 | ||
855 | /* We'll reuse the original ring buffer. */ | 852 | /* We'll reuse the original ring buffer. */ |
@@ -1029,10 +1026,8 @@ static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1029 | 1026 | ||
1030 | ctrl = 0; | 1027 | ctrl = 0; |
1031 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1028 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1032 | u64 csum_start_off, csum_stuff_off; | 1029 | const u64 csum_start_off = skb_transport_offset(skb); |
1033 | 1030 | const u64 csum_stuff_off = csum_start_off + skb->csum_offset; | |
1034 | csum_start_off = (u64) (skb->h.raw - skb->data); | ||
1035 | csum_stuff_off = csum_start_off + skb->csum_offset; | ||
1036 | 1031 | ||
1037 | ctrl = (TXDCTRL_CENAB | | 1032 | ctrl = (TXDCTRL_CENAB | |
1038 | (csum_start_off << 15) | | 1033 | (csum_start_off << 15) | |
@@ -2849,7 +2844,7 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2849 | return rc; | 2844 | return rc; |
2850 | } | 2845 | } |
2851 | 2846 | ||
2852 | #if (!defined(__sparc__) && !defined(CONFIG_PPC_PMAC)) | 2847 | #if (!defined(CONFIG_SPARC) && !defined(CONFIG_PPC_PMAC)) |
2853 | /* Fetch MAC address from vital product data of PCI ROM. */ | 2848 | /* Fetch MAC address from vital product data of PCI ROM. */ |
2854 | static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr) | 2849 | static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr) |
2855 | { | 2850 | { |
@@ -2904,36 +2899,19 @@ static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr) | |||
2904 | 2899 | ||
2905 | static int __devinit gem_get_device_address(struct gem *gp) | 2900 | static int __devinit gem_get_device_address(struct gem *gp) |
2906 | { | 2901 | { |
2907 | #if defined(__sparc__) || defined(CONFIG_PPC_PMAC) | 2902 | #if defined(CONFIG_SPARC) || defined(CONFIG_PPC_PMAC) |
2908 | struct net_device *dev = gp->dev; | 2903 | struct net_device *dev = gp->dev; |
2909 | #endif | ||
2910 | |||
2911 | #if defined(__sparc__) | ||
2912 | struct pci_dev *pdev = gp->pdev; | ||
2913 | struct pcidev_cookie *pcp = pdev->sysdata; | ||
2914 | int use_idprom = 1; | ||
2915 | |||
2916 | if (pcp != NULL) { | ||
2917 | unsigned char *addr; | ||
2918 | int len; | ||
2919 | |||
2920 | addr = of_get_property(pcp->prom_node, "local-mac-address", | ||
2921 | &len); | ||
2922 | if (addr && len == 6) { | ||
2923 | use_idprom = 0; | ||
2924 | memcpy(dev->dev_addr, addr, 6); | ||
2925 | } | ||
2926 | } | ||
2927 | if (use_idprom) | ||
2928 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); | ||
2929 | #elif defined(CONFIG_PPC_PMAC) | ||
2930 | const unsigned char *addr; | 2904 | const unsigned char *addr; |
2931 | 2905 | ||
2932 | addr = get_property(gp->of_node, "local-mac-address", NULL); | 2906 | addr = get_property(gp->of_node, "local-mac-address", NULL); |
2933 | if (addr == NULL) { | 2907 | if (addr == NULL) { |
2908 | #ifdef CONFIG_SPARC | ||
2909 | addr = idprom->id_ethaddr; | ||
2910 | #else | ||
2934 | printk("\n"); | 2911 | printk("\n"); |
2935 | printk(KERN_ERR "%s: can't get mac-address\n", dev->name); | 2912 | printk(KERN_ERR "%s: can't get mac-address\n", dev->name); |
2936 | return -1; | 2913 | return -1; |
2914 | #endif | ||
2937 | } | 2915 | } |
2938 | memcpy(dev->dev_addr, addr, 6); | 2916 | memcpy(dev->dev_addr, addr, 6); |
2939 | #else | 2917 | #else |
@@ -3091,7 +3069,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev, | |||
3091 | /* On Apple, we want a reference to the Open Firmware device-tree | 3069 | /* On Apple, we want a reference to the Open Firmware device-tree |
3092 | * node. We use it for clock control. | 3070 | * node. We use it for clock control. |
3093 | */ | 3071 | */ |
3094 | #ifdef CONFIG_PPC_PMAC | 3072 | #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC) |
3095 | gp->of_node = pci_device_to_OF_node(pdev); | 3073 | gp->of_node = pci_device_to_OF_node(pdev); |
3096 | #endif | 3074 | #endif |
3097 | 3075 | ||
diff --git a/drivers/net/sungem.h b/drivers/net/sungem.h index a70067c85cc9..58cf87c5751e 100644 --- a/drivers/net/sungem.h +++ b/drivers/net/sungem.h | |||
@@ -1025,7 +1025,7 @@ struct gem { | |||
1025 | 1025 | ||
1026 | struct pci_dev *pdev; | 1026 | struct pci_dev *pdev; |
1027 | struct net_device *dev; | 1027 | struct net_device *dev; |
1028 | #ifdef CONFIG_PPC_PMAC | 1028 | #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC) |
1029 | struct device_node *of_node; | 1029 | struct device_node *of_node; |
1030 | #endif | 1030 | #endif |
1031 | }; | 1031 | }; |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index ef671739cfea..51c3fe2108a3 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
@@ -55,9 +55,6 @@ | |||
55 | 55 | ||
56 | #ifdef CONFIG_PCI | 56 | #ifdef CONFIG_PCI |
57 | #include <linux/pci.h> | 57 | #include <linux/pci.h> |
58 | #ifdef CONFIG_SPARC | ||
59 | #include <asm/pbm.h> | ||
60 | #endif | ||
61 | #endif | 58 | #endif |
62 | 59 | ||
63 | #include "sunhme.h" | 60 | #include "sunhme.h" |
@@ -2058,11 +2055,10 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) | |||
2058 | goto drop_it; | 2055 | goto drop_it; |
2059 | } | 2056 | } |
2060 | 2057 | ||
2061 | copy_skb->dev = dev; | ||
2062 | skb_reserve(copy_skb, 2); | 2058 | skb_reserve(copy_skb, 2); |
2063 | skb_put(copy_skb, len); | 2059 | skb_put(copy_skb, len); |
2064 | hme_dma_sync_for_cpu(hp, dma_addr, len, DMA_FROMDEVICE); | 2060 | hme_dma_sync_for_cpu(hp, dma_addr, len, DMA_FROMDEVICE); |
2065 | memcpy(copy_skb->data, skb->data, len); | 2061 | skb_copy_from_linear_data(skb, copy_skb->data, len); |
2066 | hme_dma_sync_for_device(hp, dma_addr, len, DMA_FROMDEVICE); | 2062 | hme_dma_sync_for_device(hp, dma_addr, len, DMA_FROMDEVICE); |
2067 | 2063 | ||
2068 | /* Reuse original ring buffer. */ | 2064 | /* Reuse original ring buffer. */ |
@@ -2270,10 +2266,8 @@ static int happy_meal_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2270 | 2266 | ||
2271 | tx_flags = TXFLAG_OWN; | 2267 | tx_flags = TXFLAG_OWN; |
2272 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2268 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2273 | u32 csum_start_off, csum_stuff_off; | 2269 | const u32 csum_start_off = skb_transport_offset(skb); |
2274 | 2270 | const u32 csum_stuff_off = csum_start_off + skb->csum_offset; | |
2275 | csum_start_off = (u32) (skb->h.raw - skb->data); | ||
2276 | csum_stuff_off = csum_start_off + skb->csum_offset; | ||
2277 | 2271 | ||
2278 | tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE | | 2272 | tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE | |
2279 | ((csum_start_off << 14) & TXFLAG_CSBUFBEGIN) | | 2273 | ((csum_start_off << 14) & TXFLAG_CSBUFBEGIN) | |
@@ -2704,7 +2698,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe | |||
2704 | dev->dev_addr[i] = macaddr[i]; | 2698 | dev->dev_addr[i] = macaddr[i]; |
2705 | macaddr[5]++; | 2699 | macaddr[5]++; |
2706 | } else { | 2700 | } else { |
2707 | unsigned char *addr; | 2701 | const unsigned char *addr; |
2708 | int len; | 2702 | int len; |
2709 | 2703 | ||
2710 | addr = of_get_property(dp, "local-mac-address", &len); | 2704 | addr = of_get_property(dp, "local-mac-address", &len); |
@@ -2986,7 +2980,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev, | |||
2986 | { | 2980 | { |
2987 | struct quattro *qp = NULL; | 2981 | struct quattro *qp = NULL; |
2988 | #ifdef CONFIG_SPARC | 2982 | #ifdef CONFIG_SPARC |
2989 | struct pcidev_cookie *pcp; | 2983 | struct device_node *dp; |
2990 | #endif | 2984 | #endif |
2991 | struct happy_meal *hp; | 2985 | struct happy_meal *hp; |
2992 | struct net_device *dev; | 2986 | struct net_device *dev; |
@@ -2998,13 +2992,8 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev, | |||
2998 | 2992 | ||
2999 | /* Now make sure pci_dev cookie is there. */ | 2993 | /* Now make sure pci_dev cookie is there. */ |
3000 | #ifdef CONFIG_SPARC | 2994 | #ifdef CONFIG_SPARC |
3001 | pcp = pdev->sysdata; | 2995 | dp = pci_device_to_OF_node(pdev); |
3002 | if (pcp == NULL) { | 2996 | strcpy(prom_name, dp->name); |
3003 | printk(KERN_ERR "happymeal(PCI): Some PCI device info missing\n"); | ||
3004 | return -ENODEV; | ||
3005 | } | ||
3006 | |||
3007 | strcpy(prom_name, pcp->prom_node->name); | ||
3008 | #else | 2997 | #else |
3009 | if (is_quattro_p(pdev)) | 2998 | if (is_quattro_p(pdev)) |
3010 | strcpy(prom_name, "SUNW,qfe"); | 2999 | strcpy(prom_name, "SUNW,qfe"); |
@@ -3081,11 +3070,11 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev, | |||
3081 | macaddr[5]++; | 3070 | macaddr[5]++; |
3082 | } else { | 3071 | } else { |
3083 | #ifdef CONFIG_SPARC | 3072 | #ifdef CONFIG_SPARC |
3084 | unsigned char *addr; | 3073 | const unsigned char *addr; |
3085 | int len; | 3074 | int len; |
3086 | 3075 | ||
3087 | if (qfe_slot != -1 && | 3076 | if (qfe_slot != -1 && |
3088 | (addr = of_get_property(pcp->prom_node, | 3077 | (addr = of_get_property(dp, |
3089 | "local-mac-address", &len)) != NULL | 3078 | "local-mac-address", &len)) != NULL |
3090 | && len == 6) { | 3079 | && len == 6) { |
3091 | memcpy(dev->dev_addr, addr, 6); | 3080 | memcpy(dev->dev_addr, addr, 6); |
@@ -3105,7 +3094,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev, | |||
3105 | hp->tcvregs = (hpreg_base + 0x7000UL); | 3094 | hp->tcvregs = (hpreg_base + 0x7000UL); |
3106 | 3095 | ||
3107 | #ifdef CONFIG_SPARC | 3096 | #ifdef CONFIG_SPARC |
3108 | hp->hm_revision = of_getintprop_default(pcp->prom_node, "hm-rev", 0xff); | 3097 | hp->hm_revision = of_getintprop_default(dp, "hm-rev", 0xff); |
3109 | if (hp->hm_revision == 0xff) { | 3098 | if (hp->hm_revision == 0xff) { |
3110 | unsigned char prev; | 3099 | unsigned char prev; |
3111 | 3100 | ||
@@ -3300,7 +3289,7 @@ static int __devinit hme_sbus_probe(struct of_device *dev, const struct of_devic | |||
3300 | { | 3289 | { |
3301 | struct sbus_dev *sdev = to_sbus_device(&dev->dev); | 3290 | struct sbus_dev *sdev = to_sbus_device(&dev->dev); |
3302 | struct device_node *dp = dev->node; | 3291 | struct device_node *dp = dev->node; |
3303 | char *model = of_get_property(dp, "model", NULL); | 3292 | const char *model = of_get_property(dp, "model", NULL); |
3304 | int is_qfe = (match->data != NULL); | 3293 | int is_qfe = (match->data != NULL); |
3305 | 3294 | ||
3306 | if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe")) | 3295 | if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe")) |
@@ -3314,7 +3303,7 @@ static int __devexit hme_sbus_remove(struct of_device *dev) | |||
3314 | struct happy_meal *hp = dev_get_drvdata(&dev->dev); | 3303 | struct happy_meal *hp = dev_get_drvdata(&dev->dev); |
3315 | struct net_device *net_dev = hp->dev; | 3304 | struct net_device *net_dev = hp->dev; |
3316 | 3305 | ||
3317 | unregister_netdevice(net_dev); | 3306 | unregister_netdev(net_dev); |
3318 | 3307 | ||
3319 | /* XXX qfe parent interrupt... */ | 3308 | /* XXX qfe parent interrupt... */ |
3320 | 3309 | ||
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c index 5b00d79b5573..42722530ab24 100644 --- a/drivers/net/sunlance.c +++ b/drivers/net/sunlance.c | |||
@@ -547,7 +547,6 @@ static void lance_rx_dvma(struct net_device *dev) | |||
547 | 547 | ||
548 | lp->stats.rx_bytes += len; | 548 | lp->stats.rx_bytes += len; |
549 | 549 | ||
550 | skb->dev = dev; | ||
551 | skb_reserve(skb, 2); /* 16 byte align */ | 550 | skb_reserve(skb, 2); /* 16 byte align */ |
552 | skb_put(skb, len); /* make room */ | 551 | skb_put(skb, len); /* make room */ |
553 | eth_copy_and_sum(skb, | 552 | eth_copy_and_sum(skb, |
@@ -721,7 +720,6 @@ static void lance_rx_pio(struct net_device *dev) | |||
721 | 720 | ||
722 | lp->stats.rx_bytes += len; | 721 | lp->stats.rx_bytes += len; |
723 | 722 | ||
724 | skb->dev = dev; | ||
725 | skb_reserve (skb, 2); /* 16 byte align */ | 723 | skb_reserve (skb, 2); /* 16 byte align */ |
726 | skb_put(skb, len); /* make room */ | 724 | skb_put(skb, len); /* make room */ |
727 | lance_piocopy_to_skb(skb, &(ib->rx_buf[entry][0]), len); | 725 | lance_piocopy_to_skb(skb, &(ib->rx_buf[entry][0]), len); |
@@ -1145,7 +1143,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1145 | struct lance_init_block *ib = lp->init_block_mem; | 1143 | struct lance_init_block *ib = lp->init_block_mem; |
1146 | ib->btx_ring [entry].length = (-len) | 0xf000; | 1144 | ib->btx_ring [entry].length = (-len) | 0xf000; |
1147 | ib->btx_ring [entry].misc = 0; | 1145 | ib->btx_ring [entry].misc = 0; |
1148 | memcpy((char *)&ib->tx_buf [entry][0], skb->data, skblen); | 1146 | skb_copy_from_linear_data(skb, &ib->tx_buf [entry][0], skblen); |
1149 | if (len != skblen) | 1147 | if (len != skblen) |
1150 | memset((char *) &ib->tx_buf [entry][skblen], 0, len - skblen); | 1148 | memset((char *) &ib->tx_buf [entry][skblen], 0, len - skblen); |
1151 | ib->btx_ring [entry].tmd1_bits = (LE_T1_POK | LE_T1_OWN); | 1149 | ib->btx_ring [entry].tmd1_bits = (LE_T1_POK | LE_T1_OWN); |
@@ -1550,7 +1548,7 @@ static int __exit sunlance_sun4_remove(void) | |||
1550 | struct lance_private *lp = dev_get_drvdata(&sun4_sdev.ofdev.dev); | 1548 | struct lance_private *lp = dev_get_drvdata(&sun4_sdev.ofdev.dev); |
1551 | struct net_device *net_dev = lp->dev; | 1549 | struct net_device *net_dev = lp->dev; |
1552 | 1550 | ||
1553 | unregister_netdevice(net_dev); | 1551 | unregister_netdev(net_dev); |
1554 | 1552 | ||
1555 | lance_free_hwresources(lp); | 1553 | lance_free_hwresources(lp); |
1556 | 1554 | ||
@@ -1590,7 +1588,7 @@ static int __devexit sunlance_sbus_remove(struct of_device *dev) | |||
1590 | struct lance_private *lp = dev_get_drvdata(&dev->dev); | 1588 | struct lance_private *lp = dev_get_drvdata(&dev->dev); |
1591 | struct net_device *net_dev = lp->dev; | 1589 | struct net_device *net_dev = lp->dev; |
1592 | 1590 | ||
1593 | unregister_netdevice(net_dev); | 1591 | unregister_netdev(net_dev); |
1594 | 1592 | ||
1595 | lance_free_hwresources(lp); | 1593 | lance_free_hwresources(lp); |
1596 | 1594 | ||
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c index 7874eb1ef043..fa70e0b78af7 100644 --- a/drivers/net/sunqe.c +++ b/drivers/net/sunqe.c | |||
@@ -437,7 +437,6 @@ static void qe_rx(struct sunqe *qep) | |||
437 | drops++; | 437 | drops++; |
438 | qep->net_stats.rx_dropped++; | 438 | qep->net_stats.rx_dropped++; |
439 | } else { | 439 | } else { |
440 | skb->dev = qep->dev; | ||
441 | skb_reserve(skb, 2); | 440 | skb_reserve(skb, 2); |
442 | skb_put(skb, len); | 441 | skb_put(skb, len); |
443 | eth_copy_and_sum(skb, (unsigned char *) this_qbuf, | 442 | eth_copy_and_sum(skb, (unsigned char *) this_qbuf, |
@@ -593,7 +592,7 @@ static int qe_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
593 | /* Avoid a race... */ | 592 | /* Avoid a race... */ |
594 | qep->qe_block->qe_txd[entry].tx_flags = TXD_UPDATE; | 593 | qep->qe_block->qe_txd[entry].tx_flags = TXD_UPDATE; |
595 | 594 | ||
596 | memcpy(txbuf, skb->data, len); | 595 | skb_copy_from_linear_data(skb, txbuf, len); |
597 | 596 | ||
598 | qep->qe_block->qe_txd[entry].tx_addr = txbuf_dvma; | 597 | qep->qe_block->qe_txd[entry].tx_addr = txbuf_dvma; |
599 | qep->qe_block->qe_txd[entry].tx_flags = | 598 | qep->qe_block->qe_txd[entry].tx_flags = |
@@ -845,6 +844,8 @@ static int __init qec_ether_init(struct sbus_dev *sdev) | |||
845 | if (!dev) | 844 | if (!dev) |
846 | return -ENOMEM; | 845 | return -ENOMEM; |
847 | 846 | ||
847 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); | ||
848 | |||
848 | qe = netdev_priv(dev); | 849 | qe = netdev_priv(dev); |
849 | 850 | ||
850 | i = of_getintprop_default(sdev->ofdev.node, "channel#", -1); | 851 | i = of_getintprop_default(sdev->ofdev.node, "channel#", -1); |
@@ -960,7 +961,7 @@ static int __devexit qec_sbus_remove(struct of_device *dev) | |||
960 | struct sunqe *qp = dev_get_drvdata(&dev->dev); | 961 | struct sunqe *qp = dev_get_drvdata(&dev->dev); |
961 | struct net_device *net_dev = qp->dev; | 962 | struct net_device *net_dev = qp->dev; |
962 | 963 | ||
963 | unregister_netdevice(net_dev); | 964 | unregister_netdev(net_dev); |
964 | 965 | ||
965 | sbus_iounmap(qp->qcregs, CREG_REG_SIZE); | 966 | sbus_iounmap(qp->qcregs, CREG_REG_SIZE); |
966 | sbus_iounmap(qp->mregs, MREGS_REG_SIZE); | 967 | sbus_iounmap(qp->mregs, MREGS_REG_SIZE); |
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index e3a7e3ceab77..d7741e23f8de 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -1145,7 +1145,6 @@ tc35815_rx(struct net_device *dev) | |||
1145 | break; | 1145 | break; |
1146 | } | 1146 | } |
1147 | skb_reserve(skb, 2); /* 16 bit alignment */ | 1147 | skb_reserve(skb, 2); /* 16 bit alignment */ |
1148 | skb->dev = dev; | ||
1149 | 1148 | ||
1150 | data = skb_put(skb, pkt_len); | 1149 | data = skb_put(skb, pkt_len); |
1151 | 1150 | ||
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 256969e1300c..9488f49ea569 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -40,16 +40,16 @@ | |||
40 | #include <linux/dma-mapping.h> | 40 | #include <linux/dma-mapping.h> |
41 | 41 | ||
42 | #include <net/checksum.h> | 42 | #include <net/checksum.h> |
43 | #include <net/ip.h> | ||
43 | 44 | ||
44 | #include <asm/system.h> | 45 | #include <asm/system.h> |
45 | #include <asm/io.h> | 46 | #include <asm/io.h> |
46 | #include <asm/byteorder.h> | 47 | #include <asm/byteorder.h> |
47 | #include <asm/uaccess.h> | 48 | #include <asm/uaccess.h> |
48 | 49 | ||
49 | #ifdef CONFIG_SPARC64 | 50 | #ifdef CONFIG_SPARC |
50 | #include <asm/idprom.h> | 51 | #include <asm/idprom.h> |
51 | #include <asm/oplib.h> | 52 | #include <asm/prom.h> |
52 | #include <asm/pbm.h> | ||
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 55 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
@@ -3349,7 +3349,7 @@ static int tg3_rx(struct tg3 *tp, int budget) | |||
3349 | skb_reserve(copy_skb, 2); | 3349 | skb_reserve(copy_skb, 2); |
3350 | skb_put(copy_skb, len); | 3350 | skb_put(copy_skb, len); |
3351 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); | 3351 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); |
3352 | memcpy(copy_skb->data, skb->data, len); | 3352 | skb_copy_from_linear_data(skb, copy_skb->data, len); |
3353 | pci_dma_sync_single_for_device(tp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); | 3353 | pci_dma_sync_single_for_device(tp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); |
3354 | 3354 | ||
3355 | /* We'll reuse the original ring buffer. */ | 3355 | /* We'll reuse the original ring buffer. */ |
@@ -3908,20 +3908,20 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3908 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) | 3908 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) |
3909 | mss |= (skb_headlen(skb) - ETH_HLEN) << 9; | 3909 | mss |= (skb_headlen(skb) - ETH_HLEN) << 9; |
3910 | else { | 3910 | else { |
3911 | tcp_opt_len = ((skb->h.th->doff - 5) * 4); | 3911 | struct iphdr *iph = ip_hdr(skb); |
3912 | ip_tcp_len = (skb->nh.iph->ihl * 4) + | 3912 | |
3913 | sizeof(struct tcphdr); | 3913 | tcp_opt_len = tcp_optlen(skb); |
3914 | ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); | ||
3914 | 3915 | ||
3915 | skb->nh.iph->check = 0; | 3916 | iph->check = 0; |
3916 | skb->nh.iph->tot_len = htons(mss + ip_tcp_len + | 3917 | iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); |
3917 | tcp_opt_len); | ||
3918 | mss |= (ip_tcp_len + tcp_opt_len) << 9; | 3918 | mss |= (ip_tcp_len + tcp_opt_len) << 9; |
3919 | } | 3919 | } |
3920 | 3920 | ||
3921 | base_flags |= (TXD_FLAG_CPU_PRE_DMA | | 3921 | base_flags |= (TXD_FLAG_CPU_PRE_DMA | |
3922 | TXD_FLAG_CPU_POST_DMA); | 3922 | TXD_FLAG_CPU_POST_DMA); |
3923 | 3923 | ||
3924 | skb->h.th->check = 0; | 3924 | tcp_hdr(skb)->check = 0; |
3925 | 3925 | ||
3926 | } | 3926 | } |
3927 | else if (skb->ip_summed == CHECKSUM_PARTIAL) | 3927 | else if (skb->ip_summed == CHECKSUM_PARTIAL) |
@@ -4055,6 +4055,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
4055 | mss = 0; | 4055 | mss = 0; |
4056 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && | 4056 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && |
4057 | (mss = skb_shinfo(skb)->gso_size) != 0) { | 4057 | (mss = skb_shinfo(skb)->gso_size) != 0) { |
4058 | struct iphdr *iph; | ||
4058 | int tcp_opt_len, ip_tcp_len, hdr_len; | 4059 | int tcp_opt_len, ip_tcp_len, hdr_len; |
4059 | 4060 | ||
4060 | if (skb_header_cloned(skb) && | 4061 | if (skb_header_cloned(skb) && |
@@ -4063,8 +4064,8 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
4063 | goto out_unlock; | 4064 | goto out_unlock; |
4064 | } | 4065 | } |
4065 | 4066 | ||
4066 | tcp_opt_len = ((skb->h.th->doff - 5) * 4); | 4067 | tcp_opt_len = tcp_optlen(skb); |
4067 | ip_tcp_len = (skb->nh.iph->ihl * 4) + sizeof(struct tcphdr); | 4068 | ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); |
4068 | 4069 | ||
4069 | hdr_len = ip_tcp_len + tcp_opt_len; | 4070 | hdr_len = ip_tcp_len + tcp_opt_len; |
4070 | if (unlikely((ETH_HLEN + hdr_len) > 80) && | 4071 | if (unlikely((ETH_HLEN + hdr_len) > 80) && |
@@ -4074,34 +4075,31 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
4074 | base_flags |= (TXD_FLAG_CPU_PRE_DMA | | 4075 | base_flags |= (TXD_FLAG_CPU_PRE_DMA | |
4075 | TXD_FLAG_CPU_POST_DMA); | 4076 | TXD_FLAG_CPU_POST_DMA); |
4076 | 4077 | ||
4077 | skb->nh.iph->check = 0; | 4078 | iph = ip_hdr(skb); |
4078 | skb->nh.iph->tot_len = htons(mss + hdr_len); | 4079 | iph->check = 0; |
4080 | iph->tot_len = htons(mss + hdr_len); | ||
4079 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { | 4081 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { |
4080 | skb->h.th->check = 0; | 4082 | tcp_hdr(skb)->check = 0; |
4081 | base_flags &= ~TXD_FLAG_TCPUDP_CSUM; | 4083 | base_flags &= ~TXD_FLAG_TCPUDP_CSUM; |
4082 | } | 4084 | } else |
4083 | else { | 4085 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
4084 | skb->h.th->check = | 4086 | iph->daddr, 0, |
4085 | ~csum_tcpudp_magic(skb->nh.iph->saddr, | 4087 | IPPROTO_TCP, |
4086 | skb->nh.iph->daddr, | 4088 | 0); |
4087 | 0, IPPROTO_TCP, 0); | ||
4088 | } | ||
4089 | 4089 | ||
4090 | if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) || | 4090 | if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) || |
4091 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { | 4091 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { |
4092 | if (tcp_opt_len || skb->nh.iph->ihl > 5) { | 4092 | if (tcp_opt_len || iph->ihl > 5) { |
4093 | int tsflags; | 4093 | int tsflags; |
4094 | 4094 | ||
4095 | tsflags = ((skb->nh.iph->ihl - 5) + | 4095 | tsflags = (iph->ihl - 5) + (tcp_opt_len >> 2); |
4096 | (tcp_opt_len >> 2)); | ||
4097 | mss |= (tsflags << 11); | 4096 | mss |= (tsflags << 11); |
4098 | } | 4097 | } |
4099 | } else { | 4098 | } else { |
4100 | if (tcp_opt_len || skb->nh.iph->ihl > 5) { | 4099 | if (tcp_opt_len || iph->ihl > 5) { |
4101 | int tsflags; | 4100 | int tsflags; |
4102 | 4101 | ||
4103 | tsflags = ((skb->nh.iph->ihl - 5) + | 4102 | tsflags = (iph->ihl - 5) + (tcp_opt_len >> 2); |
4104 | (tcp_opt_len >> 2)); | ||
4105 | base_flags |= tsflags << 12; | 4103 | base_flags |= tsflags << 12; |
4106 | } | 4104 | } |
4107 | } | 4105 | } |
@@ -10988,24 +10986,20 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10988 | return err; | 10986 | return err; |
10989 | } | 10987 | } |
10990 | 10988 | ||
10991 | #ifdef CONFIG_SPARC64 | 10989 | #ifdef CONFIG_SPARC |
10992 | static int __devinit tg3_get_macaddr_sparc(struct tg3 *tp) | 10990 | static int __devinit tg3_get_macaddr_sparc(struct tg3 *tp) |
10993 | { | 10991 | { |
10994 | struct net_device *dev = tp->dev; | 10992 | struct net_device *dev = tp->dev; |
10995 | struct pci_dev *pdev = tp->pdev; | 10993 | struct pci_dev *pdev = tp->pdev; |
10996 | struct pcidev_cookie *pcp = pdev->sysdata; | 10994 | struct device_node *dp = pci_device_to_OF_node(pdev); |
10997 | 10995 | const unsigned char *addr; | |
10998 | if (pcp != NULL) { | 10996 | int len; |
10999 | unsigned char *addr; | 10997 | |
11000 | int len; | 10998 | addr = of_get_property(dp, "local-mac-address", &len); |
11001 | 10999 | if (addr && len == 6) { | |
11002 | addr = of_get_property(pcp->prom_node, "local-mac-address", | 11000 | memcpy(dev->dev_addr, addr, 6); |
11003 | &len); | 11001 | memcpy(dev->perm_addr, dev->dev_addr, 6); |
11004 | if (addr && len == 6) { | 11002 | return 0; |
11005 | memcpy(dev->dev_addr, addr, 6); | ||
11006 | memcpy(dev->perm_addr, dev->dev_addr, 6); | ||
11007 | return 0; | ||
11008 | } | ||
11009 | } | 11003 | } |
11010 | return -ENODEV; | 11004 | return -ENODEV; |
11011 | } | 11005 | } |
@@ -11026,7 +11020,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
11026 | u32 hi, lo, mac_offset; | 11020 | u32 hi, lo, mac_offset; |
11027 | int addr_ok = 0; | 11021 | int addr_ok = 0; |
11028 | 11022 | ||
11029 | #ifdef CONFIG_SPARC64 | 11023 | #ifdef CONFIG_SPARC |
11030 | if (!tg3_get_macaddr_sparc(tp)) | 11024 | if (!tg3_get_macaddr_sparc(tp)) |
11031 | return 0; | 11025 | return 0; |
11032 | #endif | 11026 | #endif |
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index f85f00251123..106dc1ef0acb 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c | |||
@@ -1112,7 +1112,7 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev ) | |||
1112 | 1112 | ||
1113 | if ( bbuf ) { | 1113 | if ( bbuf ) { |
1114 | tail_buffer = priv->txBuffer + ( priv->txTail * TLAN_MAX_FRAME_SIZE ); | 1114 | tail_buffer = priv->txBuffer + ( priv->txTail * TLAN_MAX_FRAME_SIZE ); |
1115 | memcpy( tail_buffer, skb->data, skb->len ); | 1115 | skb_copy_from_linear_data(skb, tail_buffer, skb->len); |
1116 | } else { | 1116 | } else { |
1117 | tail_list->buffer[0].address = pci_map_single(priv->pciDev, skb->data, skb->len, PCI_DMA_TODEVICE); | 1117 | tail_list->buffer[0].address = pci_map_single(priv->pciDev, skb->data, skb->len, PCI_DMA_TODEVICE); |
1118 | TLan_StoreSKB(tail_list, skb); | 1118 | TLan_StoreSKB(tail_list, skb); |
@@ -1577,7 +1577,6 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int ) | |||
1577 | printk(KERN_INFO "TLAN: Couldn't allocate memory for received data.\n"); | 1577 | printk(KERN_INFO "TLAN: Couldn't allocate memory for received data.\n"); |
1578 | else { | 1578 | else { |
1579 | head_buffer = priv->rxBuffer + (priv->rxHead * TLAN_MAX_FRAME_SIZE); | 1579 | head_buffer = priv->rxBuffer + (priv->rxHead * TLAN_MAX_FRAME_SIZE); |
1580 | skb->dev = dev; | ||
1581 | skb_reserve(skb, 2); | 1580 | skb_reserve(skb, 2); |
1582 | t = (void *) skb_put(skb, frameSize); | 1581 | t = (void *) skb_put(skb, frameSize); |
1583 | 1582 | ||
@@ -1608,7 +1607,6 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int ) | |||
1608 | skb->protocol = eth_type_trans( skb, dev ); | 1607 | skb->protocol = eth_type_trans( skb, dev ); |
1609 | netif_rx( skb ); | 1608 | netif_rx( skb ); |
1610 | 1609 | ||
1611 | new_skb->dev = dev; | ||
1612 | skb_reserve( new_skb, 2 ); | 1610 | skb_reserve( new_skb, 2 ); |
1613 | t = (void *) skb_put( new_skb, TLAN_MAX_FRAME_SIZE ); | 1611 | t = (void *) skb_put( new_skb, TLAN_MAX_FRAME_SIZE ); |
1614 | head_list->buffer[0].address = pci_map_single(priv->pciDev, new_skb->data, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); | 1612 | head_list->buffer[0].address = pci_map_single(priv->pciDev, new_skb->data, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); |
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c index 7580bdeacadc..e22a3f5333ef 100644 --- a/drivers/net/tokenring/3c359.c +++ b/drivers/net/tokenring/3c359.c | |||
@@ -933,20 +933,21 @@ static void xl_rx(struct net_device *dev) | |||
933 | return ; | 933 | return ; |
934 | } | 934 | } |
935 | 935 | ||
936 | skb->dev = dev ; | ||
937 | |||
938 | while (xl_priv->rx_ring_tail != temp_ring_loc) { | 936 | while (xl_priv->rx_ring_tail != temp_ring_loc) { |
939 | copy_len = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen & 0x7FFF ; | 937 | copy_len = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen & 0x7FFF ; |
940 | frame_length -= copy_len ; | 938 | frame_length -= copy_len ; |
941 | pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 939 | pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
942 | memcpy(skb_put(skb,copy_len), xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]->data, copy_len) ; | 940 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], |
941 | skb_put(skb, copy_len), | ||
942 | copy_len); | ||
943 | pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 943 | pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
944 | adv_rx_ring(dev) ; | 944 | adv_rx_ring(dev) ; |
945 | } | 945 | } |
946 | 946 | ||
947 | /* Now we have found the last fragment */ | 947 | /* Now we have found the last fragment */ |
948 | pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 948 | pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
949 | memcpy(skb_put(skb,copy_len), xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]->data, frame_length) ; | 949 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], |
950 | skb_put(skb,copy_len), frame_length); | ||
950 | /* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */ | 951 | /* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */ |
951 | pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 952 | pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
952 | adv_rx_ring(dev) ; | 953 | adv_rx_ring(dev) ; |
@@ -967,8 +968,6 @@ static void xl_rx(struct net_device *dev) | |||
967 | return ; | 968 | return ; |
968 | } | 969 | } |
969 | 970 | ||
970 | skb->dev = dev ; | ||
971 | |||
972 | skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; | 971 | skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; |
973 | pci_unmap_single(xl_priv->pdev, xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr, xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 972 | pci_unmap_single(xl_priv->pdev, xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr, xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
974 | skb_put(skb2, frame_length) ; | 973 | skb_put(skb2, frame_length) ; |
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c index 01d55315ee8c..1e8958ee2d0a 100644 --- a/drivers/net/tokenring/ibmtr.c +++ b/drivers/net/tokenring/ibmtr.c | |||
@@ -1771,7 +1771,6 @@ static void tr_rx(struct net_device *dev) | |||
1771 | /*BMS again, if she comes in with few but leaves with many */ | 1771 | /*BMS again, if she comes in with few but leaves with many */ |
1772 | skb_reserve(skb, sizeof(struct trh_hdr) - lan_hdr_len); | 1772 | skb_reserve(skb, sizeof(struct trh_hdr) - lan_hdr_len); |
1773 | skb_put(skb, length); | 1773 | skb_put(skb, length); |
1774 | skb->dev = dev; | ||
1775 | data = skb->data; | 1774 | data = skb->data; |
1776 | rbuffer_len = ntohs(readw(rbuf + offsetof(struct rec_buf, buf_len))); | 1775 | rbuffer_len = ntohs(readw(rbuf + offsetof(struct rec_buf, buf_len))); |
1777 | rbufdata = rbuf + offsetof(struct rec_buf, data); | 1776 | rbufdata = rbuf + offsetof(struct rec_buf, data); |
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index e999feb8c0bb..5d849c089a3b 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c | |||
@@ -944,8 +944,6 @@ static void streamer_rx(struct net_device *dev) | |||
944 | printk(KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n", dev->name); | 944 | printk(KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n", dev->name); |
945 | streamer_priv->streamer_stats.rx_dropped++; | 945 | streamer_priv->streamer_stats.rx_dropped++; |
946 | } else { /* we allocated an skb OK */ | 946 | } else { /* we allocated an skb OK */ |
947 | skb->dev = dev; | ||
948 | |||
949 | if (buffer_cnt == 1) { | 947 | if (buffer_cnt == 1) { |
950 | /* release the DMA mapping */ | 948 | /* release the DMA mapping */ |
951 | pci_unmap_single(streamer_priv->pci_dev, | 949 | pci_unmap_single(streamer_priv->pci_dev, |
@@ -1607,10 +1605,11 @@ static void streamer_arb_cmd(struct net_device *dev) | |||
1607 | frame_data, buffer_len); | 1605 | frame_data, buffer_len); |
1608 | } while (next_ptr && (buff_off = next_ptr)); | 1606 | } while (next_ptr && (buff_off = next_ptr)); |
1609 | 1607 | ||
1608 | mac_frame->protocol = tr_type_trans(mac_frame, dev); | ||
1610 | #if STREAMER_NETWORK_MONITOR | 1609 | #if STREAMER_NETWORK_MONITOR |
1611 | printk(KERN_WARNING "%s: Received MAC Frame, details: \n", | 1610 | printk(KERN_WARNING "%s: Received MAC Frame, details: \n", |
1612 | dev->name); | 1611 | dev->name); |
1613 | mac_hdr = (struct trh_hdr *) mac_frame->data; | 1612 | mac_hdr = tr_hdr(mac_frame); |
1614 | printk(KERN_WARNING | 1613 | printk(KERN_WARNING |
1615 | "%s: MAC Frame Dest. Addr: %02x:%02x:%02x:%02x:%02x:%02x \n", | 1614 | "%s: MAC Frame Dest. Addr: %02x:%02x:%02x:%02x:%02x:%02x \n", |
1616 | dev->name, mac_hdr->daddr[0], mac_hdr->daddr[1], | 1615 | dev->name, mac_hdr->daddr[0], mac_hdr->daddr[1], |
@@ -1622,8 +1621,6 @@ static void streamer_arb_cmd(struct net_device *dev) | |||
1622 | mac_hdr->saddr[2], mac_hdr->saddr[3], | 1621 | mac_hdr->saddr[2], mac_hdr->saddr[3], |
1623 | mac_hdr->saddr[4], mac_hdr->saddr[5]); | 1622 | mac_hdr->saddr[4], mac_hdr->saddr[5]); |
1624 | #endif | 1623 | #endif |
1625 | mac_frame->dev = dev; | ||
1626 | mac_frame->protocol = tr_type_trans(mac_frame, dev); | ||
1627 | netif_rx(mac_frame); | 1624 | netif_rx(mac_frame); |
1628 | 1625 | ||
1629 | /* Now tell the card we have dealt with the received frame */ | 1626 | /* Now tell the card we have dealt with the received frame */ |
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c index 8f4ecc1109cb..09b3cfb8e809 100644 --- a/drivers/net/tokenring/olympic.c +++ b/drivers/net/tokenring/olympic.c | |||
@@ -814,8 +814,6 @@ static void olympic_rx(struct net_device *dev) | |||
814 | olympic_priv->rx_ring_last_received += i ; | 814 | olympic_priv->rx_ring_last_received += i ; |
815 | olympic_priv->rx_ring_last_received &= (OLYMPIC_RX_RING_SIZE -1) ; | 815 | olympic_priv->rx_ring_last_received &= (OLYMPIC_RX_RING_SIZE -1) ; |
816 | } else { | 816 | } else { |
817 | skb->dev = dev ; | ||
818 | |||
819 | /* Optimise based upon number of buffers used. | 817 | /* Optimise based upon number of buffers used. |
820 | If only one buffer is used we can simply swap the buffers around. | 818 | If only one buffer is used we can simply swap the buffers around. |
821 | If more than one then we must use the new buffer and copy the information | 819 | If more than one then we must use the new buffer and copy the information |
@@ -847,7 +845,9 @@ static void olympic_rx(struct net_device *dev) | |||
847 | pci_dma_sync_single_for_cpu(olympic_priv->pdev, | 845 | pci_dma_sync_single_for_cpu(olympic_priv->pdev, |
848 | le32_to_cpu(olympic_priv->olympic_rx_ring[rx_ring_last_received].buffer), | 846 | le32_to_cpu(olympic_priv->olympic_rx_ring[rx_ring_last_received].buffer), |
849 | olympic_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 847 | olympic_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
850 | memcpy(skb_put(skb,length-4),olympic_priv->rx_ring_skb[rx_ring_last_received]->data,length-4) ; | 848 | skb_copy_from_linear_data(olympic_priv->rx_ring_skb[rx_ring_last_received], |
849 | skb_put(skb,length - 4), | ||
850 | length - 4); | ||
851 | pci_dma_sync_single_for_device(olympic_priv->pdev, | 851 | pci_dma_sync_single_for_device(olympic_priv->pdev, |
852 | le32_to_cpu(olympic_priv->olympic_rx_ring[rx_ring_last_received].buffer), | 852 | le32_to_cpu(olympic_priv->olympic_rx_ring[rx_ring_last_received].buffer), |
853 | olympic_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 853 | olympic_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
@@ -864,7 +864,9 @@ static void olympic_rx(struct net_device *dev) | |||
864 | olympic_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 864 | olympic_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
865 | rx_desc = &(olympic_priv->olympic_rx_ring[rx_ring_last_received]); | 865 | rx_desc = &(olympic_priv->olympic_rx_ring[rx_ring_last_received]); |
866 | cpy_length = (i == 1 ? frag_len : le32_to_cpu(rx_desc->res_length)); | 866 | cpy_length = (i == 1 ? frag_len : le32_to_cpu(rx_desc->res_length)); |
867 | memcpy(skb_put(skb, cpy_length), olympic_priv->rx_ring_skb[rx_ring_last_received]->data, cpy_length) ; | 867 | skb_copy_from_linear_data(olympic_priv->rx_ring_skb[rx_ring_last_received], |
868 | skb_put(skb, cpy_length), | ||
869 | cpy_length); | ||
868 | pci_dma_sync_single_for_device(olympic_priv->pdev, | 870 | pci_dma_sync_single_for_device(olympic_priv->pdev, |
869 | le32_to_cpu(olympic_priv->olympic_rx_ring[rx_ring_last_received].buffer), | 871 | le32_to_cpu(olympic_priv->olympic_rx_ring[rx_ring_last_received].buffer), |
870 | olympic_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 872 | olympic_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
@@ -1440,16 +1442,16 @@ static void olympic_arb_cmd(struct net_device *dev) | |||
1440 | next_ptr=readw(buf_ptr+offsetof(struct mac_receive_buffer,next)); | 1442 | next_ptr=readw(buf_ptr+offsetof(struct mac_receive_buffer,next)); |
1441 | } while (next_ptr && (buf_ptr=olympic_priv->olympic_lap + ntohs(next_ptr))); | 1443 | } while (next_ptr && (buf_ptr=olympic_priv->olympic_lap + ntohs(next_ptr))); |
1442 | 1444 | ||
1445 | mac_frame->protocol = tr_type_trans(mac_frame, dev); | ||
1446 | |||
1443 | if (olympic_priv->olympic_network_monitor) { | 1447 | if (olympic_priv->olympic_network_monitor) { |
1444 | struct trh_hdr *mac_hdr ; | 1448 | struct trh_hdr *mac_hdr ; |
1445 | printk(KERN_WARNING "%s: Received MAC Frame, details: \n",dev->name) ; | 1449 | printk(KERN_WARNING "%s: Received MAC Frame, details: \n",dev->name) ; |
1446 | mac_hdr = (struct trh_hdr *)mac_frame->data ; | 1450 | mac_hdr = tr_hdr(mac_frame); |
1447 | printk(KERN_WARNING "%s: MAC Frame Dest. Addr: %02x:%02x:%02x:%02x:%02x:%02x \n", dev->name , mac_hdr->daddr[0], mac_hdr->daddr[1], mac_hdr->daddr[2], mac_hdr->daddr[3], mac_hdr->daddr[4], mac_hdr->daddr[5]) ; | 1451 | printk(KERN_WARNING "%s: MAC Frame Dest. Addr: %02x:%02x:%02x:%02x:%02x:%02x \n", dev->name , mac_hdr->daddr[0], mac_hdr->daddr[1], mac_hdr->daddr[2], mac_hdr->daddr[3], mac_hdr->daddr[4], mac_hdr->daddr[5]) ; |
1448 | printk(KERN_WARNING "%s: MAC Frame Srce. Addr: %02x:%02x:%02x:%02x:%02x:%02x \n", dev->name , mac_hdr->saddr[0], mac_hdr->saddr[1], mac_hdr->saddr[2], mac_hdr->saddr[3], mac_hdr->saddr[4], mac_hdr->saddr[5]) ; | 1452 | printk(KERN_WARNING "%s: MAC Frame Srce. Addr: %02x:%02x:%02x:%02x:%02x:%02x \n", dev->name , mac_hdr->saddr[0], mac_hdr->saddr[1], mac_hdr->saddr[2], mac_hdr->saddr[3], mac_hdr->saddr[4], mac_hdr->saddr[5]) ; |
1449 | } | 1453 | } |
1450 | mac_frame->dev = dev ; | 1454 | netif_rx(mac_frame); |
1451 | mac_frame->protocol = tr_type_trans(mac_frame,dev); | ||
1452 | netif_rx(mac_frame) ; | ||
1453 | dev->last_rx = jiffies; | 1455 | dev->last_rx = jiffies; |
1454 | 1456 | ||
1455 | drop_frame: | 1457 | drop_frame: |
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c index cec282a6f62d..9bbea5c8acf4 100644 --- a/drivers/net/tokenring/smctr.c +++ b/drivers/net/tokenring/smctr.c | |||
@@ -3889,14 +3889,13 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size, | |||
3889 | 3889 | ||
3890 | /* Slide data into a sleek skb. */ | 3890 | /* Slide data into a sleek skb. */ |
3891 | skb_put(skb, skb->len); | 3891 | skb_put(skb, skb->len); |
3892 | memcpy(skb->data, rmf, skb->len); | 3892 | skb_copy_to_linear_data(skb, rmf, skb->len); |
3893 | 3893 | ||
3894 | /* Update Counters */ | 3894 | /* Update Counters */ |
3895 | tp->MacStat.rx_packets++; | 3895 | tp->MacStat.rx_packets++; |
3896 | tp->MacStat.rx_bytes += skb->len; | 3896 | tp->MacStat.rx_bytes += skb->len; |
3897 | 3897 | ||
3898 | /* Kick the packet on up. */ | 3898 | /* Kick the packet on up. */ |
3899 | skb->dev = dev; | ||
3900 | skb->protocol = tr_type_trans(skb, dev); | 3899 | skb->protocol = tr_type_trans(skb, dev); |
3901 | netif_rx(skb); | 3900 | netif_rx(skb); |
3902 | dev->last_rx = jiffies; | 3901 | dev->last_rx = jiffies; |
@@ -4476,14 +4475,13 @@ static int smctr_rx_frame(struct net_device *dev) | |||
4476 | if (skb) { | 4475 | if (skb) { |
4477 | skb_put(skb, rx_size); | 4476 | skb_put(skb, rx_size); |
4478 | 4477 | ||
4479 | memcpy(skb->data, pbuff, rx_size); | 4478 | skb_copy_to_linear_data(skb, pbuff, rx_size); |
4480 | 4479 | ||
4481 | /* Update Counters */ | 4480 | /* Update Counters */ |
4482 | tp->MacStat.rx_packets++; | 4481 | tp->MacStat.rx_packets++; |
4483 | tp->MacStat.rx_bytes += skb->len; | 4482 | tp->MacStat.rx_bytes += skb->len; |
4484 | 4483 | ||
4485 | /* Kick the packet on up. */ | 4484 | /* Kick the packet on up. */ |
4486 | skb->dev = dev; | ||
4487 | skb->protocol = tr_type_trans(skb, dev); | 4485 | skb->protocol = tr_type_trans(skb, dev); |
4488 | netif_rx(skb); | 4486 | netif_rx(skb); |
4489 | dev->last_rx = jiffies; | 4487 | dev->last_rx = jiffies; |
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c index ea797ca2b988..12bd294045a7 100644 --- a/drivers/net/tokenring/tms380tr.c +++ b/drivers/net/tokenring/tms380tr.c | |||
@@ -644,7 +644,7 @@ static int tms380tr_hardware_send_packet(struct sk_buff *skb, struct net_device | |||
644 | dmabuf = 0; | 644 | dmabuf = 0; |
645 | i = tp->TplFree->TPLIndex; | 645 | i = tp->TplFree->TPLIndex; |
646 | buf = tp->LocalTxBuffers[i]; | 646 | buf = tp->LocalTxBuffers[i]; |
647 | memcpy(buf, skb->data, length); | 647 | skb_copy_from_linear_data(skb, buf, length); |
648 | newbuf = ((char *)buf - (char *)tp) + tp->dmabuffer; | 648 | newbuf = ((char *)buf - (char *)tp) + tp->dmabuffer; |
649 | } | 649 | } |
650 | else { | 650 | else { |
@@ -2168,7 +2168,6 @@ static void tms380tr_rcv_status_irq(struct net_device *dev) | |||
2168 | } | 2168 | } |
2169 | else | 2169 | else |
2170 | { | 2170 | { |
2171 | skb->dev = dev; | ||
2172 | skb_put(skb, tp->MaxPacketSize); | 2171 | skb_put(skb, tp->MaxPacketSize); |
2173 | rpl->SkbStat = SKB_DATA_COPY; | 2172 | rpl->SkbStat = SKB_DATA_COPY; |
2174 | ReceiveDataPtr = rpl->MData; | 2173 | ReceiveDataPtr = rpl->MData; |
@@ -2179,7 +2178,8 @@ static void tms380tr_rcv_status_irq(struct net_device *dev) | |||
2179 | || rpl->SkbStat == SKB_DMA_DIRECT)) | 2178 | || rpl->SkbStat == SKB_DMA_DIRECT)) |
2180 | { | 2179 | { |
2181 | if(rpl->SkbStat == SKB_DATA_COPY) | 2180 | if(rpl->SkbStat == SKB_DATA_COPY) |
2182 | memcpy(skb->data, ReceiveDataPtr, Length); | 2181 | skb_copy_to_linear_data(skb, ReceiveDataPtr, |
2182 | Length); | ||
2183 | 2183 | ||
2184 | /* Deliver frame to system */ | 2184 | /* Deliver frame to system */ |
2185 | rpl->Skb = NULL; | 2185 | rpl->Skb = NULL; |
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index d92c5c597e16..0bfc2c9c1c08 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c | |||
@@ -788,7 +788,6 @@ static int tsi108_complete_rx(struct net_device *dev, int budget) | |||
788 | printk(".\n"); | 788 | printk(".\n"); |
789 | } | 789 | } |
790 | 790 | ||
791 | skb->dev = dev; | ||
792 | skb_put(skb, data->rxring[rx].len); | 791 | skb_put(skb, data->rxring[rx].len); |
793 | skb->protocol = eth_type_trans(skb, dev); | 792 | skb->protocol = eth_type_trans(skb, dev); |
794 | netif_receive_skb(skb); | 793 | netif_receive_skb(skb); |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index c82befa209a2..861729806dc1 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -63,7 +63,7 @@ MODULE_PARM_DESC (debug, "de2104x bitmapped message enable number"); | |||
63 | 63 | ||
64 | /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ | 64 | /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ |
65 | #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ | 65 | #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ |
66 | || defined(__sparc__) || defined(__ia64__) \ | 66 | || defined(CONFIG_SPARC) || defined(__ia64__) \ |
67 | || defined(__sh__) || defined(__mips__) | 67 | || defined(__sh__) || defined(__mips__) |
68 | static int rx_copybreak = 1518; | 68 | static int rx_copybreak = 1518; |
69 | #else | 69 | #else |
@@ -435,7 +435,6 @@ static void de_rx (struct de_private *de) | |||
435 | rx_work = 100; | 435 | rx_work = 100; |
436 | goto rx_next; | 436 | goto rx_next; |
437 | } | 437 | } |
438 | copy_skb->dev = de->dev; | ||
439 | 438 | ||
440 | if (!copying_skb) { | 439 | if (!copying_skb) { |
441 | pci_unmap_single(de->pdev, mapping, | 440 | pci_unmap_single(de->pdev, mapping, |
@@ -450,8 +449,8 @@ static void de_rx (struct de_private *de) | |||
450 | } else { | 449 | } else { |
451 | pci_dma_sync_single_for_cpu(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); | 450 | pci_dma_sync_single_for_cpu(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); |
452 | skb_reserve(copy_skb, RX_OFFSET); | 451 | skb_reserve(copy_skb, RX_OFFSET); |
453 | memcpy(skb_put(copy_skb, len), skb->data, len); | 452 | skb_copy_from_linear_data(skb, skb_put(copy_skb, len), |
454 | 453 | len); | |
455 | pci_dma_sync_single_for_device(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); | 454 | pci_dma_sync_single_for_device(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); |
456 | 455 | ||
457 | /* We'll reuse the original ring buffer. */ | 456 | /* We'll reuse the original ring buffer. */ |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index 4b3cd3d8b62a..62143f92c231 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -1160,7 +1160,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) | |||
1160 | sprintf(lp->adapter_name,"%s (%s)", name, gendev->bus_id); | 1160 | sprintf(lp->adapter_name,"%s (%s)", name, gendev->bus_id); |
1161 | 1161 | ||
1162 | lp->dma_size = (NUM_RX_DESC + NUM_TX_DESC) * sizeof(struct de4x5_desc); | 1162 | lp->dma_size = (NUM_RX_DESC + NUM_TX_DESC) * sizeof(struct de4x5_desc); |
1163 | #if defined(__alpha__) || defined(__powerpc__) || defined(__sparc_v9__) || defined(DE4X5_DO_MEMCPY) | 1163 | #if defined(__alpha__) || defined(__powerpc__) || defined(CONFIG_SPARC) || defined(DE4X5_DO_MEMCPY) |
1164 | lp->dma_size += RX_BUFF_SZ * NUM_RX_DESC + DE4X5_ALIGN; | 1164 | lp->dma_size += RX_BUFF_SZ * NUM_RX_DESC + DE4X5_ALIGN; |
1165 | #endif | 1165 | #endif |
1166 | lp->rx_ring = dma_alloc_coherent(gendev, lp->dma_size, | 1166 | lp->rx_ring = dma_alloc_coherent(gendev, lp->dma_size, |
@@ -1175,7 +1175,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) | |||
1175 | ** Set up the RX descriptor ring (Intels) | 1175 | ** Set up the RX descriptor ring (Intels) |
1176 | ** Allocate contiguous receive buffers, long word aligned (Alphas) | 1176 | ** Allocate contiguous receive buffers, long word aligned (Alphas) |
1177 | */ | 1177 | */ |
1178 | #if !defined(__alpha__) && !defined(__powerpc__) && !defined(__sparc_v9__) && !defined(DE4X5_DO_MEMCPY) | 1178 | #if !defined(__alpha__) && !defined(__powerpc__) && !defined(CONFIG_SPARC) && !defined(DE4X5_DO_MEMCPY) |
1179 | for (i=0; i<NUM_RX_DESC; i++) { | 1179 | for (i=0; i<NUM_RX_DESC; i++) { |
1180 | lp->rx_ring[i].status = 0; | 1180 | lp->rx_ring[i].status = 0; |
1181 | lp->rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ); | 1181 | lp->rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ); |
@@ -1252,11 +1252,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) | |||
1252 | mii_get_phy(dev); | 1252 | mii_get_phy(dev); |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | #ifndef __sparc_v9__ | ||
1256 | printk(" and requires IRQ%d (provided by %s).\n", dev->irq, | 1255 | printk(" and requires IRQ%d (provided by %s).\n", dev->irq, |
1257 | #else | ||
1258 | printk(" and requires IRQ%x (provided by %s).\n", dev->irq, | ||
1259 | #endif | ||
1260 | ((lp->bus == PCI) ? "PCI BIOS" : "EISA CNFG")); | 1256 | ((lp->bus == PCI) ? "PCI BIOS" : "EISA CNFG")); |
1261 | } | 1257 | } |
1262 | 1258 | ||
@@ -3627,14 +3623,13 @@ de4x5_alloc_rx_buff(struct net_device *dev, int index, int len) | |||
3627 | struct de4x5_private *lp = netdev_priv(dev); | 3623 | struct de4x5_private *lp = netdev_priv(dev); |
3628 | struct sk_buff *p; | 3624 | struct sk_buff *p; |
3629 | 3625 | ||
3630 | #if !defined(__alpha__) && !defined(__powerpc__) && !defined(__sparc_v9__) && !defined(DE4X5_DO_MEMCPY) | 3626 | #if !defined(__alpha__) && !defined(__powerpc__) && !defined(CONFIG_SPARC) && !defined(DE4X5_DO_MEMCPY) |
3631 | struct sk_buff *ret; | 3627 | struct sk_buff *ret; |
3632 | u_long i=0, tmp; | 3628 | u_long i=0, tmp; |
3633 | 3629 | ||
3634 | p = dev_alloc_skb(IEEE802_3_SZ + DE4X5_ALIGN + 2); | 3630 | p = dev_alloc_skb(IEEE802_3_SZ + DE4X5_ALIGN + 2); |
3635 | if (!p) return NULL; | 3631 | if (!p) return NULL; |
3636 | 3632 | ||
3637 | p->dev = dev; | ||
3638 | tmp = virt_to_bus(p->data); | 3633 | tmp = virt_to_bus(p->data); |
3639 | i = ((tmp + DE4X5_ALIGN) & ~DE4X5_ALIGN) - tmp; | 3634 | i = ((tmp + DE4X5_ALIGN) & ~DE4X5_ALIGN) - tmp; |
3640 | skb_reserve(p, i); | 3635 | skb_reserve(p, i); |
@@ -3655,7 +3650,6 @@ de4x5_alloc_rx_buff(struct net_device *dev, int index, int len) | |||
3655 | p = dev_alloc_skb(len + 2); | 3650 | p = dev_alloc_skb(len + 2); |
3656 | if (!p) return NULL; | 3651 | if (!p) return NULL; |
3657 | 3652 | ||
3658 | p->dev = dev; | ||
3659 | skb_reserve(p, 2); /* Align */ | 3653 | skb_reserve(p, 2); /* Align */ |
3660 | if (index < lp->rx_old) { /* Wrapped buffer */ | 3654 | if (index < lp->rx_old) { /* Wrapped buffer */ |
3661 | short tlen = (lp->rxRingSize - lp->rx_old) * RX_BUFF_SZ; | 3655 | short tlen = (lp->rxRingSize - lp->rx_old) * RX_BUFF_SZ; |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index 9aeac76184f3..b3a64ca98634 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -682,7 +682,7 @@ static int dmfe_start_xmit(struct sk_buff *skb, struct DEVICE *dev) | |||
682 | 682 | ||
683 | /* transmit this packet */ | 683 | /* transmit this packet */ |
684 | txptr = db->tx_insert_ptr; | 684 | txptr = db->tx_insert_ptr; |
685 | memcpy(txptr->tx_buf_ptr, skb->data, skb->len); | 685 | skb_copy_from_linear_data(skb, txptr->tx_buf_ptr, skb->len); |
686 | txptr->tdes1 = cpu_to_le32(0xe1000000 | skb->len); | 686 | txptr->tdes1 = cpu_to_le32(0xe1000000 | skb->len); |
687 | 687 | ||
688 | /* Point to next transmit free descriptor */ | 688 | /* Point to next transmit free descriptor */ |
@@ -988,14 +988,14 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db) | |||
988 | 988 | ||
989 | skb = newskb; | 989 | skb = newskb; |
990 | /* size less than COPY_SIZE, allocate a rxlen SKB */ | 990 | /* size less than COPY_SIZE, allocate a rxlen SKB */ |
991 | skb->dev = dev; | ||
992 | skb_reserve(skb, 2); /* 16byte align */ | 991 | skb_reserve(skb, 2); /* 16byte align */ |
993 | memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->data, rxlen); | 992 | skb_copy_from_linear_data(rxptr->rx_skb_ptr, |
993 | skb_put(skb, rxlen), | ||
994 | rxlen); | ||
994 | dmfe_reuse_skb(db, rxptr->rx_skb_ptr); | 995 | dmfe_reuse_skb(db, rxptr->rx_skb_ptr); |
995 | } else { | 996 | } else |
996 | skb->dev = dev; | ||
997 | skb_put(skb, rxlen); | 997 | skb_put(skb, rxlen); |
998 | } | 998 | |
999 | skb->protocol = eth_type_trans(skb, dev); | 999 | skb->protocol = eth_type_trans(skb, dev); |
1000 | netif_rx(skb); | 1000 | netif_rx(skb); |
1001 | dev->last_rx = jiffies; | 1001 | dev->last_rx = jiffies; |
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c index e3488d7b8ede..e86df07769a1 100644 --- a/drivers/net/tulip/interrupt.c +++ b/drivers/net/tulip/interrupt.c | |||
@@ -192,7 +192,6 @@ int tulip_poll(struct net_device *dev, int *budget) | |||
192 | to a minimally-sized skbuff. */ | 192 | to a minimally-sized skbuff. */ |
193 | if (pkt_len < tulip_rx_copybreak | 193 | if (pkt_len < tulip_rx_copybreak |
194 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 194 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
195 | skb->dev = dev; | ||
196 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 195 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
197 | pci_dma_sync_single_for_cpu(tp->pdev, | 196 | pci_dma_sync_single_for_cpu(tp->pdev, |
198 | tp->rx_buffers[entry].mapping, | 197 | tp->rx_buffers[entry].mapping, |
@@ -416,7 +415,6 @@ static int tulip_rx(struct net_device *dev) | |||
416 | to a minimally-sized skbuff. */ | 415 | to a minimally-sized skbuff. */ |
417 | if (pkt_len < tulip_rx_copybreak | 416 | if (pkt_len < tulip_rx_copybreak |
418 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 417 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
419 | skb->dev = dev; | ||
420 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 418 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
421 | pci_dma_sync_single_for_cpu(tp->pdev, | 419 | pci_dma_sync_single_for_cpu(tp->pdev, |
422 | tp->rx_buffers[entry].mapping, | 420 | tp->rx_buffers[entry].mapping, |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index e3774a522372..e9bf526ec534 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -36,8 +36,8 @@ | |||
36 | #include <asm/unaligned.h> | 36 | #include <asm/unaligned.h> |
37 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
38 | 38 | ||
39 | #ifdef __sparc__ | 39 | #ifdef CONFIG_SPARC |
40 | #include <asm/pbm.h> | 40 | #include <asm/prom.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | static char version[] __devinitdata = | 43 | static char version[] __devinitdata = |
@@ -67,7 +67,7 @@ const char * const medianame[32] = { | |||
67 | 67 | ||
68 | /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ | 68 | /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ |
69 | #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ | 69 | #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ |
70 | || defined(__sparc__) || defined(__ia64__) \ | 70 | || defined(CONFIG_SPARC) || defined(__ia64__) \ |
71 | || defined(__sh__) || defined(__mips__) | 71 | || defined(__sh__) || defined(__mips__) |
72 | static int rx_copybreak = 1518; | 72 | static int rx_copybreak = 1518; |
73 | #else | 73 | #else |
@@ -91,7 +91,7 @@ static int rx_copybreak = 100; | |||
91 | static int csr0 = 0x01A00000 | 0xE000; | 91 | static int csr0 = 0x01A00000 | 0xE000; |
92 | #elif defined(__i386__) || defined(__powerpc__) || defined(__x86_64__) | 92 | #elif defined(__i386__) || defined(__powerpc__) || defined(__x86_64__) |
93 | static int csr0 = 0x01A00000 | 0x8000; | 93 | static int csr0 = 0x01A00000 | 0x8000; |
94 | #elif defined(__sparc__) || defined(__hppa__) | 94 | #elif defined(CONFIG_SPARC) || defined(__hppa__) |
95 | /* The UltraSparc PCI controllers will disconnect at every 64-byte | 95 | /* The UltraSparc PCI controllers will disconnect at every 64-byte |
96 | * crossing anyways so it makes no sense to tell Tulip to burst | 96 | * crossing anyways so it makes no sense to tell Tulip to burst |
97 | * any more than that. | 97 | * any more than that. |
@@ -1315,7 +1315,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1315 | /* DM9102A has troubles with MRM & clear reserved bits 24:22, 20, 16, 7:1 */ | 1315 | /* DM9102A has troubles with MRM & clear reserved bits 24:22, 20, 16, 7:1 */ |
1316 | if (tulip_uli_dm_quirk(pdev)) { | 1316 | if (tulip_uli_dm_quirk(pdev)) { |
1317 | csr0 &= ~0x01f100ff; | 1317 | csr0 &= ~0x01f100ff; |
1318 | #if defined(__sparc__) | 1318 | #if defined(CONFIG_SPARC) |
1319 | csr0 = (csr0 & ~0xff00) | 0xe000; | 1319 | csr0 = (csr0 & ~0xff00) | 0xe000; |
1320 | #endif | 1320 | #endif |
1321 | } | 1321 | } |
@@ -1535,23 +1535,19 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1535 | Many PCI BIOSes also incorrectly report the IRQ line, so we correct | 1535 | Many PCI BIOSes also incorrectly report the IRQ line, so we correct |
1536 | that here as well. */ | 1536 | that here as well. */ |
1537 | if (sum == 0 || sum == 6*0xff) { | 1537 | if (sum == 0 || sum == 6*0xff) { |
1538 | #if defined(__sparc__) | 1538 | #if defined(CONFIG_SPARC) |
1539 | struct pcidev_cookie *pcp = pdev->sysdata; | 1539 | struct device_node *dp = pci_device_to_OF_node(pdev); |
1540 | const unsigned char *addr; | ||
1541 | int len; | ||
1540 | #endif | 1542 | #endif |
1541 | eeprom_missing = 1; | 1543 | eeprom_missing = 1; |
1542 | for (i = 0; i < 5; i++) | 1544 | for (i = 0; i < 5; i++) |
1543 | dev->dev_addr[i] = last_phys_addr[i]; | 1545 | dev->dev_addr[i] = last_phys_addr[i]; |
1544 | dev->dev_addr[i] = last_phys_addr[i] + 1; | 1546 | dev->dev_addr[i] = last_phys_addr[i] + 1; |
1545 | #if defined(__sparc__) | 1547 | #if defined(CONFIG_SPARC) |
1546 | if (pcp) { | 1548 | addr = of_get_property(dp, "local-mac-address", &len); |
1547 | unsigned char *addr; | 1549 | if (addr && len == 6) |
1548 | int len; | 1550 | memcpy(dev->dev_addr, addr, 6); |
1549 | |||
1550 | addr = of_get_property(pcp->prom_node, | ||
1551 | "local-mac-address", &len); | ||
1552 | if (addr && len == 6) | ||
1553 | memcpy(dev->dev_addr, addr, 6); | ||
1554 | } | ||
1555 | #endif | 1551 | #endif |
1556 | #if defined(__i386__) || defined(__x86_64__) /* Patch up x86 BIOS bug. */ | 1552 | #if defined(__i386__) || defined(__x86_64__) /* Patch up x86 BIOS bug. */ |
1557 | if (last_irq) | 1553 | if (last_irq) |
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 229158e8e4be..ca2548eb7d63 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -583,7 +583,7 @@ static int uli526x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
583 | 583 | ||
584 | /* transmit this packet */ | 584 | /* transmit this packet */ |
585 | txptr = db->tx_insert_ptr; | 585 | txptr = db->tx_insert_ptr; |
586 | memcpy(txptr->tx_buf_ptr, skb->data, skb->len); | 586 | skb_copy_from_linear_data(skb, txptr->tx_buf_ptr, skb->len); |
587 | txptr->tdes1 = cpu_to_le32(0xe1000000 | skb->len); | 587 | txptr->tdes1 = cpu_to_le32(0xe1000000 | skb->len); |
588 | 588 | ||
589 | /* Point to next transmit free descriptor */ | 589 | /* Point to next transmit free descriptor */ |
@@ -828,14 +828,14 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info | |||
828 | ( (skb = dev_alloc_skb(rxlen + 2) ) | 828 | ( (skb = dev_alloc_skb(rxlen + 2) ) |
829 | != NULL) ) { | 829 | != NULL) ) { |
830 | /* size less than COPY_SIZE, allocate a rxlen SKB */ | 830 | /* size less than COPY_SIZE, allocate a rxlen SKB */ |
831 | skb->dev = dev; | ||
832 | skb_reserve(skb, 2); /* 16byte align */ | 831 | skb_reserve(skb, 2); /* 16byte align */ |
833 | memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->tail, rxlen); | 832 | memcpy(skb_put(skb, rxlen), |
833 | skb_tail_pointer(rxptr->rx_skb_ptr), | ||
834 | rxlen); | ||
834 | uli526x_reuse_skb(db, rxptr->rx_skb_ptr); | 835 | uli526x_reuse_skb(db, rxptr->rx_skb_ptr); |
835 | } else { | 836 | } else |
836 | skb->dev = dev; | ||
837 | skb_put(skb, rxlen); | 837 | skb_put(skb, rxlen); |
838 | } | 838 | |
839 | skb->protocol = eth_type_trans(skb, dev); | 839 | skb->protocol = eth_type_trans(skb, dev); |
840 | netif_rx(skb); | 840 | netif_rx(skb); |
841 | dev->last_rx = jiffies; | 841 | dev->last_rx = jiffies; |
@@ -1177,7 +1177,10 @@ static void uli526x_reuse_skb(struct uli526x_board_info *db, struct sk_buff * sk | |||
1177 | 1177 | ||
1178 | if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { | 1178 | if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { |
1179 | rxptr->rx_skb_ptr = skb; | 1179 | rxptr->rx_skb_ptr = skb; |
1180 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 1180 | rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev, |
1181 | skb_tail_pointer(skb), | ||
1182 | RX_ALLOC_SIZE, | ||
1183 | PCI_DMA_FROMDEVICE)); | ||
1181 | wmb(); | 1184 | wmb(); |
1182 | rxptr->rdes0 = cpu_to_le32(0x80000000); | 1185 | rxptr->rdes0 = cpu_to_le32(0x80000000); |
1183 | db->rx_avail_cnt++; | 1186 | db->rx_avail_cnt++; |
@@ -1341,7 +1344,10 @@ static void allocate_rx_buffer(struct uli526x_board_info *db) | |||
1341 | if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) | 1344 | if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) |
1342 | break; | 1345 | break; |
1343 | rxptr->rx_skb_ptr = skb; /* FIXME (?) */ | 1346 | rxptr->rx_skb_ptr = skb; /* FIXME (?) */ |
1344 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 1347 | rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev, |
1348 | skb_tail_pointer(skb), | ||
1349 | RX_ALLOC_SIZE, | ||
1350 | PCI_DMA_FROMDEVICE)); | ||
1345 | wmb(); | 1351 | wmb(); |
1346 | rxptr->rdes0 = cpu_to_le32(0x80000000); | 1352 | rxptr->rdes0 = cpu_to_le32(0x80000000); |
1347 | rxptr = rxptr->next_rx_desc; | 1353 | rxptr = rxptr->next_rx_desc; |
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 002a05e0722f..5b71ac78bca2 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -813,7 +813,6 @@ static void init_rxtx_rings(struct net_device *dev) | |||
813 | np->rx_skbuff[i] = skb; | 813 | np->rx_skbuff[i] = skb; |
814 | if (skb == NULL) | 814 | if (skb == NULL) |
815 | break; | 815 | break; |
816 | skb->dev = dev; /* Mark as being used by this device. */ | ||
817 | np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data, | 816 | np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data, |
818 | np->rx_buf_sz,PCI_DMA_FROMDEVICE); | 817 | np->rx_buf_sz,PCI_DMA_FROMDEVICE); |
819 | 818 | ||
@@ -903,7 +902,7 @@ static void init_registers(struct net_device *dev) | |||
903 | } | 902 | } |
904 | #elif defined(__powerpc__) || defined(__i386__) || defined(__alpha__) || defined(__ia64__) || defined(__x86_64__) | 903 | #elif defined(__powerpc__) || defined(__i386__) || defined(__alpha__) || defined(__ia64__) || defined(__x86_64__) |
905 | i |= 0xE000; | 904 | i |= 0xE000; |
906 | #elif defined(__sparc__) || defined (CONFIG_PARISC) | 905 | #elif defined(CONFIG_SPARC) || defined (CONFIG_PARISC) |
907 | i |= 0x4800; | 906 | i |= 0x4800; |
908 | #else | 907 | #else |
909 | #warning Processor architecture undefined | 908 | #warning Processor architecture undefined |
@@ -1229,7 +1228,6 @@ static int netdev_rx(struct net_device *dev) | |||
1229 | to a minimally-sized skbuff. */ | 1228 | to a minimally-sized skbuff. */ |
1230 | if (pkt_len < rx_copybreak | 1229 | if (pkt_len < rx_copybreak |
1231 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1230 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1232 | skb->dev = dev; | ||
1233 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1231 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1234 | pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], | 1232 | pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], |
1235 | np->rx_skbuff[entry]->len, | 1233 | np->rx_skbuff[entry]->len, |
@@ -1278,7 +1276,6 @@ static int netdev_rx(struct net_device *dev) | |||
1278 | np->rx_skbuff[entry] = skb; | 1276 | np->rx_skbuff[entry] = skb; |
1279 | if (skb == NULL) | 1277 | if (skb == NULL) |
1280 | break; /* Better luck next round. */ | 1278 | break; /* Better luck next round. */ |
1281 | skb->dev = dev; /* Mark as being used by this device. */ | ||
1282 | np->rx_addr[entry] = pci_map_single(np->pci_dev, | 1279 | np->rx_addr[entry] = pci_map_single(np->pci_dev, |
1283 | skb->data, | 1280 | skb->data, |
1284 | np->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1281 | np->rx_buf_sz, PCI_DMA_FROMDEVICE); |
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index 61d313049dd0..985a1810ca59 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c | |||
@@ -411,9 +411,9 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
411 | sometimes sends more than you ask it to. */ | 411 | sometimes sends more than you ask it to. */ |
412 | 412 | ||
413 | memset(&card->tx_buffer[bufferoffsets[desc]/4],0,1536); | 413 | memset(&card->tx_buffer[bufferoffsets[desc]/4],0,1536); |
414 | memcpy(&(card->tx_buffer[bufferoffsets[desc]/4]),skb->data,skb->len); | 414 | skb_copy_from_linear_data(skb, |
415 | 415 | &(card->tx_buffer[bufferoffsets[desc] / 4]), | |
416 | 416 | skb->len); | |
417 | /* FIXME: The specification tells us that the length we send HAS to be a multiple of | 417 | /* FIXME: The specification tells us that the length we send HAS to be a multiple of |
418 | 4 bytes. */ | 418 | 4 bytes. */ |
419 | 419 | ||
@@ -1207,7 +1207,6 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri | |||
1207 | card->stats.rx_dropped++; | 1207 | card->stats.rx_dropped++; |
1208 | goto out; | 1208 | goto out; |
1209 | } | 1209 | } |
1210 | skb->dev = dev; | ||
1211 | skb_reserve(skb, 2); | 1210 | skb_reserve(skb, 2); |
1212 | eth_copy_and_sum(skb, (unsigned char*)&card->rx_buffer[bufferoffset / 4], pkt_len, 0); | 1211 | eth_copy_and_sum(skb, (unsigned char*)&card->rx_buffer[bufferoffset / 4], pkt_len, 0); |
1213 | skb_put(skb, pkt_len); | 1212 | skb_put(skb, pkt_len); |
diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c index a998c5d0ae9c..f64172927377 100644 --- a/drivers/net/tulip/xircom_tulip_cb.c +++ b/drivers/net/tulip/xircom_tulip_cb.c | |||
@@ -65,7 +65,7 @@ static int rx_copybreak = 100; | |||
65 | static int csr0 = 0x01A00000 | 0xE000; | 65 | static int csr0 = 0x01A00000 | 0xE000; |
66 | #elif defined(__powerpc__) | 66 | #elif defined(__powerpc__) |
67 | static int csr0 = 0x01B00000 | 0x8000; | 67 | static int csr0 = 0x01B00000 | 0x8000; |
68 | #elif defined(__sparc__) | 68 | #elif defined(CONFIG_SPARC) |
69 | static int csr0 = 0x01B00080 | 0x8000; | 69 | static int csr0 = 0x01B00080 | 0x8000; |
70 | #elif defined(__i386__) | 70 | #elif defined(__i386__) |
71 | static int csr0 = 0x01A00000 | 0x8000; | 71 | static int csr0 = 0x01A00000 | 0x8000; |
@@ -915,7 +915,9 @@ xircom_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
915 | 915 | ||
916 | tp->tx_skbuff[entry] = skb; | 916 | tp->tx_skbuff[entry] = skb; |
917 | if (tp->chip_id == X3201_3) { | 917 | if (tp->chip_id == X3201_3) { |
918 | memcpy(tp->tx_aligned_skbuff[entry]->data,skb->data,skb->len); | 918 | skb_copy_from_linear_data(skb, |
919 | tp->tx_aligned_skbuff[entry]->data, | ||
920 | skb->len); | ||
919 | tp->tx_ring[entry].buffer1 = virt_to_bus(tp->tx_aligned_skbuff[entry]->data); | 921 | tp->tx_ring[entry].buffer1 = virt_to_bus(tp->tx_aligned_skbuff[entry]->data); |
920 | } else | 922 | } else |
921 | tp->tx_ring[entry].buffer1 = virt_to_bus(skb->data); | 923 | tp->tx_ring[entry].buffer1 = virt_to_bus(skb->data); |
@@ -1238,7 +1240,6 @@ xircom_rx(struct net_device *dev) | |||
1238 | to a minimally-sized skbuff. */ | 1240 | to a minimally-sized skbuff. */ |
1239 | if (pkt_len < rx_copybreak | 1241 | if (pkt_len < rx_copybreak |
1240 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1242 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1241 | skb->dev = dev; | ||
1242 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1243 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1243 | #if ! defined(__alpha__) | 1244 | #if ! defined(__alpha__) |
1244 | eth_copy_and_sum(skb, bus_to_virt(tp->rx_ring[entry].buffer1), | 1245 | eth_copy_and_sum(skb, bus_to_virt(tp->rx_ring[entry].buffer1), |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 5643d1e84ed6..a2c6caaaae93 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -18,6 +18,10 @@ | |||
18 | /* | 18 | /* |
19 | * Changes: | 19 | * Changes: |
20 | * | 20 | * |
21 | * Brian Braunstein <linuxkernel@bristyle.com> 2007/03/23 | ||
22 | * Fixed hw address handling. Now net_device.dev_addr is kept consistent | ||
23 | * with tun.dev_addr when the address is set by this module. | ||
24 | * | ||
21 | * Mike Kershaw <dragorn@kismetwireless.net> 2005/08/14 | 25 | * Mike Kershaw <dragorn@kismetwireless.net> 2005/08/14 |
22 | * Add TUNSETLINK ioctl to set the link encapsulation | 26 | * Add TUNSETLINK ioctl to set the link encapsulation |
23 | * | 27 | * |
@@ -196,7 +200,10 @@ static void tun_net_init(struct net_device *dev) | |||
196 | dev->set_multicast_list = tun_net_mclist; | 200 | dev->set_multicast_list = tun_net_mclist; |
197 | 201 | ||
198 | ether_setup(dev); | 202 | ether_setup(dev); |
199 | random_ether_addr(dev->dev_addr); | 203 | |
204 | /* random address already created for us by tun_set_iff, use it */ | ||
205 | memcpy(dev->dev_addr, tun->dev_addr, min(sizeof(tun->dev_addr), sizeof(dev->dev_addr)) ); | ||
206 | |||
200 | dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */ | 207 | dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */ |
201 | break; | 208 | break; |
202 | } | 209 | } |
@@ -254,11 +261,11 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, | |||
254 | return -EFAULT; | 261 | return -EFAULT; |
255 | } | 262 | } |
256 | 263 | ||
257 | skb->dev = tun->dev; | ||
258 | switch (tun->flags & TUN_TYPE_MASK) { | 264 | switch (tun->flags & TUN_TYPE_MASK) { |
259 | case TUN_TUN_DEV: | 265 | case TUN_TUN_DEV: |
260 | skb->mac.raw = skb->data; | 266 | skb_reset_mac_header(skb); |
261 | skb->protocol = pi.proto; | 267 | skb->protocol = pi.proto; |
268 | skb->dev = tun->dev; | ||
262 | break; | 269 | break; |
263 | case TUN_TAP_DEV: | 270 | case TUN_TAP_DEV: |
264 | skb->protocol = eth_type_trans(skb, tun->dev); | 271 | skb->protocol = eth_type_trans(skb, tun->dev); |
@@ -386,8 +393,8 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, | |||
386 | * - we are multicast promiscous. | 393 | * - we are multicast promiscous. |
387 | * - we belong to the multicast group. | 394 | * - we belong to the multicast group. |
388 | */ | 395 | */ |
389 | memcpy(addr, skb->data, | 396 | skb_copy_from_linear_data(skb, addr, min_t(size_t, sizeof addr, |
390 | min_t(size_t, sizeof addr, skb->len)); | 397 | skb->len)); |
391 | bit_nr = ether_crc(sizeof addr, addr) >> 26; | 398 | bit_nr = ether_crc(sizeof addr, addr) >> 26; |
392 | if ((tun->if_flags & IFF_PROMISC) || | 399 | if ((tun->if_flags & IFF_PROMISC) || |
393 | memcmp(addr, tun->dev_addr, sizeof addr) == 0 || | 400 | memcmp(addr, tun->dev_addr, sizeof addr) == 0 || |
@@ -636,6 +643,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
636 | return 0; | 643 | return 0; |
637 | 644 | ||
638 | case SIOCGIFHWADDR: | 645 | case SIOCGIFHWADDR: |
646 | /* Note: the actual net device's address may be different */ | ||
639 | memcpy(ifr.ifr_hwaddr.sa_data, tun->dev_addr, | 647 | memcpy(ifr.ifr_hwaddr.sa_data, tun->dev_addr, |
640 | min(sizeof ifr.ifr_hwaddr.sa_data, sizeof tun->dev_addr)); | 648 | min(sizeof ifr.ifr_hwaddr.sa_data, sizeof tun->dev_addr)); |
641 | if (copy_to_user( argp, &ifr, sizeof ifr)) | 649 | if (copy_to_user( argp, &ifr, sizeof ifr)) |
@@ -643,16 +651,24 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
643 | return 0; | 651 | return 0; |
644 | 652 | ||
645 | case SIOCSIFHWADDR: | 653 | case SIOCSIFHWADDR: |
646 | /** Set the character device's hardware address. This is used when | 654 | { |
647 | * filtering packets being sent from the network device to the character | 655 | /* try to set the actual net device's hw address */ |
648 | * device. */ | 656 | int ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); |
649 | memcpy(tun->dev_addr, ifr.ifr_hwaddr.sa_data, | 657 | |
650 | min(sizeof ifr.ifr_hwaddr.sa_data, sizeof tun->dev_addr)); | 658 | if (ret == 0) { |
651 | DBG(KERN_DEBUG "%s: set hardware address: %x:%x:%x:%x:%x:%x\n", | 659 | /** Set the character device's hardware address. This is used when |
652 | tun->dev->name, | 660 | * filtering packets being sent from the network device to the character |
653 | tun->dev_addr[0], tun->dev_addr[1], tun->dev_addr[2], | 661 | * device. */ |
654 | tun->dev_addr[3], tun->dev_addr[4], tun->dev_addr[5]); | 662 | memcpy(tun->dev_addr, ifr.ifr_hwaddr.sa_data, |
655 | return 0; | 663 | min(sizeof ifr.ifr_hwaddr.sa_data, sizeof tun->dev_addr)); |
664 | DBG(KERN_DEBUG "%s: set hardware address: %x:%x:%x:%x:%x:%x\n", | ||
665 | tun->dev->name, | ||
666 | tun->dev_addr[0], tun->dev_addr[1], tun->dev_addr[2], | ||
667 | tun->dev_addr[3], tun->dev_addr[4], tun->dev_addr[5]); | ||
668 | } | ||
669 | |||
670 | return ret; | ||
671 | } | ||
656 | 672 | ||
657 | case SIOCADDMULTI: | 673 | case SIOCADDMULTI: |
658 | /** Add the specified group to the character device's multicast filter | 674 | /** Add the specified group to the character device's multicast filter |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 0d91d094edd9..f2dd7763cd0b 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -1708,7 +1708,6 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile u32 * ready, | |||
1708 | 1708 | ||
1709 | if(pkt_len < rx_copybreak && | 1709 | if(pkt_len < rx_copybreak && |
1710 | (new_skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1710 | (new_skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1711 | new_skb->dev = tp->dev; | ||
1712 | skb_reserve(new_skb, 2); | 1711 | skb_reserve(new_skb, 2); |
1713 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, | 1712 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, |
1714 | PKT_BUF_SZ, | 1713 | PKT_BUF_SZ, |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index f3a972e74e9a..adea290a9d5e 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -1486,7 +1486,6 @@ static int rhine_rx(struct net_device *dev, int limit) | |||
1486 | copying to a minimally-sized skbuff. */ | 1486 | copying to a minimally-sized skbuff. */ |
1487 | if (pkt_len < rx_copybreak && | 1487 | if (pkt_len < rx_copybreak && |
1488 | (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1488 | (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1489 | skb->dev = dev; | ||
1490 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1489 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1491 | pci_dma_sync_single_for_cpu(rp->pdev, | 1490 | pci_dma_sync_single_for_cpu(rp->pdev, |
1492 | rp->rx_skbuff_dma[entry], | 1491 | rp->rx_skbuff_dma[entry], |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 8e5d82051bd4..25b75b615188 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1339,7 +1339,8 @@ static inline int velocity_rx_copy(struct sk_buff **rx_skb, int pkt_size, | |||
1339 | if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) | 1339 | if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) |
1340 | skb_reserve(new_skb, 2); | 1340 | skb_reserve(new_skb, 2); |
1341 | 1341 | ||
1342 | memcpy(new_skb->data, rx_skb[0]->data, pkt_size); | 1342 | skb_copy_from_linear_data(rx_skb[0], new_skb->data, |
1343 | pkt_size); | ||
1343 | *rx_skb = new_skb; | 1344 | *rx_skb = new_skb; |
1344 | ret = 0; | 1345 | ret = 0; |
1345 | } | 1346 | } |
@@ -1398,7 +1399,6 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx) | |||
1398 | vptr->stats.multicast++; | 1399 | vptr->stats.multicast++; |
1399 | 1400 | ||
1400 | skb = rd_info->skb; | 1401 | skb = rd_info->skb; |
1401 | skb->dev = vptr->dev; | ||
1402 | 1402 | ||
1403 | pci_dma_sync_single_for_cpu(vptr->pdev, rd_info->skb_dma, | 1403 | pci_dma_sync_single_for_cpu(vptr->pdev, rd_info->skb_dma, |
1404 | vptr->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1404 | vptr->rx_buf_sz, PCI_DMA_FROMDEVICE); |
@@ -1428,7 +1428,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx) | |||
1428 | PCI_DMA_FROMDEVICE); | 1428 | PCI_DMA_FROMDEVICE); |
1429 | 1429 | ||
1430 | skb_put(skb, pkt_len - 4); | 1430 | skb_put(skb, pkt_len - 4); |
1431 | skb->protocol = eth_type_trans(skb, skb->dev); | 1431 | skb->protocol = eth_type_trans(skb, vptr->dev); |
1432 | 1432 | ||
1433 | stats->rx_bytes += pkt_len; | 1433 | stats->rx_bytes += pkt_len; |
1434 | netif_rx(skb); | 1434 | netif_rx(skb); |
@@ -1928,7 +1928,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1928 | if (pktlen < ETH_ZLEN) { | 1928 | if (pktlen < ETH_ZLEN) { |
1929 | /* Cannot occur until ZC support */ | 1929 | /* Cannot occur until ZC support */ |
1930 | pktlen = ETH_ZLEN; | 1930 | pktlen = ETH_ZLEN; |
1931 | memcpy(tdinfo->buf, skb->data, skb->len); | 1931 | skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); |
1932 | memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len); | 1932 | memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len); |
1933 | tdinfo->skb = skb; | 1933 | tdinfo->skb = skb; |
1934 | tdinfo->skb_dma[0] = tdinfo->buf_dma; | 1934 | tdinfo->skb_dma[0] = tdinfo->buf_dma; |
@@ -1944,7 +1944,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1944 | int nfrags = skb_shinfo(skb)->nr_frags; | 1944 | int nfrags = skb_shinfo(skb)->nr_frags; |
1945 | tdinfo->skb = skb; | 1945 | tdinfo->skb = skb; |
1946 | if (nfrags > 6) { | 1946 | if (nfrags > 6) { |
1947 | memcpy(tdinfo->buf, skb->data, skb->len); | 1947 | skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); |
1948 | tdinfo->skb_dma[0] = tdinfo->buf_dma; | 1948 | tdinfo->skb_dma[0] = tdinfo->buf_dma; |
1949 | td_ptr->tdesc0.pktsize = | 1949 | td_ptr->tdesc0.pktsize = |
1950 | td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); | 1950 | td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); |
@@ -2007,7 +2007,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2007 | */ | 2007 | */ |
2008 | if ((vptr->flags & VELOCITY_FLAGS_TX_CSUM) | 2008 | if ((vptr->flags & VELOCITY_FLAGS_TX_CSUM) |
2009 | && (skb->ip_summed == CHECKSUM_PARTIAL)) { | 2009 | && (skb->ip_summed == CHECKSUM_PARTIAL)) { |
2010 | struct iphdr *ip = skb->nh.iph; | 2010 | const struct iphdr *ip = ip_hdr(skb); |
2011 | if (ip->protocol == IPPROTO_TCP) | 2011 | if (ip->protocol == IPPROTO_TCP) |
2012 | td_ptr->tdesc1.TCR |= TCR0_TCPCK; | 2012 | td_ptr->tdesc1.TCR |= TCR0_TCPCK; |
2013 | else if (ip->protocol == IPPROTO_UDP) | 2013 | else if (ip->protocol == IPPROTO_UDP) |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 5b82e4fd0d73..23464735fa88 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -773,7 +773,7 @@ static int sppp_rx_done(struct channel_data *chan) | |||
773 | } | 773 | } |
774 | chan->rx_skb->protocol = htons(ETH_P_WAN_PPP); | 774 | chan->rx_skb->protocol = htons(ETH_P_WAN_PPP); |
775 | chan->rx_skb->dev = chan->pppdev.dev; | 775 | chan->rx_skb->dev = chan->pppdev.dev; |
776 | chan->rx_skb->mac.raw = chan->rx_skb->data; | 776 | skb_reset_mac_header(chan->rx_skb); |
777 | chan->stats.rx_packets++; | 777 | chan->stats.rx_packets++; |
778 | chan->stats.rx_bytes += chan->cosa->rxsize; | 778 | chan->stats.rx_bytes += chan->cosa->rxsize; |
779 | netif_rx(chan->rx_skb); | 779 | netif_rx(chan->rx_skb); |
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c index a631d1c2fa14..016b3ff3ea5e 100644 --- a/drivers/net/wan/cycx_x25.c +++ b/drivers/net/wan/cycx_x25.c | |||
@@ -834,7 +834,7 @@ static void cycx_x25_irq_rx(struct cycx_device *card, struct cycx_x25_cmd *cmd) | |||
834 | ++chan->ifstats.rx_packets; | 834 | ++chan->ifstats.rx_packets; |
835 | chan->ifstats.rx_bytes += pktlen; | 835 | chan->ifstats.rx_bytes += pktlen; |
836 | 836 | ||
837 | skb->mac.raw = skb->data; | 837 | skb_reset_mac_header(skb); |
838 | netif_rx(skb); | 838 | netif_rx(skb); |
839 | dev->last_rx = jiffies; /* timestamp */ | 839 | dev->last_rx = jiffies; /* timestamp */ |
840 | } | 840 | } |
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c index 736987559432..66be20c292b6 100644 --- a/drivers/net/wan/dlci.c +++ b/drivers/net/wan/dlci.c | |||
@@ -176,7 +176,7 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev) | |||
176 | if (process) | 176 | if (process) |
177 | { | 177 | { |
178 | /* we've set up the protocol, so discard the header */ | 178 | /* we've set up the protocol, so discard the header */ |
179 | skb->mac.raw = skb->data; | 179 | skb_reset_mac_header(skb); |
180 | skb_pull(skb, header); | 180 | skb_pull(skb, header); |
181 | dlp->stats.rx_bytes += skb->len; | 181 | dlp->stats.rx_bytes += skb->len; |
182 | netif_rx(skb); | 182 | netif_rx(skb); |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 25021a7992a9..dca024471455 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -1904,7 +1904,8 @@ static struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv) | |||
1904 | struct TxFD *tx_fd = dpriv->tx_fd + last; | 1904 | struct TxFD *tx_fd = dpriv->tx_fd + last; |
1905 | 1905 | ||
1906 | skb->len = DUMMY_SKB_SIZE; | 1906 | skb->len = DUMMY_SKB_SIZE; |
1907 | memcpy(skb->data, version, strlen(version)%DUMMY_SKB_SIZE); | 1907 | skb_copy_to_linear_data(skb, version, |
1908 | strlen(version) % DUMMY_SKB_SIZE); | ||
1908 | tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE); | 1909 | tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE); |
1909 | tx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, | 1910 | tx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, |
1910 | DUMMY_SKB_SIZE, PCI_DMA_TODEVICE); | 1911 | DUMMY_SKB_SIZE, PCI_DMA_TODEVICE); |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index c45d6a83339d..58a53b6d9b42 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -864,7 +864,7 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, | |||
864 | static __be16 farsync_type_trans(struct sk_buff *skb, struct net_device *dev) | 864 | static __be16 farsync_type_trans(struct sk_buff *skb, struct net_device *dev) |
865 | { | 865 | { |
866 | skb->dev = dev; | 866 | skb->dev = dev; |
867 | skb->mac.raw = skb->data; | 867 | skb_reset_mac_header(skb); |
868 | skb->pkt_type = PACKET_HOST; | 868 | skb->pkt_type = PACKET_HOST; |
869 | return htons(ETH_P_CUST); | 869 | return htons(ETH_P_CUST); |
870 | } | 870 | } |
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index c9664fd8a917..00e0aaadabcc 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -124,7 +124,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type, | |||
124 | skb_put(skb, sizeof(struct cisco_packet)); | 124 | skb_put(skb, sizeof(struct cisco_packet)); |
125 | skb->priority = TC_PRIO_CONTROL; | 125 | skb->priority = TC_PRIO_CONTROL; |
126 | skb->dev = dev; | 126 | skb->dev = dev; |
127 | skb->nh.raw = skb->data; | 127 | skb_reset_network_header(skb); |
128 | 128 | ||
129 | dev_queue_xmit(skb); | 129 | dev_queue_xmit(skb); |
130 | } | 130 | } |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index c6c3c757d6f1..aeb2789adf26 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -533,7 +533,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) | |||
533 | skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI); | 533 | skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI); |
534 | fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); | 534 | fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); |
535 | } | 535 | } |
536 | data = skb->tail; | 536 | data = skb_tail_pointer(skb); |
537 | data[i++] = LMI_CALLREF; | 537 | data[i++] = LMI_CALLREF; |
538 | data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; | 538 | data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; |
539 | if (lmi == LMI_ANSI) | 539 | if (lmi == LMI_ANSI) |
@@ -590,7 +590,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) | |||
590 | skb_put(skb, i); | 590 | skb_put(skb, i); |
591 | skb->priority = TC_PRIO_CONTROL; | 591 | skb->priority = TC_PRIO_CONTROL; |
592 | skb->dev = dev; | 592 | skb->dev = dev; |
593 | skb->nh.raw = skb->data; | 593 | skb_reset_network_header(skb); |
594 | 594 | ||
595 | dev_queue_xmit(skb); | 595 | dev_queue_xmit(skb); |
596 | } | 596 | } |
@@ -1011,7 +1011,6 @@ static int fr_rx(struct sk_buff *skb) | |||
1011 | stats->rx_bytes += skb->len; | 1011 | stats->rx_bytes += skb->len; |
1012 | if (pvc->state.becn) | 1012 | if (pvc->state.becn) |
1013 | stats->rx_compressed++; | 1013 | stats->rx_compressed++; |
1014 | skb->dev = dev; | ||
1015 | netif_rx(skb); | 1014 | netif_rx(skb); |
1016 | return NET_RX_SUCCESS; | 1015 | return NET_RX_SUCCESS; |
1017 | } else { | 1016 | } else { |
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c index a02c5fb40567..9ba3e4ee6ec7 100644 --- a/drivers/net/wan/hostess_sv11.c +++ b/drivers/net/wan/hostess_sv11.c | |||
@@ -59,7 +59,7 @@ static void hostess_input(struct z8530_channel *c, struct sk_buff *skb) | |||
59 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ | 59 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ |
60 | skb_trim(skb, skb->len-2); | 60 | skb_trim(skb, skb->len-2); |
61 | skb->protocol=__constant_htons(ETH_P_WAN_PPP); | 61 | skb->protocol=__constant_htons(ETH_P_WAN_PPP); |
62 | skb->mac.raw=skb->data; | 62 | skb_reset_mac_header(skb); |
63 | skb->dev=c->netdevice; | 63 | skb->dev=c->netdevice; |
64 | /* | 64 | /* |
65 | * Send it to the PPP layer. We don't have time to process | 65 | * Send it to the PPP layer. We don't have time to process |
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index 2b54f1bc3a0d..ae132c1c5459 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -1636,7 +1636,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1636 | if (nsb) { | 1636 | if (nsb) { |
1637 | sc->lmc_rxq[i] = nsb; | 1637 | sc->lmc_rxq[i] = nsb; |
1638 | nsb->dev = dev; | 1638 | nsb->dev = dev; |
1639 | sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail); | 1639 | sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb)); |
1640 | } | 1640 | } |
1641 | sc->failed_recv_alloc = 1; | 1641 | sc->failed_recv_alloc = 1; |
1642 | goto skip_packet; | 1642 | goto skip_packet; |
@@ -1667,8 +1667,8 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1667 | skb_put (skb, len); | 1667 | skb_put (skb, len); |
1668 | skb->protocol = lmc_proto_type(sc, skb); | 1668 | skb->protocol = lmc_proto_type(sc, skb); |
1669 | skb->protocol = htons(ETH_P_WAN_PPP); | 1669 | skb->protocol = htons(ETH_P_WAN_PPP); |
1670 | skb->mac.raw = skb->data; | 1670 | skb_reset_mac_header(skb); |
1671 | // skb->nh.raw = skb->data; | 1671 | /* skb_reset_network_header(skb); */ |
1672 | skb->dev = dev; | 1672 | skb->dev = dev; |
1673 | lmc_proto_netif(sc, skb); | 1673 | lmc_proto_netif(sc, skb); |
1674 | 1674 | ||
@@ -1679,7 +1679,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1679 | if (nsb) { | 1679 | if (nsb) { |
1680 | sc->lmc_rxq[i] = nsb; | 1680 | sc->lmc_rxq[i] = nsb; |
1681 | nsb->dev = dev; | 1681 | nsb->dev = dev; |
1682 | sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail); | 1682 | sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb)); |
1683 | /* Transferred to 21140 below */ | 1683 | /* Transferred to 21140 below */ |
1684 | } | 1684 | } |
1685 | else { | 1685 | else { |
@@ -1702,11 +1702,11 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1702 | if(!nsb) { | 1702 | if(!nsb) { |
1703 | goto give_it_anyways; | 1703 | goto give_it_anyways; |
1704 | } | 1704 | } |
1705 | memcpy(skb_put(nsb, len), skb->data, len); | 1705 | skb_copy_from_linear_data(skb, skb_put(nsb, len), len); |
1706 | 1706 | ||
1707 | nsb->protocol = lmc_proto_type(sc, skb); | 1707 | nsb->protocol = lmc_proto_type(sc, skb); |
1708 | nsb->mac.raw = nsb->data; | 1708 | skb_reset_mac_header(nsb); |
1709 | // nsb->nh.raw = nsb->data; | 1709 | /* skb_reset_network_header(nsb); */ |
1710 | nsb->dev = dev; | 1710 | nsb->dev = dev; |
1711 | lmc_proto_netif(sc, nsb); | 1711 | lmc_proto_netif(sc, nsb); |
1712 | } | 1712 | } |
@@ -1932,7 +1932,7 @@ static void lmc_softreset (lmc_softc_t * const sc) /*fold00*/ | |||
1932 | sc->lmc_rxring[i].status = 0x80000000; | 1932 | sc->lmc_rxring[i].status = 0x80000000; |
1933 | 1933 | ||
1934 | /* used to be PKT_BUF_SZ now uses skb since we lose some to head room */ | 1934 | /* used to be PKT_BUF_SZ now uses skb since we lose some to head room */ |
1935 | sc->lmc_rxring[i].length = skb->end - skb->data; | 1935 | sc->lmc_rxring[i].length = skb_tailroom(skb); |
1936 | 1936 | ||
1937 | /* use to be tail which is dumb since you're thinking why write | 1937 | /* use to be tail which is dumb since you're thinking why write |
1938 | * to the end of the packj,et but since there's nothing there tail == data | 1938 | * to the end of the packj,et but since there's nothing there tail == data |
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 62184dee377c..999bf71937ca 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c | |||
@@ -1755,17 +1755,17 @@ cpc_trace(struct net_device *dev, struct sk_buff *skb_main, char rx_tx) | |||
1755 | 1755 | ||
1756 | skb->dev = dev; | 1756 | skb->dev = dev; |
1757 | skb->protocol = htons(ETH_P_CUST); | 1757 | skb->protocol = htons(ETH_P_CUST); |
1758 | skb->mac.raw = skb->data; | 1758 | skb_reset_mac_header(skb); |
1759 | skb->pkt_type = PACKET_HOST; | 1759 | skb->pkt_type = PACKET_HOST; |
1760 | skb->len = 10 + skb_main->len; | 1760 | skb->len = 10 + skb_main->len; |
1761 | 1761 | ||
1762 | memcpy(skb->data, dev->name, 5); | 1762 | skb_copy_to_linear_data(skb, dev->name, 5); |
1763 | skb->data[5] = '['; | 1763 | skb->data[5] = '['; |
1764 | skb->data[6] = rx_tx; | 1764 | skb->data[6] = rx_tx; |
1765 | skb->data[7] = ']'; | 1765 | skb->data[7] = ']'; |
1766 | skb->data[8] = ':'; | 1766 | skb->data[8] = ':'; |
1767 | skb->data[9] = ' '; | 1767 | skb->data[9] = ' '; |
1768 | memcpy(&skb->data[10], skb_main->data, skb_main->len); | 1768 | skb_copy_from_linear_data(skb_main, &skb->data[10], skb_main->len); |
1769 | 1769 | ||
1770 | netif_rx(skb); | 1770 | netif_rx(skb); |
1771 | } | 1771 | } |
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index 5873c346e7e9..07dbdfbfc15d 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c | |||
@@ -1003,17 +1003,17 @@ static void cpc_tty_trace(pc300dev_t *dev, char* buf, int len, char rxtx) | |||
1003 | skb_put (skb, 10 + len); | 1003 | skb_put (skb, 10 + len); |
1004 | skb->dev = dev->dev; | 1004 | skb->dev = dev->dev; |
1005 | skb->protocol = htons(ETH_P_CUST); | 1005 | skb->protocol = htons(ETH_P_CUST); |
1006 | skb->mac.raw = skb->data; | 1006 | skb_reset_mac_header(skb); |
1007 | skb->pkt_type = PACKET_HOST; | 1007 | skb->pkt_type = PACKET_HOST; |
1008 | skb->len = 10 + len; | 1008 | skb->len = 10 + len; |
1009 | 1009 | ||
1010 | memcpy(skb->data,dev->dev->name,5); | 1010 | skb_copy_to_linear_data(skb, dev->dev->name, 5); |
1011 | skb->data[5] = '['; | 1011 | skb->data[5] = '['; |
1012 | skb->data[6] = rxtx; | 1012 | skb->data[6] = rxtx; |
1013 | skb->data[7] = ']'; | 1013 | skb->data[7] = ']'; |
1014 | skb->data[8] = ':'; | 1014 | skb->data[8] = ':'; |
1015 | skb->data[9] = ' '; | 1015 | skb->data[9] = ' '; |
1016 | memcpy(&skb->data[10], buf, len); | 1016 | skb_copy_to_linear_data_offset(skb, 10, buf, len); |
1017 | netif_rx(skb); | 1017 | netif_rx(skb); |
1018 | } | 1018 | } |
1019 | 1019 | ||
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index fc5c0c611ffd..35eded7ffb2d 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c | |||
@@ -999,11 +999,6 @@ get_rx_buf( struct net_device *dev ) | |||
999 | if( !skb ) | 999 | if( !skb ) |
1000 | return NULL; | 1000 | return NULL; |
1001 | 1001 | ||
1002 | #ifdef CONFIG_SBNI_MULTILINE | ||
1003 | skb->dev = ((struct net_local *) dev->priv)->master; | ||
1004 | #else | ||
1005 | skb->dev = dev; | ||
1006 | #endif | ||
1007 | skb_reserve( skb, 2 ); /* Align IP on longword boundaries */ | 1002 | skb_reserve( skb, 2 ); /* Align IP on longword boundaries */ |
1008 | return skb; | 1003 | return skb; |
1009 | } | 1004 | } |
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c index 70fb1b98b1dd..131358108c5a 100644 --- a/drivers/net/wan/sealevel.c +++ b/drivers/net/wan/sealevel.c | |||
@@ -61,7 +61,7 @@ static void sealevel_input(struct z8530_channel *c, struct sk_buff *skb) | |||
61 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ | 61 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ |
62 | skb_trim(skb, skb->len-2); | 62 | skb_trim(skb, skb->len-2); |
63 | skb->protocol=htons(ETH_P_WAN_PPP); | 63 | skb->protocol=htons(ETH_P_WAN_PPP); |
64 | skb->mac.raw=skb->data; | 64 | skb_reset_mac_header(skb); |
65 | skb->dev=c->netdevice; | 65 | skb->dev=c->netdevice; |
66 | /* | 66 | /* |
67 | * Send it to the PPP layer. We don't have time to process | 67 | * Send it to the PPP layer. We don't have time to process |
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 218f7b574ab3..67fc67cfd452 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -227,7 +227,7 @@ static void sppp_input (struct net_device *dev, struct sk_buff *skb) | |||
227 | unsigned long flags; | 227 | unsigned long flags; |
228 | 228 | ||
229 | skb->dev=dev; | 229 | skb->dev=dev; |
230 | skb->mac.raw=skb->data; | 230 | skb_reset_mac_header(skb); |
231 | 231 | ||
232 | if (dev->flags & IFF_RUNNING) | 232 | if (dev->flags & IFF_RUNNING) |
233 | { | 233 | { |
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c index 8b4540bfc1b0..98ef400908b8 100644 --- a/drivers/net/wan/z85230.c +++ b/drivers/net/wan/z85230.c | |||
@@ -1656,7 +1656,7 @@ static void z8530_rx_done(struct z8530_channel *c) | |||
1656 | else | 1656 | else |
1657 | { | 1657 | { |
1658 | skb_put(skb, ct); | 1658 | skb_put(skb, ct); |
1659 | memcpy(skb->data, rxb, ct); | 1659 | skb_copy_to_linear_data(skb, rxb, ct); |
1660 | c->stats.rx_packets++; | 1660 | c->stats.rx_packets++; |
1661 | c->stats.rx_bytes+=ct; | 1661 | c->stats.rx_bytes+=ct; |
1662 | } | 1662 | } |
@@ -1782,7 +1782,7 @@ int z8530_queue_xmit(struct z8530_channel *c, struct sk_buff *skb) | |||
1782 | */ | 1782 | */ |
1783 | c->tx_next_ptr=c->tx_dma_buf[c->tx_dma_used]; | 1783 | c->tx_next_ptr=c->tx_dma_buf[c->tx_dma_used]; |
1784 | c->tx_dma_used^=1; /* Flip temp buffer */ | 1784 | c->tx_dma_used^=1; /* Flip temp buffer */ |
1785 | memcpy(c->tx_next_ptr, skb->data, skb->len); | 1785 | skb_copy_from_linear_data(skb, c->tx_next_ptr, skb->len); |
1786 | } | 1786 | } |
1787 | else | 1787 | else |
1788 | c->tx_next_ptr=skb->data; | 1788 | c->tx_next_ptr=skb->data; |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index ece3d9c2dc61..4426841b2be6 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -2,47 +2,21 @@ | |||
2 | # Wireless LAN device configuration | 2 | # Wireless LAN device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menu "Wireless LAN (non-hamradio)" | 5 | menu "Wireless LAN" |
6 | depends on NETDEVICES | ||
7 | |||
8 | config NET_RADIO | ||
9 | bool "Wireless LAN drivers (non-hamradio) & Wireless Extensions" | ||
10 | select WIRELESS_EXT | ||
11 | ---help--- | ||
12 | Support for wireless LANs and everything having to do with radio, | ||
13 | but not with amateur radio or FM broadcasting. | ||
14 | |||
15 | Saying Y here also enables the Wireless Extensions (creates | ||
16 | /proc/net/wireless and enables iwconfig access). The Wireless | ||
17 | Extension is a generic API allowing a driver to expose to the user | ||
18 | space configuration and statistics specific to common Wireless LANs. | ||
19 | The beauty of it is that a single set of tool can support all the | ||
20 | variations of Wireless LANs, regardless of their type (as long as | ||
21 | the driver supports Wireless Extension). Another advantage is that | ||
22 | these parameters may be changed on the fly without restarting the | ||
23 | driver (or Linux). If you wish to use Wireless Extensions with | ||
24 | wireless PCMCIA (PC-) cards, you need to say Y here; you can fetch | ||
25 | the tools from | ||
26 | <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. | ||
27 | 6 | ||
28 | config NET_WIRELESS_RTNETLINK | 7 | config WLAN_PRE80211 |
29 | bool "Wireless Extension API over RtNetlink" | 8 | bool "Wireless LAN (pre-802.11)" |
30 | depends on NET_RADIO | 9 | depends on NETDEVICES |
31 | ---help--- | 10 | ---help--- |
32 | Support the Wireless Extension API over the RtNetlink socket | 11 | Say Y if you have any pre-802.11 wireless LAN hardware. |
33 | in addition to the traditional ioctl interface (selected above). | ||
34 | 12 | ||
35 | For now, few tools use this facility, but it might grow in the | 13 | This option does not affect the kernel build, it only |
36 | future. The only downside is that it adds 4.5 kB to your kernel. | 14 | lets you choose drivers. |
37 | |||
38 | # Note : the cards are obsolete (can't buy them anymore), but the drivers | ||
39 | # are not, as people are still using them... | ||
40 | comment "Obsolete Wireless cards support (pre-802.11)" | ||
41 | depends on NET_RADIO && (INET || ISA || PCMCIA) | ||
42 | 15 | ||
43 | config STRIP | 16 | config STRIP |
44 | tristate "STRIP (Metricom starmode radio IP)" | 17 | tristate "STRIP (Metricom starmode radio IP)" |
45 | depends on NET_RADIO && INET | 18 | depends on INET && WLAN_PRE80211 |
19 | select WIRELESS_EXT | ||
46 | ---help--- | 20 | ---help--- |
47 | Say Y if you have a Metricom radio and intend to use Starmode Radio | 21 | Say Y if you have a Metricom radio and intend to use Starmode Radio |
48 | IP. STRIP is a radio protocol developed for the MosquitoNet project | 22 | IP. STRIP is a radio protocol developed for the MosquitoNet project |
@@ -65,7 +39,8 @@ config STRIP | |||
65 | 39 | ||
66 | config ARLAN | 40 | config ARLAN |
67 | tristate "Aironet Arlan 655 & IC2200 DS support" | 41 | tristate "Aironet Arlan 655 & IC2200 DS support" |
68 | depends on NET_RADIO && ISA && !64BIT | 42 | depends on ISA && !64BIT && WLAN_PRE80211 |
43 | select WIRELESS_EXT | ||
69 | ---help--- | 44 | ---help--- |
70 | Aironet makes Arlan, a class of wireless LAN adapters. These use the | 45 | Aironet makes Arlan, a class of wireless LAN adapters. These use the |
71 | www.Telxon.com chip, which is also used on several similar cards. | 46 | www.Telxon.com chip, which is also used on several similar cards. |
@@ -80,7 +55,8 @@ config ARLAN | |||
80 | 55 | ||
81 | config WAVELAN | 56 | config WAVELAN |
82 | tristate "AT&T/Lucent old WaveLAN & DEC RoamAbout DS ISA support" | 57 | tristate "AT&T/Lucent old WaveLAN & DEC RoamAbout DS ISA support" |
83 | depends on NET_RADIO && ISA | 58 | depends on ISA && WLAN_PRE80211 |
59 | select WIRELESS_EXT | ||
84 | ---help--- | 60 | ---help--- |
85 | The Lucent WaveLAN (formerly NCR and AT&T; or DEC RoamAbout DS) is | 61 | The Lucent WaveLAN (formerly NCR and AT&T; or DEC RoamAbout DS) is |
86 | a Radio LAN (wireless Ethernet-like Local Area Network) using the | 62 | a Radio LAN (wireless Ethernet-like Local Area Network) using the |
@@ -107,7 +83,8 @@ config WAVELAN | |||
107 | 83 | ||
108 | config PCMCIA_WAVELAN | 84 | config PCMCIA_WAVELAN |
109 | tristate "AT&T/Lucent old WaveLAN Pcmcia wireless support" | 85 | tristate "AT&T/Lucent old WaveLAN Pcmcia wireless support" |
110 | depends on NET_RADIO && PCMCIA | 86 | depends on PCMCIA && WLAN_PRE80211 |
87 | select WIRELESS_EXT | ||
111 | help | 88 | help |
112 | Say Y here if you intend to attach an AT&T/Lucent Wavelan PCMCIA | 89 | Say Y here if you intend to attach an AT&T/Lucent Wavelan PCMCIA |
113 | (PC-card) wireless Ethernet networking card to your computer. This | 90 | (PC-card) wireless Ethernet networking card to your computer. This |
@@ -118,7 +95,8 @@ config PCMCIA_WAVELAN | |||
118 | 95 | ||
119 | config PCMCIA_NETWAVE | 96 | config PCMCIA_NETWAVE |
120 | tristate "Xircom Netwave AirSurfer Pcmcia wireless support" | 97 | tristate "Xircom Netwave AirSurfer Pcmcia wireless support" |
121 | depends on NET_RADIO && PCMCIA | 98 | depends on PCMCIA && WLAN_PRE80211 |
99 | select WIRELESS_EXT | ||
122 | help | 100 | help |
123 | Say Y here if you intend to attach this type of PCMCIA (PC-card) | 101 | Say Y here if you intend to attach this type of PCMCIA (PC-card) |
124 | wireless Ethernet networking card to your computer. | 102 | wireless Ethernet networking card to your computer. |
@@ -126,12 +104,20 @@ config PCMCIA_NETWAVE | |||
126 | To compile this driver as a module, choose M here: the module will be | 104 | To compile this driver as a module, choose M here: the module will be |
127 | called netwave_cs. If unsure, say N. | 105 | called netwave_cs. If unsure, say N. |
128 | 106 | ||
129 | comment "Wireless 802.11 Frequency Hopping cards support" | 107 | |
130 | depends on NET_RADIO && PCMCIA | 108 | config WLAN_80211 |
109 | bool "Wireless LAN (IEEE 802.11)" | ||
110 | depends on NETDEVICES | ||
111 | ---help--- | ||
112 | Say Y if you have any 802.11 wireless LAN hardware. | ||
113 | |||
114 | This option does not affect the kernel build, it only | ||
115 | lets you choose drivers. | ||
131 | 116 | ||
132 | config PCMCIA_RAYCS | 117 | config PCMCIA_RAYCS |
133 | tristate "Aviator/Raytheon 2.4MHz wireless support" | 118 | tristate "Aviator/Raytheon 2.4MHz wireless support" |
134 | depends on NET_RADIO && PCMCIA | 119 | depends on PCMCIA && WLAN_80211 |
120 | select WIRELESS_EXT | ||
135 | ---help--- | 121 | ---help--- |
136 | Say Y here if you intend to attach an Aviator/Raytheon PCMCIA | 122 | Say Y here if you intend to attach an Aviator/Raytheon PCMCIA |
137 | (PC-card) wireless Ethernet networking card to your computer. | 123 | (PC-card) wireless Ethernet networking card to your computer. |
@@ -141,12 +127,10 @@ config PCMCIA_RAYCS | |||
141 | To compile this driver as a module, choose M here: the module will be | 127 | To compile this driver as a module, choose M here: the module will be |
142 | called ray_cs. If unsure, say N. | 128 | called ray_cs. If unsure, say N. |
143 | 129 | ||
144 | comment "Wireless 802.11b ISA/PCI cards support" | ||
145 | depends on NET_RADIO && (ISA || PCI || PPC_PMAC || PCMCIA) | ||
146 | |||
147 | config IPW2100 | 130 | config IPW2100 |
148 | tristate "Intel PRO/Wireless 2100 Network Connection" | 131 | tristate "Intel PRO/Wireless 2100 Network Connection" |
149 | depends on NET_RADIO && PCI | 132 | depends on PCI && WLAN_80211 |
133 | select WIRELESS_EXT | ||
150 | select FW_LOADER | 134 | select FW_LOADER |
151 | select IEEE80211 | 135 | select IEEE80211 |
152 | ---help--- | 136 | ---help--- |
@@ -200,7 +184,8 @@ config IPW2100_DEBUG | |||
200 | 184 | ||
201 | config IPW2200 | 185 | config IPW2200 |
202 | tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection" | 186 | tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection" |
203 | depends on NET_RADIO && PCI | 187 | depends on PCI && WLAN_80211 |
188 | select WIRELESS_EXT | ||
204 | select FW_LOADER | 189 | select FW_LOADER |
205 | select IEEE80211 | 190 | select IEEE80211 |
206 | ---help--- | 191 | ---help--- |
@@ -282,7 +267,8 @@ config IPW2200_DEBUG | |||
282 | 267 | ||
283 | config AIRO | 268 | config AIRO |
284 | tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" | 269 | tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" |
285 | depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN) | 270 | depends on ISA_DMA_API && WLAN_80211 && (PCI || BROKEN) |
271 | select WIRELESS_EXT | ||
286 | select CRYPTO | 272 | select CRYPTO |
287 | ---help--- | 273 | ---help--- |
288 | This is the standard Linux driver to support Cisco/Aironet ISA and | 274 | This is the standard Linux driver to support Cisco/Aironet ISA and |
@@ -299,7 +285,8 @@ config AIRO | |||
299 | 285 | ||
300 | config HERMES | 286 | config HERMES |
301 | tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)" | 287 | tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)" |
302 | depends on NET_RADIO && (PPC_PMAC || PCI || PCMCIA) | 288 | depends on (PPC_PMAC || PCI || PCMCIA) && WLAN_80211 |
289 | select WIRELESS_EXT | ||
303 | ---help--- | 290 | ---help--- |
304 | A driver for 802.11b wireless cards based on the "Hermes" or | 291 | A driver for 802.11b wireless cards based on the "Hermes" or |
305 | Intersil HFA384x (Prism 2) MAC controller. This includes the vast | 292 | Intersil HFA384x (Prism 2) MAC controller. This includes the vast |
@@ -373,7 +360,8 @@ config PCI_HERMES | |||
373 | 360 | ||
374 | config ATMEL | 361 | config ATMEL |
375 | tristate "Atmel at76c50x chipset 802.11b support" | 362 | tristate "Atmel at76c50x chipset 802.11b support" |
376 | depends on NET_RADIO && (PCI || PCMCIA) | 363 | depends on (PCI || PCMCIA) && WLAN_80211 |
364 | select WIRELESS_EXT | ||
377 | select FW_LOADER | 365 | select FW_LOADER |
378 | select CRC32 | 366 | select CRC32 |
379 | ---help--- | 367 | ---help--- |
@@ -394,13 +382,9 @@ config PCI_ATMEL | |||
394 | Enable support for PCI and mini-PCI cards containing the | 382 | Enable support for PCI and mini-PCI cards containing the |
395 | Atmel at76c506 chip. | 383 | Atmel at76c506 chip. |
396 | 384 | ||
397 | # If Pcmcia is compiled in, offer Pcmcia cards... | ||
398 | comment "Wireless 802.11b Pcmcia/Cardbus cards support" | ||
399 | depends on NET_RADIO && PCMCIA | ||
400 | |||
401 | config PCMCIA_HERMES | 385 | config PCMCIA_HERMES |
402 | tristate "Hermes PCMCIA card support" | 386 | tristate "Hermes PCMCIA card support" |
403 | depends on NET_RADIO && PCMCIA && HERMES | 387 | depends on PCMCIA && HERMES |
404 | ---help--- | 388 | ---help--- |
405 | A driver for "Hermes" chipset based PCMCIA wireless adaptors, such | 389 | A driver for "Hermes" chipset based PCMCIA wireless adaptors, such |
406 | as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/ | 390 | as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/ |
@@ -420,7 +404,7 @@ config PCMCIA_HERMES | |||
420 | 404 | ||
421 | config PCMCIA_SPECTRUM | 405 | config PCMCIA_SPECTRUM |
422 | tristate "Symbol Spectrum24 Trilogy PCMCIA card support" | 406 | tristate "Symbol Spectrum24 Trilogy PCMCIA card support" |
423 | depends on NET_RADIO && PCMCIA && HERMES | 407 | depends on PCMCIA && HERMES |
424 | select FW_LOADER | 408 | select FW_LOADER |
425 | ---help--- | 409 | ---help--- |
426 | 410 | ||
@@ -434,7 +418,8 @@ config PCMCIA_SPECTRUM | |||
434 | 418 | ||
435 | config AIRO_CS | 419 | config AIRO_CS |
436 | tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" | 420 | tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" |
437 | depends on NET_RADIO && PCMCIA && (BROKEN || !M32R) | 421 | depends on PCMCIA && (BROKEN || !M32R) && WLAN_80211 |
422 | select WIRELESS_EXT | ||
438 | select CRYPTO | 423 | select CRYPTO |
439 | select CRYPTO_AES | 424 | select CRYPTO_AES |
440 | ---help--- | 425 | ---help--- |
@@ -458,7 +443,8 @@ config AIRO_CS | |||
458 | 443 | ||
459 | config PCMCIA_ATMEL | 444 | config PCMCIA_ATMEL |
460 | tristate "Atmel at76c502/at76c504 PCMCIA cards" | 445 | tristate "Atmel at76c502/at76c504 PCMCIA cards" |
461 | depends on NET_RADIO && ATMEL && PCMCIA | 446 | depends on ATMEL && PCMCIA |
447 | select WIRELESS_EXT | ||
462 | select FW_LOADER | 448 | select FW_LOADER |
463 | select CRC32 | 449 | select CRC32 |
464 | ---help--- | 450 | ---help--- |
@@ -467,17 +453,17 @@ config PCMCIA_ATMEL | |||
467 | 453 | ||
468 | config PCMCIA_WL3501 | 454 | config PCMCIA_WL3501 |
469 | tristate "Planet WL3501 PCMCIA cards" | 455 | tristate "Planet WL3501 PCMCIA cards" |
470 | depends on NET_RADIO && EXPERIMENTAL && PCMCIA | 456 | depends on EXPERIMENTAL && PCMCIA && WLAN_80211 |
457 | select WIRELESS_EXT | ||
471 | ---help--- | 458 | ---help--- |
472 | A driver for WL3501 PCMCIA 802.11 wireless cards made by Planet. | 459 | A driver for WL3501 PCMCIA 802.11 wireless cards made by Planet. |
473 | It has basic support for Linux wireless extensions and initial | 460 | It has basic support for Linux wireless extensions and initial |
474 | micro support for ethtool. | 461 | micro support for ethtool. |
475 | 462 | ||
476 | comment "Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support" | ||
477 | depends on NET_RADIO && PCI | ||
478 | config PRISM54 | 463 | config PRISM54 |
479 | tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus' | 464 | tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus' |
480 | depends on PCI && NET_RADIO && EXPERIMENTAL | 465 | depends on PCI && EXPERIMENTAL && WLAN_80211 |
466 | select WIRELESS_EXT | ||
481 | select FW_LOADER | 467 | select FW_LOADER |
482 | ---help--- | 468 | ---help--- |
483 | Enable PCI and Cardbus support for the following chipset based cards: | 469 | Enable PCI and Cardbus support for the following chipset based cards: |
@@ -523,7 +509,8 @@ config PRISM54 | |||
523 | 509 | ||
524 | config USB_ZD1201 | 510 | config USB_ZD1201 |
525 | tristate "USB ZD1201 based Wireless device support" | 511 | tristate "USB ZD1201 based Wireless device support" |
526 | depends on USB && NET_RADIO | 512 | depends on USB && WLAN_80211 |
513 | select WIRELESS_EXT | ||
527 | select FW_LOADER | 514 | select FW_LOADER |
528 | ---help--- | 515 | ---help--- |
529 | Say Y if you want to use wireless LAN adapters based on the ZyDAS | 516 | Say Y if you want to use wireless LAN adapters based on the ZyDAS |
@@ -542,11 +529,4 @@ source "drivers/net/wireless/hostap/Kconfig" | |||
542 | source "drivers/net/wireless/bcm43xx/Kconfig" | 529 | source "drivers/net/wireless/bcm43xx/Kconfig" |
543 | source "drivers/net/wireless/zd1211rw/Kconfig" | 530 | source "drivers/net/wireless/zd1211rw/Kconfig" |
544 | 531 | ||
545 | # yes, this works even when no drivers are selected | ||
546 | config NET_WIRELESS | ||
547 | bool | ||
548 | depends on NET_RADIO && (ISA || PCI || PPC_PMAC || PCMCIA) | ||
549 | default y | ||
550 | |||
551 | endmenu | 532 | endmenu |
552 | |||
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 2ada76a93cb6..7fe0a61091a6 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -2444,7 +2444,7 @@ static int add_airo_dev( struct net_device *dev ); | |||
2444 | 2444 | ||
2445 | static int wll_header_parse(struct sk_buff *skb, unsigned char *haddr) | 2445 | static int wll_header_parse(struct sk_buff *skb, unsigned char *haddr) |
2446 | { | 2446 | { |
2447 | memcpy(haddr, skb->mac.raw + 10, ETH_ALEN); | 2447 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); |
2448 | return ETH_ALEN; | 2448 | return ETH_ALEN; |
2449 | } | 2449 | } |
2450 | 2450 | ||
@@ -3411,14 +3411,12 @@ badrx: | |||
3411 | OUT4500( apriv, EVACK, EV_RX); | 3411 | OUT4500( apriv, EVACK, EV_RX); |
3412 | 3412 | ||
3413 | if (test_bit(FLAG_802_11, &apriv->flags)) { | 3413 | if (test_bit(FLAG_802_11, &apriv->flags)) { |
3414 | skb->mac.raw = skb->data; | 3414 | skb_reset_mac_header(skb); |
3415 | skb->pkt_type = PACKET_OTHERHOST; | 3415 | skb->pkt_type = PACKET_OTHERHOST; |
3416 | skb->dev = apriv->wifidev; | 3416 | skb->dev = apriv->wifidev; |
3417 | skb->protocol = htons(ETH_P_802_2); | 3417 | skb->protocol = htons(ETH_P_802_2); |
3418 | } else { | 3418 | } else |
3419 | skb->dev = dev; | ||
3420 | skb->protocol = eth_type_trans(skb,dev); | 3419 | skb->protocol = eth_type_trans(skb,dev); |
3421 | } | ||
3422 | skb->dev->last_rx = jiffies; | 3420 | skb->dev->last_rx = jiffies; |
3423 | skb->ip_summed = CHECKSUM_NONE; | 3421 | skb->ip_summed = CHECKSUM_NONE; |
3424 | 3422 | ||
@@ -3641,7 +3639,6 @@ badmic: | |||
3641 | } | 3639 | } |
3642 | #endif /* WIRELESS_SPY */ | 3640 | #endif /* WIRELESS_SPY */ |
3643 | 3641 | ||
3644 | skb->dev = ai->dev; | ||
3645 | skb->ip_summed = CHECKSUM_NONE; | 3642 | skb->ip_summed = CHECKSUM_NONE; |
3646 | skb->protocol = eth_type_trans(skb, ai->dev); | 3643 | skb->protocol = eth_type_trans(skb, ai->dev); |
3647 | skb->dev->last_rx = jiffies; | 3644 | skb->dev->last_rx = jiffies; |
@@ -3749,7 +3746,7 @@ void mpi_receive_802_11 (struct airo_info *ai) | |||
3749 | wireless_spy_update(ai->dev, sa, &wstats); | 3746 | wireless_spy_update(ai->dev, sa, &wstats); |
3750 | } | 3747 | } |
3751 | #endif /* IW_WIRELESS_SPY */ | 3748 | #endif /* IW_WIRELESS_SPY */ |
3752 | skb->mac.raw = skb->data; | 3749 | skb_reset_mac_header(skb); |
3753 | skb->pkt_type = PACKET_OTHERHOST; | 3750 | skb->pkt_type = PACKET_OTHERHOST; |
3754 | skb->dev = ai->wifidev; | 3751 | skb->dev = ai->wifidev; |
3755 | skb->protocol = htons(ETH_P_802_2); | 3752 | skb->protocol = htons(ETH_P_802_2); |
diff --git a/drivers/net/wireless/arlan-main.c b/drivers/net/wireless/arlan-main.c index 4688e56b69c7..498e8486d125 100644 --- a/drivers/net/wireless/arlan-main.c +++ b/drivers/net/wireless/arlan-main.c | |||
@@ -1500,7 +1500,6 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short | |||
1500 | break; | 1500 | break; |
1501 | } | 1501 | } |
1502 | skb_reserve(skb, 2); | 1502 | skb_reserve(skb, 2); |
1503 | skb->dev = dev; | ||
1504 | skbtmp = skb_put(skb, pkt_len); | 1503 | skbtmp = skb_put(skb, pkt_len); |
1505 | 1504 | ||
1506 | memcpy_fromio(skbtmp + ARLAN_FAKE_HDR_LEN, ((char __iomem *) arlan) + rxOffset, pkt_len - ARLAN_FAKE_HDR_LEN); | 1505 | memcpy_fromio(skbtmp + ARLAN_FAKE_HDR_LEN, ((char __iomem *) arlan) + rxOffset, pkt_len - ARLAN_FAKE_HDR_LEN); |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 23eba698aec5..51a7db53afa5 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -827,14 +827,14 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev) | |||
827 | if (priv->wep_is_on) | 827 | if (priv->wep_is_on) |
828 | frame_ctl |= IEEE80211_FCTL_PROTECTED; | 828 | frame_ctl |= IEEE80211_FCTL_PROTECTED; |
829 | if (priv->operating_mode == IW_MODE_ADHOC) { | 829 | if (priv->operating_mode == IW_MODE_ADHOC) { |
830 | memcpy(&header.addr1, skb->data, 6); | 830 | skb_copy_from_linear_data(skb, &header.addr1, 6); |
831 | memcpy(&header.addr2, dev->dev_addr, 6); | 831 | memcpy(&header.addr2, dev->dev_addr, 6); |
832 | memcpy(&header.addr3, priv->BSSID, 6); | 832 | memcpy(&header.addr3, priv->BSSID, 6); |
833 | } else { | 833 | } else { |
834 | frame_ctl |= IEEE80211_FCTL_TODS; | 834 | frame_ctl |= IEEE80211_FCTL_TODS; |
835 | memcpy(&header.addr1, priv->CurrentBSSID, 6); | 835 | memcpy(&header.addr1, priv->CurrentBSSID, 6); |
836 | memcpy(&header.addr2, dev->dev_addr, 6); | 836 | memcpy(&header.addr2, dev->dev_addr, 6); |
837 | memcpy(&header.addr3, skb->data, 6); | 837 | skb_copy_from_linear_data(skb, &header.addr3, 6); |
838 | } | 838 | } |
839 | 839 | ||
840 | if (priv->use_wpa) | 840 | if (priv->use_wpa) |
@@ -920,7 +920,6 @@ static void fast_rx_path(struct atmel_private *priv, | |||
920 | memcpy(&skbp[6], header->addr2, 6); /* source address */ | 920 | memcpy(&skbp[6], header->addr2, 6); /* source address */ |
921 | 921 | ||
922 | priv->dev->last_rx = jiffies; | 922 | priv->dev->last_rx = jiffies; |
923 | skb->dev = priv->dev; | ||
924 | skb->protocol = eth_type_trans(skb, priv->dev); | 923 | skb->protocol = eth_type_trans(skb, priv->dev); |
925 | skb->ip_summed = CHECKSUM_NONE; | 924 | skb->ip_summed = CHECKSUM_NONE; |
926 | netif_rx(skb); | 925 | netif_rx(skb); |
@@ -1028,7 +1027,6 @@ static void frag_rx_path(struct atmel_private *priv, | |||
1028 | priv->rx_buf, | 1027 | priv->rx_buf, |
1029 | priv->frag_len + 12); | 1028 | priv->frag_len + 12); |
1030 | priv->dev->last_rx = jiffies; | 1029 | priv->dev->last_rx = jiffies; |
1031 | skb->dev = priv->dev; | ||
1032 | skb->protocol = eth_type_trans(skb, priv->dev); | 1030 | skb->protocol = eth_type_trans(skb, priv->dev); |
1033 | skb->ip_summed = CHECKSUM_NONE; | 1031 | skb->ip_summed = CHECKSUM_NONE; |
1034 | netif_rx(skb); | 1032 | netif_rx(skb); |
diff --git a/drivers/net/wireless/bcm43xx/Kconfig b/drivers/net/wireless/bcm43xx/Kconfig index 533993f538fc..ce397e4284f4 100644 --- a/drivers/net/wireless/bcm43xx/Kconfig +++ b/drivers/net/wireless/bcm43xx/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config BCM43XX | 1 | config BCM43XX |
2 | tristate "Broadcom BCM43xx wireless support" | 2 | tristate "Broadcom BCM43xx wireless support" |
3 | depends on PCI && IEEE80211 && IEEE80211_SOFTMAC && NET_RADIO && EXPERIMENTAL | 3 | depends on PCI && IEEE80211 && IEEE80211_SOFTMAC && WLAN_80211 && EXPERIMENTAL |
4 | select WIRELESS_EXT | ||
4 | select FW_LOADER | 5 | select FW_LOADER |
5 | select HW_RANDOM | 6 | select HW_RANDOM |
6 | ---help--- | 7 | ---help--- |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c index 6e0dc76400e5..e3d2e61a31ee 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c | |||
@@ -998,7 +998,8 @@ static void dma_tx_fragment(struct bcm43xx_dmaring *ring, | |||
998 | assert(0); | 998 | assert(0); |
999 | return; | 999 | return; |
1000 | } | 1000 | } |
1001 | memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len); | 1001 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, skb->len), |
1002 | skb->len); | ||
1002 | dev_kfree_skb_any(skb); | 1003 | dev_kfree_skb_any(skb); |
1003 | skb = bounce_skb; | 1004 | skb = bounce_skb; |
1004 | } | 1005 | } |
diff --git a/drivers/net/wireless/hostap/Kconfig b/drivers/net/wireless/hostap/Kconfig index 308f773ad566..1fef33169fdd 100644 --- a/drivers/net/wireless/hostap/Kconfig +++ b/drivers/net/wireless/hostap/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config HOSTAP | 1 | config HOSTAP |
2 | tristate "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)" | 2 | tristate "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)" |
3 | depends on NET_RADIO | 3 | depends on WLAN_80211 |
4 | select WIRELESS_EXT | ||
4 | select IEEE80211 | 5 | select IEEE80211 |
5 | select IEEE80211_CRYPT_WEP | 6 | select IEEE80211_CRYPT_WEP |
6 | ---help--- | 7 | ---help--- |
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index 7e04dc94b3bc..cbedc9ee740a 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -167,7 +167,7 @@ hdr->f.status = s; hdr->f.len = l; hdr->f.data = d | |||
167 | 167 | ||
168 | ret = skb->len - phdrlen; | 168 | ret = skb->len - phdrlen; |
169 | skb->dev = dev; | 169 | skb->dev = dev; |
170 | skb->mac.raw = skb->data; | 170 | skb_reset_mac_header(skb); |
171 | skb_pull(skb, hdrlen); | 171 | skb_pull(skb, hdrlen); |
172 | if (prism_header) | 172 | if (prism_header) |
173 | skb_pull(skb, phdrlen); | 173 | skb_pull(skb, phdrlen); |
@@ -933,12 +933,14 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
933 | if (frag == 0) { | 933 | if (frag == 0) { |
934 | /* copy first fragment (including full headers) into | 934 | /* copy first fragment (including full headers) into |
935 | * beginning of the fragment cache skb */ | 935 | * beginning of the fragment cache skb */ |
936 | memcpy(skb_put(frag_skb, flen), skb->data, flen); | 936 | skb_copy_from_linear_data(skb, skb_put(frag_skb, flen), |
937 | flen); | ||
937 | } else { | 938 | } else { |
938 | /* append frame payload to the end of the fragment | 939 | /* append frame payload to the end of the fragment |
939 | * cache skb */ | 940 | * cache skb */ |
940 | memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, | 941 | skb_copy_from_linear_data_offset(skb, hdrlen, |
941 | flen); | 942 | skb_put(frag_skb, |
943 | flen), flen); | ||
942 | } | 944 | } |
943 | dev_kfree_skb(skb); | 945 | dev_kfree_skb(skb); |
944 | skb = NULL; | 946 | skb = NULL; |
@@ -1044,8 +1046,9 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
1044 | skb->len >= ETH_HLEN + ETH_ALEN) { | 1046 | skb->len >= ETH_HLEN + ETH_ALEN) { |
1045 | /* Non-standard frame: get addr4 from its bogus location after | 1047 | /* Non-standard frame: get addr4 from its bogus location after |
1046 | * the payload */ | 1048 | * the payload */ |
1047 | memcpy(skb->data + ETH_ALEN, | 1049 | skb_copy_from_linear_data_offset(skb, skb->len - ETH_ALEN, |
1048 | skb->data + skb->len - ETH_ALEN, ETH_ALEN); | 1050 | skb->data + ETH_ALEN, |
1051 | ETH_ALEN); | ||
1049 | skb_trim(skb, skb->len - ETH_ALEN); | 1052 | skb_trim(skb, skb->len - ETH_ALEN); |
1050 | } | 1053 | } |
1051 | 1054 | ||
@@ -1073,17 +1076,17 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
1073 | 1076 | ||
1074 | if (skb2 != NULL) { | 1077 | if (skb2 != NULL) { |
1075 | /* send to wireless media */ | 1078 | /* send to wireless media */ |
1076 | skb2->protocol = __constant_htons(ETH_P_802_3); | ||
1077 | skb2->mac.raw = skb2->nh.raw = skb2->data; | ||
1078 | /* skb2->nh.raw = skb2->data + ETH_HLEN; */ | ||
1079 | skb2->dev = dev; | 1079 | skb2->dev = dev; |
1080 | skb2->protocol = __constant_htons(ETH_P_802_3); | ||
1081 | skb_reset_mac_header(skb2); | ||
1082 | skb_reset_network_header(skb2); | ||
1083 | /* skb2->network_header += ETH_HLEN; */ | ||
1080 | dev_queue_xmit(skb2); | 1084 | dev_queue_xmit(skb2); |
1081 | } | 1085 | } |
1082 | 1086 | ||
1083 | if (skb) { | 1087 | if (skb) { |
1084 | skb->protocol = eth_type_trans(skb, dev); | 1088 | skb->protocol = eth_type_trans(skb, dev); |
1085 | memset(skb->cb, 0, sizeof(skb->cb)); | 1089 | memset(skb->cb, 0, sizeof(skb->cb)); |
1086 | skb->dev = dev; | ||
1087 | netif_rx(skb); | 1090 | netif_rx(skb); |
1088 | } | 1091 | } |
1089 | 1092 | ||
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c index 4a5be70c0419..246fac0e8001 100644 --- a/drivers/net/wireless/hostap/hostap_80211_tx.c +++ b/drivers/net/wireless/hostap/hostap_80211_tx.c | |||
@@ -146,7 +146,8 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
146 | fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS; | 146 | fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS; |
147 | /* From&To DS: Addr1 = RA, Addr2 = TA, Addr3 = DA, | 147 | /* From&To DS: Addr1 = RA, Addr2 = TA, Addr3 = DA, |
148 | * Addr4 = SA */ | 148 | * Addr4 = SA */ |
149 | memcpy(&hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 149 | skb_copy_from_linear_data_offset(skb, ETH_ALEN, |
150 | &hdr.addr4, ETH_ALEN); | ||
150 | hdr_len += ETH_ALEN; | 151 | hdr_len += ETH_ALEN; |
151 | } else { | 152 | } else { |
152 | /* bogus 4-addr format to workaround Prism2 station | 153 | /* bogus 4-addr format to workaround Prism2 station |
@@ -159,7 +160,8 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
159 | /* SA from skb->data + ETH_ALEN will be added after | 160 | /* SA from skb->data + ETH_ALEN will be added after |
160 | * frame payload; use hdr.addr4 as a temporary buffer | 161 | * frame payload; use hdr.addr4 as a temporary buffer |
161 | */ | 162 | */ |
162 | memcpy(&hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 163 | skb_copy_from_linear_data_offset(skb, ETH_ALEN, |
164 | &hdr.addr4, ETH_ALEN); | ||
163 | need_tailroom += ETH_ALEN; | 165 | need_tailroom += ETH_ALEN; |
164 | } | 166 | } |
165 | 167 | ||
@@ -174,24 +176,27 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
174 | else | 176 | else |
175 | memcpy(&hdr.addr1, local->bssid, ETH_ALEN); | 177 | memcpy(&hdr.addr1, local->bssid, ETH_ALEN); |
176 | memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); | 178 | memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); |
177 | memcpy(&hdr.addr3, skb->data, ETH_ALEN); | 179 | skb_copy_from_linear_data(skb, &hdr.addr3, ETH_ALEN); |
178 | } else if (local->iw_mode == IW_MODE_MASTER && !to_assoc_ap) { | 180 | } else if (local->iw_mode == IW_MODE_MASTER && !to_assoc_ap) { |
179 | fc |= IEEE80211_FCTL_FROMDS; | 181 | fc |= IEEE80211_FCTL_FROMDS; |
180 | /* From DS: Addr1 = DA, Addr2 = BSSID, Addr3 = SA */ | 182 | /* From DS: Addr1 = DA, Addr2 = BSSID, Addr3 = SA */ |
181 | memcpy(&hdr.addr1, skb->data, ETH_ALEN); | 183 | skb_copy_from_linear_data(skb, &hdr.addr1, ETH_ALEN); |
182 | memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); | 184 | memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); |
183 | memcpy(&hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); | 185 | skb_copy_from_linear_data_offset(skb, ETH_ALEN, &hdr.addr3, |
186 | ETH_ALEN); | ||
184 | } else if (local->iw_mode == IW_MODE_INFRA || to_assoc_ap) { | 187 | } else if (local->iw_mode == IW_MODE_INFRA || to_assoc_ap) { |
185 | fc |= IEEE80211_FCTL_TODS; | 188 | fc |= IEEE80211_FCTL_TODS; |
186 | /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ | 189 | /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ |
187 | memcpy(&hdr.addr1, to_assoc_ap ? | 190 | memcpy(&hdr.addr1, to_assoc_ap ? |
188 | local->assoc_ap_addr : local->bssid, ETH_ALEN); | 191 | local->assoc_ap_addr : local->bssid, ETH_ALEN); |
189 | memcpy(&hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); | 192 | skb_copy_from_linear_data_offset(skb, ETH_ALEN, &hdr.addr2, |
190 | memcpy(&hdr.addr3, skb->data, ETH_ALEN); | 193 | ETH_ALEN); |
194 | skb_copy_from_linear_data(skb, &hdr.addr3, ETH_ALEN); | ||
191 | } else if (local->iw_mode == IW_MODE_ADHOC) { | 195 | } else if (local->iw_mode == IW_MODE_ADHOC) { |
192 | /* not From/To DS: Addr1 = DA, Addr2 = SA, Addr3 = BSSID */ | 196 | /* not From/To DS: Addr1 = DA, Addr2 = SA, Addr3 = BSSID */ |
193 | memcpy(&hdr.addr1, skb->data, ETH_ALEN); | 197 | skb_copy_from_linear_data(skb, &hdr.addr1, ETH_ALEN); |
194 | memcpy(&hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); | 198 | skb_copy_from_linear_data_offset(skb, ETH_ALEN, &hdr.addr2, |
199 | ETH_ALEN); | ||
195 | memcpy(&hdr.addr3, local->bssid, ETH_ALEN); | 200 | memcpy(&hdr.addr3, local->bssid, ETH_ALEN); |
196 | } | 201 | } |
197 | 202 | ||
@@ -237,7 +242,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
237 | iface->stats.tx_packets++; | 242 | iface->stats.tx_packets++; |
238 | iface->stats.tx_bytes += skb->len; | 243 | iface->stats.tx_bytes += skb->len; |
239 | 244 | ||
240 | skb->mac.raw = skb->data; | 245 | skb_reset_mac_header(skb); |
241 | meta = (struct hostap_skb_tx_data *) skb->cb; | 246 | meta = (struct hostap_skb_tx_data *) skb->cb; |
242 | memset(meta, 0, sizeof(*meta)); | 247 | memset(meta, 0, sizeof(*meta)); |
243 | meta->magic = HOSTAP_SKB_TX_DATA_MAGIC; | 248 | meta->magic = HOSTAP_SKB_TX_DATA_MAGIC; |
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index efb8cf3bd8ad..4ca8a27b8c55 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -982,7 +982,8 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
982 | meta->tx_cb_idx = tx_cb_idx; | 982 | meta->tx_cb_idx = tx_cb_idx; |
983 | 983 | ||
984 | skb->dev = dev; | 984 | skb->dev = dev; |
985 | skb->mac.raw = skb->nh.raw = skb->data; | 985 | skb_reset_mac_header(skb); |
986 | skb_reset_network_header(skb); | ||
986 | dev_queue_xmit(skb); | 987 | dev_queue_xmit(skb); |
987 | } | 988 | } |
988 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 989 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
@@ -1276,8 +1277,8 @@ static char * ap_auth_make_challenge(struct ap_data *ap) | |||
1276 | return NULL; | 1277 | return NULL; |
1277 | } | 1278 | } |
1278 | 1279 | ||
1279 | memcpy(tmpbuf, skb->data + ap->crypt->extra_mpdu_prefix_len, | 1280 | skb_copy_from_linear_data_offset(skb, ap->crypt->extra_mpdu_prefix_len, |
1280 | WLAN_AUTH_CHALLENGE_LEN); | 1281 | tmpbuf, WLAN_AUTH_CHALLENGE_LEN); |
1281 | dev_kfree_skb(skb); | 1282 | dev_kfree_skb(skb); |
1282 | 1283 | ||
1283 | return tmpbuf; | 1284 | return tmpbuf; |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 3079378fb8cd..fb01fb95a9f0 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -1838,13 +1838,14 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev) | |||
1838 | 1838 | ||
1839 | /* skb->data starts with txdesc->frame_control */ | 1839 | /* skb->data starts with txdesc->frame_control */ |
1840 | hdr_len = 24; | 1840 | hdr_len = 24; |
1841 | memcpy(&txdesc.frame_control, skb->data, hdr_len); | 1841 | skb_copy_from_linear_data(skb, &txdesc.frame_control, hdr_len); |
1842 | fc = le16_to_cpu(txdesc.frame_control); | 1842 | fc = le16_to_cpu(txdesc.frame_control); |
1843 | if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && | 1843 | if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && |
1844 | (fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS) && | 1844 | (fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS) && |
1845 | skb->len >= 30) { | 1845 | skb->len >= 30) { |
1846 | /* Addr4 */ | 1846 | /* Addr4 */ |
1847 | memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN); | 1847 | skb_copy_from_linear_data_offset(skb, hdr_len, txdesc.addr4, |
1848 | ETH_ALEN); | ||
1848 | hdr_len += ETH_ALEN; | 1849 | hdr_len += ETH_ALEN; |
1849 | } | 1850 | } |
1850 | 1851 | ||
@@ -2217,7 +2218,7 @@ static void hostap_tx_callback(local_info_t *local, | |||
2217 | memcpy(skb_put(skb, len), payload, len); | 2218 | memcpy(skb_put(skb, len), payload, len); |
2218 | 2219 | ||
2219 | skb->dev = local->dev; | 2220 | skb->dev = local->dev; |
2220 | skb->mac.raw = skb->data; | 2221 | skb_reset_mac_header(skb); |
2221 | 2222 | ||
2222 | cb->func(skb, ok, cb->data); | 2223 | cb->func(skb, ok, cb->data); |
2223 | } | 2224 | } |
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index 9077e6edde34..1f9edd91565d 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c | |||
@@ -590,20 +590,20 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx) | |||
590 | 590 | ||
591 | int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr) | 591 | int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr) |
592 | { | 592 | { |
593 | memcpy(haddr, skb->mac.raw + 10, ETH_ALEN); /* addr2 */ | 593 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ |
594 | return ETH_ALEN; | 594 | return ETH_ALEN; |
595 | } | 595 | } |
596 | 596 | ||
597 | 597 | ||
598 | int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr) | 598 | int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr) |
599 | { | 599 | { |
600 | if (*(u32 *)skb->mac.raw == LWNG_CAP_DID_BASE) { | 600 | const unsigned char *mac = skb_mac_header(skb); |
601 | memcpy(haddr, skb->mac.raw + | 601 | |
602 | sizeof(struct linux_wlan_ng_prism_hdr) + 10, | 602 | if (*(u32 *)mac == LWNG_CAP_DID_BASE) { |
603 | memcpy(haddr, mac + sizeof(struct linux_wlan_ng_prism_hdr) + 10, | ||
603 | ETH_ALEN); /* addr2 */ | 604 | ETH_ALEN); /* addr2 */ |
604 | } else { /* (*(u32 *)skb->mac.raw == htonl(LWNG_CAPHDR_VERSION)) */ | 605 | } else { /* (*(u32 *)mac == htonl(LWNG_CAPHDR_VERSION)) */ |
605 | memcpy(haddr, skb->mac.raw + | 606 | memcpy(haddr, mac + sizeof(struct linux_wlan_ng_cap_hdr) + 10, |
606 | sizeof(struct linux_wlan_ng_cap_hdr) + 10, | ||
607 | ETH_ALEN); /* addr2 */ | 607 | ETH_ALEN); /* addr2 */ |
608 | } | 608 | } |
609 | return ETH_ALEN; | 609 | return ETH_ALEN; |
@@ -1063,7 +1063,8 @@ int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, | |||
1063 | meta->iface = netdev_priv(dev); | 1063 | meta->iface = netdev_priv(dev); |
1064 | 1064 | ||
1065 | skb->dev = dev; | 1065 | skb->dev = dev; |
1066 | skb->mac.raw = skb->nh.raw = skb->data; | 1066 | skb_reset_mac_header(skb); |
1067 | skb_reset_network_header(skb); | ||
1067 | dev_queue_xmit(skb); | 1068 | dev_queue_xmit(skb); |
1068 | 1069 | ||
1069 | return 0; | 1070 | return 0; |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index ad6e4a428355..9137a4dd02eb 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -2416,8 +2416,9 @@ static void isr_rx(struct ipw2100_priv *priv, int i, | |||
2416 | #ifdef IPW2100_RX_DEBUG | 2416 | #ifdef IPW2100_RX_DEBUG |
2417 | /* Make a copy of the frame so we can dump it to the logs if | 2417 | /* Make a copy of the frame so we can dump it to the logs if |
2418 | * ieee80211_rx fails */ | 2418 | * ieee80211_rx fails */ |
2419 | memcpy(packet_data, packet->skb->data, | 2419 | skb_copy_from_linear_data(packet->skb, packet_data, |
2420 | min_t(u32, status->frame_size, IPW_RX_NIC_BUFFER_LENGTH)); | 2420 | min_t(u32, status->frame_size, |
2421 | IPW_RX_NIC_BUFFER_LENGTH)); | ||
2421 | #endif | 2422 | #endif |
2422 | 2423 | ||
2423 | if (!ieee80211_rx(priv->ieee, packet->skb, stats)) { | 2424 | if (!ieee80211_rx(priv->ieee, packet->skb, stats)) { |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index c878a2f3239c..4839a45098cb 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -8133,7 +8133,7 @@ static void ipw_handle_mgmt_packet(struct ipw_priv *priv, | |||
8133 | skb->dev = priv->ieee->dev; | 8133 | skb->dev = priv->ieee->dev; |
8134 | 8134 | ||
8135 | /* Point raw at the ieee80211_stats */ | 8135 | /* Point raw at the ieee80211_stats */ |
8136 | skb->mac.raw = skb->data; | 8136 | skb_reset_mac_header(skb); |
8137 | 8137 | ||
8138 | skb->pkt_type = PACKET_OTHERHOST; | 8138 | skb->pkt_type = PACKET_OTHERHOST; |
8139 | skb->protocol = __constant_htons(ETH_P_80211_STATS); | 8139 | skb->protocol = __constant_htons(ETH_P_80211_STATS); |
@@ -10355,7 +10355,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv, | |||
10355 | 10355 | ||
10356 | rt_hdr->it_len = dst->len; | 10356 | rt_hdr->it_len = dst->len; |
10357 | 10357 | ||
10358 | memcpy(skb_put(dst, len), src->data, len); | 10358 | skb_copy_from_linear_data(src, skb_put(dst, len), len); |
10359 | 10359 | ||
10360 | if (!ieee80211_rx(priv->prom_priv->ieee, dst, &dummystats)) | 10360 | if (!ieee80211_rx(priv->prom_priv->ieee, dst, &dummystats)) |
10361 | dev_kfree_skb_any(dst); | 10361 | dev_kfree_skb_any(dst); |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index a009ab517710..45b00e13ab2b 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -1283,7 +1283,6 @@ static int netwave_rx(struct net_device *dev) | |||
1283 | 1283 | ||
1284 | skb_reserve( skb, 2); /* Align IP on 16 byte */ | 1284 | skb_reserve( skb, 2); /* Align IP on 16 byte */ |
1285 | skb_put( skb, rcvLen); | 1285 | skb_put( skb, rcvLen); |
1286 | skb->dev = dev; | ||
1287 | 1286 | ||
1288 | /* Copy packet fragments to the skb data area */ | 1287 | /* Copy packet fragments to the skb data area */ |
1289 | ptr = (u_char*) skb->data; | 1288 | ptr = (u_char*) skb->data; |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 4e7f6cf51436..062286dc8e15 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -689,7 +689,7 @@ static void orinoco_stat_gather(struct net_device *dev, | |||
689 | /* Note : gcc will optimise the whole section away if | 689 | /* Note : gcc will optimise the whole section away if |
690 | * WIRELESS_SPY is not defined... - Jean II */ | 690 | * WIRELESS_SPY is not defined... - Jean II */ |
691 | if (SPY_NUMBER(priv)) { | 691 | if (SPY_NUMBER(priv)) { |
692 | orinoco_spy_gather(dev, skb->mac.raw + ETH_ALEN, | 692 | orinoco_spy_gather(dev, skb_mac_header(skb) + ETH_ALEN, |
693 | desc->signal, desc->silence); | 693 | desc->signal, desc->silence); |
694 | } | 694 | } |
695 | } | 695 | } |
@@ -770,7 +770,7 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, | |||
770 | 770 | ||
771 | /* Copy the 802.11 header to the skb */ | 771 | /* Copy the 802.11 header to the skb */ |
772 | memcpy(skb_put(skb, hdrlen), &(desc->frame_ctl), hdrlen); | 772 | memcpy(skb_put(skb, hdrlen), &(desc->frame_ctl), hdrlen); |
773 | skb->mac.raw = skb->data; | 773 | skb_reset_mac_header(skb); |
774 | 774 | ||
775 | /* If any, copy the data from the card to the skb */ | 775 | /* If any, copy the data from the card to the skb */ |
776 | if (datalen > 0) { | 776 | if (datalen > 0) { |
@@ -915,7 +915,6 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) | |||
915 | memcpy(hdr->h_source, desc.addr2, ETH_ALEN); | 915 | memcpy(hdr->h_source, desc.addr2, ETH_ALEN); |
916 | 916 | ||
917 | dev->last_rx = jiffies; | 917 | dev->last_rx = jiffies; |
918 | skb->dev = dev; | ||
919 | skb->protocol = eth_type_trans(skb, dev); | 918 | skb->protocol = eth_type_trans(skb, dev); |
920 | skb->ip_summed = CHECKSUM_NONE; | 919 | skb->ip_summed = CHECKSUM_NONE; |
921 | if (fc & IEEE80211_FCTL_TODS) | 920 | if (fc & IEEE80211_FCTL_TODS) |
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index b1122912ee2d..dd070cccf324 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c | |||
@@ -136,7 +136,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) | |||
136 | printk("islpci_eth_transmit:wds_mac\n"); | 136 | printk("islpci_eth_transmit:wds_mac\n"); |
137 | #endif | 137 | #endif |
138 | memmove(skb->data + 6, src, skb->len); | 138 | memmove(skb->data + 6, src, skb->len); |
139 | memcpy(skb->data, wds_mac, 6); | 139 | skb_copy_to_linear_data(skb, wds_mac, 6); |
140 | } else { | 140 | } else { |
141 | memmove(skb->data, src, skb->len); | 141 | memmove(skb->data, src, skb->len); |
142 | } | 142 | } |
@@ -162,13 +162,16 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) | |||
162 | 162 | ||
163 | skb_put(newskb, init_wds ? skb->len + 6 : skb->len); | 163 | skb_put(newskb, init_wds ? skb->len + 6 : skb->len); |
164 | if (init_wds) { | 164 | if (init_wds) { |
165 | memcpy(newskb->data + 6, skb->data, skb->len); | 165 | skb_copy_from_linear_data(skb, |
166 | memcpy(newskb->data, wds_mac, 6); | 166 | newskb->data + 6, |
167 | skb->len); | ||
168 | skb_copy_to_linear_data(newskb, wds_mac, 6); | ||
167 | #ifdef ISLPCI_ETH_DEBUG | 169 | #ifdef ISLPCI_ETH_DEBUG |
168 | printk("islpci_eth_transmit:wds_mac\n"); | 170 | printk("islpci_eth_transmit:wds_mac\n"); |
169 | #endif | 171 | #endif |
170 | } else | 172 | } else |
171 | memcpy(newskb->data, skb->data, skb->len); | 173 | skb_copy_from_linear_data(skb, newskb->data, |
174 | skb->len); | ||
172 | 175 | ||
173 | #if VERBOSE > SHOW_ERROR_MESSAGES | 176 | #if VERBOSE > SHOW_ERROR_MESSAGES |
174 | DEBUG(SHOW_TRACING, "memcpy %p %p %i wds %i\n", | 177 | DEBUG(SHOW_TRACING, "memcpy %p %p %i wds %i\n", |
@@ -303,7 +306,7 @@ islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb) | |||
303 | skb_pull(*skb, sizeof (struct rfmon_header)); | 306 | skb_pull(*skb, sizeof (struct rfmon_header)); |
304 | 307 | ||
305 | (*skb)->protocol = htons(ETH_P_802_2); | 308 | (*skb)->protocol = htons(ETH_P_802_2); |
306 | (*skb)->mac.raw = (*skb)->data; | 309 | skb_reset_mac_header(*skb); |
307 | (*skb)->pkt_type = PACKET_OTHERHOST; | 310 | (*skb)->pkt_type = PACKET_OTHERHOST; |
308 | 311 | ||
309 | return 0; | 312 | return 0; |
@@ -374,10 +377,6 @@ islpci_eth_receive(islpci_private *priv) | |||
374 | DEBUG(SHOW_BUFFER_CONTENTS, "\nrx %p ", skb->data); | 377 | DEBUG(SHOW_BUFFER_CONTENTS, "\nrx %p ", skb->data); |
375 | display_buffer((char *) skb->data, skb->len); | 378 | display_buffer((char *) skb->data, skb->len); |
376 | #endif | 379 | #endif |
377 | |||
378 | /* do some additional sk_buff and network layer parameters */ | ||
379 | skb->dev = ndev; | ||
380 | |||
381 | /* take care of monitor mode and spy monitoring. */ | 380 | /* take care of monitor mode and spy monitoring. */ |
382 | if (unlikely(priv->iw_mode == IW_MODE_MONITOR)) | 381 | if (unlikely(priv->iw_mode == IW_MODE_MONITOR)) |
383 | discard = islpci_monitor_rx(priv, &skb); | 382 | discard = islpci_monitor_rx(priv, &skb); |
@@ -398,8 +397,10 @@ islpci_eth_receive(islpci_private *priv) | |||
398 | /* Update spy records */ | 397 | /* Update spy records */ |
399 | wireless_spy_update(ndev, annex->addr2, &wstats); | 398 | wireless_spy_update(ndev, annex->addr2, &wstats); |
400 | 399 | ||
401 | memcpy(skb->data + sizeof (struct rfmon_header), | 400 | skb_copy_from_linear_data(skb, |
402 | skb->data, 2 * ETH_ALEN); | 401 | (skb->data + |
402 | sizeof(struct rfmon_header)), | ||
403 | 2 * ETH_ALEN); | ||
403 | skb_pull(skb, sizeof (struct rfmon_header)); | 404 | skb_pull(skb, sizeof (struct rfmon_header)); |
404 | } | 405 | } |
405 | skb->protocol = eth_type_trans(skb, ndev); | 406 | skb->protocol = eth_type_trans(skb, ndev); |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 47b2ccb6a633..3be624295a1f 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -2232,7 +2232,6 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, unsigned i | |||
2232 | return; | 2232 | return; |
2233 | } | 2233 | } |
2234 | skb_reserve( skb, 2); /* Align IP on 16 byte (TBD check this)*/ | 2234 | skb_reserve( skb, 2); /* Align IP on 16 byte (TBD check this)*/ |
2235 | skb->dev = dev; | ||
2236 | 2235 | ||
2237 | DEBUG(4,"ray_cs rx_data total_len = %x, rx_len = %x\n",total_len,rx_len); | 2236 | DEBUG(4,"ray_cs rx_data total_len = %x, rx_len = %x\n",total_len,rx_len); |
2238 | 2237 | ||
@@ -2243,7 +2242,8 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, unsigned i | |||
2243 | rx_ptr += copy_from_rx_buff(local, rx_ptr, pkt_addr & RX_BUFF_END, rx_len); | 2242 | rx_ptr += copy_from_rx_buff(local, rx_ptr, pkt_addr & RX_BUFF_END, rx_len); |
2244 | /* Get source address */ | 2243 | /* Get source address */ |
2245 | #ifdef WIRELESS_SPY | 2244 | #ifdef WIRELESS_SPY |
2246 | memcpy(linksrcaddr, ((struct mac_header *)skb->data)->addr_2, ETH_ALEN); | 2245 | skb_copy_from_linear_data_offset(skb, offsetof(struct mac_header, addr_2), |
2246 | linksrcaddr, ETH_ALEN); | ||
2247 | #endif | 2247 | #endif |
2248 | /* Now, deal with encapsulation/translation/sniffer */ | 2248 | /* Now, deal with encapsulation/translation/sniffer */ |
2249 | if (!sniffer) { | 2249 | if (!sniffer) { |
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index f5ce1c6063d8..2a299a0676a6 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c | |||
@@ -2009,7 +2009,7 @@ static void deliver_packet(struct strip *strip_info, STRIP_Header * header, | |||
2009 | packetlen); | 2009 | packetlen); |
2010 | skb->dev = get_strip_dev(strip_info); | 2010 | skb->dev = get_strip_dev(strip_info); |
2011 | skb->protocol = header->protocol; | 2011 | skb->protocol = header->protocol; |
2012 | skb->mac.raw = skb->data; | 2012 | skb_reset_mac_header(skb); |
2013 | 2013 | ||
2014 | /* Having put a fake header on the front of the sk_buff for the */ | 2014 | /* Having put a fake header on the front of the sk_buff for the */ |
2015 | /* benefit of tools like tcpdump, skb_pull now 'consumes' that */ | 2015 | /* benefit of tools like tcpdump, skb_pull now 'consumes' that */ |
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index 2aa3c761dd83..1cf090d60edc 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -2512,14 +2512,13 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize) | |||
2512 | return; | 2512 | return; |
2513 | } | 2513 | } |
2514 | 2514 | ||
2515 | skb->dev = dev; | ||
2516 | |||
2517 | /* Copy the packet to the buffer. */ | 2515 | /* Copy the packet to the buffer. */ |
2518 | obram_read(ioaddr, buf_off, skb_put(skb, sksize), sksize); | 2516 | obram_read(ioaddr, buf_off, skb_put(skb, sksize), sksize); |
2519 | skb->protocol = eth_type_trans(skb, dev); | 2517 | skb->protocol = eth_type_trans(skb, dev); |
2520 | 2518 | ||
2521 | #ifdef DEBUG_RX_INFO | 2519 | #ifdef DEBUG_RX_INFO |
2522 | wv_packet_info(skb->mac.raw, sksize, dev->name, "wv_packet_read"); | 2520 | wv_packet_info(skb_mac_header(skb), sksize, dev->name, |
2521 | "wv_packet_read"); | ||
2523 | #endif /* DEBUG_RX_INFO */ | 2522 | #endif /* DEBUG_RX_INFO */ |
2524 | 2523 | ||
2525 | /* Statistics-gathering and associated stuff. | 2524 | /* Statistics-gathering and associated stuff. |
@@ -2555,7 +2554,7 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize) | |||
2555 | 2554 | ||
2556 | /* Spying stuff */ | 2555 | /* Spying stuff */ |
2557 | #ifdef IW_WIRELESS_SPY | 2556 | #ifdef IW_WIRELESS_SPY |
2558 | wl_spy_gather(dev, skb->mac.raw + WAVELAN_ADDR_SIZE, | 2557 | wl_spy_gather(dev, skb_mac_header(skb) + WAVELAN_ADDR_SIZE, |
2559 | stats); | 2558 | stats); |
2560 | #endif /* IW_WIRELESS_SPY */ | 2559 | #endif /* IW_WIRELESS_SPY */ |
2561 | #ifdef HISTOGRAM | 2560 | #ifdef HISTOGRAM |
@@ -2939,7 +2938,7 @@ static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev) | |||
2939 | * need to pad. Jean II */ | 2938 | * need to pad. Jean II */ |
2940 | if (skb->len < ETH_ZLEN) { | 2939 | if (skb->len < ETH_ZLEN) { |
2941 | memset(data, 0, ETH_ZLEN); | 2940 | memset(data, 0, ETH_ZLEN); |
2942 | memcpy(data, skb->data, skb->len); | 2941 | skb_copy_from_linear_data(skb, data, skb->len); |
2943 | /* Write packet on the card */ | 2942 | /* Write packet on the card */ |
2944 | if(wv_packet_write(dev, data, ETH_ZLEN)) | 2943 | if(wv_packet_write(dev, data, ETH_ZLEN)) |
2945 | return 1; /* We failed */ | 2944 | return 1; /* We failed */ |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index b04239792f63..67b867f837ca 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -2884,14 +2884,12 @@ wv_packet_read(struct net_device * dev, | |||
2884 | return; | 2884 | return; |
2885 | } | 2885 | } |
2886 | 2886 | ||
2887 | skb->dev = dev; | ||
2888 | |||
2889 | skb_reserve(skb, 2); | 2887 | skb_reserve(skb, 2); |
2890 | fd_p = read_ringbuf(dev, fd_p, (char *) skb_put(skb, sksize), sksize); | 2888 | fd_p = read_ringbuf(dev, fd_p, (char *) skb_put(skb, sksize), sksize); |
2891 | skb->protocol = eth_type_trans(skb, dev); | 2889 | skb->protocol = eth_type_trans(skb, dev); |
2892 | 2890 | ||
2893 | #ifdef DEBUG_RX_INFO | 2891 | #ifdef DEBUG_RX_INFO |
2894 | wv_packet_info(skb->mac.raw, sksize, dev->name, "wv_packet_read"); | 2892 | wv_packet_info(skb_mac_header(skb), sksize, dev->name, "wv_packet_read"); |
2895 | #endif /* DEBUG_RX_INFO */ | 2893 | #endif /* DEBUG_RX_INFO */ |
2896 | 2894 | ||
2897 | /* Statistics gathering & stuff associated. | 2895 | /* Statistics gathering & stuff associated. |
@@ -2925,7 +2923,7 @@ wv_packet_read(struct net_device * dev, | |||
2925 | #endif /* WAVELAN_ROAMING */ | 2923 | #endif /* WAVELAN_ROAMING */ |
2926 | 2924 | ||
2927 | #ifdef WIRELESS_SPY | 2925 | #ifdef WIRELESS_SPY |
2928 | wl_spy_gather(dev, skb->mac.raw + WAVELAN_ADDR_SIZE, stats); | 2926 | wl_spy_gather(dev, skb_mac_header(skb) + WAVELAN_ADDR_SIZE, stats); |
2929 | #endif /* WIRELESS_SPY */ | 2927 | #endif /* WIRELESS_SPY */ |
2930 | #ifdef HISTOGRAM | 2928 | #ifdef HISTOGRAM |
2931 | wl_his_gather(dev, stats); | 2929 | wl_his_gather(dev, stats); |
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c index 6cb66a356c96..935b144d9b56 100644 --- a/drivers/net/wireless/zd1201.c +++ b/drivers/net/wireless/zd1201.c | |||
@@ -327,7 +327,6 @@ static void zd1201_usbrx(struct urb *urb) | |||
327 | memcpy(skb_put(skb, 6), &data[datalen-8], 6); | 327 | memcpy(skb_put(skb, 6), &data[datalen-8], 6); |
328 | memcpy(skb_put(skb, 2), &data[datalen-24], 2); | 328 | memcpy(skb_put(skb, 2), &data[datalen-24], 2); |
329 | memcpy(skb_put(skb, len), data, len); | 329 | memcpy(skb_put(skb, len), data, len); |
330 | skb->dev = zd->dev; | ||
331 | skb->dev->last_rx = jiffies; | 330 | skb->dev->last_rx = jiffies; |
332 | skb->protocol = eth_type_trans(skb, zd->dev); | 331 | skb->protocol = eth_type_trans(skb, zd->dev); |
333 | zd->stats.rx_packets++; | 332 | zd->stats.rx_packets++; |
@@ -385,7 +384,6 @@ static void zd1201_usbrx(struct urb *urb) | |||
385 | memcpy(skb_put(skb, 2), &data[6], 2); | 384 | memcpy(skb_put(skb, 2), &data[6], 2); |
386 | memcpy(skb_put(skb, len), data+8, len); | 385 | memcpy(skb_put(skb, len), data+8, len); |
387 | } | 386 | } |
388 | skb->dev = zd->dev; | ||
389 | skb->dev->last_rx = jiffies; | 387 | skb->dev->last_rx = jiffies; |
390 | skb->protocol = eth_type_trans(skb, zd->dev); | 388 | skb->protocol = eth_type_trans(skb, zd->dev); |
391 | zd->stats.rx_packets++; | 389 | zd->stats.rx_packets++; |
@@ -809,10 +807,10 @@ static int zd1201_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
809 | txbuf[4] = 0x00; | 807 | txbuf[4] = 0x00; |
810 | txbuf[5] = 0x00; | 808 | txbuf[5] = 0x00; |
811 | 809 | ||
812 | memcpy(txbuf+6, skb->data+12, skb->len-12); | 810 | skb_copy_from_linear_data_offset(skb, 12, txbuf + 6, skb->len - 12); |
813 | if (pad) | 811 | if (pad) |
814 | txbuf[skb->len-12+6]=0; | 812 | txbuf[skb->len-12+6]=0; |
815 | memcpy(txbuf+skb->len-12+6+pad, skb->data, 12); | 813 | skb_copy_from_linear_data(skb, txbuf + skb->len - 12 + 6 + pad, 12); |
816 | *(__be16*)&txbuf[skb->len+6+pad] = htons(skb->len-12+6); | 814 | *(__be16*)&txbuf[skb->len+6+pad] = htons(skb->len-12+6); |
817 | txbuf[txbuflen-1] = 0; | 815 | txbuf[txbuflen-1] = 0; |
818 | 816 | ||
diff --git a/drivers/net/wireless/zd1211rw/Kconfig b/drivers/net/wireless/zd1211rw/Kconfig index 66ed55bc5460..d1ab24a95630 100644 --- a/drivers/net/wireless/zd1211rw/Kconfig +++ b/drivers/net/wireless/zd1211rw/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config ZD1211RW | 1 | config ZD1211RW |
2 | tristate "ZyDAS ZD1211/ZD1211B USB-wireless support" | 2 | tristate "ZyDAS ZD1211/ZD1211B USB-wireless support" |
3 | depends on USB && IEEE80211 && IEEE80211_SOFTMAC && NET_RADIO && EXPERIMENTAL | 3 | depends on USB && IEEE80211_SOFTMAC && WLAN_80211 && EXPERIMENTAL |
4 | select WIRELESS_EXT | ||
4 | select FW_LOADER | 5 | select FW_LOADER |
5 | ---help--- | 6 | ---help--- |
6 | This is an experimental driver for the ZyDAS ZD1211/ZD1211B wireless | 7 | This is an experimental driver for the ZyDAS ZD1211/ZD1211B wireless |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index aac8a1c5ba08..edaaad2f648b 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -62,6 +62,7 @@ static struct usb_device_id usb_ids[] = { | |||
62 | { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B }, | 62 | { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B }, |
63 | { USB_DEVICE(0x13b1, 0x0024), .driver_info = DEVICE_ZD1211B }, | 63 | { USB_DEVICE(0x13b1, 0x0024), .driver_info = DEVICE_ZD1211B }, |
64 | { USB_DEVICE(0x0586, 0x340f), .driver_info = DEVICE_ZD1211B }, | 64 | { USB_DEVICE(0x0586, 0x340f), .driver_info = DEVICE_ZD1211B }, |
65 | { USB_DEVICE(0x0baf, 0x0121), .driver_info = DEVICE_ZD1211B }, | ||
65 | /* "Driverless" devices that need ejecting */ | 66 | /* "Driverless" devices that need ejecting */ |
66 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, | 67 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, |
67 | {} | 68 | {} |
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 2412ce4917f2..3f4a7cf9efea 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -1137,7 +1137,6 @@ static int yellowfin_rx(struct net_device *dev) | |||
1137 | skb = dev_alloc_skb(pkt_len + 2); | 1137 | skb = dev_alloc_skb(pkt_len + 2); |
1138 | if (skb == NULL) | 1138 | if (skb == NULL) |
1139 | break; | 1139 | break; |
1140 | skb->dev = dev; | ||
1141 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1140 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1142 | eth_copy_and_sum(skb, rx_skb->data, pkt_len, 0); | 1141 | eth_copy_and_sum(skb, rx_skb->data, pkt_len, 0); |
1143 | skb_put(skb, pkt_len); | 1142 | skb_put(skb, pkt_len); |
diff --git a/drivers/net/znet.c b/drivers/net/znet.c index b24b0727108c..4032e9f6f9b0 100644 --- a/drivers/net/znet.c +++ b/drivers/net/znet.c | |||
@@ -774,7 +774,6 @@ static void znet_rx(struct net_device *dev) | |||
774 | znet->stats.rx_dropped++; | 774 | znet->stats.rx_dropped++; |
775 | break; | 775 | break; |
776 | } | 776 | } |
777 | skb->dev = dev; | ||
778 | 777 | ||
779 | if (&znet->rx_cur[(pkt_len+1)>>1] > znet->rx_end) { | 778 | if (&znet->rx_cur[(pkt_len+1)>>1] > znet->rx_end) { |
780 | int semi_cnt = (znet->rx_end - znet->rx_cur)<<1; | 779 | int semi_cnt = (znet->rx_end - znet->rx_cur)<<1; |