Skip to contentSkip to conversation

qtnfmac: enable access to the card in calibration mode

RFC PATCH In review Sergey Matyukevich 2 participants 3 messages Apr 16, 2020 – Apr 24, 2020 Quantenna qtnfmac wireless driver

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 qtnfmac: enable access to the card in calibration mode

Enable access to the wireless card in calibration mode using service ethernet port. Wireless functionality is not available in calibration mode. Service ethernet port can be used for various maintenance tasks including calibration, configuration, troubleshooting. Add new kernel module parameter force_svcmode. Set this parameter to one in order to boot wireless card into the calibration mode.

---

Hello Kalle and all,

I would like to add support for a simple service mode for calibration. This patch includes some controversial bits, that is why it is marked as RFC. Could you please take a closer look and tell me whether it is acceptable for mainlining.

Regards,
Sergey

---
 drivers/net/wireless/quantenna/qtnfmac/bus.h       |  1 +
 drivers/net/wireless/quantenna/qtnfmac/commands.c  |  1 +
 drivers/net/wireless/quantenna/qtnfmac/core.c      | 83 ++++++++++++++++++++++
 drivers/net/wireless/quantenna/qtnfmac/core.h      |  1 +
 drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |  5 ++
 .../wireless/quantenna/qtnfmac/pcie/pcie_priv.h    |  3 +-
 .../wireless/quantenna/qtnfmac/pcie/topaz_pcie.c   |  3 +
 drivers/net/wireless/quantenna/qtnfmac/qlink.h     |  2 +
 8 files changed, 98 insertions(+), 1 deletion(-)
drivers/net/wireless/quantenna/qtnfmac/bus.h +1 -0
index 87d048df09d1..7811833a84c9 100644
@@ -67,6 +67,7 @@ struct qtnf_bus {
 	struct mutex bus_lock; /* lock during command/event processing */
 	struct dentry *dbg_dir;
 	struct notifier_block netdev_nb;
+	struct net_device *svc_ndev;
 	u8 hw_id[ETH_ALEN];
 	/* bus private data */
 	char bus_priv[0] __aligned(sizeof(void *));
drivers/net/wireless/quantenna/qtnfmac/commands.c +1 -0
index f40d8c3c3d9e..984300ac2f30 100644
@@ -980,6 +980,7 @@ qtnf_cmd_resp_proc_hw_info(struct qtnf_bus *bus,
 
 	strlcpy(hwinfo->fw_version, bld_label, sizeof(hwinfo->fw_version));
 	hwinfo->hw_version = hw_ver;
+	hwinfo->svc_mode = qtnf_hwcap_is_set(hwinfo, QLINK_HW_CAPAB_SVC_MODE);
 
 	return 0;
 }
drivers/net/wireless/quantenna/qtnfmac/core.c +83 -0

119 lines not on this page · raw message

drivers/net/wireless/quantenna/qtnfmac/core.h +1 -0
index 269ce12cf8bf..9745b27379ba 100644
@@ -116,6 +116,7 @@ struct qtnf_hw_info {
 	u8 num_mac;
 	u8 mac_bitmap;
 	u32 fw_ver;
+	u8 svc_mode;
 	u8 total_tx_chain;
 	u8 total_rx_chain;
 	char fw_version[ETHTOOL_FWVERS_LEN];
drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c +5 -0
index 5337e67092ca..8e025a27a4df 100644
@@ -41,6 +41,10 @@ static u8 flashboot = 1;
 module_param(flashboot, byte, 0644);
 MODULE_PARM_DESC(flashboot, "set to 0 to use FW binary file on FS");
 
+static u8 force_svcmode;
+module_param(force_svcmode, byte, 0644);
+MODULE_PARM_DESC(force_svcmode, "set to 1 to force boot into service mode");
+
 static unsigned int fw_blksize_param = QTN_PCIE_MAX_FW_BUFSZ;
 module_param(fw_blksize_param, uint, 0644);
 MODULE_PARM_DESC(fw_blksize_param, "firmware loading block size in bytes");
@@ -342,6 +346,7 @@ static int qtnf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	pcie_priv->pdev = pdev;
 	pcie_priv->tx_stopped = 0;
 	pcie_priv->flashboot = flashboot;
+	pcie_priv->force_svcmode = force_svcmode;
 
 	if (fw_blksize_param > QTN_PCIE_MAX_FW_BUFSZ)
 		pcie_priv->fw_blksize =  QTN_PCIE_MAX_FW_BUFSZ;
drivers/net/wireless/quantenna/qtnfmac/pcie/pcie_priv.h +2 -1
index 2a6a928e13bd..93cb651a3236 100644
@@ -66,7 +66,8 @@ struct qtnf_pcie_bus_priv {
 
 	u8 msi_enabled;
 	u8 tx_stopped;
-	bool flashboot;
+	u8 flashboot;
+	u8 force_svcmode;
 };
 
 int qtnf_pcie_control_tx(struct qtnf_bus *bus, struct sk_buff *skb);
drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c +3 -0
index d1b850aa4657..f3f517733f99 100644
@@ -866,6 +866,9 @@ static int qtnf_pre_init_ep(struct qtnf_bus *bus)
 	/* notify card about driver type and boot mode */
 	flags = readl(&bda->bda_flags) | QTN_BDA_HOST_QLINK_DRV;
 
+	if (ts->base.force_svcmode)
+		flags |= QTN_BDA_HOST_CALCMD;
+
 	if (ts->base.flashboot)
 		flags |= QTN_BDA_FLASH_BOOT;
 	else
drivers/net/wireless/quantenna/qtnfmac/qlink.h +2 -0
index 4d22a54c034f..3abbe0b6e32b 100644
@@ -73,6 +73,7 @@ struct qlink_msg_header {
  *	Randomization in probe requests.
  * @QLINK_HW_CAPAB_OBSS_SCAN: device can perform OBSS scanning.
  * @QLINK_HW_CAPAB_HW_BRIDGE: device has hardware switch capabilities.
+ * @QLINK_HW_CAPAB_SVC_MODE: device is in service mode (used for calibration).
  */
 enum qlink_hw_capab {
 	QLINK_HW_CAPAB_REG_UPDATE = 0,
@@ -84,6 +85,7 @@ enum qlink_hw_capab {
 	QLINK_HW_CAPAB_SCAN_DWELL,
 	QLINK_HW_CAPAB_SAE,
 	QLINK_HW_CAPAB_HW_BRIDGE,
+	QLINK_HW_CAPAB_SVC_MODE,
 	QLINK_HW_CAPAB_NUM
 };
 
Signature · 1 line
2.11.0
#1 lore raw
Quoted 9 lines · Sergey Matyukevich

Enable access to the wireless card in calibration mode using service ethernet port. Wireless functionality is not available in calibration mode. Service ethernet port can be used for various maintenance tasks including calibration, configuration, troubleshooting. Add new kernel module parameter force_svcmode. Set this parameter to one in order to boot wireless card into the calibration mode.

Quoted 8 lines

---

Hello Kalle and all,

I would like to add support for a simple service mode for calibration. This patch includes some controversial bits, that is why it is marked as RFC. Could you please take a closer look and tell me whether it is acceptable for mainlining.

Is there a reason why you can't use nl80211 testmode? The use cases you list were exactly the reasons why we added testmode to nl80211 in the first place.

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw
Quoted 13 lines
Quoted 13 lines

Enable access to the wireless card in calibration mode using service ethernet port. Wireless functionality is not available in calibration mode. Service ethernet port can be used for various maintenance tasks including calibration, configuration, troubleshooting. Add new kernel module parameter force_svcmode. Set this parameter to one in order to boot wireless card into the calibration mode.

---

Hello Kalle and all,

Quoted 8 lines
Quoted 4 lines

I would like to add support for a simple service mode for calibration. This patch includes some controversial bits, that is why it is marked as RFC. Could you please take a closer look and tell me whether it is acceptable for mainlining.

Is there a reason why you can't use nl80211 testmode? The use cases you list were exactly the reasons why we added testmode to nl80211 in the first place.

Hello Kalle,

Thanks for reminding me of testmode. I took a closer look at this feature. This is what I would be using if I had to implement calibration mode and tools from the scratch. In my case I have to deal with legacy behavior in calibration mode: special firmware mode and tools that expect simple network access to firmware. One possible option would be to provide a dummy wireless interface. However additional manipulations with carrier would be required to bring-up dummy wireless interface. So I ended up with a simple ethernet based solution.

Regards,
Sergey