aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap
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/hostap
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/hostap')
-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
4 files changed, 27 insertions, 18 deletions
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