Skip to contentSkip to conversation

qtnfmac: misc small features and fixes

PATCH In review Sergey Matyukevich 2 participants 7 messages Oct 30, 2017 Quantenna qtnfmac wireless driver

lore
Share & tools
lore
#0 lore raw

v2 cover qtnfmac: misc small features and fixes

Hello Kalle, Igor, and all

This patch series includes a number of small features and fixes for qtnfmac driver.

Changes v1->v2:
Rebase on top of latest wireless-drivers-next to resolve the conflict caused by qtnfmac fixes merged from wireless-drivers.

Igor Mitsyanko (1):
qtnfmac: advertise support of inactivity timeout

Sergey Matyukevich (4):
qtnfmac: modify full Tx queue error reporting
qtnfmac: enable registration of more mgmt frames
qtnfmac: drop nonexistent function declaration
qtnfmac: modify full Tx queue recovery

 cfg80211.c            |   17 +++++++++++++++--
 commands.c            |    5 +++--
 core.c                |   27 +++++++++++++++++++++++++++
 core.h                |    4 +---
 pearl/pcie.c          |   15 +++++++++------
 pearl/pcie_bus_priv.h |    1 +
 qlink.h               |   11 ++++++++++-
 7 files changed, 66 insertions(+), 14 deletions(-)
#1 lore raw

PATCH v2 1/5 qtnfmac: modify full Tx queue error reporting

Under heavy load it is normal that h/w Tx queue is almost full all the time and reclaim should be done before transmitting next packet. Warning still should be reported as well as s/w Tx queues should be stopped in the case when reclaim failed.

---
 drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +1 -1
index 69131965a298..146e42a132e7 100644
@@ -643,11 +643,11 @@ static int qtnf_tx_queue_ready(struct qtnf_pcie_bus_priv *priv)
 {
 	if (!CIRC_SPACE(priv->tx_bd_w_index, priv->tx_bd_r_index,
 			priv->tx_bd_num)) {
-		pr_err_ratelimited("reclaim full Tx queue\n");
 		qtnf_pcie_data_tx_reclaim(priv);
 
 		if (!CIRC_SPACE(priv->tx_bd_w_index, priv->tx_bd_r_index,
 				priv->tx_bd_num)) {
+			pr_warn_ratelimited("reclaim full Tx queue\n");
 			priv->tx_full_count++;
 			return 0;
 		}
Signature · 1 line
2.11.0
#2 lore raw

Re: [v2,1/5] qtnfmac: modify full Tx queue error reporting

Quoted 6 lines · Sergey Matyukevich

Under heavy load it is normal that h/w Tx queue is almost full all the time and reclaim should be done before transmitting next packet. Warning still should be reported as well as s/w Tx queues should be stopped in the case when reclaim failed.

5 patches applied to wireless-drivers-next.git, thanks.

e9931f984dd1 qtnfmac: modify full Tx queue error reporting 3dd06cecb1b8 qtnfmac: enable registration of more mgmt frames bf024645ac9d qtnfmac: drop nonexistent function declaration c35c0d54a77d qtnfmac: modify full Tx queue recovery db5c6d4a9b92 qtnfmac: advertise support of inactivity timeout

Signature · 3 lines
https://patchwork.kernel.org/patch/10032277/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw

PATCH v2 2/5 qtnfmac: enable registration of more mgmt frames

In reply to Sergey Matyukevich

Support registration for more mgmt frame types
for debug and monitoring purposes.

---
 drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +11 -1
index 63a540d1216e..64db4082c9d2 100644
@@ -73,7 +73,10 @@ qtnf_mgmt_stypes[NUM_NL80211_IFTYPES] = {
 	[NL80211_IFTYPE_AP] = {
 		.tx = BIT(IEEE80211_STYPE_ACTION >> 4),
 		.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
-		      BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
+		      BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+		      BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+		      BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+		      BIT(IEEE80211_STYPE_AUTH >> 4),
 	},
 };
 
@@ -353,6 +356,13 @@ qtnf_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 		return;
 
 	switch (frame_type & IEEE80211_FCTL_STYPE) {
+	case IEEE80211_STYPE_REASSOC_REQ:
+	case IEEE80211_STYPE_ASSOC_REQ:
+		qlink_frame_type = QLINK_MGMT_FRAME_ASSOC_REQ;
+		break;
+	case IEEE80211_STYPE_AUTH:
+		qlink_frame_type = QLINK_MGMT_FRAME_AUTH;
+		break;
 	case IEEE80211_STYPE_PROBE_REQ:
 		qlink_frame_type = QLINK_MGMT_FRAME_PROBE_REQ;
 		break;
Signature · 1 line
2.11.0
#4 lore raw

PATCH v2 3/5 qtnfmac: drop nonexistent function declaration

In reply to Sergey Matyukevich

Function qtnf_classify_skb_no_mbss has been used for debug during early stage of development. Drop its declaration.

---
 drivers/net/wireless/quantenna/qtnfmac/core.h | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/core.h +0 -3
index 44a2cbb19310..49ae700f66f0 100644
@@ -153,9 +153,6 @@ int qtnf_cmd_send_get_phy_params(struct qtnf_wmac *mac);
 
 struct qtnf_wmac *qtnf_core_get_mac(const struct qtnf_bus *bus, u8 macid);
 struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb);
-struct net_device *qtnf_classify_skb_no_mbss(struct qtnf_bus *bus,
-					     struct sk_buff *skb);
-
 void qtnf_virtual_intf_cleanup(struct net_device *ndev);
 
 void qtnf_netdev_updown(struct net_device *ndev, bool up);
Signature · 1 line
2.11.0
#5 lore raw

PATCH v2 4/5 qtnfmac: modify full Tx queue recovery

In reply to Sergey Matyukevich

Current recovery approach is to wake s/w Tx queues for skb->dev netdevice. However this approach doesn't cover the case when h/w queue is full of packets from a single wireless interface. Suppose xmit attempt from the second wireless interface fails due to failed reclaim. Then the second interface will not have a chance to recover even if subsequent reclaims succeed. Possible solution is to attempt to wake all the s/w queues belonging to driver interfaces.

---
 drivers/net/wireless/quantenna/qtnfmac/core.c      | 27 ++++++++++++++++++++++
 drivers/net/wireless/quantenna/qtnfmac/core.h      |  1 +
 .../net/wireless/quantenna/qtnfmac/pearl/pcie.c    | 13 +++++++----
 .../quantenna/qtnfmac/pearl/pcie_bus_priv.h        |  1 +
 4 files changed, 37 insertions(+), 5 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/core.c +27 -0
index aa7f146278a7..6a6e5ffb0348 100644
@@ -618,6 +618,33 @@ struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb)
 }
 EXPORT_SYMBOL_GPL(qtnf_classify_skb);
 
+void qtnf_wake_all_queues(struct net_device *ndev)
+{
+	struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev);
+	struct qtnf_wmac *mac;
+	struct qtnf_bus *bus;
+	int macid;
+	int i;
+
+	if (unlikely(!vif || !vif->mac || !vif->mac->bus))
+		return;
+
+	bus = vif->mac->bus;
+
+	for (macid = 0; macid < QTNF_MAX_MAC; macid++) {
+		if (!(bus->hw_info.mac_bitmap & BIT(macid)))
+			continue;
+
+		mac = bus->mac[macid];
+		for (i = 0; i < QTNF_MAX_INTF; i++) {
+			vif = &mac->iflist[i];
+			if (vif->netdev && netif_queue_stopped(vif->netdev))
+				netif_tx_wake_all_queues(vif->netdev);
+		}
+	}
+}
+EXPORT_SYMBOL_GPL(qtnf_wake_all_queues);
+
 MODULE_AUTHOR("Quantenna Communications");
 MODULE_DESCRIPTION("Quantenna 802.11 wireless LAN FullMAC driver.");
 MODULE_LICENSE("GPL");
drivers/net/wireless/quantenna/qtnfmac/core.h +1 -0
index 49ae700f66f0..da2c24e2271d 100644
@@ -153,6 +153,7 @@ int qtnf_cmd_send_get_phy_params(struct qtnf_wmac *mac);
 
 struct qtnf_wmac *qtnf_core_get_mac(const struct qtnf_bus *bus, u8 macid);
 struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb);
+void qtnf_wake_all_queues(struct net_device *ndev);
 void qtnf_virtual_intf_cleanup(struct net_device *ndev);
 
 void qtnf_netdev_updown(struct net_device *ndev, bool up);
drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +8 -5
index 146e42a132e7..7e487622d87d 100644
@@ -617,9 +617,10 @@ static void qtnf_pcie_data_tx_reclaim(struct qtnf_pcie_bus_priv *priv)
 			if (skb->dev) {
 				skb->dev->stats.tx_packets++;
 				skb->dev->stats.tx_bytes += skb->len;
-
-				if (netif_queue_stopped(skb->dev))
-					netif_wake_queue(skb->dev);
+				if (unlikely(priv->tx_stopped)) {
+					qtnf_wake_all_queues(skb->dev);
+					priv->tx_stopped = 0;
+				}
 			}
 
 			dev_kfree_skb_any(skb);
@@ -669,8 +670,10 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb)
 	spin_lock_irqsave(&priv->tx0_lock, flags);
 
 	if (!qtnf_tx_queue_ready(priv)) {
-		if (skb->dev)
-			netif_stop_queue(skb->dev);
+		if (skb->dev) {
+			netif_tx_stop_all_queues(skb->dev);
+			priv->tx_stopped = 1;
+		}
 
 		spin_unlock_irqrestore(&priv->tx0_lock, flags);
 		return NETDEV_TX_BUSY;
drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h +1 -0
index 86ac1ccedb52..397875a50fc2 100644
@@ -37,6 +37,7 @@ struct qtnf_pcie_bus_priv {
 	/* lock for tx0 operations */
 	spinlock_t tx0_lock;
 	u8 msi_enabled;
+	u8 tx_stopped;
 	int mps;
 
 	struct workqueue_struct *workqueue;
Signature · 1 line
2.11.0
#6 lore raw

PATCH v2 5/5 qtnfmac: advertise support of inactivity timeout

In reply to Sergey Matyukevich

From: Igor Mitsyanko <[email protected]>

Wireless device may implement a logic to kick-out STA due to inactivity for a certain period of time. This feature needs to be advertised to higher layers if supported. Timeout value is still taken from parameters to START_AP command, nothing changes here.

---
 drivers/net/wireless/quantenna/qtnfmac/cfg80211.c |  5 ++++-
 drivers/net/wireless/quantenna/qtnfmac/commands.c |  5 +++--
 drivers/net/wireless/quantenna/qtnfmac/qlink.h    | 11 ++++++++++-
 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +4 -1
index 64db4082c9d2..e70f5bd5e498 100644
@@ -956,7 +956,10 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac)
 
 	ether_addr_copy(wiphy->perm_addr, mac->macaddr);
 
-	if (hw_info->hw_capab & QLINK_HW_SUPPORTS_REG_UPDATE) {
+	if (hw_info->hw_capab & QLINK_HW_CAPAB_STA_INACT_TIMEOUT)
+		wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER;
+
+	if (hw_info->hw_capab & QLINK_HW_CAPAB_REG_UPDATE) {
 		wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
 			REGULATORY_CUSTOM_REG;
 		wiphy->reg_notifier = qtnf_cfg80211_reg_notifier;
drivers/net/wireless/quantenna/qtnfmac/commands.c +3 -2
index babdc600c193..b81f81bd1411 100644
@@ -975,10 +975,11 @@ qtnf_cmd_resp_proc_hw_info(struct qtnf_bus *bus,
 		return -EINVAL;
 	}
 
-	pr_info("fw_version=%d, MACs map %#x, alpha2=\"%c%c\", chains Tx=%u Rx=%u\n",
+	pr_info("fw_version=%d, MACs map %#x, alpha2=\"%c%c\", chains Tx=%u Rx=%u, capab=0x%x\n",
 		hwinfo->fw_ver, hwinfo->mac_bitmap,
 		hwinfo->rd->alpha2[0], hwinfo->rd->alpha2[1],
-		hwinfo->total_tx_chain, hwinfo->total_rx_chain);
+		hwinfo->total_tx_chain, hwinfo->total_rx_chain,
+		hwinfo->hw_capab);
 
 	return 0;
 }
drivers/net/wireless/quantenna/qtnfmac/qlink.h +10 -1
index 7b313d38c30b..0f582782682f 100644
@@ -61,8 +61,17 @@ struct qlink_msg_header {
 /* Generic definitions of data and information carried in QLINK messages
  */
 
+/**
+ * enum qlink_hw_capab - device capabilities.
+ *
+ * @QLINK_HW_CAPAB_REG_UPDATE: device can update it's regulatory region.
+ * @QLINK_HW_CAPAB_STA_INACT_TIMEOUT: device implements a logic to kick-out
+ *	associated STAs due to inactivity. Inactivity timeout period is taken
+ *	from QLINK_CMD_START_AP parameters.
+ */
 enum qlink_hw_capab {
-	QLINK_HW_SUPPORTS_REG_UPDATE	= BIT(0),
+	QLINK_HW_CAPAB_REG_UPDATE = BIT(0),
+	QLINK_HW_CAPAB_STA_INACT_TIMEOUT = BIT(1),
 };
 
 enum qlink_phy_mode {
Signature · 1 line
2.11.0