qcacmn: Add new target_if layer files for for LTE and 11d feature

Create target_if_reg_11d.c and target_if_reg_lte.c  files.
Move 11d and LTE feature specific code from target_if_reg.c file to
these files.

These files has only MCL specific code.

Change-Id: I016c6e6c8b6d54670496367e08ac5d83ad94bebd
CRs-Fixed: 2349173
This commit is contained in:
Shashikala Prabhu 2019-01-14 17:42:22 +05:30 • committed by nshrivas
commit 75b0650131
4 changed files with 445 additions and 0 deletions

View file

@ -0,0 +1,124 @@
/*
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: target_if_reg_11d.h
* This file contains regulatory target 11d scan interface.
*/
#ifndef __TARGET_IF_REG_11D_H__
#define __TARGET_IF_REG_11D_H__
#include "qdf_types.h"
#include "target_if.h"
#include <wlan_objmgr_psoc_obj.h>
#include "target_if_reg.h"
#include "wmi_unified_api.h"
#include "wmi_unified_reg_api.h"
#ifdef HOST_11D_SCAN
/**
* tgt_if_regulatory_is_11d_offloaded() - Check if reg 11d is offloaded.
* @psoc: psoc pointer
*
* Return: true if 11d is offloaded, else false.
*/
bool tgt_if_regulatory_is_11d_offloaded(struct wlan_objmgr_psoc *psoc);
/**
* tgt_if_regulatory_register_11d_new_cc_handler() - Register for 11d country
* code event ID.
* @psoc: psoc pointer
* @args: Pointer to args.
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_if_regulatory_register_11d_new_cc_handler(
struct wlan_objmgr_psoc *psoc, void *arg);
/**
* tgt_if_regulatory_unregister_11d_new_cc_handler() - Unregister 11d country
* code event ID.
* @psoc: psoc pointer
* @args: Pointer to args.
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_if_regulatory_unregister_11d_new_cc_handler(
struct wlan_objmgr_psoc *psoc, void *arg);
/**
* tgt_if_regulatory_start_11d_scan() - Start 11d scan.
* @psoc: psoc pointer
* @reg_start_11d_scan_req: Pointer to 11d scan start request.
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_if_regulatory_start_11d_scan(
struct wlan_objmgr_psoc *psoc,
struct reg_start_11d_scan_req *reg_start_11d_scan_req);
/**
* tgt_if_regulatory_stop_11d_scan() - Stop 11d scan.
* @psoc: psoc pointer
* @reg_stop_11d_scan_req: Pointer to 11d scan stop request.
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_if_regulatory_stop_11d_scan(
struct wlan_objmgr_psoc *psoc,
struct reg_stop_11d_scan_req *reg_stop_11d_scan_req);
#else
static inline bool
tgt_if_regulatory_is_11d_offloaded(struct wlan_objmgr_psoc *psoc)
{
return false;
}
static inline QDF_STATUS
tgt_if_regulatory_register_11d_new_cc_handler(struct wlan_objmgr_psoc *psoc,
void *arg)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS
tgt_if_regulatory_unregister_11d_new_cc_handler(struct wlan_objmgr_psoc *psoc,
void *arg)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS tgt_if_regulatory_start_11d_scan(
struct wlan_objmgr_psoc *psoc,
struct reg_start_11d_scan_req *reg_start_11d_scan_req)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS tgt_if_regulatory_stop_11d_scan(
struct wlan_objmgr_psoc *psoc,
struct reg_stop_11d_scan_req *reg_stop_11d_scan_req)
{
return QDF_STATUS_SUCCESS;
}
#endif
#endif

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: target_if_reg_lte.h
* This file contains regulatory target LTE interface
*/
#ifndef __TARGET_IF_REG_LTE_H__
#define __TARGET_IF_REG_LTE_H__
#include "qdf_types.h"
#include "target_if.h"
#include <wlan_objmgr_psoc_obj.h>
#include "target_if_reg.h"
#include "wmi_unified_api.h"
#include "wmi_unified_reg_api.h"
#ifdef CONFIG_LTE_COEX
/**
* tgt_if_regulatory_register_ch_avoid_event_handler() - Register avoid channel
* list event handler
* @psoc: Pointer to psoc
* @arg: Pointer to argumemt list
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_if_regulatory_register_ch_avoid_event_handler(
struct wlan_objmgr_psoc *psoc, void *arg);
/**
* tgt_if_regulatory_unregister_ch_avoid_event_handler() - Unregister avoid
* channel list event handler
* @psoc: Pointer to psoc
* @arg: Pointer to argumemt list
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_if_regulatory_unregister_ch_avoid_event_handler(
struct wlan_objmgr_psoc *psoc, void *arg);
#else
static inline QDF_STATUS tgt_if_regulatory_register_ch_avoid_event_handler(
struct wlan_objmgr_psoc *psoc, void *arg)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS tgt_if_regulatory_unregister_ch_avoid_event_handler(
struct wlan_objmgr_psoc *psoc, void *arg)
{
return QDF_STATUS_SUCCESS;
}
#endif
#endif /* __TARGET_IF_REG_H__ */

View file

@ -0,0 +1,143 @@
/*
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: target_if_reg_11d.c
* This file contains regulatory target interface
*/
#include "target_if_reg_11d.h"
#ifdef HOST_11D_SCAN
bool tgt_if_regulatory_is_11d_offloaded(struct wlan_objmgr_psoc *psoc)
{
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle)
return false;
return wmi_service_enabled(wmi_handle, wmi_service_11d_offload);
}
/**
* tgt_reg_11d_new_cc_handler() - 11d country code event handler
* @handle: scn handle
* @event_buf: event buffer
* @len: legth of @event_buf
*
* Return: 0 on success
*/
static int tgt_reg_11d_new_cc_handler(ol_scn_t handle, uint8_t *event_buf,
uint32_t len)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
struct reg_11d_new_country reg_11d_new_cc;
QDF_STATUS status;
struct wmi_unified *wmi_handle;
TARGET_IF_ENTER();
psoc = target_if_get_psoc_from_scn_hdl(handle);
if (!psoc) {
target_if_err("psoc ptr is NULL");
return -EINVAL;
}
reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
if (!reg_rx_ops->reg_11d_new_cc_handler) {
target_if_err("reg_11d_new_cc_handler is NULL");
return -EINVAL;
}
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("Invalid WMI handle");
return -EINVAL;
}
if (wmi_extract_reg_11d_new_cc_event(wmi_handle, event_buf,
&reg_11d_new_cc, len)
!= QDF_STATUS_SUCCESS) {
target_if_err("Extraction of new country event failed");
return -EFAULT;
}
status = reg_rx_ops->reg_11d_new_cc_handler(psoc, &reg_11d_new_cc);
if (status != QDF_STATUS_SUCCESS) {
target_if_err("Failed to process new country code event");
return -EFAULT;
}
target_if_debug("processed 11d new country code event");
return 0;
}
QDF_STATUS tgt_if_regulatory_register_11d_new_cc_handler(
struct wlan_objmgr_psoc *psoc, void *arg)
{
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle)
return QDF_STATUS_E_FAILURE;
return wmi_unified_register_event(wmi_handle,
wmi_11d_new_country_event_id,
tgt_reg_11d_new_cc_handler);
}
QDF_STATUS tgt_if_regulatory_unregister_11d_new_cc_handler(
struct wlan_objmgr_psoc *psoc, void *arg)
{
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle)
return QDF_STATUS_E_FAILURE;
return wmi_unified_unregister_event(wmi_handle,
wmi_11d_new_country_event_id);
}
QDF_STATUS tgt_if_regulatory_start_11d_scan(
struct wlan_objmgr_psoc *psoc,
struct reg_start_11d_scan_req *reg_start_11d_scan_req)
{
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle)
return QDF_STATUS_E_FAILURE;
return wmi_unified_send_start_11d_scan_cmd(wmi_handle,
reg_start_11d_scan_req);
}
QDF_STATUS tgt_if_regulatory_stop_11d_scan(
struct wlan_objmgr_psoc *psoc,
struct reg_stop_11d_scan_req *reg_stop_11d_scan_req)
{
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle)
return QDF_STATUS_E_FAILURE;
return wmi_unified_send_stop_11d_scan_cmd(wmi_handle,
reg_stop_11d_scan_req);
}
#endif

View file

@ -0,0 +1,106 @@
/*
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: target_if_reg_lte.c
* This file contains regulatory target LTE interface
*/
#include "target_if_reg_lte.h"
/**
* tgt_reg_ch_avoid_event_handler() - Avoid channel list event handler.
* @handle: Pointer to scn handler.
* @event_buf: Pointer to event buffer.
* @len: Buffer length.
*
* Return: Error code.
*/
static int tgt_reg_ch_avoid_event_handler(ol_scn_t handle, uint8_t *event_buf,
uint32_t len)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
struct ch_avoid_ind_type ch_avoid_event;
QDF_STATUS status;
struct wmi_unified *wmi_handle;
TARGET_IF_ENTER();
psoc = target_if_get_psoc_from_scn_hdl(handle);
if (!psoc) {
target_if_err("psoc ptr is NULL");
return -EINVAL;
}
reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
if (!reg_rx_ops->reg_ch_avoid_event_handler) {
target_if_err("reg_ch_avoid_event_handler is NULL");
return -EINVAL;
}
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("Invalid WMI handle");
return -EINVAL;
}
if (wmi_extract_reg_ch_avoid_event(
wmi_handle, event_buf, &ch_avoid_event, len)
!= QDF_STATUS_SUCCESS) {
target_if_err("Extraction of CH avoid event failed");
return -EFAULT;
}
status = reg_rx_ops->reg_ch_avoid_event_handler(psoc, &ch_avoid_event);
if (status != QDF_STATUS_SUCCESS) {
target_if_err("Failed to process CH avoid event");
return -EFAULT;
}
target_if_debug("processed CH avoid event");
return 0;
}
QDF_STATUS tgt_if_regulatory_register_ch_avoid_event_handler(
struct wlan_objmgr_psoc *psoc, void *arg)
{
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle)
return QDF_STATUS_E_FAILURE;
return wmi_unified_register_event(wmi_handle,
wmi_wlan_freq_avoid_event_id,
tgt_reg_ch_avoid_event_handler);
}
QDF_STATUS tgt_if_regulatory_unregister_ch_avoid_event_handler(
struct wlan_objmgr_psoc *psoc, void *arg)
{
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle)
return QDF_STATUS_E_FAILURE;
return wmi_unified_unregister_event(wmi_handle,
wmi_wlan_freq_avoid_event_id);
}