aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-03-27 17:55:52 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:28:23 -0400
commitd626f62b11e00c16e81e4308ab93d3f13551812a (patch)
treefac4af6ced853755e12fc709d55f0c2bec51265d /drivers/net/wireless
parent2a123b86e2b242a4a6db990d2851d45e192f88e5 (diff)
[SK_BUFF]: Introduce skb_copy_from_linear_data{_offset}
To clearly state the intent of copying from 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@redhat.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/atmel.c4
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_dma.c3
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c13
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c23
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c4
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c5
-rw-r--r--drivers/net/wireless/ipw2100.c5
-rw-r--r--drivers/net/wireless/ipw2200.c2
-rw-r--r--drivers/net/wireless/prism54/islpci_eth.c13
-rw-r--r--drivers/net/wireless/ray_cs.c3
-rw-r--r--drivers/net/wireless/wavelan.c2
-rw-r--r--drivers/net/wireless/zd1201.c4
12 files changed, 49 insertions, 32 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 1c17cbe007ba..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)
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/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 35a3a50724fe..cbedc9ee740a 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -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
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index 159baef18e4a..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
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 797d950d5d61..4ca8a27b8c55 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -1277,8 +1277,8 @@ static char * ap_auth_make_challenge(struct ap_data *ap)
1277 return NULL; 1277 return NULL;
1278 } 1278 }
1279 1279
1280 memcpy(tmpbuf, skb->data + ap->crypt->extra_mpdu_prefix_len, 1280 skb_copy_from_linear_data_offset(skb, ap->crypt->extra_mpdu_prefix_len,
1281 WLAN_AUTH_CHALLENGE_LEN); 1281 tmpbuf, WLAN_AUTH_CHALLENGE_LEN);
1282 dev_kfree_skb(skb); 1282 dev_kfree_skb(skb);
1283 1283
1284 return tmpbuf; 1284 return tmpbuf;
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 9003ff7d151a..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
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 b04c56a25cc5..4839a45098cb 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -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/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c
index 6ebfff034242..7d8bff1dbc4d 100644
--- a/drivers/net/wireless/prism54/islpci_eth.c
+++ b/drivers/net/wireless/prism54/islpci_eth.c
@@ -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 newskb->data + 6,
167 skb->len);
166 memcpy(newskb->data, wds_mac, 6); 168 memcpy(newskb->data, 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",
@@ -394,8 +397,10 @@ islpci_eth_receive(islpci_private *priv)
394 /* Update spy records */ 397 /* Update spy records */
395 wireless_spy_update(ndev, annex->addr2, &wstats); 398 wireless_spy_update(ndev, annex->addr2, &wstats);
396 399
397 memcpy(skb->data + sizeof (struct rfmon_header), 400 skb_copy_from_linear_data(skb,
398 skb->data, 2 * ETH_ALEN); 401 (skb->data +
402 sizeof(struct rfmon_header)),
403 2 * ETH_ALEN);
399 skb_pull(skb, sizeof (struct rfmon_header)); 404 skb_pull(skb, sizeof (struct rfmon_header));
400 } 405 }
401 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 9633b0457f8c..3be624295a1f 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -2242,7 +2242,8 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, unsigned i
2242 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);
2243 /* Get source address */ 2243 /* Get source address */
2244#ifdef WIRELESS_SPY 2244#ifdef WIRELESS_SPY
2245 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);
2246#endif 2247#endif
2247 /* Now, deal with encapsulation/translation/sniffer */ 2248 /* Now, deal with encapsulation/translation/sniffer */
2248 if (!sniffer) { 2249 if (!sniffer) {
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c
index 2bf77b1ee531..1cf090d60edc 100644
--- a/drivers/net/wireless/wavelan.c
+++ b/drivers/net/wireless/wavelan.c
@@ -2938,7 +2938,7 @@ static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev)
2938 * need to pad. Jean II */ 2938 * need to pad. Jean II */
2939 if (skb->len < ETH_ZLEN) { 2939 if (skb->len < ETH_ZLEN) {
2940 memset(data, 0, ETH_ZLEN); 2940 memset(data, 0, ETH_ZLEN);
2941 memcpy(data, skb->data, skb->len); 2941 skb_copy_from_linear_data(skb, data, skb->len);
2942 /* Write packet on the card */ 2942 /* Write packet on the card */
2943 if(wv_packet_write(dev, data, ETH_ZLEN)) 2943 if(wv_packet_write(dev, data, ETH_ZLEN))
2944 return 1; /* We failed */ 2944 return 1; /* We failed */
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index 1fe013a7297a..935b144d9b56 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -807,10 +807,10 @@ static int zd1201_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
807 txbuf[4] = 0x00; 807 txbuf[4] = 0x00;
808 txbuf[5] = 0x00; 808 txbuf[5] = 0x00;
809 809
810 memcpy(txbuf+6, skb->data+12, skb->len-12); 810 skb_copy_from_linear_data_offset(skb, 12, txbuf + 6, skb->len - 12);
811 if (pad) 811 if (pad)
812 txbuf[skb->len-12+6]=0; 812 txbuf[skb->len-12+6]=0;
813 memcpy(txbuf+skb->len-12+6+pad, skb->data, 12); 813 skb_copy_from_linear_data(skb, txbuf + skb->len - 12 + 6 + pad, 12);
814 *(__be16*)&txbuf[skb->len+6+pad] = htons(skb->len-12+6); 814 *(__be16*)&txbuf[skb->len+6+pad] = htons(skb->len-12+6);
815 txbuf[txbuflen-1] = 0; 815 txbuf[txbuflen-1] = 0;
816 816