diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2011-01-31 13:48:06 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-02-04 16:29:49 -0500 |
commit | c2fadcb3b16b294d7de509c42f1390f672510667 (patch) | |
tree | e01f72a37776473d42880b702a91b4df2368508e /drivers/net/wireless/zd1211rw | |
parent | 5cf6cf819bfffd89fc8c7c3a7406f54da4945a34 (diff) |
zd1211rw: support setting BSSID for AP mode
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/zd1211rw')
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_chip.c | 39 | ||||
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_chip.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_mac.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_mac.h | 1 |
4 files changed, 55 insertions, 11 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index 447f2360b0ca..71d3cdebca14 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c | |||
@@ -370,16 +370,12 @@ error: | |||
370 | return r; | 370 | return r; |
371 | } | 371 | } |
372 | 372 | ||
373 | /* MAC address: if custom mac addresses are to be used CR_MAC_ADDR_P1 and | 373 | static int zd_write_mac_addr_common(struct zd_chip *chip, const u8 *mac_addr, |
374 | * CR_MAC_ADDR_P2 must be overwritten | 374 | const struct zd_ioreq32 *in_reqs, |
375 | */ | 375 | const char *type) |
376 | int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr) | ||
377 | { | 376 | { |
378 | int r; | 377 | int r; |
379 | struct zd_ioreq32 reqs[2] = { | 378 | struct zd_ioreq32 reqs[2] = {in_reqs[0], in_reqs[1]}; |
380 | [0] = { .addr = CR_MAC_ADDR_P1 }, | ||
381 | [1] = { .addr = CR_MAC_ADDR_P2 }, | ||
382 | }; | ||
383 | 379 | ||
384 | if (mac_addr) { | 380 | if (mac_addr) { |
385 | reqs[0].value = (mac_addr[3] << 24) | 381 | reqs[0].value = (mac_addr[3] << 24) |
@@ -388,9 +384,9 @@ int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr) | |||
388 | | mac_addr[0]; | 384 | | mac_addr[0]; |
389 | reqs[1].value = (mac_addr[5] << 8) | 385 | reqs[1].value = (mac_addr[5] << 8) |
390 | | mac_addr[4]; | 386 | | mac_addr[4]; |
391 | dev_dbg_f(zd_chip_dev(chip), "mac addr %pM\n", mac_addr); | 387 | dev_dbg_f(zd_chip_dev(chip), "%s addr %pM\n", type, mac_addr); |
392 | } else { | 388 | } else { |
393 | dev_dbg_f(zd_chip_dev(chip), "set NULL mac\n"); | 389 | dev_dbg_f(zd_chip_dev(chip), "set NULL %s\n", type); |
394 | } | 390 | } |
395 | 391 | ||
396 | mutex_lock(&chip->mutex); | 392 | mutex_lock(&chip->mutex); |
@@ -399,6 +395,29 @@ int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr) | |||
399 | return r; | 395 | return r; |
400 | } | 396 | } |
401 | 397 | ||
398 | /* MAC address: if custom mac addresses are to be used CR_MAC_ADDR_P1 and | ||
399 | * CR_MAC_ADDR_P2 must be overwritten | ||
400 | */ | ||
401 | int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr) | ||
402 | { | ||
403 | static const struct zd_ioreq32 reqs[2] = { | ||
404 | [0] = { .addr = CR_MAC_ADDR_P1 }, | ||
405 | [1] = { .addr = CR_MAC_ADDR_P2 }, | ||
406 | }; | ||
407 | |||
408 | return zd_write_mac_addr_common(chip, mac_addr, reqs, "mac"); | ||
409 | } | ||
410 | |||
411 | int zd_write_bssid(struct zd_chip *chip, const u8 *bssid) | ||
412 | { | ||
413 | static const struct zd_ioreq32 reqs[2] = { | ||
414 | [0] = { .addr = CR_BSSID_P1 }, | ||
415 | [1] = { .addr = CR_BSSID_P2 }, | ||
416 | }; | ||
417 | |||
418 | return zd_write_mac_addr_common(chip, bssid, reqs, "bssid"); | ||
419 | } | ||
420 | |||
402 | int zd_read_regdomain(struct zd_chip *chip, u8 *regdomain) | 421 | int zd_read_regdomain(struct zd_chip *chip, u8 *regdomain) |
403 | { | 422 | { |
404 | int r; | 423 | int r; |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index f8bbf7d302ae..7b0c58ce7056 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h | |||
@@ -881,6 +881,7 @@ static inline u8 _zd_chip_get_channel(struct zd_chip *chip) | |||
881 | u8 zd_chip_get_channel(struct zd_chip *chip); | 881 | u8 zd_chip_get_channel(struct zd_chip *chip); |
882 | int zd_read_regdomain(struct zd_chip *chip, u8 *regdomain); | 882 | int zd_read_regdomain(struct zd_chip *chip, u8 *regdomain); |
883 | int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr); | 883 | int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr); |
884 | int zd_write_bssid(struct zd_chip *chip, const u8 *bssid); | ||
884 | int zd_chip_switch_radio_on(struct zd_chip *chip); | 885 | int zd_chip_switch_radio_on(struct zd_chip *chip); |
885 | int zd_chip_switch_radio_off(struct zd_chip *chip); | 886 | int zd_chip_switch_radio_off(struct zd_chip *chip); |
886 | int zd_chip_enable_int(struct zd_chip *chip); | 887 | int zd_chip_enable_int(struct zd_chip *chip); |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 487ed33e951d..ab0d1b9a08ec 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -231,6 +231,26 @@ static int set_rx_filter(struct zd_mac *mac) | |||
231 | return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter); | 231 | return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter); |
232 | } | 232 | } |
233 | 233 | ||
234 | static int set_mac_and_bssid(struct zd_mac *mac) | ||
235 | { | ||
236 | int r; | ||
237 | |||
238 | if (!mac->vif) | ||
239 | return -1; | ||
240 | |||
241 | r = zd_write_mac_addr(&mac->chip, mac->vif->addr); | ||
242 | if (r) | ||
243 | return r; | ||
244 | |||
245 | /* Vendor driver after setting MAC either sets BSSID for AP or | ||
246 | * filter for other modes. | ||
247 | */ | ||
248 | if (mac->type != NL80211_IFTYPE_AP) | ||
249 | return set_rx_filter(mac); | ||
250 | else | ||
251 | return zd_write_bssid(&mac->chip, mac->vif->addr); | ||
252 | } | ||
253 | |||
234 | static int set_mc_hash(struct zd_mac *mac) | 254 | static int set_mc_hash(struct zd_mac *mac) |
235 | { | 255 | { |
236 | struct zd_mc_hash hash; | 256 | struct zd_mc_hash hash; |
@@ -888,7 +908,9 @@ static int zd_op_add_interface(struct ieee80211_hw *hw, | |||
888 | return -EOPNOTSUPP; | 908 | return -EOPNOTSUPP; |
889 | } | 909 | } |
890 | 910 | ||
891 | return zd_write_mac_addr(&mac->chip, vif->addr); | 911 | mac->vif = vif; |
912 | |||
913 | return set_mac_and_bssid(mac); | ||
892 | } | 914 | } |
893 | 915 | ||
894 | static void zd_op_remove_interface(struct ieee80211_hw *hw, | 916 | static void zd_op_remove_interface(struct ieee80211_hw *hw, |
@@ -896,6 +918,7 @@ static void zd_op_remove_interface(struct ieee80211_hw *hw, | |||
896 | { | 918 | { |
897 | struct zd_mac *mac = zd_hw_mac(hw); | 919 | struct zd_mac *mac = zd_hw_mac(hw); |
898 | mac->type = NL80211_IFTYPE_UNSPECIFIED; | 920 | mac->type = NL80211_IFTYPE_UNSPECIFIED; |
921 | mac->vif = NULL; | ||
899 | zd_set_beacon_interval(&mac->chip, 0); | 922 | zd_set_beacon_interval(&mac->chip, 0); |
900 | zd_write_mac_addr(&mac->chip, NULL); | 923 | zd_write_mac_addr(&mac->chip, NULL); |
901 | } | 924 | } |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h index ff7ef30372a1..0ec6bde0b37c 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.h +++ b/drivers/net/wireless/zd1211rw/zd_mac.h | |||
@@ -172,6 +172,7 @@ struct zd_mac { | |||
172 | spinlock_t lock; | 172 | spinlock_t lock; |
173 | spinlock_t intr_lock; | 173 | spinlock_t intr_lock; |
174 | struct ieee80211_hw *hw; | 174 | struct ieee80211_hw *hw; |
175 | struct ieee80211_vif *vif; | ||
175 | struct housekeeping housekeeping; | 176 | struct housekeeping housekeeping; |
176 | struct work_struct set_rts_cts_work; | 177 | struct work_struct set_rts_cts_work; |
177 | struct work_struct process_intr; | 178 | struct work_struct process_intr; |