From 2487f8f7e9c5c490ec43da4a7be8a16f21edcdd7 Mon Sep 17 00:00:00 2001 From: Rachit Kankane Date: Wed, 19 Apr 2017 14:30:19 +0530 Subject: [PATCH] qcacld-3.0: HDD, SAP changes to Disable/Enable NOA P2P-GO whenever goes offchannel, issues NOA. With this behavior, we have issue whenever legacy STA connects to P2P-GO as legacy STA does not understand NOA. To handle this case, changes are done in HDD and SAP component and the revised behavior will be: 1. By default no change in NOA. 2. Whenever first legacy STA connects to GO, SAP informs HDD with new parameter station type. HDD will communicate the same to p2p protocol component. Once the connected station is authorized p2p protocol component will disable NOA (i.e. P2P-GO will start issuing Self-CTS whenever it goes off-channel). 3. Whenever last legacy STA disconnects from GO, p2p protocol component enables NOA (i.e. P2P-GO will start issuing NOA whenever it goes off-channel). Change-Id: Iadab47c9a2aeb434371d4c262623d7196f3b1ab4 CRs-Fixed: 2035609 --- core/hdd/inc/wlan_hdd_main.h | 3 +++ core/hdd/src/wlan_hdd_assoc.c | 6 ++++-- core/hdd/src/wlan_hdd_hostapd.c | 10 +++++++++- core/hdd/src/wlan_hdd_object_manager.c | 13 +++++++++---- core/hdd/src/wlan_hdd_object_manager.h | 8 +++++--- core/hdd/src/wlan_hdd_softap_tx_rx.c | 2 ++ core/sap/inc/sap_api.h | 10 ++++++++++ core/sap/src/sap_fsm.c | 8 ++++++++ 8 files changed, 50 insertions(+), 10 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 7ce59205b61c..f4e73e661a63 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -713,6 +713,9 @@ typedef struct { */ uint8_t ucSTAId; + /* type of station i.e. p2p client or infrastructure station */ + eStationType staType; + /** MAC address of the station */ struct qdf_mac_addr macAddrSTA; diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index fe4b735b26da..567188f5f614 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1276,7 +1276,8 @@ static void hdd_send_association_event(struct net_device *dev, ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, pAdapter->device_mode, - peerMacAddr.bytes); + peerMacAddr.bytes, + false); if (ret) hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", MAC_ADDR_ARRAY(peerMacAddr.bytes)); @@ -1326,7 +1327,8 @@ static void hdd_send_association_event(struct net_device *dev, ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, QDF_IBSS_MODE, - pCsrRoamInfo->bssid.bytes); + pCsrRoamInfo->bssid.bytes, + false); if (ret) hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", MAC_ADDR_ARRAY(pCsrRoamInfo->bssid.bytes)); diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 317090c7f575..d14f279fdb81 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1574,6 +1574,12 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, pSapEvent->sapevt. sapStationAssocReassocCompleteEvent. chan_info.rate_flags; + pHostapdAdapter->aStaInfo[staId].staType = + pSapEvent->sapevt. + sapStationAssocReassocCompleteEvent. + staType; + hdd_debug("hdd_hostapd_sap_event_cb, StaID: %d, StaType: %d", + staId, pHostapdAdapter->aStaInfo[staId].staType); } if (hdd_ipa_is_enabled(pHddCtx)) { @@ -1692,7 +1698,9 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, pHostapdAdapter->hdd_vdev, pHostapdAdapter->device_mode, pSapEvent->sapevt.sapStationAssocReassocCompleteEvent. - staMac.bytes); + staMac.bytes, + (pHostapdAdapter->aStaInfo[staId].staType + == eSTA_TYPE_P2P_CLI)); if (ret) hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", MAC_ADDR_ARRAY(pSapEvent->sapevt. diff --git a/core/hdd/src/wlan_hdd_object_manager.c b/core/hdd/src/wlan_hdd_object_manager.c index a300dc196409..8032921c090d 100644 --- a/core/hdd/src/wlan_hdd_object_manager.c +++ b/core/hdd/src/wlan_hdd_object_manager.c @@ -245,7 +245,8 @@ int hdd_objmgr_release_and_destroy_vdev(hdd_adapter_t *adapter) int hdd_objmgr_add_peer_object(struct wlan_objmgr_vdev *vdev, enum tQDF_ADAPTER_MODE adapter_mode, - uint8_t *mac_addr) + uint8_t *mac_addr, + bool is_p2p_type) { enum wlan_peer_type peer_type; struct wlan_objmgr_peer *peer; @@ -255,7 +256,11 @@ int hdd_objmgr_add_peer_object(struct wlan_objmgr_vdev *vdev, peer_type = WLAN_PEER_AP; } else if ((adapter_mode == QDF_SAP_MODE) || (adapter_mode == QDF_P2P_GO_MODE)) { - peer_type = WLAN_PEER_STA; + if (is_p2p_type) { + peer_type = WLAN_PEER_P2P_CLI; + } else { + peer_type = WLAN_PEER_STA; + } } else if (adapter_mode == QDF_IBSS_MODE) { peer_type = WLAN_PEER_IBSS; } else { @@ -273,8 +278,8 @@ int hdd_objmgr_add_peer_object(struct wlan_objmgr_vdev *vdev, if (!peer) return -ENOMEM; - hdd_info("Peer object "MAC_ADDRESS_STR" add success!", - MAC_ADDR_ARRAY(mac_addr)); + hdd_info("Peer object "MAC_ADDRESS_STR" add success! Type: %d", + MAC_ADDR_ARRAY(mac_addr), peer_type); return 0; } diff --git a/core/hdd/src/wlan_hdd_object_manager.h b/core/hdd/src/wlan_hdd_object_manager.h index 610ee496d4be..adac92e8b21a 100644 --- a/core/hdd/src/wlan_hdd_object_manager.h +++ b/core/hdd/src/wlan_hdd_object_manager.h @@ -159,16 +159,18 @@ int hdd_objmgr_release_and_destroy_vdev(hdd_adapter_t *adapter); * @vdev: vdev pointer * @adapter_mode: adapter mode * @mac_addr: Peer mac address + * @is_p2p_type: TRUE if peer is p2p type * * This API creates and adds the peer object to the given @vdev. The peer type - * (STA, AP or IBSS) is assigned based on adapter mode. For example, if adapter - * mode is STA, peer is AP. + * (STA, AP, P2P or IBSS) is assigned based on adapter mode. For example, if + * adapter mode is STA, peer is AP. * * Return: 0 for success, negative error code for failure */ int hdd_objmgr_add_peer_object(struct wlan_objmgr_vdev *vdev, enum tQDF_ADAPTER_MODE adapter_mode, - uint8_t *mac_addr); + uint8_t *mac_addr, + bool is_p2p_type); /** * hdd_objmgr_remove_peer_object() - Delete and remove the peer from vdev diff --git a/core/hdd/src/wlan_hdd_softap_tx_rx.c b/core/hdd/src/wlan_hdd_softap_tx_rx.c index 4062e6a52256..927f359f6df2 100644 --- a/core/hdd/src/wlan_hdd_softap_tx_rx.c +++ b/core/hdd/src/wlan_hdd_softap_tx_rx.c @@ -47,6 +47,7 @@ #include #include #include +#include "wlan_p2p_ucfg_api.h" #ifdef IPA_OFFLOAD #include #endif @@ -1067,6 +1068,7 @@ QDF_STATUS hdd_softap_change_sta_state(hdd_adapter_t *pAdapter, if (QDF_STATUS_SUCCESS == qdf_status) { pAdapter->aStaInfo[ucSTAId].tlSTAState = OL_TXRX_PEER_STATE_AUTH; + p2p_peer_authorized(pAdapter->hdd_vdev, pDestMacAddress->bytes); } EXIT(); diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 45f7d80d4ea1..223cca7b2cb8 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -234,6 +234,15 @@ typedef enum { eSAP_WPSPBC_ONE_WPSPBC_PROBE_REQ_IN120S, } eWPSPBCOverlap; +/*--------------------------------------------------------------------------- + SAP Associated station types + ---------------------------------------------------------------------------*/ +typedef enum { + eSTA_TYPE_NONE = 0x00000000, /* No station type */ + eSTA_TYPE_INFRA = 0x00000001, /* legacy station */ + eSTA_TYPE_P2P_CLI = 0x00000002, /* p2p client */ +} eStationType; + /*---------------------------------------------------------------------------- * Typedefs * -------------------------------------------------------------------------*/ @@ -267,6 +276,7 @@ typedef struct sap_StationAssocIndication_s { typedef struct sap_StationAssocReassocCompleteEvent_s { struct qdf_mac_addr staMac; + eStationType staType; uint8_t staId; uint8_t status; uint8_t ies[MAX_ASSOC_IND_IE_LEN]; diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 38d113a04e8f..73508da9993d 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -55,6 +55,7 @@ #include "cds_reg_service.h" #include "qdf_util.h" #include "wlan_policy_mgr_api.h" +#include "cfg_api.h" #include #include #include @@ -2393,6 +2394,13 @@ QDF_STATUS sap_signal_hdd_event(ptSapContext sap_ctx, qdf_mem_copy(&reassoc_complete->ies[len], csr_roaminfo->paddIE, csr_roaminfo->addIELen); + if (cfg_get_vendor_ie_ptr_from_oui(mac_ctx, + SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE, + csr_roaminfo->paddIE, csr_roaminfo->addIELen)) { + reassoc_complete->staType = eSTA_TYPE_P2P_CLI; + } else { + reassoc_complete->staType = eSTA_TYPE_INFRA; + } } /* also fill up the channel info from the csr_roamInfo */