Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4740028 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: force EDMG channel through debugfs"

parents 2cbcc095 a2a8d561
Loading
Loading
Loading
Loading
+90 −0
Original line number Diff line number Diff line
@@ -338,6 +338,86 @@ int wil_iftype_nl2wmi(enum nl80211_iftype type)
	return -EOPNOTSUPP;
}

int wil_spec2wmi_ch(u8 spec_ch, u8 *wmi_ch)
{
	switch (spec_ch) {
	case 1:
		*wmi_ch = WMI_CHANNEL_1;
		break;
	case 2:
		*wmi_ch = WMI_CHANNEL_2;
		break;
	case 3:
		*wmi_ch = WMI_CHANNEL_3;
		break;
	case 4:
		*wmi_ch = WMI_CHANNEL_4;
		break;
	case 5:
		*wmi_ch = WMI_CHANNEL_5;
		break;
	case 6:
		*wmi_ch = WMI_CHANNEL_6;
		break;
	case 9:
		*wmi_ch = WMI_CHANNEL_9;
		break;
	case 10:
		*wmi_ch = WMI_CHANNEL_10;
		break;
	case 11:
		*wmi_ch = WMI_CHANNEL_11;
		break;
	case 12:
		*wmi_ch = WMI_CHANNEL_12;
		break;
	default:
		return -EINVAL;
	}

	return 0;
}

int wil_wmi2spec_ch(u8 wmi_ch, u8 *spec_ch)
{
	switch (wmi_ch) {
	case WMI_CHANNEL_1:
		*spec_ch = 1;
		break;
	case WMI_CHANNEL_2:
		*spec_ch = 2;
		break;
	case WMI_CHANNEL_3:
		*spec_ch = 3;
		break;
	case WMI_CHANNEL_4:
		*spec_ch = 4;
		break;
	case WMI_CHANNEL_5:
		*spec_ch = 5;
		break;
	case WMI_CHANNEL_6:
		*spec_ch = 6;
		break;
	case WMI_CHANNEL_9:
		*spec_ch = 9;
		break;
	case WMI_CHANNEL_10:
		*spec_ch = 10;
		break;
	case WMI_CHANNEL_11:
		*spec_ch = 11;
		break;
	case WMI_CHANNEL_12:
		*spec_ch = 12;
		break;
	default:
		return -EINVAL;
	}

	return 0;
}

int wil_cid_fill_sinfo(struct wil6210_vif *vif, int cid,
		       struct station_info *sinfo)
{
@@ -1084,6 +1164,16 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,
	}
	conn.channel = ch - 1;

	if (test_bit(WMI_FW_CAPABILITY_CHANNEL_BONDING, wil->fw_capabilities))
		if (wil->force_edmg_channel) {
			rc = wil_spec2wmi_ch(wil->force_edmg_channel,
					     &conn.edmg_channel);
			if (rc)
				wil_err(wil,
					"wmi channel for channel %d not found",
					wil->force_edmg_channel);
		}

	ether_addr_copy(conn.bssid, bss->bssid);
	ether_addr_copy(conn.dst_mac, bss->bssid);

+1 −0
Original line number Diff line number Diff line
@@ -2167,6 +2167,7 @@ static const struct dbg_off dbg_wil_off[] = {
	WIL_FIELD(ring_idle_trsh, 0644,	doff_u32),
	WIL_FIELD(num_rx_status_rings, 0644,	doff_u8),
	WIL_FIELD(amsdu_en, 0644,	doff_u8),
	WIL_FIELD(force_edmg_channel, 0644,	doff_u8),
	{},
};

+4 −0
Original line number Diff line number Diff line
@@ -948,6 +948,7 @@ struct wil6210_priv {
	u8 wakeup_trigger;
	struct wil_suspend_stats suspend_stats;
	struct wil_debugfs_data dbg_data;
	u8 force_edmg_channel;

	void *platform_handle;
	struct wil_platform_ops platform_ops;
@@ -1355,6 +1356,9 @@ int wmi_start_sched_scan(struct wil6210_priv *wil,
int wmi_stop_sched_scan(struct wil6210_priv *wil);
int wmi_mgmt_tx(struct wil6210_vif *vif, const u8 *buf, size_t len);

int wil_wmi2spec_ch(u8 wmi_ch, u8 *spec_ch);
int wil_spec2wmi_ch(u8 spec_ch, u8 *wmi_ch);

int reverse_memcmp(const void *cs, const void *ct, size_t count);

/* WMI for enhanced DMA */
+22 −3
Original line number Diff line number Diff line
@@ -908,7 +908,8 @@ static void wmi_evt_connect(struct wil6210_vif *vif, int id, void *d, int len)
	struct net_device *ndev = vif_to_ndev(vif);
	struct wireless_dev *wdev = vif_to_wdev(vif);
	struct wmi_connect_event *evt = d;
	int ch; /* channel number */
	int ch; /* channel number (primary) */
	u8 spec_ch = 0; /* spec channel number */
	struct station_info sinfo;
	u8 *assoc_req_ie, *assoc_resp_ie;
	size_t assoc_req_ielen, assoc_resp_ielen;
@@ -936,8 +937,16 @@ static void wmi_evt_connect(struct wil6210_vif *vif, int id, void *d, int len)
	}

	ch = evt->channel + 1;
	if (evt->edmg_channel &&
	    test_bit(WMI_FW_CAPABILITY_CHANNEL_BONDING, wil->fw_capabilities))
		wil_wmi2spec_ch(evt->edmg_channel, &spec_ch);
	if (spec_ch)
		wil_info(wil, "Connect %pM EDMG channel [%d] primary channel [%d] cid %d aid %d\n",
			 evt->bssid, spec_ch, ch, evt->cid, evt->aid);
	else
		wil_info(wil, "Connect %pM channel [%d] cid %d aid %d\n",
			 evt->bssid, ch, evt->cid, evt->aid);

	wil_hex_dump_wmi("connect AI : ", DUMP_PREFIX_OFFSET, 16, 1,
			 evt->assoc_info, len - sizeof(*evt), true);

@@ -1683,6 +1692,16 @@ int wmi_pcp_start(struct wil6210_vif *vif,
		.evt = {.status = WMI_FW_STATUS_FAILURE},
	};

	if (test_bit(WMI_FW_CAPABILITY_CHANNEL_BONDING, wil->fw_capabilities))
		if (wil->force_edmg_channel) {
			rc = wil_spec2wmi_ch(wil->force_edmg_channel,
					     &cmd.edmg_channel);
			if (rc)
				wil_err(wil,
					"wmi channel for channel %d not found",
					wil->force_edmg_channel);
		}

	if (!vif->privacy)
		cmd.disable_sec = 1;

+30 −3
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ enum wmi_fw_capability {
	WMI_FW_CAPABILITY_LO_POWER_CALIB_FROM_OTP	= 14,
	WMI_FW_CAPABILITY_PNO				= 15,
	WMI_FW_CAPABILITY_CONNECT_SNR_THR		= 16,
	WMI_FW_CAPABILITY_CHANNEL_BONDING		= 17,
	WMI_FW_CAPABILITY_REF_CLOCK_CONTROL		= 18,
	WMI_FW_CAPABILITY_AP_SME_OFFLOAD_NONE		= 19,
	WMI_FW_CAPABILITY_AMSDU				= 23,
@@ -314,6 +315,19 @@ enum wmi_connect_ctrl_flag_bits {

#define WMI_MAX_SSID_LEN	(32)

enum wmi_channel {
	WMI_CHANNEL_1	= 0x00,
	WMI_CHANNEL_2	= 0x01,
	WMI_CHANNEL_3	= 0x02,
	WMI_CHANNEL_4	= 0x03,
	WMI_CHANNEL_5	= 0x04,
	WMI_CHANNEL_6	= 0x05,
	WMI_CHANNEL_9	= 0x06,
	WMI_CHANNEL_10	= 0x07,
	WMI_CHANNEL_11	= 0x08,
	WMI_CHANNEL_12	= 0x09,
};

/* WMI_CONNECT_CMDID */
struct wmi_connect_cmd {
	u8 network_type;
@@ -325,8 +339,12 @@ struct wmi_connect_cmd {
	u8 group_crypto_len;
	u8 ssid_len;
	u8 ssid[WMI_MAX_SSID_LEN];
	/* enum wmi_channel WMI_CHANNEL_1..WMI_CHANNEL_6; for EDMG this is
	 * the primary channel number
	 */
	u8 channel;
	u8 reserved0;
	/* enum wmi_channel WMI_CHANNEL_9..WMI_CHANNEL_12 */
	u8 edmg_channel;
	u8 bssid[WMI_MAC_LEN];
	__le32 ctrl_flags;
	u8 dst_mac[WMI_MAC_LEN];
@@ -644,12 +662,17 @@ struct wmi_pcp_start_cmd {
	u8 pcp_max_assoc_sta;
	u8 hidden_ssid;
	u8 is_go;
	u8 reserved0[5];
	/* enum wmi_channel WMI_CHANNEL_9..WMI_CHANNEL_12 */
	u8 edmg_channel;
	u8 reserved[4];
	/* A-BFT length override if non-0 */
	u8 abft_len;
	/* enum wmi_ap_sme_offload_mode_e */
	u8 ap_sme_offload_mode;
	u8 network_type;
	/* enum wmi_channel WMI_CHANNEL_1..WMI_CHANNEL_6; for EDMG this is
	 * the primary channel number
	 */
	u8 channel;
	u8 disable_sec_offload;
	u8 disable_sec;
@@ -1899,8 +1922,12 @@ struct wmi_notify_req_done_event {

/* WMI_CONNECT_EVENTID */
struct wmi_connect_event {
	/* enum wmi_channel WMI_CHANNEL_1..WMI_CHANNEL_6; for EDMG this is
	 * the primary channel number
	 */
	u8 channel;
	u8 reserved0;
	/* enum wmi_channel WMI_CHANNEL_9..WMI_CHANNEL_12 */
	u8 edmg_channel;
	u8 bssid[WMI_MAC_LEN];
	__le16 listen_interval;
	__le16 beacon_interval;