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

Commit 20d2ebe5 authored by Daniel Drake's avatar Daniel Drake Committed by John W. Linville
Browse files

libertas: Update 11d info only when interface is active



reg_notifier can be called before the interface is up.
Handle this correctly by storing the requested country code, then
apply the relevant configuration when the interface is brought up.

Signed-off-by: default avatarDaniel Drake <dsd@laptop.org>
Acked-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 08a4a1ab
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -2180,13 +2180,15 @@ int lbs_reg_notifier(struct wiphy *wiphy,
		struct regulatory_request *request)
		struct regulatory_request *request)
{
{
	struct lbs_private *priv = wiphy_priv(wiphy);
	struct lbs_private *priv = wiphy_priv(wiphy);
	int ret;
	int ret = 0;


	lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain "
	lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain "
			"callback for domain %c%c\n", request->alpha2[0],
			"callback for domain %c%c\n", request->alpha2[0],
			request->alpha2[1]);
			request->alpha2[1]);


	ret = lbs_set_11d_domain_info(priv, request, wiphy->bands);
	memcpy(priv->country_code, request->alpha2, sizeof(request->alpha2));
	if (lbs_iface_active(priv))
		ret = lbs_set_11d_domain_info(priv);


	lbs_deb_leave(LBS_DEB_CFG80211);
	lbs_deb_leave(LBS_DEB_CFG80211);
	return ret;
	return ret;
+10 −9
Original line number Original line Diff line number Diff line
@@ -733,15 +733,13 @@ int lbs_get_rssi(struct lbs_private *priv, s8 *rssi, s8 *nf)
 *  to the firmware
 *  to the firmware
 *
 *
 *  @priv:	pointer to &struct lbs_private
 *  @priv:	pointer to &struct lbs_private
 *  @request:	cfg80211 regulatory request structure
 *  @bands:	the device's supported bands and channels
 *
 *
 *  returns:	0 on success, error code on failure
 *  returns:	0 on success, error code on failure
*/
*/
int lbs_set_11d_domain_info(struct lbs_private *priv,
int lbs_set_11d_domain_info(struct lbs_private *priv)
			    struct regulatory_request *request,
			    struct ieee80211_supported_band **bands)
{
{
	struct wiphy *wiphy = priv->wdev->wiphy;
	struct ieee80211_supported_band **bands = wiphy->bands;
	struct cmd_ds_802_11d_domain_info cmd;
	struct cmd_ds_802_11d_domain_info cmd;
	struct mrvl_ie_domain_param_set *domain = &cmd.domain;
	struct mrvl_ie_domain_param_set *domain = &cmd.domain;
	struct ieee80211_country_ie_triplet *t;
	struct ieee80211_country_ie_triplet *t;
@@ -752,21 +750,23 @@ int lbs_set_11d_domain_info(struct lbs_private *priv,
	u8 first_channel = 0, next_chan = 0, max_pwr = 0;
	u8 first_channel = 0, next_chan = 0, max_pwr = 0;
	u8 i, flag = 0;
	u8 i, flag = 0;
	size_t triplet_size;
	size_t triplet_size;
	int ret;
	int ret = 0;


	lbs_deb_enter(LBS_DEB_11D);
	lbs_deb_enter(LBS_DEB_11D);
	if (!priv->country_code[0])
		goto out;


	memset(&cmd, 0, sizeof(cmd));
	memset(&cmd, 0, sizeof(cmd));
	cmd.action = cpu_to_le16(CMD_ACT_SET);
	cmd.action = cpu_to_le16(CMD_ACT_SET);


	lbs_deb_11d("Setting country code '%c%c'\n",
	lbs_deb_11d("Setting country code '%c%c'\n",
		    request->alpha2[0], request->alpha2[1]);
		    priv->country_code[0], priv->country_code[1]);


	domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);
	domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);


	/* Set country code */
	/* Set country code */
	domain->country_code[0] = request->alpha2[0];
	domain->country_code[0] = priv->country_code[0];
	domain->country_code[1] = request->alpha2[1];
	domain->country_code[1] = priv->country_code[1];
	domain->country_code[2] = ' ';
	domain->country_code[2] = ' ';


	/* Now set up the channel triplets; firmware is somewhat picky here
	/* Now set up the channel triplets; firmware is somewhat picky here
@@ -848,6 +848,7 @@ int lbs_set_11d_domain_info(struct lbs_private *priv,


	ret = lbs_cmd_with_response(priv, CMD_802_11D_DOMAIN_INFO, &cmd);
	ret = lbs_cmd_with_response(priv, CMD_802_11D_DOMAIN_INFO, &cmd);


out:
	lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
	lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
	return ret;
	return ret;
}
}
+1 −3
Original line number Original line Diff line number Diff line
@@ -128,9 +128,7 @@ int lbs_set_monitor_mode(struct lbs_private *priv, int enable);


int lbs_get_rssi(struct lbs_private *priv, s8 *snr, s8 *nf);
int lbs_get_rssi(struct lbs_private *priv, s8 *snr, s8 *nf);


int lbs_set_11d_domain_info(struct lbs_private *priv,
int lbs_set_11d_domain_info(struct lbs_private *priv);
			    struct regulatory_request *request,
			    struct ieee80211_supported_band **bands);


int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value);
int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value);


+1 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,7 @@ struct lbs_private {
	bool wiphy_registered;
	bool wiphy_registered;
	struct cfg80211_scan_request *scan_req;
	struct cfg80211_scan_request *scan_req;
	u8 assoc_bss[ETH_ALEN];
	u8 assoc_bss[ETH_ALEN];
	u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
	u8 disassoc_reason;
	u8 disassoc_reason;


	/* Mesh */
	/* Mesh */
+6 −0
Original line number Original line Diff line number Diff line
@@ -152,6 +152,12 @@ int lbs_start_iface(struct lbs_private *priv)
		goto err;
		goto err;
	}
	}


	ret = lbs_set_11d_domain_info(priv);
	if (ret) {
		lbs_deb_net("set 11d domain info failed\n");
		goto err;
	}

	lbs_update_channel(priv);
	lbs_update_channel(priv);


	priv->iface_running = true;
	priv->iface_running = true;