mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
iwlwifi: rewrite RXON checks
The RXON checking is a bit magical, and prints out too much information if something goes wrong. Make it less magical and print out only the items that were actually wrong. Also remove the comment about removing it -- the driver is constantly changing so these checks are useful. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
34f5a70c08
commit
dacefedb34
@ -510,76 +510,74 @@ void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(iwl_set_rxon_hwcrypto);
|
EXPORT_SYMBOL(iwl_set_rxon_hwcrypto);
|
||||||
|
|
||||||
/**
|
/* validate RXON structure is valid */
|
||||||
* iwl_check_rxon_cmd - validate RXON structure is valid
|
|
||||||
*
|
|
||||||
* NOTE: This is really only useful during development and can eventually
|
|
||||||
* be #ifdef'd out once the driver is stable and folks aren't actively
|
|
||||||
* making changes
|
|
||||||
*/
|
|
||||||
int iwl_check_rxon_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
|
int iwl_check_rxon_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
|
||||||
{
|
{
|
||||||
int error = 0;
|
|
||||||
int counter = 1;
|
|
||||||
struct iwl_rxon_cmd *rxon = &ctx->staging;
|
struct iwl_rxon_cmd *rxon = &ctx->staging;
|
||||||
|
bool error = false;
|
||||||
|
|
||||||
if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
|
if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
|
||||||
error |= le32_to_cpu(rxon->flags &
|
if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) {
|
||||||
(RXON_FLG_TGJ_NARROW_BAND_MSK |
|
IWL_WARN(priv, "check 2.4G: wrong narrow\n");
|
||||||
RXON_FLG_RADAR_DETECT_MSK));
|
error = true;
|
||||||
if (error)
|
}
|
||||||
IWL_WARN(priv, "check 24G fields %d | %d\n",
|
if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) {
|
||||||
counter++, error);
|
IWL_WARN(priv, "check 2.4G: wrong radar\n");
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
|
if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) {
|
||||||
0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
|
IWL_WARN(priv, "check 5.2G: not short slot!\n");
|
||||||
if (error)
|
error = true;
|
||||||
IWL_WARN(priv, "check 52 fields %d | %d\n",
|
}
|
||||||
counter++, error);
|
if (rxon->flags & RXON_FLG_CCK_MSK) {
|
||||||
error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
|
IWL_WARN(priv, "check 5.2G: CCK!\n");
|
||||||
if (error)
|
error = true;
|
||||||
IWL_WARN(priv, "check 52 CCK %d | %d\n",
|
}
|
||||||
counter++, error);
|
}
|
||||||
|
if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) {
|
||||||
|
IWL_WARN(priv, "mac/bssid mcast!\n");
|
||||||
|
error = true;
|
||||||
}
|
}
|
||||||
error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
|
|
||||||
if (error)
|
|
||||||
IWL_WARN(priv, "check mac addr %d | %d\n", counter++, error);
|
|
||||||
|
|
||||||
/* make sure basic rates 6Mbps and 1Mbps are supported */
|
/* make sure basic rates 6Mbps and 1Mbps are supported */
|
||||||
error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
|
if ((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0 &&
|
||||||
((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
|
(rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0) {
|
||||||
if (error)
|
IWL_WARN(priv, "neither 1 nor 6 are basic\n");
|
||||||
IWL_WARN(priv, "check basic rate %d | %d\n", counter++, error);
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
error |= (le16_to_cpu(rxon->assoc_id) > 2007);
|
if (le16_to_cpu(rxon->assoc_id) > 2007) {
|
||||||
if (error)
|
IWL_WARN(priv, "aid > 2007\n");
|
||||||
IWL_WARN(priv, "check assoc id %d | %d\n", counter++, error);
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
|
if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
|
||||||
== (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
|
== (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) {
|
||||||
if (error)
|
IWL_WARN(priv, "CCK and short slot\n");
|
||||||
IWL_WARN(priv, "check CCK and short slot %d | %d\n",
|
error = true;
|
||||||
counter++, error);
|
}
|
||||||
|
|
||||||
error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
|
if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
|
||||||
== (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
|
== (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) {
|
||||||
if (error)
|
IWL_WARN(priv, "CCK and auto detect");
|
||||||
IWL_WARN(priv, "check CCK & auto detect %d | %d\n",
|
error = true;
|
||||||
counter++, error);
|
}
|
||||||
|
|
||||||
error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
|
if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
|
||||||
RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
|
RXON_FLG_TGG_PROTECT_MSK)) ==
|
||||||
if (error)
|
RXON_FLG_TGG_PROTECT_MSK) {
|
||||||
IWL_WARN(priv, "check TGG and auto detect %d | %d\n",
|
IWL_WARN(priv, "TGg but no auto-detect\n");
|
||||||
counter++, error);
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
IWL_WARN(priv, "Tuning to channel %d\n",
|
IWL_WARN(priv, "Tuning to channel %d\n",
|
||||||
le16_to_cpu(rxon->channel));
|
le16_to_cpu(rxon->channel));
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
IWL_ERR(priv, "Not a valid iwl_rxon_assoc_cmd field values\n");
|
IWL_ERR(priv, "Invalid RXON\n");
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user