mwifiex: add cfg80211 add_station handler support
PATCH v2 20/30 mwifiex: add cfg80211 add_station handler support
From: Avinash Patil <[email protected]>
This patch adds cfg80211 add_station handler support for mwifiex which is needed for TDLS setup. Driver issues create TDLS link command to FW upon receiving add_station from cfg80211.
--- drivers/net/wireless/mwifiex/cfg80211.c | 18 ++++++++++++++++++ drivers/net/wireless/mwifiex/sta_cmd.c | 3 +++ drivers/net/wireless/mwifiex/sta_cmdresp.c | 15 +++++++++++++++ drivers/net/wireless/mwifiex/tdls.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+)
drivers/net/wireless/mwifiex/cfg80211.c +18 -0
@@ -2715,6 +2715,23 @@ mwifiex_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,return mwifiex_tdls_oper (priv, peer, action); } +static int +mwifiex_cfg80211_add_station (struct wiphy *wiphy, +struct net_device *dev, +u8 *mac,struct station_parameters *params) +{ +struct mwifiex_private *priv =mwifiex_netdev_get_priv (dev); + +if (!(params->sta_flags_set &BIT (NL80211_STA_FLAG_TDLS_PEER ))) +return -ENOTSUPP ; + +/* make sure we are in station mode and connected */ +if ((priv->bss_type !=MWIFIEX_BSS_TYPE_STA ) || !priv->media_connected) +return -ENOTSUPP ; + +return mwifiex_tdls_oper (priv, mac,MWIFIEX_TDLS_CREATE_LINK ); +} +/* station cfg80211 operations */ static struct cfg80211_ops mwifiex_cfg80211_ops = { .add_virtual_intf = mwifiex_add_virtual_intf,
@@ -2752,6 +2769,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { .set_coalesce = mwifiex_cfg80211_set_coalesce, .tdls_mgmt = mwifiex_cfg80211_tdls_mgmt, .tdls_oper = mwifiex_cfg80211_tdls_oper, + .add_station = mwifiex_cfg80211_add_station, };#ifdef CONFIG_PM
drivers/net/wireless/mwifiex/sta_cmd.c +3 -0
@@ -1300,6 +1300,9 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv,case MWIFIEX_TDLS_DISABLE_LINK : tdls_oper->tdls_action =cpu_to_le16 (ACT_TDLS_DELETE );break ; +case MWIFIEX_TDLS_CREATE_LINK : + tdls_oper->tdls_action =cpu_to_le16 (ACT_TDLS_CREATE ); +break ;default :dev_err (priv->adapter->dev,"Unknown TDLS operation\n" );return -ENOTSUPP ;
drivers/net/wireless/mwifiex/sta_cmdresp.c +15 -0
@@ -807,6 +807,8 @@ static int mwifiex_ret_tdls_oper(struct mwifiex_private *priv,struct host_cmd_ds_tdls_oper *cmd_tdls_oper = &resp->params.tdls_oper;u16 reason =le16_to_cpu (cmd_tdls_oper->reason);u16 action =le16_to_cpu (cmd_tdls_oper->tdls_action); +struct mwifiex_sta_node *node = +mwifiex_get_sta_entry (priv, cmd_tdls_oper->peer_mac);switch (action) {case ACT_TDLS_DELETE :
@@ -819,6 +821,19 @@ static int mwifiex_ret_tdls_oper(struct mwifiex_private *priv,"TDLS link config for %pM successful\n" , cmd_tdls_oper->peer_mac);break ; +case ACT_TDLS_CREATE : +if (reason) { +dev_err (priv->adapter->dev, +"TDLS link creation for %pM failed: reason %d" , + cmd_tdls_oper->peer_mac, reason); +if (node && reason !=TDLS_ERR_LINK_EXISTS ) + node->tdls_status =TDLS_SETUP_FAILURE ; + }else { +dev_dbg (priv->adapter->dev, +"TDLS link creation for %pM successful" , + cmd_tdls_oper->peer_mac); + } +break ;default :dev_err (priv->adapter->dev,"Unknown TDLS command action respnse %d" , action);
drivers/net/wireless/mwifiex/tdls.c +28 -0
@@ -544,6 +544,32 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, }static int +mwifiex_tdls_process_create_link (struct mwifiex_private *priv,u8 *peer) +{ +struct mwifiex_sta_node *sta_ptr; +struct mwifiex_ds_tdls_oper tdls_oper; + +memset (&tdls_oper,0 ,sizeof (struct mwifiex_ds_tdls_oper )); + sta_ptr =mwifiex_get_sta_entry (priv, peer); + +if (sta_ptr && sta_ptr->tdls_status ==TDLS_SETUP_INPROGRESS ) { +dev_dbg (priv->adapter->dev, +"Setup already in progress for peer %pM\n" , peer); +return 0 ; + } + + sta_ptr =mwifiex_add_sta_entry (priv, peer); +if (!sta_ptr) +return -ENOMEM ; + + sta_ptr->tdls_status =TDLS_SETUP_INPROGRESS ; +memcpy (&tdls_oper.peer_mac, peer,ETH_ALEN ); + tdls_oper.tdls_action =MWIFIEX_TDLS_CREATE_LINK ; +return mwifiex_send_cmd_sync (priv, HostCmd_CMD_TDLS_OPER, + HostCmd_ACT_GEN_SET,0 , &tdls_oper); +} + +static int mwifiex_tdls_process_disable_link (struct mwifiex_private *priv,u8 *peer) {struct mwifiex_sta_node *sta_ptr;
@@ -634,6 +660,8 @@ int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action)return mwifiex_tdls_process_enable_link (priv, peer);case MWIFIEX_TDLS_DISABLE_LINK :return mwifiex_tdls_process_disable_link (priv, peer); +case MWIFIEX_TDLS_CREATE_LINK : +return mwifiex_tdls_process_create_link (priv, peer); }return 0 ; }
Signature · 1 line
1.8.2.3
PATCH v2 21/30 mwifiex: add cfg80211 change_station handler support
From: Avinash Patil <[email protected]>
This patch adds cfg80211 change_station handler support for mwifiex which is needed for TDLS link setup. Driver creates a command to modify peer link capabilities and issues command to FW.
--- drivers/net/wireless/mwifiex/cfg80211.c | 25 +++++++++++ drivers/net/wireless/mwifiex/fw.h | 5 +++ drivers/net/wireless/mwifiex/main.h | 1 + drivers/net/wireless/mwifiex/sta_cmd.c | 71 +++++++++++++++++++++++++++++- drivers/net/wireless/mwifiex/sta_cmdresp.c | 13 ++++++ drivers/net/wireless/mwifiex/tdls.c | 23 ++++++++++ 6 files changed, 137 insertions(+), 1 deletion(-)
drivers/net/wireless/mwifiex/cfg80211.c +25 -0
@@ -2732,6 +2732,30 @@ mwifiex_cfg80211_add_station(struct wiphy *wiphy,return mwifiex_tdls_oper (priv, mac,MWIFIEX_TDLS_CREATE_LINK ); } +static int +mwifiex_cfg80211_change_station (struct wiphy *wiphy, +struct net_device *dev, +u8 *mac,struct station_parameters *params) +{ +int ret; +struct mwifiex_private *priv =mwifiex_netdev_get_priv (dev); + +/* we support change_station handler only for TDLS peers*/ +if (!(params->sta_flags_set &BIT (NL80211_STA_FLAG_TDLS_PEER ))) +return -ENOTSUPP ; + +/* make sure we are in station mode and connected */ +if ((priv->bss_type !=MWIFIEX_BSS_TYPE_STA ) || !priv->media_connected) +return -ENOTSUPP ; + + priv->sta_params = params; + + ret =mwifiex_tdls_oper (priv, mac,MWIFIEX_TDLS_CONFIG_LINK ); + priv->sta_params =NULL ; + +return ret; +} +/* station cfg80211 operations */ static struct cfg80211_ops mwifiex_cfg80211_ops = { .add_virtual_intf = mwifiex_add_virtual_intf,
@@ -2770,6 +2794,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { .tdls_mgmt = mwifiex_cfg80211_tdls_mgmt, .tdls_oper = mwifiex_cfg80211_tdls_oper, .add_station = mwifiex_cfg80211_add_station, + .change_station = mwifiex_cfg80211_change_station, };#ifdef CONFIG_PM
drivers/net/wireless/mwifiex/fw.h +5 -0
@@ -1391,6 +1391,11 @@ struct mwifiex_ie_types_extcap {u8 ext_capab[0 ]; } __packed; +struct mwifiex_ie_types_qos_info { +struct mwifiex_ie_types_header header; +u8 qos_info; +} __packed; +struct host_cmd_ds_mac_reg_access {__le16 action;__le16 offset;
drivers/net/wireless/mwifiex/main.h +1 -0
@@ -529,6 +529,7 @@ struct mwifiex_private {unsigned long csa_expire_time;u8 del_list_idx;bool hs2_enabled; +struct station_parameters *sta_params; };enum mwifiex_ba_status {
drivers/net/wireless/mwifiex/sta_cmd.c +70 -1
96 lines not on this page · raw message
drivers/net/wireless/mwifiex/sta_cmdresp.c +13 -0
@@ -834,6 +834,19 @@ static int mwifiex_ret_tdls_oper(struct mwifiex_private *priv, cmd_tdls_oper->peer_mac); }break ; +case ACT_TDLS_CONFIG : +if (reason) { +dev_err (priv->adapter->dev, +"TDLS link config for %pM failed, reason %d\n" , + cmd_tdls_oper->peer_mac, reason); +if (node) + node->tdls_status =TDLS_SETUP_FAILURE ; + }else { +dev_dbg (priv->adapter->dev, +"TDLS link config for %pM successful\n" , + cmd_tdls_oper->peer_mac); + } +break ;default :dev_err (priv->adapter->dev,"Unknown TDLS command action respnse %d" , action);
drivers/net/wireless/mwifiex/tdls.c +23 -0
@@ -544,6 +544,27 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, }static int +mwifiex_tdls_process_config_link (struct mwifiex_private *priv,u8 *peer) +{ +struct mwifiex_sta_node *sta_ptr; +struct mwifiex_ds_tdls_oper tdls_oper; + +memset (&tdls_oper,0 ,sizeof (struct mwifiex_ds_tdls_oper )); + sta_ptr =mwifiex_get_sta_entry (priv, peer); + +if (!sta_ptr || sta_ptr->tdls_status ==TDLS_SETUP_FAILURE ) { +dev_err (priv->adapter->dev, +"link absent for peer %pM; cannot config\n" , peer); +return -EINVAL ; + } + +memcpy (&tdls_oper.peer_mac, peer,ETH_ALEN ); + tdls_oper.tdls_action =MWIFIEX_TDLS_CONFIG_LINK ; +return mwifiex_send_cmd_sync (priv, HostCmd_CMD_TDLS_OPER, + HostCmd_ACT_GEN_SET,0 , &tdls_oper); +} + +static int mwifiex_tdls_process_create_link (struct mwifiex_private *priv,u8 *peer) {struct mwifiex_sta_node *sta_ptr;
@@ -662,6 +683,8 @@ int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action)return mwifiex_tdls_process_disable_link (priv, peer);case MWIFIEX_TDLS_CREATE_LINK :return mwifiex_tdls_process_create_link (priv, peer); +case MWIFIEX_TDLS_CONFIG_LINK : +return mwifiex_tdls_process_config_link (priv, peer); }return 0 ; }
Signature · 1 line
1.8.2.3
PATCH v2 22/30 mwifiex: provision for holding and restoring packets during TDLS setup
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
While TDLS link is being setup, few packets from this station to peer station may be buffered at AP. It may happen that once TDLS link is setup, packets sent from station to peer on direct link get delivered before traffic from AP arrives at peer station. This results into packet reordering issue at peer station.
To avoid this, we hold data packets destined to TDLS peer during TDLS setup. These packets are moved to temperory TDLS TX queue. Upon successful TDLS setup, they are moved to RA list created for this peer. Upon failure, packets are moved back to AP's RA list for that particular TID.
--- drivers/net/wireless/mwifiex/init.c | 1 + drivers/net/wireless/mwifiex/main.h | 1 + drivers/net/wireless/mwifiex/tdls.c | 94 +++++++++++++++++++++++++++++++++++++ drivers/net/wireless/mwifiex/wmm.c | 4 ++ 4 files changed, 100 insertions(+)
drivers/net/wireless/mwifiex/init.c +1 -0
@@ -452,6 +452,7 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter)INIT_LIST_HEAD (&priv->tx_ba_stream_tbl_ptr);INIT_LIST_HEAD (&priv->rx_reorder_tbl_ptr);INIT_LIST_HEAD (&priv->sta_list); +skb_queue_head_init (&priv->tdls_txq);spin_lock_init (&priv->tx_ba_stream_tbl_lock);spin_lock_init (&priv->rx_reorder_tbl_lock);
drivers/net/wireless/mwifiex/main.h +1 -0
@@ -530,6 +530,7 @@ struct mwifiex_private {u8 del_list_idx;bool hs2_enabled;struct station_parameters *sta_params; +struct sk_buff_head tdls_txq; };enum mwifiex_ba_status {
drivers/net/wireless/mwifiex/tdls.c +94 -0
124 lines not on this page · raw message
drivers/net/wireless/mwifiex/wmm.c +4 -0
@@ -533,6 +533,7 @@ void mwifiex_clean_txrx(struct mwifiex_private *priv) {unsigned long flags; +struct sk_buff *skb, *tmp;mwifiex_11n_cleanup_reorder_tbl (priv);spin_lock_irqsave (&priv->wmm.ra_list_spinlock, flags);
@@ -549,6 +550,9 @@ mwifiex_clean_txrx(struct mwifiex_private *priv)if (priv->adapter->if_ops.clean_pcie_ring) priv->adapter->if_ops.clean_pcie_ring (priv->adapter);spin_unlock_irqrestore (&priv->wmm.ra_list_spinlock, flags); + + skb_queue_walk_safe(&priv->tdls_txq, skb, tmp) +mwifiex_write_data_complete (priv->adapter, skb,0 ,-1 ); }/*
Signature · 1 line
1.8.2.3
PATCH v2 23/30 mwifiex: tdls related handling for data packets addressed to TDLS peer
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
1. If data packet is addressed to TDLS peer for which link is established, mark these packets with TDLS flag so that FW can send them on direct link instead of sending via AP.
2. If data packet is addressed to TDLS peer and TDLS setup is underway, move these packets to TDLS queue.
3. If this packet is TDLS setup packet, do not block it.
--- drivers/net/wireless/mwifiex/main.h | 1 + drivers/net/wireless/mwifiex/tdls.c | 11 ++++++++++ drivers/net/wireless/mwifiex/wmm.c | 42 +++++++++++++++++++++++++++++++------ 3 files changed, 48 insertions(+), 6 deletions(-)
drivers/net/wireless/mwifiex/main.h +1 -0
@@ -1213,6 +1213,7 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv,void mwifiex_process_tdls_action_frame (struct mwifiex_private *priv,u8 *buf,int len);int mwifiex_tdls_oper (struct mwifiex_private *priv,u8 *peer,u8 action); +int mwifiex_get_tdls_link_status (struct mwifiex_private *priv,u8 *mac);#ifdef CONFIG_DEBUG_FS void mwifiex_debugfs_init (void );
drivers/net/wireless/mwifiex/tdls.c +11 -0
@@ -782,3 +782,14 @@ int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action) }return 0 ; } + +int mwifiex_get_tdls_link_status (struct mwifiex_private *priv,u8 *mac) +{ +struct mwifiex_sta_node *sta_ptr; + + sta_ptr =mwifiex_get_sta_entry (priv, mac); +if (sta_ptr) +return sta_ptr->tdls_status; + +return TDLS_NOT_SETUP ; +}
drivers/net/wireless/mwifiex/wmm.c +36 -6
54 lines not on this page · raw message
Signature · 1 line
1.8.2.3
PATCH v2 24/30 mwifiex: AMPDU support for TDLS link
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
This patch adds AMPDU support for TDLS link. We have set 11n capabilities including AMPDU parameters during ENABLE_LINK. We set a variable in RA list to indicate this as TDLS link. This patch uses these capabilities to know if AMPDU is allowed on TDLS link and enables AMPDU aggregation for TX and RX reording support for RA list for this peer.
--- drivers/net/wireless/mwifiex/11n.h | 18 ++++++++++++++++-- drivers/net/wireless/mwifiex/11n_rxreorder.c | 6 +++++- drivers/net/wireless/mwifiex/main.h | 1 + drivers/net/wireless/mwifiex/tdls.c | 1 + drivers/net/wireless/mwifiex/wmm.c | 9 ++++++++- 5 files changed, 31 insertions(+), 4 deletions(-)
drivers/net/wireless/mwifiex/11n.h +16 -2
@@ -81,11 +81,15 @@ static inline u8 mwifiex_is_ampdu_allowed(struct mwifiex_private *priv, struct mwifiex_ra_list_tbl *ptr, int tid) { - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) + if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { return mwifiex_is_station_ampdu_allowed(priv, ptr, tid); - else + } else { +if (ptr->tdls_link) +return mwifiex_is_station_ampdu_allowed (priv, ptr, tid); +return (priv->aggr_prio_tbl[tid].ampdu_ap !=BA_STREAM_NOT_ALLOWED ) ? true : false; + } }/*
@@ -179,4 +183,14 @@ static inline int mwifiex_is_sta_11n_enabled(struct mwifiex_private *priv, return node->is_11n_enabled; } + +static inline u8 +mwifiex_tdls_peer_11n_enabled (struct mwifiex_private *priv,u8 *ra) +{ +struct mwifiex_sta_node *node =mwifiex_get_sta_entry (priv, ra); +if (node) +return node->is_11n_enabled; + +return false; +}#endif /* !_MWIFIEX_11N_H_ */
drivers/net/wireless/mwifiex/11n_rxreorder.c +5 -1
@@ -290,7 +290,11 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, last_seq = node->rx_seq[tid]; } }else { - last_seq = priv->rx_seq[tid]; + node =mwifiex_get_sta_entry (priv, ta); +if (node) + last_seq = node->rx_seq[tid]; +else + last_seq = priv->rx_seq[tid]; } if (last_seq != MWIFIEX_DEF_11N_RX_SEQ_NUM &&
drivers/net/wireless/mwifiex/main.h +1 -0
@@ -210,6 +210,7 @@ struct mwifiex_ra_list_tbl {u16 ba_pkt_count;u8 ba_packet_thr;u16 total_pkt_count; +bool tdls_link; };struct mwifiex_tid_tbl {
drivers/net/wireless/mwifiex/tdls.c +1 -0
@@ -49,6 +49,7 @@ mwifiex_restore_tdls_packets(struct mwifiex_private *priv, u8 *mac, u8 status)if (status ==TDLS_SETUP_COMPLETE ) { ra_list =mwifiex_wmm_get_queue_raptr (priv, tid, mac); + ra_list->tdls_link = true; tx_info->flags |=MWIFIEX_BUF_FLAG_TDLS_PKT ; }else { tid_list = &priv->wmm.tid_tbl_ptr[tid_down].ra_list;
drivers/net/wireless/mwifiex/wmm.c +8 -1
@@ -160,8 +160,15 @@ mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra)break ; ra_list->is_11n_enabled =0 ; + ra_list->tdls_link = false;if (!mwifiex_queuing_ra_based (priv)) { - ra_list->is_11n_enabled =IS_11N_ENABLED (priv); +if (mwifiex_get_tdls_link_status (priv, ra) == +TDLS_SETUP_COMPLETE ) { + ra_list->is_11n_enabled = +mwifiex_tdls_peer_11n_enabled (priv, ra); + }else { + ra_list->is_11n_enabled =IS_11N_ENABLED (priv); + } }else { ra_list->is_11n_enabled =mwifiex_is_sta_11n_enabled (priv, node);
Signature · 1 line
1.8.2.3
PATCH v2 25/30 mwifiex: pass ieee80211_vht_cap to mwifiex_fill_vht_cap_tlv
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
This patch changes mwifiex_fill_vht_cap_tlv function to pass struct ieee80211_vht_cap instead of mwifiex_ie_types_vhtcap so that it can be used generically.
--- drivers/net/wireless/mwifiex/11ac.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/net/wireless/mwifiex/11ac.c +12 -11
@@ -96,21 +96,21 @@ mwifiex_convert_mcsmap_to_maxrate(struct mwifiex_private *priv,static void mwifiex_fill_vht_cap_info (struct mwifiex_private *priv, -struct mwifiex_ie_types_vhtcap *vht_cap,u8 bands) +struct ieee80211_vht_cap *vht_cap,u8 bands) {struct mwifiex_adapter *adapter = priv->adapter;if (bands &BAND_A ) - vht_cap->vht_cap.vht_cap_info = + vht_cap->vht_cap_info =cpu_to_le32 (adapter->usr_dot_11ac_dev_cap_a);else - vht_cap->vht_cap.vht_cap_info = + vht_cap->vht_cap_info =cpu_to_le32 (adapter->usr_dot_11ac_dev_cap_bg); }static void mwifiex_fill_vht_cap_tlv (struct mwifiex_private *priv, -struct mwifiex_ie_types_vhtcap *vht_cap,u8 bands) +struct ieee80211_vht_cap *vht_cap,u8 bands) {struct mwifiex_adapter *adapter = priv->adapter;u16 mcs_map_user, mcs_map_resp, mcs_map_result;
@@ -121,7 +121,7 @@ mwifiex_fill_vht_cap_tlv(struct mwifiex_private *priv,/* rx MCS Set: find the minimum of the user rx mcs and ap rx mcs */ mcs_map_user =GET_DEVRXMCSMAP (adapter->usr_dot_11ac_mcs_support); - mcs_map_resp =le16_to_cpu (vht_cap->vht_cap.supp_mcs.rx_mcs_map); + mcs_map_resp =le16_to_cpu (vht_cap->supp_mcs.rx_mcs_map); mcs_map_result =0 ;for (nss =1 ; nss <=8 ; nss++) {
@@ -137,14 +137,14 @@ mwifiex_fill_vht_cap_tlv(struct mwifiex_private *priv, min(mcs_user, mcs_resp)); } - vht_cap->vht_cap.supp_mcs.rx_mcs_map =cpu_to_le16 (mcs_map_result); + vht_cap->supp_mcs.rx_mcs_map =cpu_to_le16 (mcs_map_result); tmp =mwifiex_convert_mcsmap_to_maxrate (priv, bands, mcs_map_result); - vht_cap->vht_cap.supp_mcs.rx_highest =cpu_to_le16 (tmp); + vht_cap->supp_mcs.rx_highest =cpu_to_le16 (tmp);/* tx MCS Set: find the minimum of the user tx mcs and ap tx mcs */ mcs_map_user =GET_DEVTXMCSMAP (adapter->usr_dot_11ac_mcs_support); - mcs_map_resp =le16_to_cpu (vht_cap->vht_cap.supp_mcs.tx_mcs_map); + mcs_map_resp =le16_to_cpu (vht_cap->supp_mcs.tx_mcs_map); mcs_map_result =0 ;for (nss =1 ; nss <=8 ; nss++) {
@@ -159,10 +159,10 @@ mwifiex_fill_vht_cap_tlv(struct mwifiex_private *priv, min(mcs_user, mcs_resp)); } - vht_cap->vht_cap.supp_mcs.tx_mcs_map =cpu_to_le16 (mcs_map_result); + vht_cap->supp_mcs.tx_mcs_map =cpu_to_le16 (mcs_map_result); tmp =mwifiex_convert_mcsmap_to_maxrate (priv, bands, mcs_map_result); - vht_cap->vht_cap.supp_mcs.tx_highest =cpu_to_le16 (tmp); + vht_cap->supp_mcs.tx_highest =cpu_to_le16 (tmp);return ; }
@@ -197,7 +197,8 @@ int mwifiex_cmd_append_11ac_tlv(struct mwifiex_private *priv,sizeof (struct ieee_types_header ), le16_to_cpu(vht_cap->header.len)); -mwifiex_fill_vht_cap_tlv (priv, vht_cap, bss_desc->bss_band); +mwifiex_fill_vht_cap_tlv (priv, &vht_cap->vht_cap, + bss_desc->bss_band); *buffer +=sizeof (*vht_cap); ret_len +=sizeof (*vht_cap); }
Signature · 1 line
1.8.2.3
PATCH v2 26/30 mwifiex: add VHT support for TDLS
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
During TDLS setup request/response, if HW is 11ac capable, we add VHT Capability IEs in outgoing data frame. Also while processing received setup request/response, we preserve peer's 11ac capability retrieved from IEs.
Patch also gets VHT parameters from config_station handlers and sets it to FW using TDLS config command.
--- drivers/net/wireless/mwifiex/11ac.c | 83 ++++++++++++- drivers/net/wireless/mwifiex/11ac.h | 2 + drivers/net/wireless/mwifiex/fw.h | 5 + drivers/net/wireless/mwifiex/main.h | 22 ++++ drivers/net/wireless/mwifiex/sta_cmd.c | 20 +++ drivers/net/wireless/mwifiex/tdls.c | 221 ++++++++++++++++++++++++++++++++- 6 files changed, 346 insertions(+), 7 deletions(-)
drivers/net/wireless/mwifiex/11ac.c +80 -3
@@ -108,9 +108,8 @@ mwifiex_fill_vht_cap_info(struct mwifiex_private *priv,cpu_to_le32 (adapter->usr_dot_11ac_dev_cap_bg); } -static void -mwifiex_fill_vht_cap_tlv (struct mwifiex_private *priv, -struct ieee80211_vht_cap *vht_cap,u8 bands) +void mwifiex_fill_vht_cap_tlv (struct mwifiex_private *priv, +struct ieee80211_vht_cap *vht_cap,u8 bands) {struct mwifiex_adapter *adapter = priv->adapter;u16 mcs_map_user, mcs_map_resp, mcs_map_result;
@@ -305,3 +304,81 @@ void mwifiex_set_11ac_ba_params(struct mwifiex_private *priv)return ; } + +bool mwifiex_is_bss_in_11ac_mode (struct mwifiex_private *priv) +{ +struct mwifiex_bssdescriptor *bss_desc; +struct ieee80211_vht_operation *vht_oper; + + bss_desc = &priv->curr_bss_params.bss_descriptor; + vht_oper = bss_desc->bcn_vht_oper; + +if (!bss_desc->bcn_vht_cap || !vht_oper) +return false; + +if (vht_oper->chan_width ==IEEE80211_VHT_CHANWIDTH_USE_HT ) +return false; + +return true; +} + +u8 mwifiex_get_center_freq_index (struct mwifiex_private *priv,u8 band, +u32 pri_chan,u8 chan_bw) +{ +u8 center_freq_idx =0 ; + +if (band &BAND_AAC ) { +switch (pri_chan) { +case 36 : +case 40 : +case 44 : +case 48 : +if (chan_bw ==IEEE80211_VHT_CHANWIDTH_80MHZ ) + center_freq_idx =42 ; +break ; +case 52 : +case 56 : +case 60 : +case 64 : +if (chan_bw ==IEEE80211_VHT_CHANWIDTH_80MHZ ) + center_freq_idx =58 ; +else if (chan_bw ==IEEE80211_VHT_CHANWIDTH_160MHZ ) + center_freq_idx =50 ; +break ; +case 100 : +case 104 : +case 108 : +case 112 : +if (chan_bw ==IEEE80211_VHT_CHANWIDTH_80MHZ ) + center_freq_idx =106 ; +break ; +case 116 : +case 120 : +case 124 : +case 128 : +if (chan_bw ==IEEE80211_VHT_CHANWIDTH_80MHZ ) + center_freq_idx =122 ; +else if (chan_bw ==IEEE80211_VHT_CHANWIDTH_160MHZ ) + center_freq_idx =114 ; +break ; +case 132 : +case 136 : +case 140 : +case 144 : +if (chan_bw ==IEEE80211_VHT_CHANWIDTH_80MHZ ) + center_freq_idx =138 ; +break ; +case 149 : +case 153 : +case 157 : +case 161 : +if (chan_bw ==IEEE80211_VHT_CHANWIDTH_80MHZ ) + center_freq_idx =155 ; +break ; +default : + center_freq_idx =42 ; + } + } + +return center_freq_idx; +}
drivers/net/wireless/mwifiex/11ac.h +2 -0
@@ -40,4 +40,6 @@ int mwifiex_cmd_append_11ac_tlv(struct mwifiex_private *priv,int mwifiex_cmd_11ac_cfg (struct mwifiex_private *priv,struct host_cmd_ds_command *cmd,u16 cmd_action,struct mwifiex_11ac_vht_cfg *cfg); +void mwifiex_fill_vht_cap_tlv (struct mwifiex_private *priv, +struct ieee80211_vht_cap *vht_cap,u8 bands);#endif /* _MWIFIEX_11AC_H_ */
drivers/net/wireless/mwifiex/fw.h +5 -0
@@ -1356,6 +1356,11 @@ struct mwifiex_ie_types_vhtcap {struct ieee80211_vht_cap vht_cap; } __packed; +struct mwifiex_ie_types_aid { +struct mwifiex_ie_types_header header; +__le16 aid; +} __packed; +struct mwifiex_ie_types_oper_mode_ntf {struct mwifiex_ie_types_header header;u8 oper_mode;
drivers/net/wireless/mwifiex/main.h +22 -0
@@ -273,6 +273,21 @@ struct ieee_types_extcap {u8 ext_capab[8 ]; } __packed; +struct ieee_types_vht_cap { +struct ieee_types_header ieee_hdr; +struct ieee80211_vht_cap vhtcap; +} __packed; + +struct ieee_types_vht_oper { +struct ieee_types_header ieee_hdr; +struct ieee80211_vht_operation vhtoper; +} __packed; + +struct ieee_types_aid { +struct ieee_types_header ieee_hdr; +u16 aid; +} __packed; +struct mwifiex_bssdescriptor {u8 mac_address[ETH_ALEN ];struct cfg80211_ssid ssid;
@@ -603,10 +618,13 @@ struct mwifiex_tdls_capab {u8 rates_len;u8 qos_info;u8 coex_2040; +u16 aid;struct ieee80211_ht_cap ht_capb;struct ieee80211_ht_operation ht_oper;struct ieee_types_extcap extcap;struct ieee_types_generic rsn_ie; +struct ieee80211_vht_cap vhtcap; +struct ieee80211_vht_operation vhtoper; };/* This is AP/TDLS specific structure which stores information
@@ -617,6 +635,7 @@ struct mwifiex_sta_node {u8 mac_addr[ETH_ALEN ];u8 is_wmm_enabled;u8 is_11n_enabled; +u8 is_11ac_enabled;u8 ampdu_sta[MAX_NUM_TID ];u16 rx_seq[MAX_NUM_TID ];u16 max_amsdu;
@@ -1215,6 +1234,9 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, u8 *buf, int len);int mwifiex_tdls_oper (struct mwifiex_private *priv,u8 *peer,u8 action);int mwifiex_get_tdls_link_status (struct mwifiex_private *priv,u8 *mac); +bool mwifiex_is_bss_in_11ac_mode (struct mwifiex_private *priv); +u8 mwifiex_get_center_freq_index (struct mwifiex_private *priv,u8 band, +u32 pri_chan,u8 chan_bw);#ifdef CONFIG_DEBUG_FS void mwifiex_debugfs_init (void );
drivers/net/wireless/mwifiex/sta_cmd.c +20 -0
@@ -1292,6 +1292,8 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv,struct mwifiex_ie_types_htcap *ht_capab;struct mwifiex_ie_types_qos_info *wmm_qos_info;struct mwifiex_ie_types_extcap *extcap; +struct mwifiex_ie_types_vhtcap *vht_capab; +struct mwifiex_ie_types_aid *aid;u8 *pos, qos_info;u16 config_len =0 ;struct station_parameters *params = priv->sta_params;
@@ -1370,6 +1372,24 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv, config_len +=sizeof (struct mwifiex_ie_types_extcap ) + params->ext_capab_len; } +if (params->vht_capa) { + vht_capab = (struct mwifiex_ie_types_vhtcap *)(pos + + config_len); + vht_capab->header.type = +cpu_to_le16 (WLAN_EID_VHT_CAPABILITY ); + vht_capab->header.len = +cpu_to_le16 (sizeof (struct ieee80211_vht_cap )); +memcpy (&vht_capab->vht_cap, params->vht_capa, +sizeof (struct ieee80211_vht_cap )); + config_len +=sizeof (struct mwifiex_ie_types_vhtcap ); + } +if (params->aid) { + aid = (struct mwifiex_ie_types_aid *)(pos + config_len); + aid->header.type =cpu_to_le16 (WLAN_EID_AID ); + aid->header.len =cpu_to_le16 (sizeof (params->aid)); + aid->aid =cpu_to_le16 (params->aid); + config_len +=sizeof (struct mwifiex_ie_types_aid ); + }break ;default :
drivers/net/wireless/mwifiex/tdls.c +217 -4
281 lines not on this page · raw message
Signature · 1 line
1.8.2.3
PATCH v2 27/30 mwifiex: separate BA params for TDLS link if 11ac is supported
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
If TDLS link is 11ac enabled i.e. we as well as peer station supports VHT, configure seprate TX & RX window sizes during BA setup. So even if BSS does not support 11ac, we can use VHT capabilities and higher window sizes on direct link.
--- drivers/net/wireless/mwifiex/11n.c | 22 +++++++++++++++++++--- drivers/net/wireless/mwifiex/11n_rxreorder.c | 21 +++++++++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-)
drivers/net/wireless/mwifiex/11n.c +19 -3
@@ -537,16 +537,32 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid,int mwifiex_send_addba (struct mwifiex_private *priv,int tid,u8 *peer_mac) {struct host_cmd_ds_11n_addba_req add_ba_req; +struct mwifiex_sta_node *sta_ptr; +u32 tx_win_size = priv->add_ba_param.tx_win_size;static u8 dialog_tok;int ret;dev_dbg (priv->adapter->dev,"cmd: %s: tid %d\n" , __func__, tid); +if ((GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_STA ) && +ISSUPP_TDLS_ENABLED (priv->adapter->fw_cap_info) && + priv->adapter->is_hw_11ac_capable && +memcmp (priv->cfg_bssid, peer_mac,ETH_ALEN )) { + sta_ptr =mwifiex_get_sta_entry (priv, peer_mac); +if (!sta_ptr) { +dev_warn (priv->adapter->dev, +"BA setup with unknown TDLS peer %pM!\n" , + peer_mac); +return -1 ; + } +if (sta_ptr->is_11ac_enabled) + tx_win_size =MWIFIEX_11AC_STA_AMPDU_DEF_TXWINSIZE ; + } + add_ba_req.block_ack_param_set =cpu_to_le16 ( (u16) ((tid <<BLOCKACKPARAM_TID_POS ) | - (priv->add_ba_param. - tx_win_size <<BLOCKACKPARAM_WINSIZE_POS ) | -IMMEDIATE_BLOCK_ACK )); + tx_win_size <<BLOCKACKPARAM_WINSIZE_POS | +IMMEDIATE_BLOCK_ACK )); add_ba_req.block_ack_tmo =cpu_to_le16 ((u16 )priv->add_ba_param.timeout); ++dialog_tok;
drivers/net/wireless/mwifiex/11n_rxreorder.c +19 -2
@@ -362,10 +362,28 @@ int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv, *cmd_addba_req) {struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &cmd->params.add_ba_rsp; +struct mwifiex_sta_node *sta_ptr; +u32 rx_win_size = priv->add_ba_param.rx_win_size;u8 tid;int win_size;uint16_t block_ack_param_set; +if ((GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_STA ) && +ISSUPP_TDLS_ENABLED (priv->adapter->fw_cap_info) && + priv->adapter->is_hw_11ac_capable && +memcmp (priv->cfg_bssid, cmd_addba_req->peer_mac_addr,ETH_ALEN )) { + sta_ptr =mwifiex_get_sta_entry (priv, + cmd_addba_req->peer_mac_addr); +if (!sta_ptr) { +dev_warn (priv->adapter->dev, +"BA setup with unknown TDLS peer %pM!\n" , + cmd_addba_req->peer_mac_addr); +return -1 ; + } +if (sta_ptr->is_11ac_enabled) + rx_win_size =MWIFIEX_11AC_STA_AMPDU_DEF_RXWINSIZE ; + } + cmd->command =cpu_to_le16 (HostCmd_CMD_11N_ADDBA_RSP); cmd->size =cpu_to_le16 (sizeof (*add_ba_rsp) +S_DS_GEN );
@@ -382,8 +400,7 @@ int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv, block_ack_param_set &= ~IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK ;/* We donot support AMSDU inside AMPDU, hence reset the bit */ block_ack_param_set &= ~BLOCKACKPARAM_AMSDU_SUPP_MASK ; - block_ack_param_set |= (priv->add_ba_param.rx_win_size << -BLOCKACKPARAM_WINSIZE_POS ); + block_ack_param_set |= rx_win_size <<BLOCKACKPARAM_WINSIZE_POS ; add_ba_rsp->block_ack_param_set =cpu_to_le16 (block_ack_param_set); win_size = (le16_to_cpu (add_ba_rsp->block_ack_param_set) &IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK )
Signature · 1 line
1.8.2.3
PATCH v2 28/30 mwifiex: disable all TDLS link during disconnection
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
During deauthenticate/link lost event, disable all TDLS links as TDLS would not work when infra connection is not active. Also this will avoid an issue where ping to peer station doesn't work after reassociation to AP where we had created TDLS link in earlier association.
--- drivers/net/wireless/mwifiex/main.h | 1 + drivers/net/wireless/mwifiex/sta_event.c | 4 ++++ drivers/net/wireless/mwifiex/tdls.c | 35 ++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+)
drivers/net/wireless/mwifiex/main.h +1 -0
@@ -1234,6 +1234,7 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, u8 *buf, int len);int mwifiex_tdls_oper (struct mwifiex_private *priv,u8 *peer,u8 action);int mwifiex_get_tdls_link_status (struct mwifiex_private *priv,u8 *mac); +void mwifiex_disable_all_tdls_links (struct mwifiex_private *priv);bool mwifiex_is_bss_in_11ac_mode (struct mwifiex_private *priv);u8 mwifiex_get_center_freq_index (struct mwifiex_private *priv,u8 band,u32 pri_chan,u8 chan_bw);
drivers/net/wireless/mwifiex/sta_event.c +4 -0
@@ -54,6 +54,10 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) priv->scan_block = false; +if ((GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_STA ) && +ISSUPP_TDLS_ENABLED (priv->adapter->fw_cap_info)) +mwifiex_disable_all_tdls_links (priv); +/* Free Tx and Rx packets, report disconnect to upper layer */ mwifiex_clean_txrx (priv);
drivers/net/wireless/mwifiex/tdls.c +35 -0
@@ -1007,3 +1007,38 @@ int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, u8 *mac)return TDLS_NOT_SETUP ; } + +void mwifiex_disable_all_tdls_links (struct mwifiex_private *priv) +{ +struct mwifiex_sta_node *sta_ptr; +struct mwifiex_ds_tdls_oper tdls_oper; +unsigned long flags; + +if (list_empty (&priv->sta_list)) +return ; + +list_for_each_entry (sta_ptr, &priv->sta_list, list) { +memset (&tdls_oper,0 ,sizeof (struct mwifiex_ds_tdls_oper )); + +if (sta_ptr->is_11n_enabled) { +mwifiex_11n_cleanup_reorder_tbl (priv); +spin_lock_irqsave (&priv->wmm.ra_list_spinlock, + flags); +mwifiex_11n_delete_all_tx_ba_stream_tbl (priv); +spin_unlock_irqrestore (&priv->wmm.ra_list_spinlock, + flags); + } + +mwifiex_restore_tdls_packets (priv, sta_ptr->mac_addr, +TDLS_LINK_TEARDOWN ); +memcpy (&tdls_oper.peer_mac, sta_ptr->mac_addr,ETH_ALEN ); + tdls_oper.tdls_action =MWIFIEX_TDLS_DISABLE_LINK ; +if (mwifiex_send_cmd_async (priv, HostCmd_CMD_TDLS_OPER, + HostCmd_ACT_GEN_SET,0 , &tdls_oper)) +dev_warn (priv->adapter->dev, +"Disable link failed for TDLS peer %pM" , + sta_ptr->mac_addr); + } + +mwifiex_del_all_sta_list (priv); +}
Signature · 1 line
1.8.2.3
PATCH v2 29/30 mwifiex: parse API version from FW
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
This patch adds support to parse FW API version TLVs. Currently only API version for key_material is supported.
--- drivers/net/wireless/mwifiex/cmdevt.c | 45 ++++++++++++++++++++++++++++++++++- drivers/net/wireless/mwifiex/fw.h | 13 ++++++++++ drivers/net/wireless/mwifiex/init.c | 2 ++ drivers/net/wireless/mwifiex/main.h | 1 + 4 files changed, 60 insertions(+), 1 deletion(-)
drivers/net/wireless/mwifiex/cmdevt.c +44 -1
@@ -1455,7 +1455,10 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv, {struct host_cmd_ds_get_hw_spec *hw_spec = &resp->params.hw_spec;struct mwifiex_adapter *adapter = priv->adapter; -int i; +struct mwifiex_ie_types_header *tlv; +struct hw_spec_fw_api_rev *api_rev; +u16 resp_size, api_id; +int i, left_len, parsed_len =0 ; adapter->fw_cap_info =le32_to_cpu (hw_spec->fw_cap_info);
@@ -1513,6 +1516,46 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv, adapter->is_hw_11ac_capable = false; } + resp_size =le16_to_cpu (resp->size) -S_DS_GEN ; +if (resp_size >sizeof (struct host_cmd_ds_get_hw_spec )) { +/* we have variable HW SPEC information */ + left_len = resp_size -sizeof (struct host_cmd_ds_get_hw_spec ); +while (left_len >sizeof (struct mwifiex_ie_types_header )) { + tlv = (void *)&hw_spec->tlvs + parsed_len; +switch (le16_to_cpu (tlv->type)) { +case TLV_TYPE_FW_API_REV : + api_rev = (struct hw_spec_fw_api_rev *)tlv; + api_id =le16_to_cpu (api_rev->api_id); +switch (api_id) { +case KEY_API_VER_ID : + adapter->fw_key_api_major_ver = + api_rev->major_ver; + adapter->fw_key_api_minor_ver = + api_rev->minor_ver; +dev_dbg (adapter->dev, +"fw_key_api v%d.%d\n" , + adapter->fw_key_api_major_ver, + adapter->fw_key_api_minor_ver); +break ; +default : +dev_warn (adapter->dev, +"Unknown FW api_id: %d\n" , + api_id); +break ; + } +break ; +default : +dev_warn (adapter->dev, +"Unknown GET_HW_SPEC TLV type: %#x\n" , +le16_to_cpu (tlv->type)); +break ; + } + parsed_len +=le16_to_cpu (tlv->len) + +sizeof (struct mwifiex_ie_types_header ); + left_len -= parsed_len; + } + } +dev_dbg (adapter->dev,"info: GET_HW_SPEC: fw_release_number- %#x\n" , adapter->fw_release_number); dev_dbg(adapter->dev, "info: GET_HW_SPEC: permanent addr: %pM\n",
drivers/net/wireless/mwifiex/fw.h +13 -0
@@ -159,6 +159,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 145)#define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146)#define TLV_TYPE_COALESCE_RULE (PROPRIETARY_TLV_BASE_ID + 154) +#define TLV_TYPE_FW_API_REV (PROPRIETARY_TLV_BASE_ID + 199)#define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048
@@ -751,6 +752,17 @@ struct host_cmd_ds_802_11_ps_mode_enh { } params; } __packed; +enum FW_API_VER_ID { +KEY_API_VER_ID =1 , +}; + +struct hw_spec_fw_api_rev { +struct mwifiex_ie_types_header header; +__le16 api_id; +u8 major_ver; +u8 minor_ver; +} __packed; +struct host_cmd_ds_get_hw_spec {__le16 hw_if_version;__le16 version;
@@ -772,6 +784,7 @@ struct host_cmd_ds_get_hw_spec {__le32 reserved_6;__le32 dot_11ac_dev_cap;__le32 dot_11ac_mcs_support; +u8 tlvs[0 ]; } __packed;struct host_cmd_ds_802_11_rssi_info {
drivers/net/wireless/mwifiex/init.c +2 -0
@@ -283,6 +283,8 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) adapter->max_mgmt_ie_index =MAX_MGMT_IE_INDEX ; adapter->empty_tx_q_cnt =0 ; adapter->ext_scan = true; + adapter->fw_key_api_major_ver =0 ; + adapter->fw_key_api_minor_ver =0 ; }/*
drivers/net/wireless/mwifiex/main.h +1 -0
@@ -801,6 +801,7 @@ struct mwifiex_adapter {atomic_t pending_bridged_pkts;struct semaphore *card_sem;bool ext_scan; +u8 fw_key_api_major_ver, fw_key_api_minor_ver; };int mwifiex_init_lock_list (struct mwifiex_adapter *adapter);
Signature · 1 line
1.8.2.3