Skip to contentSkip to conversation

ath10k: Report low ack rssi based on the reason code

PATCH In review Rakesh Pillai 3 participants 4 messages Apr 3, 2019 – Oct 3, 2019 1 message not in the archive Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ath10k: Report low ack rssi based on the reason code

Firmware sends peer sta kickout event to the driver along with the reason code for a particular peer.

Currently the sta kickout event is delivered to the upper layer without checking if the reason code is valid or not. This causes frequent disconnection of the STA.

Report low ack rssi event to mac80211 only if the reason code is valid.

Tested HW: WCN3990
Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1

---
Changes from v1:
- Added reason code in tlv structure, so that it does not break non-tlv wmi event parsing.

---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  4 +++-
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  5 +++++
 drivers/net/wireless/ath/ath10k/wmi.c     |  9 ++++++---
 drivers/net/wireless/ath/ath10k/wmi.h     | 11 +++++++++++
 4 files changed, 25 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +3 -1
index 582fb11..9d6ee92 100644
@@ -876,7 +876,7 @@ static int ath10k_wmi_tlv_op_pull_peer_kick_ev(struct ath10k *ar,
 					       struct wmi_peer_kick_ev_arg *arg)
 {
 	const void **tb;
-	const struct wmi_peer_sta_kickout_event *ev;
+	const struct wmi_tlv_peer_sta_kickout_event *ev;
 	int ret;
 
 	tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC);
@@ -893,6 +893,8 @@ static int ath10k_wmi_tlv_op_pull_peer_kick_ev(struct ath10k *ar,
 	}
 
 	arg->mac_addr = ev->peer_macaddr.addr;
+	arg->reason = __le32_to_cpu(ev->reason);
+	arg->reason_code_valid = true;
 
 	kfree(tb);
 	return 0;
drivers/net/wireless/ath/ath10k/wmi-tlv.h +5 -0
index 65e6aa5..be68ac6 100644
@@ -1984,6 +1984,11 @@ struct wmi_tlv_diag_data_ev {
 	__le32 num_items;
 } __packed;
 
+struct wmi_tlv_peer_sta_kickout_event {
+	struct wmi_mac_addr peer_macaddr;
+	__le32 reason;
+} __packed;
+
 struct wmi_tlv_sta_keepalive_cmd {
 	__le32 vdev_id;
 	__le32 enabled;
drivers/net/wireless/ath/ath10k/wmi.c +6 -3
index 98a90e4..6603c31 100644
@@ -3428,9 +3428,6 @@ void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb)
 		return;
 	}
 
-	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event peer sta kickout %pM\n",
-		   arg.mac_addr);
-
 	rcu_read_lock();
 
 	sta = ieee80211_find_sta_by_ifaddr(ar->hw, arg.mac_addr, NULL);
@@ -3440,6 +3437,12 @@ void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb)
 		goto exit;
 	}
 
+	if (arg.reason_code_valid &&
+	    arg.reason == WMI_PEER_STA_KICKOUT_REASON_UNSPECIFIED)
+		goto exit;
+
+	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event peer sta kickout %pM reason code %d\n",
+		   arg.mac_addr, arg.reason);
 	ieee80211_report_low_ack(sta, 10);
 
 exit:
drivers/net/wireless/ath/ath10k/wmi.h +11 -0
index e1c40bb..3ccd79e 100644
@@ -6797,6 +6797,8 @@ struct wmi_vdev_start_ev_arg {
 
 struct wmi_peer_kick_ev_arg {
 	const u8 *mac_addr;
+	u32 reason;
+	bool reason_code_valid;
 };
 
 struct wmi_swba_ev_arg {
@@ -6887,6 +6889,15 @@ struct wmi_pdev_bss_chan_info_event {
 	__le32 reserved;
 } __packed;
 
+enum wmi_peer_sta_kickout_reason {
+	WMI_PEER_STA_KICKOUT_REASON_UNSPECIFIED,
+	WMI_PEER_STA_KICKOUT_REASON_XRETRY,
+	WMI_PEER_STA_KICKOUT_REASON_INACTIVITY,
+	WMI_PEER_STA_KICKOUT_REASON_IBSS_DISCONNECT,
+	WMI_PEER_STA_KICKOUT_REASON_TDLS_DISCONNECT,
+	WMI_PEER_STA_KICKOUT_REASON_SA_QUERY_TIMEOUT,
+};
+
 /* WOW structures */
 enum wmi_wow_wakeup_event {
 	WOW_BMISS_EVENT = 0,
Signature · 1 line
2.7.4
#1 lore raw
Quoted 78 lines · Rakesh Pillai

Firmware sends peer sta kickout event to the driver along with the reason code for a particular peer.

Currently the sta kickout event is delivered to the upper layer without checking if the reason code is valid or not. This causes frequent disconnection of the STA.

Report low ack rssi event to mac80211 only if the reason code is valid.

Tested HW: WCN3990
Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1

---
Changes from v1:
- Added reason code in tlv structure, so that it does not break non-tlv wmi event parsing.

---
  drivers/net/wireless/ath/ath10k/wmi-tlv.c |  4 +++-
  drivers/net/wireless/ath/ath10k/wmi-tlv.h |  5 +++++
  drivers/net/wireless/ath/ath10k/wmi.c     |  9 ++++++---
  drivers/net/wireless/ath/ath10k/wmi.h     | 11 +++++++++++
  4 files changed, 25 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +3 -1
index 582fb11..9d6ee92 100644
@@ -876,7 +876,7 @@ static int ath10k_wmi_tlv_op_pull_peer_kick_ev(struct ath10k *ar,
  					       struct wmi_peer_kick_ev_arg *arg)
  {
  	const void **tb;
-	const struct wmi_peer_sta_kickout_event *ev;
+	const struct wmi_tlv_peer_sta_kickout_event *ev;
  	int ret;
 
  	tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC);
@@ -893,6 +893,8 @@ static int ath10k_wmi_tlv_op_pull_peer_kick_ev(struct ath10k *ar,
  	}
 
  	arg->mac_addr = ev->peer_macaddr.addr;
+	arg->reason = __le32_to_cpu(ev->reason);
+	arg->reason_code_valid = true;
 
  	kfree(tb);
  	return 0;
drivers/net/wireless/ath/ath10k/wmi-tlv.h +5 -0
index 65e6aa5..be68ac6 100644
@@ -1984,6 +1984,11 @@ struct wmi_tlv_diag_data_ev {
  	__le32 num_items;
  } __packed;
 
+struct wmi_tlv_peer_sta_kickout_event {
+	struct wmi_mac_addr peer_macaddr;
+	__le32 reason;
+} __packed;
+
  struct wmi_tlv_sta_keepalive_cmd {
  	__le32 vdev_id;
  	__le32 enabled;
drivers/net/wireless/ath/ath10k/wmi.c +0 -3
index 98a90e4..6603c31 100644
@@ -3428,9 +3428,6 @@ void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb)
  		return;
  	}
 
-	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event peer sta kickout %pM\n",
-		   arg.mac_addr);
-
  	rcu_read_lock();
 
  	sta = ieee80211_find_sta_by_ifaddr(ar->hw, arg.mac_addr, NULL);

drivers/net/wireless/ath/ath10k/wmi.c void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb) · line 3443

Quoted 7 lines
drivers/net/wireless/ath/ath10k/wmi.c +4 -0
@@ -3440,6 +3437,12 @@ void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb)
  		goto exit;
  	}
 
+	if (arg.reason_code_valid &&
+	    arg.reason == WMI_PEER_STA_KICKOUT_REASON_UNSPECIFIED)
+		goto exit;
+

Why do we want this event not to be delivered to user space?

Quoted 10 lines
drivers/net/wireless/ath/ath10k/wmi.c +2 -0
+	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event peer sta kickout %pM reason code %d\n",
+		   arg.mac_addr, arg.reason);
  	ieee80211_report_low_ack(sta, 10);
 
  exit:
drivers/net/wireless/ath/ath10k/wmi.h +0 -0
index e1c40bb..3ccd79e 100644

drivers/net/wireless/ath/ath10k/wmi.h struct wmi_vdev_start_ev_arg { · line 6803

Quoted 7 lines
drivers/net/wireless/ath/ath10k/wmi.h +2 -0
@@ -6797,6 +6797,8 @@ struct wmi_vdev_start_ev_arg {
 
  struct wmi_peer_kick_ev_arg {
  	const u8 *mac_addr;
+	u32 reason;
+	bool reason_code_valid;
  };
 

Adding extra members to this structure breaks structure consistency between FW and host driver since FW doesn't have such members.

Peter

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 15 lines

drivers/net/wireless/ath/ath10k/wmi.h struct wmi_vdev_start_ev_arg { · line 6803

Quoted 12 lines
drivers/net/wireless/ath/ath10k/wmi.h +2 -0
index e1c40bb..3ccd79e 100644
@@ -6797,6 +6797,8 @@ struct wmi_vdev_start_ev_arg {
 
  struct wmi_peer_kick_ev_arg {
  	const u8 *mac_addr;
+	u32 reason;
+	bool reason_code_valid;
  };
 

Adding extra members to this structure breaks structure consistency between FW and host driver since FW doesn't have such members.

Quoted 5 lines

Peter
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

struct wmi_peer_sta_kickout_event is used for parsing event from non-tlv firmwares and struct wmi_tlv_peer_sta_kickout_event is used for parsing event from tlv firmwares. Both of the above structures maintain consistency with the respective FW.

struct wmi_peer_kick_ev_arg is used only for internal ath10k operations only.

Thanks,
Rakesh Pillai.

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

#4 lore raw
In reply to Peter Oh
Quoted 16 lines · Peter Oh
Quoted 15 lines · Rakesh Pillai

Firmware sends peer sta kickout event to the driver along with the reason code for a particular peer.

Currently the sta kickout event is delivered to the upper layer without checking if the reason code is valid or not. This causes frequent disconnection of the STA.

Report low ack rssi event to mac80211 only if the reason code is valid.

Tested HW: WCN3990
Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1

[...]

Quoted 10 lines

drivers/net/wireless/ath/ath10k/wmi.c void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb) · line 3443

Quoted 8 lines
drivers/net/wireless/ath/ath10k/wmi.c +4 -0
@@ -3440,6 +3437,12 @@ void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb)
  		goto exit;
  	}
 
+	if (arg.reason_code_valid &&
+	    arg.reason == WMI_PEER_STA_KICKOUT_REASON_UNSPECIFIED)
+		goto exit;
+

Why do we want this event not to be delivered to user space?

Yeah, I'm curious about that as well. If I'm guessing right, WMI_PEER_STA_KICKOUT_REASON_UNSPECIFIED is supposed to mean that the firmware does not support providing the reason code. Usually, but not always, in the firmware interface value zero means unsupported. So why would we want to ignore a kickout event which has a valid mac address for the peer?

In what kind of cases is the firmware emitting these events? Is this really the correct thing to do?

Quoted 11 lines
Quoted 11 lines
drivers/net/wireless/ath/ath10k/wmi.c +2 -0
+	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event peer sta kickout %pM reason code %d\n",
+		   arg.mac_addr, arg.reason);
  	ieee80211_report_low_ack(sta, 10);
 
  exit:
drivers/net/wireless/ath/ath10k/wmi.h +0 -0
index e1c40bb..3ccd79e 100644
@@ -6797,6 +6797,8 @@ struct wmi_vdev_start_ev_arg {
 
Quoted 8 lines

drivers/net/wireless/ath/ath10k/wmi.h struct wmi_vdev_start_ev_arg { · line 6802

Quoted 5 lines
drivers/net/wireless/ath/ath10k/wmi.h +2 -0
  struct wmi_peer_kick_ev_arg {
  	const u8 *mac_addr;
+	u32 reason;
+	bool reason_code_valid;
  };

Adding extra members to this structure breaks structure consistency between FW and host driver since FW doesn't have such members.

Yeah, this reason_code_valid boolean is set if WMI-TLV is used, but it does not still mean that the reason code is valid. (There might be WMI-TLV firmwares which do not provide the reason code.)

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches