diff options
author | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-11-14 12:31:30 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-11-16 03:22:34 -0500 |
commit | 71f96ee6c6fd50fefb3f5550f25380060a85eebf (patch) | |
tree | 4f8cb8007d24753e91e4b661bf924c31810090f2 /drivers | |
parent | d1a9421ddc63c2b81f9b05ea7ba6082c13b933b5 (diff) |
ath6kl: make maximum number of vifs runtime configurable
Needed when detecting how many vifs firmware supports.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/cfg80211.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/core.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/init.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/txrx.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/wmi.c | 6 |
5 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 7cf983bf5ab8..5241929877ec 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c | |||
@@ -357,7 +357,7 @@ static bool ath6kl_is_valid_iftype(struct ath6kl *ar, enum nl80211_iftype type, | |||
357 | 357 | ||
358 | if (type == NL80211_IFTYPE_STATION || | 358 | if (type == NL80211_IFTYPE_STATION || |
359 | type == NL80211_IFTYPE_AP || type == NL80211_IFTYPE_ADHOC) { | 359 | type == NL80211_IFTYPE_AP || type == NL80211_IFTYPE_ADHOC) { |
360 | for (i = 0; i < MAX_NUM_VIF; i++) { | 360 | for (i = 0; i < ar->vif_max; i++) { |
361 | if ((ar->avail_idx_map >> i) & BIT(0)) { | 361 | if ((ar->avail_idx_map >> i) & BIT(0)) { |
362 | *if_idx = i; | 362 | *if_idx = i; |
363 | return true; | 363 | return true; |
@@ -367,7 +367,7 @@ static bool ath6kl_is_valid_iftype(struct ath6kl *ar, enum nl80211_iftype type, | |||
367 | 367 | ||
368 | if (type == NL80211_IFTYPE_P2P_CLIENT || | 368 | if (type == NL80211_IFTYPE_P2P_CLIENT || |
369 | type == NL80211_IFTYPE_P2P_GO) { | 369 | type == NL80211_IFTYPE_P2P_GO) { |
370 | for (i = ar->max_norm_iface; i < MAX_NUM_VIF; i++) { | 370 | for (i = ar->max_norm_iface; i < ar->vif_max; i++) { |
371 | if ((ar->avail_idx_map >> i) & BIT(0)) { | 371 | if ((ar->avail_idx_map >> i) & BIT(0)) { |
372 | *if_idx = i; | 372 | *if_idx = i; |
373 | return true; | 373 | return true; |
@@ -1306,7 +1306,7 @@ static struct net_device *ath6kl_cfg80211_add_iface(struct wiphy *wiphy, | |||
1306 | struct net_device *ndev; | 1306 | struct net_device *ndev; |
1307 | u8 if_idx, nw_type; | 1307 | u8 if_idx, nw_type; |
1308 | 1308 | ||
1309 | if (ar->num_vif == MAX_NUM_VIF) { | 1309 | if (ar->num_vif == ar->vif_max) { |
1310 | ath6kl_err("Reached maximum number of supported vif\n"); | 1310 | ath6kl_err("Reached maximum number of supported vif\n"); |
1311 | return ERR_PTR(-EINVAL); | 1311 | return ERR_PTR(-EINVAL); |
1312 | } | 1312 | } |
@@ -2459,6 +2459,8 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev) | |||
2459 | ar->wiphy = wiphy; | 2459 | ar->wiphy = wiphy; |
2460 | ar->dev = dev; | 2460 | ar->dev = dev; |
2461 | 2461 | ||
2462 | ar->vif_max = 1; | ||
2463 | |||
2462 | if (multi_norm_if_support) | 2464 | if (multi_norm_if_support) |
2463 | ar->max_norm_iface = 2; | 2465 | ar->max_norm_iface = 2; |
2464 | else | 2466 | else |
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h index 1697c00351a4..6fdaaf7321e1 100644 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ b/drivers/net/wireless/ath/ath6kl/core.h | |||
@@ -399,7 +399,11 @@ enum ath6kl_hif_type { | |||
399 | ATH6KL_HIF_TYPE_USB, | 399 | ATH6KL_HIF_TYPE_USB, |
400 | }; | 400 | }; |
401 | 401 | ||
402 | #define MAX_NUM_VIF 1 | 402 | /* |
403 | * Driver's maximum limit, note that some firmwares support only one vif | ||
404 | * and the runtime (current) limit must be checked from ar->vif_max. | ||
405 | */ | ||
406 | #define ATH6KL_VIF_MAX 1 | ||
403 | 407 | ||
404 | /* vif flags info */ | 408 | /* vif flags info */ |
405 | enum ath6kl_vif_state { | 409 | enum ath6kl_vif_state { |
@@ -498,6 +502,7 @@ struct ath6kl { | |||
498 | /* Lock to avoid race in vif_list entries among add/del/traverse */ | 502 | /* Lock to avoid race in vif_list entries among add/del/traverse */ |
499 | spinlock_t list_lock; | 503 | spinlock_t list_lock; |
500 | u8 num_vif; | 504 | u8 num_vif; |
505 | int vif_max; | ||
501 | u8 max_norm_iface; | 506 | u8 max_norm_iface; |
502 | u8 avail_idx_map; | 507 | u8 avail_idx_map; |
503 | spinlock_t lock; | 508 | spinlock_t lock; |
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index 9d6e50d5c90a..0f7246166562 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -463,7 +463,7 @@ int ath6kl_configure_target(struct ath6kl *ar) | |||
463 | */ | 463 | */ |
464 | fw_iftype = HI_OPTION_FW_MODE_BSS_STA; | 464 | fw_iftype = HI_OPTION_FW_MODE_BSS_STA; |
465 | 465 | ||
466 | for (i = 0; i < MAX_NUM_VIF; i++) | 466 | for (i = 0; i < ar->vif_max; i++) |
467 | fw_mode |= fw_iftype << (i * HI_OPTION_FW_MODE_BITS); | 467 | fw_mode |= fw_iftype << (i * HI_OPTION_FW_MODE_BITS); |
468 | 468 | ||
469 | /* | 469 | /* |
@@ -477,7 +477,7 @@ int ath6kl_configure_target(struct ath6kl *ar) | |||
477 | fw_submode |= HI_OPTION_FW_SUBMODE_NONE << | 477 | fw_submode |= HI_OPTION_FW_SUBMODE_NONE << |
478 | (i * HI_OPTION_FW_SUBMODE_BITS); | 478 | (i * HI_OPTION_FW_SUBMODE_BITS); |
479 | 479 | ||
480 | for (i = ar->max_norm_iface; i < MAX_NUM_VIF; i++) | 480 | for (i = ar->max_norm_iface; i < ar->vif_max; i++) |
481 | fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV << | 481 | fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV << |
482 | (i * HI_OPTION_FW_SUBMODE_BITS); | 482 | (i * HI_OPTION_FW_SUBMODE_BITS); |
483 | 483 | ||
@@ -508,7 +508,7 @@ int ath6kl_configure_target(struct ath6kl *ar) | |||
508 | return -EIO; | 508 | return -EIO; |
509 | } | 509 | } |
510 | 510 | ||
511 | param |= (MAX_NUM_VIF << HI_OPTION_NUM_DEV_SHIFT); | 511 | param |= (ar->vif_max << HI_OPTION_NUM_DEV_SHIFT); |
512 | param |= fw_mode << HI_OPTION_FW_MODE_SHIFT; | 512 | param |= fw_mode << HI_OPTION_FW_MODE_SHIFT; |
513 | param |= fw_submode << HI_OPTION_FW_SUBMODE_SHIFT; | 513 | param |= fw_submode << HI_OPTION_FW_SUBMODE_SHIFT; |
514 | 514 | ||
@@ -1482,7 +1482,7 @@ int ath6kl_init_hw_start(struct ath6kl *ar) | |||
1482 | if ((ath6kl_set_host_app_area(ar)) != 0) | 1482 | if ((ath6kl_set_host_app_area(ar)) != 0) |
1483 | ath6kl_err("unable to set the host app area\n"); | 1483 | ath6kl_err("unable to set the host app area\n"); |
1484 | 1484 | ||
1485 | for (i = 0; i < MAX_NUM_VIF; i++) { | 1485 | for (i = 0; i < ar->vif_max; i++) { |
1486 | ret = ath6kl_target_config_wlan_params(ar, i); | 1486 | ret = ath6kl_target_config_wlan_params(ar, i); |
1487 | if (ret) | 1487 | if (ret) |
1488 | goto err_htc_stop; | 1488 | goto err_htc_stop; |
@@ -1592,7 +1592,7 @@ int ath6kl_core_init(struct ath6kl *ar) | |||
1592 | goto err_node_cleanup; | 1592 | goto err_node_cleanup; |
1593 | } | 1593 | } |
1594 | 1594 | ||
1595 | for (i = 0; i < MAX_NUM_VIF; i++) | 1595 | for (i = 0; i < ar->vif_max; i++) |
1596 | ar->avail_idx_map |= BIT(i); | 1596 | ar->avail_idx_map |= BIT(i); |
1597 | 1597 | ||
1598 | rtnl_lock(); | 1598 | rtnl_lock(); |
diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c index 0b45d45c22a0..506a3031a885 100644 --- a/drivers/net/wireless/ath/ath6kl/txrx.c +++ b/drivers/net/wireless/ath/ath6kl/txrx.c | |||
@@ -541,7 +541,7 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue) | |||
541 | int status; | 541 | int status; |
542 | enum htc_endpoint_id eid; | 542 | enum htc_endpoint_id eid; |
543 | bool wake_event = false; | 543 | bool wake_event = false; |
544 | bool flushing[MAX_NUM_VIF] = {false}; | 544 | bool flushing[ATH6KL_VIF_MAX] = {false}; |
545 | u8 if_idx; | 545 | u8 if_idx; |
546 | struct ath6kl_vif *vif; | 546 | struct ath6kl_vif *vif; |
547 | 547 | ||
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index f1d53d089c7e..aa1a25298704 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c | |||
@@ -85,7 +85,7 @@ struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx) | |||
85 | { | 85 | { |
86 | struct ath6kl_vif *vif, *found = NULL; | 86 | struct ath6kl_vif *vif, *found = NULL; |
87 | 87 | ||
88 | if (WARN_ON(if_idx > (MAX_NUM_VIF - 1))) | 88 | if (WARN_ON(if_idx > (ar->vif_max - 1))) |
89 | return NULL; | 89 | return NULL; |
90 | 90 | ||
91 | /* FIXME: Locking */ | 91 | /* FIXME: Locking */ |
@@ -187,7 +187,7 @@ int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb, | |||
187 | struct wmi_data_hdr *data_hdr; | 187 | struct wmi_data_hdr *data_hdr; |
188 | int ret; | 188 | int ret; |
189 | 189 | ||
190 | if (WARN_ON(skb == NULL || (if_idx > MAX_NUM_VIF - 1))) | 190 | if (WARN_ON(skb == NULL || (if_idx > wmi->parent_dev->vif_max - 1))) |
191 | return -EINVAL; | 191 | return -EINVAL; |
192 | 192 | ||
193 | if (tx_meta_info) { | 193 | if (tx_meta_info) { |
@@ -1620,7 +1620,7 @@ int ath6kl_wmi_cmd_send(struct wmi *wmi, u8 if_idx, struct sk_buff *skb, | |||
1620 | int ret; | 1620 | int ret; |
1621 | u16 info1; | 1621 | u16 info1; |
1622 | 1622 | ||
1623 | if (WARN_ON(skb == NULL || (if_idx > (MAX_NUM_VIF - 1)))) | 1623 | if (WARN_ON(skb == NULL || (if_idx > (wmi->parent_dev->vif_max - 1)))) |
1624 | return -EINVAL; | 1624 | return -EINVAL; |
1625 | 1625 | ||
1626 | ath6kl_dbg(ATH6KL_DBG_WMI, "wmi tx id %d len %d flag %d\n", | 1626 | ath6kl_dbg(ATH6KL_DBG_WMI, "wmi tx id %d len %d flag %d\n", |