From 80e1cfff995b1d6aa6edfec44643d5391f17232b Mon Sep 17 00:00:00 2001 From: Tallapragada Kalyan Date: Thu, 1 Dec 2022 08:50:18 +0530 Subject: [PATCH] qcacmn: add new fields to flow rule HAL API to support PPE waikiki supports sending a packet from REO2PPE if a flow rule matches. these changes are added to take advantage of this HW feature when ever we are adding a flow rule CRs-Fixed: 3359141 Change-Id: I8fedfcc759bc0427d71d3bb615e61ba38577c5c0 --- dp/inc/cdp_txrx_cmn_struct.h | 6 ++++++ dp/wifi3.0/be/dp_be.c | 18 ++++++++++++++++-- dp/wifi3.0/dp_stats.c | 16 ++++++++++++++++ dp/wifi3.0/dp_types.h | 7 +++++++ hal/wifi3.0/hal_rx_flow_info.h | 7 +++++++ hal/wifi3.0/qcn9224/hal_9224.h | 14 ++++++++++++++ 6 files changed, 66 insertions(+), 2 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index bb2c854580..5c69ea1360 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -2982,12 +2982,18 @@ struct cdp_rx_flow_tuple_info { * @op_code: add/delete/enable/disable operation requested * @flow_tuple_info: structure containing tuple info * @fse_metadata: metadata to be set in RX flow + * @use_ppe_ds: use DS mode + * @priority_vld: is priority valid + * @service_code: service code for DS */ struct cdp_rx_flow_info { bool is_addr_ipv4; enum cdp_flow_fst_operation op_code; struct cdp_rx_flow_tuple_info flow_tuple_info; uint16_t fse_metadata; + uint8_t use_ppe_ds; + uint8_t priority_vld; + uint16_t service_code; }; #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS diff --git a/dp/wifi3.0/be/dp_be.c b/dp/wifi3.0/be/dp_be.c index 8dea8727c3..84c4dc6d02 100644 --- a/dp/wifi3.0/be/dp_be.c +++ b/dp/wifi3.0/be/dp_be.c @@ -525,9 +525,13 @@ static QDF_STATUS dp_peer_ppeds_default_route_be(struct dp_soc *soc, { uint16_t service_code; uint8_t priority_valid; - uint8_t use_ppe = PEER_ROUTING_USE_PPE; + uint8_t use_ppe_ds = PEER_ROUTING_USE_PPE; uint8_t peer_routing_enabled = PEER_ROUTING_ENABLED; QDF_STATUS status = QDF_STATUS_SUCCESS; + struct wlan_cfg_dp_soc_ctxt *cfg = soc->wlan_cfg_ctx; + struct dp_vdev_be *be_vdev; + + be_vdev = dp_get_be_vdev_from_dp_vdev(be_peer->peer.vdev); /* * Program service code bypass to avoid L2 new mac address @@ -536,13 +540,23 @@ static QDF_STATUS dp_peer_ppeds_default_route_be(struct dp_soc *soc, service_code = PPE_DRV_SC_SPF_BYPASS; priority_valid = be_peer->priority_valid; + /* + * if FST is enabled and MLO is disabled then + * let flow rule take the decision of routing + * the pkt to DS or host + */ + if (wlan_cfg_is_rx_flow_tag_enabled(cfg) && + qdf_is_macaddr_zero((struct qdf_mac_addr *) + be_vdev->vdev.mld_mac_addr.raw)) + use_ppe_ds = 0; + if (soc->cdp_soc.ol_ops->peer_set_ppeds_default_routing) { status = soc->cdp_soc.ol_ops->peer_set_ppeds_default_routing (soc->ctrl_psoc, be_peer->peer.mac_addr.raw, service_code, priority_valid, - src_info, vdev_id, use_ppe, + src_info, vdev_id, use_ppe_ds, peer_routing_enabled); if (status != QDF_STATUS_SUCCESS) { qdf_err("vdev_id: %d, PPE peer routing mac:" diff --git a/dp/wifi3.0/dp_stats.c b/dp/wifi3.0/dp_stats.c index 0903418319..599ed3a974 100644 --- a/dp/wifi3.0/dp_stats.c +++ b/dp/wifi3.0/dp_stats.c @@ -7633,6 +7633,20 @@ dp_print_pdev_tx_stats(struct dp_pdev *pdev) dp_monitor_print_pdev_tx_capture_stats(pdev); } +#ifdef WLAN_SUPPORT_RX_FLOW_TAG +static inline void dp_rx_basic_fst_stats(struct dp_pdev *pdev) +{ + DP_PRINT_STATS("\tNo of IPv4 Flow entries inserted = %d", + qdf_atomic_read(&pdev->soc->ipv4_fse_cnt)); + DP_PRINT_STATS("\tNo of IPv6 Flow entries inserted = %d", + qdf_atomic_read(&pdev->soc->ipv6_fse_cnt)); +} +#else +static inline void dp_rx_basic_fst_stats(struct dp_pdev *pdev) +{ +} +#endif + void dp_print_pdev_rx_stats(struct dp_pdev *pdev) { @@ -7717,6 +7731,8 @@ dp_print_pdev_rx_stats(struct dp_pdev *pdev) pdev->stats.rx_buffer_pool.num_bufs_alloc_success); DP_PRINT_STATS("\tAllocations from the pool during replenish = %llu", pdev->stats.rx_buffer_pool.num_pool_bufs_replenish); + + dp_rx_basic_fst_stats(pdev); } #ifdef WLAN_SUPPORT_PPEDS diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index d99c949c02..432a9f1b03 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -2627,6 +2627,13 @@ struct dp_soc { bool high_throughput; #endif bool is_tx_pause; + +#ifdef WLAN_SUPPORT_RX_FLOW_TAG + /* number of IPv4 flows inserted */ + qdf_atomic_t ipv4_fse_cnt; + /* number of IPv6 flows inserted */ + qdf_atomic_t ipv6_fse_cnt; +#endif }; #ifdef IPA_OFFLOAD diff --git a/hal/wifi3.0/hal_rx_flow_info.h b/hal/wifi3.0/hal_rx_flow_info.h index 3e2d5f0dc7..af5e30f70e 100644 --- a/hal/wifi3.0/hal_rx_flow_info.h +++ b/hal/wifi3.0/hal_rx_flow_info.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2019-2021 The Linux Foundation. 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 @@ -32,12 +33,18 @@ * @reo_destination_handler: REO destination for this flow * @reo_destination_indication: REO indication for this flow * @fse_metadata: Flow metadata or tag passed to HW for marking packets + * @use_ppe_ds: send the pkt to REO2PPE instead of REO2HOST + * @priority_vld: field used by DS + * @service_code: field used by DS */ struct hal_rx_flow { struct hal_flow_tuple_info tuple_info; uint8_t reo_destination_handler; uint8_t reo_destination_indication; uint32_t fse_metadata; + uint8_t use_ppe_ds; + uint8_t priority_vld; + uint16_t service_code; }; /** diff --git a/hal/wifi3.0/qcn9224/hal_9224.h b/hal/wifi3.0/qcn9224/hal_9224.h index 88472a1986..3d6263df59 100644 --- a/hal/wifi3.0/qcn9224/hal_9224.h +++ b/hal/wifi3.0/qcn9224/hal_9224.h @@ -1203,6 +1203,20 @@ hal_rx_flow_setup_fse_9224(uint8_t *rx_fst, uint32_t table_offset, HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY, L4_PROTOCOL, flow->tuple_info.l4_protocol); + HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, USE_PPE); + HAL_SET_FLD(fse, RX_FLOW_SEARCH_ENTRY, USE_PPE) |= + HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY, USE_PPE, flow->use_ppe_ds); + + HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, PRIORITY_VALID); + HAL_SET_FLD(fse, RX_FLOW_SEARCH_ENTRY, PRIORITY_VALID) |= + HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY, PRIORITY_VALID, + flow->priority_vld); + + HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, SERVICE_CODE); + HAL_SET_FLD(fse, RX_FLOW_SEARCH_ENTRY, SERVICE_CODE) |= + HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY, SERVICE_CODE, + flow->service_code); + HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, REO_DESTINATION_HANDLER); HAL_SET_FLD(fse, RX_FLOW_SEARCH_ENTRY, REO_DESTINATION_HANDLER) |= HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY, REO_DESTINATION_HANDLER,