From 422bbf322bfb519386fc65fb308528b29c706c22 Mon Sep 17 00:00:00 2001 From: Nandha Kishore Easwaran Date: Tue, 17 May 2022 14:31:42 +0530 Subject: [PATCH] qcacmn: Add tx peer filtering WMI command Add WMI command for tx peer filtering. This command is needed to send the mac address to FW for which tx monitor peer filtering is needed to be done. Change-Id: Ia141fba81ba240b7f4ca015eb9251e3485294bb6 CRs-Fixed: 3199493 --- dp/inc/cdp_txrx_ops.h | 18 ++++++++++ .../inc/wlan_vdev_mgr_tgt_if_tx_defs.h | 12 +++++++ wmi/inc/wmi_unified_priv.h | 5 +++ wmi/inc/wmi_unified_vdev_api.h | 14 ++++++++ wmi/src/wmi_unified_vdev_api.c | 14 ++++++++ wmi/src/wmi_unified_vdev_tlv.c | 35 +++++++++++++++++++ 6 files changed, 98 insertions(+) diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index baa4c34af4..6cc8abfb52 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -59,6 +59,20 @@ enum cdp_nac_param_cmd { CDP_NAC_PARAM_LIST, }; +/** + * enum cdp_tx_filter_action - TX peer filtering action + * @CDP_TX_FILTER_ACTION_ADD: add peer + * @CDP_TX_FILTER_ACTION_DEL: delete peer + * + * whether add or delete + */ +enum cdp_tx_filter_action { + /* add peer mac address*/ + CDP_TX_FILTER_ACTION_ADD = 1, + /* delete peer mac address */ + CDP_TX_FILTER_ACTION_DEL, +}; + #define CDP_DELBA_INTERVAL_MS 3000 /** * enum cdp_delba_rcode - CDP reason code for sending DELBA @@ -1404,6 +1418,10 @@ struct ol_if_ops { uint8_t vdev_id, enum cdp_nac_param_cmd cmd, uint8_t *peer_mac); + int (*config_lite_mon_tx_peer)(struct cdp_ctrl_objmgr_psoc *psoc, + uint8_t pdev_id, uint8_t vdev_id, + enum cdp_tx_filter_action cmd, + uint8_t *peer_mac); #endif }; diff --git a/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mgr_tgt_if_tx_defs.h b/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mgr_tgt_if_tx_defs.h index 64296d93e3..13307fd47d 100644 --- a/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mgr_tgt_if_tx_defs.h +++ b/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mgr_tgt_if_tx_defs.h @@ -532,6 +532,18 @@ struct set_neighbour_rx_params { uint32_t type; }; +/** + * struct set_tx_peer_filter - Set tx peer filter + * @vdev_id: vdev id + * @idx: index of param + * @action: action + */ +struct set_tx_peer_filter { + uint8_t vdev_id; + uint32_t idx; + uint32_t action; +}; + /** * struct vdev_scan_nac_rssi_params - NAC_RSSI cmd parameter * @vdev_id: vdev id diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 983e9087a2..9edcc43172 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -3008,6 +3008,11 @@ QDF_STATUS uint8_t *chip_info, uint32_t *pktlog_json_version); +QDF_STATUS +(*send_peer_filter_set_tx_cmd)(wmi_unified_t wmi_handle, + uint8_t macaddr[], + struct set_tx_peer_filter *param); + QDF_STATUS (*extract_pdev_telemetry_stats)( wmi_unified_t wmi_handle, void *evt_buf, diff --git a/wmi/inc/wmi_unified_vdev_api.h b/wmi/inc/wmi_unified_vdev_api.h index be1650c66d..36ff39795f 100644 --- a/wmi/inc/wmi_unified_vdev_api.h +++ b/wmi/inc/wmi_unified_vdev_api.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 @@ -26,6 +27,19 @@ #include +/** + * wmi_unified_peer_filter_set_tx_cmd_send() - WMI set tx peer filter function + * @param wmi_handle: handle to WMI. + * @param macaddr: MAC address + * @param param: pointer to hold peer filter parameter + * + * @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS +wmi_unified_peer_filter_set_tx_cmd_send(struct wmi_unified *wmi_handle, + uint8_t macaddr[], + struct set_tx_peer_filter *param); + /** * wmi_unified_vdev_set_neighbour_rx_cmd_send() - WMI set neighbour rx function * @param wmi_handle: handle to WMI. diff --git a/wmi/src/wmi_unified_vdev_api.c b/wmi/src/wmi_unified_vdev_api.c index d676608602..f8dbffd4bb 100644 --- a/wmi/src/wmi_unified_vdev_api.c +++ b/wmi/src/wmi_unified_vdev_api.c @@ -155,6 +155,20 @@ wmi_unified_vdev_config_ratemask_cmd_send(struct wmi_unified *wmi_handle, return QDF_STATUS_E_FAILURE; } +QDF_STATUS +wmi_unified_peer_filter_set_tx_cmd_send(struct wmi_unified *wmi_handle, + uint8_t macaddr[], + struct set_tx_peer_filter *param) +{ + struct wmi_ops *ops = wmi_handle->ops; + + if (ops->send_peer_filter_set_tx_cmd) + return ops->send_peer_filter_set_tx_cmd(wmi_handle, macaddr, + param); + + return QDF_STATUS_E_FAILURE; +} + QDF_STATUS wmi_unified_vdev_set_neighbour_rx_cmd_send( struct wmi_unified *wmi_handle, uint8_t macaddr[QDF_MAC_ADDR_SIZE], diff --git a/wmi/src/wmi_unified_vdev_tlv.c b/wmi/src/wmi_unified_vdev_tlv.c index 45f071ebb7..c54bdec6a9 100644 --- a/wmi/src/wmi_unified_vdev_tlv.c +++ b/wmi/src/wmi_unified_vdev_tlv.c @@ -135,6 +135,40 @@ extract_tbttoffset_num_vdevs_tlv(struct wmi_unified *wmi_handle, void *evt_buf, return QDF_STATUS_SUCCESS; } +static QDF_STATUS +send_peer_filter_set_tx_cmd_tlv(struct wmi_unified *wmi_handle, + uint8_t macaddr[], + struct set_tx_peer_filter *param) +{ + wmi_peer_tx_filter_cmd_fixed_param *cmd; + wmi_buf_t buf; + uint32_t len = sizeof(*cmd); + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) + return QDF_STATUS_E_FAILURE; + + cmd = (wmi_peer_tx_filter_cmd_fixed_param *)wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_peer_tx_filter_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + wmi_peer_tx_filter_cmd_fixed_param)); + + cmd->vdev_id = param->vdev_id; + cmd->action = param->action; + WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->addr); + + wmi_mtrace(WMI_PEER_TX_FILTER_CMDID, cmd->vdev_id, 0); + if (wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_PEER_TX_FILTER_CMDID)) { + wmi_err("Failed to set neighbour rx param"); + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + static QDF_STATUS send_vdev_set_neighbour_rx_cmd_tlv(struct wmi_unified *wmi_handle, uint8_t macaddr[QDF_MAC_ADDR_SIZE], @@ -420,4 +454,5 @@ void wmi_vdev_attach_tlv(struct wmi_unified *wmi_handle) wmi_ops->send_beacon_send_cmd = send_beacon_send_cmd_tlv; wmi_ops->send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv; + wmi_ops->send_peer_filter_set_tx_cmd = send_peer_filter_set_tx_cmd_tlv; }