diff options
| author | Nachiket Kukade <nkukade@codeaurora.org> | 2018-02-14 16:54:01 +0530 |
|---|---|---|
| committer | Nachiket Kukade <nkukade@codeaurora.org> | 2018-02-14 20:22:13 +0530 |
| commit | 3bdf52f6d5bf2cab4a041917a5ddfd882178dc7a (patch) | |
| tree | 281888f67f64abba6a0a7067306072c1fa67e371 | |
| parent | 2532ec399576f8b62b48b71c528b9bfc7a07dfc7 (diff) | |
qcacmn: Refactor APF related common modules in separate files
File wmi_unified_tlv.c is bloated and adding support for upcoming
Android Packet Filter v3 is going to increase its size even more.
Create a new source file for APF related WMI modules and a header
file for declaring the API's.
Change-Id: I37dcc30c7d1311067f375c891be9723612161de9
CRs-Fixed: 2189827
| -rw-r--r-- | wmi/inc/wmi_unified_apf_tlv.h | 49 | ||||
| -rw-r--r-- | wmi/inc/wmi_unified_tlv.h | 18 | ||||
| -rw-r--r-- | wmi/src/wmi_unified_apf_tlv.c | 76 | ||||
| -rw-r--r-- | wmi/src/wmi_unified_tlv.c | 48 |
4 files changed, 127 insertions, 64 deletions
diff --git a/wmi/inc/wmi_unified_apf_tlv.h b/wmi/inc/wmi_unified_apf_tlv.h new file mode 100644 index 000000000000..61183beac06f --- /dev/null +++ b/wmi/inc/wmi_unified_apf_tlv.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * + * Previously licensed under the ISC license by Qualcomm Atheros, Inc. + * + * + * 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. + */ + +/* + * This file was originally distributed by Qualcomm Atheros, Inc. + * under proprietary terms before Copyright ownership was assigned + * to the Linux Foundation. + */ + +#ifndef _WMI_UNIFIED_APF_TLV_H_ +#define _WMI_UNIFIED_APF_TLV_H_ + +#include "wmi_unified.h" +#include "wmi_unified_api.h" + +/** + * send_set_active_bpf_mode_cmd_tlv() - configure active BPF mode in FW + * @wmi_handle: the WMI handle + * @vdev_id: the Id of the vdev to apply the configuration to + * @ucast_mode: the active BPF mode to configure for unicast packets + * @mcast_bcast_mode: the active BPF mode to configure for multicast/broadcast + * packets + * + * Return: QDF status + */ +QDF_STATUS +send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, + uint8_t vdev_id, + FW_ACTIVE_BPF_MODE ucast_mode, + FW_ACTIVE_BPF_MODE mcast_bcast_mode); +#endif /* _WMI_UNIFIED_APF_TLV_H_ */ diff --git a/wmi/inc/wmi_unified_tlv.h b/wmi/inc/wmi_unified_tlv.h index 5ce02c00bf1c..56bbbe941bf4 100644 --- a/wmi/inc/wmi_unified_tlv.h +++ b/wmi/inc/wmi_unified_tlv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -641,22 +641,6 @@ QDF_STATUS send_get_buf_extscan_hotlist_cmd_tlv(wmi_unified_t wmi_handle, struct ext_scan_setbssi_hotlist_params * photlist, int *buf_len); -/** - * send_set_active_bpf_mode_cmd_tlv() - configure active BPF mode in FW - * @wmi_handle: the WMI handle - * @vdev_id: the Id of the vdev to apply the configuration to - * @ucast_mode: the active BPF mode to configure for unicast packets - * @mcast_bcast_mode: the active BPF mode to configure for multicast/broadcast - * packets - * - * Return: QDF status - */ -QDF_STATUS -send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, - uint8_t vdev_id, - FW_ACTIVE_BPF_MODE ucast_mode, - FW_ACTIVE_BPF_MODE mcast_bcast_mode); - QDF_STATUS send_set_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, struct set_arp_stats *req_buf); QDF_STATUS send_get_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, diff --git a/wmi/src/wmi_unified_apf_tlv.c b/wmi/src/wmi_unified_apf_tlv.c new file mode 100644 index 000000000000..d483b18b60fc --- /dev/null +++ b/wmi/src/wmi_unified_apf_tlv.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * + * Previously licensed under the ISC license by Qualcomm Atheros, Inc. + * + * + * 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. + */ + +/* + * This file was originally distributed by Qualcomm Atheros, Inc. + * under proprietary terms before Copyright ownership was assigned + * to the Linux Foundation. + */ + +#include "wmi_unified_apf_tlv.h" + +QDF_STATUS send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, + uint8_t vdev_id, + FW_ACTIVE_BPF_MODE ucast_mode, + FW_ACTIVE_BPF_MODE mcast_bcast_mode) +{ + const WMITLV_TAG_ID tag_id = + WMITLV_TAG_STRUC_wmi_bpf_set_vdev_active_mode_cmd_fixed_param; + const uint32_t tlv_len = WMITLV_GET_STRUCT_TLVLEN( + wmi_bpf_set_vdev_active_mode_cmd_fixed_param); + QDF_STATUS status; + wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd; + wmi_buf_t buf; + + WMI_LOGD("Sending WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID(%u, %d, %d)", + vdev_id, ucast_mode, mcast_bcast_mode); + + /* allocate command buffer */ + buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); + if (!buf) { + WMI_LOGE("%s: wmi_buf_alloc failed", __func__); + return QDF_STATUS_E_NOMEM; + } + + /* set TLV header */ + cmd = (wmi_bpf_set_vdev_active_mode_cmd_fixed_param *)wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, tag_id, tlv_len); + + /* populate data */ + cmd->vdev_id = vdev_id; + cmd->uc_mode = ucast_mode; + cmd->mcbc_mode = mcast_bcast_mode; + + /* send to FW */ + status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), + WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID); + if (QDF_IS_STATUS_ERROR(status)) { + WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d", + status); + wmi_buf_free(buf); + return status; + } + + WMI_LOGD("Sent WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID successfully"); + + return QDF_STATUS_SUCCESS; +} + diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 058f16b822d6..f48c4e9f5027 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -26,6 +26,7 @@ */ #include "wmi_unified_tlv.h" +#include "wmi_unified_apf_tlv.h" #include "wmi_unified_api.h" #include "wmi.h" #include "wmi_version.h" @@ -12531,53 +12532,6 @@ QDF_STATUS send_get_buf_extscan_hotlist_cmd_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } -QDF_STATUS send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, - uint8_t vdev_id, - FW_ACTIVE_BPF_MODE ucast_mode, - FW_ACTIVE_BPF_MODE mcast_bcast_mode) -{ - const WMITLV_TAG_ID tag_id = - WMITLV_TAG_STRUC_wmi_bpf_set_vdev_active_mode_cmd_fixed_param; - const uint32_t tlv_len = WMITLV_GET_STRUCT_TLVLEN( - wmi_bpf_set_vdev_active_mode_cmd_fixed_param); - QDF_STATUS status; - wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd; - wmi_buf_t buf; - - WMI_LOGD("Sending WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID(%u, %d, %d)", - vdev_id, ucast_mode, mcast_bcast_mode); - - /* allocate command buffer */ - buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); - if (!buf) { - WMI_LOGE("%s: wmi_buf_alloc failed", __func__); - return QDF_STATUS_E_NOMEM; - } - - /* set TLV header */ - cmd = (wmi_bpf_set_vdev_active_mode_cmd_fixed_param *)wmi_buf_data(buf); - WMITLV_SET_HDR(&cmd->tlv_header, tag_id, tlv_len); - - /* populate data */ - cmd->vdev_id = vdev_id; - cmd->uc_mode = ucast_mode; - cmd->mcbc_mode = mcast_bcast_mode; - - /* send to FW */ - status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), - WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID); - if (QDF_IS_STATUS_ERROR(status)) { - WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d", - status); - wmi_buf_free(buf); - return status; - } - - WMI_LOGD("Sent WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID successfully"); - - return QDF_STATUS_SUCCESS; -} - /** * send_power_dbg_cmd_tlv() - send power debug commands * @wmi_handle: wmi handle |
