* [PATCH V2 0/3] mac80211: add code to explicitly enable TWT support inside the driver
From: John Crispin @ 2019-04-30 7:03 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo; +Cc: linux-wireless, John Crispin
At least ath11k needs an extra FW call to enable TWT inside the HW. This
series adds code to trigger this from within start_ap() and also STA assoc
events.
Changes in V2
* fix 2 typos
* move from bbs_config to start_ap
John Crispin (3):
mac80211: dynamically enable the TWT requester support on STA
interfaces
mac80211: allow turning TWT responder support on and off via netlink
ath11k: add TWT support
drivers/net/wireless/ath/ath11k/mac.c | 7 +++
drivers/net/wireless/ath/ath11k/wmi.c | 91 +++++++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/wmi.h | 71 +++++++++++++++++++++++++++
include/net/cfg80211.h | 2 +
include/net/mac80211.h | 5 ++
include/uapi/linux/nl80211.h | 4 ++
net/mac80211/cfg.c | 4 +-
net/mac80211/mlme.c | 18 ++++++-
net/wireless/nl80211.c | 5 ++
9 files changed, 204 insertions(+), 3 deletions(-)
--
2.11.0
^ permalink raw reply
* [PATCH V2 1/3] mac80211: dynamically enable the TWT requester support on STA interfaces
From: John Crispin @ 2019-04-30 7:03 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190430070338.4006-1-john@phrozen.org>
Turn TWT for STA interfaces when they associate and/or receive a
beacon where the twt_responder bit has changed.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
include/net/mac80211.h | 2 ++
net/mac80211/mlme.c | 18 ++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ac2ed8ec662b..2504a6cd8ca9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -317,6 +317,7 @@ struct ieee80211_vif_chanctx_switch {
* @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface
* @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder
* functionality changed for this BSS (AP mode).
+ * @BSS_CHANGED_TWT: TWT status changed
*
*/
enum ieee80211_bss_change {
@@ -347,6 +348,7 @@ enum ieee80211_bss_change {
BSS_CHANGED_KEEP_ALIVE = 1<<24,
BSS_CHANGED_MCAST_RATE = 1<<25,
BSS_CHANGED_FTM_RESPONDER = 1<<26,
+ BSS_CHANGED_TWT = 1<<27,
/* when adding here, make sure to change ieee80211_reconfig */
};
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2dbcf5d5512e..0d6ede3b6320 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3151,6 +3151,19 @@ static bool ieee80211_twt_req_supported(const struct sta_info *sta,
IEEE80211_HE_MAC_CAP0_TWT_RES;
}
+static int ieee80211_recalc_twt_req(struct ieee80211_sub_if_data *sdata,
+ struct sta_info *sta,
+ struct ieee802_11_elems *elems)
+{
+ bool twt = ieee80211_twt_req_supported(sta, elems);
+
+ if (sdata->vif.bss_conf.twt_requester != twt) {
+ sdata->vif.bss_conf.twt_requester = twt;
+ return BSS_CHANGED_TWT;
+ }
+ return 0;
+}
+
static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
struct cfg80211_bss *cbss,
struct ieee80211_mgmt *mgmt, size_t len)
@@ -3333,8 +3346,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
sta);
bss_conf->he_support = sta->sta.he_cap.has_he;
- bss_conf->twt_requester =
- ieee80211_twt_req_supported(sta, &elems);
+ changed |= ieee80211_recalc_twt_req(sdata, sta, &elems);
} else {
bss_conf->he_support = false;
bss_conf->twt_requester = false;
@@ -3994,6 +4006,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
mutex_lock(&local->sta_mtx);
sta = sta_info_get(sdata, bssid);
+ changed |= ieee80211_recalc_twt_req(sdata, sta, &elems);
+
if (ieee80211_config_bw(sdata, sta,
elems.ht_cap_elem, elems.ht_operation,
elems.vht_operation, elems.he_operation,
--
2.11.0
^ permalink raw reply related
* [PATCH V2 2/3] mac80211: allow turning TWT responder support on and off via netlink
From: John Crispin @ 2019-04-30 7:03 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190430070338.4006-1-john@phrozen.org>
Allow the userland daemon to en/disable TWT support for an AP.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
include/net/cfg80211.h | 2 ++
include/net/mac80211.h | 3 +++
include/uapi/linux/nl80211.h | 4 ++++
net/mac80211/cfg.c | 4 +++-
net/wireless/nl80211.c | 5 +++++
5 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bb307a11ee63..c4fe1bf10289 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -876,6 +876,7 @@ enum cfg80211_ap_settings_flags {
* @he_cap: HE capabilities (or %NULL if HE isn't enabled)
* @ht_required: stations must support HT
* @vht_required: stations must support VHT
+ * @twt_responder: Enable Target Wait Time
* @flags: flags, as defined in enum cfg80211_ap_settings_flags
*/
struct cfg80211_ap_settings {
@@ -902,6 +903,7 @@ struct cfg80211_ap_settings {
const struct ieee80211_vht_cap *vht_cap;
const struct ieee80211_he_cap_elem *he_cap;
bool ht_required, vht_required;
+ bool twt_responder;
u32 flags;
};
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 2504a6cd8ca9..3c916d5de8c8 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -506,6 +506,8 @@ struct ieee80211_ftm_responder_params {
* @he_support: does this BSS support HE
* @twt_requester: does this BSS support TWT requester (relevant for managed
* mode only, set if the AP advertises TWT responder role)
+ * @twt_responder: does this BSS support TWT requester (relevant for managed
+ * mode only, set if the AP advertises TWT responder role)
* @assoc: association status
* @ibss_joined: indicates whether this station is part of an IBSS
* or not
@@ -613,6 +615,7 @@ struct ieee80211_bss_conf {
u16 frame_time_rts_th;
bool he_support;
bool twt_requester;
+ bool twt_responder;
/* association related data */
bool assoc, ibss_joined;
bool ibss_creator;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index dd4f86ee286e..ba1f69751a4a 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2308,6 +2308,8 @@ enum nl80211_commands {
* @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
* scheduler.
*
+ * @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2759,6 +2761,8 @@ enum nl80211_attrs {
NL80211_ATTR_AIRTIME_WEIGHT,
+ NL80211_ATTR_TWT_RESPONDER,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 09dd1c2860fc..8be2f32fedfc 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -939,7 +939,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
BSS_CHANGED_BEACON |
BSS_CHANGED_SSID |
BSS_CHANGED_P2P_PS |
- BSS_CHANGED_TXPOWER;
+ BSS_CHANGED_TXPOWER |
+ BSS_CHANGED_TWT;
int err;
int prev_beacon_int;
@@ -1009,6 +1010,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
sdata->vif.bss_conf.dtim_period = params->dtim_period;
sdata->vif.bss_conf.enable_beacon = true;
sdata->vif.bss_conf.allow_p2p_go_ps = sdata->vif.p2p;
+ sdata->vif.bss_conf.twt_responder = params->twt_responder;
sdata->vif.bss_conf.ssid_len = params->ssid_len;
if (params->ssid_len)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 25a9e3b5c154..643f53dc2c89 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -541,6 +541,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_PEER_MEASUREMENTS] =
NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
[NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
+ [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG },
};
/* policy for the key attributes */
@@ -4531,6 +4532,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
return PTR_ERR(params.acl);
}
+ if (info->attrs[NL80211_ATTR_TWT_RESPONDER])
+ params.twt_responder =
+ nla_get_flag(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
+
nl80211_calculate_ap_params(¶ms);
if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
--
2.11.0
^ permalink raw reply related
* [PATCH V2 3/3] ath11k: add TWT support
From: John Crispin @ 2019-04-30 7:03 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190430070338.4006-1-john@phrozen.org>
Add target wait time wmi calls to the driver. En/disable the support
from when the bss_config changes. We ignore the cmd completion events.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/net/wireless/ath/ath11k/mac.c | 7 +++
drivers/net/wireless/ath/ath11k/wmi.c | 91 +++++++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/wmi.h | 71 +++++++++++++++++++++++++++
3 files changed, 169 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 2c7afbc7b9a6..e3f9d288c357 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1938,6 +1938,13 @@ static void ath11k_bss_info_changed(struct ieee80211_hw *hw,
ath11k_mac_txpower_recalc(ar);
}
+ if (changed & BSS_CHANGED_TWT) {
+ if (info->twt_requester || info->twt_responder)
+ ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev_idx);
+ else
+ ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev_idx);
+ }
+
mutex_unlock(&ar->conf_mutex);
}
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 7edaed5c97df..52d6fb200d07 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -1797,6 +1797,10 @@ ath11k_wmi_copy_peer_flags(struct wmi_peer_assoc_complete_cmd *cmd,
cmd->peer_flags |= WMI_PEER_VHT;
if (param->he_flag)
cmd->peer_flags |= WMI_PEER_HE;
+ if (param->twt_requester)
+ cmd->peer_flags |= WMI_PEER_TWT_REQ;
+ if (param->twt_responder)
+ cmd->peer_flags |= WMI_PEER_TWT_RESP;
}
/* Suppress authorization for all AUTH modes that need 4-way handshake
@@ -2787,6 +2791,86 @@ int ath11k_wmi_pdev_pktlog_disable(struct ath11k *ar)
return ret;
}
+int
+ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_sc->sc;
+ struct wmi_twt_enable_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_TWT_ENABLE_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+ cmd->pdev_id = pdev_id;
+ cmd->sta_cong_timer_ms = ATH11K_TWT_DEF_STA_CONG_TIMER_MS;
+ cmd->default_slot_size = ATH11K_TWT_DEF_DEFAULT_SLOT_SIZE;
+ cmd->congestion_thresh_setup = ATH11K_TWT_DEF_CONGESTION_THRESH_SETUP;
+ cmd->congestion_thresh_teardown =
+ ATH11K_TWT_DEF_CONGESTION_THRESH_TEARDOWN;
+ cmd->congestion_thresh_critical =
+ ATH11K_TWT_DEF_CONGESTION_THRESH_CRITICAL;
+ cmd->interference_thresh_teardown =
+ ATH11K_TWT_DEF_INTERFERENCE_THRESH_TEARDOWN;
+ cmd->interference_thresh_setup =
+ ATH11K_TWT_DEF_INTERFERENCE_THRESH_SETUP;
+ cmd->min_no_sta_setup = ATH11K_TWT_DEF_MIN_NO_STA_SETUP;
+ cmd->min_no_sta_teardown = ATH11K_TWT_DEF_MIN_NO_STA_TEARDOWN;
+ cmd->no_of_bcast_mcast_slots = ATH11K_TWT_DEF_NO_OF_BCAST_MCAST_SLOTS;
+ cmd->min_no_twt_slots = ATH11K_TWT_DEF_MIN_NO_TWT_SLOTS;
+ cmd->max_no_sta_twt = ATH11K_TWT_DEF_MAX_NO_STA_TWT;
+ cmd->mode_check_interval = ATH11K_TWT_DEF_MODE_CHECK_INTERVAL;
+ cmd->add_sta_slot_interval = ATH11K_TWT_DEF_ADD_STA_SLOT_INTERVAL;
+ cmd->remove_sta_slot_interval =
+ ATH11K_TWT_DEF_REMOVE_STA_SLOT_INTERVAL;
+ /* TODO add MBSSID support */
+ cmd->mbss_support = 0;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_ENABLE_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_ENABLE_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
+int
+ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_sc->sc;
+ struct wmi_twt_disable_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_TWT_DISABLE_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+ cmd->pdev_id = pdev_id;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_DISABLE_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_DIeABLE_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
static inline void ath11k_fill_band_to_mac_param(struct ath11k_base *soc,
struct wmi_host_pdev_band_to_mac *band_to_mac)
{
@@ -2877,6 +2961,9 @@ ath11k_wmi_copy_resource_config(struct wmi_resource_config *wmi_cfg,
wmi_cfg->use_pdev_id = tg_cfg->use_pdev_id;
wmi_cfg->flag1 = tg_cfg->atf_config;
wmi_cfg->peer_map_unmap_v2_support = tg_cfg->peer_map_unmap_v2_support;
+ wmi_cfg->sched_params = tg_cfg->sched_params;
+ wmi_cfg->twt_ap_pdev_count = tg_cfg->twt_ap_pdev_count;
+ wmi_cfg->twt_ap_sta_count = tg_cfg->twt_ap_sta_count;
}
static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
@@ -3068,6 +3155,8 @@ int ath11k_wmi_cmd_init(struct ath11k_base *sc)
config.beacon_tx_offload_max_vdev = sc->num_radios * TARGET_MAX_BCN_OFFLD;
config.rx_batchmode = TARGET_RX_BATCHMODE;
config.peer_map_unmap_v2_support = 1;
+ config.twt_ap_pdev_count = 2;
+ config.twt_ap_sta_count = 1000;
memcpy(&wmi_sc->wlan_resource_config, &config, sizeof(config));
@@ -5859,6 +5948,8 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb)
/* add Unsupported events here */
case WMI_TBTTOFFSET_EXT_UPDATE_EVENTID:
case WMI_VDEV_DELETE_RESP_EVENTID:
+ case WMI_TWT_ENABLE_EVENTID:
+ case WMI_TWT_DISABLE_EVENTID:
ath11k_dbg(ab, ATH11K_DBG_WMI,
"ignoring unsupported event 0x%x\n", id);
break;
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index 071537850c68..99f69fc3cf53 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -169,6 +169,10 @@ enum wmi_cmd_group {
WMI_GRP_MONITOR, /* 0x39 */
WMI_GRP_REGULATORY, /* 0x3a */
WMI_GRP_HW_DATA_FILTER, /* 0x3b */
+ WMI_GRP_WLM, /* 0x3c */
+ WMI_GRP_11K_OFFLOAD, /* 0x3d */
+ WMI_GRP_TWT, /* 0x3e */
+
};
#define WMI_CMD_GRP(grp_id) (((grp_id) << 12) | 0x1)
@@ -531,6 +535,12 @@ enum wmi_tlv_cmd_id {
WMI_NDP_RESPONDER_REQ_CMDID,
WMI_NDP_END_REQ_CMDID,
WMI_HW_DATA_FILTER_CMDID = WMI_TLV_CMD(WMI_GRP_HW_DATA_FILTER),
+ WMI_TWT_ENABLE_CMDID = WMI_TLV_CMD(WMI_GRP_TWT),
+ WMI_TWT_DISABLE_CMDID,
+ WMI_TWT_ADD_DIALOG_CMDID,
+ WMI_TWT_DEL_DIALOG_CMDID,
+ WMI_TWT_PAUSE_DIALOG_CMDID,
+ WMI_TWT_RESUME_DIALOG_CMDID,
};
enum wmi_tlv_event_id {
@@ -713,6 +723,13 @@ enum wmi_tlv_event_id {
WMI_NDP_INDICATION_EVENTID,
WMI_NDP_CONFIRM_EVENTID,
WMI_NDP_END_INDICATION_EVENTID,
+
+ WMI_TWT_ENABLE_EVENTID = WMI_TLV_CMD(WMI_GRP_TWT),
+ WMI_TWT_DISABLE_EVENTID,
+ WMI_TWT_ADD_DIALOG_EVENTID,
+ WMI_TWT_DEL_DIALOG_EVENTID,
+ WMI_TWT_PAUSE_DIALOG_EVENTID,
+ WMI_TWT_RESUME_DIALOG_EVENTID,
};
enum wmi_tlv_pdev_param {
@@ -2736,6 +2753,9 @@ struct wmi_resource_config {
u32 max_num_dbs_scan_duty_cycle;
u32 max_num_group_keys;
u32 peer_map_unmap_v2_support;
+ u32 sched_params;
+ u32 twt_ap_pdev_count;
+ u32 twt_ap_sta_count;
} __packed;
struct wmi_service_ready_event {
@@ -3907,6 +3927,8 @@ struct peer_assoc_params {
u32 peer_he_mcs_count;
u32 peer_he_rx_mcs_set[WMI_HOST_MAX_HE_RATE_SET];
u32 peer_he_tx_mcs_set[WMI_HOST_MAX_HE_RATE_SET];
+ bool twt_responder;
+ bool twt_requester;
struct ath11k_ppe_threshold peer_ppet;
};
@@ -4130,6 +4152,8 @@ struct wmi_pktlog_disable_cmd {
#define WMI_PEER_DYN_MIMOPS 0x00020000
#define WMI_PEER_STATIC_MIMOPS 0x00040000
#define WMI_PEER_SPATIAL_MUX 0x00200000
+#define WMI_PEER_TWT_REQ 0x00400000
+#define WMI_PEER_TWT_RESP 0x00800000
#define WMI_PEER_VHT 0x02000000
#define WMI_PEER_80MHZ 0x04000000
#define WMI_PEER_PMF 0x08000000
@@ -5005,6 +5029,48 @@ struct wmi_wmm_params_all_arg {
struct wmi_wmm_params_arg ac_vo;
};
+#define ATH11K_TWT_DEF_STA_CONG_TIMER_MS 5000
+#define ATH11K_TWT_DEF_DEFAULT_SLOT_SIZE 10
+#define ATH11K_TWT_DEF_CONGESTION_THRESH_SETUP 50
+#define ATH11K_TWT_DEF_CONGESTION_THRESH_TEARDOWN 20
+#define ATH11K_TWT_DEF_CONGESTION_THRESH_CRITICAL 100
+#define ATH11K_TWT_DEF_INTERFERENCE_THRESH_TEARDOWN 80
+#define ATH11K_TWT_DEF_INTERFERENCE_THRESH_SETUP 50
+#define ATH11K_TWT_DEF_MIN_NO_STA_SETUP 10
+#define ATH11K_TWT_DEF_MIN_NO_STA_TEARDOWN 2
+#define ATH11K_TWT_DEF_NO_OF_BCAST_MCAST_SLOTS 2
+#define ATH11K_TWT_DEF_MIN_NO_TWT_SLOTS 2
+#define ATH11K_TWT_DEF_MAX_NO_STA_TWT 500
+#define ATH11K_TWT_DEF_MODE_CHECK_INTERVAL 10000
+#define ATH11K_TWT_DEF_ADD_STA_SLOT_INTERVAL 1000
+#define ATH11K_TWT_DEF_REMOVE_STA_SLOT_INTERVAL 5000
+
+struct wmi_twt_enable_params_cmd {
+ u32 tlv_header;
+ u32 pdev_id;
+ u32 sta_cong_timer_ms;
+ u32 mbss_support;
+ u32 default_slot_size;
+ u32 congestion_thresh_setup;
+ u32 congestion_thresh_teardown;
+ u32 congestion_thresh_critical;
+ u32 interference_thresh_teardown;
+ u32 interference_thresh_setup;
+ u32 min_no_sta_setup;
+ u32 min_no_sta_teardown;
+ u32 no_of_bcast_mcast_slots;
+ u32 min_no_twt_slots;
+ u32 max_no_sta_twt;
+ u32 mode_check_interval;
+ u32 add_sta_slot_interval;
+ u32 remove_sta_slot_interval;
+};
+
+struct wmi_twt_disable_params_cmd {
+ u32 tlv_header;
+ u32 pdev_id;
+};
+
struct target_resource_config {
u32 num_vdevs;
u32 num_peers;
@@ -5065,6 +5131,9 @@ struct target_resource_config {
u32 max_bssid_rx_filters;
u32 use_pdev_id;
u32 peer_map_unmap_v2_support;
+ u32 sched_params;
+ u32 twt_ap_pdev_count;
+ u32 twt_ap_sta_count;
};
#define WMI_MAX_MEM_REQS 32
@@ -5190,4 +5259,6 @@ size_t ath11k_wmi_fw_stats_num_vdevs(struct list_head *head);
void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
struct ath11k_fw_stats *fw_stats, u32 stats_id,
char *buf);
+int ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id);
+int ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id);
#endif
--
2.11.0
^ permalink raw reply related
* Re: [PATCHv5 1/9] nl80211: New netlink command for TID specific configuration
From: Tamizh chelvam @ 2019-04-30 7:38 UTC (permalink / raw)
To: Johannes Berg; +Cc: ath10k, linux-wireless
In-Reply-To: <b90f20a45af63a3261ee14eda38239521dce6486.camel@sipsolutions.net>
>> +enum ieee80211_tid_conf_mask {
>> + IEEE80211_TID_CONF_NOACK = BIT(0),
>> +};
>> +
>> +/**
>> + * struct ieee80211_tid_cfg - TID specific configuration
>> + * @tid: TID number
>> + * @tid_conf_mask: bitmap indicating which parameter changed
>> + * see %enum ieee80211_tid_conf_mask
>> + * @noack: noack configuration value for the TID
>> + */
>> +struct ieee80211_tid_cfg {
>> + u8 tid;
>> + enum ieee80211_tid_conf_mask tid_conf_mask;
>
> This shouldn't use the enum type if it's a bitmap. Doing the enum type
> above is only useful for documentation, which you should add there.
>
Okay. I will change this to u32.
>> + * @set_tid_config: TID specific configuration. Apply this
>> configuration for
>> + * all the connected stations in the BSS if peer is NULL. Otherwise
>
> %NULL renders better, IIRC
>
Sure.
>> + * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
>> + * nested attribute with %NL80211_ATTR_TID_* sub-attributes.
>
> Please use NL80211_TID_ATTR_* to disambiguate the namespaces
>
Sure.
>> +enum nl80211_tid_config {
>> + NL80211_TID_CONFIG_DEFAULT,
>> + NL80211_TID_CONFIG_ENABLE,
>> + NL80211_TID_CONFIG_DISABLE,
>> +};
>
>
> That could do with some documentation
>
Sure.
>> +
>> +/* enum nl80211_attr_tid_config - TID specific configuration.
>> + * @NL80211_ATTR_TID_CONFIG_TID: a TID value (u8 attribute).
>
> See above - TID_ATTR_* is better.
>
>> + * @NL80211_ATTR_TID_CONFIG_NOACK: Configure ack policy for the TID.
>> + * specified in %NL80211_ATTR_TID_CONFIG_TID. see %enum
>> nl80211_tid_config.
>> + * Its type is u8, if the peer MAC address is passed in
>> %NL80211_ATTR_MAC,
>> + * then the noack configuration is applied to the data frame for the
>> tid
>> + * to that connected station. This configuration is valid only for
>> STA's
>> + * current connection. i.e. the configuration will be reset to
>> default when
>> + * the station connects back after disconnection/roaming.
>> + * when user-space does not include %NL80211_ATTR_MAC, then this
>
> please use tabs consistently
>
>> + * configuration should be treated as per-netdev configuration.
>> + * This configuration will be cleared when the interface goes down
>> and on
>> + * the disconnection from a BSS.
>
> "goes down" is redundant then? Or do you mean that's for the AP case?
>
In AP case, if a station disconnects from AP then the configuration will
be cleared for the station. Similarly in STA mode if it disconnected
from the BSS then the configuration also will be cleared.
>> +static const struct nla_policy
>> +nl80211_attr_tid_config_policy[NL80211_ATTR_TID_CONFIG_MAX + 1] = {
>> + [NL80211_ATTR_TID_CONFIG_TID] = { .type = NLA_U8 },
>
> Shouldn't this use NLA_POLICY_RANGE() or MAX()?
>
To give option to apply configuration for all TIDs if the value is
255(likely).
>> + [NL80211_ATTR_TID_CONFIG_NOACK] =
>> + NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE),
>> +};
>> +
>> const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
>> [NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
>> [NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING,
>> @@ -541,6 +548,8 @@ static int validate_ie_attr(const struct nlattr
>> *attr,
>> [NL80211_ATTR_PEER_MEASUREMENTS] =
>> NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
>> [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
>> + [NL80211_ATTR_TID_CONFIG] =
>> + NLA_POLICY_NESTED(nl80211_attr_tid_config_policy),
>> };
>
> Great! :-)
>
>> /* policy for the key attributes */
>> @@ -13259,6 +13268,93 @@ static int
>> nl80211_get_ftm_responder_stats(struct sk_buff *skb,
>> return -ENOBUFS;
>> }
>>
>> +static int parse_tid_conf(struct cfg80211_registered_device *rdev,
>> + struct nlattr *attrs[],
>> + struct ieee80211_tid_cfg *tid_conf,
>> + const u8 *peer)
>> +{
>> + tid_conf->tid = nla_get_u8(attrs[NL80211_ATTR_TID_CONFIG_TID]);
>
> You need to check that this is even present!
>
>> + size_of_conf = sizeof(struct ieee80211_tid_config) +
>> + num_conf * sizeof(struct ieee80211_tid_cfg);
>
> use struct_size()
Sure
>
>> + tid_conf = kzalloc(size_of_conf, GFP_KERNEL);
>> + if (!tid_conf)
>> + return -ENOMEM;
>> +
>> + tid_conf->n_tid_conf = num_conf;
>> +
>> + if (info->attrs[NL80211_ATTR_MAC])
>> + tid_conf->peer = nla_data(info->attrs[NL80211_ATTR_MAC]);
>> + else
>> + tid_conf->peer = NULL;
>
> No need to initialize to NULL after kzalloc()
okay sure.
>
>> + nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG],
>> + rem_conf) {
>> + ret = nla_parse_nested(attrs, NL80211_ATTR_TID_CONFIG_MAX, tid,
>> + NULL, NULL);
>> +
>> + if (ret)
>> + goto bad_tid_conf;
>> +
>> + if (!attrs[NL80211_ATTR_TID_CONFIG_TID]) {
>> + ret = -EINVAL;
>> + goto bad_tid_conf;
>> + }
>
> Oh, you check here. Perhaps easier to do inside though?
Checked here since the parse_tid_conf function called after this check.
>
>> + {
>> + .cmd = NL80211_CMD_SET_TID_CONFIG,
>> + .doit = nl80211_set_tid_config,
>> + .policy = nl80211_policy,
>
> The .policy field no longer exists.
Sure, I will remove this
>
> johannes
^ permalink raw reply
* [PATCH] mt76: usb: use EP max packet aligned buffer sizes for rx
From: Stanislaw Gruszka @ 2019-04-30 7:42 UTC (permalink / raw)
To: linux-wireless; +Cc: Felix Fietkau, Lorenzo Bianconi
If buffer size is not usb_endpoint_maxp (512 or 1024 bytes) multiple,
usb host driver has to use bounce buffer and copy data. For RX we can
avoid that since we alreay allocate q->buf_size (2kB) buffers and
mt76usb hardware will not fill more data as rx packet size is limited
by network protocol. However add error message if this assumption
somehow will be not true.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
drivers/net/wireless/mediatek/mt76/usb.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index c299c6591072..025e072cff28 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -286,7 +286,6 @@ static int
mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
int nsgs, gfp_t gfp)
{
- int sglen = SKB_WITH_OVERHEAD(q->buf_size);
int i;
for (i = 0; i < nsgs; i++) {
@@ -300,7 +299,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
page = virt_to_head_page(data);
offset = data - page_address(page);
- sg_set_page(&urb->sg[i], page, sglen, offset);
+ sg_set_page(&urb->sg[i], page, q->buf_size, offset);
}
if (i < nsgs) {
@@ -312,7 +311,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
}
urb->num_sgs = max_t(int, i, urb->num_sgs);
- urb->transfer_buffer_length = urb->num_sgs * sglen,
+ urb->transfer_buffer_length = urb->num_sgs * q->buf_size,
sg_init_marker(urb->sg, urb->num_sgs);
return i ? : -ENOMEM;
@@ -326,7 +325,7 @@ mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp)
if (dev->usb.sg_en) {
return mt76u_fill_rx_sg(dev, q, urb, nsgs, gfp);
} else {
- urb->transfer_buffer_length = SKB_WITH_OVERHEAD(q->buf_size);
+ urb->transfer_buffer_length = q->buf_size;
urb->transfer_buffer = page_frag_alloc(&q->rx_page,
q->buf_size, gfp);
return urb->transfer_buffer ? 0 : -ENOMEM;
@@ -447,8 +446,10 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
return 0;
data_len = min_t(int, len, data_len - MT_DMA_HDR_LEN);
- if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size))
+ if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size)) {
+ dev_err(dev->dev, "rx data too big %d\n", data_len);
return 0;
+ }
skb = build_skb(data, q->buf_size);
if (!skb)
--
2.20.1
^ permalink raw reply related
* Re: [PATCH] mt76: usb: use EP max packet aligned buffer sizes for rx
From: Felix Fietkau @ 2019-04-30 7:59 UTC (permalink / raw)
To: Stanislaw Gruszka, linux-wireless; +Cc: Lorenzo Bianconi
In-Reply-To: <20190430074219.8495-1-sgruszka@redhat.com>
On 2019-04-30 09:42, Stanislaw Gruszka wrote:
> If buffer size is not usb_endpoint_maxp (512 or 1024 bytes) multiple,
> usb host driver has to use bounce buffer and copy data. For RX we can
> avoid that since we alreay allocate q->buf_size (2kB) buffers and
> mt76usb hardware will not fill more data as rx packet size is limited
> by network protocol. However add error message if this assumption
> somehow will be not true.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> drivers/net/wireless/mediatek/mt76/usb.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
> index c299c6591072..025e072cff28 100644
> --- a/drivers/net/wireless/mediatek/mt76/usb.c
> +++ b/drivers/net/wireless/mediatek/mt76/usb.c
> @@ -447,8 +446,10 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
> return 0;
>
> data_len = min_t(int, len, data_len - MT_DMA_HDR_LEN);
> - if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size))
> + if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size)) {
> + dev_err(dev->dev, "rx data too big %d\n", data_len);
Please use WARN_ON_ONCE here, or at least dev_err_ratelimited if you
think it's necessary to print data_len.
- Felix
^ permalink raw reply
* [PATCH v2] mt76: usb: use EP max packet aligned buffer sizes for rx
From: Stanislaw Gruszka @ 2019-04-30 8:10 UTC (permalink / raw)
To: linux-wireless; +Cc: Felix Fietkau, Lorenzo Bianconi
If buffer size is not usb_endpoint_maxp (512 or 1024 bytes) multiple,
usb host driver has to use bounce buffer and copy data. For RX we can
avoid that since we alreay allocate q->buf_size (2kB) buffers and
mt76usb hardware will not fill more data as rx packet size is limited
by network protocol. However add error message if this assumption
somehow will be not true.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
v2: use dev_err_ratelimited
drivers/net/wireless/mediatek/mt76/usb.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index c299c6591072..bbaa1365bbda 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -286,7 +286,6 @@ static int
mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
int nsgs, gfp_t gfp)
{
- int sglen = SKB_WITH_OVERHEAD(q->buf_size);
int i;
for (i = 0; i < nsgs; i++) {
@@ -300,7 +299,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
page = virt_to_head_page(data);
offset = data - page_address(page);
- sg_set_page(&urb->sg[i], page, sglen, offset);
+ sg_set_page(&urb->sg[i], page, q->buf_size, offset);
}
if (i < nsgs) {
@@ -312,7 +311,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
}
urb->num_sgs = max_t(int, i, urb->num_sgs);
- urb->transfer_buffer_length = urb->num_sgs * sglen,
+ urb->transfer_buffer_length = urb->num_sgs * q->buf_size,
sg_init_marker(urb->sg, urb->num_sgs);
return i ? : -ENOMEM;
@@ -326,7 +325,7 @@ mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp)
if (dev->usb.sg_en) {
return mt76u_fill_rx_sg(dev, q, urb, nsgs, gfp);
} else {
- urb->transfer_buffer_length = SKB_WITH_OVERHEAD(q->buf_size);
+ urb->transfer_buffer_length = q->buf_size;
urb->transfer_buffer = page_frag_alloc(&q->rx_page,
q->buf_size, gfp);
return urb->transfer_buffer ? 0 : -ENOMEM;
@@ -447,8 +446,10 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
return 0;
data_len = min_t(int, len, data_len - MT_DMA_HDR_LEN);
- if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size))
+ if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size)) {
+ dev_err_ratelimited(dev->dev, "rx data too big %d\n", data_len);
return 0;
+ }
skb = build_skb(data, q->buf_size);
if (!skb)
--
2.20.1
^ permalink raw reply related
* Re: [PATCH] brcmfmac: change the order of things in brcmf_detach()
From: Piotr Figiel @ 2019-04-30 8:11 UTC (permalink / raw)
To: Arend van Spriel; +Cc: Rafał Miłecki, linux-wireless@vger.kernel.org
In-Reply-To: <1556532561-24428-1-git-send-email-arend.vanspriel@broadcom.com>
Hi Arend,
On Mon, Apr 29, 2019 at 12:09:21PM +0200, Arend van Spriel wrote:
> When brcmf_detach() from the bus layer upon rmmod we can no longer
> communicate. Hence we will set the bus state to DOWN and cleanup
> the event and protocol layer. The network interfaces need to be
> deleted before brcmf_cfg80211_detach() because the latter does the
> wiphy_unregister() which issues a warning if there are still network
> devices linked to the wiphy instance.
This seems to already happen - brcmf_cfg80211_detach() is called after the
interfaces are removed.
> This change solves a null pointer dereference issue which happened
> upon issueing rmmod while there are packets queued in bus protocol
> layer.
>
> Reported-by: Rafał Miłecki <rafal@milecki.pl>
> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
> Reviewed-by: Franky Lin <franky.lin@broadcom.com>
> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> ---
> Hi Piotr,
>
> While working on an issue with msgbuf protocol (used for PCIe devices)
> your change 5cdb0ef6144f ("brcmfmac: fix NULL pointer derefence during
> USB disconnect") conflicted. I suspect my reordering stuff in
> brcmf_detach() also fixes your issue so could you retest this patch,
> which basically reverts your change and applies my reordering, and see
> whether my suspicion can be confirmed.
Does the issue reported by Rafał you are trying to solve with this patch occur
on current linux-next?
Best regards,
--
Piotr Figiel
^ permalink raw reply
* Re: [PATCH V2 1/3] mac80211: dynamically enable the TWT requester support on STA interfaces
From: Kalle Valo @ 2019-04-30 9:11 UTC (permalink / raw)
To: John Crispin; +Cc: Johannes Berg, linux-wireless, Shashidhar Lakkavalli
In-Reply-To: <20190430070338.4006-2-john@phrozen.org>
John Crispin <john@phrozen.org> writes:
> Turn TWT for STA interfaces when they associate and/or receive a
> beacon where the twt_responder bit has changed.
>
> Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
> Signed-off-by: John Crispin <john@phrozen.org>
Nothing important, but nowadays we have Co-developed-by which is a nice
way to document multiple authors (I'm assuming that's the case here):
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v2] mt76: mt7615: add TX/RX antenna pattern capabilities
From: Felix Fietkau @ 2019-04-30 9:24 UTC (permalink / raw)
To: Ryder Lee, Lorenzo Bianconi
Cc: Roy Luo, YF Luo, Yiwei Chung, Sean Wang, linux-wireless,
linux-mediatek, linux-kernel
In-Reply-To: <4f7160cb9f52335ce15fccac087fec25e7650884.1556255852.git.ryder.lee@mediatek.com>
On 2019-04-26 07:23, Ryder Lee wrote:
> Announce antenna pattern cap to adapt PHY and baseband settings.
>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
> Changes since v2:
> - Add a prefix mt76 in the title.
> ---
> drivers/net/wireless/mediatek/mt76/mt7615/init.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> index 3ab3ff553ef2..122f7a565540 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> @@ -190,6 +190,8 @@ int mt7615_register_device(struct mt7615_dev *dev)
> IEEE80211_VHT_CAP_SHORT_GI_160 |
> IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
> IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
> + IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
> + IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN |
If I read the standard correctly, these flags indicate that the rx/tx
antenna pattern does NOT change during association.
Doesn't that mean that we should set it in mac80211.c instead, so that
it also applies to MT76x2?
Thanks,
- Felix
^ permalink raw reply
* Re: [PATCH v2 5/5] mt76: mt7603: enable/disable pre_tbtt_tasklet in mt7603_set_channel
From: Felix Fietkau @ 2019-04-30 9:34 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <ad6f286f30e8d9080320164a5551c2ee37bd6a95.1556525110.git.lorenzo@kernel.org>
On 2019-04-29 10:13, Lorenzo Bianconi wrote:
> Disable pre_tbtt_tasklet tasklet before setting the operating channel.
> Enable/disable beacon_timer in mt7603_set_channel
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
This doesn't seem right to me - I don't think we should send beacons
while off-channel.
- Felix
^ permalink raw reply
* Re: [PATCH] ath10k: add peer id check in ath10k_peer_find_by_id
From: Kalle Valo @ 2019-04-30 9:36 UTC (permalink / raw)
To: Nicolas Boichat; +Cc: Wen Gong, Claire Chang, linux-wireless, ath10k
In-Reply-To: <CANMq1KAU1B4Bweq3O6O8HOMwT7fHjj9tDyxqMsn_vn4gwxXL=Q@mail.gmail.com>
Nicolas Boichat <drinkcat@chromium.org> writes:
> On Wed, Apr 3, 2019 at 3:01 AM Wen Gong <wgong@codeaurora.org> wrote:
>>
>> For some SDIO chip, the peer id is 65535 for MPDU with error status,
>> then test_bit will trigger buffer overflow for peer's memory, if kasan
>> enabled, it will report error.
>>
>> Add check for overflow the size of peer's peer_ids will avoid the buffer
>> overflow access.
>>
[...]
>> --- a/drivers/net/wireless/ath/ath10k/txrx.c
>> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
>> @@ -157,6 +157,9 @@ struct ath10k_peer *ath10k_peer_find_by_id(struct ath10k *ar, int peer_id)
>> {
>> struct ath10k_peer *peer;
>>
>> + if (peer_id >= sizeof(peer->peer_ids) * BITS_PER_BYTE)
>
> I'd use >= BITS_PER_TYPE(peer->peer_ids).
Nice, I didn't know about that. Wen, please submit v2 using this.
--
Kalle Valo
^ permalink raw reply
* Re: [RFC/RFT] mac80211: Switch to a virtual time-based airtime scheduler
From: Yibo Zhao @ 2019-04-30 9:45 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: make-wifi-fast, linux-wireless, Felix Fietkau, Rajkumar Manoharan,
Kan Yan, linux-wireless-owner
In-Reply-To: <87bm10ped0.fsf@toke.dk>
On 2019-04-21 05:15, Toke Høiland-Jørgensen wrote:
> Yibo Zhao <yiboz@codeaurora.org> writes:
>
>> On 2019-04-11 19:24, Toke Høiland-Jørgensen wrote:
>>> Yibo Zhao <yiboz@codeaurora.org> writes:
>>>
>>>> On 2019-04-10 18:40, Toke Høiland-Jørgensen wrote:
>>>>> Yibo Zhao <yiboz@codeaurora.org> writes:
>>>>>
>>>>>> On 2019-04-10 04:41, Toke Høiland-Jørgensen wrote:
>>>>>>> Yibo Zhao <yiboz@codeaurora.org> writes:
>>>>>>>
>>>>>>>> On 2019-04-04 16:31, Toke Høiland-Jørgensen wrote:
>>>>>>>>> Yibo Zhao <yiboz@codeaurora.org> writes:
>>>>>>>>>
>>>>>>>>>> On 2019-02-16 01:05, Toke Høiland-Jørgensen wrote:
>>>>>>>>>>> This switches the airtime scheduler in mac80211 to use a
>>>>>>>>>>> virtual
>>>>>>>>>>> time-based
>>>>>>>>>>> scheduler instead of the round-robin scheduler used before.
>>>>>>>>>>> This
>>>>>>>>>>> has
>>>>>>>>>>> a
>>>>>>>>>>> couple of advantages:
>>>>>>>>>>>
>>>>>>>>>>> - No need to sync up the round-robin scheduler in
>>>>>>>>>>> firmware/hardware
>>>>>>>>>>> with
>>>>>>>>>>> the round-robin airtime scheduler.
>>>>>>>>>>>
>>>>>>>>>>> - If several stations are eligible for transmission we can
>>>>>>>>>>> schedule
>>>>>>>>>>> both of
>>>>>>>>>>> them; no need to hard-block the scheduling rotation until
>>>>>>>>>>> the
>>>>>>>>>>> head
>>>>>>>>>>> of
>>>>>>>>>>> the
>>>>>>>>>>> queue has used up its quantum.
>>>>>>>>>>>
>>>>>>>>>>> - The check of whether a station is eligible for transmission
>>>>>>>>>>> becomes
>>>>>>>>>>> simpler (in ieee80211_txq_may_transmit()).
>>>>>>>>>>>
>>>>>>>>>>> The drawback is that scheduling becomes slightly more
>>>>>>>>>>> expensive,
>>>>>>>>>>> as
>>>>>>>>>>> we
>>>>>>>>>>> need
>>>>>>>>>>> to maintain an rbtree of TXQs sorted by virtual time. This
>>>>>>>>>>> means
>>>>>>>>>>> that
>>>>>>>>>>> ieee80211_register_airtime() becomes O(logN) in the number of
>>>>>>>>>>> currently
>>>>>>>>>>> scheduled TXQs. However, hopefully this number rarely grows
>>>>>>>>>>> too
>>>>>>>>>>> big
>>>>>>>>>>> (it's
>>>>>>>>>>> only TXQs currently backlogged, not all associated stations),
>>>>>>>>>>> so
>>>>>>>>>>> it
>>>>>>>>>>> shouldn't be too big of an issue.
>>>>>>>>>>>
>>>>>>>>>>> @@ -1831,18 +1830,32 @@ void
>>>>>>>>>>> ieee80211_sta_register_airtime(struct
>>>>>>>>>>> ieee80211_sta *pubsta, u8 tid,
>>>>>>>>>>> {
>>>>>>>>>>> struct sta_info *sta = container_of(pubsta, struct
>>>>>>>>>>> sta_info,
>>>>>>>>>>> sta);
>>>>>>>>>>> struct ieee80211_local *local = sta->sdata->local;
>>>>>>>>>>> + struct ieee80211_txq *txq = sta->sta.txq[tid];
>>>>>>>>>>> u8 ac = ieee80211_ac_from_tid(tid);
>>>>>>>>>>> - u32 airtime = 0;
>>>>>>>>>>> + u64 airtime = 0, weight_sum;
>>>>>>>>>>> +
>>>>>>>>>>> + if (!txq)
>>>>>>>>>>> + return;
>>>>>>>>>>>
>>>>>>>>>>> if (sta->local->airtime_flags & AIRTIME_USE_TX)
>>>>>>>>>>> airtime += tx_airtime;
>>>>>>>>>>> if (sta->local->airtime_flags & AIRTIME_USE_RX)
>>>>>>>>>>> airtime += rx_airtime;
>>>>>>>>>>>
>>>>>>>>>>> + /* Weights scale so the unit weight is 256 */
>>>>>>>>>>> + airtime <<= 8;
>>>>>>>>>>> +
>>>>>>>>>>> spin_lock_bh(&local->active_txq_lock[ac]);
>>>>>>>>>>> +
>>>>>>>>>>> sta->airtime[ac].tx_airtime += tx_airtime;
>>>>>>>>>>> sta->airtime[ac].rx_airtime += rx_airtime;
>>>>>>>>>>> - sta->airtime[ac].deficit -= airtime;
>>>>>>>>>>> +
>>>>>>>>>>> + weight_sum = local->airtime_weight_sum[ac] ?:
>>>>>>>>>>> sta->airtime_weight;
>>>>>>>>>>> +
>>>>>>>>>>> + local->airtime_v_t[ac] += airtime / weight_sum;
>> Hi Toke,
>>
>> I was porting this version of ATF design to my ath10k platform and
>> found
>> my old kernel version not supporting 64bit division. I'm wondering if
>> it
>> is necessary to use u64 for airtime and weight_sum here though I can
>> find a solution for it. I think u32 might be enough. For airtime,
>> u32_max / 256 = 7182219 us(718 ms). As for weight_sum, u32_max / 8092
>> us
>> = 130490, meaning we can support more than 130000 nodes with airtime
>> weight 8092 us.
>
> As Felix said, we don't really want divides in the fast path at all.
> And
> since the divisors are constant, we should be able to just pre-compute
> reciprocals and turn the whole thing into multiplications...
>
>> Another finding was when I configured two 11ac STAs with different
>> airtime weight, such as 256 and 1024 meaning ratio is 1:4, the
>> throughput ratio was not roughly matching the ratio. Could you please
>> share your results? I am not sure if it is due to platform difference.
>
> Hmm, I tested them with ath9k where things seemed to work equivalently
> to the DRR. Are you testing the same hardware with that? Would be a
> good
> baseline.
>
> I am on vacation until the end of the month, but can share my actual
> test results once I get back...
Hi Toke,
I saw your commit in hostapd in
http://patchwork.ozlabs.org/patch/1059334/
For dynamic and limit mode described in above hostapd patch, do I need
to change any code in this kernel patch or any other patches am I
missing?
After a quick look at the hostapd patch, I guess all the efforts for
both modes are done in hostapd. Correct me if I am wrong. :)
>
> -Toke
--
Yibo
^ permalink raw reply
* Re: [PATCH v2 5/5] mt76: mt7603: enable/disable pre_tbtt_tasklet in mt7603_set_channel
From: Lorenzo Bianconi @ 2019-04-30 9:57 UTC (permalink / raw)
To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <2c1357f9-95e6-49a2-7a75-7c2d6c89203a@nbd.name>
>
> On 2019-04-29 10:13, Lorenzo Bianconi wrote:
> > Disable pre_tbtt_tasklet tasklet before setting the operating channel.
> > Enable/disable beacon_timer in mt7603_set_channel
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> This doesn't seem right to me - I don't think we should send beacons
> while off-channel.
Yes, right. I will rework this patch and even patch 1/5
Regards,
Lorenzo
>
> - Felix
^ permalink raw reply
* Re: [PATCHv5 5/9] nl80211: Add netlink attribute to configure TID specific tx rate
From: Tamizh chelvam @ 2019-04-30 9:58 UTC (permalink / raw)
To: Johannes Berg; +Cc: ath10k, linux-wireless
In-Reply-To: <d9135c6be42425424e4c3fd606c7e5aaf9dac1e9.camel@sipsolutions.net>
On 2019-04-26 15:07, Johannes Berg wrote:
>> @@ -13354,6 +13367,42 @@ static int parse_tid_conf(struct
>> cfg80211_registered_device *rdev,
>> nla_get_u8(attrs[NL80211_ATTR_TID_CONFIG_RTSCTS_CTRL]);
>> }
>>
>> + if (attrs[NL80211_ATTR_TID_CONFIG_TX_RATES_TYPE]) {
>> + int idx;
>> + enum nl80211_attrs attr;
>> +
>> + if (!wiphy_ext_feature_isset(&rdev->wiphy,
>> + NL80211_EXT_FEATURE_PER_TID_TX_BITRATE_MASK))
>> + return -EOPNOTSUPP;
>> +
>> + if (peer &&
>> + !wiphy_ext_feature_isset(&rdev->wiphy,
>> + NL80211_EXT_FEATURE_PER_STA_TX_BITRATE_MASK))
>> + return -EOPNOTSUPP;
>> +
>> + idx = NL80211_ATTR_TID_CONFIG_TX_RATES_TYPE;
>> + tid_conf->txrate_type = nla_get_u8(attrs[idx]);
>> +
>> + tid_conf->tid_conf_mask |= IEEE80211_TID_CONF_TX_BITRATE;
>> + if (tid_conf->txrate_type != NL80211_TX_RATE_AUTOMATIC) {
>> + tid_conf->mask =
>> + kzalloc(sizeof(struct cfg80211_bitrate_mask),
>> + GFP_KERNEL);
>
> You leak this
>
>> + if (!tid_conf->mask)
>> + return -ENOMEM;
>> +
>> + attr = NL80211_ATTR_TID_CONFIG_TX_RATES;
>> + ret = nl80211_parse_tx_bitrate_mask(attrs, rdev, attr,
>> + tid_conf->mask);
>> + if (ret) {
>> + kfree(tid_conf->mask);
>> + return ret;
>> + }
>> + } else {
>> + tid_conf->mask = NULL;
>> + }
>> + }
>> +
>> return 0;
>> }
>>
>> @@ -13407,7 +13456,7 @@ static int nl80211_set_tid_config(struct
>> sk_buff *skb,
>> }
>>
>> ret = parse_tid_conf(rdev, attrs, &tid_conf->tid_conf[conf_idx],
>> - tid_conf->peer);
>> + info, tid_conf->peer);
>> if (ret)
>> goto bad_tid_conf;
>
> Practically everywhere, but particularly in the bad case in the next
> loop iteration etc?
>
Yeah. I will fix this in next version.
^ permalink raw reply
* Re: [PATCH] brcmfmac: change the order of things in brcmf_detach()
From: Arend Van Spriel @ 2019-04-30 10:10 UTC (permalink / raw)
To: Piotr Figiel; +Cc: Rafał Miłecki, linux-wireless@vger.kernel.org
In-Reply-To: <20190430081142.GA27822@phoenix>
On 4/30/2019 10:11 AM, Piotr Figiel wrote:
> Hi Arend,
>
> On Mon, Apr 29, 2019 at 12:09:21PM +0200, Arend van Spriel wrote:
>> When brcmf_detach() from the bus layer upon rmmod we can no longer
>> communicate. Hence we will set the bus state to DOWN and cleanup
>> the event and protocol layer. The network interfaces need to be
>> deleted before brcmf_cfg80211_detach() because the latter does the
>> wiphy_unregister() which issues a warning if there are still network
>> devices linked to the wiphy instance.
>
> This seems to already happen - brcmf_cfg80211_detach() is called after the
> interfaces are removed.
Right. This was just to remind me why brcmf_cfg80211_detach() must be
called after removing the interfaces.
>> This change solves a null pointer dereference issue which happened
>> upon issueing rmmod while there are packets queued in bus protocol
>> layer.
>>
>> Reported-by: Rafał Miłecki <rafal@milecki.pl>
>> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
>> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
>> Reviewed-by: Franky Lin <franky.lin@broadcom.com>
>> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
>> ---
>> Hi Piotr,
>>
>> While working on an issue with msgbuf protocol (used for PCIe devices)
>> your change 5cdb0ef6144f ("brcmfmac: fix NULL pointer derefence during
>> USB disconnect") conflicted. I suspect my reordering stuff in
>> brcmf_detach() also fixes your issue so could you retest this patch,
>> which basically reverts your change and applies my reordering, and see
>> whether my suspicion can be confirmed.
>
> Does the issue reported by Rafał you are trying to solve with this patch occur
> on current linux-next?
Looking at you patch I suspect it does, because
brcmf_proto_msgbuf_detach() is invoked in
brcmf_proto_detach_post_delif(). However, I could not reproduce it with
or without the patch.
Rafał,
Do you know whether your reported issue, ie. calling brcmf_tx_finalize()
after interfaces were removed, still exists in wireless-testing (or
linux-next).
Regards,
Arend
^ permalink raw reply
* RE: [PATCH] ath10k: add peer id check in ath10k_peer_find_by_id
From: Wen Gong @ 2019-04-30 10:12 UTC (permalink / raw)
To: kvalo@codeaurora.org, Nicolas Boichat
Cc: Claire Chang, linux-wireless@vger.kernel.org,
ath10k@lists.infradead.org, Wen Gong
In-Reply-To: <87wojbrg0m.fsf@kamboji.qca.qualcomm.com>
> -----Original Message-----
> From: ath10k <ath10k-bounces@lists.infradead.org> On Behalf Of Kalle Valo
> Sent: Tuesday, April 30, 2019 5:37 PM
> To: Nicolas Boichat <drinkcat@chromium.org>
> Cc: Claire Chang <tientzu@chromium.org>; linux-wireless@vger.kernel.org;
> ath10k@lists.infradead.org; Wen Gong <wgong@codeaurora.org>
> Subject: [EXT] Re: [PATCH] ath10k: add peer id check in
> ath10k_peer_find_by_id
> >> --- a/drivers/net/wireless/ath/ath10k/txrx.c
> >> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
> >> @@ -157,6 +157,9 @@ struct ath10k_peer
> *ath10k_peer_find_by_id(struct ath10k *ar, int peer_id)
> >> {
> >> struct ath10k_peer *peer;
> >>
> >> + if (peer_id >= sizeof(peer->peer_ids) * BITS_PER_BYTE)
> >
> > I'd use >= BITS_PER_TYPE(peer->peer_ids).
>
> Nice, I didn't know about that. Wen, please submit v2 using this.
>
> --
> Kalle Valo
Yes,
I have send v2 yesterday:
[PATCH v2] ath10k: add peer id check in ath10k_peer_find_by_id
>
> _______________________________________________
> ath10k mailing list
> ath10k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply
* Re: [PATCH v9 09/14] rtw88: chip files
From: Kalle Valo @ 2019-04-30 10:26 UTC (permalink / raw)
To: yhchuang
Cc: linux-wireless, johannes, pkshih, tehuang, Larry.Finger, sgruszka,
briannorris, gregkh
In-Reply-To: <1555653004-1795-10-git-send-email-yhchuang@realtek.com>
<yhchuang@realtek.com> writes:
> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> chip files Realtek 802.11ac wireless network chips
> 8822B & 8822C series files
>
> Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
[...]
> +static struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8822b[] = {
> + {0x0086,
> + RTW_PWR_CUT_ALL_MSK,
> + RTW_PWR_INTF_SDIO_MSK,
> + RTW_PWR_ADDR_SDIO,
> + RTW_PWR_CMD_WRITE, BIT(0), 0},
I see lots of arrays like this which are not const. I think they should
be const.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v9 01/14] rtw88: main files
From: Kalle Valo @ 2019-04-30 10:30 UTC (permalink / raw)
To: yhchuang
Cc: linux-wireless, johannes, pkshih, tehuang, Larry.Finger, sgruszka,
briannorris, gregkh
In-Reply-To: <1555653004-1795-2-git-send-email-yhchuang@realtek.com>
<yhchuang@realtek.com> writes:
> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> main files for Realtek 802.11ac wireless network chips
>
> Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
[...]
> +static inline bool rtw_flag_check(struct rtw_dev *rtwdev, enum rtw_flags flag)
> +{
> + return test_bit(flag, rtwdev->flags);
> +}
> +
> +static inline void rtw_flag_clear(struct rtw_dev *rtwdev, enum rtw_flags flag)
> +{
> + clear_bit(flag, rtwdev->flags);
> +}
> +
> +static inline void rtw_flag_set(struct rtw_dev *rtwdev, enum rtw_flags flag)
> +{
> + set_bit(flag, rtwdev->flags);
> +}
In upstream we don't usually like these kind of abstractions, they just
hide what the code does.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v9 01/14] rtw88: main files
From: Kalle Valo @ 2019-04-30 10:32 UTC (permalink / raw)
To: yhchuang
Cc: linux-wireless, johannes, pkshih, tehuang, Larry.Finger, sgruszka,
briannorris, gregkh
In-Reply-To: <1555653004-1795-2-git-send-email-yhchuang@realtek.com>
<yhchuang@realtek.com> writes:
> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> main files for Realtek 802.11ac wireless network chips
>
> Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
[...]
> +static bool rtw_fw_support_lps;
> +unsigned int rtw_debug_mask;
> +EXPORT_SYMBOL(rtw_debug_mask);
> +
> +module_param_named(support_lps, rtw_fw_support_lps, bool, 0644);
> +module_param_named(debug_mask, rtw_debug_mask, uint, 0644);
> +
> +MODULE_PARM_DESC(support_lps, "Set Y to enable LPS support");
Not everyone (myself included) do not know what LPS means, please spell
it out in the description.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v2] mt76: mt7615: add TX/RX antenna pattern capabilities
From: Ryder Lee @ 2019-04-30 11:27 UTC (permalink / raw)
To: Felix Fietkau
Cc: Lorenzo Bianconi, Roy Luo, YF Luo, Yiwei Chung, Sean Wang,
linux-wireless, linux-mediatek, linux-kernel
In-Reply-To: <c3f6e202-8c2f-a103-a104-e0d1cde8147b@nbd.name>
On Tue, 2019-04-30 at 11:24 +0200, Felix Fietkau wrote:
> On 2019-04-26 07:23, Ryder Lee wrote:
> > Announce antenna pattern cap to adapt PHY and baseband settings.
> >
> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> > ---
> > Changes since v2:
> > - Add a prefix mt76 in the title.
> > ---
> > drivers/net/wireless/mediatek/mt76/mt7615/init.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> > index 3ab3ff553ef2..122f7a565540 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> > @@ -190,6 +190,8 @@ int mt7615_register_device(struct mt7615_dev *dev)
> > IEEE80211_VHT_CAP_SHORT_GI_160 |
> > IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
> > IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
> > + IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
> > + IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN |
> If I read the standard correctly, these flags indicate that the rx/tx
> antenna pattern does NOT change during association.
> Doesn't that mean that we should set it in mac80211.c instead, so that
> it also applies to MT76x2?
>
Right. I will add these flags in common code.
Ryder
^ permalink raw reply
* Re: [PATCH v9 01/14] rtw88: main files
From: Kalle Valo @ 2019-04-30 11:45 UTC (permalink / raw)
To: yhchuang
Cc: linux-wireless, johannes, pkshih, tehuang, Larry.Finger, sgruszka,
briannorris, gregkh
In-Reply-To: <1555653004-1795-2-git-send-email-yhchuang@realtek.com>
<yhchuang@realtek.com> writes:
> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> main files for Realtek 802.11ac wireless network chips
>
> Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
[...]
> +static int rtw_ops_add_interface(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif)
> +{
> + struct rtw_dev *rtwdev = hw->priv;
> + struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;
> + enum rtw_net_type net_type;
> + u32 config = 0;
> + u8 port = 0;
> +
> + rtwvif->port = port;
> + rtwvif->vif = vif;
> + rtwvif->stats.tx_unicast = 0;
> + rtwvif->stats.rx_unicast = 0;
> + rtwvif->stats.tx_cnt = 0;
> + rtwvif->stats.rx_cnt = 0;
> + rtwvif->in_lps = false;
> + rtwvif->conf = &rtw_vif_port[port];
> +
> + mutex_lock(&rtwdev->mutex);
> +
> + switch (vif->type) {
> + case NL80211_IFTYPE_AP:
> + case NL80211_IFTYPE_MESH_POINT:
> + net_type = RTW_NET_AP_MODE;
> + break;
> + case NL80211_IFTYPE_ADHOC:
> + net_type = RTW_NET_AD_HOC;
> + break;
> + case NL80211_IFTYPE_STATION:
> + default:
> + net_type = RTW_NET_NO_LINK;
> + break;
> + }
> +
> + ether_addr_copy(rtwvif->mac_addr, vif->addr);
> + config |= PORT_SET_MAC_ADDR;
> + rtwvif->net_type = net_type;
> + config |= PORT_SET_NET_TYPE;
> + rtw_vif_port_config(rtwdev, rtwvif, config);
> +
> + mutex_unlock(&rtwdev->mutex);
> +
> + rtw_info(rtwdev, "start vif %pM on port %d\n", vif->addr, rtwvif->port);
I think this somewhat spammy. And looking at other uses of rtw_info():
mac80211.c:157: rtw_info(rtwdev, "start vif %pM on port %d\n", vif->addr, rtwvif->port);
mac80211.c:168: rtw_info(rtwdev, "stop vif %pM on port %d\n", vif->addr, rtwvif->port);
mac80211.c:318: rtw_info(rtwdev, "sta %pM joined with macid %d\n",
mac80211.c:340: rtw_info(rtwdev, "sta %pM with macid %d left\n",
rtw8822b.c:936: rtw_info(rtwdev, "unsupport tx path, set to default path ab\n");
rtw8822b.c:940: rtw_info(rtwdev, "unsupport rx path, set to default path ab\n");
I would just convert the last two to warning level, assuming those cases
do not happen normally. And the rest would be better as debug messages
to keep the dmesg clean.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v9 12/14] rtw88: Kconfig & Makefile
From: Kalle Valo @ 2019-04-30 11:53 UTC (permalink / raw)
To: yhchuang
Cc: linux-wireless, johannes, pkshih, tehuang, Larry.Finger, sgruszka,
briannorris, gregkh
In-Reply-To: <1555653004-1795-13-git-send-email-yhchuang@realtek.com>
<yhchuang@realtek.com> writes:
> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> Kconfig & Makefile for Realtek 802.11ac wireless network chips
>
> Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
[...]
> --- /dev/null
> +++ b/drivers/net/wireless/realtek/rtw88/Makefile
> @@ -0,0 +1,20 @@
> +obj-$(CONFIG_RTW88_CORE) += rtw88.o
> +rtw88-y += main.o \
> + mac80211.o \
> + util.o \
> + debug.o \
> + tx.o \
> + rx.o \
> + mac.o \
> + phy.o \
> + efuse.o \
> + fw.o \
> + ps.o \
> + sec.o \
> + regd.o
> +
> +rtw88-$(CONFIG_RTW88_8822BE) += rtw8822b.o rtw8822b_table.o
> +rtw88-$(CONFIG_RTW88_8822CE) += rtw8822c.o rtw8822c_table.o
> +
> +obj-$(CONFIG_RTW88_PCI) += rtwpci.o
> +rtwpci-objs := pci.o
Please add an SPDX tag also for the makefile.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v9 05/14] rtw88: mac files
From: Kalle Valo @ 2019-04-30 11:48 UTC (permalink / raw)
To: yhchuang
Cc: linux-wireless, johannes, pkshih, tehuang, Larry.Finger, sgruszka,
briannorris, gregkh
In-Reply-To: <1555653004-1795-6-git-send-email-yhchuang@realtek.com>
<yhchuang@realtek.com> writes:
> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> mac files for Realtek 802.11ac wireless network chips
>
> Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
[...]
> +static int rtw_pwr_cmd_polling(struct rtw_dev *rtwdev,
> + struct rtw_pwr_seq_cmd *cmd)
> +{
> + u8 value;
> + u8 flag = 0;
> + u32 offset;
> + u32 cnt = RTW_PWR_POLLING_CNT;
> +
> + if (cmd->base == RTW_PWR_ADDR_SDIO)
> + offset = cmd->offset | SDIO_LOCAL_OFFSET;
> + else
> + offset = cmd->offset;
> +
> + do {
> + cnt--;
> + value = rtw_read8(rtwdev, offset);
> + value &= cmd->mask;
> + if (value == (cmd->value & cmd->mask))
> + return 0;
> + if (cnt == 0) {
> + if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE &&
> + flag == 0) {
> + value = rtw_read8(rtwdev, REG_SYS_PW_CTRL);
> + value |= BIT(3);
> + rtw_write8(rtwdev, REG_SYS_PW_CTRL, value);
> + value &= ~BIT(3);
> + rtw_write8(rtwdev, REG_SYS_PW_CTRL, value);
> + cnt = RTW_PWR_POLLING_CNT;
> + flag = 1;
> + } else {
> + return -EBUSY;
> + }
> + } else {
> + udelay(50);
> + }
> + } while (1);
Never ending loops in kernel are dangerous. I would add some kind of
fail safe to "while (1)", for example max number of loops or some time
based limit.
--
Kalle Valo
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox