diff options
author | Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2007-03-31 10:55:19 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:28:29 -0400 |
commit | 27d7ff46a3498d3debc6ba68fb8014c702b81170 (patch) | |
tree | b5a0c617cf8339524d3b1f1633e08eae7b94cf86 /drivers/net | |
parent | 3dbad80ac7632f243b824d469301abb97ec634a1 (diff) |
[SK_BUFF]: Introduce skb_copy_to_linear_data{_offset}
To clearly state the intent of copying to linear sk_buffs, _offset being a
overly long variant but interesting for the sake of saving some bytes.
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Diffstat (limited to 'drivers/net')
33 files changed, 90 insertions, 60 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 2101334a8ac2..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 | ||
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c index 43c17c85c97b..6a6cbd331a16 100644 --- a/drivers/net/appletalk/ltpc.c +++ b/drivers/net/appletalk/ltpc.c | |||
@@ -774,7 +774,7 @@ static int sendup_buffer (struct net_device *dev) | |||
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_reset_transport_header(skb); | 779 | skb_reset_transport_header(skb); |
780 | 780 | ||
diff --git a/drivers/net/atari_bionet.c b/drivers/net/atari_bionet.c index 13dbed368d6a..3d87bd2b4194 100644 --- a/drivers/net/atari_bionet.c +++ b/drivers/net/atari_bionet.c | |||
@@ -550,7 +550,8 @@ bionet_poll_rx(struct net_device *dev) { | |||
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 745101d7451b..54714409a09b 100644 --- a/drivers/net/atari_pamsnet.c +++ b/drivers/net/atari_pamsnet.c | |||
@@ -793,7 +793,8 @@ pamsnet_poll_rx(struct net_device *dev) { | |||
793 | 793 | ||
794 | /* 'skb->data' points to the start of sk_buff data area. | 794 | /* 'skb->data' points to the start of sk_buff data area. |
795 | */ | 795 | */ |
796 | memcpy(skb->data, nic_packet->buffer, pkt_len); | 796 | skb_copy_to_linear_data(skb, nic_packet->buffer, |
797 | pkt_len); | ||
797 | netif_rx(skb); | 798 | netif_rx(skb); |
798 | dev->last_rx = jiffies; | 799 | dev->last_rx = jiffies; |
799 | lp->stats.rx_packets++; | 800 | lp->stats.rx_packets++; |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 1be1bbd16164..e4f874a70fe5 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -2095,10 +2095,14 @@ static void espibug_workaround_t204(unsigned long data) | |||
2095 | 0x0, 0x7, 0x43, 0x0, 0x0, 0x0 | 2095 | 0x0, 0x7, 0x43, 0x0, 0x0, 0x0 |
2096 | }; | 2096 | }; |
2097 | 2097 | ||
2098 | memcpy(skb->data + sizeof(struct cpl_tx_pkt), | 2098 | skb_copy_to_linear_data_offset(skb, |
2099 | ch_mac_addr, ETH_ALEN); | 2099 | sizeof(struct cpl_tx_pkt), |
2100 | memcpy(skb->data + skb->len - 10, | 2100 | ch_mac_addr, |
2101 | 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); | ||
2102 | skb->cb[0] = 0xff; | 2106 | skb->cb[0] = 0xff; |
2103 | } | 2107 | } |
2104 | 2108 | ||
@@ -2125,10 +2129,14 @@ static void espibug_workaround(unsigned long data) | |||
2125 | if (!skb->cb[0]) { | 2129 | if (!skb->cb[0]) { |
2126 | u8 ch_mac_addr[ETH_ALEN] = | 2130 | u8 ch_mac_addr[ETH_ALEN] = |
2127 | {0x0, 0x7, 0x43, 0x0, 0x0, 0x0}; | 2131 | {0x0, 0x7, 0x43, 0x0, 0x0, 0x0}; |
2128 | memcpy(skb->data + sizeof(struct cpl_tx_pkt), | 2132 | skb_copy_to_linear_data_offset(skb, |
2129 | ch_mac_addr, ETH_ALEN); | 2133 | sizeof(struct cpl_tx_pkt), |
2130 | memcpy(skb->data + skb->len - 10, ch_mac_addr, | 2134 | ch_mac_addr, |
2131 | ETH_ALEN); | 2135 | ETH_ALEN); |
2136 | skb_copy_to_linear_data_offset(skb, | ||
2137 | skb->len - 10, | ||
2138 | ch_mac_addr, | ||
2139 | ETH_ALEN); | ||
2132 | skb->cb[0] = 0xff; | 2140 | skb->cb[0] = 0xff; |
2133 | } | 2141 | } |
2134 | 2142 | ||
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 166c959c94b9..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 | } |
@@ -1722,11 +1722,11 @@ static void skb_data_init(struct sk_buff *skb, struct sge_fl_page *p, | |||
1722 | { | 1722 | { |
1723 | skb->len = len; | 1723 | skb->len = len; |
1724 | if (len <= SKB_DATA_SIZE) { | 1724 | if (len <= SKB_DATA_SIZE) { |
1725 | memcpy(skb->data, p->va, len); | 1725 | skb_copy_to_linear_data(skb, p->va, len); |
1726 | skb->tail += len; | 1726 | skb->tail += len; |
1727 | put_page(p->frag.page); | 1727 | put_page(p->frag.page); |
1728 | } else { | 1728 | } else { |
1729 | memcpy(skb->data, p->va, SKB_DATA_SIZE); | 1729 | skb_copy_to_linear_data(skb, p->va, SKB_DATA_SIZE); |
1730 | skb_shinfo(skb)->frags[0].page = p->frag.page; | 1730 | skb_shinfo(skb)->frags[0].page = p->frag.page; |
1731 | skb_shinfo(skb)->frags[0].page_offset = | 1731 | skb_shinfo(skb)->frags[0].page_offset = |
1732 | p->frag.page_offset + SKB_DATA_SIZE; | 1732 | p->frag.page_offset + SKB_DATA_SIZE; |
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index 8d29fae1c71c..571d82f8008c 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c | |||
@@ -3091,7 +3091,9 @@ 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 */ |
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 e7c93f44f810..610216ec4918 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -4224,9 +4224,12 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
4224 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); | 4224 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); |
4225 | if (new_skb) { | 4225 | if (new_skb) { |
4226 | skb_reserve(new_skb, NET_IP_ALIGN); | 4226 | skb_reserve(new_skb, NET_IP_ALIGN); |
4227 | memcpy(new_skb->data - NET_IP_ALIGN, | 4227 | skb_copy_to_linear_data_offset(new_skb, |
4228 | skb->data - NET_IP_ALIGN, | 4228 | -NET_IP_ALIGN, |
4229 | length + NET_IP_ALIGN); | 4229 | (skb->data - |
4230 | NET_IP_ALIGN), | ||
4231 | (length + | ||
4232 | NET_IP_ALIGN)); | ||
4230 | /* save the skb in buffer_info as good */ | 4233 | /* save the skb in buffer_info as good */ |
4231 | buffer_info->skb = skb; | 4234 | buffer_info->skb = skb; |
4232 | skb = new_skb; | 4235 | skb = new_skb; |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 8b5392072632..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, |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c index fb2248a25516..f9c889c0dd07 100644 --- a/drivers/net/irda/ali-ircc.c +++ b/drivers/net/irda/ali-ircc.c | |||
@@ -1923,7 +1923,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self) | |||
1923 | 1923 | ||
1924 | /* Copy frame without CRC, CRC is removed by hardware*/ | 1924 | /* Copy frame without CRC, CRC is removed by hardware*/ |
1925 | skb_put(skb, len); | 1925 | skb_put(skb, len); |
1926 | memcpy(skb->data, self->rx_buff.data, len); | 1926 | skb_copy_to_linear_data(skb, self->rx_buff.data, len); |
1927 | 1927 | ||
1928 | /* Move to next frame */ | 1928 | /* Move to next frame */ |
1929 | self->rx_buff.data += len; | 1929 | self->rx_buff.data += len; |
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c index cdd1f6c1e741..4dbdfaaf37bf 100644 --- a/drivers/net/irda/au1k_ir.c +++ b/drivers/net/irda/au1k_ir.c | |||
@@ -604,7 +604,7 @@ 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_reset_mac_header(skb); | 609 | skb_reset_mac_header(skb); |
610 | skb->protocol = htons(ETH_P_IRDA); | 610 | skb->protocol = htons(ETH_P_IRDA); |
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 9987a0dc1eaf..3ca47bf6dfec 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c | |||
@@ -1282,8 +1282,8 @@ 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_reset_mac_header(skb); | 1289 | skb_reset_mac_header(skb); |
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index 4b0037e498f8..54d1d543c92c 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c | |||
@@ -426,7 +426,7 @@ 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_reset_mac_header(skb); | 431 | skb_reset_mac_header(skb); |
432 | skb->protocol = htons(ETH_P_IRDA); | 432 | skb->protocol = htons(ETH_P_IRDA); |
@@ -479,7 +479,7 @@ 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_reset_mac_header(skb); | 484 | skb_reset_mac_header(skb); |
485 | skb->protocol = htons(ETH_P_IRDA); | 485 | skb->protocol = htons(ETH_P_IRDA); |
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index 0ff992714136..d96c89751a71 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c | |||
@@ -1868,10 +1868,14 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase) | |||
1868 | /* Copy frame without CRC */ | 1868 | /* Copy frame without CRC */ |
1869 | if (self->io.speed < 4000000) { | 1869 | if (self->io.speed < 4000000) { |
1870 | skb_put(skb, len-2); | 1870 | skb_put(skb, len-2); |
1871 | memcpy(skb->data, self->rx_buff.data, len-2); | 1871 | skb_copy_to_linear_data(skb, |
1872 | self->rx_buff.data, | ||
1873 | len - 2); | ||
1872 | } else { | 1874 | } else { |
1873 | skb_put(skb, len-4); | 1875 | skb_put(skb, len-4); |
1874 | memcpy(skb->data, self->rx_buff.data, len-4); | 1876 | skb_copy_to_linear_data(skb, |
1877 | self->rx_buff.data, | ||
1878 | len - 4); | ||
1875 | } | 1879 | } |
1876 | 1880 | ||
1877 | /* Move to next frame */ | 1881 | /* Move to next frame */ |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index b3e1107420af..fb196fd91855 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -386,7 +386,7 @@ 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 */ |
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index aec86a214340..755aa444a4dd 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -348,7 +348,7 @@ static void fir_eof(struct stir_cb *stir) | |||
348 | } | 348 | } |
349 | skb_reserve(nskb, 1); | 349 | skb_reserve(nskb, 1); |
350 | skb = nskb; | 350 | skb = nskb; |
351 | memcpy(nskb->data, rx_buff->data, len); | 351 | skb_copy_to_linear_data(nskb, rx_buff->data, len); |
352 | } else { | 352 | } else { |
353 | nskb = dev_alloc_skb(rx_buff->truesize); | 353 | nskb = dev_alloc_skb(rx_buff->truesize); |
354 | if (unlikely(!nskb)) { | 354 | if (unlikely(!nskb)) { |
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index 45bbd6686151..ff5358574d0a 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c | |||
@@ -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 | ||
@@ -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) |
@@ -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); |
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index 0d4a68618fc1..5182e800cc18 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c | |||
@@ -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 */ |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index e729ced52dc3..dfde80e54aef 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -2017,9 +2017,12 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
2017 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); | 2017 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); |
2018 | if (new_skb) { | 2018 | if (new_skb) { |
2019 | skb_reserve(new_skb, NET_IP_ALIGN); | 2019 | skb_reserve(new_skb, NET_IP_ALIGN); |
2020 | memcpy(new_skb->data - NET_IP_ALIGN, | 2020 | skb_copy_to_linear_data_offset(new_skb, |
2021 | skb->data - NET_IP_ALIGN, | 2021 | -NET_IP_ALIGN, |
2022 | length + NET_IP_ALIGN); | 2022 | (skb->data - |
2023 | NET_IP_ALIGN), | ||
2024 | (length + | ||
2025 | NET_IP_ALIGN)); | ||
2023 | /* save the skb in buffer_info as good */ | 2026 | /* save the skb in buffer_info as good */ |
2024 | buffer_info->skb = skb; | 2027 | buffer_info->skb = skb; |
2025 | skb = new_skb; | 2028 | skb = new_skb; |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 20b5cb101368..6df673a058ce 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -94,7 +94,8 @@ static void emulate_large_send_offload(struct sk_buff *skb) | |||
94 | skb_set_mac_header(nskb, -ETH_HLEN); | 94 | skb_set_mac_header(nskb, -ETH_HLEN); |
95 | skb_reset_network_header(nskb); | 95 | skb_reset_network_header(nskb); |
96 | iph = ip_hdr(nskb); | 96 | iph = ip_hdr(nskb); |
97 | memcpy(nskb->data, skb_network_header(skb), doffset); | 97 | skb_copy_to_linear_data(nskb, skb_network_header(skb), |
98 | doffset); | ||
98 | if (skb_copy_bits(skb, | 99 | if (skb_copy_bits(skb, |
99 | doffset + offset, | 100 | doffset + offset, |
100 | nskb->data + doffset, | 101 | nskb->data + doffset, |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 9e233f8216a7..0e04f7ac3f2e 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -367,9 +367,10 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
367 | BUG_ON(frag != last_frag); | 367 | BUG_ON(frag != last_frag); |
368 | frag_len = len - offset; | 368 | frag_len = len - offset; |
369 | } | 369 | } |
370 | memcpy(skb->data + offset, | 370 | skb_copy_to_linear_data_offset(skb, offset, |
371 | bp->rx_buffers + (RX_BUFFER_SIZE * frag), | 371 | (bp->rx_buffers + |
372 | frag_len); | 372 | (RX_BUFFER_SIZE * frag)), |
373 | frag_len); | ||
373 | offset += RX_BUFFER_SIZE; | 374 | offset += RX_BUFFER_SIZE; |
374 | bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED); | 375 | bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED); |
375 | wmb(); | 376 | wmb(); |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index e4b69a0485ba..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; |
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index b987a5c3f42a..e0a93005e6dc 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -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, |
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c index 064e7c21c01d..a7ef6c8b7721 100644 --- a/drivers/net/skfp/skfddi.c +++ b/drivers/net/skfp/skfddi.c | |||
@@ -1937,7 +1937,7 @@ int mac_drv_rx_init(struct s_smc *smc, int len, int fc, | |||
1937 | } | 1937 | } |
1938 | skb_reserve(skb, 3); | 1938 | skb_reserve(skb, 3); |
1939 | skb_put(skb, len); | 1939 | skb_put(skb, len); |
1940 | memcpy(skb->data, look_ahead, len); | 1940 | skb_copy_to_linear_data(skb, look_ahead, len); |
1941 | 1941 | ||
1942 | // deliver frame to system | 1942 | // deliver frame to system |
1943 | skb->protocol = fddi_type_trans(skb, smc->os.dev); | 1943 | skb->protocol = fddi_type_trans(skb, smc->os.dev); |
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index 327ed7962fbd..791e081fdc15 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -853,7 +853,7 @@ static int lance_rx( struct net_device *dev ) | |||
853 | 853 | ||
854 | skb_reserve( skb, 2 ); /* 16 byte align */ | 854 | skb_reserve( skb, 2 ); /* 16 byte align */ |
855 | skb_put( skb, pkt_len ); /* Make room */ | 855 | skb_put( skb, pkt_len ); /* Make room */ |
856 | // memcpy( skb->data, PKTBUF_ADDR(head), pkt_len ); | 856 | // skb_copy_to_linear_data(skb, PKTBUF_ADDR(head), pkt_len); |
857 | eth_copy_and_sum(skb, | 857 | eth_copy_and_sum(skb, |
858 | PKTBUF_ADDR(head), | 858 | PKTBUF_ADDR(head), |
859 | pkt_len, 0); | 859 | pkt_len, 0); |
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c index b0296d80e46c..9bbea5c8acf4 100644 --- a/drivers/net/tokenring/smctr.c +++ b/drivers/net/tokenring/smctr.c | |||
@@ -3889,7 +3889,7 @@ 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++; |
@@ -4475,7 +4475,7 @@ static int smctr_rx_frame(struct net_device *dev) | |||
4475 | if (skb) { | 4475 | if (skb) { |
4476 | skb_put(skb, rx_size); | 4476 | skb_put(skb, rx_size); |
4477 | 4477 | ||
4478 | memcpy(skb->data, pbuff, rx_size); | 4478 | skb_copy_to_linear_data(skb, pbuff, rx_size); |
4479 | 4479 | ||
4480 | /* Update Counters */ | 4480 | /* Update Counters */ |
4481 | tp->MacStat.rx_packets++; | 4481 | tp->MacStat.rx_packets++; |
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c index e6f0817c3509..12bd294045a7 100644 --- a/drivers/net/tokenring/tms380tr.c +++ b/drivers/net/tokenring/tms380tr.c | |||
@@ -2178,7 +2178,8 @@ static void tms380tr_rcv_status_irq(struct net_device *dev) | |||
2178 | || rpl->SkbStat == SKB_DMA_DIRECT)) | 2178 | || rpl->SkbStat == SKB_DMA_DIRECT)) |
2179 | { | 2179 | { |
2180 | if(rpl->SkbStat == SKB_DATA_COPY) | 2180 | if(rpl->SkbStat == SKB_DATA_COPY) |
2181 | memcpy(skb->data, ReceiveDataPtr, Length); | 2181 | skb_copy_to_linear_data(skb, ReceiveDataPtr, |
2182 | Length); | ||
2182 | 2183 | ||
2183 | /* Deliver frame to system */ | 2184 | /* Deliver frame to system */ |
2184 | rpl->Skb = NULL; | 2185 | rpl->Skb = NULL; |
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/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 8ba75bb17326..999bf71937ca 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c | |||
@@ -1759,7 +1759,7 @@ cpc_trace(struct net_device *dev, struct sk_buff *skb_main, char rx_tx) | |||
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] = ']'; |
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index de02a07259cf..07dbdfbfc15d 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c | |||
@@ -1007,13 +1007,13 @@ static void cpc_tty_trace(pc300dev_t *dev, char* buf, int len, char rxtx) | |||
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/z85230.c b/drivers/net/wan/z85230.c index 9432d2ce7745..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 | } |
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index 7d8bff1dbc4d..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 | } |
@@ -165,7 +165,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) | |||
165 | skb_copy_from_linear_data(skb, | 165 | skb_copy_from_linear_data(skb, |
166 | newskb->data + 6, | 166 | newskb->data + 6, |
167 | skb->len); | 167 | skb->len); |
168 | memcpy(newskb->data, wds_mac, 6); | 168 | skb_copy_to_linear_data(newskb, wds_mac, 6); |
169 | #ifdef ISLPCI_ETH_DEBUG | 169 | #ifdef ISLPCI_ETH_DEBUG |
170 | printk("islpci_eth_transmit:wds_mac\n"); | 170 | printk("islpci_eth_transmit:wds_mac\n"); |
171 | #endif | 171 | #endif |