aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2010-04-12 12:29:15 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-14 14:52:43 -0400
commit0fa35a5836df2b8f285d6f53dfb4316c34621f88 (patch)
tree220eccf35fdff1213f4d6a1fd2c9312021e55c89 /drivers
parente6c6d33cb7d18721e56ce4bb5a0e22593956ef14 (diff)
ath9k-htc:respect usb buffer cacheline alignment in reg out path
In ath9k-htc register out path, ath9k-htc will pass skb->data into usb hcd and usb hcd will do dma mapping and unmapping to the buffer pointed by skb->data, so we should pass a cache-line aligned address. This patch replace __dev_alloc_skb with alloc_skb to make skb->data pointed to a cacheline aligned address simply since ath9k-htc does not skb_push on the skb and pass it to mac80211, also use kfree_skb to free the skb allocated by alloc_skb(we can use kfree_skb safely in hardirq context since skb->destructor is NULL always in the path). Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_hst.c21
-rw-r--r--drivers/net/wireless/ath/ath9k/wmi.c6
3 files changed, 16 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 259de170ea2..3d8f0f468f8 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -53,7 +53,7 @@ static void hif_usb_regout_cb(struct urb *urb)
53 53
54 return; 54 return;
55free: 55free:
56 dev_kfree_skb_any(cmd->skb); 56 kfree_skb(cmd->skb);
57 kfree(cmd); 57 kfree(cmd);
58} 58}
59 59
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index d1fa5bd6bdb..587d98ed098 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -146,7 +146,7 @@ static int htc_config_pipe_credits(struct htc_target *target)
146 struct htc_config_pipe_msg *cp_msg; 146 struct htc_config_pipe_msg *cp_msg;
147 int ret, time_left; 147 int ret, time_left;
148 148
149 skb = dev_alloc_skb(50 + sizeof(struct htc_frame_hdr)); 149 skb = alloc_skb(50 + sizeof(struct htc_frame_hdr), GFP_ATOMIC);
150 if (!skb) { 150 if (!skb) {
151 dev_err(target->dev, "failed to allocate send buffer\n"); 151 dev_err(target->dev, "failed to allocate send buffer\n");
152 return -ENOMEM; 152 return -ENOMEM;
@@ -174,7 +174,7 @@ static int htc_config_pipe_credits(struct htc_target *target)
174 174
175 return 0; 175 return 0;
176err: 176err:
177 dev_kfree_skb(skb); 177 kfree_skb(skb);
178 return -EINVAL; 178 return -EINVAL;
179} 179}
180 180
@@ -184,7 +184,7 @@ static int htc_setup_complete(struct htc_target *target)
184 struct htc_comp_msg *comp_msg; 184 struct htc_comp_msg *comp_msg;
185 int ret = 0, time_left; 185 int ret = 0, time_left;
186 186
187 skb = dev_alloc_skb(50 + sizeof(struct htc_frame_hdr)); 187 skb = alloc_skb(50 + sizeof(struct htc_frame_hdr), GFP_ATOMIC);
188 if (!skb) { 188 if (!skb) {
189 dev_err(target->dev, "failed to allocate send buffer\n"); 189 dev_err(target->dev, "failed to allocate send buffer\n");
190 return -ENOMEM; 190 return -ENOMEM;
@@ -210,7 +210,7 @@ static int htc_setup_complete(struct htc_target *target)
210 return 0; 210 return 0;
211 211
212err: 212err:
213 dev_kfree_skb(skb); 213 kfree_skb(skb);
214 return -EINVAL; 214 return -EINVAL;
215} 215}
216 216
@@ -250,8 +250,8 @@ int htc_connect_service(struct htc_target *target,
250 endpoint->dl_pipeid = service_to_dlpipe(service_connreq->service_id); 250 endpoint->dl_pipeid = service_to_dlpipe(service_connreq->service_id);
251 endpoint->ep_callbacks = service_connreq->ep_callbacks; 251 endpoint->ep_callbacks = service_connreq->ep_callbacks;
252 252
253 skb = dev_alloc_skb(sizeof(struct htc_conn_svc_msg) + 253 skb = alloc_skb(sizeof(struct htc_conn_svc_msg) +
254 sizeof(struct htc_frame_hdr)); 254 sizeof(struct htc_frame_hdr), GFP_ATOMIC);
255 if (!skb) { 255 if (!skb) {
256 dev_err(target->dev, "Failed to allocate buf to send" 256 dev_err(target->dev, "Failed to allocate buf to send"
257 "service connect req\n"); 257 "service connect req\n");
@@ -282,7 +282,7 @@ int htc_connect_service(struct htc_target *target,
282 *conn_rsp_epid = target->conn_rsp_epid; 282 *conn_rsp_epid = target->conn_rsp_epid;
283 return 0; 283 return 0;
284err: 284err:
285 dev_kfree_skb(skb); 285 kfree_skb(skb);
286 return ret; 286 return ret;
287} 287}
288 288
@@ -321,7 +321,7 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
321 struct sk_buff *skb, bool txok) 321 struct sk_buff *skb, bool txok)
322{ 322{
323 struct htc_endpoint *endpoint; 323 struct htc_endpoint *endpoint;
324 struct htc_frame_hdr *htc_hdr; 324 struct htc_frame_hdr *htc_hdr = NULL;
325 325
326 if (htc_handle->htc_flags & HTC_OP_CONFIG_PIPE_CREDITS) { 326 if (htc_handle->htc_flags & HTC_OP_CONFIG_PIPE_CREDITS) {
327 complete(&htc_handle->cmd_wait); 327 complete(&htc_handle->cmd_wait);
@@ -349,7 +349,10 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
349 return; 349 return;
350ret: 350ret:
351 /* HTC-generated packets are freed here. */ 351 /* HTC-generated packets are freed here. */
352 dev_kfree_skb_any(skb); 352 if (htc_hdr && htc_hdr->endpoint_id != ENDPOINT0)
353 dev_kfree_skb_any(skb);
354 else
355 kfree_skb(skb);
353} 356}
354 357
355/* 358/*
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index acb66544a2a..f2ff18cf3e6 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -213,7 +213,7 @@ free_skb:
213static void ath9k_wmi_ctrl_tx(void *priv, struct sk_buff *skb, 213static void ath9k_wmi_ctrl_tx(void *priv, struct sk_buff *skb,
214 enum htc_endpoint_id epid, bool txok) 214 enum htc_endpoint_id epid, bool txok)
215{ 215{
216 dev_kfree_skb_any(skb); 216 kfree_skb(skb);
217} 217}
218 218
219int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi, 219int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi,
@@ -269,7 +269,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
269 if (!wmi) 269 if (!wmi)
270 return -EINVAL; 270 return -EINVAL;
271 271
272 skb = dev_alloc_skb(headroom + cmd_len); 272 skb = alloc_skb(headroom + cmd_len, GFP_ATOMIC);
273 if (!skb) 273 if (!skb)
274 return -ENOMEM; 274 return -ENOMEM;
275 275
@@ -313,7 +313,7 @@ out:
313 ath_print(common, ATH_DBG_WMI, 313 ath_print(common, ATH_DBG_WMI,
314 "WMI failure for: %s\n", wmi_cmd_to_name(cmd_id)); 314 "WMI failure for: %s\n", wmi_cmd_to_name(cmd_id));
315 mutex_unlock(&wmi->op_mutex); 315 mutex_unlock(&wmi->op_mutex);
316 dev_kfree_skb_any(skb); 316 kfree_skb(skb);
317 317
318 return ret; 318 return ret;
319} 319}