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

Commit fa0ecbb9 authored by Bing Zhao's avatar Bing Zhao Committed by John W. Linville
Browse files

mwifiex: remove global variable cmd_wait_q_required



There is a race condition while queuing synchronous command and
asynchronous command requested from different threads, because
the wait_q_enabled flag is set based on a global variable
cmd_wait_q_required.

The issue is fixed by removing this global variable and using a
unified function with an argument 'sync' passed into the
function.

Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6b7dce12
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -73,8 +73,8 @@ static int mwifiex_11h_activate(struct mwifiex_private *priv, bool flag)
{
{
	u32 enable = flag;
	u32 enable = flag;


	return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
	return mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
				     HostCmd_ACT_GEN_SET, DOT11H_I, &enable);
				HostCmd_ACT_GEN_SET, DOT11H_I, &enable, true);
}
}


/* This functions processes TLV buffer for a pending BSS Join command.
/* This functions processes TLV buffer for a pending BSS Join command.
+4 −4
Original line number Original line Diff line number Diff line
@@ -574,8 +574,8 @@ int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac)
	memcpy(&add_ba_req.peer_mac_addr, peer_mac, ETH_ALEN);
	memcpy(&add_ba_req.peer_mac_addr, peer_mac, ETH_ALEN);


	/* We don't wait for the response of this command */
	/* We don't wait for the response of this command */
	ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_ADDBA_REQ,
	ret = mwifiex_send_cmd(priv, HostCmd_CMD_11N_ADDBA_REQ,
				     0, 0, &add_ba_req);
			       0, 0, &add_ba_req, false);


	return ret;
	return ret;
}
}
@@ -602,8 +602,8 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac,
	memcpy(&delba.peer_mac_addr, peer_mac, ETH_ALEN);
	memcpy(&delba.peer_mac_addr, peer_mac, ETH_ALEN);


	/* We don't wait for the response of this command */
	/* We don't wait for the response of this command */
	ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_DELBA,
	ret = mwifiex_send_cmd(priv, HostCmd_CMD_11N_DELBA,
				     HostCmd_ACT_GEN_SET, 0, &delba);
			       HostCmd_ACT_GEN_SET, 0, &delba, false);


	return ret;
	return ret;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -650,7 +650,7 @@ void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv,
	delba.del_ba_param_set |= cpu_to_le16(
	delba.del_ba_param_set |= cpu_to_le16(
		(u16) event->origninator << DELBA_INITIATOR_POS);
		(u16) event->origninator << DELBA_INITIATOR_POS);
	delba.reason_code = cpu_to_le16(WLAN_REASON_QSTA_TIMEOUT);
	delba.reason_code = cpu_to_le16(WLAN_REASON_QSTA_TIMEOUT);
	mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_DELBA, 0, 0, &delba);
	mwifiex_send_cmd(priv, HostCmd_CMD_11N_DELBA, 0, 0, &delba, false);
}
}


/*
/*
+81 −86
Original line number Original line Diff line number Diff line
@@ -252,9 +252,9 @@ mwifiex_cfg80211_mgmt_frame_register(struct wiphy *wiphy,


	if (mask != priv->mgmt_frame_mask) {
	if (mask != priv->mgmt_frame_mask) {
		priv->mgmt_frame_mask = mask;
		priv->mgmt_frame_mask = mask;
		mwifiex_send_cmd_async(priv, HostCmd_CMD_MGMT_FRAME_REG,
		mwifiex_send_cmd(priv, HostCmd_CMD_MGMT_FRAME_REG,
				 HostCmd_ACT_GEN_SET, 0,
				 HostCmd_ACT_GEN_SET, 0,
				       &priv->mgmt_frame_mask);
				 &priv->mgmt_frame_mask, false);
		wiphy_dbg(wiphy, "info: mgmt frame registered\n");
		wiphy_dbg(wiphy, "info: mgmt frame registered\n");
	}
	}
}
}
@@ -515,8 +515,8 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)


	priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
	priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);


	if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_802_11D_DOMAIN_INFO,
				   HostCmd_ACT_GEN_SET, 0, NULL)) {
			     HostCmd_ACT_GEN_SET, 0, NULL, false)) {
		wiphy_err(wiphy, "11D: setting domain info in FW\n");
		wiphy_err(wiphy, "11D: setting domain info in FW\n");
		return -1;
		return -1;
	}
	}
@@ -580,9 +580,9 @@ mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr)
	    frag_thr > MWIFIEX_FRAG_MAX_VALUE)
	    frag_thr > MWIFIEX_FRAG_MAX_VALUE)
		frag_thr = MWIFIEX_FRAG_MAX_VALUE;
		frag_thr = MWIFIEX_FRAG_MAX_VALUE;


	return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
	return mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
				HostCmd_ACT_GEN_SET, FRAG_THRESH_I,
				HostCmd_ACT_GEN_SET, FRAG_THRESH_I,
				     &frag_thr);
				&frag_thr, true);
}
}


/*
/*
@@ -597,9 +597,9 @@ mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr)
	if (rts_thr < MWIFIEX_RTS_MIN_VALUE || rts_thr > MWIFIEX_RTS_MAX_VALUE)
	if (rts_thr < MWIFIEX_RTS_MIN_VALUE || rts_thr > MWIFIEX_RTS_MAX_VALUE)
		rts_thr = MWIFIEX_RTS_MAX_VALUE;
		rts_thr = MWIFIEX_RTS_MAX_VALUE;


	return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
	return mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
				HostCmd_ACT_GEN_SET, RTS_THRESH_I,
				HostCmd_ACT_GEN_SET, RTS_THRESH_I,
				    &rts_thr);
				&rts_thr, true);
}
}


/*
/*
@@ -637,20 +637,19 @@ mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)


			bss_started = priv->bss_started;
			bss_started = priv->bss_started;


			ret = mwifiex_send_cmd_sync(priv,
			ret = mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_STOP,
						    HostCmd_CMD_UAP_BSS_STOP,
					       HostCmd_ACT_GEN_SET, 0,
					       HostCmd_ACT_GEN_SET, 0,
						    NULL);
					       NULL, true);
			if (ret) {
			if (ret) {
				wiphy_err(wiphy, "Failed to stop the BSS\n");
				wiphy_err(wiphy, "Failed to stop the BSS\n");
				kfree(bss_cfg);
				kfree(bss_cfg);
				return ret;
				return ret;
			}
			}


			ret = mwifiex_send_cmd_async(priv,
			ret = mwifiex_send_cmd(priv, HostCmd_CMD_UAP_SYS_CONFIG,
						     HostCmd_CMD_UAP_SYS_CONFIG,
					       HostCmd_ACT_GEN_SET,
					       HostCmd_ACT_GEN_SET,
						     UAP_BSS_PARAMS_I, bss_cfg);
					       UAP_BSS_PARAMS_I, bss_cfg,
					       false);


			kfree(bss_cfg);
			kfree(bss_cfg);


@@ -662,10 +661,9 @@ mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
			if (!bss_started)
			if (!bss_started)
				break;
				break;


			ret = mwifiex_send_cmd_async(priv,
			ret = mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_START,
						     HostCmd_CMD_UAP_BSS_START,
					       HostCmd_ACT_GEN_SET, 0,
					       HostCmd_ACT_GEN_SET, 0,
						     NULL);
					       NULL, false);
			if (ret) {
			if (ret) {
				wiphy_err(wiphy, "Failed to start BSS\n");
				wiphy_err(wiphy, "Failed to start BSS\n");
				return ret;
				return ret;
@@ -700,8 +698,8 @@ mwifiex_cfg80211_deinit_p2p(struct mwifiex_private *priv)
	if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA)
	if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA)
		mwifiex_set_bss_role(priv, MWIFIEX_BSS_ROLE_STA);
		mwifiex_set_bss_role(priv, MWIFIEX_BSS_ROLE_STA);


	if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_P2P_MODE_CFG,
				  HostCmd_ACT_GEN_SET, 0, &mode))
			     HostCmd_ACT_GEN_SET, 0, &mode, true))
		return -1;
		return -1;


	return 0;
	return 0;
@@ -721,13 +719,13 @@ mwifiex_cfg80211_init_p2p_client(struct mwifiex_private *priv)
		return -1;
		return -1;


	mode = P2P_MODE_DEVICE;
	mode = P2P_MODE_DEVICE;
	if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_P2P_MODE_CFG,
				  HostCmd_ACT_GEN_SET, 0, &mode))
			     HostCmd_ACT_GEN_SET, 0, &mode, true))
		return -1;
		return -1;


	mode = P2P_MODE_CLIENT;
	mode = P2P_MODE_CLIENT;
	if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_P2P_MODE_CFG,
				  HostCmd_ACT_GEN_SET, 0, &mode))
			     HostCmd_ACT_GEN_SET, 0, &mode, true))
		return -1;
		return -1;


	return 0;
	return 0;
@@ -747,13 +745,13 @@ mwifiex_cfg80211_init_p2p_go(struct mwifiex_private *priv)
		return -1;
		return -1;


	mode = P2P_MODE_DEVICE;
	mode = P2P_MODE_DEVICE;
	if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_P2P_MODE_CFG,
				  HostCmd_ACT_GEN_SET, 0, &mode))
			     HostCmd_ACT_GEN_SET, 0, &mode, true))
		return -1;
		return -1;


	mode = P2P_MODE_GO;
	mode = P2P_MODE_GO;
	if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_P2P_MODE_CFG,
				  HostCmd_ACT_GEN_SET, 0, &mode))
			     HostCmd_ACT_GEN_SET, 0, &mode, true))
		return -1;
		return -1;


	if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP)
	if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP)
@@ -853,8 +851,8 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,


	priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM;
	priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM;


	ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_SET_BSS_MODE,
	ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
				    HostCmd_ACT_GEN_SET, 0, NULL);
			       HostCmd_ACT_GEN_SET, 0, NULL, true);


	return ret;
	return ret;
}
}
@@ -942,8 +940,8 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
			STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
			STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;


	/* Get signal information from the firmware */
	/* Get signal information from the firmware */
	if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_RSSI_INFO,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
				  HostCmd_ACT_GEN_GET, 0, NULL)) {
			     HostCmd_ACT_GEN_GET, 0, NULL, true)) {
		dev_err(priv->adapter->dev, "failed to get signal information\n");
		dev_err(priv->adapter->dev, "failed to get signal information\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -954,9 +952,9 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
	}
	}


	/* Get DTIM period information from firmware */
	/* Get DTIM period information from firmware */
	mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
	mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
			 HostCmd_ACT_GEN_GET, DTIM_PERIOD_I,
			 HostCmd_ACT_GEN_GET, DTIM_PERIOD_I,
			      &priv->dtim_period);
			 &priv->dtim_period, true);


	mwifiex_parse_htinfo(priv, priv->tx_htinfo, &sinfo->txrate);
	mwifiex_parse_htinfo(priv, priv->tx_htinfo, &sinfo->txrate);


@@ -1186,8 +1184,8 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
	if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2)
	if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2)
		bitmap_rates[2] |= mask->control[band].ht_mcs[1] << 8;
		bitmap_rates[2] |= mask->control[band].ht_mcs[1] << 8;


	return mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG,
	return mwifiex_send_cmd(priv, HostCmd_CMD_TX_RATE_CFG,
				     HostCmd_ACT_GEN_SET, 0, bitmap_rates);
				HostCmd_ACT_GEN_SET, 0, bitmap_rates, true);
}
}


/*
/*
@@ -1216,14 +1214,14 @@ static int mwifiex_cfg80211_set_cqm_rssi_config(struct wiphy *wiphy,
		subsc_evt.bcn_h_rssi_cfg.abs_value = abs(rssi_thold);
		subsc_evt.bcn_h_rssi_cfg.abs_value = abs(rssi_thold);
		subsc_evt.bcn_l_rssi_cfg.evt_freq = 1;
		subsc_evt.bcn_l_rssi_cfg.evt_freq = 1;
		subsc_evt.bcn_h_rssi_cfg.evt_freq = 1;
		subsc_evt.bcn_h_rssi_cfg.evt_freq = 1;
		return mwifiex_send_cmd_sync(priv,
		return mwifiex_send_cmd(priv,
					HostCmd_CMD_802_11_SUBSCRIBE_EVENT,
					HostCmd_CMD_802_11_SUBSCRIBE_EVENT,
					     0, 0, &subsc_evt);
					0, 0, &subsc_evt, true);
	} else {
	} else {
		subsc_evt.action = HostCmd_ACT_BITWISE_CLR;
		subsc_evt.action = HostCmd_ACT_BITWISE_CLR;
		return mwifiex_send_cmd_sync(priv,
		return mwifiex_send_cmd(priv,
					HostCmd_CMD_802_11_SUBSCRIBE_EVENT,
					HostCmd_CMD_802_11_SUBSCRIBE_EVENT,
					     0, 0, &subsc_evt);
					0, 0, &subsc_evt, true);
	}
	}


	return 0;
	return 0;
@@ -1276,10 +1274,9 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
	if (!mac || is_broadcast_ether_addr(mac)) {
	if (!mac || is_broadcast_ether_addr(mac)) {
		wiphy_dbg(wiphy, "%s: NULL/broadcast mac address\n", __func__);
		wiphy_dbg(wiphy, "%s: NULL/broadcast mac address\n", __func__);
		list_for_each_entry(sta_node, &priv->sta_list, list) {
		list_for_each_entry(sta_node, &priv->sta_list, list) {
			if (mwifiex_send_cmd_sync(priv,
			if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_STA_DEAUTH,
						  HostCmd_CMD_UAP_STA_DEAUTH,
					     HostCmd_ACT_GEN_SET, 0,
					     HostCmd_ACT_GEN_SET, 0,
						  sta_node->mac_addr))
					     sta_node->mac_addr, true))
				return -1;
				return -1;
			mwifiex_uap_del_sta_data(priv, sta_node);
			mwifiex_uap_del_sta_data(priv, sta_node);
		}
		}
@@ -1289,10 +1286,9 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
		sta_node = mwifiex_get_sta_entry(priv, mac);
		sta_node = mwifiex_get_sta_entry(priv, mac);
		spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
		spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
		if (sta_node) {
		if (sta_node) {
			if (mwifiex_send_cmd_sync(priv,
			if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_STA_DEAUTH,
						  HostCmd_CMD_UAP_STA_DEAUTH,
					     HostCmd_ACT_GEN_SET, 0,
					     HostCmd_ACT_GEN_SET, 0,
						  sta_node->mac_addr))
					     sta_node->mac_addr, true))
				return -1;
				return -1;
			mwifiex_uap_del_sta_data(priv, sta_node);
			mwifiex_uap_del_sta_data(priv, sta_node);
		}
		}
@@ -1333,8 +1329,8 @@ mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
	ant_cfg.tx_ant = tx_ant;
	ant_cfg.tx_ant = tx_ant;
	ant_cfg.rx_ant = rx_ant;
	ant_cfg.rx_ant = rx_ant;


	return mwifiex_send_cmd_sync(priv, HostCmd_CMD_RF_ANTENNA,
	return mwifiex_send_cmd(priv, HostCmd_CMD_RF_ANTENNA,
				     HostCmd_ACT_GEN_SET, 0, &ant_cfg);
				HostCmd_ACT_GEN_SET, 0, &ant_cfg, true);
}
}


/* cfg80211 operation handler for stop ap.
/* cfg80211 operation handler for stop ap.
@@ -1349,8 +1345,8 @@ static int mwifiex_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)


	priv->ap_11n_enabled = 0;
	priv->ap_11n_enabled = 0;


	if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_STOP,
				  HostCmd_ACT_GEN_SET, 0, NULL)) {
			     HostCmd_ACT_GEN_SET, 0, NULL, true)) {
		wiphy_err(wiphy, "Failed to stop the BSS\n");
		wiphy_err(wiphy, "Failed to stop the BSS\n");
		return -1;
		return -1;
	}
	}
@@ -1461,16 +1457,16 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
		bss_cfg->ps_sta_ao_timer = 10 * params->inactivity_timeout;
		bss_cfg->ps_sta_ao_timer = 10 * params->inactivity_timeout;
	}
	}


	if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_STOP,
				  HostCmd_ACT_GEN_SET, 0, NULL)) {
			     HostCmd_ACT_GEN_SET, 0, NULL, true)) {
		wiphy_err(wiphy, "Failed to stop the BSS\n");
		wiphy_err(wiphy, "Failed to stop the BSS\n");
		kfree(bss_cfg);
		kfree(bss_cfg);
		return -1;
		return -1;
	}
	}


	if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_SYS_CONFIG,
			     HostCmd_ACT_GEN_SET,
			     HostCmd_ACT_GEN_SET,
				   UAP_BSS_PARAMS_I, bss_cfg)) {
			     UAP_BSS_PARAMS_I, bss_cfg, false)) {
		wiphy_err(wiphy, "Failed to set the SSID\n");
		wiphy_err(wiphy, "Failed to set the SSID\n");
		kfree(bss_cfg);
		kfree(bss_cfg);
		return -1;
		return -1;
@@ -1478,8 +1474,8 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,


	kfree(bss_cfg);
	kfree(bss_cfg);


	if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_BSS_START,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_START,
				   HostCmd_ACT_GEN_SET, 0, NULL)) {
			     HostCmd_ACT_GEN_SET, 0, NULL, false)) {
		wiphy_err(wiphy, "Failed to start the BSS\n");
		wiphy_err(wiphy, "Failed to start the BSS\n");
		return -1;
		return -1;
	}
	}
@@ -1489,9 +1485,9 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
	else
	else
		priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_WEP_ENABLE;
		priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_WEP_ENABLE;


	if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_MAC_CONTROL,
	if (mwifiex_send_cmd(priv, HostCmd_CMD_MAC_CONTROL,
			     HostCmd_ACT_GEN_SET, 0,
			     HostCmd_ACT_GEN_SET, 0,
				  &priv->curr_pkt_filter))
			     &priv->curr_pkt_filter, true))
		return -1;
		return -1;


	return 0;
	return 0;
@@ -2459,9 +2455,8 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
				   MWIFIEX_CRITERIA_UNICAST |
				   MWIFIEX_CRITERIA_UNICAST |
				   MWIFIEX_CRITERIA_MULTICAST;
				   MWIFIEX_CRITERIA_MULTICAST;


	ret =  mwifiex_send_cmd_sync(priv, HostCmd_CMD_MEF_CFG,
	ret = mwifiex_send_cmd(priv, HostCmd_CMD_MEF_CFG,
				     HostCmd_ACT_GEN_SET, 0,
			       HostCmd_ACT_GEN_SET, 0, &mef_cfg, true);
				     &mef_cfg);


	kfree(mef_entry);
	kfree(mef_entry);
	return ret;
	return ret;
@@ -2573,9 +2568,9 @@ static int mwifiex_cfg80211_set_coalesce(struct wiphy *wiphy,
	if (!coalesce) {
	if (!coalesce) {
		dev_dbg(adapter->dev,
		dev_dbg(adapter->dev,
			"Disable coalesce and reset all previous rules\n");
			"Disable coalesce and reset all previous rules\n");
		return mwifiex_send_cmd_sync(priv, HostCmd_CMD_COALESCE_CFG,
		return mwifiex_send_cmd(priv, HostCmd_CMD_COALESCE_CFG,
					HostCmd_ACT_GEN_SET, 0,
					HostCmd_ACT_GEN_SET, 0,
					     &coalesce_cfg);
					&coalesce_cfg, true);
	}
	}


	coalesce_cfg.num_of_rules = coalesce->n_rules;
	coalesce_cfg.num_of_rules = coalesce->n_rules;
@@ -2590,8 +2585,8 @@ static int mwifiex_cfg80211_set_coalesce(struct wiphy *wiphy,
		}
		}
	}
	}


	return mwifiex_send_cmd_sync(priv, HostCmd_CMD_COALESCE_CFG,
	return mwifiex_send_cmd(priv, HostCmd_CMD_COALESCE_CFG,
				     HostCmd_ACT_GEN_SET, 0, &coalesce_cfg);
				HostCmd_ACT_GEN_SET, 0, &coalesce_cfg, true);
}
}


/* cfg80211 ops handler for tdls_mgmt.
/* cfg80211 ops handler for tdls_mgmt.
@@ -2940,17 +2935,17 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
				   country_code);
				   country_code);
	}
	}


	mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
	mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
			      HostCmd_ACT_GEN_GET, FRAG_THRESH_I, &thr);
			 HostCmd_ACT_GEN_GET, FRAG_THRESH_I, &thr, true);
	wiphy->frag_threshold = thr;
	wiphy->frag_threshold = thr;
	mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
	mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
			      HostCmd_ACT_GEN_GET, RTS_THRESH_I, &thr);
			 HostCmd_ACT_GEN_GET, RTS_THRESH_I, &thr, true);
	wiphy->rts_threshold = thr;
	wiphy->rts_threshold = thr;
	mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
	mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
			      HostCmd_ACT_GEN_GET, SHORT_RETRY_LIM_I, &retry);
			 HostCmd_ACT_GEN_GET, SHORT_RETRY_LIM_I, &retry, true);
	wiphy->retry_short = (u8) retry;
	wiphy->retry_short = (u8) retry;
	mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
	mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
			      HostCmd_ACT_GEN_GET, LONG_RETRY_LIM_I, &retry);
			 HostCmd_ACT_GEN_GET, LONG_RETRY_LIM_I, &retry, true);
	wiphy->retry_long = (u8) retry;
	wiphy->retry_long = (u8) retry;


	adapter->wiphy = wiphy;
	adapter->wiphy = wiphy;
+7 −29
Original line number Original line Diff line number Diff line
@@ -37,13 +37,12 @@
static void
static void
mwifiex_init_cmd_node(struct mwifiex_private *priv,
mwifiex_init_cmd_node(struct mwifiex_private *priv,
		      struct cmd_ctrl_node *cmd_node,
		      struct cmd_ctrl_node *cmd_node,
		      u32 cmd_oid, void *data_buf)
		      u32 cmd_oid, void *data_buf, bool sync)
{
{
	cmd_node->priv = priv;
	cmd_node->priv = priv;
	cmd_node->cmd_oid = cmd_oid;
	cmd_node->cmd_oid = cmd_oid;
	if (priv->adapter->cmd_wait_q_required) {
	if (sync) {
		cmd_node->wait_q_enabled = priv->adapter->cmd_wait_q_required;
		cmd_node->wait_q_enabled = true;
		priv->adapter->cmd_wait_q_required = false;
		cmd_node->cmd_wait_q_woken = false;
		cmd_node->cmd_wait_q_woken = false;
		cmd_node->condition = &cmd_node->cmd_wait_q_woken;
		cmd_node->condition = &cmd_node->cmd_wait_q_woken;
	}
	}
@@ -480,28 +479,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
}
}


/*
/*
 * This function is used to send synchronous command to the firmware.
 * This function prepares a command and send it to the firmware.
 *
 * it allocates a wait queue for the command and wait for the command
 * response.
 */
int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no,
			  u16 cmd_action, u32 cmd_oid, void *data_buf)
{
	int ret = 0;
	struct mwifiex_adapter *adapter = priv->adapter;

	adapter->cmd_wait_q_required = true;

	ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid,
				     data_buf);

	return ret;
}


/*
 * This function prepares a command and asynchronously send it to the firmware.
 *
 *
 * Preparation includes -
 * Preparation includes -
 *      - Sanity tests to make sure the card is still present or the FW
 *      - Sanity tests to make sure the card is still present or the FW
@@ -511,8 +489,8 @@ int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no,
 *      - Fill up the non-default parameters and buffer pointers
 *      - Fill up the non-default parameters and buffer pointers
 *      - Add the command to pending queue
 *      - Add the command to pending queue
 */
 */
int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
			   u16 cmd_action, u32 cmd_oid, void *data_buf)
		     u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync)
{
{
	int ret;
	int ret;
	struct mwifiex_adapter *adapter = priv->adapter;
	struct mwifiex_adapter *adapter = priv->adapter;
@@ -550,7 +528,7 @@ int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
	}
	}


	/* Initialize the command node */
	/* Initialize the command node */
	mwifiex_init_cmd_node(priv, cmd_node, cmd_oid, data_buf);
	mwifiex_init_cmd_node(priv, cmd_node, cmd_oid, data_buf, sync);


	if (!cmd_node->cmd_skb) {
	if (!cmd_node->cmd_skb) {
		dev_err(adapter->dev, "PREP_CMD: no free cmd buf\n");
		dev_err(adapter->dev, "PREP_CMD: no free cmd buf\n");
Loading