33 .limits = mwifiex_ap_sta_limits,
34 .num_different_channels = 1,
37 .beacon_int_infra_match =
true,
45 REG_RULE(2412-10, 2462+10, 40, 3, 20, 0),
47 REG_RULE(2467-10, 2472+10, 20, 3, 20,
50 REG_RULE(2484-10, 2484+10, 20, 3, 20,
54 REG_RULE(5180-10, 5240+10, 40, 3, 20,
57 REG_RULE(5745-10, 5825+10, 40, 3, 20,
60 REG_RULE(5260-10, 5320+10, 40, 3, 30,
64 REG_RULE(5500-10, 5700+10, 40, 3, 30,
115 static void *mwifiex_cfg80211_get_adapter(
struct wiphy *
wiphy)
117 return (
void *) (*(
unsigned long *) wiphy_priv(wiphy));
124 mwifiex_cfg80211_del_key(
struct wiphy *wiphy,
struct net_device *netdev,
128 const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
129 const u8 *peer_mac = pairwise ? mac_addr : bc_mac;
132 wiphy_err(wiphy,
"deleting the crypto keys\n");
136 wiphy_dbg(wiphy,
"info: crypto keys deleted\n");
144 mwifiex_form_mgmt_frame(
struct sk_buff *
skb,
const u8 *
buf,
size_t len)
155 memcpy(
skb_push(skb,
sizeof(pkt_len)), &pkt_len,
sizeof(pkt_len));
158 &tx_control,
sizeof(tx_control));
160 memcpy(
skb_push(skb,
sizeof(pkt_type)), &pkt_type,
sizeof(pkt_type));
172 skb->
tstamp = timeval_to_ktime(tv);
181 mwifiex_cfg80211_mgmt_tx(
struct wiphy *wiphy,
struct wireless_dev *wdev,
184 bool channel_type_valid,
unsigned int wait,
185 const u8 *buf,
size_t len,
bool no_cck,
194 wiphy_err(wiphy,
"invalid buffer and length\n");
204 "info: skip to send probe resp in AP or GO mode\n");
211 pkt_len +
sizeof(pkt_len));
214 wiphy_err(wiphy,
"allocate skb failed for management frame\n");
218 mwifiex_form_mgmt_frame(skb, buf, len);
224 wiphy_dbg(wiphy,
"info: management frame transmitted\n");
232 mwifiex_cfg80211_mgmt_frame_register(
struct wiphy *wiphy,
246 wiphy_dbg(wiphy,
"info: mgmt frame registered\n");
253 mwifiex_cfg80211_remain_on_channel(
struct wiphy *wiphy,
262 if (!chan || !cookie) {
263 wiphy_err(wiphy,
"Invalid parameter for ROC\n");
268 wiphy_dbg(wiphy,
"info: ongoing ROC, cookie = 0x%llu\n",
274 &channel_type, duration);
285 wiphy_dbg(wiphy,
"info: ROC, cookie = 0x%llx\n", *cookie);
295 mwifiex_cfg80211_cancel_remain_on_channel(
struct wiphy *wiphy,
301 if (cookie != priv->
roc_cfg.cookie)
316 wiphy_dbg(wiphy,
"info: cancel ROC, cookie = 0x%llx\n", cookie);
326 mwifiex_cfg80211_set_tx_power(
struct wiphy *wiphy,
336 power_cfg.is_power_auto = 0;
337 power_cfg.power_level =
dbm;
339 power_cfg.is_power_auto = 1;
353 mwifiex_cfg80211_set_power_mgmt(
struct wiphy *wiphy,
362 "info: ignore timeout value for IEEE Power Save\n");
373 mwifiex_cfg80211_set_default_key(
struct wiphy *wiphy,
struct net_device *netdev,
374 u8 key_index,
bool unicast,
387 wiphy_err(wiphy,
"set default Tx key index\n");
398 mwifiex_cfg80211_add_key(
struct wiphy *wiphy,
struct net_device *netdev,
399 u8 key_index,
bool pairwise,
const u8 *mac_addr,
404 const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
405 const u8 *peer_mac = pairwise ? mac_addr : bc_mac;
423 key_index, peer_mac, 0)) {
438 static int mwifiex_send_domain_info_cmd_fw(
struct wiphy *wiphy)
440 u8 no_of_triplet = 0;
442 u8 no_of_parsed_chan = 0;
443 u8 first_chan = 0, next_chan = 0, max_pwr = 0;
458 if (!wiphy->
bands[band]) {
459 wiphy_err(wiphy,
"11D: setting domain info in FW\n");
463 sband = wiphy->
bands[band];
473 next_chan = first_chan;
475 no_of_parsed_chan = 1;
479 if (ch->
hw_value == next_chan + 1 &&
490 next_chan = first_chan;
492 no_of_parsed_chan = 1;
510 wiphy_err(wiphy,
"11D: setting domain info in FW\n");
527 static int mwifiex_reg_notifier(
struct wiphy *wiphy,
532 wiphy_dbg(wiphy,
"info: cfg80211 regulatory domain callback for %c%c\n",
547 mwifiex_send_domain_info_cmd_fw(wiphy);
594 mwifiex_cfg80211_set_wiphy_params(
struct wiphy *wiphy,
u32 changed)
599 int ret, bss_started,
i;
601 for (i = 0; i < adapter->
priv_num; i++) {
602 priv = adapter->
priv[
i];
627 wiphy_err(wiphy,
"Failed to stop the BSS\n");
640 wiphy_err(wiphy,
"Failed to set bss config\n");
652 wiphy_err(wiphy,
"Failed to start BSS\n");
658 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
659 ret = mwifiex_set_rts(priv,
664 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
665 ret = mwifiex_set_frag(priv,
702 if (mwifiex_cfg80211_deinit_p2p(priv))
728 if (mwifiex_cfg80211_deinit_p2p(priv))
751 mwifiex_cfg80211_change_virtual_intf(
struct wiphy *wiphy,
770 wiphy_err(wiphy,
"%s: changing to %d not supported\n",
780 if (mwifiex_cfg80211_init_p2p_client(priv))
785 if (mwifiex_cfg80211_init_p2p_go(priv))
795 wiphy_err(wiphy,
"%s: changing to %d not supported\n",
809 wiphy_err(wiphy,
"%s: changing to %d not supported\n",
818 if (mwifiex_cfg80211_deinit_p2p(priv))
827 wiphy_err(wiphy,
"%s: unknown iftype: %d\n",
869 dev_err(priv->
adapter->dev,
"failed to get signal information\n");
905 sinfo->
txrate.legacy = rate * 5;
933 mwifiex_cfg80211_get_station(
struct wiphy *wiphy,
struct net_device *dev,
943 return mwifiex_dump_station_info(priv, sinfo);
950 mwifiex_cfg80211_dump_station(
struct wiphy *wiphy,
struct net_device *dev,
960 return mwifiex_dump_station_info(priv, sinfo);
965 {.bitrate = 10, .hw_value = 2, },
966 {.bitrate = 20, .hw_value = 4, },
967 {.bitrate = 55, .hw_value = 11, },
968 {.bitrate = 110, .hw_value = 22, },
969 {.bitrate = 60, .hw_value = 12, },
970 {.bitrate = 90, .hw_value = 18, },
971 {.bitrate = 120, .hw_value = 24, },
972 {.bitrate = 180, .hw_value = 36, },
973 {.bitrate = 240, .hw_value = 48, },
974 {.bitrate = 360, .hw_value = 72, },
975 {.bitrate = 480, .hw_value = 96, },
976 {.bitrate = 540, .hw_value = 108, },
981 {.center_freq = 2412, .hw_value = 1, },
982 {.center_freq = 2417, .hw_value = 2, },
983 {.center_freq = 2422, .hw_value = 3, },
984 {.center_freq = 2427, .hw_value = 4, },
985 {.center_freq = 2432, .hw_value = 5, },
986 {.center_freq = 2437, .hw_value = 6, },
987 {.center_freq = 2442, .hw_value = 7, },
988 {.center_freq = 2447, .hw_value = 8, },
989 {.center_freq = 2452, .hw_value = 9, },
990 {.center_freq = 2457, .hw_value = 10, },
991 {.center_freq = 2462, .hw_value = 11, },
992 {.center_freq = 2467, .hw_value = 12, },
993 {.center_freq = 2472, .hw_value = 13, },
994 {.center_freq = 2484, .hw_value = 14, },
998 .channels = mwifiex_channels_2ghz,
999 .n_channels =
ARRAY_SIZE(mwifiex_channels_2ghz),
1000 .bitrates = mwifiex_rates,
1005 {.center_freq = 5040, .hw_value = 8, },
1006 {.center_freq = 5060, .hw_value = 12, },
1007 {.center_freq = 5080, .hw_value = 16, },
1008 {.center_freq = 5170, .hw_value = 34, },
1009 {.center_freq = 5190, .hw_value = 38, },
1010 {.center_freq = 5210, .hw_value = 42, },
1011 {.center_freq = 5230, .hw_value = 46, },
1012 {.center_freq = 5180, .hw_value = 36, },
1013 {.center_freq = 5200, .hw_value = 40, },
1014 {.center_freq = 5220, .hw_value = 44, },
1015 {.center_freq = 5240, .hw_value = 48, },
1016 {.center_freq = 5260, .hw_value = 52, },
1017 {.center_freq = 5280, .hw_value = 56, },
1018 {.center_freq = 5300, .hw_value = 60, },
1019 {.center_freq = 5320, .hw_value = 64, },
1020 {.center_freq = 5500, .hw_value = 100, },
1021 {.center_freq = 5520, .hw_value = 104, },
1022 {.center_freq = 5540, .hw_value = 108, },
1023 {.center_freq = 5560, .hw_value = 112, },
1024 {.center_freq = 5580, .hw_value = 116, },
1025 {.center_freq = 5600, .hw_value = 120, },
1026 {.center_freq = 5620, .hw_value = 124, },
1027 {.center_freq = 5640, .hw_value = 128, },
1028 {.center_freq = 5660, .hw_value = 132, },
1029 {.center_freq = 5680, .hw_value = 136, },
1030 {.center_freq = 5700, .hw_value = 140, },
1031 {.center_freq = 5745, .hw_value = 149, },
1032 {.center_freq = 5765, .hw_value = 153, },
1033 {.center_freq = 5785, .hw_value = 157, },
1034 {.center_freq = 5805, .hw_value = 161, },
1035 {.center_freq = 5825, .hw_value = 165, },
1039 .channels = mwifiex_channels_5ghz,
1040 .n_channels =
ARRAY_SIZE(mwifiex_channels_5ghz),
1041 .bitrates = mwifiex_rates + 4,
1047 static const u32 mwifiex_cipher_suites[] = {
1090 static int mwifiex_cfg80211_set_bitrate_mask(
struct wiphy *wiphy,
1101 "Can not set Tx data rate in disconnected state\n");
1107 memset(bitmap_rates, 0,
sizeof(bitmap_rates));
1111 bitmap_rates[0] = mask->
control[band].legacy & 0x000f;
1115 bitmap_rates[1] = (mask->
control[band].legacy & 0x0ff0) >> 4;
1117 bitmap_rates[1] = mask->
control[band].legacy;
1120 bitmap_rates[2] = mask->
control[band].mcs[0];
1122 bitmap_rates[2] |= mask->
control[band].mcs[1] << 8;
1134 static int mwifiex_cfg80211_set_cqm_rssi_config(
struct wiphy *wiphy,
1136 s32 rssi_thold,
u32 rssi_hyst)
1148 if (rssi_thold && rssi_hyst) {
1150 subsc_evt.bcn_l_rssi_cfg.abs_value =
abs(rssi_thold);
1151 subsc_evt.bcn_h_rssi_cfg.abs_value =
abs(rssi_thold);
1152 subsc_evt.bcn_l_rssi_cfg.evt_freq = 1;
1153 subsc_evt.bcn_h_rssi_cfg.evt_freq = 1;
1170 static int mwifiex_cfg80211_change_beacon(
struct wiphy *wiphy,
1177 wiphy_err(wiphy,
"%s: bss_type mismatched\n", __func__);
1182 wiphy_err(wiphy,
"%s: bss not started\n", __func__);
1187 wiphy_err(wiphy,
"%s: setting mgmt ies failed\n", __func__);
1195 mwifiex_cfg80211_set_antenna(
struct wiphy *wiphy,
u32 tx_ant,
u32 rx_ant)
1197 struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
1202 if (!tx_ant || !rx_ant)
1209 if (tx_ant != rx_ant)
1212 if ((tx_ant & (tx_ant - 1)) &&
1217 (priv->
adapter->number_of_antenna > 1)) {
1233 static int mwifiex_cfg80211_stop_ap(
struct wiphy *wiphy,
struct net_device *dev)
1238 wiphy_err(wiphy,
"Failed to delete mgmt IEs!\n");
1244 wiphy_err(wiphy,
"Failed to stop the BSS\n");
1256 static int mwifiex_cfg80211_start_ap(
struct wiphy *wiphy,
1262 u8 config_bands = 0;
1319 if (!((config_bands | priv->
adapter->fw_bands) &
1321 priv->
adapter->config_bands = config_bands;
1324 mwifiex_send_domain_info_cmd_fw(wiphy);
1328 wiphy_err(wiphy,
"Failed to parse secuirty parameters!\n");
1342 wiphy_err(wiphy,
"Failed to stop the BSS\n");
1350 wiphy_err(wiphy,
"Failed to set the SSID\n");
1359 wiphy_err(wiphy,
"Failed to start the BSS\n");
1383 mwifiex_cfg80211_disconnect(
struct wiphy *wiphy,
struct net_device *dev,
1391 wiphy_dbg(wiphy,
"info: successfully disconnected from %pM:"
1392 " reason code %d\n", priv->
cfg_bssid, reason_code);
1410 static int mwifiex_cfg80211_inform_ibss_bss(
struct mwifiex_private *priv)
1423 ie_buf[1] = bss_info.ssid.ssid_len;
1426 &bss_info.ssid.ssid, bss_info.ssid.ssid_len);
1463 int ret, auth_type = 0;
1465 u8 is_scanning_required = 0, config_bands = 0;
1469 req_ssid.ssid_len = ssid_len;
1475 memcpy(req_ssid.ssid, ssid, ssid_len);
1476 if (!req_ssid.ssid_len || req_ssid.ssid[0] < 0x20) {
1491 if (!((config_bands | priv->
adapter->fw_bands) &
1493 priv->
adapter->config_bands = config_bands;
1499 priv->
sec_info.wpa_enabled =
false;
1500 priv->
sec_info.wpa2_enabled =
false;
1502 priv->
sec_info.encryption_mode = 0;
1503 priv->
sec_info.is_authtype_auto = 0;
1517 priv->
sec_info.authentication_mode =
1527 priv->
sec_info.is_authtype_auto = 1;
1532 if (sme->
crypto.n_ciphers_pairwise) {
1534 sme->
crypto.ciphers_pairwise[0];
1535 priv->
sec_info.authentication_mode = auth_type;
1538 if (sme->
crypto.cipher_group) {
1540 priv->
sec_info.authentication_mode = auth_type;
1546 if (mwifiex_is_alg_wep(priv->
sec_info.encryption_mode)) {
1548 "info: setting wep encryption"
1549 " with key len %d\n", sme->
key_len);
1563 if (is_scanning_required) {
1574 bssid, ssid, ssid_len,
1579 bssid, ssid, ssid_len,
1584 if (is_scanning_required) {
1586 "assoc: requested bss not found in scan results\n");
1589 is_scanning_required = 1;
1592 "info: trying to associate to '%s' bssid %pM\n",
1593 (
char *) req_ssid.ssid, bss->
bssid);
1606 if (mwifiex_cfg80211_inform_ibss_bss(priv))
1621 mwifiex_cfg80211_connect(
struct wiphy *wiphy,
struct net_device *dev,
1628 wiphy_err(wiphy,
"received infra assoc request "
1629 "when station is in ibss mode\n");
1634 wiphy_err(wiphy,
"skip association request for AP interface\n");
1638 wiphy_dbg(wiphy,
"info: Trying to associate to %s and bssid %pM\n",
1649 "info: associated to bssid %pM successfully\n",
1653 "info: association to bssid %pM failed\n",
1681 struct wiphy *wiphy = priv->
wdev->wiphy;
1684 u8 config_bands = 0;
1690 for (i = 0; i < mwifiex_band_2ghz.
n_bitrates; i++) {
1696 if (mwifiex_rates[i].
bitrate == 60) {
1735 wiphy_dbg(wiphy,
"info: set ibss band %d, chan %d, chan offset %d\n",
1748 mwifiex_cfg80211_join_ibss(
struct wiphy *wiphy,
struct net_device *dev,
1755 wiphy_err(wiphy,
"request to join ibss received "
1756 "when station is not in ibss mode\n");
1760 wiphy_dbg(wiphy,
"info: trying to join to %s and bssid %pM\n",
1763 mwifiex_set_ibss_params(priv, params);
1765 ret = mwifiex_cfg80211_assoc(priv, params->
ssid_len, params->
ssid,
1772 "info: joined/created adhoc network with bssid"
1773 " %pM successfully\n", priv->
cfg_bssid);
1776 "info: failed creating/joining adhoc network\n");
1789 mwifiex_cfg80211_leave_ibss(
struct wiphy *wiphy,
struct net_device *dev)
1793 wiphy_dbg(wiphy,
"info: disconnecting from essid %pM\n",
1811 mwifiex_cfg80211_scan(
struct wiphy *wiphy,
1820 wiphy_dbg(wiphy,
"info: received scan request on %s\n", dev->
name);
1840 if (request->
ie && request->
ie_len) {
1848 offset +=
sizeof(*ie) + ie->
len;
1850 if (offset >= request->
ie_len)
1879 if (request->
ie && request->
ie_len) {
1949 memset(mcs, 0xff, rx_mcs_supp);
1951 memset(&mcs[rx_mcs_supp], 0,
1972 struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
1988 "cannot create multiple sta/adhoc ifaces\n");
2016 wiphy_err(wiphy,
"Can't create multiple AP interfaces");
2041 wiphy_err(wiphy,
"Can't create multiple P2P ifaces");
2073 wiphy_err(wiphy,
"type not supported\n");
2080 wiphy_err(wiphy,
"no memory available for netdevice\n");
2091 mwifiex_setup_ht_caps(
2094 dev_net_set(dev, wiphy_net(wiphy));
2105 mdev_priv = netdev_priv(dev);
2106 *((
unsigned long *) mdev_priv) = (
unsigned long) priv;
2112 wiphy_err(wiphy,
"cannot register virtual network device\n");
2121 dev_dbg(adapter->
dev,
"info: %s: Marvell 802.11 Adapter\n", dev->
name);
2123 #ifdef CONFIG_DEBUG_FS
2137 #ifdef CONFIG_DEBUG_FS
2141 if (!netif_queue_stopped(priv->
netdev))
2142 netif_stop_queue(priv->
netdev);
2144 if (netif_carrier_ok(priv->
netdev))
2147 if (wdev->
netdev->reg_state == NETREG_REGISTERED)
2148 unregister_netdevice(wdev->
netdev);
2150 if (wdev->
netdev->reg_state == NETREG_UNREGISTERED)
2168 .change_virtual_intf = mwifiex_cfg80211_change_virtual_intf,
2169 .scan = mwifiex_cfg80211_scan,
2170 .connect = mwifiex_cfg80211_connect,
2171 .disconnect = mwifiex_cfg80211_disconnect,
2172 .get_station = mwifiex_cfg80211_get_station,
2173 .dump_station = mwifiex_cfg80211_dump_station,
2174 .set_wiphy_params = mwifiex_cfg80211_set_wiphy_params,
2175 .join_ibss = mwifiex_cfg80211_join_ibss,
2176 .leave_ibss = mwifiex_cfg80211_leave_ibss,
2177 .add_key = mwifiex_cfg80211_add_key,
2178 .del_key = mwifiex_cfg80211_del_key,
2179 .mgmt_tx = mwifiex_cfg80211_mgmt_tx,
2180 .mgmt_frame_register = mwifiex_cfg80211_mgmt_frame_register,
2181 .remain_on_channel = mwifiex_cfg80211_remain_on_channel,
2182 .cancel_remain_on_channel = mwifiex_cfg80211_cancel_remain_on_channel,
2183 .set_default_key = mwifiex_cfg80211_set_default_key,
2184 .set_power_mgmt = mwifiex_cfg80211_set_power_mgmt,
2185 .set_tx_power = mwifiex_cfg80211_set_tx_power,
2186 .set_bitrate_mask = mwifiex_cfg80211_set_bitrate_mask,
2187 .start_ap = mwifiex_cfg80211_start_ap,
2188 .stop_ap = mwifiex_cfg80211_stop_ap,
2189 .change_beacon = mwifiex_cfg80211_change_beacon,
2190 .set_cqm_rssi_config = mwifiex_cfg80211_set_cqm_rssi_config,
2191 .set_antenna = mwifiex_cfg80211_set_antenna,
2206 struct wiphy *wiphy;
2211 wiphy =
wiphy_new(&mwifiex_cfg80211_ops,
2214 dev_err(adapter->
dev,
"%s: creating new wiphy\n", __func__);
2265 wdev_priv = wiphy_priv(wiphy);
2266 *(
unsigned long *)wdev_priv = (
unsigned long)
adapter;
2268 set_wiphy_dev(wiphy, priv->
adapter->dev);
2273 "%s: wiphy_register failed: %d\n", __func__, ret);
2280 "ignoring F/W country code %2.2s\n", country_code);
2282 adapter->
wiphy = wiphy;