hostap: nl80211 use nl80211_put_freq_params
Use nl80211_put_freq_params when it possible. Remove duplicated code. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
This commit is contained in:
parent
816e3df972
commit
ed8e005973
1 changed files with 2 additions and 46 deletions
|
@ -11522,53 +11522,9 @@ static int nl80211_start_radar_detection(void *priv,
|
||||||
|
|
||||||
nl80211_cmd(bss->drv, msg, 0, NL80211_CMD_RADAR_DETECT);
|
nl80211_cmd(bss->drv, msg, 0, NL80211_CMD_RADAR_DETECT);
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
|
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq);
|
|
||||||
|
|
||||||
if (freq->vht_enabled) {
|
if (nl80211_put_freq_params(msg, freq) < 0)
|
||||||
switch (freq->bandwidth) {
|
goto nla_put_failure;
|
||||||
case 20:
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
|
|
||||||
NL80211_CHAN_WIDTH_20);
|
|
||||||
break;
|
|
||||||
case 40:
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
|
|
||||||
NL80211_CHAN_WIDTH_40);
|
|
||||||
break;
|
|
||||||
case 80:
|
|
||||||
if (freq->center_freq2)
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
|
|
||||||
NL80211_CHAN_WIDTH_80P80);
|
|
||||||
else
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
|
|
||||||
NL80211_CHAN_WIDTH_80);
|
|
||||||
break;
|
|
||||||
case 160:
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
|
|
||||||
NL80211_CHAN_WIDTH_160);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1, freq->center_freq1);
|
|
||||||
if (freq->center_freq2)
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ2,
|
|
||||||
freq->center_freq2);
|
|
||||||
} else if (freq->ht_enabled) {
|
|
||||||
switch (freq->sec_channel_offset) {
|
|
||||||
case -1:
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
|
|
||||||
NL80211_CHAN_HT40MINUS);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
|
|
||||||
NL80211_CHAN_HT40PLUS);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
|
|
||||||
NL80211_CHAN_HT20);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
|
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
|
|
Loading…
Reference in a new issue