Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c6b4e19 authored by Houston Hoffman's avatar Houston Hoffman Committed by Akash Patel
Browse files

qcacld-3.0: Define wma_is_vdev_in_beaconning_mode

Define wma_is_vdev_in_beaconning_mode to remove in function ifdefs.
Remove conditional compilation arround wma_is_vdev_in_ibss_mode calls.

Change-Id: I4b047d05088b5cbe51fa49818634fdd3a78e6b68
CRs-Fixed: 935297
parent 58e12dc3
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -463,8 +463,38 @@ bool wma_is_vdev_in_ap_mode(tp_wma_handle wma, uint8_t vdev_id);

#ifdef QCA_IBSS_SUPPORT
bool wma_is_vdev_in_ibss_mode(tp_wma_handle wma, uint8_t vdev_id);
#else
/**
 * wma_is_vdev_in_ibss_mode(): dummy function
 * @wma: wma handle
 * @vdev_id: vdev id
 *
 * Return false since no vdev can be in ibss mode without ibss support
 */
static inline
bool wma_is_vdev_in_ibss_mode(tp_wma_handle wma, uint8_t vdev_id);
{
	return false;
}
#endif

/**
 * wma_is_vdev_in_beaconning_mode() - check if vdev is in a beaconning mode
 * @wma: wma handle
 * @vdev_id: vdev id
 *
 * Helper function to know whether given vdev id
 * is in a beaconning mode or not.
 *
 * Return: True if vdev needs to beacon.
 */
static inline
bool wma_is_vdev_in_beaconning_mode(tp_wma_handle wma, uint8_t vdev_id)
{
	return wma_is_vdev_in_ap_mode(wma, vdev_id) ||
		wma_is_vdev_in_ibss_mode(wma, vdev_id);
}

/**
 * wma_find_bssid_by_vdev_id() - Get the BSS ID corresponding to the vdev ID
 * @wma - wma handle
+38 −27
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
 *
 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
 *
@@ -153,7 +153,6 @@ bool wma_is_vdev_in_ibss_mode(tp_wma_handle wma, uint8_t vdev_id)
}
#endif /* QCA_IBSS_SUPPORT */


/**
 * wma_find_vdev_by_bssid() - Get the corresponding vdev_id from BSSID
 * @wma - wma handle
@@ -1078,13 +1077,11 @@ void wma_remove_peer(tp_wma_handle wma, uint8_t *bssid,
	wmi_unified_peer_flush_tids_send(wma->wmi_handle, bssid,
					 peer_tid_bitmap, vdev_id);

#if defined(QCA_IBSS_SUPPORT)
	if ((peer) && (wma_is_vdev_in_ibss_mode(wma, vdev_id))) {
		WMA_LOGD("%s: bssid %pM peer->mac_addr %pM", __func__,
			 bssid, peer->mac_addr.raw);
		peer_addr = peer->mac_addr.raw;
	}
#endif /* QCA_IBSS_SUPPORT */

	wmi_unified_peer_delete_send(wma->wmi_handle, peer_addr, vdev_id);
#undef PEER_ALL_TID_BITMASK
@@ -1179,7 +1176,6 @@ CDF_STATUS wma_create_peer(tp_wma_handle wma, ol_txrx_pdev_handle pdev,
	WMA_LOGE("%s: Created peer with peer_addr %pM vdev_id %d, peer_count - %d",
		__func__, peer_addr, vdev_id, wma->interfaces[vdev_id].peer_count);

#ifdef QCA_IBSS_SUPPORT
	/* for each remote ibss peer, clear its keys */
	if (wma_is_vdev_in_ibss_mode(wma, vdev_id) &&
	    !cdf_mem_compare(peer_addr, vdev->mac_addr.raw,
@@ -1196,7 +1192,6 @@ CDF_STATUS wma_create_peer(tp_wma_handle wma, ol_txrx_pdev_handle pdev,

		wma_set_stakey(wma, &key_info);
	}
#endif /* QCA_IBSS_SUPPORT */

	return CDF_STATUS_SUCCESS;
err:
@@ -1289,7 +1284,22 @@ static void wma_delete_all_ibss_peers(tp_wma_handle wma, A_UINT32 vdev_id)
	wma_remove_peer(wma, wma->interfaces[vdev_id].bssid, vdev_id, peer,
			false);
}

#else
/**
 * wma_delete_all_ibss_peers(): dummy function for when ibss is not supported
 * @wma: wma handle
 * @vdev_id: vdev id
 *
 * This function send peer delete command to fw for all
 * peers in peer_list  and remove ref count for peer id
 * peer will actually remove from list after receving
 * unmap event from firmware.
 *
 * Return: none
 */
static void wma_delete_all_ibss_peers(tp_wma_handle wma, A_UINT32 vdev_id)
{
}
#endif /* QCA_IBSS_SUPPORT */

/**
@@ -1405,6 +1415,20 @@ static void wma_recreate_ibss_vdev_and_bss_peer(tp_wma_handle wma,
		WMA_LOGA("IBSS BSS peer created with mac %pM",
			 vdev->mac_addr.raw);
}
#else
/**
 * wma_recreate_ibss_vdev_and_bss_peer() - dummy function
 * @wma: wma handle
 * @vdev_id: vdev id
 *
 * Dummy for when IBSS not supported
 *
 * Return: none
 */
static void wma_recreate_ibss_vdev_and_bss_peer(tp_wma_handle wma,
						uint8_t vdev_id)
{
}
#endif /* QCA_IBSS_SUPPORT */

/**
@@ -1568,11 +1592,9 @@ int wma_vdev_stop_resp_handler(void *handle, uint8_t *cmd_param_info,
			status = -EINVAL;
			goto free_req_msg;
		}
#ifdef QCA_IBSS_SUPPORT
		if (wma_is_vdev_in_ibss_mode(wma, resp_event->vdev_id))
			wma_delete_all_ibss_peers(wma, resp_event->vdev_id);
		else
#endif /* QCA_IBSS_SUPPORT */
		{
			if (wma_is_vdev_in_ap_mode(wma, resp_event->vdev_id)) {
				wma_delete_all_ap_remote_peers(wma,
@@ -1619,12 +1641,12 @@ int wma_vdev_stop_resp_handler(void *handle, uint8_t *cmd_param_info,
			cdf_mem_free(bcn);
			wma->interfaces[resp_event->vdev_id].beacon = NULL;
		}
#ifdef QCA_IBSS_SUPPORT

		/* recreate ibss vdev and bss peer for scan purpose */
		if (wma_is_vdev_in_ibss_mode(wma, resp_event->vdev_id))
			wma_recreate_ibss_vdev_and_bss_peer(wma,
						resp_event->vdev_id);
#endif /* QCA_IBSS_SUPPORT */

		/* Timeout status means its WMA generated DEL BSS REQ when ADD
		 * BSS REQ was timed out to stop the VDEV in this case no need
		 * to send response to UMAC
@@ -2472,11 +2494,9 @@ void wma_vdev_resp_timer(void *data)
			cdf_mc_timer_stop(&tgt_req->event_timeout);
			goto free_tgt_req;
		}
#ifdef QCA_IBSS_SUPPORT
		if (wma_is_vdev_in_ibss_mode(wma, tgt_req->vdev_id))
			wma_delete_all_ibss_peers(wma, tgt_req->vdev_id);
		else
#endif /* QCA_IBSS_SUPPORT */
		{
			if (wma_is_vdev_in_ap_mode(wma, tgt_req->vdev_id)) {
				wma_delete_all_ap_remote_peers(wma,
@@ -2522,12 +2542,12 @@ void wma_vdev_resp_timer(void *data)
			cdf_mem_free(bcn);
			wma->interfaces[tgt_req->vdev_id].beacon = NULL;
		}
#ifdef QCA_IBSS_SUPPORT

		/* recreate ibss vdev and bss peer for scan purpose */
		if (wma_is_vdev_in_ibss_mode(wma, tgt_req->vdev_id))
			wma_recreate_ibss_vdev_and_bss_peer(wma,
							    tgt_req->vdev_id);
#endif /* QCA_IBSS_SUPPORT */

		params->status = CDF_STATUS_E_TIMEOUT;
		WMA_LOGA("%s: WMA_DELETE_BSS_REQ timedout", __func__);
		wma_send_msg(wma, WMA_DELETE_BSS_RSP, (void *)params, 0);
@@ -4221,19 +4241,16 @@ void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta)

	if (wma_is_vdev_in_ap_mode(wma, add_sta->smesessionId))
		oper_mode = BSS_OPERATIONAL_MODE_AP;
#ifdef QCA_IBSS_SUPPORT
	else if (wma_is_vdev_in_ibss_mode(wma, add_sta->smesessionId))
		oper_mode = BSS_OPERATIONAL_MODE_IBSS;
#endif

	switch (oper_mode) {
	case BSS_OPERATIONAL_MODE_STA:
		wma_add_sta_req_sta_mode(wma, add_sta);
		break;

#ifdef QCA_IBSS_SUPPORT
	case BSS_OPERATIONAL_MODE_IBSS: /* IBSS should share the same code as AP mode */
#endif
	/* IBSS should share the same code as AP mode */
	case BSS_OPERATIONAL_MODE_IBSS:
	case BSS_OPERATIONAL_MODE_AP:
		hif_vote_link_up();
		wma_add_sta_req_ap_mode(wma, add_sta);
@@ -4263,21 +4280,17 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta)

	if (wma_is_vdev_in_ap_mode(wma, smesession_id))
		oper_mode = BSS_OPERATIONAL_MODE_AP;
#ifdef QCA_IBSS_SUPPORT
	if (wma_is_vdev_in_ibss_mode(wma, smesession_id)) {
		oper_mode = BSS_OPERATIONAL_MODE_IBSS;
		WMA_LOGD("%s: to delete sta for IBSS mode", __func__);
	}
#endif

	switch (oper_mode) {
	case BSS_OPERATIONAL_MODE_STA:
		wma_delete_sta_req_sta_mode(wma, del_sta);
		break;

#ifdef QCA_IBSS_SUPPORT
	case BSS_OPERATIONAL_MODE_IBSS: /* IBSS shares AP code */
#endif
	case BSS_OPERATIONAL_MODE_AP:
		hif_vote_link_down();
		wma_delete_sta_req_ap_mode(wma, del_sta);
@@ -4353,14 +4366,12 @@ void wma_delete_bss(tp_wma_handle wma, tpDeleteBssParams params)
		WMA_LOGE("%s:Unable to get TXRX context", __func__);
		goto out;
	}
#ifdef QCA_IBSS_SUPPORT
	if (wma_is_vdev_in_ibss_mode(wma, params->smesessionId))
		/* in rome ibss case, self mac is used to create the bss peer */
		peer = ol_txrx_find_peer_by_addr(pdev,
			wma->interfaces[params->smesessionId].addr,
			&peer_id);
	else
#endif
		peer = ol_txrx_find_peer_by_addr(pdev, params->bssid, &peer_id);

	if (!peer) {
+2 −10
Original line number Diff line number Diff line
@@ -3391,12 +3391,7 @@ void wma_register_wow_default_patterns(WMA_HANDLE handle, uint8_t vdev_id)
	iface = &wma->interfaces[vdev_id];

	if (iface->ptrn_match_enable) {
		if (wma_is_vdev_in_ap_mode(wma, vdev_id)
#ifdef QCA_IBSS_SUPPORT
			||
			wma_is_vdev_in_ibss_mode(wma, vdev_id)
#endif
			) {
		if (wma_is_vdev_in_beaconning_mode(wma, vdev_id)) {
			/* Configure SAP/GO/IBSS mode default wow patterns */
			WMA_LOGI("Config SAP specific default wow patterns vdev_id %d",
				 vdev_id);
@@ -3985,10 +3980,7 @@ CDF_STATUS wma_suspend_req(tp_wma_handle wma, tpSirWlanSuspendParam info)
	 *  4) Is Extscan in progress in any one of vdev ?
	 */
	for (i = 0; i < wma->max_bssid; i++) {
		if ((wma_is_vdev_in_ap_mode(wma, i)
#ifdef QCA_IBSS_SUPPORT
		     || wma_is_vdev_in_ibss_mode(wma, i)
#endif /* QCA_IBSS_SUPPORT */
		if ((wma_is_vdev_in_beaconning_mode(wma, i)
		     ) && wma->interfaces[i].vdev_up &&
		    WMI_SERVICE_IS_ENABLED(wma->wmi_service_bitmap,
					   WMI_SERVICE_BEACON_OFFLOAD)) {
+1 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
 *
 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
 *
@@ -954,9 +954,7 @@ int32_t wmi_unified_send_peer_assoc(tp_wma_handle wma,
	 * be the new peer address
	 */
	if ((wma_is_vdev_in_ap_mode(wma, params->smesessionId))
#ifdef QCA_IBSS_SUPPORT
	    || (wma_is_vdev_in_ibss_mode(wma, params->smesessionId))
#endif /* QCA_IBSS_SUPPORT */
#ifdef FEATURE_WLAN_TDLS
	    || (STA_ENTRY_TDLS_PEER == params->staType)
#endif /* FEATURE_WLAN_TDLS */