From 09f46cf46cb1d242d4470b53e7cf1f1a735dae2c Mon Sep 17 00:00:00 2001 From: Balaji Pothunoori Date: Fri, 18 Jun 2021 11:00:38 +0530 Subject: [PATCH 01/14] qcacmn: add wmi service for tx aggregation support Add wmi service to differentiate max tx aggr support from firmware. Change-Id: I2f9a4101815b06b41d4a75d888e30ee42b9307ec CRs-Fixed: 2959207 --- wmi/inc/wmi_unified_param.h | 2 ++ wmi/src/wmi_unified_tlv.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index d06aefa59a0f..38aea5ea0a70 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5247,6 +5247,8 @@ typedef enum { wmi_service_igmp_offload_support, #endif wmi_service_sae_eapol_offload_support, + wmi_service_ampdu_tx_buf_size_256_support, + wmi_services_max, } wmi_conv_service_ids; #define WMI_SERVICE_UNAVAILABLE 0xFFFF diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index e92c180384b8..590aef5efd20 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -15669,6 +15669,8 @@ static void populate_tlv_service(uint32_t *wmi_service) wmi_service[wmi_service_disable_upper_6g_edge_ch_supp] = WMI_SERVICE_DISABLE_UPPER_6G_EDGE_CH_SUPP; #endif + wmi_service[wmi_service_ampdu_tx_buf_size_256_support] = + WMI_SERVICE_AMPDU_TX_BUF_SIZE_256_SUPPORT; } /** From 5cd4a4cf794ffe924dc505741d22c8458ee4c1a1 Mon Sep 17 00:00:00 2001 From: Maheswara Sarma Date: Thu, 1 Jul 2021 00:09:36 -0700 Subject: [PATCH 02/14] Revert "qcacmn: add wmi service for tx aggregation support" This reverts commit 09f46cf46cb1d242d4470b53e7cf1f1a735dae2c. Change-Id: I559fb3b523c1fb982d868a53eb07bb9b0d2e7083 --- wmi/inc/wmi_unified_param.h | 2 -- wmi/src/wmi_unified_tlv.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 38aea5ea0a70..d06aefa59a0f 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5247,8 +5247,6 @@ typedef enum { wmi_service_igmp_offload_support, #endif wmi_service_sae_eapol_offload_support, - wmi_service_ampdu_tx_buf_size_256_support, - wmi_services_max, } wmi_conv_service_ids; #define WMI_SERVICE_UNAVAILABLE 0xFFFF diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 590aef5efd20..e92c180384b8 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -15669,8 +15669,6 @@ static void populate_tlv_service(uint32_t *wmi_service) wmi_service[wmi_service_disable_upper_6g_edge_ch_supp] = WMI_SERVICE_DISABLE_UPPER_6G_EDGE_CH_SUPP; #endif - wmi_service[wmi_service_ampdu_tx_buf_size_256_support] = - WMI_SERVICE_AMPDU_TX_BUF_SIZE_256_SUPPORT; } /** From f2a88eafe4a2c8a77ffccec6a4565a6a8101d79b Mon Sep 17 00:00:00 2001 From: sheenam monga Date: Wed, 11 Aug 2021 16:57:10 +0530 Subject: [PATCH 03/14] qcacmn: Fix possible OOB in wmi_extract_dbr_buf_release_entry Currently in function wmi_extract_dbr_buf_release_entry, num_buf_release_entry & num_meta_data_entry are copied to direct_buf_rx_rsp structure without any validation which may cause out of bound issue if num_buf_release_entry or num_meta_data_entries provided in fixed param becomes greater than actual number of entries. Fix is to validate num_entries and num_meta_data before populating param->num_buf_release_entry and param->num_meta_data_entry. Change-Id: I18050fd4f90f8815d7eceb5f715fdbaa09130d3a CRs-Fixed: 3000875 --- .../direct_buf_rx/src/target_if_direct_buf_rx_main.c | 5 +++++ wmi/src/wmi_unified_dbr_tlv.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c index ae28ad470be7..d8a8c5359a76 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c +++ b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c @@ -1845,6 +1845,11 @@ static int target_if_direct_buf_rx_rsp_event_handler(ol_scn_t scn, dbr_buf_pool = mod_param->dbr_buf_pool; dbr_rsp.dbr_entries = qdf_mem_malloc(dbr_rsp.num_buf_release_entry * sizeof(struct direct_buf_rx_entry)); + if (!dbr_rsp.dbr_entries) { + direct_buf_rx_err("invalid dbr_entries"); + wlan_objmgr_pdev_release_ref(pdev, dbr_mod_id); + return QDF_STATUS_E_FAILURE; + } if (dbr_rsp.num_meta_data_entry > dbr_rsp.num_buf_release_entry) { direct_buf_rx_err("More than expected number of metadata"); diff --git a/wmi/src/wmi_unified_dbr_tlv.c b/wmi/src/wmi_unified_dbr_tlv.c index faff709508b1..2c7798d228f1 100644 --- a/wmi/src/wmi_unified_dbr_tlv.c +++ b/wmi/src/wmi_unified_dbr_tlv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2021 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 @@ -132,7 +132,17 @@ static QDF_STATUS extract_dbr_buf_release_fixed_tlv(wmi_unified_t wmi_handle, wmi_handle, ev->pdev_id); param->mod_id = ev->mod_id; + if ((!param_buf->num_entries) || + param_buf->num_entries < ev->num_buf_release_entry){ + wmi_err("actual num of buf release entries less than provided entries"); + return QDF_STATUS_E_INVAL; + } param->num_buf_release_entry = ev->num_buf_release_entry; + if ((!param_buf->num_meta_data) || + param_buf->num_meta_data < ev->num_meta_data_entry) { + wmi_err("actual num of meta data entries less than provided entries"); + return QDF_STATUS_E_INVAL; + } param->num_meta_data_entry = ev->num_meta_data_entry; wmi_debug("pdev id %d mod id %d num buf release entry %d", param->pdev_id, param->mod_id, param->num_buf_release_entry); From 2f09f258999d4447a1c683008db0fb83e5a72e9a Mon Sep 17 00:00:00 2001 From: Varsha Mishra Date: Thu, 10 Jun 2021 14:36:58 +0530 Subject: [PATCH 04/14] qcacmn: Drop non-eapol packets for unauthorized peer Until peer is authorized, drop non-eapol frames in rx error path. Change-Id: I339b9248b8ae63e4b6ab0268c4ed28130404ba33 --- dp/wifi3.0/dp_rx_err.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/dp/wifi3.0/dp_rx_err.c b/dp/wifi3.0/dp_rx_err.c index fba5c29d46cb..74c40099c526 100644 --- a/dp/wifi3.0/dp_rx_err.c +++ b/dp/wifi3.0/dp_rx_err.c @@ -1140,6 +1140,7 @@ dp_rx_null_q_desc_handle(struct dp_soc *soc, qdf_nbuf_t nbuf, qdf_ether_header_t *eh; struct hal_rx_msdu_metadata msdu_metadata; uint16_t sa_idx = 0; + bool is_eapol; qdf_nbuf_set_rx_chfrag_start(nbuf, hal_rx_msdu_end_first_msdu_get(soc->hal_soc, @@ -1294,6 +1295,22 @@ dp_rx_null_q_desc_handle(struct dp_soc *soc, qdf_nbuf_t nbuf, /* IEEE80211_SEQ_MAX indicates invalid start_seq */ } + eh = (qdf_ether_header_t *)qdf_nbuf_data(nbuf); + + if (!peer->authorize) { + is_eapol = qdf_nbuf_is_ipv4_eapol_pkt(nbuf) || + qdf_nbuf_is_ipv4_wapi_pkt(nbuf); + + if (is_eapol) { + if (qdf_mem_cmp(eh->ether_dhost, + &vdev->mac_addr.raw[0], + QDF_MAC_ADDR_SIZE)) + goto drop_nbuf; + } else { + goto drop_nbuf; + } + } + /* * Drop packets in this path if cce_match is found. Packets will come * in following path depending on whether tidQ is setup. @@ -1307,8 +1324,7 @@ dp_rx_null_q_desc_handle(struct dp_soc *soc, qdf_nbuf_t nbuf, * to stack. */ if (qdf_unlikely(dp_rx_err_cce_drop(soc, vdev, nbuf, rx_tlv_hdr))) { - qdf_nbuf_free(nbuf); - return QDF_STATUS_E_FAILURE; + goto drop_nbuf; } if (qdf_unlikely(vdev->rx_decap_type == htt_cmn_pkt_type_raw)) { @@ -1335,7 +1351,6 @@ dp_rx_null_q_desc_handle(struct dp_soc *soc, qdf_nbuf_t nbuf, soc->hal_soc, rx_tlv_hdr) && (vdev->rx_decap_type == htt_cmn_pkt_type_ethernet))) { - eh = (qdf_ether_header_t *)qdf_nbuf_data(nbuf); DP_STATS_INC_PKT(peer, rx.multicast, 1, qdf_nbuf_len(nbuf)); From 06ebe419d8cbd742e92c0edb522f0f2a32966bba Mon Sep 17 00:00:00 2001 From: Vulupala Shashank Reddy Date: Mon, 13 Sep 2021 11:01:44 +0530 Subject: [PATCH 05/14] qcacmn: Add APIs to get data packets info Add APIs to get TCP fin/fin-ack/rst packets information. Change-Id: Ia1150c81076fa47ae7f34d14bc73efc82003258a CRs-Fixed: 3046235 --- qdf/inc/qdf_nbuf.h | 39 ++++++++++++++++++++++ qdf/linux/src/i_qdf_nbuf.h | 8 +++++ qdf/linux/src/qdf_nbuf.c | 66 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) diff --git a/qdf/inc/qdf_nbuf.h b/qdf/inc/qdf_nbuf.h index 05a67bb7b67e..9f2c7871bcf6 100644 --- a/qdf/inc/qdf_nbuf.h +++ b/qdf/inc/qdf_nbuf.h @@ -2952,6 +2952,32 @@ bool qdf_nbuf_data_is_dns_response(qdf_nbuf_t buf) return __qdf_nbuf_data_is_dns_response(qdf_nbuf_data(buf)); } +/** + * qdf_nbuf_data_is_tcp_fin() - check if skb data is a tcp fin + * @buf: buffer + * + * Return: true if packet is tcp fin packet. + * false otherwise. + */ +static inline +bool qdf_nbuf_data_is_tcp_fin(qdf_nbuf_t buf) +{ + return __qdf_nbuf_data_is_tcp_fin(qdf_nbuf_data(buf)); +} + +/** + * qdf_nbuf_data_is_tcp_fin_ack() - check if skb data is a tcp fin ack + * @buf: buffer + * + * Return: true if packet is tcp fin ack packet. + * false otherwise. + */ +static inline +bool qdf_nbuf_data_is_tcp_fin_ack(qdf_nbuf_t buf) +{ + return __qdf_nbuf_data_is_tcp_fin_ack(qdf_nbuf_data(buf)); +} + /** * qdf_nbuf_data_is_tcp_syn() - check if skb data is a tcp syn * @buf: buffer @@ -2978,6 +3004,19 @@ bool qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_t buf) return __qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_data(buf)); } +/** + * qdf_nbuf_data_is_tcp_rst() - check if skb data is a tcp rst + * @buf: buffer + * + * Return: true if packet is tcp rst packet. + * false otherwise. + */ +static inline +bool qdf_nbuf_data_is_tcp_rst(qdf_nbuf_t buf) +{ + return __qdf_nbuf_data_is_tcp_rst(qdf_nbuf_data(buf)); +} + /** * qdf_nbuf_data_is_tcp_ack() - check if skb data is a tcp ack * @buf: buffer diff --git a/qdf/linux/src/i_qdf_nbuf.h b/qdf/linux/src/i_qdf_nbuf.h index cc049e2a8690..0471fcc41ce9 100644 --- a/qdf/linux/src/i_qdf_nbuf.h +++ b/qdf/linux/src/i_qdf_nbuf.h @@ -73,6 +73,11 @@ typedef struct sk_buff_head __qdf_nbuf_queue_head_t; /* mark the first packet after wow wakeup */ #define QDF_MARK_FIRST_WAKEUP_PACKET 0x80000000 +/* TCP Related MASK */ +#define QDF_NBUF_PKT_TCPOP_FIN 0x01 +#define QDF_NBUF_PKT_TCPOP_FIN_ACK 0x11 +#define QDF_NBUF_PKT_TCPOP_RST 0x04 + /* * Make sure that qdf_dma_addr_t in the cb block is always 64 bit aligned */ @@ -836,8 +841,11 @@ uint32_t __qdf_nbuf_get_arp_tgt_ip(uint8_t *data); uint8_t *__qdf_nbuf_get_dns_domain_name(uint8_t *data, uint32_t len); bool __qdf_nbuf_data_is_dns_query(uint8_t *data); bool __qdf_nbuf_data_is_dns_response(uint8_t *data); +bool __qdf_nbuf_data_is_tcp_fin(uint8_t *data); +bool __qdf_nbuf_data_is_tcp_fin_ack(uint8_t *data); bool __qdf_nbuf_data_is_tcp_syn(uint8_t *data); bool __qdf_nbuf_data_is_tcp_syn_ack(uint8_t *data); +bool __qdf_nbuf_data_is_tcp_rst(uint8_t *data); bool __qdf_nbuf_data_is_tcp_ack(uint8_t *data); uint16_t __qdf_nbuf_data_get_tcp_src_port(uint8_t *data); uint16_t __qdf_nbuf_data_get_tcp_dst_port(uint8_t *data); diff --git a/qdf/linux/src/qdf_nbuf.c b/qdf/linux/src/qdf_nbuf.c index f7963e010eb7..4821a4052240 100644 --- a/qdf/linux/src/qdf_nbuf.c +++ b/qdf/linux/src/qdf_nbuf.c @@ -1725,6 +1725,50 @@ bool __qdf_nbuf_data_is_dns_response(uint8_t *data) return false; } +/** + * __qdf_nbuf_data_is_tcp_fin() - check if skb data is a tcp fin + * @data: Pointer to network data buffer + * + * This api is to check if the packet is tcp fin. + * + * Return: true if packet is tcp fin packet. + * false otherwise. + */ +bool __qdf_nbuf_data_is_tcp_fin(uint8_t *data) +{ + uint8_t op_code; + + op_code = (uint8_t)(*(uint8_t *)(data + + QDF_NBUF_PKT_TCP_OPCODE_OFFSET)); + + if (op_code == QDF_NBUF_PKT_TCPOP_FIN) + return true; + + return false; +} + +/** + * __qdf_nbuf_data_is_tcp_fin_ack() - check if skb data is a tcp fin ack + * @data: Pointer to network data buffer + * + * This api is to check if the tcp packet is fin ack. + * + * Return: true if packet is tcp fin ack packet. + * false otherwise. + */ +bool __qdf_nbuf_data_is_tcp_fin_ack(uint8_t *data) +{ + uint8_t op_code; + + op_code = (uint8_t)(*(uint8_t *)(data + + QDF_NBUF_PKT_TCP_OPCODE_OFFSET)); + + if (op_code == QDF_NBUF_PKT_TCPOP_FIN_ACK) + return true; + + return false; +} + /** * __qdf_nbuf_data_is_tcp_syn() - check if skb data is a tcp syn * @data: Pointer to network data buffer @@ -1767,6 +1811,28 @@ bool __qdf_nbuf_data_is_tcp_syn_ack(uint8_t *data) return false; } +/** + * __qdf_nbuf_data_is_tcp_rst() - check if skb data is a tcp rst + * @data: Pointer to network data buffer + * + * This api is to check if the tcp packet is rst. + * + * Return: true if packet is tcp rst packet. + * false otherwise. + */ +bool __qdf_nbuf_data_is_tcp_rst(uint8_t *data) +{ + uint8_t op_code; + + op_code = (uint8_t)(*(uint8_t *)(data + + QDF_NBUF_PKT_TCP_OPCODE_OFFSET)); + + if (op_code == QDF_NBUF_PKT_TCPOP_RST) + return true; + + return false; +} + /** * __qdf_nbuf_data_is_tcp_ack() - check if skb data is a tcp ack * @data: Pointer to network data buffer From 5a3e18b614c82eef496da0b648cbc741ca89e571 Mon Sep 17 00:00:00 2001 From: Balaji Pothunoori Date: Wed, 15 Sep 2021 12:57:47 +0530 Subject: [PATCH 06/14] qcacmn: add vendor command to configure the parameters for monitor mode Add new vendor command to configure monitor mode packet filter parameters which includes data/mgmt/ctrl frame types. Change-Id: Ie5e5d35b725e3d1b617edc1c889dc269b22a3673 CRs-Fixed: 3025489 --- os_if/linux/qca_vendor.h | 134 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index d3b91124e082..055d88379692 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -475,6 +475,29 @@ * configurations, concurrency combinations, etc. The attributes used * with this command are defined in * enum qca_wlan_vendor_attr_usable_channels. + * + * @QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE: This vendor subcommand is used + * to set packet monitor mode that aims to send the specified set of TX and + * RX frames on the current client interface to an active monitor interface. + * If this Monitor mode is set, the driver will send the configured frames, + * from the interface on which the command is issued, to an active monitor + * interface. The attributes used with this command are defined in + * enum qca_wlan_vendor_attr_set_monitor_mode. + * + * Though the monitor mode is configured for the respective data/mgmt/ctrl + * frames, it is up to the respective WLAN driver/firmware/hardware designs + * to consider the possibility of sending these frames over the monitor + * interface. For example, the control frames are handled with in the + * hardware and thus passing such frames over the monitor interface is left + * to the respective designs. + * + * Also, this monitor mode is governed to behave accordingly in suspend/resume + * states. If the firmware handles any of such frames in suspend state without + * waking up the host and if the monitor mode is configured to notify all such + * frames, then the firmware is expected to resume the host and forward the + * respective frames to the monitor interface. Please note that such a request + * to get the frames over the monitor interface will have a definite power + * implications. */ enum qca_nl80211_vendor_subcmds { @@ -708,6 +731,7 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_MBSSID_TX_VDEV_STATUS = 196, QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_MULTI_STA_POLICY = 197, QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS = 198, + QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE = 202, }; enum qca_wlan_vendor_tos { @@ -11014,4 +11038,114 @@ enum qca_wlan_vendor_attr_usable_channels { QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_AFTER_LAST - 1, }; +/** + * qca_wlan_vendor_monitor_data_frame_type - Represent the various + * data types to be sent over the monitor interface. + */ +enum qca_wlan_vendor_monitor_data_frame_type { + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ALL = BIT(0), + /* valid only if QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ALL is not set */ + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ARP = BIT(1), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DHCPV4 = BIT(2), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DHCPV6 = BIT(3), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_EAPOL = BIT(4), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DNSV4 = BIT(5), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DNSV6 = BIT(6), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_SYN = BIT(7), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_SYNACK = BIT(8), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_FIN = BIT(9), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_FINACK = BIT(10), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_ACK = BIT(11), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_RST = BIT(12), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ICMPV4 = BIT(13), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ICMPV6 = BIT(14), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_RTP = BIT(15), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_SIP = BIT(16), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_QOS_NULL = BIT(17), +}; + +/** + * qca_wlan_vendor_monitor_mgmt_frame_type - Represent the various + * mgmt types to be sent over the monitor interface. + * @QCA_WLAN_VENDOR_MONITOR_MGMT_FRAME_TYPE_ALL: All the MGMT Frames. + * @QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_NO_BEACON: All the MGMT Frames + * except the Beacons. Valid only in the Connect state. + * @QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_BEACON: Only the connected + * BSSID Beacons. Valid only in the Connect state. + * @QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_SCAN_BEACON: Represents + * the Beacons obtained during the scan (off channel and connected channel) + * when in connected state. + */ + +enum qca_wlan_vendor_monitor_mgmt_frame_type { + QCA_WLAN_VENDOR_MONITOR_MGMT_FRAME_TYPE_ALL = BIT(0), + /* valid only if QCA_WLAN_VENDOR_MONITOR_MGMT_FRAME_TYPE_ALL is not set */ + QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_NO_BEACON = BIT(1), + QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_BEACON = BIT(2), + QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_SCAN_BEACON = BIT(3), +}; + +/** + * qca_wlan_vendor_monitor_ctrl_frame_type - Represent the various + * ctrl types to be sent over the monitor interface. + * @QCA_WLAN_VENDOR_MONITOR_CTRL_FRAME_TYPE_ALL: All the ctrl Frames. + * @QCA_WLAN_VENDOR_MONITOR_CTRL_TRIGGER_FRAME: Trigger Frame. + */ +enum qca_wlan_vendor_monitor_ctrl_frame_type { + QCA_WLAN_VENDOR_MONITOR_CTRL_FRAME_TYPE_ALL = BIT(0), + /* valid only if QCA_WLAN_VENDOR_MONITOR_CTRL_FRAME_TYPE_ALL is not set */ + QCA_WLAN_VENDOR_MONITOR_CTRL_TRIGGER_FRAME = BIT(1), +}; + +/** + * enum qca_wlan_vendor_attr_set_monitor_mode - Used by the + * vendor command QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE to set the + * monitor mode. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_TX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These data packets + * are represented by enum qca_wlan_vendor_monitor_data_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_RX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These data packets + * are represented by enum qca_wlan_vendor_monitor_data_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These mgmt packets + * are represented by enum qca_wlan_vendor_monitor_mgmt_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These mgmt packets + * are represented by enum qca_wlan_vendor_monitor_mgmt_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These ctrl packets + * are represented by enum qca_wlan_vendor_monitor_ctrl_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These ctrl packets + * are represented by enum qca_wlan_vendor_monitor_ctrl_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL: u32 attribute, + * An interval only for the connected beacon interval, which expects that the + * connected BSSID's beacons shall be sent on the monitor interface only on this + * specific interval. + */ +enum qca_wlan_vendor_attr_set_monitor_mode { + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_TX_FRAME_TYPE = 1, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_RX_FRAME_TYPE = 2, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE = 3, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE = 4, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE = 5, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE = 6, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL = 7, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MAX = + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_AFTER_LAST - 1, + +}; + #endif From 000c0d1c8a8745369554d6899e92af42c2a8d8e1 Mon Sep 17 00:00:00 2001 From: Surabhi Vishnoi Date: Wed, 29 Sep 2021 18:05:28 +0530 Subject: [PATCH 07/14] qcacmn: Add cdp api to update the packet capture mode Add a CDP api to update the packet capture mode in dp_soc when it get updated by user using vendor command. Change-Id: Id0856aeeb5e1a77e1ce6fb23562fdbff4a2fb320 CRs-Fixed: 3048344 --- dp/inc/cdp_txrx_cmn.h | 29 +++++++++++++++++++++++++++++ dp/inc/cdp_txrx_ops.h | 3 +++ dp/wifi3.0/dp_main.c | 13 +++++++++++++ 3 files changed, 45 insertions(+) diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index 3fc8d89427dc..620513343129 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -2730,4 +2730,33 @@ cdp_drain_txrx(ol_txrx_soc_handle soc) return soc->ops->cmn_drv_ops->txrx_drain(soc); } + +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 +/** + * cdp_set_pkt_capture_mode() - set pkt capture mode in dp ctx + * @soc: opaque soc handle + * @val: value to be set + */ +static inline void +cdp_set_pkt_capture_mode(ol_txrx_soc_handle soc, bool val) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->set_pkt_capture_mode) + return; + + soc->ops->cmn_drv_ops->set_pkt_capture_mode(soc, val); +} +#else +static inline void +cdp_set_pkt_capture_mode(ol_txrx_soc_handle soc, bool val) +{ +} +#endif #endif /* _CDP_TXRX_CMN_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 93789956bb51..921876d0a690 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -578,6 +578,9 @@ struct cdp_cmn_ops { ol_osif_peer_handle osif_peer); #endif /* QCA_SUPPORT_WDS_EXTENDED */ void (*txrx_drain)(ol_txrx_soc_handle soc); +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 + void (*set_pkt_capture_mode)(struct cdp_soc_t *soc, bool val); +#endif }; struct cdp_ctrl_ops { diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index c1615ed0da86..4c6578961d33 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -11294,6 +11294,16 @@ static void dp_drain_txrx(struct cdp_soc_t *soc_handle) } #endif +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 +static void +dp_set_pkt_capture_mode(struct cdp_soc_t *soc_handle, bool val) +{ + struct dp_soc *soc = (struct dp_soc *)soc_handle; + + soc->wlan_cfg_ctx->pkt_capture_mode = val; +} +#endif + static struct cdp_cmn_ops dp_ops_cmn = { .txrx_soc_attach_target = dp_soc_attach_target_wifi3, .txrx_vdev_attach = dp_vdev_attach_wifi3, @@ -11396,6 +11406,9 @@ static struct cdp_cmn_ops dp_ops_cmn = { #if defined(FEATURE_RUNTIME_PM) || defined(DP_POWER_SAVE) .txrx_drain = dp_drain_txrx, #endif +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 + .set_pkt_capture_mode = dp_set_pkt_capture_mode, +#endif }; static struct cdp_ctrl_ops dp_ops_ctrl = { From a84a537be8cd54f4b9c9f331bc7a9e34ce45032f Mon Sep 17 00:00:00 2001 From: Vulupala Shashank Reddy Date: Fri, 12 Nov 2021 10:28:58 +0530 Subject: [PATCH 08/14] Revert "qcacmn: add vendor command to configure the parameters for monitor mode" This reverts commit 5a3e18b614c82eef496da0b648cbc741ca89e571. Change-Id: I2561a1d0196802f7f734ccdd1ba8355d47af0eb3 --- os_if/linux/qca_vendor.h | 134 --------------------------------------- 1 file changed, 134 deletions(-) diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index 055d88379692..d3b91124e082 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -475,29 +475,6 @@ * configurations, concurrency combinations, etc. The attributes used * with this command are defined in * enum qca_wlan_vendor_attr_usable_channels. - * - * @QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE: This vendor subcommand is used - * to set packet monitor mode that aims to send the specified set of TX and - * RX frames on the current client interface to an active monitor interface. - * If this Monitor mode is set, the driver will send the configured frames, - * from the interface on which the command is issued, to an active monitor - * interface. The attributes used with this command are defined in - * enum qca_wlan_vendor_attr_set_monitor_mode. - * - * Though the monitor mode is configured for the respective data/mgmt/ctrl - * frames, it is up to the respective WLAN driver/firmware/hardware designs - * to consider the possibility of sending these frames over the monitor - * interface. For example, the control frames are handled with in the - * hardware and thus passing such frames over the monitor interface is left - * to the respective designs. - * - * Also, this monitor mode is governed to behave accordingly in suspend/resume - * states. If the firmware handles any of such frames in suspend state without - * waking up the host and if the monitor mode is configured to notify all such - * frames, then the firmware is expected to resume the host and forward the - * respective frames to the monitor interface. Please note that such a request - * to get the frames over the monitor interface will have a definite power - * implications. */ enum qca_nl80211_vendor_subcmds { @@ -731,7 +708,6 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_MBSSID_TX_VDEV_STATUS = 196, QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_MULTI_STA_POLICY = 197, QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS = 198, - QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE = 202, }; enum qca_wlan_vendor_tos { @@ -11038,114 +11014,4 @@ enum qca_wlan_vendor_attr_usable_channels { QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_AFTER_LAST - 1, }; -/** - * qca_wlan_vendor_monitor_data_frame_type - Represent the various - * data types to be sent over the monitor interface. - */ -enum qca_wlan_vendor_monitor_data_frame_type { - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ALL = BIT(0), - /* valid only if QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ALL is not set */ - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ARP = BIT(1), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DHCPV4 = BIT(2), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DHCPV6 = BIT(3), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_EAPOL = BIT(4), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DNSV4 = BIT(5), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DNSV6 = BIT(6), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_SYN = BIT(7), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_SYNACK = BIT(8), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_FIN = BIT(9), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_FINACK = BIT(10), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_ACK = BIT(11), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_RST = BIT(12), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ICMPV4 = BIT(13), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ICMPV6 = BIT(14), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_RTP = BIT(15), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_SIP = BIT(16), - QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_QOS_NULL = BIT(17), -}; - -/** - * qca_wlan_vendor_monitor_mgmt_frame_type - Represent the various - * mgmt types to be sent over the monitor interface. - * @QCA_WLAN_VENDOR_MONITOR_MGMT_FRAME_TYPE_ALL: All the MGMT Frames. - * @QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_NO_BEACON: All the MGMT Frames - * except the Beacons. Valid only in the Connect state. - * @QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_BEACON: Only the connected - * BSSID Beacons. Valid only in the Connect state. - * @QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_SCAN_BEACON: Represents - * the Beacons obtained during the scan (off channel and connected channel) - * when in connected state. - */ - -enum qca_wlan_vendor_monitor_mgmt_frame_type { - QCA_WLAN_VENDOR_MONITOR_MGMT_FRAME_TYPE_ALL = BIT(0), - /* valid only if QCA_WLAN_VENDOR_MONITOR_MGMT_FRAME_TYPE_ALL is not set */ - QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_NO_BEACON = BIT(1), - QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_BEACON = BIT(2), - QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_SCAN_BEACON = BIT(3), -}; - -/** - * qca_wlan_vendor_monitor_ctrl_frame_type - Represent the various - * ctrl types to be sent over the monitor interface. - * @QCA_WLAN_VENDOR_MONITOR_CTRL_FRAME_TYPE_ALL: All the ctrl Frames. - * @QCA_WLAN_VENDOR_MONITOR_CTRL_TRIGGER_FRAME: Trigger Frame. - */ -enum qca_wlan_vendor_monitor_ctrl_frame_type { - QCA_WLAN_VENDOR_MONITOR_CTRL_FRAME_TYPE_ALL = BIT(0), - /* valid only if QCA_WLAN_VENDOR_MONITOR_CTRL_FRAME_TYPE_ALL is not set */ - QCA_WLAN_VENDOR_MONITOR_CTRL_TRIGGER_FRAME = BIT(1), -}; - -/** - * enum qca_wlan_vendor_attr_set_monitor_mode - Used by the - * vendor command QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE to set the - * monitor mode. - * - * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_TX_FRAME_TYPE: u32 attribute, - * Represents the tx data packet type to be monitored (u32). These data packets - * are represented by enum qca_wlan_vendor_monitor_data_frame_type. - * - * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_RX_FRAME_TYPE: u32 attribute, - * Represents the tx data packet type to be monitored (u32). These data packets - * are represented by enum qca_wlan_vendor_monitor_data_frame_type. - * - * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE: u32 attribute, - * Represents the tx data packet type to be monitored (u32). These mgmt packets - * are represented by enum qca_wlan_vendor_monitor_mgmt_frame_type. - * - * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE: u32 attribute, - * Represents the tx data packet type to be monitored (u32). These mgmt packets - * are represented by enum qca_wlan_vendor_monitor_mgmt_frame_type. - * - * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE: u32 attribute, - * Represents the tx data packet type to be monitored (u32). These ctrl packets - * are represented by enum qca_wlan_vendor_monitor_ctrl_frame_type. - * - * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE: u32 attribute, - * Represents the tx data packet type to be monitored (u32). These ctrl packets - * are represented by enum qca_wlan_vendor_monitor_ctrl_frame_type. - * - * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL: u32 attribute, - * An interval only for the connected beacon interval, which expects that the - * connected BSSID's beacons shall be sent on the monitor interface only on this - * specific interval. - */ -enum qca_wlan_vendor_attr_set_monitor_mode { - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_INVALID = 0, - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_TX_FRAME_TYPE = 1, - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_RX_FRAME_TYPE = 2, - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE = 3, - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE = 4, - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE = 5, - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE = 6, - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL = 7, - - /* keep last */ - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_AFTER_LAST, - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MAX = - QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_AFTER_LAST - 1, - -}; - #endif From 192d7161f53c7d766ec425a1c95ff4a56927ca10 Mon Sep 17 00:00:00 2001 From: Balaji Pothunoori Date: Mon, 4 Oct 2021 17:20:16 +0530 Subject: [PATCH 09/14] qcacmn: add vendor command to configure the parameters for monitor mode Add new vendor command to configure monitor mode packet filter parameters which includes data/mgmt/ctrl frame types. Change-Id: I7b8ee4b99aed5d4f914c647a1e2fea3bfbcb6209 --- os_if/linux/qca_vendor.h | 136 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index d3b91124e082..6e816b8afa89 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -475,6 +475,29 @@ * configurations, concurrency combinations, etc. The attributes used * with this command are defined in * enum qca_wlan_vendor_attr_usable_channels. + * + * @QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE: This vendor subcommand is used + * to set packet monitor mode that aims to send the specified set of TX and + * RX frames on the current client interface to an active monitor interface. + * If this Monitor mode is set, the driver will send the configured frames, + * from the interface on which the command is issued, to an active monitor + * interface. The attributes used with this command are defined in + * enum qca_wlan_vendor_attr_set_monitor_mode. + * + * Though the monitor mode is configured for the respective data/mgmt/ctrl + * frames, it is up to the respective WLAN driver/firmware/hardware designs + * to consider the possibility of sending these frames over the monitor + * interface. For example, the control frames are handled with in the + * hardware and thus passing such frames over the monitor interface is left + * to the respective designs. + * + * Also, this monitor mode is governed to behave accordingly in + * suspend/resume states. If the firmware handles any of such frames + * in suspend state without waking up the host and if the monitor mode + * is configured to notify all such frames, then the firmware is expected + * to resume the host and forward the respective frames to the monitor + * interface. Please note that such a request to get the frames over the + * monitor interface will have a definite power implications. */ enum qca_nl80211_vendor_subcmds { @@ -708,6 +731,7 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_MBSSID_TX_VDEV_STATUS = 196, QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_MULTI_STA_POLICY = 197, QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS = 198, + QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE = 202, }; enum qca_wlan_vendor_tos { @@ -11014,4 +11038,116 @@ enum qca_wlan_vendor_attr_usable_channels { QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_AFTER_LAST - 1, }; +/** + * qca_wlan_vendor_monitor_data_frame_type - Represent the various + * data types to be sent over the monitor interface. + */ +enum qca_wlan_vendor_monitor_data_frame_type { + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ALL = BIT(0), + + /* valid only if QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ALL is + not set */ + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ARP = BIT(1), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DHCPV4 = BIT(2), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DHCPV6 = BIT(3), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_EAPOL = BIT(4), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DNSV4 = BIT(5), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_DNSV6 = BIT(6), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_SYN = BIT(7), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_SYNACK = BIT(8), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_FIN = BIT(9), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_FINACK = BIT(10), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_ACK = BIT(11), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_TCP_RST = BIT(12), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ICMPV4 = BIT(13), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_ICMPV6 = BIT(14), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_RTP = BIT(15), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_TYPE_SIP = BIT(16), + QCA_WLAN_VENDOR_MONITOR_DATA_FRAME_QOS_NULL = BIT(17), +}; + +/** + * qca_wlan_vendor_monitor_mgmt_frame_type - Represent the various + * mgmt types to be sent over the monitor interface. + * @QCA_WLAN_VENDOR_MONITOR_MGMT_FRAME_TYPE_ALL: All the MGMT Frames. + * @QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_NO_BEACON: All the MGMT Frames + * except the Beacons. Valid only in the Connect state. + * @QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_BEACON: Only the connected + * BSSID Beacons. Valid only in the Connect state. + * @QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_SCAN_BEACON: Represents + * the Beacons obtained during the scan (off channel and connected channel) + * when in connected state. + */ + +enum qca_wlan_vendor_monitor_mgmt_frame_type { + QCA_WLAN_VENDOR_MONITOR_MGMT_FRAME_TYPE_ALL = BIT(0), + /* valid only if QCA_WLAN_VENDOR_MONITOR_MGMT_FRAME_TYPE_ALL is not set */ + QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_NO_BEACON = BIT(1), + QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_BEACON = BIT(2), + QCA_WLAN_VENDOR_MONITOR_MGMT_CONNECT_SCAN_BEACON = BIT(3), +}; + +/** + * qca_wlan_vendor_monitor_ctrl_frame_type - Represent the various + * ctrl types to be sent over the monitor interface. + * @QCA_WLAN_VENDOR_MONITOR_CTRL_FRAME_TYPE_ALL: All the ctrl Frames. + * @QCA_WLAN_VENDOR_MONITOR_CTRL_TRIGGER_FRAME: Trigger Frame. + */ +enum qca_wlan_vendor_monitor_ctrl_frame_type { + QCA_WLAN_VENDOR_MONITOR_CTRL_FRAME_TYPE_ALL = BIT(0), + /* valid only if QCA_WLAN_VENDOR_MONITOR_CTRL_FRAME_TYPE_ALL is not set */ + QCA_WLAN_VENDOR_MONITOR_CTRL_TRIGGER_FRAME = BIT(1), +}; + +/** + * enum qca_wlan_vendor_attr_set_monitor_mode - Used by the + * vendor command QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE to set the + * monitor mode. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_TX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These data packets + * are represented by enum qca_wlan_vendor_monitor_data_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_RX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These data packets + * are represented by enum qca_wlan_vendor_monitor_data_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These mgmt packets + * are represented by enum qca_wlan_vendor_monitor_mgmt_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These mgmt packets + * are represented by enum qca_wlan_vendor_monitor_mgmt_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These ctrl packets + * are represented by enum qca_wlan_vendor_monitor_ctrl_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE: u32 attribute, + * Represents the tx data packet type to be monitored (u32). These ctrl packets + * are represented by enum qca_wlan_vendor_monitor_ctrl_frame_type. + * + * @QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL: + * u32 attribute, An interval only for the connected beacon interval, which + * expects that the connected BSSID's beacons shall be sent on the monitor + * interface only on this specific interval. + */ +enum qca_wlan_vendor_attr_set_monitor_mode { + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_TX_FRAME_TYPE = 1, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_RX_FRAME_TYPE = 2, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE = 3, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE = 4, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE = 5, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE = 6, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL = 7, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MAX = + QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_AFTER_LAST - 1, + +}; + #endif From 903ca27b9a3f7b016e259fac1a87652347667d38 Mon Sep 17 00:00:00 2001 From: Surabhi Vishnoi Date: Thu, 27 Jan 2022 15:17:01 +0530 Subject: [PATCH 10/14] qcacmn: Reduce the log level from error to info Reduce the log level of tx flow control threshold pool size from error to info. This is done to reduce the delay due to console logging in connection/roaming path. Change-Id: I5332bd179edc92006976a6421121cfce38b89b70 CRs-Fixed: 3119430 --- dp/wifi3.0/dp_tx_flow_control.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dp/wifi3.0/dp_tx_flow_control.c b/dp/wifi3.0/dp_tx_flow_control.c index 341e7945904d..41654aa1e7af 100644 --- a/dp/wifi3.0/dp_tx_flow_control.c +++ b/dp/wifi3.0/dp_tx_flow_control.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-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 @@ -73,9 +73,8 @@ dp_tx_initialize_threshold(struct dp_tx_desc_pool_s *pool, pool->stop_th[DP_TH_HI] = (pool->stop_th[DP_TH_BE_BK] * FL_TH_HI_PERCENTAGE) / 100; - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - "%s: tx flow control threshold is set, pool size is %d", - __func__, flow_pool_size); + dp_info("tx flow control threshold is set, pool size is %d", + flow_pool_size); } /** From 5a4a0fc153512dfefac3b5f2fd170237dadc3de3 Mon Sep 17 00:00:00 2001 From: Arun Kumar Khandavalli Date: Tue, 15 Feb 2022 10:13:30 +0530 Subject: [PATCH 11/14] qcacmn: Dont add the wmi header size while allocating the wmi buff Currently whenever the wmi message is allocated the wmi header length is also added to check with against the max size supported by the firmware, there is no need to add the extra wmi header size as the max length shared by firmware has the wmi header size included. Below is the breakdown: Max CE2 transfer size is 2048 bytes HTC header is 8 bytes WMI header is 4 bytes Max payload can be (MAX CE2 Transfer size - (HTC header+ WMI header) (2048 - (8 +4)) = 2036 During the htc handshake this max wmi length is recevied by the host as 2040 bytes which is including the wmi header so host adding the extra 4 bytes is redundant and can be removed. HTC buffer->actual_length = 2036 + WMI(4) = 2040 bytes Change-Id: Ib958a938506c5c96347dec5304ca30aa8690d459 CRs-Fixed: 3130493 --- wmi/src/wmi_unified.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wmi/src/wmi_unified.c b/wmi/src/wmi_unified.c index e143c75344e2..7bed514cbdb7 100644 --- a/wmi/src/wmi_unified.c +++ b/wmi/src/wmi_unified.c @@ -1649,7 +1649,10 @@ wmi_buf_alloc_debug(wmi_unified_t wmi_handle, uint32_t len, { wmi_buf_t wmi_buf; - if (roundup(len + sizeof(WMI_CMD_HDR), 4) > wmi_handle->max_msg_len) { + if (roundup(len, 4) > wmi_handle->max_msg_len) { + wmi_err("Invalid length %u (via %s:%u) max size: %u", + len, func_name, line_num, + wmi_handle->max_msg_len); QDF_ASSERT(0); return NULL; } @@ -1690,9 +1693,9 @@ wmi_buf_t wmi_buf_alloc_fl(wmi_unified_t wmi_handle, uint32_t len, { wmi_buf_t wmi_buf; - if (roundup(len + sizeof(WMI_CMD_HDR), 4) > wmi_handle->max_msg_len) { - QDF_DEBUG_PANIC("Invalid length %u (via %s:%u)", - len, func, line); + if (roundup(len, 4) > wmi_handle->max_msg_len) { + QDF_DEBUG_PANIC("Invalid length %u (via %s:%u) max size: %u", + len, func, line, wmi_handle->max_msg_len); return NULL; } From 1af67b79a45c3982607f875b60cf9771ecd4b393 Mon Sep 17 00:00:00 2001 From: Surya Prakash Sivaraj Date: Thu, 28 Apr 2022 18:56:07 +0530 Subject: [PATCH 12/14] qcacmn: Update preauth candidate entry to scan table During SAE roam auth offload, update the beacon/probe response frame coming from the FW via WMI_ROAM_FRAME_EVENTID into the scan db. When the bss info of the preauth candidate is unavailable in the host/kernel scan entry, supplicant fails to determine the proper SAE PWE config of the peer and the commit request fails. Change-Id: I8537147104f30b74ffb2e87946f2e5f4b129f0df CRs-Fixed: 3075460 --- .../cmn_defs/inc/wlan_cmn_ieee80211.h | 5 +++++ umac/scan/dispatcher/inc/wlan_scan_utils_api.h | 17 +++++++++++++++++ umac/scan/dispatcher/src/wlan_scan_utils_api.c | 12 ++++++++++++ wmi/inc/wmi_unified_param.h | 1 + wmi/src/wmi_unified_tlv.c | 2 ++ 5 files changed, 37 insertions(+) diff --git a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h index 6a9907af33e7..24e7466ce7ef 100644 --- a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h +++ b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2020 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 @@ -196,6 +197,10 @@ /* 80 + 80 MHz Operating Channel (revised signalling) */ #define WLAN_VHTOP_CHWIDTH_REVSIG_80_80 1 +#define WLAN_MAX_HEOP_IE_LEN 16 +#define WLAN_HEOP_OUI_TYPE "\x24" +#define WLAN_HEOP_OUI_SIZE 1 + #define WLAN_HEOP_FIXED_PARAM_LENGTH 7 #define WLAN_HEOP_VHTOP_LENGTH 3 #define WLAN_HEOP_CO_LOCATED_BSS_LENGTH 1 diff --git a/umac/scan/dispatcher/inc/wlan_scan_utils_api.h b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h index c5a3081582f4..08a36fab5508 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_utils_api.h +++ b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2020 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 @@ -1721,4 +1722,20 @@ static inline bool util_scan_is_null_ssid(struct wlan_ssid *ssid) return false; } +/** + * util_scan_get_6g_oper_channel() - function to get primary channel + * from he op IE + * he_op_ie : ie pointer + * + * Return : primary channel or 0 if 6g params is not present. + */ +#ifdef CONFIG_BAND_6GHZ +uint8_t util_scan_get_6g_oper_channel(uint8_t *he_op_ie); +#else +static inline uint8_t +util_scan_get_6g_oper_channel(uint8_t *he_op_ie) +{ + return 0; +} +#endif #endif diff --git a/umac/scan/dispatcher/src/wlan_scan_utils_api.c b/umac/scan/dispatcher/src/wlan_scan_utils_api.c index a7130b60551c..66a4555e03aa 100644 --- a/umac/scan/dispatcher/src/wlan_scan_utils_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_utils_api.c @@ -339,6 +339,18 @@ util_scan_get_phymode_6g(struct wlan_objmgr_pdev *pdev, return phymode; } + +uint8_t +util_scan_get_6g_oper_channel(uint8_t *he_op_ie) +{ + struct he_oper_6g_param *he_6g_params; + + he_6g_params = util_scan_get_he_6g_params(he_op_ie); + if (!he_6g_params) + return 0; + + return he_6g_params->primary_channel; +} #else static QDF_STATUS util_scan_get_chan_from_he_6g_params(struct wlan_objmgr_pdev *pdev, diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 87bc26ff2175..0fa5f924d1c1 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -4697,6 +4697,7 @@ typedef enum { #ifdef WLAN_FEATURE_PKT_CAPTURE_V2 wmi_vdev_smart_monitor_event_id, #endif + wmi_roam_frame_event_id, wmi_events_max, } wmi_conv_event_id; diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 6edd7e6b616d..fb8e13a9fa61 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -15548,6 +15548,8 @@ event_ids[wmi_roam_scan_chan_list_id] = event_ids[wmi_vdev_smart_monitor_event_id] = WMI_VDEV_SMART_MONITOR_EVENTID; #endif + event_ids[wmi_roam_frame_event_id] = + WMI_ROAM_FRAME_EVENTID; } #ifdef WLAN_FEATURE_LINK_LAYER_STATS From a360e37d0297fc4ef6fe666dbe7bf8a39dfea127 Mon Sep 17 00:00:00 2001 From: Paul Zhang Date: Fri, 19 May 2023 13:54:35 +0800 Subject: [PATCH 13/14] qcacmn: set pdev id to 0xFF when set country code From firmware perspective, host only sets 5 GHz regdomain hence 2 GHz uses default setting and firmware does not update channel list event for all phys according to the new country code. Therefore sets pdev_id to 0xFF in function reg_set_country and it is mapping to WMI_PDEV_ID_SOC when issue wmi command WMI_SET_CURRENT_COUNTRY_CMDID as firmware required. Change-Id: I0eb84db9f6d77c0473161cc4ffc0dcebd31c3d45 CRs-Fixed: 3239644 --- umac/regulatory/core/src/reg_utils.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 73f3a88c7806..2a162c13bd52 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 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 @@ -38,6 +38,7 @@ #include "reg_services_common.h" #include "reg_build_chan_list.h" #include "wlan_cm_bss_score_param.h" +#include "wmi_unified_param.h" #define DEFAULT_WORLD_REGDMN 0x60 @@ -228,7 +229,11 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev, reg_debug("programming new country: %s to firmware", country); qdf_mem_copy(cc.country, country, REG_ALPHA2_LEN + 1); - cc.pdev_id = pdev_id; + /* + * Need firmware to send channel list event + * for all phys. Therefore set pdev_id to 0xFF. + */ + cc.pdev_id = WMI_HOST_PDEV_ID_SOC; if (!psoc_reg->offload_enabled && !reg_is_world_alpha2(country)) { QDF_STATUS status; @@ -1084,9 +1089,9 @@ QDF_STATUS reg_set_curr_country(struct wlan_regulatory_psoc_priv_obj *soc_reg, /* * Need firmware to send channel list event - * for all phys. Therefore set pdev_id to 0xFF + * for all phys. Therefore set pdev_id to 0xFF. */ - pdev_id = 0xFF; + pdev_id = WMI_HOST_PDEV_ID_SOC; for (phy_num = 0; phy_num < regulat_info->num_phy; phy_num++) { if (soc_reg->cc_src == SOURCE_USERSPACE) soc_reg->new_user_ctry_pending[phy_num] = true; From c53391f022c654b844a252ef2e6b999499746af6 Mon Sep 17 00:00:00 2001 From: Krupali Dhanvijay Date: Thu, 19 Jan 2023 12:10:12 +0530 Subject: [PATCH 14/14] qcacmn: Fix low TPC power for vendor DTPC IE Currently low TPC power is configured to firmware if power constraint IE is not present and only vendor DTPC IE is present. TPC power calculation is depends on regulatory power, ap power constraint and TPE IE. To fix this add new check is_power_constraint_abs in reg_tpc_obj. Whenever local power constraint is from DTPC IE, is_power_constraint_abs is set to true. And TPC power is calculated with regulatory power, DTPC IE power and TPE IE power. Change-Id: If6f1ea737c8b32db449dd340314026fd3693b698 CRs-Fixed: 3387238 --- umac/regulatory/dispatcher/inc/reg_services_public_struct.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h index 46b1e668709b..b8e63e6574e6 100644 --- a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h +++ b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2023 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 @@ -1430,6 +1431,7 @@ struct chan_power_info { * @frequency: Array of operating frequency * @tpe: TPE values processed from TPE IE * @chan_power_info: power info to send to FW + * @is_power_constraint_abs: is power constraint absolute or not */ struct reg_tpc_power_info { bool is_psd_power; @@ -1441,6 +1443,7 @@ struct reg_tpc_power_info { qdf_freq_t frequency[MAX_NUM_PWR_LEVEL]; uint8_t tpe[MAX_NUM_PWR_LEVEL]; struct chan_power_info chan_power_info[MAX_NUM_PWR_LEVEL]; + bool is_power_constraint_abs; }; #endif