1 /*
2 * Copyright (c) 2016-2019, 2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /**
21 * DOC: nan_datapath_api.c
22 *
23 * SME NAN Data path API implementation
24 */
25 #include <sir_common.h>
26 #include <ani_global.h>
27 #include "sme_api.h"
28 #include "sme_inside.h"
29 #include "csr_internal.h"
30 #include "sme_nan_datapath.h"
31
32 /**
33 * csr_roam_update_ndp_return_params() - updates ndp return parameters
34 * @mac_ctx: MAC context handle
35 * @result: result of the roaming command
36 * @roam_status: roam status returned to the roam command initiator
37 * @roam_result: roam result returned to the roam command initiator
38 * @roam_info: Roam info data structure to be updated
39 *
40 * Results: None
41 */
csr_roam_update_ndp_return_params(struct mac_context * mac_ctx,uint32_t result,uint32_t * roam_status,uint32_t * roam_result,struct csr_roam_info * roam_info)42 void csr_roam_update_ndp_return_params(struct mac_context *mac_ctx,
43 uint32_t result,
44 uint32_t *roam_status,
45 uint32_t *roam_result,
46 struct csr_roam_info *roam_info)
47 {
48
49 switch (result) {
50 case CSR_SAP_START_BSS_SUCCESS:
51 roam_info->ndp.ndi_create_params.reason = 0;
52 roam_info->ndp.ndi_create_params.status =
53 NDP_RSP_STATUS_SUCCESS;
54 roam_info->ndp.ndi_create_params.sta_id = roam_info->staId;
55 *roam_status = eCSR_ROAM_NDP_STATUS_UPDATE;
56 *roam_result = eCSR_ROAM_RESULT_NDI_CREATE_RSP;
57 break;
58 case CSR_SAP_START_BSS_FAILURE:
59 roam_info->ndp.ndi_create_params.status = NDP_RSP_STATUS_ERROR;
60 roam_info->ndp.ndi_create_params.reason =
61 NDP_NAN_DATA_IFACE_CREATE_FAILED;
62 *roam_status = eCSR_ROAM_NDP_STATUS_UPDATE;
63 *roam_result = eCSR_ROAM_RESULT_NDI_CREATE_RSP;
64 break;
65 case CSR_SAP_STOP_BSS_SUCCESS:
66 roam_info->ndp.ndi_delete_params.reason = 0;
67 roam_info->ndp.ndi_delete_params.status =
68 NDP_RSP_STATUS_SUCCESS;
69 *roam_status = eCSR_ROAM_NDP_STATUS_UPDATE;
70 *roam_result = eCSR_ROAM_RESULT_NDI_DELETE_RSP;
71 break;
72 case CSR_SAP_STOP_BSS_FAILURE:
73 roam_info->ndp.ndi_delete_params.status = NDP_RSP_STATUS_ERROR;
74 roam_info->ndp.ndi_delete_params.reason =
75 NDP_NAN_DATA_IFACE_DELETE_FAILED;
76 *roam_status = eCSR_ROAM_NDP_STATUS_UPDATE;
77 *roam_result = eCSR_ROAM_RESULT_NDI_DELETE_RSP;
78 break;
79 default:
80 sme_err("Invalid CSR Roam result code: %d", result);
81 break;
82 }
83 }
84