diff options
author | Arik Nemtsov <arik@wizery.com> | 2012-08-02 13:37:21 -0400 |
---|---|---|
committer | Luciano Coelho <luca@coelho.fi> | 2012-09-27 05:13:52 -0400 |
commit | f4afbed9447c86e5d3cec5933ae74b902617987c (patch) | |
tree | b62d8cfa0c1c7abc9b45578b6d06828b364fbe33 | |
parent | d49524d3e8406e3b858650abcf846531a2104120 (diff) |
wlcore/wl18xx/wl12xx: allow up to 3 mac addresses
Allow 3 native mac addresses on 18xx. On 12xx allow 2 native mac
addresses and set the LAA bit to create a third mac address. This
enabled operation with a separate group interface.
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/main.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/wl12xx.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/main.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/wl18xx.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/main.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/wlcore.h | 11 |
6 files changed, 38 insertions, 9 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index 0a8bc0c7b6cc..f49ce7c633b6 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c | |||
@@ -1643,6 +1643,7 @@ static int __devinit wl12xx_probe(struct platform_device *pdev) | |||
1643 | wl->rtable = wl12xx_rtable; | 1643 | wl->rtable = wl12xx_rtable; |
1644 | wl->num_tx_desc = WL12XX_NUM_TX_DESCRIPTORS; | 1644 | wl->num_tx_desc = WL12XX_NUM_TX_DESCRIPTORS; |
1645 | wl->num_rx_desc = WL12XX_NUM_RX_DESCRIPTORS; | 1645 | wl->num_rx_desc = WL12XX_NUM_RX_DESCRIPTORS; |
1646 | wl->num_mac_addr = WL12XX_NUM_MAC_ADDRESSES; | ||
1646 | wl->band_rate_to_idx = wl12xx_band_rate_to_idx; | 1647 | wl->band_rate_to_idx = wl12xx_band_rate_to_idx; |
1647 | wl->hw_tx_rate_tbl_size = WL12XX_CONF_HW_RXTX_RATE_MAX; | 1648 | wl->hw_tx_rate_tbl_size = WL12XX_CONF_HW_RXTX_RATE_MAX; |
1648 | wl->hw_min_ht_rate = WL12XX_CONF_HW_RXTX_RATE_MCS0; | 1649 | wl->hw_min_ht_rate = WL12XX_CONF_HW_RXTX_RATE_MCS0; |
diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h index 9953374a307d..7182bbf6625d 100644 --- a/drivers/net/wireless/ti/wl12xx/wl12xx.h +++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h | |||
@@ -43,6 +43,8 @@ | |||
43 | #define WL12XX_NUM_TX_DESCRIPTORS 16 | 43 | #define WL12XX_NUM_TX_DESCRIPTORS 16 |
44 | #define WL12XX_NUM_RX_DESCRIPTORS 8 | 44 | #define WL12XX_NUM_RX_DESCRIPTORS 8 |
45 | 45 | ||
46 | #define WL12XX_NUM_MAC_ADDRESSES 2 | ||
47 | |||
46 | struct wl127x_rx_mem_pool_addr { | 48 | struct wl127x_rx_mem_pool_addr { |
47 | u32 addr; | 49 | u32 addr; |
48 | u32 addr_extra; | 50 | u32 addr_extra; |
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c index 3f4fbd80d4ae..93b148fe17a3 100644 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ b/drivers/net/wireless/ti/wl18xx/main.c | |||
@@ -1394,6 +1394,7 @@ static int __devinit wl18xx_probe(struct platform_device *pdev) | |||
1394 | wl->rtable = wl18xx_rtable; | 1394 | wl->rtable = wl18xx_rtable; |
1395 | wl->num_tx_desc = WL18XX_NUM_TX_DESCRIPTORS; | 1395 | wl->num_tx_desc = WL18XX_NUM_TX_DESCRIPTORS; |
1396 | wl->num_rx_desc = WL18XX_NUM_TX_DESCRIPTORS; | 1396 | wl->num_rx_desc = WL18XX_NUM_TX_DESCRIPTORS; |
1397 | wl->num_mac_addr = WL18XX_NUM_MAC_ADDRESSES; | ||
1397 | wl->band_rate_to_idx = wl18xx_band_rate_to_idx; | 1398 | wl->band_rate_to_idx = wl18xx_band_rate_to_idx; |
1398 | wl->hw_tx_rate_tbl_size = WL18XX_CONF_HW_RXTX_RATE_MAX; | 1399 | wl->hw_tx_rate_tbl_size = WL18XX_CONF_HW_RXTX_RATE_MAX; |
1399 | wl->hw_min_ht_rate = WL18XX_CONF_HW_RXTX_RATE_MCS0; | 1400 | wl->hw_min_ht_rate = WL18XX_CONF_HW_RXTX_RATE_MCS0; |
diff --git a/drivers/net/wireless/ti/wl18xx/wl18xx.h b/drivers/net/wireless/ti/wl18xx/wl18xx.h index a6e61a25124d..96a1e438d677 100644 --- a/drivers/net/wireless/ti/wl18xx/wl18xx.h +++ b/drivers/net/wireless/ti/wl18xx/wl18xx.h | |||
@@ -38,6 +38,8 @@ | |||
38 | #define WL18XX_NUM_TX_DESCRIPTORS 32 | 38 | #define WL18XX_NUM_TX_DESCRIPTORS 32 |
39 | #define WL18XX_NUM_RX_DESCRIPTORS 32 | 39 | #define WL18XX_NUM_RX_DESCRIPTORS 32 |
40 | 40 | ||
41 | #define WL18XX_NUM_MAC_ADDRESSES 3 | ||
42 | |||
41 | struct wl18xx_priv { | 43 | struct wl18xx_priv { |
42 | /* buffer for sending commands to FW */ | 44 | /* buffer for sending commands to FW */ |
43 | u8 cmd_buf[WL18XX_CMD_MAX_SIZE]; | 45 | u8 cmd_buf[WL18XX_CMD_MAX_SIZE]; |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index ae2b0fd7e558..dd0cbd9f6ce1 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -5074,18 +5074,17 @@ out: | |||
5074 | mutex_unlock(&wl->mutex); | 5074 | mutex_unlock(&wl->mutex); |
5075 | } | 5075 | } |
5076 | 5076 | ||
5077 | static void wl12xx_derive_mac_addresses(struct wl1271 *wl, | 5077 | static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) |
5078 | u32 oui, u32 nic, int n) | ||
5079 | { | 5078 | { |
5080 | int i; | 5079 | int i; |
5081 | 5080 | ||
5082 | wl1271_debug(DEBUG_PROBE, "base address: oui %06x nic %06x, n %d", | 5081 | wl1271_debug(DEBUG_PROBE, "base address: oui %06x nic %06x", |
5083 | oui, nic, n); | 5082 | oui, nic); |
5084 | 5083 | ||
5085 | if (nic + n - 1 > 0xffffff) | 5084 | if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xffffff) |
5086 | wl1271_warning("NIC part of the MAC address wraps around!"); | 5085 | wl1271_warning("NIC part of the MAC address wraps around!"); |
5087 | 5086 | ||
5088 | for (i = 0; i < n; i++) { | 5087 | for (i = 0; i < wl->num_mac_addr; i++) { |
5089 | wl->addresses[i].addr[0] = (u8)(oui >> 16); | 5088 | wl->addresses[i].addr[0] = (u8)(oui >> 16); |
5090 | wl->addresses[i].addr[1] = (u8)(oui >> 8); | 5089 | wl->addresses[i].addr[1] = (u8)(oui >> 8); |
5091 | wl->addresses[i].addr[2] = (u8) oui; | 5090 | wl->addresses[i].addr[2] = (u8) oui; |
@@ -5095,7 +5094,22 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl, | |||
5095 | nic++; | 5094 | nic++; |
5096 | } | 5095 | } |
5097 | 5096 | ||
5098 | wl->hw->wiphy->n_addresses = n; | 5097 | /* we may be one address short at the most */ |
5098 | WARN_ON(wl->num_mac_addr + 1 < WLCORE_NUM_MAC_ADDRESSES); | ||
5099 | |||
5100 | /* | ||
5101 | * turn on the LAA bit in the first address and use it as | ||
5102 | * the last address. | ||
5103 | */ | ||
5104 | if (wl->num_mac_addr < WLCORE_NUM_MAC_ADDRESSES) { | ||
5105 | int idx = WLCORE_NUM_MAC_ADDRESSES - 1; | ||
5106 | memcpy(&wl->addresses[idx], &wl->addresses[0], | ||
5107 | sizeof(wl->addresses[0])); | ||
5108 | /* LAA bit */ | ||
5109 | wl->addresses[idx].addr[2] |= BIT(1); | ||
5110 | } | ||
5111 | |||
5112 | wl->hw->wiphy->n_addresses = WLCORE_NUM_MAC_ADDRESSES; | ||
5099 | wl->hw->wiphy->addresses = wl->addresses; | 5113 | wl->hw->wiphy->addresses = wl->addresses; |
5100 | } | 5114 | } |
5101 | 5115 | ||
@@ -5155,7 +5169,7 @@ static int wl1271_register_hw(struct wl1271 *wl) | |||
5155 | nic_addr = wl->fuse_nic_addr + 1; | 5169 | nic_addr = wl->fuse_nic_addr + 1; |
5156 | } | 5170 | } |
5157 | 5171 | ||
5158 | wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr, 2); | 5172 | wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); |
5159 | 5173 | ||
5160 | ret = ieee80211_register_hw(wl->hw); | 5174 | ret = ieee80211_register_hw(wl->hw); |
5161 | if (ret < 0) { | 5175 | if (ret < 0) { |
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index a7e9d5869db4..165afae2d9ad 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h | |||
@@ -31,6 +31,12 @@ | |||
31 | /* The maximum number of Tx descriptors in all chip families */ | 31 | /* The maximum number of Tx descriptors in all chip families */ |
32 | #define WLCORE_MAX_TX_DESCRIPTORS 32 | 32 | #define WLCORE_MAX_TX_DESCRIPTORS 32 |
33 | 33 | ||
34 | /* | ||
35 | * We always allocate this number of mac addresses. If we don't | ||
36 | * have enough allocated addresses, the LAA bit is used | ||
37 | */ | ||
38 | #define WLCORE_NUM_MAC_ADDRESSES 3 | ||
39 | |||
34 | /* forward declaration */ | 40 | /* forward declaration */ |
35 | struct wl1271_tx_hw_descr; | 41 | struct wl1271_tx_hw_descr; |
36 | enum wl_rx_buf_align; | 42 | enum wl_rx_buf_align; |
@@ -181,7 +187,7 @@ struct wl1271 { | |||
181 | u32 fuse_nic_addr; | 187 | u32 fuse_nic_addr; |
182 | 188 | ||
183 | /* we have up to 2 MAC addresses */ | 189 | /* we have up to 2 MAC addresses */ |
184 | struct mac_address addresses[2]; | 190 | struct mac_address addresses[WLCORE_NUM_MAC_ADDRESSES]; |
185 | int channel; | 191 | int channel; |
186 | u8 system_hlid; | 192 | u8 system_hlid; |
187 | 193 | ||
@@ -394,6 +400,9 @@ struct wl1271 { | |||
394 | /* sleep auth value currently configured to FW */ | 400 | /* sleep auth value currently configured to FW */ |
395 | int sleep_auth; | 401 | int sleep_auth; |
396 | 402 | ||
403 | /* the number of allocated MAC addresses in this chip */ | ||
404 | int num_mac_addr; | ||
405 | |||
397 | /* the minimum FW version required for the driver to work */ | 406 | /* the minimum FW version required for the driver to work */ |
398 | unsigned int min_fw_ver[NUM_FW_VER]; | 407 | unsigned int min_fw_ver[NUM_FW_VER]; |
399 | }; | 408 | }; |