qtnfmac: fixes and cleanups for STA mode
v2 cover qtnfmac: fixes and cleanups for STA mode
Hello Kalle and all,
Here is the next patch set with fixes and cleanups for qtnfmac driver. This set mostly consists of multiple fixes and improvements for STA mode. The major changes include the following items:
- fixes for 'iw' output: rates for enabled SGI, 'dump station'
- expose more scan features to host: scan flush and dwell time
- inform host wireless core when OBSS is not supported by firmware
- command processing cleanup: unify and get rid of 'unlikely' macros
Regards,
Sergey
Changes v1->v2:
- fix email addresses: drop "OS" string
Igor Mitsyanko (4)
qtnfmac: do not cancel scan in disconnect callback
qtnfmac: do not initialize per-MAC data multiple times
qtnfmac: request userspace to do OBSS scanning if FW can not
qtnfmac: generate local disconnect event in disconnect callback
Sergey Matyukevich (9)
qtnfmac: implement dump_station support for STA mode
qtnfmac: drop redundant data copy in control path
qtnfmac: add support for scan dwell time configuration
qtnfmac: add support for scan flush
qtnfmac: drop error reports for out-of-bounds key indexes
qtnfmac: inform wireless core about supported extended capabilities
qtnfmac: pass sgi rate info flag to wireless core
qtnfmac: cleanup and unify command error handling
qtnfmac: do not track STA states in driver
cfg80211.c | 193 ++++++++++----------- commands.c | 535 +++++++++++++---------------------------------------------- core.c | 39 ++-- core.h | 8 event.c | 18 - pcie/pcie.c | 5 qlink.h | 5 qlink_util.h | 8 shm_ipc.c | 13 - shm_ipc.h | 4 10 files changed, 277 insertions(+), 551 deletions(-)
PATCH v2 1/13 qtnfmac: do not track STA states in driver
Remove STA connection states tracking from driver. Leave it wireless core on host and to firmware.
--- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 59 +++-------------------- drivers/net/wireless/quantenna/qtnfmac/core.h | 7 --- drivers/net/wireless/quantenna/qtnfmac/event.c | 18 +------ 3 files changed, 8 insertions(+), 76 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +7 -52
@@ -216,7 +216,6 @@ static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy,eth_zero_addr (vif->mac_addr);eth_zero_addr (vif->bssid); vif->bss_priority =QTNF_DEF_BSS_PRIORITY ; - vif->sta_state =QTNF_STA_DISCONNECTED ;memset (&vif->wdev,0 ,sizeof (vif->wdev)); vif->wdev.wiphy = wiphy; vif->wdev.iftype = type;
@@ -624,9 +623,6 @@ qtnf_connect(struct wiphy *wiphy, struct net_device *dev,if (vif->wdev.iftype !=NL80211_IFTYPE_STATION )return -EOPNOTSUPP ; -if (vif->sta_state !=QTNF_STA_DISCONNECTED ) -return -EBUSY ; -if (sme->bssid)ether_addr_copy (vif->bssid, sme->bssid);else
@@ -639,7 +635,6 @@ qtnf_connect(struct wiphy *wiphy, struct net_device *dev,return ret; } - vif->sta_state =QTNF_STA_CONNECTING ;return 0 ; }
@@ -664,9 +659,6 @@ qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev,qtnf_scan_done (mac, true); -if (vif->sta_state ==QTNF_STA_DISCONNECTED ) - goto out; - ret =qtnf_cmd_send_disconnect (vif, reason_code);if (ret) { pr_err("VIF%u.%u: failed to disconnect\n", mac->macid,
@@ -675,9 +667,6 @@ qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev, } out: -if (vif->sta_state ==QTNF_STA_CONNECTING ) - vif->sta_state =QTNF_STA_DISCONNECTED ; -return ret; }
@@ -1152,28 +1141,10 @@ void qtnf_virtual_intf_cleanup(struct net_device *ndev)struct qtnf_wmac *mac =wiphy_priv (vif->wdev.wiphy);if (vif->wdev.iftype ==NL80211_IFTYPE_STATION ) { -switch (vif->sta_state) { -case QTNF_STA_DISCONNECTED : -break ; -case QTNF_STA_CONNECTING : -cfg80211_connect_result (vif->netdev, - vif->bssid,NULL ,0 , -NULL ,0 , -WLAN_STATUS_UNSPECIFIED_FAILURE , -GFP_KERNEL ); -qtnf_disconnect (vif->wdev.wiphy, ndev, -WLAN_REASON_DEAUTH_LEAVING ); -break ; -case QTNF_STA_CONNECTED : -cfg80211_disconnected (vif->netdev, -WLAN_REASON_DEAUTH_LEAVING , -NULL ,0 ,1 ,GFP_KERNEL ); -qtnf_disconnect (vif->wdev.wiphy, ndev, -WLAN_REASON_DEAUTH_LEAVING ); -break ; - } - - vif->sta_state =QTNF_STA_DISCONNECTED ; +cfg80211_disconnected (vif->netdev,WLAN_REASON_DEAUTH_LEAVING , +NULL ,0 ,1 ,GFP_KERNEL ); +qtnf_disconnect (vif->wdev.wiphy, ndev, +WLAN_REASON_DEAUTH_LEAVING ); }qtnf_scan_done (mac, true);
@@ -1181,27 +1152,11 @@ void qtnf_virtual_intf_cleanup(struct net_device *ndev)void qtnf_cfg80211_vif_reset (struct qtnf_vif *vif) { -if (vif->wdev.iftype ==NL80211_IFTYPE_STATION ) { -switch (vif->sta_state) { -case QTNF_STA_CONNECTING : -cfg80211_connect_result (vif->netdev, - vif->bssid,NULL ,0 , -NULL ,0 , -WLAN_STATUS_UNSPECIFIED_FAILURE , -GFP_KERNEL ); -break ; -case QTNF_STA_CONNECTED : -cfg80211_disconnected (vif->netdev, -WLAN_REASON_DEAUTH_LEAVING , -NULL ,0 ,1 ,GFP_KERNEL ); -break ; -case QTNF_STA_DISCONNECTED : -break ; - } - } +if (vif->wdev.iftype ==NL80211_IFTYPE_STATION ) +cfg80211_disconnected (vif->netdev,WLAN_REASON_DEAUTH_LEAVING , +NULL ,0 ,1 ,GFP_KERNEL );cfg80211_shutdown_all_interfaces (vif->wdev.wiphy); - vif->sta_state =QTNF_STA_DISCONNECTED ; }void qtnf_band_init_rates (struct ieee80211_supported_band *band)
drivers/net/wireless/quantenna/qtnfmac/core.h +0 -7
@@ -64,12 +64,6 @@ struct qtnf_sta_list {atomic_t size; }; -enum qtnf_sta_state { -QTNF_STA_DISCONNECTED , -QTNF_STA_CONNECTING , -QTNF_STA_CONNECTED -}; -struct qtnf_vif {struct wireless_dev wdev;u8 bssid[ETH_ALEN ];
@@ -77,7 +71,6 @@ struct qtnf_vif {u8 vifid;u8 bss_priority;u8 bss_status; -enum qtnf_sta_state sta_state;u16 mgmt_frames_bitmask;struct net_device *netdev;struct qtnf_wmac *mac;
drivers/net/wireless/quantenna/qtnfmac/event.c +1 -17
@@ -171,24 +171,14 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif,return -EPROTO ; } -if (vif->sta_state !=QTNF_STA_CONNECTING ) { -pr_err ("VIF%u.%u: BSS_JOIN event when STA is not connecting\n" , - vif->mac->macid, vif->vifid); -return -EPROTO ; - } -pr_debug ("VIF%u.%u: BSSID:%pM\n" , vif->mac->macid, vif->vifid, join_info->bssid);cfg80211_connect_result (vif->netdev, join_info->bssid,NULL ,0 ,NULL ,0 ,le16_to_cpu (join_info->status),GFP_KERNEL ); -if (le16_to_cpu (join_info->status) ==WLAN_STATUS_SUCCESS ) { - vif->sta_state =QTNF_STA_CONNECTED ; +if (le16_to_cpu (join_info->status) ==WLAN_STATUS_SUCCESS )netif_carrier_on (vif->netdev); - }else { - vif->sta_state =QTNF_STA_DISCONNECTED ; - }return 0 ; }
@@ -211,16 +201,10 @@ qtnf_event_handle_bss_leave(struct qtnf_vif *vif,return -EPROTO ; } -if (vif->sta_state !=QTNF_STA_CONNECTED ) -pr_warn ("VIF%u.%u: BSS_LEAVE event when STA is not connected\n" , - vif->mac->macid, vif->vifid); -pr_debug ("VIF%u.%u: disconnected\n" , vif->mac->macid, vif->vifid);cfg80211_disconnected (vif->netdev,le16_to_cpu (leave_info->reason),NULL ,0 ,0 ,GFP_KERNEL ); - - vif->sta_state =QTNF_STA_DISCONNECTED ;netif_carrier_off (vif->netdev);return 0 ;
Signature · 1 line
2.11.0
Re: [PATCH v2 01/13] qtnfmac: do not track STA states in driver
Quoted 4 lines · Sergey Matyukevich
Remove STA connection states tracking from driver. Leave it wireless core on host and to firmware.
Signed-off-by Sergey Matyukevich <[email protected]>
13 patches applied to wireless-drivers-next.git, thanks.
263ee96b77a7 qtnfmac: do not track STA states in driver d5f693bc4bb9 qtnfmac: generate local disconnect event in disconnect callback 92246b126ebf qtnfmac: request userspace to do OBSS scanning if FW can not 75001bbc0765 qtnfmac: do not initialize per-MAC data multiple times c6ed298ffe09 qtnfmac: cleanup and unify command error handling aaa981406f4f qtnfmac: do not cancel scan in disconnect callback d5657b709e2a qtnfmac: pass sgi rate info flag to wireless core ab1c64a1d349 qtnfmac: inform wireless core about supported extended capabilities 35da3fe63b86 qtnfmac: drop error reports for out-of-bounds key indexes 6d85930f2653 qtnfmac: add support for scan flush2525f188f7fd qtnfmac: add support for scan dwell time configuration 8804ea9e15a3 qtnfmac: drop redundant data copy in control path e1c02eb16a9c qtnfmac: implement dump_station support for STA mode
Signature · 3 lines
https://patchwork.kernel.org/patch/10627791/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH v2 2/13 qtnfmac: generate local disconnect event in disconnect callback
In reply to Sergey MatyukevichFrom: Igor Mitsyanko <[email protected]>
When cfg80211 disconnect callback is triggered and command is processed by firmware, disconnect event with local parameter set must be sent immediately. Indicating that it's a "local" event (not from AP) will help upper layers to process this event correctly.
--- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +7 -6
@@ -660,10 +660,14 @@ qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev,qtnf_scan_done (mac, true); ret =qtnf_cmd_send_disconnect (vif, reason_code); -if (ret) { +if (ret)pr_err ("VIF%u.%u: failed to disconnect\n" , mac->macid, vif->vifid); - goto out; + +if (vif->wdev.current_bss) { +netif_carrier_off (vif->netdev); +cfg80211_disconnected (vif->netdev, reason_code, +NULL ,0 , true,GFP_KERNEL ); } out:
@@ -1140,12 +1144,9 @@ void qtnf_virtual_intf_cleanup(struct net_device *ndev)struct qtnf_vif *vif =qtnf_netdev_get_priv (ndev);struct qtnf_wmac *mac =wiphy_priv (vif->wdev.wiphy); -if (vif->wdev.iftype ==NL80211_IFTYPE_STATION ) { -cfg80211_disconnected (vif->netdev,WLAN_REASON_DEAUTH_LEAVING , -NULL ,0 ,1 ,GFP_KERNEL ); +if (vif->wdev.iftype ==NL80211_IFTYPE_STATION )qtnf_disconnect (vif->wdev.wiphy, ndev,WLAN_REASON_DEAUTH_LEAVING ); - }qtnf_scan_done (mac, true); }
Signature · 1 line
2.11.0
PATCH v2 3/13 qtnfmac: request userspace to do OBSS scanning if FW can not
In reply to Sergey MatyukevichFrom: Igor Mitsyanko <[email protected]>
In case firmware reports that it can not do OBSS scanning for 40MHz 2.4GHz channels itself, tell userpsace to do that instead by setting NL80211_FEATURE_NEED_OBSS_SCAN flag.
--- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 3 +++ drivers/net/wireless/quantenna/qtnfmac/qlink.h | 2 ++ 2 files changed, 5 insertions(+)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +3 -0
@@ -1099,6 +1099,9 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac)if (hw_info->hw_capab &QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR ) wiphy->features |=NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR ; +if (!(hw_info->hw_capab &QLINK_HW_CAPAB_OBSS_SCAN )) + wiphy->features |=NL80211_FEATURE_NEED_OBSS_SCAN ; +#ifdef CONFIG_PM if (macinfo->wowlan) wiphy->wowlan = macinfo->wowlan;
drivers/net/wireless/quantenna/qtnfmac/qlink.h +2 -0
@@ -71,6 +71,7 @@ struct qlink_msg_header {* @QLINK_HW_CAPAB_DFS_OFFLOAD: device implements DFS offload functionality * @QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR: device supports MAC Address * Randomization in probe requests. +* @QLINK_HW_CAPAB_OBSS_SCAN: device can perform OBSS scanning. */ enum qlink_hw_capab {QLINK_HW_CAPAB_REG_UPDATE =BIT (0 ),
@@ -78,6 +79,7 @@ enum qlink_hw_capab {QLINK_HW_CAPAB_DFS_OFFLOAD =BIT (2 ),QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR =BIT (3 ),QLINK_HW_CAPAB_PWR_MGMT =BIT (4 ), + QLINK_HW_CAPAB_OBSS_SCAN = BIT(5), }; enum qlink_iface_type {
Signature · 1 line
2.11.0
PATCH v2 4/13 qtnfmac: do not initialize per-MAC data multiple times
In reply to Sergey MatyukevichFrom: Igor Mitsyanko <[email protected]>
Several members of pwr-MAC structure are re-initialized several times together with per-VIF initialization. Fix that and simplify the code.
--- drivers/net/wireless/quantenna/qtnfmac/core.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/core.c +13 -10
@@ -370,6 +370,7 @@ static void qtnf_mac_scan_timeout(struct work_struct *work)static struct qtnf_wmac *qtnf_core_mac_alloc (struct qtnf_bus *bus,unsigned int macid) { +struct qtnf_vif *vif;struct wiphy *wiphy;struct qtnf_wmac *mac;unsigned int i;
@@ -382,18 +383,20 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus, mac->macid = macid; mac->bus = bus; +mutex_init (&mac->mac_lock); +INIT_DELAYED_WORK (&mac->scan_timeout, qtnf_mac_scan_timeout);for (i =0 ; i <QTNF_MAX_INTF ; i++) { -memset (&mac->iflist[i],0 ,sizeof (struct qtnf_vif )); - mac->iflist[i].wdev.iftype =NL80211_IFTYPE_UNSPECIFIED ; - mac->iflist[i].mac = mac; - mac->iflist[i].vifid = i; -qtnf_sta_list_init (&mac->iflist[i].sta_list); -mutex_init (&mac->mac_lock); -INIT_DELAYED_WORK (&mac->scan_timeout, qtnf_mac_scan_timeout); - mac->iflist[i].stats64 = - netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); -if (!mac->iflist[i].stats64) + vif = &mac->iflist[i]; + +memset (vif,0 ,sizeof (*vif)); + vif->wdev.iftype =NL80211_IFTYPE_UNSPECIFIED ; + vif->mac = mac; + vif->vifid = i; +qtnf_sta_list_init (&vif->sta_list); + + vif->stats64 = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); +if (!vif->stats64)pr_warn ("VIF%u.%u: per cpu stats allocation failed\n" , macid, i); }
Signature · 1 line
2.11.0
PATCH v2 5/13 qtnfmac: cleanup and unify command error handling
In reply to Sergey MatyukevichUnify command error handling using qtnf_cmd_resp_result_decode function. Do not duplicate error messages in command handlers and cfg80211 callbacks: report 'cmd exec fail' only on control path internal failure. Remove redundant 'unlikely' macros.
--- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 64 ++- drivers/net/wireless/quantenna/qtnfmac/commands.c | 518 +++++----------------- 2 files changed, 149 insertions(+), 433 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +40 -24
@@ -141,8 +141,8 @@ qtnf_change_virtual_intf(struct wiphy *wiphy, ret =qtnf_cmd_send_change_intf_type (vif, type, mac_addr);if (ret) { -pr_err ("VIF%u.%u: failed to change VIF type: %d\n" , - vif->mac->macid, vif->vifid, ret); +pr_err ("VIF%u.%u: failed to change type to %d\n" , + vif->mac->macid, vif->vifid, type);return ret; }
@@ -228,18 +228,22 @@ static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy,if (params) mac_addr = params->macaddr; -if (qtnf_cmd_send_add_intf (vif, type, mac_addr)) { -pr_err ("VIF%u.%u: failed to add VIF\n" , mac->macid, vif->vifid); + ret =qtnf_cmd_send_add_intf (vif, type, mac_addr); +if (ret) { +pr_err ("VIF%u.%u: failed to add VIF %pM\n" , + mac->macid, vif->vifid, mac_addr); goto err_cmd; }if (!is_valid_ether_addr (vif->mac_addr)) {pr_err ("VIF%u.%u: FW reported bad MAC: %pM\n" , mac->macid, vif->vifid, vif->mac_addr); + ret = -EINVAL ; goto err_mac; } -if (qtnf_core_net_attach (mac, vif, name, name_assign_t)) { + ret =qtnf_core_net_attach (mac, vif, name, name_assign_t); +if (ret) {pr_err ("VIF%u.%u: failed to attach netdev\n" , mac->macid, vif->vifid); goto err_net;
@@ -255,7 +259,7 @@ static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy, err_cmd: vif->wdev.iftype =NL80211_IFTYPE_UNSPECIFIED ; -return ERR_PTR (-EFAULT ); +return ERR_PTR (ret); } static int qtnf_mgmt_set_appie(struct qtnf_vif *vif,
@@ -334,12 +338,11 @@ static int qtnf_stop_ap(struct wiphy *wiphy, struct net_device *dev)qtnf_scan_done (vif->mac, true); ret =qtnf_cmd_send_stop_ap (vif); -if (ret) { +if (ret)pr_err ("VIF%u.%u: failed to stop AP operation in FW\n" , vif->mac->macid, vif->vifid); -netif_carrier_off (vif->netdev); - } +netif_carrier_off (vif->netdev);return ret; }
@@ -589,6 +592,7 @@ qtnf_del_station(struct wiphy *wiphy, struct net_device *dev,if (ret)pr_err ("VIF%u.%u: failed to delete STA %pM\n" , vif->mac->macid, vif->vifid, params->mac); +return ret; }
@@ -596,21 +600,25 @@ static int qtnf_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) { struct qtnf_wmac *mac = wiphy_priv(wiphy); +int ret;cancel_delayed_work_sync (&mac->scan_timeout); mac->scan_req = request; -if (qtnf_cmd_send_scan (mac)) { + ret =qtnf_cmd_send_scan (mac); +if (ret) {pr_err ("MAC%u: failed to start scan\n" , mac->macid); mac->scan_req =NULL ; -return -EFAULT ; + goto out; } +pr_debug ("MAC%u: scan started\n" , mac->macid);queue_delayed_work (mac->bus->workqueue, &mac->scan_timeout,QTNF_SCAN_TIMEOUT_SEC *HZ ); -return 0 ; +out: +return ret; } static int
@@ -630,12 +638,13 @@ qtnf_connect(struct wiphy *wiphy, struct net_device *dev, ret =qtnf_cmd_send_connect (vif, sme);if (ret) { -pr_err ("VIF%u.%u: failed to connect\n" , vif->mac->macid, - vif->vifid); -return ret; +pr_err ("VIF%u.%u: failed to connect\n" , + vif->mac->macid, vif->vifid); + goto out; } -return 0 ; +out: +return ret; } static int
@@ -661,8 +670,8 @@ qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev, ret =qtnf_cmd_send_disconnect (vif, reason_code);if (ret) -pr_err ("VIF%u.%u: failed to disconnect\n" , mac->macid, - vif->vifid); +pr_err ("VIF%u.%u: failed to disconnect\n" , + mac->macid, vif->vifid);if (vif->wdev.current_bss) {netif_carrier_off (vif->netdev);
@@ -740,7 +749,6 @@ qtnf_dump_survey(struct wiphy *wiphy, struct net_device *dev,default :pr_debug ("failed to get chan(%d) stats from card\n" , chan->hw_value); - ret = -EINVAL ;break ; }
@@ -763,6 +771,7 @@ qtnf_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, ret =qtnf_cmd_get_channel (vif, chandef);if (ret) {pr_err ("%s: failed to get channel: %d\n" , ndev->name, ret); + ret = -ENODATA ; goto out; }
@@ -772,6 +781,7 @@ qtnf_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, chandef->center_freq1, chandef->center_freq2, chandef->width); ret = -ENODATA ; + goto out; } out:
@@ -841,10 +851,8 @@ static int qtnf_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, ret =qtnf_cmd_send_pm_set (vif, enabled ?QLINK_PM_AUTO_STANDBY :QLINK_PM_OFF , timeout); -if (ret) { +if (ret)pr_err ("%s: failed to set PM mode ret=%d\n" , dev->name, ret); -return ret; - }return ret; }
@@ -964,9 +972,16 @@ static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy_in, ret =qtnf_cmd_reg_notify (bus, req);if (ret) { -if (ret != -EOPNOTSUPP && ret != -EALREADY ) +if (ret == -EOPNOTSUPP ) { +pr_warn ("reg update not supported\n" ); + }else if (ret == -EALREADY ) { +pr_info ("regulatory domain is already set to %c%c" , + req->alpha2[0 ], req->alpha2[1 ]); + }else {pr_err ("failed to update reg domain to %c%c\n" , req->alpha2[0 ], req->alpha2[1 ]); + } +return ; }
@@ -1139,7 +1154,8 @@ void qtnf_netdev_updown(struct net_device *ndev, bool up)struct qtnf_vif *vif =qtnf_netdev_get_priv (ndev);if (qtnf_cmd_send_updown_intf (vif, up)) -pr_err ("failed to send up/down command to FW\n" ); +pr_err ("failed to send %s command to VIF%u.%u\n" , + up ?"UP" :"DOWN" , vif->mac->macid, vif->vifid); }void qtnf_virtual_intf_cleanup (struct net_device *ndev)
drivers/net/wireless/quantenna/qtnfmac/commands.c +109 -409
1,070 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v2 6/13 qtnfmac: do not cancel scan in disconnect callback
In reply to Sergey MatyukevichFrom: Igor Mitsyanko <[email protected]>
Do not cancel scan in disconnect callback. If there is an active scan, it will be cancelled by firmware, then host driver will be properly notified by event.
Cancelling scan in disconnect callback occasionally may lead to the following race issue. Host is able to queue one scan after scan abort in disconnect callback, and another scan after scan abort in event handler. As a result, firmware receives second scan before the first scan completes.
--- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +0 -2
@@ -666,8 +666,6 @@ qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev, goto out; } -qtnf_scan_done (mac, true); - ret =qtnf_cmd_send_disconnect (vif, reason_code);if (ret) pr_err("VIF%u.%u: failed to disconnect\n",
Signature · 1 line
2.11.0
PATCH v2 7/13 qtnfmac: pass sgi rate info flag to wireless core
In reply to Sergey MatyukevichSGI should be passed to wireless core as a part of rate structure. Otherwise wireless core performs incorrect rate calculation when SGI is enabled in hardware but not reported to host.
--- drivers/net/wireless/quantenna/qtnfmac/commands.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/quantenna/qtnfmac/commands.c +3 -0
@@ -498,6 +498,9 @@ qtnf_sta_info_parse_rate(struct rate_info *rate_dst, rate_dst->flags |=RATE_INFO_FLAGS_MCS ; else if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_VHT_MCS) rate_dst->flags |= RATE_INFO_FLAGS_VHT_MCS; + +if (rate_src->flags &QLINK_STA_INFO_RATE_FLAG_SHORT_GI ) + rate_dst->flags |=RATE_INFO_FLAGS_SHORT_GI ; } static void
Signature · 1 line
2.11.0
PATCH v2 8/13 qtnfmac: inform wireless core about supported extended capabilities
In reply to Sergey MatyukevichDriver retrieves information about supported extended capabilities from wireless card. However this information is not propagated further to Linux wireless core. Fix this by setting extended capabilities fields of wiphy structure.
--- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 9 +++++++++ drivers/net/wireless/quantenna/qtnfmac/commands.c | 3 +-- drivers/net/wireless/quantenna/qtnfmac/core.c | 16 ++++++++++++++-- drivers/net/wireless/quantenna/qtnfmac/core.h | 1 + 4 files changed, 25 insertions(+), 4 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +9 -0
@@ -1129,6 +1129,15 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac) wiphy->regulatory_flags |=REGULATORY_WIPHY_SELF_MANAGED ; } +if (mac->macinfo.extended_capabilities_len) { + wiphy->extended_capabilities = + mac->macinfo.extended_capabilities; + wiphy->extended_capabilities_mask = + mac->macinfo.extended_capabilities_mask; + wiphy->extended_capabilities_len = + mac->macinfo.extended_capabilities_len; + } +strlcpy (wiphy->fw_version, hw_info->fw_version,sizeof (wiphy->fw_version)); wiphy->hw_version = hw_info->hw_version;
drivers/net/wireless/quantenna/qtnfmac/commands.c +1 -2
@@ -1273,8 +1273,7 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac, ext_capa_mask =NULL ; } -kfree (mac->macinfo.extended_capabilities); -kfree (mac->macinfo.extended_capabilities_mask); +qtnf_mac_ext_caps_free (mac); mac->macinfo.extended_capabilities = ext_capa; mac->macinfo.extended_capabilities_mask = ext_capa_mask; mac->macinfo.extended_capabilities_len = ext_capa_len;
drivers/net/wireless/quantenna/qtnfmac/core.c +14 -2
@@ -304,6 +304,19 @@ void qtnf_mac_iface_comb_free(struct qtnf_wmac *mac) } } +void qtnf_mac_ext_caps_free (struct qtnf_wmac *mac) +{ +if (mac->macinfo.extended_capabilities_len) { +kfree (mac->macinfo.extended_capabilities); + mac->macinfo.extended_capabilities =NULL ; + +kfree (mac->macinfo.extended_capabilities_mask); + mac->macinfo.extended_capabilities_mask =NULL ; + + mac->macinfo.extended_capabilities_len =0 ; + } +} +static void qtnf_vif_reset_handler (struct work_struct *work) { struct qtnf_vif *vif = container_of(work, struct qtnf_vif, reset_work);
@@ -496,8 +509,7 @@ static void qtnf_core_mac_detach(struct qtnf_bus *bus, unsigned int macid) }qtnf_mac_iface_comb_free (mac); -kfree (mac->macinfo.extended_capabilities); -kfree (mac->macinfo.extended_capabilities_mask); +qtnf_mac_ext_caps_free (mac);kfree (mac->macinfo.wowlan);wiphy_free (wiphy); bus->mac[macid] =NULL ;
drivers/net/wireless/quantenna/qtnfmac/core.h +1 -0
@@ -144,6 +144,7 @@ struct qtnf_hw_info {struct qtnf_vif *qtnf_mac_get_free_vif (struct qtnf_wmac *mac);struct qtnf_vif *qtnf_mac_get_base_vif (struct qtnf_wmac *mac);void qtnf_mac_iface_comb_free (struct qtnf_wmac *mac); +void qtnf_mac_ext_caps_free (struct qtnf_wmac *mac);struct wiphy *qtnf_wiphy_allocate (struct qtnf_bus *bus);int qtnf_core_net_attach (struct qtnf_wmac *mac,struct qtnf_vif *priv,const char *name,unsigned char name_assign_type);
Signature · 1 line
2.11.0
PATCH v2 9/13 qtnfmac: drop error reports for out-of-bounds key indexes
In reply to Sergey MatyukevichOn disconnect wireless core attempts to remove all the supported keys. Following cfg80211_ops conventions, firmware returns -ENOENT code for the out-of-bound key indexes. This is a normal behavior, so no need to report errors for this case.
--- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +10 -3
@@ -523,9 +523,16 @@ static int qtnf_del_key(struct wiphy *wiphy, struct net_device *dev,int ret; ret =qtnf_cmd_send_del_key (vif, key_index, pairwise, mac_addr); -if (ret) -pr_err ("VIF%u.%u: failed to delete key: idx=%u pw=%u\n" , - vif->mac->macid, vif->vifid, key_index, pairwise); +if (ret) { +if (ret == -ENOENT ) { +pr_debug ("VIF%u.%u: key index %d out of bounds\n" , + vif->mac->macid, vif->vifid, key_index); + }else { +pr_err ("VIF%u.%u: failed to delete key: idx=%u pw=%u\n" , + vif->mac->macid, vif->vifid, + key_index, pairwise); + } + }return ret; }
Signature · 1 line
2.11.0
PATCH v2 10/13 qtnfmac: add support for scan flush
In reply to Sergey MatyukevichNotify firmware to flush cache before scanning when needed.
--- drivers/net/wireless/quantenna/qtnfmac/commands.c | 6 ++++++ drivers/net/wireless/quantenna/qtnfmac/qlink.h | 1 + drivers/net/wireless/quantenna/qtnfmac/qlink_util.h | 8 ++++++++ 3 files changed, 15 insertions(+)
drivers/net/wireless/quantenna/qtnfmac/commands.c +6 -0
@@ -2197,6 +2197,12 @@ int qtnf_cmd_send_scan(struct qtnf_wmac *mac) scan_req->mac_addr_mask); } +if (scan_req->flags &NL80211_SCAN_FLAG_FLUSH ) { +pr_debug ("MAC%u: flush cache before scan\n" , mac->macid); + +qtnf_cmd_skb_put_tlv_tag (cmd_skb,QTN_TLV_ID_SCAN_FLUSH ); + } + ret =qtnf_cmd_send (mac->bus, cmd_skb);if (ret) goto out;
drivers/net/wireless/quantenna/qtnfmac/qlink.h +1 -0
@@ -1151,6 +1151,7 @@ enum qlink_tlv_id {QTN_TLV_ID_MAX_SCAN_SSIDS =0x0409 ,QTN_TLV_ID_WOWLAN_CAPAB =0x0410 ,QTN_TLV_ID_WOWLAN_PATTERN =0x0411 , + QTN_TLV_ID_SCAN_FLUSH = 0x0412, }; struct qlink_tlv_hdr {
drivers/net/wireless/quantenna/qtnfmac/qlink_util.h +8 -0
@@ -40,6 +40,14 @@ static inline void qtnf_cmd_skb_put_tlv_arr(struct sk_buff *skb,memcpy (hdr->val, arr, arr_len); } +static inline void qtnf_cmd_skb_put_tlv_tag (struct sk_buff *skb,u16 tlv_id) +{ +struct qlink_tlv_hdr *hdr =skb_put (skb,sizeof (*hdr)); + + hdr->type =cpu_to_le16 (tlv_id); + hdr->len =cpu_to_le16 (0 ); +} +static inline void qtnf_cmd_skb_put_tlv_u8 (struct sk_buff *skb,u16 tlv_id,u8 value) {
Signature · 1 line
2.11.0
PATCH v2 11/13 qtnfmac: add support for scan dwell time configuration
In reply to Sergey MatyukevichFirmware supports scan dwell time tuning for various types of scans. Enable support for this feature:
- advertise capability to configure channel dwell time to host
- pass scan dwell parameters to wireless card in scan request
--- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 4 ++++ drivers/net/wireless/quantenna/qtnfmac/commands.c | 9 +++++++++ drivers/net/wireless/quantenna/qtnfmac/qlink.h | 2 ++ 3 files changed, 15 insertions(+)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +4 -0
@@ -1101,6 +1101,10 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac)if (hw_info->hw_capab &QLINK_HW_CAPAB_DFS_OFFLOAD )wiphy_ext_feature_set (wiphy,NL80211_EXT_FEATURE_DFS_OFFLOAD ); +if (hw_info->hw_capab &QLINK_HW_CAPAB_SCAN_DWELL ) +wiphy_ext_feature_set (wiphy, +NL80211_EXT_FEATURE_SET_SCAN_DWELL ); + wiphy->probe_resp_offload =NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 ;
drivers/net/wireless/quantenna/qtnfmac/commands.c +9 -0
@@ -2203,6 +2203,15 @@ int qtnf_cmd_send_scan(struct qtnf_wmac *mac)qtnf_cmd_skb_put_tlv_tag (cmd_skb,QTN_TLV_ID_SCAN_FLUSH ); } +if (scan_req->duration) { +pr_debug ("MAC%u: %s scan duration %u\n" , mac->macid, + scan_req->duration_mandatory ?"mandatory" :"max" , + scan_req->duration); + +qtnf_cmd_skb_put_tlv_u16 (cmd_skb,QTN_TLV_ID_SCAN_DWELL , + scan_req->duration); + } + ret =qtnf_cmd_send (mac->bus, cmd_skb);if (ret) goto out;
drivers/net/wireless/quantenna/qtnfmac/qlink.h +2 -0
@@ -80,6 +80,7 @@ enum qlink_hw_capab {QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR =BIT (3 ),QLINK_HW_CAPAB_PWR_MGMT =BIT (4 ),QLINK_HW_CAPAB_OBSS_SCAN =BIT (5 ), + QLINK_HW_CAPAB_SCAN_DWELL = BIT(6), }; enum qlink_iface_type {
@@ -1152,6 +1153,7 @@ enum qlink_tlv_id {QTN_TLV_ID_WOWLAN_CAPAB =0x0410 ,QTN_TLV_ID_WOWLAN_PATTERN =0x0411 ,QTN_TLV_ID_SCAN_FLUSH =0x0412 , + QTN_TLV_ID_SCAN_DWELL = 0x0413, }; struct qlink_tlv_hdr {
Signature · 1 line
2.11.0
PATCH v2 12/13 qtnfmac: drop redundant data copy in control path
In reply to Sergey MatyukevichCommand responses and events from the firmware are copied twice in control path: at first in shm core (qtnf_shm_handle_new_data) and then in pcie bus drivers (qtnf_pcie_control_rx_callback). There is no need to copy this data twice, it can be done only once in rx callbacks.
--- drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 5 +++-- drivers/net/wireless/quantenna/qtnfmac/shm_ipc.c | 13 ++++++------- drivers/net/wireless/quantenna/qtnfmac/shm_ipc.h | 4 +--- 3 files changed, 10 insertions(+), 12 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c +3 -2
@@ -242,7 +242,8 @@ static int qtnf_pcie_init_memory(struct qtnf_pcie_bus_priv *priv)return 0 ; } -static void qtnf_pcie_control_rx_callback (void *arg,const u8 *buf,size_t len) +static void qtnf_pcie_control_rx_callback (void *arg,const u8 __iomem *buf, +size_t len) {struct qtnf_pcie_bus_priv *priv = arg;struct qtnf_bus *bus =pci_get_drvdata (priv->pdev);
@@ -260,7 +261,7 @@ static void qtnf_pcie_control_rx_callback(void *arg, const u8 *buf, size_t len)return ; } -skb_put_data (skb, buf, len); +memcpy_fromio (skb_put (skb, len), buf, len);qtnf_trans_handle_rx_ctl_packet (bus, skb); }
drivers/net/wireless/quantenna/qtnfmac/shm_ipc.c +6 -7
@@ -42,19 +42,18 @@ static void qtnf_shm_handle_new_data(struct qtnf_shm_ipc *ipc)if (unlikely (size ==0 || size >QTN_IPC_MAX_DATA_SZ )) {pr_err ("wrong rx packet size: %zu\n" , size); rx_buff_ok = false; - }else { -memcpy_fromio (ipc->rx_data, ipc->shm_region->data, size); + } + +if (likely (rx_buff_ok)) { + ipc->rx_packet_count++; + ipc->rx_callback.fn (ipc->rx_callback.arg, + ipc->shm_region->data, size); }writel (QTNF_SHM_IPC_ACK , &shm_reg_hdr->flags);readl (&shm_reg_hdr->flags);/* flush PCIe write */ ipc->interrupt.fn (ipc->interrupt.arg); - -if (likely (rx_buff_ok)) { - ipc->rx_packet_count++; - ipc->rx_callback.fn (ipc->rx_callback.arg, ipc->rx_data, size); - } }static void qtnf_shm_ipc_irq_work (struct work_struct *work)
drivers/net/wireless/quantenna/qtnfmac/shm_ipc.h +1 -3
@@ -32,7 +32,7 @@ struct qtnf_shm_ipc_int { };struct qtnf_shm_ipc_rx_callback { -void (*fn)(void *arg,const u8 *buf,size_t len); +void (*fn)(void *arg,const u8 __iomem *buf,size_t len);void *arg; };
@@ -51,8 +51,6 @@ struct qtnf_shm_ipc {u8 waiting_for_ack; -u8 rx_data[QTN_IPC_MAX_DATA_SZ ]__aligned(sizeof(u32)) ; -struct qtnf_shm_ipc_int interrupt;struct qtnf_shm_ipc_rx_callback rx_callback;
Signature · 1 line
2.11.0
PATCH v2 13/13 qtnfmac: implement dump_station support for STA mode
In reply to Sergey MatyukevichCurrent implementation of dump_station cfg80211 callback supports AP mode only. Add support for STA mode as well: by default in STA mode this callback is supposed to return AP on managed interface.
--- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 30 ++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +21 -9
@@ -480,19 +480,31 @@ qtnf_dump_station(struct wiphy *wiphy, struct net_device *dev,const struct qtnf_sta_node *sta_node;int ret; - sta_node =qtnf_sta_list_lookup_index (&vif->sta_list, idx); +switch (vif->wdev.iftype) { +case NL80211_IFTYPE_STATION : +if (idx !=0 || !vif->wdev.current_bss) +return -ENOENT ; -if (unlikely (!sta_node)) -return -ENOENT ; +ether_addr_copy (mac, vif->bssid); +break ; +case NL80211_IFTYPE_AP : + sta_node =qtnf_sta_list_lookup_index (&vif->sta_list, idx); +if (unlikely (!sta_node)) +return -ENOENT ; -ether_addr_copy (mac, sta_node->mac_addr); +ether_addr_copy (mac, sta_node->mac_addr); +break ; +default : +return -ENOTSUPP ; + } - ret =qtnf_cmd_get_sta_info (vif, sta_node->mac_addr, sinfo); + ret =qtnf_cmd_get_sta_info (vif, mac, sinfo); -if (unlikely (ret == -ENOENT )) { -qtnf_sta_list_del (vif, mac); -cfg80211_del_sta (vif->netdev, mac,GFP_KERNEL ); - sinfo->filled =0 ; +if (vif->wdev.iftype ==NL80211_IFTYPE_AP ) { +if (ret == -ENOENT ) { +cfg80211_del_sta (vif->netdev, mac,GFP_KERNEL ); + sinfo->filled =0 ; + } } sinfo->generation = vif->generation;
Signature · 1 line
2.11.0