Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: chromeos/compat-wireless/drivers/net/wireless/ath/ath9k/main.c

Issue 5990016: ath9k: AR9380 PAPRD changes to improve tx performance (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/kernel.git@master
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008-2009 Atheros Communications Inc. 2 * Copyright (c) 2008-2009 Atheros Communications Inc.
3 * 3 *
4 * Permission to use, copy, modify, and/or distribute this software for any 4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above 5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies. 6 * copyright notice and this permission notice appear in all copies.
7 * 7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 if (!(common->tx_chainmask & BIT(chain))) 283 if (!(common->tx_chainmask & BIT(chain)))
284 continue; 284 continue;
285 285
286 ar9003_paprd_populate_single_table(ah, caldata, chain); 286 ar9003_paprd_populate_single_table(ah, caldata, chain);
287 } 287 }
288 288
289 ar9003_paprd_enable(ah, true); 289 ar9003_paprd_enable(ah, true);
290 ath9k_ps_restore(sc); 290 ath9k_ps_restore(sc);
291 } 291 }
292 292
293 static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain)
294 {
295 struct ieee80211_hw *hw = sc->hw;
296 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
297 struct ath_tx_control txctl;
298 int time_left;
299
300 memset(&txctl, 0, sizeof(txctl));
301 txctl.txq = sc->tx.txq_map[WME_AC_BE];
302
303 memset(tx_info, 0, sizeof(*tx_info));
304 tx_info->band = hw->conf.channel->band;
305 tx_info->flags |= IEEE80211_TX_CTL_NO_ACK;
306 tx_info->control.rates[0].idx = 0;
307 tx_info->control.rates[0].count = 1;
308 tx_info->control.rates[0].flags = IEEE80211_TX_RC_MCS;
309 tx_info->control.rates[1].idx = -1;
310
311 init_completion(&sc->paprd_complete);
312 sc->paprd_pending = true;
313 txctl.paprd = BIT(chain);
314 if (ath_tx_start(hw, skb, &txctl) != 0)
315 return false;
316
317 time_left = wait_for_completion_timeout(&sc->paprd_complete,
318 msecs_to_jiffies(ATH_PAPRD_TIMEOUT));
319 sc->paprd_pending = false;
320
321 if (!time_left)
322 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CALIBRATE,
323 "Timeout waiting for paprd training on TX chain %d\n",
324 chain);
325
326 return !!time_left;
327 }
328
293 void ath_paprd_calibrate(struct work_struct *work) 329 void ath_paprd_calibrate(struct work_struct *work)
294 { 330 {
295 struct ath_softc *sc = container_of(work, struct ath_softc, paprd_work); 331 struct ath_softc *sc = container_of(work, struct ath_softc, paprd_work);
296 struct ieee80211_hw *hw = sc->hw; 332 struct ieee80211_hw *hw = sc->hw;
297 struct ath_hw *ah = sc->sc_ah; 333 struct ath_hw *ah = sc->sc_ah;
298 struct ieee80211_hdr *hdr; 334 struct ieee80211_hdr *hdr;
299 struct sk_buff *skb = NULL; 335 struct sk_buff *skb = NULL;
300 struct ieee80211_tx_info *tx_info;
301 int band = hw->conf.channel->band;
302 struct ieee80211_supported_band *sband = &sc->sbands[band];
303 struct ath_tx_control txctl;
304 struct ath9k_hw_cal_data *caldata = ah->caldata; 336 struct ath9k_hw_cal_data *caldata = ah->caldata;
305 struct ath_common *common = ath9k_hw_common(ah); 337 struct ath_common *common = ath9k_hw_common(ah);
306 int ftype; 338 int ftype;
307 int chain_ok = 0; 339 int chain_ok = 0;
308 int chain; 340 int chain;
309 int len = 1800; 341 int len = 1800;
310 int time_left;
311 int i;
312 342
313 if (!caldata) 343 if (!caldata)
314 return; 344 return;
315 345
346 if (ar9003_paprd_init_table(ah) < 0)
347 return;
348
316 skb = alloc_skb(len, GFP_KERNEL); 349 skb = alloc_skb(len, GFP_KERNEL);
317 if (!skb) 350 if (!skb)
318 return; 351 return;
319 352
320 tx_info = IEEE80211_SKB_CB(skb);
321
322 skb_put(skb, len); 353 skb_put(skb, len);
323 memset(skb->data, 0, len); 354 memset(skb->data, 0, len);
324 hdr = (struct ieee80211_hdr *)skb->data; 355 hdr = (struct ieee80211_hdr *)skb->data;
325 ftype = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC; 356 ftype = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC;
326 hdr->frame_control = cpu_to_le16(ftype); 357 hdr->frame_control = cpu_to_le16(ftype);
327 hdr->duration_id = cpu_to_le16(10); 358 hdr->duration_id = cpu_to_le16(10);
328 memcpy(hdr->addr1, hw->wiphy->perm_addr, ETH_ALEN); 359 memcpy(hdr->addr1, hw->wiphy->perm_addr, ETH_ALEN);
329 memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); 360 memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN);
330 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); 361 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN);
331 362
332 memset(&txctl, 0, sizeof(txctl));
333 txctl.txq = sc->tx.txq_map[WME_AC_BE];
334
335 ath9k_ps_wakeup(sc); 363 ath9k_ps_wakeup(sc);
336 ar9003_paprd_init_table(ah);
337 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { 364 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
338 if (!(common->tx_chainmask & BIT(chain))) 365 if (!(common->tx_chainmask & BIT(chain)))
339 continue; 366 continue;
340 367
341 chain_ok = 0; 368 chain_ok = 0;
342 memset(tx_info, 0, sizeof(*tx_info));
343 tx_info->band = band;
344 369
345 » » for (i = 0; i < 4; i++) { 370 » » ath_print(common, ATH_DBG_CALIBRATE,
346 » » » tx_info->control.rates[i].idx = sband->n_bitrates - 1; 371 » » » "Sending PAPRD frame for thermal measurement "
347 » » » tx_info->control.rates[i].count = 6; 372 » » » "on chain %d\n", chain);
348 » » } 373 » » if (!ath_paprd_send_frame(sc, skb, chain))
374 » » » goto fail_paprd;
349 375
350 init_completion(&sc->paprd_complete);
351 ar9003_paprd_setup_gain_table(ah, chain); 376 ar9003_paprd_setup_gain_table(ah, chain);
352 txctl.paprd = BIT(chain);
353 if (ath_tx_start(hw, skb, &txctl) != 0)
354 break;
355 377
356 » » time_left = wait_for_completion_timeout(&sc->paprd_complete, 378 » » ath_print(common, ATH_DBG_CALIBRATE,
357 » » » » msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); 379 » » » "Sending PAPRD training frame on chain %d\n", chain);
358 » » if (!time_left) { 380 » » if (!ath_paprd_send_frame(sc, skb, chain))
359 » » » ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE,
360 » » » » "Timeout waiting for paprd training on "
361 » » » » "TX chain %d\n",
362 » » » » chain);
363 goto fail_paprd; 381 goto fail_paprd;
364 }
365 382
366 if (!ar9003_paprd_is_done(ah)) 383 if (!ar9003_paprd_is_done(ah))
367 break; 384 break;
368 385
369 if (ar9003_paprd_create_curve(ah, caldata, chain) != 0) 386 if (ar9003_paprd_create_curve(ah, caldata, chain) != 0)
370 break; 387 break;
371 388
372 chain_ok = 1; 389 chain_ok = 1;
373 } 390 }
374 kfree_skb(skb); 391 kfree_skb(skb);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (sc->sc_ah->config.enable_ani) 496 if (sc->sc_ah->config.enable_ani)
480 cal_interval = min(cal_interval, 497 cal_interval = min(cal_interval,
481 (u32)ah->config.ani_poll_interval); 498 (u32)ah->config.ani_poll_interval);
482 if (!common->ani.caldone) 499 if (!common->ani.caldone)
483 cal_interval = min(cal_interval, (u32)short_cal_interval); 500 cal_interval = min(cal_interval, (u32)short_cal_interval);
484 501
485 mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); 502 mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
486 if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) { 503 if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) {
487 if (!ah->caldata->paprd_done) 504 if (!ah->caldata->paprd_done)
488 ieee80211_queue_work(sc->hw, &sc->paprd_work); 505 ieee80211_queue_work(sc->hw, &sc->paprd_work);
489 » » else 506 » » else if (!ah->paprd_table_write_done)
490 ath_paprd_activate(sc); 507 ath_paprd_activate(sc);
491 } 508 }
492 } 509 }
493 510
494 /* 511 /*
495 * Update tx/rx chainmask. For legacy association, 512 * Update tx/rx chainmask. For legacy association,
496 * hard code chainmask to 1x1, for 11n association, use 513 * hard code chainmask to 1x1, for 11n association, use
497 * the chainmask configuration, for bt coexistence, use 514 * the chainmask configuration, for bt coexistence, use
498 * the chainmask configuration even in legacy mode. 515 * the chainmask configuration even in legacy mode.
499 */ 516 */
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 .get_tsf = ath9k_get_tsf, 2067 .get_tsf = ath9k_get_tsf,
2051 .set_tsf = ath9k_set_tsf, 2068 .set_tsf = ath9k_set_tsf,
2052 .reset_tsf = ath9k_reset_tsf, 2069 .reset_tsf = ath9k_reset_tsf,
2053 .ampdu_action = ath9k_ampdu_action, 2070 .ampdu_action = ath9k_ampdu_action,
2054 .get_survey = ath9k_get_survey, 2071 .get_survey = ath9k_get_survey,
2055 .sw_scan_start = ath9k_sw_scan_start, 2072 .sw_scan_start = ath9k_sw_scan_start,
2056 .sw_scan_complete = ath9k_sw_scan_complete, 2073 .sw_scan_complete = ath9k_sw_scan_complete,
2057 .rfkill_poll = ath9k_rfkill_poll_state, 2074 .rfkill_poll = ath9k_rfkill_poll_state,
2058 .set_coverage_class = ath9k_set_coverage_class, 2075 .set_coverage_class = ath9k_set_coverage_class,
2059 }; 2076 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698