.. | .. |
---|
| 1 | +// SPDX-License-Identifier: ISC |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2012 Broadcom Corporation |
---|
3 | | - * |
---|
4 | | - * Permission to use, copy, modify, and/or distribute this software for any |
---|
5 | | - * purpose with or without fee is hereby granted, provided that the above |
---|
6 | | - * copyright notice and this permission notice appear in all copies. |
---|
7 | | - * |
---|
8 | | - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
---|
9 | | - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
---|
10 | | - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
---|
11 | | - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
12 | | - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
---|
13 | | - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
---|
14 | | - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
15 | 4 | */ |
---|
16 | 5 | #include <linux/slab.h> |
---|
17 | 6 | #include <linux/netdevice.h> |
---|
.. | .. |
---|
28 | 17 | #include "fwil_types.h" |
---|
29 | 18 | #include "p2p.h" |
---|
30 | 19 | #include "cfg80211.h" |
---|
| 20 | +#include "feature.h" |
---|
31 | 21 | |
---|
32 | 22 | /* parameters used for p2p escan */ |
---|
33 | 23 | #define P2PAPI_SCAN_NPROBES 1 |
---|
.. | .. |
---|
70 | 60 | #define P2P_AF_MIN_DWELL_TIME 100 |
---|
71 | 61 | #define P2P_AF_MED_DWELL_TIME 400 |
---|
72 | 62 | #define P2P_AF_LONG_DWELL_TIME 1000 |
---|
73 | | -#define P2P_AF_TX_MAX_RETRY 1 |
---|
| 63 | +#define P2P_AF_TX_MAX_RETRY 5 |
---|
74 | 64 | #define P2P_AF_MAX_WAIT_TIME msecs_to_jiffies(2000) |
---|
75 | 65 | #define P2P_INVALID_CHANNEL -1 |
---|
76 | 66 | #define P2P_CHANNEL_SYNC_RETRY 5 |
---|
77 | 67 | #define P2P_AF_FRM_SCAN_MAX_WAIT msecs_to_jiffies(450) |
---|
78 | 68 | #define P2P_DEFAULT_SLEEP_TIME_VSDB 200 |
---|
| 69 | +#define P2P_AF_RETRY_DELAY_TIME 40 |
---|
79 | 70 | |
---|
80 | 71 | /* WiFi P2P Public Action Frame OUI Subtypes */ |
---|
81 | 72 | #define P2P_PAF_GON_REQ 0 /* Group Owner Negotiation Req */ |
---|
.. | .. |
---|
103 | 94 | #define P2PSD_ACTION_ID_GAS_CRESP 0x0d /* GAS Comback Response AF */ |
---|
104 | 95 | |
---|
105 | 96 | #define BRCMF_P2P_DISABLE_TIMEOUT msecs_to_jiffies(500) |
---|
| 97 | + |
---|
| 98 | +/* Mask for retry counter of custom dwell time */ |
---|
| 99 | +#define CUSTOM_RETRY_MASK 0xff000000 |
---|
106 | 100 | /** |
---|
107 | 101 | * struct brcmf_p2p_disc_st_le - set discovery state in firmware. |
---|
108 | 102 | * |
---|
.. | .. |
---|
151 | 145 | * |
---|
152 | 146 | * @category: P2P_PUB_AF_CATEGORY |
---|
153 | 147 | * @action: P2P_PUB_AF_ACTION |
---|
154 | | - * @oui[3]: P2P_OUI |
---|
| 148 | + * @oui: P2P_OUI |
---|
155 | 149 | * @oui_type: OUI type - P2P_VER |
---|
156 | 150 | * @subtype: OUI subtype - P2P_TYPE_* |
---|
157 | 151 | * @dialog_token: nonzero, identifies req/rsp transaction |
---|
158 | | - * @elts[1]: Variable length information elements. |
---|
| 152 | + * @elts: Variable length information elements. |
---|
159 | 153 | */ |
---|
160 | 154 | struct brcmf_p2p_pub_act_frame { |
---|
161 | 155 | u8 category; |
---|
.. | .. |
---|
171 | 165 | * struct brcmf_p2p_action_frame - WiFi P2P Action Frame |
---|
172 | 166 | * |
---|
173 | 167 | * @category: P2P_AF_CATEGORY |
---|
174 | | - * @OUI[3]: OUI - P2P_OUI |
---|
| 168 | + * @oui: OUI - P2P_OUI |
---|
175 | 169 | * @type: OUI Type - P2P_VER |
---|
176 | 170 | * @subtype: OUI Subtype - P2P_AF_* |
---|
177 | 171 | * @dialog_token: nonzero, identifies req/resp tranaction |
---|
178 | | - * @elts[1]: Variable length information elements. |
---|
| 172 | + * @elts: Variable length information elements. |
---|
179 | 173 | */ |
---|
180 | 174 | struct brcmf_p2p_action_frame { |
---|
181 | 175 | u8 category; |
---|
.. | .. |
---|
192 | 186 | * @category: 0x04 Public Action Frame |
---|
193 | 187 | * @action: 0x6c Advertisement Protocol |
---|
194 | 188 | * @dialog_token: nonzero, identifies req/rsp transaction |
---|
195 | | - * @query_data[1]: Query Data. SD gas ireq SD gas iresp |
---|
| 189 | + * @query_data: Query Data. SD gas ireq SD gas iresp |
---|
196 | 190 | */ |
---|
197 | 191 | struct brcmf_p2psd_gas_pub_act_frame { |
---|
198 | 192 | u8 category; |
---|
.. | .. |
---|
207 | 201 | * @mpc_onoff: To make sure to send successfully action frame, we have to |
---|
208 | 202 | * turn off mpc 0: off, 1: on, (-1): do nothing |
---|
209 | 203 | * @search_channel: 1: search peer's channel to send af |
---|
210 | | - * extra_listen: keep the dwell time to get af response frame. |
---|
| 204 | + * @extra_listen: keep the dwell time to get af response frame. |
---|
211 | 205 | */ |
---|
212 | 206 | struct brcmf_config_af_params { |
---|
213 | 207 | s32 mpc_onoff; |
---|
.. | .. |
---|
434 | 428 | */ |
---|
435 | 429 | static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac) |
---|
436 | 430 | { |
---|
| 431 | + struct brcmf_pub *drvr = ifp->drvr; |
---|
437 | 432 | s32 ret = 0; |
---|
438 | 433 | |
---|
439 | 434 | brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); |
---|
.. | .. |
---|
450 | 445 | ret = brcmf_fil_iovar_data_set(ifp, "p2p_da_override", p2p_mac, |
---|
451 | 446 | ETH_ALEN); |
---|
452 | 447 | if (ret) |
---|
453 | | - brcmf_err("failed to update device address ret %d\n", ret); |
---|
| 448 | + bphy_err(drvr, "failed to update device address ret %d\n", ret); |
---|
454 | 449 | |
---|
455 | 450 | return ret; |
---|
456 | 451 | } |
---|
.. | .. |
---|
467 | 462 | */ |
---|
468 | 463 | static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr) |
---|
469 | 464 | { |
---|
| 465 | + struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; |
---|
470 | 466 | bool random_addr = false; |
---|
| 467 | + bool local_admin = false; |
---|
471 | 468 | |
---|
472 | | - if (!dev_addr || is_zero_ether_addr(dev_addr)) |
---|
473 | | - random_addr = true; |
---|
| 469 | + if (!dev_addr || is_zero_ether_addr(dev_addr)) { |
---|
| 470 | + /* If the primary interface address is already locally |
---|
| 471 | + * administered, create a new random address. |
---|
| 472 | + */ |
---|
| 473 | + if (pri_ifp->mac_addr[0] & 0x02) { |
---|
| 474 | + random_addr = true; |
---|
| 475 | + } else { |
---|
| 476 | + dev_addr = pri_ifp->mac_addr; |
---|
| 477 | + local_admin = true; |
---|
| 478 | + } |
---|
| 479 | + } |
---|
474 | 480 | |
---|
475 | 481 | /* Generate the P2P Device Address obtaining a random ethernet |
---|
476 | 482 | * address with the locally administered bit set. |
---|
.. | .. |
---|
480 | 486 | else |
---|
481 | 487 | memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); |
---|
482 | 488 | |
---|
| 489 | + if (local_admin) |
---|
| 490 | + p2p->dev_addr[0] |= 0x02; |
---|
| 491 | + |
---|
483 | 492 | /* Generate the P2P Interface Address. If the discovery and connection |
---|
484 | 493 | * BSSCFGs need to simultaneously co-exist, then this address must be |
---|
485 | 494 | * different from the P2P Device Address, but also locally administered. |
---|
486 | 495 | */ |
---|
487 | | - memcpy(p2p->int_addr, p2p->dev_addr, ETH_ALEN); |
---|
488 | | - p2p->int_addr[0] |= 0x02; |
---|
489 | | - p2p->int_addr[4] ^= 0x80; |
---|
| 496 | + memcpy(p2p->conn_int_addr, p2p->dev_addr, ETH_ALEN); |
---|
| 497 | + p2p->conn_int_addr[0] |= 0x02; |
---|
| 498 | + p2p->conn_int_addr[4] ^= 0x80; |
---|
| 499 | + |
---|
| 500 | + memcpy(p2p->conn2_int_addr, p2p->dev_addr, ETH_ALEN); |
---|
| 501 | + p2p->conn2_int_addr[0] |= 0x02; |
---|
| 502 | + p2p->conn2_int_addr[4] ^= 0x90; |
---|
490 | 503 | } |
---|
491 | 504 | |
---|
492 | 505 | /** |
---|
.. | .. |
---|
570 | 583 | */ |
---|
571 | 584 | static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p) |
---|
572 | 585 | { |
---|
| 586 | + struct brcmf_pub *drvr = p2p->cfg->pub; |
---|
573 | 587 | struct brcmf_cfg80211_vif *vif; |
---|
574 | 588 | s32 ret = 0; |
---|
575 | 589 | |
---|
576 | 590 | brcmf_dbg(TRACE, "enter\n"); |
---|
577 | 591 | vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; |
---|
578 | 592 | if (!vif) { |
---|
579 | | - brcmf_err("P2P config device not available\n"); |
---|
| 593 | + bphy_err(drvr, "P2P config device not available\n"); |
---|
580 | 594 | ret = -EPERM; |
---|
581 | 595 | goto exit; |
---|
582 | 596 | } |
---|
.. | .. |
---|
590 | 604 | vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; |
---|
591 | 605 | ret = brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 1); |
---|
592 | 606 | if (ret < 0) { |
---|
593 | | - brcmf_err("set p2p_disc error\n"); |
---|
| 607 | + bphy_err(drvr, "set p2p_disc error\n"); |
---|
594 | 608 | goto exit; |
---|
595 | 609 | } |
---|
596 | 610 | vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; |
---|
597 | 611 | ret = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0); |
---|
598 | 612 | if (ret < 0) { |
---|
599 | | - brcmf_err("unable to set WL_P2P_DISC_ST_SCAN\n"); |
---|
| 613 | + bphy_err(drvr, "unable to set WL_P2P_DISC_ST_SCAN\n"); |
---|
600 | 614 | goto exit; |
---|
601 | 615 | } |
---|
602 | 616 | |
---|
.. | .. |
---|
608 | 622 | */ |
---|
609 | 623 | ret = brcmf_fil_bsscfg_int_set(vif->ifp, "wsec", AES_ENABLED); |
---|
610 | 624 | if (ret < 0) { |
---|
611 | | - brcmf_err("wsec error %d\n", ret); |
---|
| 625 | + bphy_err(drvr, "wsec error %d\n", ret); |
---|
612 | 626 | goto exit; |
---|
613 | 627 | } |
---|
614 | 628 | |
---|
.. | .. |
---|
630 | 644 | u16 chanspecs[], s32 search_state, |
---|
631 | 645 | enum p2p_bss_type bss_type) |
---|
632 | 646 | { |
---|
| 647 | + struct brcmf_pub *drvr = p2p->cfg->pub; |
---|
633 | 648 | s32 ret = 0; |
---|
634 | 649 | s32 memsize = offsetof(struct brcmf_p2p_scan_le, |
---|
635 | 650 | eparams.params_le.channel_list); |
---|
.. | .. |
---|
648 | 663 | |
---|
649 | 664 | vif = p2p->bss_idx[bss_type].vif; |
---|
650 | 665 | if (vif == NULL) { |
---|
651 | | - brcmf_err("no vif for bss type %d\n", bss_type); |
---|
| 666 | + bphy_err(drvr, "no vif for bss type %d\n", bss_type); |
---|
652 | 667 | ret = -EINVAL; |
---|
653 | 668 | goto exit; |
---|
654 | 669 | } |
---|
.. | .. |
---|
676 | 691 | BRCMF_P2P_WILDCARD_SSID_LEN); |
---|
677 | 692 | break; |
---|
678 | 693 | default: |
---|
679 | | - brcmf_err(" invalid search state %d\n", search_state); |
---|
| 694 | + bphy_err(drvr, " invalid search state %d\n", search_state); |
---|
680 | 695 | ret = -EINVAL; |
---|
681 | 696 | goto exit; |
---|
682 | 697 | } |
---|
.. | .. |
---|
748 | 763 | * brcmf_p2p_run_escan() - escan callback for peer-to-peer. |
---|
749 | 764 | * |
---|
750 | 765 | * @cfg: driver private data for cfg80211 interface. |
---|
751 | | - * @ndev: net device for which scan is requested. |
---|
| 766 | + * @ifp: interface control. |
---|
752 | 767 | * @request: scan request from cfg80211. |
---|
753 | | - * @action: scan action. |
---|
754 | 768 | * |
---|
755 | 769 | * Determines the P2P discovery state based to scan request parameters and |
---|
756 | 770 | * validates the channels in the request. |
---|
.. | .. |
---|
760 | 774 | struct cfg80211_scan_request *request) |
---|
761 | 775 | { |
---|
762 | 776 | struct brcmf_p2p_info *p2p = &cfg->p2p; |
---|
| 777 | + struct brcmf_pub *drvr = cfg->pub; |
---|
763 | 778 | s32 err = 0; |
---|
764 | 779 | s32 search_state = WL_P2P_DISC_ST_SCAN; |
---|
765 | 780 | struct brcmf_cfg80211_vif *vif; |
---|
.. | .. |
---|
822 | 837 | } |
---|
823 | 838 | exit: |
---|
824 | 839 | if (err) |
---|
825 | | - brcmf_err("error (%d)\n", err); |
---|
| 840 | + bphy_err(drvr, "error (%d)\n", err); |
---|
826 | 841 | return err; |
---|
827 | 842 | } |
---|
828 | 843 | |
---|
.. | .. |
---|
897 | 912 | if (err) |
---|
898 | 913 | return err; |
---|
899 | 914 | |
---|
900 | | - vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; |
---|
901 | | - |
---|
902 | 915 | /* override .run_escan() callback. */ |
---|
903 | 916 | cfg->escan_info.run = brcmf_p2p_run_escan; |
---|
904 | 917 | } |
---|
.. | .. |
---|
917 | 930 | static s32 |
---|
918 | 931 | brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, u16 channel, u32 duration) |
---|
919 | 932 | { |
---|
| 933 | + struct brcmf_pub *drvr = p2p->cfg->pub; |
---|
920 | 934 | struct brcmf_cfg80211_vif *vif; |
---|
921 | 935 | struct brcmu_chan ch; |
---|
922 | 936 | s32 err = 0; |
---|
923 | 937 | |
---|
924 | 938 | vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; |
---|
925 | 939 | if (!vif) { |
---|
926 | | - brcmf_err("Discovery is not set, so we have nothing to do\n"); |
---|
| 940 | + bphy_err(drvr, "Discovery is not set, so we have nothing to do\n"); |
---|
927 | 941 | err = -EPERM; |
---|
928 | 942 | goto exit; |
---|
929 | 943 | } |
---|
930 | 944 | |
---|
931 | 945 | if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status)) { |
---|
932 | | - brcmf_err("Previous LISTEN is not completed yet\n"); |
---|
| 946 | + bphy_err(drvr, "Previous LISTEN is not completed yet\n"); |
---|
933 | 947 | /* WAR: prevent cookie mismatch in wpa_supplicant return OK */ |
---|
934 | 948 | goto exit; |
---|
935 | 949 | } |
---|
.. | .. |
---|
952 | 966 | * brcmf_p2p_remain_on_channel() - put device on channel and stay there. |
---|
953 | 967 | * |
---|
954 | 968 | * @wiphy: wiphy device. |
---|
| 969 | + * @wdev: wireless device. |
---|
955 | 970 | * @channel: channel to stay on. |
---|
956 | 971 | * @duration: time in ms to remain on channel. |
---|
957 | | - * |
---|
| 972 | + * @cookie: cookie. |
---|
958 | 973 | */ |
---|
959 | 974 | int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, |
---|
960 | 975 | struct ieee80211_channel *channel, |
---|
.. | .. |
---|
1039 | 1054 | * brcmf_p2p_act_frm_search() - search function for action frame. |
---|
1040 | 1055 | * |
---|
1041 | 1056 | * @p2p: p2p device. |
---|
1042 | | - * channel: channel on which action frame is to be trasmitted. |
---|
| 1057 | + * @channel: channel on which action frame is to be trasmitted. |
---|
1043 | 1058 | * |
---|
1044 | 1059 | * search function to reach at common channel to send action frame. When |
---|
1045 | 1060 | * channel is 0 then all social channels will be used to send af |
---|
1046 | 1061 | */ |
---|
1047 | 1062 | static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel) |
---|
1048 | 1063 | { |
---|
| 1064 | + struct brcmf_pub *drvr = p2p->cfg->pub; |
---|
1049 | 1065 | s32 err; |
---|
1050 | 1066 | u32 channel_cnt; |
---|
1051 | 1067 | u16 *default_chan_list; |
---|
.. | .. |
---|
1061 | 1077 | default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list), |
---|
1062 | 1078 | GFP_KERNEL); |
---|
1063 | 1079 | if (default_chan_list == NULL) { |
---|
1064 | | - brcmf_err("channel list allocation failed\n"); |
---|
| 1080 | + bphy_err(drvr, "channel list allocation failed\n"); |
---|
1065 | 1081 | err = -ENOMEM; |
---|
1066 | 1082 | goto exit; |
---|
1067 | 1083 | } |
---|
.. | .. |
---|
1103 | 1119 | struct brcmf_p2p_info *p2p = container_of(afx_hdl, |
---|
1104 | 1120 | struct brcmf_p2p_info, |
---|
1105 | 1121 | afx_hdl); |
---|
| 1122 | + struct brcmf_pub *drvr = p2p->cfg->pub; |
---|
1106 | 1123 | s32 err; |
---|
1107 | 1124 | |
---|
1108 | 1125 | if (!afx_hdl->is_active) |
---|
.. | .. |
---|
1116 | 1133 | err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan); |
---|
1117 | 1134 | |
---|
1118 | 1135 | if (err) { |
---|
1119 | | - brcmf_err("ERROR occurred! value is (%d)\n", err); |
---|
| 1136 | + bphy_err(drvr, "ERROR occurred! value is (%d)\n", err); |
---|
1120 | 1137 | if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, |
---|
1121 | 1138 | &p2p->status)) |
---|
1122 | 1139 | complete(&afx_hdl->act_frm_scan); |
---|
.. | .. |
---|
1249 | 1266 | } |
---|
1250 | 1267 | |
---|
1251 | 1268 | /** |
---|
| 1269 | + * brcmf_p2p_abort_action_frame() - abort action frame. |
---|
| 1270 | + * |
---|
| 1271 | + * @cfg: common configuration struct. |
---|
| 1272 | + * |
---|
| 1273 | + */ |
---|
| 1274 | +static s32 brcmf_p2p_abort_action_frame(struct brcmf_cfg80211_info *cfg) |
---|
| 1275 | +{ |
---|
| 1276 | + struct brcmf_p2p_info *p2p = &cfg->p2p; |
---|
| 1277 | + struct brcmf_cfg80211_vif *vif; |
---|
| 1278 | + s32 err; |
---|
| 1279 | + s32 int_val = 1; |
---|
| 1280 | + |
---|
| 1281 | + brcmf_dbg(TRACE, "Enter\n"); |
---|
| 1282 | + |
---|
| 1283 | + vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; |
---|
| 1284 | + err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe_abort", &int_val, |
---|
| 1285 | + sizeof(s32)); |
---|
| 1286 | + if (err) |
---|
| 1287 | + brcmf_err(" aborting action frame has failed (%d)\n", err); |
---|
| 1288 | + |
---|
| 1289 | + return err; |
---|
| 1290 | +} |
---|
| 1291 | + |
---|
| 1292 | +/** |
---|
1252 | 1293 | * brcmf_p2p_stop_wait_next_action_frame() - finish scan if af tx complete. |
---|
1253 | 1294 | * |
---|
1254 | 1295 | * @cfg: common configuration struct. |
---|
.. | .. |
---|
1259 | 1300 | { |
---|
1260 | 1301 | struct brcmf_p2p_info *p2p = &cfg->p2p; |
---|
1261 | 1302 | struct brcmf_if *ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; |
---|
| 1303 | + s32 err; |
---|
1262 | 1304 | |
---|
1263 | 1305 | if (test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status) && |
---|
1264 | 1306 | (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status) || |
---|
.. | .. |
---|
1267 | 1309 | /* if channel is not zero, "actfame" uses off channel scan. |
---|
1268 | 1310 | * So abort scan for off channel completion. |
---|
1269 | 1311 | */ |
---|
1270 | | - if (p2p->af_sent_channel) |
---|
1271 | | - brcmf_notify_escan_complete(cfg, ifp, true, true); |
---|
| 1312 | + if (p2p->af_sent_channel) { |
---|
| 1313 | + /* abort actframe using actframe_abort or abort scan */ |
---|
| 1314 | + err = brcmf_p2p_abort_action_frame(cfg); |
---|
| 1315 | + if (err) |
---|
| 1316 | + brcmf_notify_escan_complete(cfg, ifp, true, |
---|
| 1317 | + true); |
---|
| 1318 | + } |
---|
1272 | 1319 | } else if (test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN, |
---|
1273 | 1320 | &p2p->status)) { |
---|
1274 | 1321 | brcmf_dbg(TRACE, "*** Wake UP ** abort listen for next af frame\n"); |
---|
.. | .. |
---|
1282 | 1329 | * brcmf_p2p_gon_req_collision() - Check if go negotiaton collission |
---|
1283 | 1330 | * |
---|
1284 | 1331 | * @p2p: p2p device info struct. |
---|
| 1332 | + * @mac: MAC address. |
---|
1285 | 1333 | * |
---|
1286 | 1334 | * return true if recevied action frame is to be dropped. |
---|
1287 | 1335 | */ |
---|
.. | .. |
---|
1338 | 1386 | const struct brcmf_event_msg *e, |
---|
1339 | 1387 | void *data) |
---|
1340 | 1388 | { |
---|
1341 | | - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; |
---|
| 1389 | + struct brcmf_pub *drvr = ifp->drvr; |
---|
| 1390 | + struct brcmf_cfg80211_info *cfg = drvr->config; |
---|
1342 | 1391 | struct brcmf_p2p_info *p2p = &cfg->p2p; |
---|
1343 | 1392 | struct afx_hdl *afx_hdl = &p2p->afx_hdl; |
---|
1344 | 1393 | struct wireless_dev *wdev; |
---|
.. | .. |
---|
1409 | 1458 | mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) + |
---|
1410 | 1459 | mgmt_frame_len, GFP_KERNEL); |
---|
1411 | 1460 | if (!mgmt_frame) { |
---|
1412 | | - brcmf_err("No memory available for action frame\n"); |
---|
| 1461 | + bphy_err(drvr, "No memory available for action frame\n"); |
---|
1413 | 1462 | return -ENOMEM; |
---|
1414 | 1463 | } |
---|
1415 | 1464 | memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN); |
---|
.. | .. |
---|
1492 | 1541 | static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p, |
---|
1493 | 1542 | struct brcmf_fil_af_params_le *af_params) |
---|
1494 | 1543 | { |
---|
| 1544 | + struct brcmf_pub *drvr = p2p->cfg->pub; |
---|
1495 | 1545 | struct brcmf_cfg80211_vif *vif; |
---|
| 1546 | + struct brcmf_p2p_action_frame *p2p_af; |
---|
1496 | 1547 | s32 err = 0; |
---|
1497 | | - s32 timeout = 0; |
---|
1498 | 1548 | |
---|
1499 | 1549 | brcmf_dbg(TRACE, "Enter\n"); |
---|
1500 | 1550 | |
---|
.. | .. |
---|
1502 | 1552 | clear_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status); |
---|
1503 | 1553 | clear_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); |
---|
1504 | 1554 | |
---|
1505 | | - vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; |
---|
| 1555 | + /* check if it is a p2p_presence response */ |
---|
| 1556 | + p2p_af = (struct brcmf_p2p_action_frame *)af_params->action_frame.data; |
---|
| 1557 | + if (p2p_af->subtype == P2P_AF_PRESENCE_RSP) |
---|
| 1558 | + vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif; |
---|
| 1559 | + else |
---|
| 1560 | + vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; |
---|
| 1561 | + |
---|
1506 | 1562 | err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe", af_params, |
---|
1507 | 1563 | sizeof(*af_params)); |
---|
1508 | 1564 | if (err) { |
---|
1509 | | - brcmf_err(" sending action frame has failed\n"); |
---|
| 1565 | + bphy_err(drvr, " sending action frame has failed\n"); |
---|
1510 | 1566 | goto exit; |
---|
1511 | 1567 | } |
---|
1512 | 1568 | |
---|
.. | .. |
---|
1524 | 1580 | (p2p->wait_for_offchan_complete) ? |
---|
1525 | 1581 | "off-channel" : "on-channel"); |
---|
1526 | 1582 | |
---|
1527 | | - timeout = wait_for_completion_timeout(&p2p->send_af_done, |
---|
1528 | | - P2P_AF_MAX_WAIT_TIME); |
---|
| 1583 | + wait_for_completion_timeout(&p2p->send_af_done, P2P_AF_MAX_WAIT_TIME); |
---|
1529 | 1584 | |
---|
1530 | 1585 | if (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status)) { |
---|
1531 | 1586 | brcmf_dbg(TRACE, "TX action frame operation is success\n"); |
---|
.. | .. |
---|
1556 | 1611 | struct brcmf_config_af_params *config_af_params) |
---|
1557 | 1612 | { |
---|
1558 | 1613 | struct brcmf_p2p_info *p2p = &cfg->p2p; |
---|
| 1614 | + struct brcmf_pub *drvr = cfg->pub; |
---|
1559 | 1615 | struct brcmf_fil_action_frame_le *action_frame; |
---|
1560 | 1616 | struct brcmf_p2p_pub_act_frame *act_frm; |
---|
1561 | 1617 | s32 err = 0; |
---|
.. | .. |
---|
1634 | 1690 | config_af_params->extra_listen = false; |
---|
1635 | 1691 | break; |
---|
1636 | 1692 | default: |
---|
1637 | | - brcmf_err("Unknown p2p pub act frame subtype: %d\n", |
---|
1638 | | - act_frm->subtype); |
---|
| 1693 | + bphy_err(drvr, "Unknown p2p pub act frame subtype: %d\n", |
---|
| 1694 | + act_frm->subtype); |
---|
1639 | 1695 | err = -EINVAL; |
---|
1640 | 1696 | } |
---|
1641 | 1697 | return err; |
---|
1642 | 1698 | } |
---|
1643 | 1699 | |
---|
| 1700 | +static bool brcmf_p2p_check_dwell_overflow(u32 requested_dwell, |
---|
| 1701 | + unsigned long dwell_jiffies) |
---|
| 1702 | +{ |
---|
| 1703 | + if ((requested_dwell & CUSTOM_RETRY_MASK) && |
---|
| 1704 | + (jiffies_to_msecs(jiffies - dwell_jiffies) > |
---|
| 1705 | + (requested_dwell & ~CUSTOM_RETRY_MASK))) { |
---|
| 1706 | + brcmf_err("Action frame TX retry time over dwell time!\n"); |
---|
| 1707 | + return true; |
---|
| 1708 | + } |
---|
| 1709 | + return false; |
---|
| 1710 | +} |
---|
1644 | 1711 | /** |
---|
1645 | 1712 | * brcmf_p2p_send_action_frame() - send action frame . |
---|
1646 | 1713 | * |
---|
.. | .. |
---|
1657 | 1724 | struct brcmf_fil_action_frame_le *action_frame; |
---|
1658 | 1725 | struct brcmf_config_af_params config_af_params; |
---|
1659 | 1726 | struct afx_hdl *afx_hdl = &p2p->afx_hdl; |
---|
| 1727 | + struct brcmf_pub *drvr = cfg->pub; |
---|
1660 | 1728 | u16 action_frame_len; |
---|
1661 | 1729 | bool ack = false; |
---|
1662 | 1730 | u8 category; |
---|
.. | .. |
---|
1664 | 1732 | s32 tx_retry; |
---|
1665 | 1733 | s32 extra_listen_time; |
---|
1666 | 1734 | uint delta_ms; |
---|
| 1735 | + unsigned long dwell_jiffies = 0; |
---|
| 1736 | + bool dwell_overflow = false; |
---|
1667 | 1737 | |
---|
| 1738 | + u32 requested_dwell = le32_to_cpu(af_params->dwell_time); |
---|
1668 | 1739 | action_frame = &af_params->action_frame; |
---|
1669 | 1740 | action_frame_len = le16_to_cpu(action_frame->len); |
---|
1670 | 1741 | |
---|
.. | .. |
---|
1692 | 1763 | if (brcmf_p2p_pub_af_tx(cfg, af_params, &config_af_params)) { |
---|
1693 | 1764 | /* Just send unknown subtype frame with */ |
---|
1694 | 1765 | /* default parameters. */ |
---|
1695 | | - brcmf_err("P2P Public action frame, unknown subtype.\n"); |
---|
| 1766 | + bphy_err(drvr, "P2P Public action frame, unknown subtype.\n"); |
---|
1696 | 1767 | } |
---|
1697 | 1768 | } else if (brcmf_p2p_is_gas_action(action_frame->data, |
---|
1698 | 1769 | action_frame_len)) { |
---|
.. | .. |
---|
1714 | 1785 | af_params->dwell_time = |
---|
1715 | 1786 | cpu_to_le32(P2P_AF_MIN_DWELL_TIME); |
---|
1716 | 1787 | } else { |
---|
1717 | | - brcmf_err("Unknown action type: %d\n", action); |
---|
| 1788 | + bphy_err(drvr, "Unknown action type: %d\n", action); |
---|
1718 | 1789 | goto exit; |
---|
1719 | 1790 | } |
---|
1720 | 1791 | } else if (brcmf_p2p_is_p2p_action(action_frame->data, |
---|
.. | .. |
---|
1722 | 1793 | /* do not configure anything. it will be */ |
---|
1723 | 1794 | /* sent with a default configuration */ |
---|
1724 | 1795 | } else { |
---|
1725 | | - brcmf_err("Unknown Frame: category 0x%x, action 0x%x\n", |
---|
1726 | | - category, action); |
---|
| 1796 | + bphy_err(drvr, "Unknown Frame: category 0x%x, action 0x%x\n", |
---|
| 1797 | + category, action); |
---|
1727 | 1798 | return false; |
---|
1728 | 1799 | } |
---|
1729 | 1800 | |
---|
.. | .. |
---|
1761 | 1832 | |
---|
1762 | 1833 | if (brcmf_p2p_af_searching_channel(p2p) == |
---|
1763 | 1834 | P2P_INVALID_CHANNEL) { |
---|
1764 | | - brcmf_err("Couldn't find peer's channel.\n"); |
---|
| 1835 | + bphy_err(drvr, "Couldn't find peer's channel.\n"); |
---|
1765 | 1836 | goto exit; |
---|
1766 | 1837 | } |
---|
1767 | 1838 | |
---|
.. | .. |
---|
1775 | 1846 | /* update channel */ |
---|
1776 | 1847 | af_params->channel = cpu_to_le32(afx_hdl->peer_chan); |
---|
1777 | 1848 | } |
---|
| 1849 | + dwell_jiffies = jiffies; |
---|
| 1850 | + dwell_overflow = brcmf_p2p_check_dwell_overflow(requested_dwell, |
---|
| 1851 | + dwell_jiffies); |
---|
1778 | 1852 | |
---|
1779 | 1853 | tx_retry = 0; |
---|
1780 | 1854 | while (!p2p->block_gon_req_tx && |
---|
1781 | | - (ack == false) && (tx_retry < P2P_AF_TX_MAX_RETRY)) { |
---|
| 1855 | + (!ack) && (tx_retry < P2P_AF_TX_MAX_RETRY) && |
---|
| 1856 | + !dwell_overflow) { |
---|
| 1857 | + if (af_params->channel) |
---|
| 1858 | + msleep(P2P_AF_RETRY_DELAY_TIME); |
---|
| 1859 | + |
---|
1782 | 1860 | ack = !brcmf_p2p_tx_action_frame(p2p, af_params); |
---|
1783 | 1861 | tx_retry++; |
---|
| 1862 | + dwell_overflow = brcmf_p2p_check_dwell_overflow(requested_dwell, |
---|
| 1863 | + dwell_jiffies); |
---|
1784 | 1864 | } |
---|
1785 | | - if (ack == false) { |
---|
1786 | | - brcmf_err("Failed to send Action Frame(retry %d)\n", tx_retry); |
---|
| 1865 | + if (!ack) { |
---|
| 1866 | + bphy_err(drvr, "Failed to send Action Frame(retry %d)\n", |
---|
| 1867 | + tx_retry); |
---|
1787 | 1868 | clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); |
---|
1788 | 1869 | } |
---|
1789 | 1870 | |
---|
.. | .. |
---|
1957 | 2038 | |
---|
1958 | 2039 | /** |
---|
1959 | 2040 | * Change a P2P Role. |
---|
1960 | | - * Parameters: |
---|
1961 | | - * @mac: MAC address of the BSS to change a role |
---|
| 2041 | + * @cfg: driver private data for cfg80211 interface. |
---|
| 2042 | + * @if_type: interface type. |
---|
1962 | 2043 | * Returns 0 if success. |
---|
1963 | 2044 | */ |
---|
1964 | 2045 | int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg, |
---|
1965 | 2046 | enum brcmf_fil_p2p_if_types if_type) |
---|
1966 | 2047 | { |
---|
1967 | 2048 | struct brcmf_p2p_info *p2p = &cfg->p2p; |
---|
| 2049 | + struct brcmf_pub *drvr = cfg->pub; |
---|
1968 | 2050 | struct brcmf_cfg80211_vif *vif; |
---|
1969 | 2051 | struct brcmf_fil_p2p_if_le if_request; |
---|
1970 | 2052 | s32 err; |
---|
.. | .. |
---|
1974 | 2056 | |
---|
1975 | 2057 | vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; |
---|
1976 | 2058 | if (!vif) { |
---|
1977 | | - brcmf_err("vif for P2PAPI_BSSCFG_PRIMARY does not exist\n"); |
---|
| 2059 | + bphy_err(drvr, "vif for P2PAPI_BSSCFG_PRIMARY does not exist\n"); |
---|
1978 | 2060 | return -EPERM; |
---|
1979 | 2061 | } |
---|
1980 | 2062 | brcmf_notify_escan_complete(cfg, vif->ifp, true, true); |
---|
1981 | 2063 | vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif; |
---|
1982 | 2064 | if (!vif) { |
---|
1983 | | - brcmf_err("vif for P2PAPI_BSSCFG_CONNECTION does not exist\n"); |
---|
| 2065 | + bphy_err(drvr, "vif for P2PAPI_BSSCFG_CONNECTION does not exist\n"); |
---|
1984 | 2066 | return -EPERM; |
---|
1985 | 2067 | } |
---|
1986 | 2068 | brcmf_set_mpc(vif->ifp, 0); |
---|
.. | .. |
---|
1992 | 2074 | |
---|
1993 | 2075 | if_request.type = cpu_to_le16((u16)if_type); |
---|
1994 | 2076 | if_request.chspec = cpu_to_le16(chanspec); |
---|
1995 | | - memcpy(if_request.addr, p2p->int_addr, sizeof(if_request.addr)); |
---|
| 2077 | + memcpy(if_request.addr, p2p->conn_int_addr, sizeof(if_request.addr)); |
---|
1996 | 2078 | |
---|
1997 | 2079 | brcmf_cfg80211_arm_vif_event(cfg, vif); |
---|
1998 | 2080 | err = brcmf_fil_iovar_data_set(vif->ifp, "p2p_ifupd", &if_request, |
---|
1999 | 2081 | sizeof(if_request)); |
---|
2000 | 2082 | if (err) { |
---|
2001 | | - brcmf_err("p2p_ifupd FAILED, err=%d\n", err); |
---|
| 2083 | + bphy_err(drvr, "p2p_ifupd FAILED, err=%d\n", err); |
---|
2002 | 2084 | brcmf_cfg80211_arm_vif_event(cfg, NULL); |
---|
2003 | 2085 | return err; |
---|
2004 | 2086 | } |
---|
.. | .. |
---|
2006 | 2088 | BRCMF_VIF_EVENT_TIMEOUT); |
---|
2007 | 2089 | brcmf_cfg80211_arm_vif_event(cfg, NULL); |
---|
2008 | 2090 | if (!err) { |
---|
2009 | | - brcmf_err("No BRCMF_E_IF_CHANGE event received\n"); |
---|
| 2091 | + bphy_err(drvr, "No BRCMF_E_IF_CHANGE event received\n"); |
---|
2010 | 2092 | return -EIO; |
---|
2011 | 2093 | } |
---|
2012 | 2094 | |
---|
.. | .. |
---|
2069 | 2151 | struct wiphy *wiphy, |
---|
2070 | 2152 | u8 *addr) |
---|
2071 | 2153 | { |
---|
| 2154 | + struct brcmf_pub *drvr = p2p->cfg->pub; |
---|
2072 | 2155 | struct brcmf_cfg80211_vif *p2p_vif; |
---|
2073 | 2156 | struct brcmf_if *p2p_ifp; |
---|
2074 | 2157 | struct brcmf_if *pri_ifp; |
---|
.. | .. |
---|
2080 | 2163 | |
---|
2081 | 2164 | p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE); |
---|
2082 | 2165 | if (IS_ERR(p2p_vif)) { |
---|
2083 | | - brcmf_err("could not create discovery vif\n"); |
---|
| 2166 | + bphy_err(drvr, "could not create discovery vif\n"); |
---|
2084 | 2167 | return (struct wireless_dev *)p2p_vif; |
---|
2085 | 2168 | } |
---|
2086 | 2169 | |
---|
.. | .. |
---|
2088 | 2171 | |
---|
2089 | 2172 | /* firmware requires unique mac address for p2pdev interface */ |
---|
2090 | 2173 | if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) { |
---|
2091 | | - brcmf_err("discovery vif must be different from primary interface\n"); |
---|
2092 | | - return ERR_PTR(-EINVAL); |
---|
| 2174 | + bphy_err(drvr, "discovery vif must be different from primary interface\n"); |
---|
| 2175 | + err = -EINVAL; |
---|
| 2176 | + goto fail; |
---|
2093 | 2177 | } |
---|
2094 | 2178 | |
---|
2095 | 2179 | brcmf_p2p_generate_bss_mac(p2p, addr); |
---|
.. | .. |
---|
2101 | 2185 | /* Initialize P2P Discovery in the firmware */ |
---|
2102 | 2186 | err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); |
---|
2103 | 2187 | if (err < 0) { |
---|
2104 | | - brcmf_err("set p2p_disc error\n"); |
---|
| 2188 | + bphy_err(drvr, "set p2p_disc error\n"); |
---|
2105 | 2189 | brcmf_fweh_p2pdev_setup(pri_ifp, false); |
---|
2106 | 2190 | brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); |
---|
2107 | 2191 | goto fail; |
---|
.. | .. |
---|
2113 | 2197 | brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); |
---|
2114 | 2198 | brcmf_fweh_p2pdev_setup(pri_ifp, false); |
---|
2115 | 2199 | if (!err) { |
---|
2116 | | - brcmf_err("timeout occurred\n"); |
---|
| 2200 | + bphy_err(drvr, "timeout occurred\n"); |
---|
2117 | 2201 | err = -EIO; |
---|
2118 | 2202 | goto fail; |
---|
2119 | 2203 | } |
---|
.. | .. |
---|
2127 | 2211 | /* verify bsscfg index for P2P discovery */ |
---|
2128 | 2212 | err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx); |
---|
2129 | 2213 | if (err < 0) { |
---|
2130 | | - brcmf_err("retrieving discover bsscfg index failed\n"); |
---|
| 2214 | + bphy_err(drvr, "retrieving discover bsscfg index failed\n"); |
---|
2131 | 2215 | goto fail; |
---|
2132 | 2216 | } |
---|
2133 | 2217 | |
---|
.. | .. |
---|
2143 | 2227 | fail: |
---|
2144 | 2228 | brcmf_free_vif(p2p_vif); |
---|
2145 | 2229 | return ERR_PTR(err); |
---|
| 2230 | +} |
---|
| 2231 | + |
---|
| 2232 | +static int brcmf_p2p_get_conn_idx(struct brcmf_cfg80211_info *cfg) |
---|
| 2233 | +{ |
---|
| 2234 | + int i; |
---|
| 2235 | + struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); |
---|
| 2236 | + |
---|
| 2237 | + if (!ifp) |
---|
| 2238 | + return -ENODEV; |
---|
| 2239 | + |
---|
| 2240 | + for (i = P2PAPI_BSSCFG_CONNECTION; i < P2PAPI_BSSCFG_MAX; i++) { |
---|
| 2241 | + if (!cfg->p2p.bss_idx[i].vif) { |
---|
| 2242 | + if (i == P2PAPI_BSSCFG_CONNECTION2 && |
---|
| 2243 | + !(brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) { |
---|
| 2244 | + brcmf_err("Multi p2p not supported"); |
---|
| 2245 | + return -EIO; |
---|
| 2246 | + } |
---|
| 2247 | + return i; |
---|
| 2248 | + } |
---|
| 2249 | + } |
---|
| 2250 | + return -EIO; |
---|
2146 | 2251 | } |
---|
2147 | 2252 | |
---|
2148 | 2253 | /** |
---|
.. | .. |
---|
2161 | 2266 | { |
---|
2162 | 2267 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); |
---|
2163 | 2268 | struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); |
---|
| 2269 | + struct brcmf_pub *drvr = cfg->pub; |
---|
2164 | 2270 | struct brcmf_cfg80211_vif *vif; |
---|
2165 | 2271 | enum brcmf_fil_p2p_if_types iftype; |
---|
2166 | | - int err; |
---|
| 2272 | + int err = 0; |
---|
| 2273 | + int connidx; |
---|
| 2274 | + u8 *p2p_intf_addr; |
---|
2167 | 2275 | |
---|
2168 | 2276 | if (brcmf_cfg80211_vif_event_armed(cfg)) |
---|
2169 | 2277 | return ERR_PTR(-EBUSY); |
---|
.. | .. |
---|
2189 | 2297 | return (struct wireless_dev *)vif; |
---|
2190 | 2298 | brcmf_cfg80211_arm_vif_event(cfg, vif); |
---|
2191 | 2299 | |
---|
2192 | | - err = brcmf_p2p_request_p2p_if(&cfg->p2p, ifp, cfg->p2p.int_addr, |
---|
2193 | | - iftype); |
---|
| 2300 | + connidx = brcmf_p2p_get_conn_idx(cfg); |
---|
| 2301 | + |
---|
| 2302 | + if (connidx == P2PAPI_BSSCFG_CONNECTION) |
---|
| 2303 | + p2p_intf_addr = cfg->p2p.conn_int_addr; |
---|
| 2304 | + else if (connidx == P2PAPI_BSSCFG_CONNECTION2) |
---|
| 2305 | + p2p_intf_addr = cfg->p2p.conn2_int_addr; |
---|
| 2306 | + else |
---|
| 2307 | + err = -EINVAL; |
---|
| 2308 | + |
---|
| 2309 | + if (!err) |
---|
| 2310 | + err = brcmf_p2p_request_p2p_if(&cfg->p2p, ifp, |
---|
| 2311 | + p2p_intf_addr, iftype); |
---|
| 2312 | + |
---|
2194 | 2313 | if (err) { |
---|
| 2314 | + brcmf_err("request p2p interface failed\n"); |
---|
2195 | 2315 | brcmf_cfg80211_arm_vif_event(cfg, NULL); |
---|
2196 | 2316 | goto fail; |
---|
2197 | 2317 | } |
---|
.. | .. |
---|
2201 | 2321 | BRCMF_VIF_EVENT_TIMEOUT); |
---|
2202 | 2322 | brcmf_cfg80211_arm_vif_event(cfg, NULL); |
---|
2203 | 2323 | if (!err) { |
---|
2204 | | - brcmf_err("timeout occurred\n"); |
---|
| 2324 | + bphy_err(drvr, "timeout occurred\n"); |
---|
2205 | 2325 | err = -EIO; |
---|
2206 | 2326 | goto fail; |
---|
2207 | 2327 | } |
---|
.. | .. |
---|
2209 | 2329 | /* interface created in firmware */ |
---|
2210 | 2330 | ifp = vif->ifp; |
---|
2211 | 2331 | if (!ifp) { |
---|
2212 | | - brcmf_err("no if pointer provided\n"); |
---|
| 2332 | + bphy_err(drvr, "no if pointer provided\n"); |
---|
2213 | 2333 | err = -ENOENT; |
---|
2214 | 2334 | goto fail; |
---|
2215 | 2335 | } |
---|
.. | .. |
---|
2218 | 2338 | ifp->ndev->name_assign_type = name_assign_type; |
---|
2219 | 2339 | err = brcmf_net_attach(ifp, true); |
---|
2220 | 2340 | if (err) { |
---|
2221 | | - brcmf_err("Registering netdevice failed\n"); |
---|
| 2341 | + bphy_err(drvr, "Registering netdevice failed\n"); |
---|
2222 | 2342 | free_netdev(ifp->ndev); |
---|
2223 | 2343 | goto fail; |
---|
2224 | 2344 | } |
---|
2225 | 2345 | |
---|
2226 | | - cfg->p2p.bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = vif; |
---|
| 2346 | + cfg->p2p.bss_idx[connidx].vif = vif; |
---|
2227 | 2347 | /* Disable firmware roaming for P2P interface */ |
---|
2228 | 2348 | brcmf_fil_iovar_int_set(ifp, "roam_off", 1); |
---|
2229 | 2349 | if (iftype == BRCMF_FIL_P2P_IF_GO) { |
---|
.. | .. |
---|
2373 | 2493 | */ |
---|
2374 | 2494 | s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced) |
---|
2375 | 2495 | { |
---|
| 2496 | + struct brcmf_pub *drvr = cfg->pub; |
---|
2376 | 2497 | struct brcmf_p2p_info *p2p; |
---|
2377 | 2498 | struct brcmf_if *pri_ifp; |
---|
2378 | 2499 | s32 err = 0; |
---|
.. | .. |
---|
2387 | 2508 | if (p2pdev_forced) { |
---|
2388 | 2509 | err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL); |
---|
2389 | 2510 | if (IS_ERR(err_ptr)) { |
---|
2390 | | - brcmf_err("P2P device creation failed.\n"); |
---|
| 2511 | + bphy_err(drvr, "P2P device creation failed.\n"); |
---|
2391 | 2512 | err = PTR_ERR(err_ptr); |
---|
2392 | 2513 | } |
---|
2393 | 2514 | } else { |
---|