315-ath9k-Fix-address-management.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From: Sujith Manoharan <[email protected]>
  2. Date: Fri, 17 Oct 2014 07:40:20 +0530
  3. Subject: [PATCH] ath9k: Fix address management
  4. Since both the arguments need to satisfy
  5. the alignment requirements of ether_addr_copy(),
  6. use memcpy() in cases where there will be no
  7. big performance benefit and make sure that
  8. ether_addr_copy() calls use properly aligned
  9. arguments.
  10. Signed-off-by: Sujith Manoharan <[email protected]>
  11. ---
  12. --- a/drivers/net/wireless/ath/ath.h
  13. +++ b/drivers/net/wireless/ath/ath.h
  14. @@ -147,7 +147,7 @@ struct ath_common {
  15. u16 cachelsz;
  16. u16 curaid;
  17. u8 macaddr[ETH_ALEN];
  18. - u8 curbssid[ETH_ALEN];
  19. + u8 curbssid[ETH_ALEN] __aligned(2);
  20. u8 bssidmask[ETH_ALEN];
  21. u32 rx_bufsize;
  22. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  23. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  24. @@ -595,7 +595,7 @@ struct ath_vif {
  25. u16 seq_no;
  26. /* BSS info */
  27. - u8 bssid[ETH_ALEN];
  28. + u8 bssid[ETH_ALEN] __aligned(2);
  29. u16 aid;
  30. bool assoc;
  31. --- a/drivers/net/wireless/ath/ath9k/main.c
  32. +++ b/drivers/net/wireless/ath/ath9k/main.c
  33. @@ -1057,7 +1057,7 @@ static void ath9k_set_offchannel_state(s
  34. eth_zero_addr(common->curbssid);
  35. eth_broadcast_addr(common->bssidmask);
  36. - ether_addr_copy(common->macaddr, vif->addr);
  37. + memcpy(common->macaddr, vif->addr, ETH_ALEN);
  38. common->curaid = 0;
  39. ah->opmode = vif->type;
  40. ah->imask &= ~ATH9K_INT_SWBA;
  41. @@ -1098,7 +1098,7 @@ void ath9k_calculate_summary_state(struc
  42. ath9k_calculate_iter_data(sc, ctx, &iter_data);
  43. if (iter_data.has_hw_macaddr)
  44. - ether_addr_copy(common->macaddr, iter_data.hw_macaddr);
  45. + memcpy(common->macaddr, iter_data.hw_macaddr, ETH_ALEN);
  46. memcpy(common->bssidmask, iter_data.mask, ETH_ALEN);
  47. ath_hw_setbssidmask(common);
  48. @@ -1785,7 +1785,7 @@ static void ath9k_bss_info_changed(struc
  49. ath_dbg(common, CONFIG, "BSSID %pM Changed ASSOC %d\n",
  50. bss_conf->bssid, bss_conf->assoc);
  51. - ether_addr_copy(avp->bssid, bss_conf->bssid);
  52. + memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN);
  53. avp->aid = bss_conf->aid;
  54. avp->assoc = bss_conf->assoc;