diff --git a/dp/inc/cdp_txrx_fse.h b/dp/inc/cdp_txrx_fse.h new file mode 100644 index 0000000000..2eb5d29b58 --- /dev/null +++ b/dp/inc/cdp_txrx_fse.h @@ -0,0 +1,73 @@ +/* + * 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 + * 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. + */ + +#ifndef _CDP_TXRX_FSE_H_ +#define _CDP_TXRX_FSE_H_ + +#include +#include + +#ifdef WLAN_SUPPORT_RX_FLOW_TAG +static inline QDF_STATUS +cdp_fse_flow_add(ol_txrx_soc_handle soc, + uint32_t *src_ip, uint32_t src_port, + uint32_t *dest_ip, uint32_t dest_port, + uint8_t protocol, uint8_t version) +{ + if (!soc || !soc->ops) { + dp_cdp_debug("Invalid Instance"); + QDF_BUG(0); + return QDF_STATUS_E_FAILURE; + } + + if (!soc->ops->fse_ops || + !soc->ops->fse_ops->fse_rule_add) { + return QDF_STATUS_E_FAILURE; + } + + return soc->ops->fse_ops->fse_rule_add(soc, + src_ip, src_port, + dest_ip, dest_port, + protocol, version); +} + +static inline QDF_STATUS +cdp_fse_flow_delete(ol_txrx_soc_handle soc, + uint32_t *src_ip, uint32_t src_port, + uint32_t *dest_ip, uint32_t dest_port, + uint8_t protocol, uint8_t version) +{ + if (!soc || !soc->ops) { + dp_cdp_debug("Invalid Instance"); + QDF_BUG(0); + return QDF_STATUS_E_FAILURE; + } + + if (!soc->ops->fse_ops || + !soc->ops->fse_ops->fse_rule_delete) { + return QDF_STATUS_E_FAILURE; + } + + return soc->ops->fse_ops->fse_rule_delete(soc, + src_ip, src_port, + dest_ip, dest_port, + protocol, version); +} + +#endif /* WLAN_SUPPORT_RX_FLOW_TAG */ +#endif /* _CDP_TXRX_FSE_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 28768c8b33..7259605ce7 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -2456,6 +2456,21 @@ struct cdp_ppeds_txrx_ops { }; #endif /* WLAN_SUPPORT_PPEDS */ +#ifdef WLAN_SUPPORT_RX_FLOW_TAG +struct cdp_fse_ops { + QDF_STATUS + (*fse_rule_add)(struct cdp_soc_t *soc, + uint32_t *src_ip, uint32_t src_port, + uint32_t *dest_ip, uint32_t dest_port, + uint8_t protocol, uint8_t version); + QDF_STATUS + (*fse_rule_delete)(struct cdp_soc_t *soc, + uint32_t *src_ip, uint32_t src_port, + uint32_t *dest_ip, uint32_t dest_port, + uint8_t protocol, uint8_t version); +}; +#endif /* WLAN_SUPPORT_RX_FLOW_TAG */ + struct cdp_ops { struct cdp_cmn_ops *cmn_drv_ops; struct cdp_ctrl_ops *ctrl_ops; @@ -2509,5 +2524,8 @@ struct cdp_ops { #ifdef WLAN_SUPPORT_PPEDS struct cdp_ppeds_txrx_ops *ppeds_ops; #endif +#ifdef WLAN_SUPPORT_RX_FLOW_TAG + struct cdp_fse_ops *fse_ops; +#endif }; #endif diff --git a/dp/wifi3.0/be/dp_be_rx.c b/dp/wifi3.0/be/dp_be_rx.c index e375848bd8..14c1ad617f 100644 --- a/dp/wifi3.0/be/dp_be_rx.c +++ b/dp/wifi3.0/be/dp_be_rx.c @@ -44,10 +44,21 @@ static inline void dp_rx_update_flow_info(qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr) { + uint32_t fse_metadata; + /* Set the flow idx valid flag only when there is no timeout */ if (hal_rx_msdu_flow_idx_timeout_be(rx_tlv_hdr)) return; + /* + * If invalid bit is not set and the fse metadata indicates that it is + * a valid SFE flow match in FSE, do not set the rx flow tag and let it + * go via stack instead of VP. + */ + fse_metadata = hal_rx_msdu_fse_metadata_get_be(rx_tlv_hdr); + if (!hal_rx_msdu_flow_idx_invalid_be(rx_tlv_hdr) && (fse_metadata == DP_RX_FSE_FLOW_MATCH_SFE)) + return; + qdf_nbuf_set_rx_flow_idx_valid(nbuf, !hal_rx_msdu_flow_idx_invalid_be(rx_tlv_hdr)); } diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 7854aed346..820cfc6aa9 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -100,6 +100,9 @@ cdp_dump_flow_pool_info(struct cdp_soc_t *soc) #ifdef CONFIG_SAWF_DEF_QUEUES #include "dp_sawf.h" #endif +#ifdef WLAN_SUPPORT_RX_FLOW_TAG +#include "dp_rx_tag.h" +#endif #ifdef WLAN_FEATURE_PEER_TXQ_FLUSH_CONF #include #endif @@ -11014,6 +11017,13 @@ static struct cdp_scs_ops dp_ops_scs = { }; #endif +#ifdef WLAN_SUPPORT_RX_FLOW_TAG +static struct cdp_fse_ops dp_ops_fse = { + .fse_rule_add = NULL, + .fse_rule_delete = NULL, +}; +#endif + #ifdef CONFIG_SAWF_DEF_QUEUES static struct cdp_sawf_ops dp_ops_sawf = { .sawf_def_queues_map_req = dp_sawf_def_queues_map_req, @@ -11885,6 +11895,9 @@ static void dp_soc_txrx_ops_attach(struct dp_soc *soc) #ifdef WLAN_SUPPORT_SCS soc->cdp_soc.ops->scs_ops = &dp_ops_scs; #endif +#ifdef WLAN_SUPPORT_RX_FLOW_TAG + soc->cdp_soc.ops->fse_ops = &dp_ops_fse; +#endif }; #if defined(QCA_WIFI_QCA8074) || defined(QCA_WIFI_QCA6018) || \ diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index c56c87a0e4..de53b5efcd 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -172,6 +172,10 @@ #define DP_RX_REFILL_THRD_THRESHOLD 512 #endif +#ifdef WLAN_SUPPORT_RX_FLOW_TAG +#define DP_RX_FSE_FLOW_MATCH_SFE 0xAAAA +#endif + #ifdef WLAN_VENDOR_SPECIFIC_BAR_UPDATE #define DP_SKIP_BAR_UPDATE_TIMEOUT 5000 #endif @@ -4975,6 +4979,8 @@ struct dp_rx_fst { qdf_atomic_t is_cache_update_pending; /* Flag to indicate completion of FSE setup in HW/FW */ bool fse_setup_done; + /* Last ring id used to add a flow */ + uint8_t ring_id; }; #define DP_RX_GET_SW_FT_ENTRY_SIZE sizeof(struct dp_rx_fse)