mwifiex: update beamforming capability field for HT
PATCH v2 11/30 mwifiex: update beamforming capability field for HT
From: Amitkumar Karwar <[email protected]>
This patch makes sure that beamforming capability field in ht capability info gets filled if hardware supports the feature.
--- drivers/net/wireless/mwifiex/11n.c | 4 ++++ drivers/net/wireless/mwifiex/fw.h | 3 +++ 2 files changed, 7 insertions(+)
drivers/net/wireless/mwifiex/11n.c +4 -0
@@ -64,6 +64,10 @@ mwifiex_fill_cap_info(struct mwifiex_private *priv, u8 radio_type, ht_cap->ht_cap.cap_info =cpu_to_le16 (sband->ht_cap.cap); ht_cap->ht_cap.extended_ht_cap_info =cpu_to_le16 (ht_ext_cap); + +if (ISSUPP_BEAMFORMING (priv->adapter->hw_dot_11n_dev_cap)) + ht_cap->ht_cap.tx_BF_cap_info = +cpu_to_le32 (MWIFIEX_DEF_11N_TX_BF_CAP ); }/*
drivers/net/wireless/mwifiex/fw.h +3 -0
@@ -186,6 +186,8 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT) | \ IEEE80211_HT_CAP_SM_PS) +#define MWIFIEX_DEF_11N_TX_BF_CAP 0x09E1E008 +#define MWIFIEX_DEF_AMPDU IEEE80211_HT_AMPDU_PARM_FACTOR/* dev_cap bitmap
@@ -209,6 +211,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define ISSUPP_GREENFIELD (Dot11nDevCap) (Dot11nDevCap & BIT(29))#define ISENABLED_40MHZ_INTOLERANT (Dot11nDevCap) (Dot11nDevCap & BIT(8))#define ISSUPP_RXLDPC (Dot11nDevCap) (Dot11nDevCap & BIT(22)) +#define ISSUPP_BEAMFORMING (Dot11nDevCap) (Dot11nDevCap & BIT(30))/* httxcfg bitmap * 0 reserved
Signature · 1 line
1.8.2.3
PATCH v2 12/30 mwifiex: advertise correct beamforming information for VHT
From: Amitkumar Karwar <[email protected]>
Currently MU/SU beamformer and MU beamformee features are not supported.
Hence this patch modifies VHT capability information accordingly. Number of sounding dimensions should be zero in this case.
--- drivers/net/wireless/mwifiex/cmdevt.c | 6 ++++-- drivers/net/wireless/mwifiex/fw.h | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/cmdevt.c +4 -2
@@ -1499,8 +1499,10 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,/* Copy 11AC cap */ adapter->hw_dot_11ac_dev_cap =le32_to_cpu (hw_spec->dot_11ac_dev_cap); - adapter->usr_dot_11ac_dev_cap_bg = adapter->hw_dot_11ac_dev_cap; - adapter->usr_dot_11ac_dev_cap_a = adapter->hw_dot_11ac_dev_cap; + adapter->usr_dot_11ac_dev_cap_bg = adapter->hw_dot_11ac_dev_cap + & ~MWIFIEX_DEF_11AC_CAP_BF_RESET_MASK ; + adapter->usr_dot_11ac_dev_cap_a = adapter->hw_dot_11ac_dev_cap + & ~MWIFIEX_DEF_11AC_CAP_BF_RESET_MASK ;/* Copy 11AC mcs */ adapter->hw_dot_11ac_mcs_support =
drivers/net/wireless/mwifiex/fw.h +9 -0
@@ -243,6 +243,15 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define GET_DEVTXMCSMAP (dev_mcs_map) (dev_mcs_map >> 16)#define GET_DEVRXMCSMAP (dev_mcs_map) (dev_mcs_map & 0xFFFF) +/* Clear SU Beanformer, MU beanformer, MU beanformee and +* sounding dimensions bits +*/ +#define MWIFIEX_DEF_11AC_CAP_BF_RESET_MASK \ + (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | \ + IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE | \ + IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | \ + IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK) +#define MOD_CLASS_HR_DSSS 0x03#define MOD_CLASS_OFDM 0x07#define MOD_CLASS_HT 0x08
Signature · 1 line
1.8.2.3
PATCH v2 13/30 mwifiex: handle AMPDU supported check for AP interface
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
This patch fixes a bug where we were checking for AP's AMPDU param setting even when transmitting traffic to associated station. Patch adds provision to pass additional parameter ra_list pointer to function which checks if AMPDU is allowed. If current BSS type is AP, we check station's AMPDU params else we check AP's AMPDU params.
--- drivers/net/wireless/mwifiex/11n.h | 26 ++++++++++++++++++++------ drivers/net/wireless/mwifiex/wmm.c | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-)
drivers/net/wireless/mwifiex/11n.h +20 -6
@@ -64,14 +64,28 @@ int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd, struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl);void mwifiex_del_tx_ba_stream_tbl_by_ra (struct mwifiex_private *priv,u8 *ra); -/* -* This function checks whether AMPDU is allowed or not for a particular TID. -*/ static inline u8 -mwifiex_is_ampdu_allowed (struct mwifiex_private *priv,int tid) +mwifiex_is_station_ampdu_allowed (struct mwifiex_private *priv, +struct mwifiex_ra_list_tbl *ptr,int tid) { -return ((priv->aggr_prio_tbl[tid].ampdu_ap !=BA_STREAM_NOT_ALLOWED ) - ? true : false); +struct mwifiex_sta_node *node =mwifiex_get_sta_entry (priv, ptr->ra); + +if (unlikely (!node)) +return false; + +return (node->ampdu_sta[tid] !=BA_STREAM_NOT_ALLOWED ) ? true : false; +} + +/* This function checks whether AMPDU is allowed or not for a particular TID. */ +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 ) +return mwifiex_is_station_ampdu_allowed (priv, ptr, tid); +else +return (priv->aggr_prio_tbl[tid].ampdu_ap != +BA_STREAM_NOT_ALLOWED ) ? true : false; }/*
drivers/net/wireless/mwifiex/wmm.c +1 -1
@@ -1226,7 +1226,7 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter)/* ra_list_spinlock has been freed in mwifiex_send_single_packet() */ }else { -if (mwifiex_is_ampdu_allowed (priv, tid) && +if (mwifiex_is_ampdu_allowed (priv, ptr, tid) && ptr->ba_pkt_count > ptr->ba_packet_thr) {if (mwifiex_space_avail_for_new_ba_stream (adapter)) { mwifiex_create_ba_tbl(priv, ptr->ra, tid,
Signature · 1 line
1.8.2.3
PATCH v2 14/30 mwifiex: make tos_to_tid_inv part of mwifiex_private structure
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
tos_to_tid_inv values are needed even during TDLS restore operations. Currently tos_to_tid_inv is part of wmm.c and is declared static.
Make it part of private structure so that it can be used in other files as well.
--- drivers/net/wireless/mwifiex/init.c | 1 + drivers/net/wireless/mwifiex/main.h | 1 + drivers/net/wireless/mwifiex/wmm.c | 34 +++++++++++----------------------- drivers/net/wireless/mwifiex/wmm.h | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 23 deletions(-)
drivers/net/wireless/mwifiex/init.c +1 -0
@@ -137,6 +137,7 @@ int mwifiex_init_priv(struct mwifiex_private *priv) priv->csa_expire_time =0 ; priv->del_list_idx =0 ; priv->hs2_enabled = false; +memcpy (priv->tos_to_tid_inv, tos_to_tid_inv,MAX_NUM_TID );return mwifiex_add_bss_prio_tbl (priv); }
drivers/net/wireless/mwifiex/main.h +1 -0
@@ -461,6 +461,7 @@ struct mwifiex_private {struct mwifiex_tx_aggr aggr_prio_tbl[MAX_NUM_TID ];struct mwifiex_add_ba_param add_ba_param;u16 rx_seq[MAX_NUM_TID ]; +u8 tos_to_tid_inv[MAX_NUM_TID ];struct list_head rx_reorder_tbl_ptr;/* spin lock for rx_reorder_tbl_ptr queue */ spinlock_t rx_reorder_tbl_lock;
drivers/net/wireless/mwifiex/wmm.c +11 -23
@@ -64,21 +64,6 @@ static u8 tos_to_tid[] = { 0x07 /* 1 1 1 AC_VO */ }; -/* -* This table inverses the tos_to_tid operation to get a priority -* which is in sequential order, and can be compared. -* Use this to compare the priority of two different TIDs. -*/ -static u8 tos_to_tid_inv[] = { -0x02 ,/* from tos_to_tid[2] = 0 */ -0x00 ,/* from tos_to_tid[0] = 1 */ -0x01 ,/* from tos_to_tid[1] = 2 */ -0x03 , -0x04 , -0x05 , -0x06 , -0x07 }; -static u8 ac_to_tid[4 ][2 ] = { {1 ,2 }, {0 ,3 }, {4 ,5 }, {6 ,7 } };/*
@@ -213,8 +198,9 @@ static void mwifiex_wmm_default_queue_priorities(struct mwifiex_private *priv)* This function map ACs to TIDs. */ static void -mwifiex_wmm_queue_priorities_tid (struct mwifiex_wmm_desc *wmm) +mwifiex_wmm_queue_priorities_tid (struct mwifiex_private *priv) { +struct mwifiex_wmm_desc *wmm = &priv->wmm;u8 *queue_priority = wmm->queue_priority;int i;
@@ -224,7 +210,7 @@ mwifiex_wmm_queue_priorities_tid(struct mwifiex_wmm_desc *wmm) }for (i =0 ; i <MAX_NUM_TID ; ++i) - tos_to_tid_inv[tos_to_tid[i]] = (u8 )i; + priv->tos_to_tid_inv[tos_to_tid[i]] = (u8 )i;atomic_set (&wmm->highest_queued_prio,HIGH_PRIO_TID ); }
@@ -285,7 +271,7 @@ mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv, } } -mwifiex_wmm_queue_priorities_tid (&priv->wmm); +mwifiex_wmm_queue_priorities_tid (priv); }/*
@@ -421,9 +407,11 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter)continue ;for (i =0 ; i <MAX_NUM_TID ; ++i) { - priv->aggr_prio_tbl[i].amsdu = tos_to_tid_inv[i]; - priv->aggr_prio_tbl[i].ampdu_ap = tos_to_tid_inv[i]; - priv->aggr_prio_tbl[i].ampdu_user = tos_to_tid_inv[i]; + priv->aggr_prio_tbl[i].amsdu = priv->tos_to_tid_inv[i]; + priv->aggr_prio_tbl[i].ampdu_ap = + priv->tos_to_tid_inv[i]; + priv->aggr_prio_tbl[i].ampdu_user = + priv->tos_to_tid_inv[i]; } priv->aggr_prio_tbl[6 ].amsdu
@@ -683,9 +671,9 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv, ra_list->total_pkt_count++;if (atomic_read (&priv->wmm.highest_queued_prio) < - tos_to_tid_inv[tid_down]) + priv->tos_to_tid_inv[tid_down])atomic_set (&priv->wmm.highest_queued_prio, - tos_to_tid_inv[tid_down]); + priv->tos_to_tid_inv[tid_down]);atomic_inc (&priv->wmm.tx_pkts_queued);
drivers/net/wireless/mwifiex/wmm.h +15 -0
@@ -34,6 +34,21 @@ enum ieee_types_wmm_ecw_bitmasks {static const u16 mwifiex_1d_to_wmm_queue[8 ] = {1 ,0 ,0 ,1 ,2 ,2 ,3 ,3 };/* +* This table inverses the tos_to_tid operation to get a priority +* which is in sequential order, and can be compared. +* Use this to compare the priority of two different TIDs. +*/ +static const u8 tos_to_tid_inv[] = { +0x02 ,/* from tos_to_tid[2] = 0 */ +0x00 ,/* from tos_to_tid[0] = 1 */ +0x01 ,/* from tos_to_tid[1] = 2 */ +0x03 , +0x04 , +0x05 , +0x06 , +0x07 }; + +/* * This function retrieves the TID of the given RA list. */ static inline int
Signature · 1 line
1.8.2.3
PATCH v2 15/30 mwifiex: move station list functions to common code
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
These functions are now needed by TDLS while managing station list. Move them from AP related file to utility file.
--- drivers/net/wireless/mwifiex/main.h | 10 +++ drivers/net/wireless/mwifiex/uap_event.c | 118 ------------------------------- drivers/net/wireless/mwifiex/util.c | 114 +++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 118 deletions(-)
drivers/net/wireless/mwifiex/main.h +10 -0
@@ -1167,6 +1167,16 @@ void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv);extern const struct ethtool_ops mwifiex_ethtool_ops; +void mwifiex_del_all_sta_list (struct mwifiex_private *priv); +void mwifiex_del_sta_entry (struct mwifiex_private *priv,u8 *mac); +void +mwifiex_set_sta_ht_cap (struct mwifiex_private *priv,const u8 *ies, +int ies_len,struct mwifiex_sta_node *node); +struct mwifiex_sta_node * +mwifiex_add_sta_entry (struct mwifiex_private *priv,u8 *mac); +struct mwifiex_sta_node * +mwifiex_get_sta_entry (struct mwifiex_private *priv,u8 *mac); +#ifdef CONFIG_DEBUG_FS void mwifiex_debugfs_init (void );void mwifiex_debugfs_remove (void );
drivers/net/wireless/mwifiex/uap_event.c +0 -118
126 lines not on this page · raw message
drivers/net/wireless/mwifiex/util.c +114 -0
117 lines not on this page · raw message
Signature · 1 line
1.8.2.3
PATCH v2 16/30 mwifiex: cleanup in mwifiex_fill_cap_info()
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
Pass 'struct ieee80211_ht_cap' pointer to mwifiex_fill_cap_info() instead of
'struct mwifiex_ie_types_htcap' pointer, because the routine internally uses the later one.
This patch also adds WARN_ON_ONCE check for NULL band.
--- drivers/net/wireless/mwifiex/11n.c | 29 +++++++++++++++++------------ drivers/net/wireless/mwifiex/11n.h | 4 ++-- drivers/net/wireless/mwifiex/join.c | 2 +- drivers/net/wireless/mwifiex/scan.c | 2 +- 4 files changed, 21 insertions(+), 16 deletions(-)
drivers/net/wireless/mwifiex/11n.c +17 -12
@@ -34,22 +34,26 @@* * RD responder bit to set to clear in the extended capability header. */ -void -mwifiex_fill_cap_info (struct mwifiex_private *priv,u8 radio_type, -struct mwifiex_ie_types_htcap *ht_cap) +int mwifiex_fill_cap_info (struct mwifiex_private *priv,u8 radio_type, +struct ieee80211_ht_cap *ht_cap) { -uint16_t ht_ext_cap =le16_to_cpu (ht_cap->ht_cap.extended_ht_cap_info); +uint16_t ht_ext_cap =le16_to_cpu (ht_cap->extended_ht_cap_info);struct ieee80211_supported_band *sband = priv->wdev->wiphy->bands[radio_type]; - ht_cap->ht_cap.ampdu_params_info = +if (WARN_ON_ONCE (!sband)) { +dev_err (priv->adapter->dev,"Invalid radio type!\n" ); +return -EINVAL ; + } + + ht_cap->ampdu_params_info = (sband->ht_cap.ampdu_factor &IEEE80211_HT_AMPDU_PARM_FACTOR ) | ((sband->ht_cap.ampdu_density <<IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT ) &IEEE80211_HT_AMPDU_PARM_DENSITY ); -memcpy ((u8 *) &ht_cap->ht_cap.mcs, &sband->ht_cap.mcs, +memcpy ((u8 *)&ht_cap->mcs, &sband->ht_cap.mcs,sizeof (sband->ht_cap.mcs)); if (priv->bss_mode == NL80211_IFTYPE_STATION ||
@@ -57,17 +61,18 @@ mwifiex_fill_cap_info(struct mwifiex_private *priv, u8 radio_type, (priv->adapter->sec_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_NONE)))/* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */ -SETHT_MCS32 (ht_cap->ht_cap.mcs.rx_mask); +SETHT_MCS32 (ht_cap->mcs.rx_mask);/* Clear RD responder bit */ ht_ext_cap &= ~IEEE80211_HT_EXT_CAP_RD_RESPONDER ; - ht_cap->ht_cap.cap_info =cpu_to_le16 (sband->ht_cap.cap); - ht_cap->ht_cap.extended_ht_cap_info =cpu_to_le16 (ht_ext_cap); + ht_cap->cap_info =cpu_to_le16 (sband->ht_cap.cap); + ht_cap->extended_ht_cap_info =cpu_to_le16 (ht_ext_cap);if (ISSUPP_BEAMFORMING (priv->adapter->hw_dot_11n_dev_cap)) - ht_cap->ht_cap.tx_BF_cap_info = -cpu_to_le32 (MWIFIEX_DEF_11N_TX_BF_CAP ); + ht_cap->tx_BF_cap_info =cpu_to_le32 (MWIFIEX_DEF_11N_TX_BF_CAP ); + +return 0 ; }/*
@@ -316,7 +321,7 @@ mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv,sizeof (struct ieee_types_header ), le16_to_cpu(ht_cap->header.len)); -mwifiex_fill_cap_info (priv, radio_type, ht_cap); +mwifiex_fill_cap_info (priv, radio_type, &ht_cap->ht_cap); *buffer +=sizeof (struct mwifiex_ie_types_htcap ); ret_len +=sizeof (struct mwifiex_ie_types_htcap );
drivers/net/wireless/mwifiex/11n.h +2 -2
@@ -34,8 +34,8 @@ int mwifiex_cmd_11n_cfg(struct mwifiex_private *priv,int mwifiex_cmd_append_11n_tlv (struct mwifiex_private *priv,struct mwifiex_bssdescriptor *bss_desc,u8 **buffer); -void mwifiex_fill_cap_info (struct mwifiex_private *,u8 radio_type, -struct mwifiex_ie_types_htcap *); +int mwifiex_fill_cap_info (struct mwifiex_private *,u8 radio_type, +struct ieee80211_ht_cap *);int mwifiex_set_get_11n_htcap_cfg (struct mwifiex_private *priv,u16 action,int *htcap_cfg); void mwifiex_11n_delete_tx_ba_stream_tbl_entry(struct mwifiex_private *priv,
drivers/net/wireless/mwifiex/join.c +1 -1
@@ -982,7 +982,7 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,cpu_to_le16 (sizeof (struct ieee80211_ht_cap )); radio_type =mwifiex_band_to_radio_type ( priv->adapter->config_bands); -mwifiex_fill_cap_info (priv, radio_type, ht_cap); +mwifiex_fill_cap_info (priv, radio_type, &ht_cap->ht_cap);if (adapter->sec_chan_offset ==IEEE80211_HT_PARAM_CHA_SEC_NONE ) {
drivers/net/wireless/mwifiex/scan.c +1 -1
@@ -957,7 +957,7 @@ mwifiex_config_scan(struct mwifiex_private *priv,cpu_to_le16 (sizeof (struct ieee80211_ht_cap )); radio_type =mwifiex_band_to_radio_type (priv->adapter->config_bands); -mwifiex_fill_cap_info (priv, radio_type, ht_cap); +mwifiex_fill_cap_info (priv, radio_type, &ht_cap->ht_cap); tlv_pos +=sizeof (struct mwifiex_ie_types_htcap ); }
Signature · 1 line
1.8.2.3
PATCH v2 17/30 mwifiex: add tdls_mgmt handler support
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
This patch adds support for TDLS management frames transmit handler. mwifiex driver supports TDLS with external support, i.e. expects user space application to form TDLS frames. Same is advertised to cfg80211 during registration.
--- drivers/net/wireless/mwifiex/Makefile | 1 + drivers/net/wireless/mwifiex/cfg80211.c | 81 ++++++ drivers/net/wireless/mwifiex/decl.h | 1 + drivers/net/wireless/mwifiex/fw.h | 2 + drivers/net/wireless/mwifiex/ioctl.h | 4 + drivers/net/wireless/mwifiex/main.h | 18 ++ drivers/net/wireless/mwifiex/sta_tx.c | 3 + drivers/net/wireless/mwifiex/tdls.c | 423 ++++++++++++++++++++++++++++++++ 8 files changed, 533 insertions(+) create mode 100644 drivers/net/wireless/mwifiex/tdls.c
drivers/net/wireless/mwifiex/Makefile +1 -0
@@ -41,6 +41,7 @@ mwifiex-y += uap_txrx.o mwifiex-y += cfg80211.o mwifiex-y += ethtool.o mwifiex-y += 11h.o +mwifiex-y += tdls.o mwifiex-$(CONFIG_DEBUG_FS) += debugfs.o obj-$(CONFIG_MWIFIEX) += mwifiex.o
drivers/net/wireless/mwifiex/cfg80211.c +81 -0
99 lines not on this page · raw message
drivers/net/wireless/mwifiex/decl.h +1 -0
@@ -75,6 +75,7 @@#define MWIFIEX_BUF_FLAG_REQUEUED_PKT BIT(0)#define MWIFIEX_BUF_FLAG_BRIDGED_PKT BIT(1) +#define MWIFIEX_BUF_FLAG_TDLS_PKT BIT(2)#define MWIFIEX_BRIDGED_PKTS_THR_HIGH 1024#define MWIFIEX_BRIDGED_PKTS_THR_LOW 128
drivers/net/wireless/mwifiex/fw.h +2 -0
@@ -181,6 +181,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define MWIFIEX_TX_DATA_BUF_SIZE_8K 8192#define ISSUPP_11NENABLED (FwCapInfo) (FwCapInfo & BIT(11)) +#define ISSUPP_TDLS_ENABLED (FwCapInfo) (FwCapInfo & BIT(14))#define MWIFIEX_DEF_HT_CAP (IEEE80211_HT_CAP_DSSSCCK40 | \ (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT) | \
@@ -497,6 +498,7 @@ struct mwifiex_ie_types_data {#define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01#define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08 +#define MWIFIEX_TXPD_FLAGS_TDLS_PACKET 0x10struct txpd {u8 bss_type;
drivers/net/wireless/mwifiex/ioctl.h +4 -0
@@ -85,6 +85,10 @@ struct wep_key {#define BAND_CONFIG_A 0x01#define MWIFIEX_SUPPORTED_RATES 14#define MWIFIEX_SUPPORTED_RATES_EXT 32 +#define MWIFIEX_TDLS_SUPPORTED_RATES 8 +#define MWIFIEX_TDLS_DEF_QOS_CAPAB 0xf +#define MWIFIEX_PRIO_BK 2 +#define MWIFIEX_PRIO_VI 5struct mwifiex_uap_bss_param {u8 channel;
drivers/net/wireless/mwifiex/main.h +18 -0
@@ -262,6 +262,16 @@ struct ieee_types_generic {u8 data[IEEE_MAX_IE_SIZE -sizeof (struct ieee_types_header )]; } __packed; +struct ieee_types_bss_co_2040 { +struct ieee_types_header ieee_hdr; +u8 bss_2040co; +} __packed; + +struct ieee_types_extcap { +struct ieee_types_header ieee_hdr; +u8 ext_capab[8 ]; +} __packed; +struct mwifiex_bssdescriptor {u8 mac_address[ETH_ALEN ];struct cfg80211_ssid ssid;
@@ -1176,6 +1186,14 @@ struct mwifiex_sta_node * mwifiex_add_sta_entry(struct mwifiex_private *priv, u8 *mac);struct mwifiex_sta_node *mwifiex_get_sta_entry (struct mwifiex_private *priv,u8 *mac); +int mwifiex_send_tdls_data_frame (struct mwifiex_private *priv,u8 *peer, +u8 action_code,u8 dialog_token, +u16 status_code,const u8 *extra_ies, +size_t extra_ies_len); +int mwifiex_send_tdls_action_frame (struct mwifiex_private *priv, +u8 *peer,u8 action_code,u8 dialog_token, +u16 status_code,const u8 *extra_ies, +size_t extra_ies_len);#ifdef CONFIG_DEBUG_FS void mwifiex_debugfs_init (void );
drivers/net/wireless/mwifiex/sta_tx.c +3 -0
@@ -95,6 +95,9 @@ void *mwifiex_process_sta_txpd(struct mwifiex_private *priv, } } +if (tx_info->flags &MWIFIEX_BUF_FLAG_TDLS_PKT ) + local_tx_pd->flags |=MWIFIEX_TXPD_FLAGS_TDLS_PACKET ; +/* Offset of actual data */ pkt_offset =sizeof (struct txpd ) + pad;if (pkt_type ==PKT_TYPE_MGMT ) {
drivers/net/wireless/mwifiex/tdls.c new file +423 -0
423 lines not on this page · raw message
Signature · 1 line
1.8.2.3
PATCH v2 18/30 mwifiex: parse TDLS action frames during RX
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
This patch adds support for parsing TDLS action frames during station receive handler.
Peer station capabilities are stored into station node.
--- drivers/net/wireless/mwifiex/decl.h | 8 +++ drivers/net/wireless/mwifiex/main.h | 19 +++++- drivers/net/wireless/mwifiex/sta_rx.c | 13 +++- drivers/net/wireless/mwifiex/tdls.c | 119 ++++++++++++++++++++++++++++++++++ drivers/net/wireless/mwifiex/wmm.c | 5 +- drivers/net/wireless/mwifiex/wmm.h | 3 + 6 files changed, 160 insertions(+), 7 deletions(-)
drivers/net/wireless/mwifiex/decl.h +8 -0
@@ -93,6 +93,14 @@ enum mwifiex_bss_role { MWIFIEX_BSS_ROLE_ANY = 0xff, }; +enum mwifiex_tdls_status { +TDLS_NOT_SETUP =0 , +TDLS_SETUP_INPROGRESS , +TDLS_SETUP_COMPLETE , +TDLS_SETUP_FAILURE , +TDLS_LINK_TEARDOWN , +}; +#define BSS_ROLE_BIT_MASK BIT(0)#define GET_BSS_ROLE (priv) ((priv)->bss_role & BSS_ROLE_BIT_MASK)
drivers/net/wireless/mwifiex/main.h +17 -2
@@ -594,8 +594,20 @@ struct mwifiex_bss_priv {u64 fw_tsf; }; -/* This is AP specific structure which stores information -* about associated STA +struct mwifiex_tdls_capab { +__le16 capab; +u8 rates[32 ]; +u8 rates_len; +u8 qos_info; +u8 coex_2040; +struct ieee80211_ht_cap ht_capb; +struct ieee80211_ht_operation ht_oper; +struct ieee_types_extcap extcap; +struct ieee_types_generic rsn_ie; +}; + +/* This is AP/TDLS specific structure which stores information +* about associated/peer STA */ struct mwifiex_sta_node {struct list_head list;
@@ -605,6 +617,7 @@ struct mwifiex_sta_node {u8 ampdu_sta[MAX_NUM_TID ];u16 rx_seq[MAX_NUM_TID ];u16 max_amsdu; +struct mwifiex_tdls_capab tdls_cap; };struct mwifiex_if_ops {
@@ -1194,6 +1207,8 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, u8 *peer, u8 action_code, u8 dialog_token, u16 status_code, const u8 *extra_ies, size_t extra_ies_len); +void mwifiex_process_tdls_action_frame (struct mwifiex_private *priv, +u8 *buf,int len);#ifdef CONFIG_DEBUG_FS void mwifiex_debugfs_init (void );
drivers/net/wireless/mwifiex/sta_rx.c +11 -2
@@ -88,11 +88,14 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv,struct rxpd *local_rx_pd;int hdr_chop;struct ethhdr *eth; +u16 rx_pkt_off, rx_pkt_len; +u8 *offset; local_rx_pd = (struct rxpd *) (skb->data); - rx_pkt_hdr = (void *)local_rx_pd + -le16_to_cpu (local_rx_pd->rx_pkt_offset); + rx_pkt_off =le16_to_cpu (local_rx_pd->rx_pkt_offset); + rx_pkt_len =le16_to_cpu (local_rx_pd->rx_pkt_length); + rx_pkt_hdr = (void *)local_rx_pd + rx_pkt_off; if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header, sizeof(bridge_tunnel_header))) ||
@@ -142,6 +145,12 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv,return 0 ; } +if (ISSUPP_TDLS_ENABLED (priv->adapter->fw_cap_info) && +ntohs (rx_pkt_hdr->eth803_hdr.h_proto) ==ETH_P_TDLS ) { + offset = (u8 *)local_rx_pd + rx_pkt_off; +mwifiex_process_tdls_action_frame (priv, offset, rx_pkt_len); + } + priv->rxpd_rate = local_rx_pd->rx_rate; priv->rxpd_htinfo = local_rx_pd->ht_info;
drivers/net/wireless/mwifiex/tdls.c +119 -0
128 lines not on this page · raw message
drivers/net/wireless/mwifiex/wmm.c +2 -3
@@ -374,8 +374,7 @@ mwifiex_wmm_convert_tos_to_ac(struct mwifiex_adapter *adapter, u32 tos)* AP is disabled (due to call admission control (ACM bit). Mapping * of TID to AC is taken care of internally. */ -static u8 -mwifiex_wmm_downgrade_tid (struct mwifiex_private *priv,u32 tid) +u8 mwifiex_wmm_downgrade_tid (struct mwifiex_private *priv,u32 tid) {enum mwifiex_wmm_ac_e ac, ac_down;u8 new_tid;
@@ -578,7 +577,7 @@ mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid,* If no such node is found, a new node is added first and then * retrieved. */ -static struct mwifiex_ra_list_tbl * +struct mwifiex_ra_list_tbl *mwifiex_wmm_get_queue_raptr (struct mwifiex_private *priv,u8 tid,u8 *ra_addr) {struct mwifiex_ra_list_tbl *ra_list;
drivers/net/wireless/mwifiex/wmm.h +3 -0
@@ -122,5 +122,8 @@ void mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv,void mwifiex_wmm_setup_ac_downgrade (struct mwifiex_private *priv);int mwifiex_ret_wmm_get_status (struct mwifiex_private *priv,const struct host_cmd_ds_command *resp); +struct mwifiex_ra_list_tbl * +mwifiex_wmm_get_queue_raptr (struct mwifiex_private *priv,u8 tid,u8 *ra_addr); +u8 mwifiex_wmm_downgrade_tid (struct mwifiex_private *priv,u32 tid);#endif /* !_MWIFIEX_WMM_H_ */
Signature · 1 line
1.8.2.3
PATCH v2 19/30 mwifiex: add cfg80211 tdls_oper handler support
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
This patch adds cfg80211 handler tdls_oper handler support to mwifiex. Upon enable link, driver sets status as TDLS status as setup complete and also sets AMSDU size, AMPDU params for direct link. Upon disable link, driver issues command to FW to delete this link in FW.
--- drivers/net/wireless/mwifiex/cfg80211.c | 49 +++++++++++++++ drivers/net/wireless/mwifiex/decl.h | 14 +++++ drivers/net/wireless/mwifiex/fw.h | 12 ++++ drivers/net/wireless/mwifiex/ioctl.h | 12 ++++ drivers/net/wireless/mwifiex/main.h | 2 + drivers/net/wireless/mwifiex/sta_cmd.c | 32 ++++++++++ drivers/net/wireless/mwifiex/sta_cmdresp.c | 28 +++++++++ drivers/net/wireless/mwifiex/tdls.c | 97 ++++++++++++++++++++++++++++++ 8 files changed, 246 insertions(+)
drivers/net/wireless/mwifiex/cfg80211.c +49 -0
@@ -2667,6 +2667,54 @@ mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,return ret; } +static int +mwifiex_cfg80211_tdls_oper (struct wiphy *wiphy,struct net_device *dev, +u8 *peer,enum nl80211_tdls_operation action) +{ +struct mwifiex_private *priv =mwifiex_netdev_get_priv (dev); + +if (!(wiphy->flags &WIPHY_FLAG_SUPPORTS_TDLS ) || + !(wiphy->flags &WIPHY_FLAG_TDLS_EXTERNAL_SETUP )) +return -ENOTSUPP ; + +/* make sure we are in station mode and connected */ +if (!(priv->bss_type ==MWIFIEX_BSS_TYPE_STA && priv->media_connected)) +return -ENOTSUPP ; + +dev_dbg (priv->adapter->dev, +"TDLS peer=%pM, oper=%d\n" , peer, action); + +switch (action) { +case NL80211_TDLS_ENABLE_LINK : + action =MWIFIEX_TDLS_ENABLE_LINK ; +break ; +case NL80211_TDLS_DISABLE_LINK : + action =MWIFIEX_TDLS_DISABLE_LINK ; +break ; +case NL80211_TDLS_TEARDOWN : +/* shouldn't happen!*/ +dev_warn (priv->adapter->dev, +"tdls_oper: teardown from driver not supported\n" ); +return -EINVAL ; +case NL80211_TDLS_SETUP : +/* shouldn't happen!*/ +dev_warn (priv->adapter->dev, +"tdls_oper: setup from driver not supported\n" ); +return -EINVAL ; +case NL80211_TDLS_DISCOVERY_REQ : +/* shouldn't happen!*/ +dev_warn (priv->adapter->dev, +"tdls_oper: discovery from driver not supported\n" ); +return -EINVAL ; +default : +dev_err (priv->adapter->dev, +"tdls_oper: operation not supported\n" ); +return -ENOTSUPP ; + } + +return mwifiex_tdls_oper (priv, peer, action); +} +/* station cfg80211 operations */ static struct cfg80211_ops mwifiex_cfg80211_ops = { .add_virtual_intf = mwifiex_add_virtual_intf,
@@ -2703,6 +2751,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = {#endif .set_coalesce = mwifiex_cfg80211_set_coalesce, .tdls_mgmt = mwifiex_cfg80211_tdls_mgmt, + .tdls_oper = mwifiex_cfg80211_tdls_oper, };#ifdef CONFIG_PM
drivers/net/wireless/mwifiex/decl.h +14 -0
@@ -80,6 +80,11 @@#define MWIFIEX_BRIDGED_PKTS_THR_HIGH 1024#define MWIFIEX_BRIDGED_PKTS_THR_LOW 128 +#define MWIFIEX_TDLS_DISABLE_LINK 0x00 +#define MWIFIEX_TDLS_ENABLE_LINK 0x01 +#define MWIFIEX_TDLS_CREATE_LINK 0x02 +#define MWIFIEX_TDLS_CONFIG_LINK 0x03 +enum mwifiex_bss_type {MWIFIEX_BSS_TYPE_STA =0 ,MWIFIEX_BSS_TYPE_UAP =1 ,
@@ -101,6 +106,15 @@ enum mwifiex_tdls_status { TDLS_LINK_TEARDOWN, }; +enum mwifiex_tdls_error_code { +TDLS_ERR_NO_ERROR =0 , +TDLS_ERR_INTERNAL_ERROR , +TDLS_ERR_MAX_LINKS_EST , +TDLS_ERR_LINK_EXISTS , +TDLS_ERR_LINK_NONEXISTENT , +TDLS_ERR_PEER_STA_UNREACHABLE =25 , +}; +#define BSS_ROLE_BIT_MASK BIT(0)#define GET_BSS_ROLE (priv) ((priv)->bss_role & BSS_ROLE_BIT_MASK)
drivers/net/wireless/mwifiex/fw.h +12 -0
@@ -316,6 +316,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define HostCmd_CMD_MGMT_FRAME_REG 0x010c#define HostCmd_CMD_REMAIN_ON_CHAN 0x010d#define HostCmd_CMD_11AC_CFG 0x0112 +#define HostCmd_CMD_TDLS_OPER 0x0122#define PROTOCOL_NO_SECURITY 0x01#define PROTOCOL_STATIC_WEP 0x02
@@ -486,6 +487,10 @@ enum P2P_MODES {#define MWIFIEX_CRITERIA_UNICAST BIT(1)#define MWIFIEX_CRITERIA_MULTICAST BIT(3) +#define ACT_TDLS_DELETE 0x00 +#define ACT_TDLS_CREATE 0x01 +#define ACT_TDLS_CONFIG 0x02 +struct mwifiex_ie_types_header {__le16 type;__le16 len;
@@ -1066,6 +1071,12 @@ struct host_cmd_ds_rf_ant_siso {__le16 ant_mode; }; +struct host_cmd_ds_tdls_oper { +__le16 tdls_action; +__le16 reason; +u8 peer_mac[ETH_ALEN ]; +} __packed; +struct mwifiex_fixed_bcn_param {__le64 timestamp;__le16 beacon_period;
@@ -1726,6 +1737,7 @@ struct host_cmd_ds_command {struct host_cmd_ds_sta_deauth sta_deauth;struct host_cmd_11ac_vht_cfg vht_cfg;struct host_cmd_ds_coalesce_cfg coalesce_cfg; +struct host_cmd_ds_tdls_oper tdls_oper; } params; } __packed;
drivers/net/wireless/mwifiex/ioctl.h +12 -0
@@ -435,4 +435,16 @@ struct mwifiex_ds_coalesce_cfg { struct mwifiex_coalesce_rule rule[MWIFIEX_COALESCE_MAX_RULES]; }; +struct mwifiex_ds_tdls_oper { +u16 tdls_action; +u8 peer_mac[ETH_ALEN ]; +u16 capability; +u8 qos_info; +u8 *ext_capab; +u8 ext_capab_len; +u8 *supp_rates; +u8 supp_rates_len; +u8 *ht_capab; +}; +#endif /* !_MWIFIEX_IOCTL_H_ */
drivers/net/wireless/mwifiex/main.h +2 -0
@@ -617,6 +617,7 @@ struct mwifiex_sta_node {u8 ampdu_sta[MAX_NUM_TID ];u16 rx_seq[MAX_NUM_TID ];u16 max_amsdu; +u8 tdls_status;struct mwifiex_tdls_capab tdls_cap; };
@@ -1209,6 +1210,7 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, size_t extra_ies_len);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);#ifdef CONFIG_DEBUG_FS void mwifiex_debugfs_init (void );
drivers/net/wireless/mwifiex/sta_cmd.c +32 -0
@@ -1280,6 +1280,35 @@ mwifiex_cmd_coalesce_cfg(struct mwifiex_private *priv,return 0 ; } +static int +mwifiex_cmd_tdls_oper (struct mwifiex_private *priv, +struct host_cmd_ds_command *cmd, +void *data_buf) +{ +struct host_cmd_ds_tdls_oper *tdls_oper = &cmd->params.tdls_oper; +struct mwifiex_ds_tdls_oper *oper = data_buf; +struct mwifiex_sta_node *sta_ptr; + + cmd->command =cpu_to_le16 (HostCmd_CMD_TDLS_OPER); + cmd->size =cpu_to_le16 (S_DS_GEN ); + + tdls_oper->reason =0 ; +memcpy (tdls_oper->peer_mac, oper->peer_mac,ETH_ALEN ); + sta_ptr =mwifiex_get_sta_entry (priv, oper->peer_mac); + +switch (oper->tdls_action) { +case MWIFIEX_TDLS_DISABLE_LINK : + tdls_oper->tdls_action =cpu_to_le16 (ACT_TDLS_DELETE ); +break ; +default : +dev_err (priv->adapter->dev,"Unknown TDLS operation\n" ); +return -ENOTSUPP ; + } + +le16_add_cpu (&cmd->size,sizeof (struct host_cmd_ds_tdls_oper )); + +return 0 ; +}/* * This function prepares the commands before sending them to the firmware. *
@@ -1510,6 +1539,9 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no, ret =mwifiex_cmd_coalesce_cfg (priv, cmd_ptr, cmd_action, data_buf);break ; +case HostCmd_CMD_TDLS_OPER: + ret =mwifiex_cmd_tdls_oper (priv, cmd_ptr, data_buf); +break ;default :dev_err (priv->adapter->dev,"PREP_CMD: unknown cmd- %#x\n" , cmd_no);
drivers/net/wireless/mwifiex/sta_cmdresp.c +28 -0
@@ -801,7 +801,32 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,return 0 ; } +static int mwifiex_ret_tdls_oper (struct mwifiex_private *priv, +struct host_cmd_ds_command *resp) +{ +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); +switch (action) { +case ACT_TDLS_DELETE : +if (reason) +dev_err (priv->adapter->dev, +"TDLS link delete for %pM failed: reason %d\n" , + cmd_tdls_oper->peer_mac, reason); +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); +return -1 ; + } + +return 0 ; +}/* * This function handles the command response for subscribe event command. */
@@ -1004,6 +1029,9 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,break ;case HostCmd_CMD_COALESCE_CFG:break ; +case HostCmd_CMD_TDLS_OPER: + ret =mwifiex_ret_tdls_oper (priv, resp); +break ;default :dev_err (adapter->dev,"CMD_RESP: unknown cmd response %#x\n" , resp->command);
drivers/net/wireless/mwifiex/tdls.c +97 -0
106 lines not on this page · raw message
Signature · 1 line
1.8.2.3