diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex/tdls.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/tdls.c | 97 |
1 files changed, 77 insertions, 20 deletions
diff --git a/drivers/net/wireless/mwifiex/tdls.c b/drivers/net/wireless/mwifiex/tdls.c index 97662a1ba58c..e73034fbbde9 100644 --- a/drivers/net/wireless/mwifiex/tdls.c +++ b/drivers/net/wireless/mwifiex/tdls.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #define TDLS_RESP_FIX_LEN 8 | 25 | #define TDLS_RESP_FIX_LEN 8 |
26 | #define TDLS_CONFIRM_FIX_LEN 6 | 26 | #define TDLS_CONFIRM_FIX_LEN 6 |
27 | 27 | ||
28 | static void | 28 | static void mwifiex_restore_tdls_packets(struct mwifiex_private *priv, |
29 | mwifiex_restore_tdls_packets(struct mwifiex_private *priv, u8 *mac, u8 status) | 29 | const u8 *mac, u8 status) |
30 | { | 30 | { |
31 | struct mwifiex_ra_list_tbl *ra_list; | 31 | struct mwifiex_ra_list_tbl *ra_list; |
32 | struct list_head *tid_list; | 32 | struct list_head *tid_list; |
@@ -84,7 +84,8 @@ mwifiex_restore_tdls_packets(struct mwifiex_private *priv, u8 *mac, u8 status) | |||
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | 86 | ||
87 | static void mwifiex_hold_tdls_packets(struct mwifiex_private *priv, u8 *mac) | 87 | static void mwifiex_hold_tdls_packets(struct mwifiex_private *priv, |
88 | const u8 *mac) | ||
88 | { | 89 | { |
89 | struct mwifiex_ra_list_tbl *ra_list; | 90 | struct mwifiex_ra_list_tbl *ra_list; |
90 | struct list_head *ra_list_head; | 91 | struct list_head *ra_list_head; |
@@ -185,8 +186,50 @@ static int mwifiex_tdls_add_vht_capab(struct mwifiex_private *priv, | |||
185 | return 0; | 186 | return 0; |
186 | } | 187 | } |
187 | 188 | ||
189 | static int | ||
190 | mwifiex_tdls_add_ht_oper(struct mwifiex_private *priv, const u8 *mac, | ||
191 | u8 vht_enabled, struct sk_buff *skb) | ||
192 | { | ||
193 | struct ieee80211_ht_operation *ht_oper; | ||
194 | struct mwifiex_sta_node *sta_ptr; | ||
195 | struct mwifiex_bssdescriptor *bss_desc = | ||
196 | &priv->curr_bss_params.bss_descriptor; | ||
197 | u8 *pos; | ||
198 | |||
199 | sta_ptr = mwifiex_get_sta_entry(priv, mac); | ||
200 | if (unlikely(!sta_ptr)) { | ||
201 | dev_warn(priv->adapter->dev, | ||
202 | "TDLS peer station not found in list\n"); | ||
203 | return -1; | ||
204 | } | ||
205 | |||
206 | pos = (void *)skb_put(skb, sizeof(struct ieee80211_ht_operation) + 2); | ||
207 | *pos++ = WLAN_EID_HT_OPERATION; | ||
208 | *pos++ = sizeof(struct ieee80211_ht_operation); | ||
209 | ht_oper = (void *)pos; | ||
210 | |||
211 | ht_oper->primary_chan = bss_desc->channel; | ||
212 | |||
213 | /* follow AP's channel bandwidth */ | ||
214 | if (ISSUPP_CHANWIDTH40(priv->adapter->hw_dot_11n_dev_cap) && | ||
215 | bss_desc->bcn_ht_cap && | ||
216 | ISALLOWED_CHANWIDTH40(bss_desc->bcn_ht_oper->ht_param)) | ||
217 | ht_oper->ht_param = bss_desc->bcn_ht_oper->ht_param; | ||
218 | |||
219 | if (vht_enabled) { | ||
220 | ht_oper->ht_param = | ||
221 | mwifiex_get_sec_chan_offset(bss_desc->channel); | ||
222 | ht_oper->ht_param |= BIT(2); | ||
223 | } | ||
224 | |||
225 | memcpy(&sta_ptr->tdls_cap.ht_oper, ht_oper, | ||
226 | sizeof(struct ieee80211_ht_operation)); | ||
227 | |||
228 | return 0; | ||
229 | } | ||
230 | |||
188 | static int mwifiex_tdls_add_vht_oper(struct mwifiex_private *priv, | 231 | static int mwifiex_tdls_add_vht_oper(struct mwifiex_private *priv, |
189 | u8 *mac, struct sk_buff *skb) | 232 | const u8 *mac, struct sk_buff *skb) |
190 | { | 233 | { |
191 | struct mwifiex_bssdescriptor *bss_desc; | 234 | struct mwifiex_bssdescriptor *bss_desc; |
192 | struct ieee80211_vht_operation *vht_oper; | 235 | struct ieee80211_vht_operation *vht_oper; |
@@ -325,8 +368,9 @@ static void mwifiex_tdls_add_qos_capab(struct sk_buff *skb) | |||
325 | } | 368 | } |
326 | 369 | ||
327 | static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, | 370 | static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, |
328 | u8 *peer, u8 action_code, u8 dialog_token, | 371 | const u8 *peer, u8 action_code, |
329 | u16 status_code, struct sk_buff *skb) | 372 | u8 dialog_token, |
373 | u16 status_code, struct sk_buff *skb) | ||
330 | { | 374 | { |
331 | struct ieee80211_tdls_data *tf; | 375 | struct ieee80211_tdls_data *tf; |
332 | int ret; | 376 | int ret; |
@@ -428,6 +472,17 @@ static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, | |||
428 | dev_kfree_skb_any(skb); | 472 | dev_kfree_skb_any(skb); |
429 | return ret; | 473 | return ret; |
430 | } | 474 | } |
475 | ret = mwifiex_tdls_add_ht_oper(priv, peer, 1, skb); | ||
476 | if (ret) { | ||
477 | dev_kfree_skb_any(skb); | ||
478 | return ret; | ||
479 | } | ||
480 | } else { | ||
481 | ret = mwifiex_tdls_add_ht_oper(priv, peer, 0, skb); | ||
482 | if (ret) { | ||
483 | dev_kfree_skb_any(skb); | ||
484 | return ret; | ||
485 | } | ||
431 | } | 486 | } |
432 | break; | 487 | break; |
433 | 488 | ||
@@ -453,7 +508,8 @@ static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, | |||
453 | } | 508 | } |
454 | 509 | ||
455 | static void | 510 | static void |
456 | mwifiex_tdls_add_link_ie(struct sk_buff *skb, u8 *src_addr, u8 *peer, u8 *bssid) | 511 | mwifiex_tdls_add_link_ie(struct sk_buff *skb, const u8 *src_addr, |
512 | const u8 *peer, const u8 *bssid) | ||
457 | { | 513 | { |
458 | struct ieee80211_tdls_lnkie *lnkid; | 514 | struct ieee80211_tdls_lnkie *lnkid; |
459 | 515 | ||
@@ -467,8 +523,8 @@ mwifiex_tdls_add_link_ie(struct sk_buff *skb, u8 *src_addr, u8 *peer, u8 *bssid) | |||
467 | memcpy(lnkid->resp_sta, peer, ETH_ALEN); | 523 | memcpy(lnkid->resp_sta, peer, ETH_ALEN); |
468 | } | 524 | } |
469 | 525 | ||
470 | int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, | 526 | int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, |
471 | u8 *peer, u8 action_code, u8 dialog_token, | 527 | u8 action_code, u8 dialog_token, |
472 | u16 status_code, const u8 *extra_ies, | 528 | u16 status_code, const u8 *extra_ies, |
473 | size_t extra_ies_len) | 529 | size_t extra_ies_len) |
474 | { | 530 | { |
@@ -560,7 +616,8 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, | |||
560 | } | 616 | } |
561 | 617 | ||
562 | static int | 618 | static int |
563 | mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, u8 *peer, | 619 | mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, |
620 | const u8 *peer, | ||
564 | u8 action_code, u8 dialog_token, | 621 | u8 action_code, u8 dialog_token, |
565 | u16 status_code, struct sk_buff *skb) | 622 | u16 status_code, struct sk_buff *skb) |
566 | { | 623 | { |
@@ -638,10 +695,10 @@ mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, u8 *peer, | |||
638 | return 0; | 695 | return 0; |
639 | } | 696 | } |
640 | 697 | ||
641 | int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, | 698 | int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer, |
642 | u8 *peer, u8 action_code, u8 dialog_token, | 699 | u8 action_code, u8 dialog_token, |
643 | u16 status_code, const u8 *extra_ies, | 700 | u16 status_code, const u8 *extra_ies, |
644 | size_t extra_ies_len) | 701 | size_t extra_ies_len) |
645 | { | 702 | { |
646 | struct sk_buff *skb; | 703 | struct sk_buff *skb; |
647 | struct mwifiex_txinfo *tx_info; | 704 | struct mwifiex_txinfo *tx_info; |
@@ -848,7 +905,7 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, | |||
848 | } | 905 | } |
849 | 906 | ||
850 | static int | 907 | static int |
851 | mwifiex_tdls_process_config_link(struct mwifiex_private *priv, u8 *peer) | 908 | mwifiex_tdls_process_config_link(struct mwifiex_private *priv, const u8 *peer) |
852 | { | 909 | { |
853 | struct mwifiex_sta_node *sta_ptr; | 910 | struct mwifiex_sta_node *sta_ptr; |
854 | struct mwifiex_ds_tdls_oper tdls_oper; | 911 | struct mwifiex_ds_tdls_oper tdls_oper; |
@@ -869,7 +926,7 @@ mwifiex_tdls_process_config_link(struct mwifiex_private *priv, u8 *peer) | |||
869 | } | 926 | } |
870 | 927 | ||
871 | static int | 928 | static int |
872 | mwifiex_tdls_process_create_link(struct mwifiex_private *priv, u8 *peer) | 929 | mwifiex_tdls_process_create_link(struct mwifiex_private *priv, const u8 *peer) |
873 | { | 930 | { |
874 | struct mwifiex_sta_node *sta_ptr; | 931 | struct mwifiex_sta_node *sta_ptr; |
875 | struct mwifiex_ds_tdls_oper tdls_oper; | 932 | struct mwifiex_ds_tdls_oper tdls_oper; |
@@ -896,7 +953,7 @@ mwifiex_tdls_process_create_link(struct mwifiex_private *priv, u8 *peer) | |||
896 | } | 953 | } |
897 | 954 | ||
898 | static int | 955 | static int |
899 | mwifiex_tdls_process_disable_link(struct mwifiex_private *priv, u8 *peer) | 956 | mwifiex_tdls_process_disable_link(struct mwifiex_private *priv, const u8 *peer) |
900 | { | 957 | { |
901 | struct mwifiex_sta_node *sta_ptr; | 958 | struct mwifiex_sta_node *sta_ptr; |
902 | struct mwifiex_ds_tdls_oper tdls_oper; | 959 | struct mwifiex_ds_tdls_oper tdls_oper; |
@@ -925,7 +982,7 @@ mwifiex_tdls_process_disable_link(struct mwifiex_private *priv, u8 *peer) | |||
925 | } | 982 | } |
926 | 983 | ||
927 | static int | 984 | static int |
928 | mwifiex_tdls_process_enable_link(struct mwifiex_private *priv, u8 *peer) | 985 | mwifiex_tdls_process_enable_link(struct mwifiex_private *priv, const u8 *peer) |
929 | { | 986 | { |
930 | struct mwifiex_sta_node *sta_ptr; | 987 | struct mwifiex_sta_node *sta_ptr; |
931 | struct ieee80211_mcs_info mcs; | 988 | struct ieee80211_mcs_info mcs; |
@@ -982,7 +1039,7 @@ mwifiex_tdls_process_enable_link(struct mwifiex_private *priv, u8 *peer) | |||
982 | return 0; | 1039 | return 0; |
983 | } | 1040 | } |
984 | 1041 | ||
985 | int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action) | 1042 | int mwifiex_tdls_oper(struct mwifiex_private *priv, const u8 *peer, u8 action) |
986 | { | 1043 | { |
987 | switch (action) { | 1044 | switch (action) { |
988 | case MWIFIEX_TDLS_ENABLE_LINK: | 1045 | case MWIFIEX_TDLS_ENABLE_LINK: |
@@ -997,7 +1054,7 @@ int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action) | |||
997 | return 0; | 1054 | return 0; |
998 | } | 1055 | } |
999 | 1056 | ||
1000 | int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, u8 *mac) | 1057 | int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac) |
1001 | { | 1058 | { |
1002 | struct mwifiex_sta_node *sta_ptr; | 1059 | struct mwifiex_sta_node *sta_ptr; |
1003 | 1060 | ||