Skip to contentSkip to conversation

mwifiex fixes and USB multichannel

PATCH In review Amitkumar Karwar 2 participants 18 messages Sep 18, 2015 – Sep 29, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover mwifiex fixes and USB multichannel

This patch series includes few fixes and USB multichannel feature support patch series

Amitkumar Karwar (2):
mwifiex: avoid memsetting PCIe event buffer
mwifiex: Suppress -ENOSR error for data traffic on USB

Aniket Nagarnaik (2):
mwifiex: don't always include ht/vht info in tdls confirm frame
mwifiex: fix NULL pointer dereference during hidden SSID scan

Xinming Hu (4):
mwifiex: fix typo in del_virtual_intf() function
mwifiex: minor corrections in multiport aggregation code
mwifiex: fix driver init failure under memory pressure
mwifiex: NULL check for cfg80211_inform_bss()

Zhaoyang Liu (8):
mwifiex: update amsdu tx packet time stamp
mwifiex: correct paused tx data packet counter
mwifiex: fix tx data_sent issue for usb interface
mwifiex: move usb specific data_sent update to usb.c
mwifiex: add usb multi channel event process support
mwifiex: add usb tx data multi endpoints support
mwifiex: add usb multi endpoints resync support
mwifiex: complete usb tx data with multi endpoints

 drivers/net/wireless/mwifiex/11n_aggr.c    |   8 +-
 drivers/net/wireless/mwifiex/cfg80211.c    |  12 +-
 drivers/net/wireless/mwifiex/fw.h          |  18 +++
 drivers/net/wireless/mwifiex/init.c        |   1 +
 drivers/net/wireless/mwifiex/main.c        |  60 +++++++-
 drivers/net/wireless/mwifiex/main.h        |   8 ++
 drivers/net/wireless/mwifiex/pcie.c        |   1 -
 drivers/net/wireless/mwifiex/scan.c        |  22 +--
 drivers/net/wireless/mwifiex/sdio.c        |  29 ++--
 drivers/net/wireless/mwifiex/sta_cmd.c     |   3 +-
 drivers/net/wireless/mwifiex/sta_cmdresp.c |  11 ++
 drivers/net/wireless/mwifiex/sta_event.c   |  78 ++++++++--
 drivers/net/wireless/mwifiex/sta_tx.c      |   7 +-
 drivers/net/wireless/mwifiex/tdls.c        |  12 ++
 drivers/net/wireless/mwifiex/txrx.c        |  19 +--
 drivers/net/wireless/mwifiex/uap_event.c   |   4 +-
 drivers/net/wireless/mwifiex/uap_txrx.c    |  10 +-
 drivers/net/wireless/mwifiex/usb.c         | 224 +++++++++++++++++++++++------
 drivers/net/wireless/mwifiex/usb.h         |  15 +-
 drivers/net/wireless/mwifiex/wmm.c         |  52 +++++--
 20 files changed, 469 insertions(+), 125 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/16 mwifiex: fix typo in del_virtual_intf() function

From: Xinming Hu <[email protected]>

Interface counters should be incremented in add_virtual_intf() and decremented in del_virtual_intf() function. This patch corrects it.

---
 drivers/net/wireless/mwifiex/cfg80211.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +3 -3
index 7e71dd7..4e06e98 100644
@@ -2862,14 +2862,14 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 	case NL80211_IFTYPE_UNSPECIFIED:
 	case NL80211_IFTYPE_STATION:
 	case NL80211_IFTYPE_ADHOC:
-		adapter->curr_iface_comb.sta_intf++;
+		adapter->curr_iface_comb.sta_intf--;
 		break;
 	case NL80211_IFTYPE_AP:
-		adapter->curr_iface_comb.uap_intf++;
+		adapter->curr_iface_comb.uap_intf--;
 		break;
 	case NL80211_IFTYPE_P2P_CLIENT:
 	case NL80211_IFTYPE_P2P_GO:
-		adapter->curr_iface_comb.p2p_intf++;
+		adapter->curr_iface_comb.p2p_intf--;
 		break;
 	default:
 		mwifiex_dbg(adapter, ERROR,
Signature · 1 line
1.8.1.4
#2 lore raw

Re: [01/16] mwifiex: fix typo in del_virtual_intf() function

Quoted 9 lines

From: Xinming Hu <[email protected]>

Interface counters should be incremented in add_virtual_intf() and decremented in del_virtual_intf() function. This patch corrects it.

Thanks, 16 patches applied to wireless-drivers-next.git:

65405c51bb2e mwifiex: fix typo in del_virtual_intf() function 0a252abb6ad7 mwifiex: update amsdu tx packet time stamp e3ad3d5b6ab2 mwifiex: minor corrections in multiport aggregation code 9a9053c3420f mwifiex: fix driver init failure under memory pressure 02421dd3f6af mwifiex: NULL check for cfg80211_inform_bss() 2c3da961268f mwifiex: don't always include ht/vht info in tdls confirm frame 17e524b1b60f mwifiex: fix NULL pointer dereference during hidden SSID scan 14d9c11c91a6 mwifiex: avoid memsetting PCIe event buffer 70c5ad7e20c1 mwifiex: correct paused tx data packet counter 17090beec26e mwifiex: Suppress -ENOSR error for data traffic on USB d22871db0172 mwifiex: fix tx data_sent issue for usb interface d941444321f6 mwifiex: move usb specific data_sent update to usb.c 2b0f997db43f mwifiex: add usb multi channel event process support 308fe29ef243 mwifiex: add usb tx data multi endpoints support 7e4e5d2cd081 mwifiex: add usb multi endpoints resync support 735ab6bfc038 mwifiex: complete usb tx data with multi endpoints

Kalle Valo

#3 lore raw

PATCH 2/16 mwifiex: update amsdu tx packet time stamp

In reply to Amitkumar Karwar

From: Zhaoyang Liu <[email protected]>

This patch fixes the issue of delay time in A-MSDU tx packet. In generated new A-MSDU packet, the time stamp is initialized to zero. Choose the time of first MSDU packet as aggregated packet's time.

---
 drivers/net/wireless/mwifiex/11n_aggr.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/mwifiex/11n_aggr.c +1 -0
index f7c7172..6cb0d33 100644
@@ -202,6 +202,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
 		tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT;
 	tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_AGGR_PKT;
 	skb_aggr->priority = skb_src->priority;
+	skb_aggr->tstamp = skb_src->tstamp;
 
 	do_gettimeofday(&tv);
 	skb_aggr->tstamp = timeval_to_ktime(tv);
Signature · 1 line
1.8.1.4
#4 lore raw

PATCH 3/16 mwifiex: minor corrections in multiport aggregation code

In reply to Amitkumar Karwar

From: Xinming Hu <[email protected]>

This patch includes below changes
1) Check if multiport aggregation feature flag while doing rx length validation check.
2) Reset buffer size variables when buffers are freed.

---
 drivers/net/wireless/mwifiex/sdio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/sdio.c +5 -2
index 5d05c6f..d35210c 100644
@@ -1606,8 +1606,9 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
 				(rx_len + MWIFIEX_SDIO_BLOCK_SIZE -
 				 1) / MWIFIEX_SDIO_BLOCK_SIZE;
 			if (rx_len <= INTF_HEADER_LEN ||
-			    (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE) >
-			     card->mpa_rx.buf_size) {
+			    (card->mpa_rx.enabled &&
+			     ((rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE) >
+			      card->mpa_rx.buf_size))) {
 				mwifiex_dbg(adapter, ERROR,
 					    "invalid rx_len=%d\n",
 					    rx_len);
@@ -1925,6 +1926,8 @@ error:
 	if (ret) {
 		kfree(card->mpa_tx.buf);
 		kfree(card->mpa_rx.buf);
+		card->mpa_tx.buf_size = 0;
+		card->mpa_rx.buf_size = 0;
 	}
 
 	return ret;
Signature · 1 line
1.8.1.4
#5 lore raw

PATCH 4/16 mwifiex: fix driver init failure under memory pressure

In reply to Amitkumar Karwar

From: Xinming Hu <[email protected]>

64k Tx and Rx buffers are allocated during driver initialization for SDIO level data aggregations. When host is under memory pressure situation, kzalloc() request for 64k may fail.

We will try allocating 32k buffers and disable our rx single port aggreagation feature in this situation.

If the allocation still fails, we will disable our sdio multport aggregation feature as well. In this way, we will transmit and receive packets one by one, thus reduce the demand for big memory.

---
 drivers/net/wireless/mwifiex/main.h    |  2 ++
 drivers/net/wireless/mwifiex/sdio.c    | 22 ++++++++++++++++------
 drivers/net/wireless/mwifiex/sta_cmd.c |  3 ++-
 3 files changed, 20 insertions(+), 7 deletions(-)
drivers/net/wireless/mwifiex/main.h +2 -0
index f4159ed..8f5c3da 100644
@@ -861,6 +861,8 @@ struct mwifiex_adapter {
 	u8 more_task_flag;
 	u16 tx_buf_size;
 	u16 curr_tx_buf_size;
+	/* sdio single port rx aggregation capability */
+	bool host_disable_sdio_rx_aggr;
 	bool sdio_rx_aggr_enable;
 	u16 sdio_rx_block_size;
 	u32 ioport;
drivers/net/wireless/mwifiex/sdio.c +16 -6
index d35210c..78a8474 100644
@@ -2058,16 +2058,26 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
 	ret = mwifiex_alloc_sdio_mpa_buffers(adapter,
 					     card->mp_tx_agg_buf_size,
 					     card->mp_rx_agg_buf_size);
-	if (ret) {
-		mwifiex_dbg(adapter, ERROR,
-			    "failed to alloc sdio mp-a buffers\n");
-		kfree(card->mp_regs);
-		return -1;
+
+	/* Allocate 32k MPA Tx/Rx buffers if 64k memory allocation fails */
+	if (ret && (card->mp_tx_agg_buf_size == MWIFIEX_MP_AGGR_BUF_SIZE_MAX ||
+		    card->mp_rx_agg_buf_size == MWIFIEX_MP_AGGR_BUF_SIZE_MAX)) {
+		/* Disable rx single port aggregation */
+		adapter->host_disable_sdio_rx_aggr = true;
+
+		ret = mwifiex_alloc_sdio_mpa_buffers
+			(adapter, MWIFIEX_MP_AGGR_BUF_SIZE_32K,
+			 MWIFIEX_MP_AGGR_BUF_SIZE_32K);
+		if (ret) {
+			/* Disable multi port aggregation */
+			card->mpa_tx.enabled = 0;
+			card->mpa_rx.enabled = 0;
+		}
 	}
 
 	adapter->auto_tdls = card->can_auto_tdls;
 	adapter->ext_scan = card->can_ext_scan;
-	return ret;
+	return 0;
 }
 
 /*
drivers/net/wireless/mwifiex/sta_cmd.c +2 -1
index fd7bf94..e486867 100644
@@ -2156,7 +2156,8 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
 
 		/** Set SDIO Single Port RX Aggr Info */
 		if (priv->adapter->iface_type == MWIFIEX_SDIO &&
-		    ISSUPP_SDIO_SPA_ENABLED(priv->adapter->fw_cap_info)) {
+		    ISSUPP_SDIO_SPA_ENABLED(priv->adapter->fw_cap_info) &&
+		    !priv->adapter->host_disable_sdio_rx_aggr) {
 			sdio_sp_rx_aggr_enable = true;
 			ret = mwifiex_send_cmd(priv,
 					       HostCmd_CMD_SDIO_SP_RX_AGGR_CFG,
Signature · 1 line
1.8.1.4
#6 lore raw

PATCH 5/16 mwifiex: NULL check for cfg80211_inform_bss()

In reply to Amitkumar Karwar

From: Xinming Hu <[email protected]>

cfg80211_inform_bss would return null in some cases, such as memory allocation failure.

This patch adds sanity check for this case, to avoid possible issues when above corner case is hit.

---
 drivers/net/wireless/mwifiex/cfg80211.c |  6 ++++--
 drivers/net/wireless/mwifiex/scan.c     | 20 ++++++++++++--------
 2 files changed, 16 insertions(+), 10 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +4 -2
index 4e06e98..262c4b9 100644
@@ -1994,8 +1994,10 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
 				  CFG80211_BSS_FTYPE_UNKNOWN,
 				  bss_info.bssid, 0, WLAN_CAPABILITY_IBSS,
 				  0, ie_buf, ie_len, 0, GFP_KERNEL);
-	cfg80211_put_bss(priv->wdev.wiphy, bss);
-	memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN);
+	if (bss) {
+		cfg80211_put_bss(priv->wdev.wiphy, bss);
+		ether_addr_copy(priv->cfg_bssid, bss_info.bssid);
+	}
 
 	return 0;
 }
drivers/net/wireless/mwifiex/scan.c +12 -8
index 5847863..3675730 100644
@@ -1839,14 +1839,18 @@ mwifiex_parse_single_response_buf(struct mwifiex_private *priv, u8 **bss_info,
 					    bssid, timestamp,
 					    cap_info_bitmap, beacon_period,
 					    ie_buf, ie_len, rssi, GFP_KERNEL);
-			bss_priv = (struct mwifiex_bss_priv *)bss->priv;
-			bss_priv->band = band;
-			bss_priv->fw_tsf = fw_tsf;
-			if (priv->media_connected &&
-			    !memcmp(bssid, priv->curr_bss_params.bss_descriptor
-				    .mac_address, ETH_ALEN))
-				mwifiex_update_curr_bss_params(priv, bss);
-			cfg80211_put_bss(priv->wdev.wiphy, bss);
+			if (bss) {
+				bss_priv = (struct mwifiex_bss_priv *)bss->priv;
+				bss_priv->band = band;
+				bss_priv->fw_tsf = fw_tsf;
+				if (priv->media_connected &&
+				    !memcmp(bssid, priv->curr_bss_params.
+					    bss_descriptor.mac_address,
+					    ETH_ALEN))
+					mwifiex_update_curr_bss_params(priv,
+								       bss);
+				cfg80211_put_bss(priv->wdev.wiphy, bss);
+			}
 
 			if ((chan->flags & IEEE80211_CHAN_RADAR) ||
 			    (chan->flags & IEEE80211_CHAN_NO_IR)) {
Signature · 1 line
1.8.1.4
#7 lore raw

PATCH 6/16 mwifiex: don't always include ht/vht info in tdls confirm frame

In reply to Amitkumar Karwar

From: Aniket Nagarnaik <[email protected]>

Current TDLS implementation always includes ht/vht information in tdls setup confirm frame which causes teardown by legacy peer station after TDLS handshake. We will inclue ht/vht capabilities in tdls setup confirm frame only if peer station supports it to fix this problem.

---
 drivers/net/wireless/mwifiex/tdls.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/wireless/mwifiex/tdls.c +12 -0
index b3e163d..9275f9c 100644
@@ -204,6 +204,12 @@ mwifiex_tdls_add_ht_oper(struct mwifiex_private *priv, const u8 *mac,
 		return -1;
 	}
 
+	if (!(le16_to_cpu(sta_ptr->tdls_cap.ht_capb.cap_info))) {
+		mwifiex_dbg(priv->adapter, WARN,
+			    "TDLS peer doesn't support ht capabilities\n");
+		return 0;
+	}
+
 	pos = (void *)skb_put(skb, sizeof(struct ieee80211_ht_operation) + 2);
 	*pos++ = WLAN_EID_HT_OPERATION;
 	*pos++ = sizeof(struct ieee80211_ht_operation);
@@ -252,6 +258,12 @@ static int mwifiex_tdls_add_vht_oper(struct mwifiex_private *priv,
 		return -1;
 	}
 
+	if (!(le32_to_cpu(sta_ptr->tdls_cap.vhtcap.vht_cap_info))) {
+		mwifiex_dbg(adapter, WARN,
+			    "TDLS peer doesn't support vht capabilities\n");
+		return 0;
+	}
+
 	if (!mwifiex_is_bss_in_11ac_mode(priv)) {
 		if (sta_ptr->tdls_cap.extcap.ext_capab[7] &
 		   WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED) {
Signature · 1 line
1.8.1.4
#8 lore raw

PATCH 7/16 mwifiex: fix NULL pointer dereference during hidden SSID scan

In reply to Amitkumar Karwar

From: Aniket Nagarnaik <[email protected]>

This NULL pointer dereference is observed during suspend resume stress test. All pending commands are cancelled when system goes into suspend state. There a corner case in which host may receive response for last scan command after this and try to trigger extra active scan for hidden SSIDs.

The issue is fixed by adding a NULL check to skip that extra scan.

Fixes 2375fa2b36feaf34 (mwifiex: fix unable to connect hidden SSID..)
Cc <[email protected]> [v4.2+]
---
 drivers/net/wireless/mwifiex/scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mwifiex/scan.c +1 -1
index 3675730..c20017c 100644
@@ -1893,7 +1893,7 @@ mwifiex_active_scan_req_for_passive_chan(struct mwifiex_private *priv)
 	u8 id = 0;
 	struct mwifiex_user_scan_cfg  *user_scan_cfg;
 
-	if (adapter->active_scan_triggered) {
+	if (adapter->active_scan_triggered || !priv->scan_request) {
 		adapter->active_scan_triggered = false;
 		return 0;
 	}
Signature · 1 line
1.8.1.4
#9 lore raw

PATCH 8/16 mwifiex: avoid memsetting PCIe event buffer

In reply to Amitkumar Karwar

Preallocated PCIe buffer is being reused for all PCIe interface events. Physical address of the buffer is shared with firmware so that it can perform DMA on it. As event length is specified in the header, there should not be a problem if the buffer gets overwritten.
We will save some cycles by avoiding memset everytime while submitting the buffer to firmware.

Fixes 2728cecdc7d6bf3d21(mwifiex: corrections in PCIe event skb)
---
 drivers/net/wireless/mwifiex/pcie.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/wireless/mwifiex/pcie.c +0 -1
index 408b684..21192b6 100644
@@ -1815,7 +1815,6 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter,
 	if (!card->evt_buf_list[rdptr]) {
 		skb_push(skb, INTF_HEADER_LEN);
 		skb_put(skb, MAX_EVENT_SIZE - skb->len);
-		memset(skb->data, 0, MAX_EVENT_SIZE);
 		if (mwifiex_map_pci_memory(adapter, skb,
 					   MAX_EVENT_SIZE,
 					   PCI_DMA_FROMDEVICE))
Signature · 1 line
1.8.1.4
#10 lore raw

PATCH 9/16 mwifiex: correct paused tx data packet counter

In reply to Amitkumar Karwar

From: Zhaoyang Liu <[email protected]>

This patch fixes observed issues while updating counter for number of paused data packets in wmm queue when trying to delete packet or delete station entry.

---
 drivers/net/wireless/mwifiex/uap_txrx.c | 10 +++++++---
 drivers/net/wireless/mwifiex/wmm.c      |  9 +++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)
drivers/net/wireless/mwifiex/uap_txrx.c +7 -3
index 8766741..74d5d72 100644
@@ -31,7 +31,8 @@
  */
 static bool
 mwifiex_uap_del_tx_pkts_in_ralist(struct mwifiex_private *priv,
-				  struct list_head *ra_list_head)
+				  struct list_head *ra_list_head,
+				  int tid)
 {
 	struct mwifiex_ra_list_tbl *ra_list;
 	struct sk_buff *skb, *tmp;
@@ -49,7 +50,10 @@ mwifiex_uap_del_tx_pkts_in_ralist(struct mwifiex_private *priv,
 				__skb_unlink(skb, &ra_list->skb_head);
 				mwifiex_write_data_complete(adapter, skb, 0,
 							    -1);
-				atomic_dec(&priv->wmm.tx_pkts_queued);
+				if (ra_list->tx_paused)
+					priv->wmm.pkts_paused[tid]--;
+				else
+					atomic_dec(&priv->wmm.tx_pkts_queued);
 				pkt_deleted = true;
 			}
 			if ((atomic_read(&adapter->pending_bridged_pkts) <=
@@ -77,7 +81,7 @@ static void mwifiex_uap_cleanup_tx_queues(struct mwifiex_private *priv)
 		if (priv->del_list_idx == MAX_NUM_TID)
 			priv->del_list_idx = 0;
 		ra_list = &priv->wmm.tid_tbl_ptr[priv->del_list_idx].ra_list;
-		if (mwifiex_uap_del_tx_pkts_in_ralist(priv, ra_list)) {
+		if (mwifiex_uap_del_tx_pkts_in_ralist(priv, ra_list, i)) {
 			priv->del_list_idx++;
 			break;
 		}
drivers/net/wireless/mwifiex/wmm.c +7 -2
index 173d366..8e30fb3 100644
@@ -160,7 +160,6 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra)
 		ra_list->tdls_link = false;
 		ra_list->ba_status = BA_SETUP_NONE;
 		ra_list->amsdu_in_ampdu = false;
-		ra_list->tx_paused = false;
 		if (!mwifiex_queuing_ra_based(priv)) {
 			if (mwifiex_is_tdls_link_setup
 				(mwifiex_get_tdls_link_status(priv, ra))) {
@@ -173,6 +172,8 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra)
 		} else {
 			spin_lock_irqsave(&priv->sta_list_spinlock, flags);
 			node = mwifiex_get_sta_entry(priv, ra);
+			if (node)
+				ra_list->tx_paused = node->tx_pause;
 			ra_list->is_11n_enabled =
 				      mwifiex_is_sta_11n_enabled(priv, node);
 			if (ra_list->is_11n_enabled)
@@ -737,7 +738,11 @@ mwifiex_wmm_del_peer_ra_list(struct mwifiex_private *priv, const u8 *ra_addr)
 		if (!ra_list)
 			continue;
 		mwifiex_wmm_del_pkts_in_ralist_node(priv, ra_list);
-		atomic_sub(ra_list->total_pkt_count, &priv->wmm.tx_pkts_queued);
+		if (ra_list->tx_paused)
+			priv->wmm.pkts_paused[i] -= ra_list->total_pkt_count;
+		else
+			atomic_sub(ra_list->total_pkt_count,
+				   &priv->wmm.tx_pkts_queued);
 		list_del(&ra_list->list);
 		kfree(ra_list);
 	}
Signature · 1 line
1.8.1.4
#11 lore raw

PATCH 10/16 mwifiex: Suppress -ENOSR error for data traffic on USB

In reply to Amitkumar Karwar

We have preallocated buffer pool for Tx data. During high data traffic, all buffers are submitted to USB and driver needs to wait until one of the buffers get available for next Tx packet.

"data: -ENOSR is returned" errors is expected in this case. Let's lower the priority of this message.

---
 drivers/net/wireless/mwifiex/txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mwifiex/txrx.c +1 -1
index 8b1e5b5..98f097d 100644
@@ -130,7 +130,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
 
 	switch (ret) {
 	case -ENOSR:
-		mwifiex_dbg(adapter, ERROR, "data: -ENOSR is returned\n");
+		mwifiex_dbg(adapter, DATA, "data: -ENOSR is returned\n");
 		break;
 	case -EBUSY:
 		if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
Signature · 1 line
1.8.1.4
#12 lore raw

PATCH 11/16 mwifiex: fix tx data_sent issue for usb interface

In reply to Amitkumar Karwar

From: Zhaoyang Liu <[email protected]>

This patch fix missing tx data_sent flag update for usb interface. Except USB interface, data_sent flag has been updated in specific file such as sdio.c and pcie.c. So only USB interface type need check when TX data completed.

---
 drivers/net/wireless/mwifiex/11n_aggr.c | 4 ++--
 drivers/net/wireless/mwifiex/sta_tx.c   | 6 +++++-
 drivers/net/wireless/mwifiex/txrx.c     | 8 ++++----
 drivers/net/wireless/mwifiex/wmm.c      | 4 ++--
 4 files changed, 13 insertions(+), 9 deletions(-)
drivers/net/wireless/mwifiex/11n_aggr.c +2 -2
index 6cb0d33..ce22cc8 100644
@@ -300,7 +300,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
 		mwifiex_dbg(adapter, ERROR, "data: -EBUSY is returned\n");
 		break;
 	case -1:
-		if (adapter->iface_type != MWIFIEX_PCIE)
+		if (adapter->iface_type == MWIFIEX_USB)
 			adapter->data_sent = false;
 		mwifiex_dbg(adapter, ERROR, "%s: host_to_card failed: %#x\n",
 			    __func__, ret);
@@ -308,7 +308,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
 		mwifiex_write_data_complete(adapter, skb_aggr, 1, ret);
 		return 0;
 	case -EINPROGRESS:
-		if (adapter->iface_type != MWIFIEX_PCIE)
+		if (adapter->iface_type == MWIFIEX_USB)
 			adapter->data_sent = false;
 		break;
 	case 0:
drivers/net/wireless/mwifiex/sta_tx.c +5 -1
index 355ac59..7a4d5f4 100644
@@ -174,6 +174,7 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
 	local_tx_pd->bss_type = priv->bss_type;
 
 	if (adapter->iface_type == MWIFIEX_USB) {
+		adapter->data_sent = true;
 		ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
 						   skb, NULL);
 	} else {
@@ -191,7 +192,8 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
 		adapter->dbg.num_tx_host_to_card_failure++;
 		break;
 	case -1:
-		adapter->data_sent = false;
+		if (adapter->iface_type == MWIFIEX_USB)
+			adapter->data_sent = false;
 		dev_kfree_skb_any(skb);
 		mwifiex_dbg(adapter, ERROR,
 			    "%s: host_to_card failed: ret=%d\n",
@@ -206,6 +208,8 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
 		adapter->tx_lock_flag = true;
 		break;
 	case -EINPROGRESS:
+		if (adapter->iface_type == MWIFIEX_USB)
+			adapter->data_sent = false;
 		adapter->tx_lock_flag = true;
 		break;
 	default:
drivers/net/wireless/mwifiex/txrx.c +4 -4
index 98f097d..6ef030a 100644
@@ -142,7 +142,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
 		mwifiex_dbg(adapter, ERROR, "data: -EBUSY is returned\n");
 		break;
 	case -1:
-		if (adapter->iface_type != MWIFIEX_PCIE)
+		if (adapter->iface_type == MWIFIEX_USB)
 			adapter->data_sent = false;
 		mwifiex_dbg(adapter, ERROR,
 			    "mwifiex_write_data_async failed: 0x%X\n",
@@ -151,7 +151,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
 		mwifiex_write_data_complete(adapter, skb, 0, ret);
 		break;
 	case -EINPROGRESS:
-		if (adapter->iface_type != MWIFIEX_PCIE)
+		if (adapter->iface_type == MWIFIEX_USB)
 			adapter->data_sent = false;
 		break;
 	case 0:
@@ -222,7 +222,7 @@ static int mwifiex_host_to_card(struct mwifiex_adapter *adapter,
 		mwifiex_dbg(adapter, ERROR, "data: -EBUSY is returned\n");
 		break;
 	case -1:
-		if (adapter->iface_type != MWIFIEX_PCIE)
+		if (adapter->iface_type == MWIFIEX_USB)
 			adapter->data_sent = false;
 		mwifiex_dbg(adapter, ERROR,
 			    "mwifiex_write_data_async failed: 0x%X\n", ret);
@@ -230,7 +230,7 @@ static int mwifiex_host_to_card(struct mwifiex_adapter *adapter,
 		mwifiex_write_data_complete(adapter, skb, 0, ret);
 		break;
 	case -EINPROGRESS:
-		if (adapter->iface_type != MWIFIEX_PCIE)
+		if (adapter->iface_type == MWIFIEX_USB)
 			adapter->data_sent = false;
 		break;
 	case 0:
drivers/net/wireless/mwifiex/wmm.c +2 -2
index 8e30fb3..8a3f59e 100644
@@ -1356,14 +1356,14 @@ mwifiex_send_processed_packet(struct mwifiex_private *priv,
 				       ra_list_flags);
 		break;
 	case -1:
-		if (adapter->iface_type != MWIFIEX_PCIE)
+		if (adapter->iface_type == MWIFIEX_USB)
 			adapter->data_sent = false;
 		mwifiex_dbg(adapter, ERROR, "host_to_card failed: %#x\n", ret);
 		adapter->dbg.num_tx_host_to_card_failure++;
 		mwifiex_write_data_complete(adapter, skb, 0, ret);
 		break;
 	case -EINPROGRESS:
-		if (adapter->iface_type != MWIFIEX_PCIE)
+		if (adapter->iface_type == MWIFIEX_USB)
 			adapter->data_sent = false;
 		break;
 	case 0:
Signature · 1 line
1.8.1.4
#13 lore raw

PATCH 12/16 mwifiex: move usb specific data_sent update to usb.c

In reply to Amitkumar Karwar

From: Zhaoyang Liu <[email protected]>

This patch move data_sent flag update to usb.c file.

Quoted 1 line

From now all data_sent update cases only happened in specific file:

sdio.c, usb.c, pcie.c. Outside ot these files, it is only allowed to check the value of data_ent.

---
 drivers/net/wireless/mwifiex/11n_aggr.c |  5 -----
 drivers/net/wireless/mwifiex/sta_tx.c   |  5 -----
 drivers/net/wireless/mwifiex/txrx.c     | 13 -------------
 drivers/net/wireless/mwifiex/usb.c      |  7 ++++++-
 drivers/net/wireless/mwifiex/wmm.c      |  5 -----
 5 files changed, 6 insertions(+), 29 deletions(-)
drivers/net/wireless/mwifiex/11n_aggr.c +0 -5
index ce22cc8..46221c2 100644
@@ -259,7 +259,6 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
 	}
 
 	if (adapter->iface_type == MWIFIEX_USB) {
-		adapter->data_sent = true;
 		ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
 						   skb_aggr, NULL);
 	} else {
@@ -300,16 +299,12 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
 		mwifiex_dbg(adapter, ERROR, "data: -EBUSY is returned\n");
 		break;
 	case -1:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		mwifiex_dbg(adapter, ERROR, "%s: host_to_card failed: %#x\n",
 			    __func__, ret);
 		adapter->dbg.num_tx_host_to_card_failure++;
 		mwifiex_write_data_complete(adapter, skb_aggr, 1, ret);
 		return 0;
 	case -EINPROGRESS:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		break;
 	case 0:
 		mwifiex_write_data_complete(adapter, skb_aggr, 1, ret);
drivers/net/wireless/mwifiex/sta_tx.c +0 -5
index 7a4d5f4..877ad06 100644
@@ -174,7 +174,6 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
 	local_tx_pd->bss_type = priv->bss_type;
 
 	if (adapter->iface_type == MWIFIEX_USB) {
-		adapter->data_sent = true;
 		ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
 						   skb, NULL);
 	} else {
@@ -192,8 +191,6 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
 		adapter->dbg.num_tx_host_to_card_failure++;
 		break;
 	case -1:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		dev_kfree_skb_any(skb);
 		mwifiex_dbg(adapter, ERROR,
 			    "%s: host_to_card failed: ret=%d\n",
@@ -208,8 +205,6 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
 		adapter->tx_lock_flag = true;
 		break;
 	case -EINPROGRESS:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		adapter->tx_lock_flag = true;
 		break;
 	default:
drivers/net/wireless/mwifiex/txrx.c +0 -13
index 6ef030a..90f4915 100644
@@ -115,7 +115,6 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
 		if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA)
 			local_tx_pd = (struct txpd *)(head_ptr + hroom);
 		if (adapter->iface_type == MWIFIEX_USB) {
-			adapter->data_sent = true;
 			ret = adapter->if_ops.host_to_card(adapter,
 							   MWIFIEX_USB_EP_DATA,
 							   skb, NULL);
@@ -142,8 +141,6 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
 		mwifiex_dbg(adapter, ERROR, "data: -EBUSY is returned\n");
 		break;
 	case -1:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		mwifiex_dbg(adapter, ERROR,
 			    "mwifiex_write_data_async failed: 0x%X\n",
 			    ret);
@@ -151,8 +148,6 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
 		mwifiex_write_data_complete(adapter, skb, 0, ret);
 		break;
 	case -EINPROGRESS:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		break;
 	case 0:
 		mwifiex_write_data_complete(adapter, skb, 0, ret);
@@ -193,7 +188,6 @@ static int mwifiex_host_to_card(struct mwifiex_adapter *adapter,
 	}
 
 	if (adapter->iface_type == MWIFIEX_USB) {
-		adapter->data_sent = true;
 		ret = adapter->if_ops.host_to_card(adapter,
 						   MWIFIEX_USB_EP_DATA,
 						   skb, NULL);
@@ -222,16 +216,12 @@ static int mwifiex_host_to_card(struct mwifiex_adapter *adapter,
 		mwifiex_dbg(adapter, ERROR, "data: -EBUSY is returned\n");
 		break;
 	case -1:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		mwifiex_dbg(adapter, ERROR,
 			    "mwifiex_write_data_async failed: 0x%X\n", ret);
 		adapter->dbg.num_tx_host_to_card_failure++;
 		mwifiex_write_data_complete(adapter, skb, 0, ret);
 		break;
 	case -EINPROGRESS:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		break;
 	case 0:
 		mwifiex_write_data_complete(adapter, skb, 0, ret);
@@ -306,9 +296,6 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
 	if (!priv)
 		goto done;
 
-	if (adapter->iface_type == MWIFIEX_USB)
-		adapter->data_sent = false;
-
 	mwifiex_set_trans_start(priv->netdev);
 	if (!status) {
 		priv->stats.tx_packets++;
drivers/net/wireless/mwifiex/usb.c +6 -1
index bc8619d..3f1713e 100644
@@ -272,6 +272,7 @@ static void mwifiex_usb_tx_complete(struct urb *urb)
 		mwifiex_dbg(adapter, DATA,
 			    "%s: DATA\n", __func__);
 		atomic_dec(&card->tx_data_urb_pending);
+		adapter->data_sent = false;
 		mwifiex_write_data_complete(adapter, context->skb, 0,
 					    urb->status ? -1 : 0);
 	}
@@ -752,6 +753,7 @@ static int mwifiex_usb_host_to_card(struct mwifiex_adapter *adapter, u8 ep,
 
 	if (ep == card->tx_data_ep &&
 	    atomic_read(&card->tx_data_urb_pending) >= MWIFIEX_TX_DATA_URB) {
+		adapter->data_sent = true;
 		return -EBUSY;
 	}
 
@@ -788,6 +790,7 @@ static int mwifiex_usb_host_to_card(struct mwifiex_adapter *adapter, u8 ep,
 			atomic_dec(&card->tx_cmd_urb_pending);
 		} else {
 			atomic_dec(&card->tx_data_urb_pending);
+			adapter->data_sent = false;
 			if (card->tx_data_ix)
 				card->tx_data_ix--;
 			else
@@ -798,8 +801,10 @@ static int mwifiex_usb_host_to_card(struct mwifiex_adapter *adapter, u8 ep,
 	} else {
 		if (ep == card->tx_data_ep &&
 		    atomic_read(&card->tx_data_urb_pending) ==
-							MWIFIEX_TX_DATA_URB)
+							MWIFIEX_TX_DATA_URB) {
+			adapter->data_sent = true;
 			return -ENOSR;
+		}
 	}
 
 	return -EINPROGRESS;
drivers/net/wireless/mwifiex/wmm.c +0 -5
index 8a3f59e..4f303f3 100644
@@ -1326,7 +1326,6 @@ mwifiex_send_processed_packet(struct mwifiex_private *priv,
 	spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags);
 
 	if (adapter->iface_type == MWIFIEX_USB) {
-		adapter->data_sent = true;
 		ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
 						   skb, NULL);
 	} else {
@@ -1356,15 +1355,11 @@ mwifiex_send_processed_packet(struct mwifiex_private *priv,
 				       ra_list_flags);
 		break;
 	case -1:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		mwifiex_dbg(adapter, ERROR, "host_to_card failed: %#x\n", ret);
 		adapter->dbg.num_tx_host_to_card_failure++;
 		mwifiex_write_data_complete(adapter, skb, 0, ret);
 		break;
 	case -EINPROGRESS:
-		if (adapter->iface_type == MWIFIEX_USB)
-			adapter->data_sent = false;
 		break;
 	case 0:
 		mwifiex_write_data_complete(adapter, skb, 0, ret);
Signature · 1 line
1.8.1.4
#14 lore raw

PATCH 13/16 mwifiex: add usb multi channel event process support

In reply to Amitkumar Karwar

From: Zhaoyang Liu <[email protected]>

This patch add multi channel event process for USB multi tx data endpoints. Driver receives firmware multi channel event only in case that new connection is setup or interface is disconnect. Different BSS interface need update used usb endpoint.

---
 drivers/net/wireless/mwifiex/fw.h        | 18 +++++++++
 drivers/net/wireless/mwifiex/init.c      |  1 +
 drivers/net/wireless/mwifiex/main.h      |  2 +
 drivers/net/wireless/mwifiex/sta_event.c | 69 +++++++++++++++++++++++++++-----
 drivers/net/wireless/mwifiex/usb.c       |  2 +
 5 files changed, 82 insertions(+), 10 deletions(-)
drivers/net/wireless/mwifiex/fw.h +18 -0
index eaed2e0..1e1e81a 100644
@@ -107,6 +107,7 @@ enum KEY_TYPE_ID {
 enum mwifiex_usb_ep {
 	MWIFIEX_USB_EP_CMD_EVENT = 1,
 	MWIFIEX_USB_EP_DATA = 2,
+	MWIFIEX_USB_EP_DATA_CH2 = 3,
 };
 
 enum MWIFIEX_802_11_PRIVACY_FILTER {
@@ -177,6 +178,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 #define TLV_TYPE_COALESCE_RULE      (PROPRIETARY_TLV_BASE_ID + 154)
 #define TLV_TYPE_KEY_PARAM_V2       (PROPRIETARY_TLV_BASE_ID + 156)
 #define TLV_TYPE_MULTI_CHAN_INFO    (PROPRIETARY_TLV_BASE_ID + 183)
+#define TLV_TYPE_MC_GROUP_INFO      (PROPRIETARY_TLV_BASE_ID + 184)
 #define TLV_TYPE_TDLS_IDLE_TIMEOUT  (PROPRIETARY_TLV_BASE_ID + 194)
 #define TLV_TYPE_SCAN_CHANNEL_GAP   (PROPRIETARY_TLV_BASE_ID + 197)
 #define TLV_TYPE_API_REV            (PROPRIETARY_TLV_BASE_ID + 199)
@@ -1994,6 +1996,22 @@ struct mwifiex_ie_types_multi_chan_info {
 	u8 tlv_buffer[0];
 } __packed;
 
+struct mwifiex_ie_types_mc_group_info {
+	struct mwifiex_ie_types_header header;
+	u8 chan_group_id;
+	u8 chan_buf_weight;
+	u8 band_config;
+	u8 chan_num;
+	u32 chan_time;
+	u32 reserved;
+	union {
+		u8 sdio_func_num;
+		u8 usb_ep_num;
+	} hid_num;
+	u8 intf_num;
+	u8 bss_type_numlist[0];
+} __packed;
+
 struct meas_rpt_map {
 	u8 rssi:3;
 	u8 unmeasured:1;
drivers/net/wireless/mwifiex/init.c +1 -0
index 5d3ae63..de74a77 100644
@@ -78,6 +78,7 @@ int mwifiex_init_priv(struct mwifiex_private *priv)
 	priv->media_connected = false;
 	eth_broadcast_addr(priv->curr_addr);
 	priv->port_open = false;
+	priv->usb_port = MWIFIEX_USB_EP_DATA;
 	priv->pkt_tx_ctrl = 0;
 	priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
 	priv->data_rate = 0;	/* Initially indicate the rate as auto */
drivers/net/wireless/mwifiex/main.h +2 -0
index 8f5c3da..3e044b4 100644
@@ -520,6 +520,7 @@ struct mwifiex_private {
 	u8 curr_addr[ETH_ALEN];
 	u8 media_connected;
 	u8 port_open;
+	u8 usb_port;
 	u32 num_tx_timeout;
 	/* track consecutive timeout */
 	u8 tx_timeout_cnt;
@@ -990,6 +991,7 @@ struct mwifiex_adapter {
 	u8 coex_rx_win_size;
 	bool drcs_enabled;
 	u8 active_scan_triggered;
+	bool usb_mc_status;
 };
 
 void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
drivers/net/wireless/mwifiex/sta_event.c +59 -10

84 lines not on this page · raw message

drivers/net/wireless/mwifiex/usb.c +2 -0
index 3f1713e..5a70fe9 100644
@@ -845,6 +845,8 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter)
 		break;
 	}
 
+	adapter->usb_mc_status = false;
+
 	return 0;
 }
 
Signature · 1 line
1.8.1.4
#15 lore raw

PATCH 14/16 mwifiex: add usb tx data multi endpoints support

In reply to Amitkumar Karwar

From: Zhaoyang Liu <[email protected]>

This patch add support for USB interface to TX data with different endpoint. And previous TX information are saved in new designed structure.

---
 drivers/net/wireless/mwifiex/main.c |   6 +-
 drivers/net/wireless/mwifiex/usb.c  | 124 ++++++++++++++++++++++++------------
 drivers/net/wireless/mwifiex/usb.h  |  13 ++--
 3 files changed, 97 insertions(+), 46 deletions(-)
drivers/net/wireless/mwifiex/main.c +4 -2
index 278dc94..6c8f35f 100644
@@ -963,8 +963,10 @@ void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter)
 		cardp = (struct usb_card_rec *)adapter->card;
 		p += sprintf(p, "tx_cmd_urb_pending = %d\n",
 			     atomic_read(&cardp->tx_cmd_urb_pending));
-		p += sprintf(p, "tx_data_urb_pending = %d\n",
-			     atomic_read(&cardp->tx_data_urb_pending));
+		p += sprintf(p, "tx_data_urb_pending_port_0 = %d\n",
+			     atomic_read(&cardp->port[0].tx_data_urb_pending));
+		p += sprintf(p, "tx_data_urb_pending_port_1 = %d\n",
+			     atomic_read(&cardp->port[1].tx_data_urb_pending));
 		p += sprintf(p, "rx_cmd_urb_pending = %d\n",
 			     atomic_read(&cardp->rx_cmd_urb_pending));
 		p += sprintf(p, "rx_data_urb_pending = %d\n",
drivers/net/wireless/mwifiex/usb.c +84 -40

215 lines not on this page · raw message

drivers/net/wireless/mwifiex/usb.h +9 -4
index 6029a68..6339d87 100644
@@ -38,6 +38,7 @@
 #define USB8XXX_FW_READY	2
 #define USB8XXX_FW_MAX_RETRY	3
 
+#define MWIFIEX_TX_DATA_PORT	2
 #define MWIFIEX_TX_DATA_URB	6
 #define MWIFIEX_RX_DATA_URB	6
 #define MWIFIEX_USB_TIMEOUT	100
@@ -61,6 +62,13 @@ struct urb_context {
 	u8 ep;
 };
 
+struct usb_tx_data_port {
+	u8 tx_data_ep;
+	atomic_t tx_data_urb_pending;
+	int tx_data_ix;
+	struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB];
+};
+
 struct usb_card_rec {
 	struct mwifiex_adapter *adapter;
 	struct usb_device *udev;
@@ -72,14 +80,11 @@ struct usb_card_rec {
 	u8 usb_boot_state;
 	u8 rx_data_ep;
 	atomic_t rx_data_urb_pending;
-	u8 tx_data_ep;
 	u8 tx_cmd_ep;
-	atomic_t tx_data_urb_pending;
 	atomic_t tx_cmd_urb_pending;
 	int bulk_out_maxpktsize;
 	struct urb_context tx_cmd;
-	int tx_data_ix;
-	struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB];
+	struct usb_tx_data_port port[MWIFIEX_TX_DATA_PORT];
 };
 
 struct fw_header {
Signature · 1 line
1.8.1.4
#16 lore raw

PATCH 15/16 mwifiex: add usb multi endpoints resync support

In reply to Amitkumar Karwar

From: Zhaoyang Liu <[email protected]>

This patch add support for usb multi endpoints resync. Once multi channel event is received from firmware, update usb_mc_setp flag to block TX data until setup is over. And available data endpoint will be attached to BSS interface.

---
 drivers/net/wireless/mwifiex/main.c        | 54 +++++++++++++++++++++++++---
 drivers/net/wireless/mwifiex/main.h        |  3 ++
 drivers/net/wireless/mwifiex/sta_cmdresp.c | 11 ++++++
 drivers/net/wireless/mwifiex/sta_event.c   |  5 +++
 drivers/net/wireless/mwifiex/usb.c         | 56 ++++++++++++++++++++++++++++++
 drivers/net/wireless/mwifiex/usb.h         |  2 ++
 6 files changed, 127 insertions(+), 4 deletions(-)
drivers/net/wireless/mwifiex/main.c +50 -4
index 6c8f35f..da88b4d 100644
@@ -294,9 +294,15 @@ process_start:
 			/* We have tried to wakeup the card already */
 			if (adapter->pm_wakeup_fw_try)
 				break;
-			if (adapter->ps_state != PS_STATE_AWAKE ||
-			    adapter->tx_lock_flag)
+			if (adapter->ps_state != PS_STATE_AWAKE)
 				break;
+			if (adapter->tx_lock_flag) {
+				if (adapter->iface_type == MWIFIEX_USB) {
+					if (!adapter->usb_mc_setup)
+						break;
+				} else
+					break;
+			}
 
 			if ((!adapter->scan_chan_gap_enabled &&
 			     adapter->scan_processing) || adapter->data_sent ||
@@ -345,11 +351,18 @@ process_start:
 		 */
 		if ((adapter->ps_state == PS_STATE_SLEEP) ||
 		    (adapter->ps_state == PS_STATE_PRE_SLEEP) ||
-		    (adapter->ps_state == PS_STATE_SLEEP_CFM) ||
-		    adapter->tx_lock_flag){
+		    (adapter->ps_state == PS_STATE_SLEEP_CFM)) {
 			continue;
 		}
 
+		if (adapter->tx_lock_flag) {
+			if (adapter->iface_type == MWIFIEX_USB) {
+				if (!adapter->usb_mc_setup)
+					continue;
+			} else
+				continue;
+		}
+
 		if (!adapter->cmd_sent && !adapter->curr_cmd &&
 		    mwifiex_is_send_cmd_allowed
 		    (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) {
@@ -359,6 +372,13 @@ process_start:
 			}
 		}
 
+		/** If USB Multi channel setup ongoing,
+		 *  wait for ready to tx data.
+		 */
+		if (adapter->iface_type == MWIFIEX_USB &&
+		    adapter->usb_mc_setup)
+			continue;
+
 		if ((adapter->scan_chan_gap_enabled ||
 		     !adapter->scan_processing) &&
 		    !adapter->data_sent &&
@@ -928,6 +948,32 @@ mwifiex_tx_timeout(struct net_device *dev)
 	}
 }
 
+void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter)
+{
+	struct usb_card_rec *card = adapter->card;
+	struct mwifiex_private *priv;
+	u16 tx_buf_size;
+	int i, ret;
+
+	card->mc_resync_flag = true;
+	for (i = 0; i < MWIFIEX_TX_DATA_PORT; i++) {
+		if (atomic_read(&card->port[i].tx_data_urb_pending)) {
+			mwifiex_dbg(adapter, WARN, "pending data urb in sys\n");
+			return;
+		}
+	}
+
+	card->mc_resync_flag = false;
+	tx_buf_size = 0xffff;
+	priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
+	ret = mwifiex_send_cmd(priv, HostCmd_CMD_RECONFIGURE_TX_BUFF,
+			       HostCmd_ACT_GEN_SET, 0, &tx_buf_size, false);
+	if (ret)
+		mwifiex_dbg(adapter, ERROR,
+			    "send reconfig tx buf size cmd err\n");
+}
+EXPORT_SYMBOL_GPL(mwifiex_multi_chan_resync);
+
 void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter)
 {
 	void *p;
drivers/net/wireless/mwifiex/main.h +3 -0
index 3e044b4..47ab094 100644
@@ -817,6 +817,7 @@ struct mwifiex_if_ops {
 	void (*iface_work)(struct work_struct *work);
 	void (*submit_rem_rx_urbs)(struct mwifiex_adapter *adapter);
 	void (*deaggr_pkt)(struct mwifiex_adapter *, struct sk_buff *);
+	void (*multi_port_resync)(struct mwifiex_adapter *);
 };
 
 struct mwifiex_adapter {
@@ -992,6 +993,7 @@ struct mwifiex_adapter {
 	bool drcs_enabled;
 	u8 active_scan_triggered;
 	bool usb_mc_status;
+	bool usb_mc_setup;
 };
 
 void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
@@ -1567,6 +1569,7 @@ void mwifiex_process_tx_pause_event(struct mwifiex_private *priv,
 				    struct sk_buff *event);
 void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
 				      struct sk_buff *event_skb);
+void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter);
 
 #ifdef CONFIG_DEBUG_FS
 void mwifiex_debugfs_init(void);
drivers/net/wireless/mwifiex/sta_cmdresp.c +11 -0
index a218c75..9ac7aa2 100644
@@ -1150,6 +1150,17 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
 		ret = mwifiex_ret_11n_addba_resp(priv, resp);
 		break;
 	case HostCmd_CMD_RECONFIGURE_TX_BUFF:
+		if (0xffff == (u16)le16_to_cpu(resp->params.tx_buf.buff_size)) {
+			if (adapter->iface_type == MWIFIEX_USB &&
+			    adapter->usb_mc_setup) {
+				if (adapter->if_ops.multi_port_resync)
+					adapter->if_ops.
+						multi_port_resync(adapter);
+				adapter->usb_mc_setup = false;
+				adapter->tx_lock_flag = false;
+			}
+			break;
+		}
 		adapter->tx_buf_size = (u16) le16_to_cpu(resp->params.
 							     tx_buf.buff_size);
 		adapter->tx_buf_size = (adapter->tx_buf_size
drivers/net/wireless/mwifiex/sta_event.c +5 -0
index 6792089..c333b24 100644
@@ -381,6 +381,11 @@ void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
 			       sizeof(struct mwifiex_ie_types_header));
 	}
 
+	if (adapter->iface_type == MWIFIEX_USB) {
+		adapter->tx_lock_flag = true;
+		adapter->usb_mc_setup = true;
+		mwifiex_multi_chan_resync(adapter);
+	}
 }
 
 void mwifiex_process_tx_pause_event(struct mwifiex_private *priv,
drivers/net/wireless/mwifiex/usb.c +56 -0

86 lines not on this page · raw message

drivers/net/wireless/mwifiex/usb.h +2 -0
index 6339d87..b4e9246 100644
@@ -64,6 +64,7 @@ struct urb_context {
 
 struct usb_tx_data_port {
 	u8 tx_data_ep;
+	u8 block_status;
 	atomic_t tx_data_urb_pending;
 	int tx_data_ix;
 	struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB];
@@ -84,6 +85,7 @@ struct usb_card_rec {
 	atomic_t tx_cmd_urb_pending;
 	int bulk_out_maxpktsize;
 	struct urb_context tx_cmd;
+	u8 mc_resync_flag;
 	struct usb_tx_data_port port[MWIFIEX_TX_DATA_PORT];
 };
 
Signature · 1 line
1.8.1.4
#17 lore raw

PATCH 16/16 mwifiex: complete usb tx data with multi endpoints

In reply to Amitkumar Karwar

From: Zhaoyang Liu <[email protected]>

This patch do the work to TX data with specific USB endpoint. At the same time, update data_sent flag according to multi port status. And is_port_ready API is added for BSS interface to check if current used usb data endpoint is available or not.

---
 drivers/net/wireless/mwifiex/11n_aggr.c  |  2 +-
 drivers/net/wireless/mwifiex/main.h      |  1 +
 drivers/net/wireless/mwifiex/sta_event.c |  4 ++-
 drivers/net/wireless/mwifiex/sta_tx.c    |  6 +++-
 drivers/net/wireless/mwifiex/txrx.c      |  4 +--
 drivers/net/wireless/mwifiex/uap_event.c |  4 ++-
 drivers/net/wireless/mwifiex/usb.c       | 47 ++++++++++++++++++++++++++++----
 drivers/net/wireless/mwifiex/wmm.c       | 38 +++++++++++++++++++++++---
 8 files changed, 90 insertions(+), 16 deletions(-)
drivers/net/wireless/mwifiex/11n_aggr.c +1 -1
index 46221c2..2c5ffa1 100644
@@ -259,7 +259,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
 	}
 
 	if (adapter->iface_type == MWIFIEX_USB) {
-		ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
+		ret = adapter->if_ops.host_to_card(adapter, priv->usb_port,
 						   skb_aggr, NULL);
 	} else {
 		if (skb_src)
drivers/net/wireless/mwifiex/main.h +1 -0
index 47ab094..05e1e63 100644
@@ -818,6 +818,7 @@ struct mwifiex_if_ops {
 	void (*submit_rem_rx_urbs)(struct mwifiex_adapter *adapter);
 	void (*deaggr_pkt)(struct mwifiex_adapter *, struct sk_buff *);
 	void (*multi_port_resync)(struct mwifiex_adapter *);
+	bool (*is_port_ready)(struct mwifiex_private *);
 };
 
 struct mwifiex_adapter {
drivers/net/wireless/mwifiex/sta_event.c +3 -1
index c333b24..ff3ee9d 100644
@@ -616,7 +616,9 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
 		adapter->tx_lock_flag = false;
 		if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) {
 			if (mwifiex_check_last_packet_indication(priv)) {
-				if (adapter->data_sent) {
+				if (adapter->data_sent ||
+				    (adapter->if_ops.is_port_ready &&
+				     !adapter->if_ops.is_port_ready(priv))) {
 					adapter->ps_state = PS_STATE_AWAKE;
 					adapter->pm_wakeup_card_req = false;
 					adapter->pm_wakeup_fw_try = false;
drivers/net/wireless/mwifiex/sta_tx.c +5 -1
index 877ad06..f6683ea 100644
@@ -153,6 +153,10 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
 	if (adapter->data_sent)
 		return -1;
 
+	if (adapter->if_ops.is_port_ready &&
+	    !adapter->if_ops.is_port_ready(priv))
+		return -1;
+
 	skb = dev_alloc_skb(data_len);
 	if (!skb)
 		return -1;
@@ -174,7 +178,7 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
 	local_tx_pd->bss_type = priv->bss_type;
 
 	if (adapter->iface_type == MWIFIEX_USB) {
-		ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
+		ret = adapter->if_ops.host_to_card(adapter, priv->usb_port,
 						   skb, NULL);
 	} else {
 		skb_push(skb, INTF_HEADER_LEN);
drivers/net/wireless/mwifiex/txrx.c +2 -2
index 90f4915..bf6182b 100644
@@ -116,7 +116,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
 			local_tx_pd = (struct txpd *)(head_ptr + hroom);
 		if (adapter->iface_type == MWIFIEX_USB) {
 			ret = adapter->if_ops.host_to_card(adapter,
-							   MWIFIEX_USB_EP_DATA,
+							   priv->usb_port,
 							   skb, NULL);
 		} else {
 			ret = adapter->if_ops.host_to_card(adapter,
@@ -189,7 +189,7 @@ static int mwifiex_host_to_card(struct mwifiex_adapter *adapter,
 
 	if (adapter->iface_type == MWIFIEX_USB) {
 		ret = adapter->if_ops.host_to_card(adapter,
-						   MWIFIEX_USB_EP_DATA,
+						   priv->usb_port,
 						   skb, NULL);
 	} else {
 		ret = adapter->if_ops.host_to_card(adapter,
drivers/net/wireless/mwifiex/uap_event.c +3 -1
index 46c972a..078834c 100644
@@ -269,7 +269,9 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
 		adapter->tx_lock_flag = false;
 		if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) {
 			if (mwifiex_check_last_packet_indication(priv)) {
-				if (adapter->data_sent) {
+				if (adapter->data_sent ||
+				    (adapter->if_ops.is_port_ready &&
+				     !adapter->if_ops.is_port_ready(priv))) {
 					adapter->ps_state = PS_STATE_AWAKE;
 					adapter->pm_wakeup_card_req = false;
 					adapter->pm_wakeup_fw_try = false;
drivers/net/wireless/mwifiex/usb.c +41 -6

93 lines not on this page · raw message

drivers/net/wireless/mwifiex/wmm.c +34 -4
index 4f303f3..7bbdfe4 100644
@@ -452,7 +452,21 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter)
 
 int mwifiex_bypass_txlist_empty(struct mwifiex_adapter *adapter)
 {
-	return atomic_read(&adapter->bypass_tx_pending) ? false : true;
+	struct mwifiex_private *priv;
+	int i;
+
+	for (i = 0; i < adapter->priv_num; i++) {
+		priv = adapter->priv[i];
+		if (!priv)
+			continue;
+		if (adapter->if_ops.is_port_ready &&
+		    !adapter->if_ops.is_port_ready(priv))
+			continue;
+		if (!skb_queue_empty(&priv->bypass_txq))
+			return false;
+	}
+
+	return true;
 }
 
 /*
@@ -466,9 +480,14 @@ mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter)
 
 	for (i = 0; i < adapter->priv_num; ++i) {
 		priv = adapter->priv[i];
-		if (priv && !priv->port_open)
+		if (!priv)
+			continue;
+		if (!priv->port_open)
+			continue;
+		if (adapter->if_ops.is_port_ready &&
+		    !adapter->if_ops.is_port_ready(priv))
 			continue;
-		if (priv && atomic_read(&priv->wmm.tx_pkts_queued))
+		if (atomic_read(&priv->wmm.tx_pkts_queued))
 			return false;
 	}
 
@@ -1091,6 +1110,10 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
 			    (atomic_read(&priv_tmp->wmm.tx_pkts_queued) == 0))
 				continue;
 
+			if (adapter->if_ops.is_port_ready &&
+			    !adapter->if_ops.is_port_ready(priv_tmp))
+				continue;
+
 			/* iterate over the WMM queues of the BSS */
 			hqp = &priv_tmp->wmm.highest_queued_prio;
 			for (i = atomic_read(hqp); i >= LOW_PRIO_TID; --i) {
@@ -1326,7 +1349,7 @@ mwifiex_send_processed_packet(struct mwifiex_private *priv,
 	spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags);
 
 	if (adapter->iface_type == MWIFIEX_USB) {
-		ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA,
+		ret = adapter->if_ops.host_to_card(adapter, priv->usb_port,
 						   skb, NULL);
 	} else {
 		tx_param.next_pkt_len =
@@ -1467,6 +1490,13 @@ void mwifiex_process_bypass_tx(struct mwifiex_adapter *adapter)
 	for (i = 0; i < adapter->priv_num; ++i) {
 		priv = adapter->priv[i];
 
+		if (!priv)
+			continue;
+
+		if (adapter->if_ops.is_port_ready &&
+		    !adapter->if_ops.is_port_ready(priv))
+			continue;
+
 		if (skb_queue_empty(&priv->bypass_txq))
 			continue;
 
Signature · 1 line
1.8.1.4