10513f0afSPeter Spreadborough /* SPDX-License-Identifier: BSD-3-Clause 20513f0afSPeter Spreadborough * Copyright(c) 2014-2021 Broadcom 30513f0afSPeter Spreadborough * All rights reserved. 40513f0afSPeter Spreadborough */ 50513f0afSPeter Spreadborough 60513f0afSPeter Spreadborough #include <rte_common.h> 70513f0afSPeter Spreadborough #include <rte_cycles.h> 80513f0afSPeter Spreadborough #include <rte_malloc.h> 90513f0afSPeter Spreadborough #include <rte_log.h> 100513f0afSPeter Spreadborough #include <rte_alarm.h> 110513f0afSPeter Spreadborough #include "bnxt.h" 120513f0afSPeter Spreadborough #include "bnxt_ulp.h" 130513f0afSPeter Spreadborough #include "bnxt_ulp_utils.h" 140513f0afSPeter Spreadborough #include "bnxt_ulp_tfc.h" 150513f0afSPeter Spreadborough #include "bnxt_tf_common.h" 160513f0afSPeter Spreadborough #include "ulp_sc_mgr.h" 170513f0afSPeter Spreadborough #include "ulp_flow_db.h" 180513f0afSPeter Spreadborough #include "ulp_template_db_enum.h" 190513f0afSPeter Spreadborough #include "ulp_template_struct.h" 200513f0afSPeter Spreadborough #include "tfc.h" 210513f0afSPeter Spreadborough #include "tfc_debug.h" 220513f0afSPeter Spreadborough #include "tfc_action_handle.h" 230513f0afSPeter Spreadborough 240513f0afSPeter Spreadborough static int32_t 250513f0afSPeter Spreadborough ulp_sc_tfc_stats_cache_update(struct tfc *tfcp, 260513f0afSPeter Spreadborough int dir, 27*ca827d42SPeter Spreadborough uint64_t *host_address, 280513f0afSPeter Spreadborough uint64_t handle, 290513f0afSPeter Spreadborough uint16_t *words, 300513f0afSPeter Spreadborough struct tfc_mpc_batch_info_t *batch_info, 310513f0afSPeter Spreadborough bool reset) 320513f0afSPeter Spreadborough { 330513f0afSPeter Spreadborough struct tfc_cmm_info cmm_info; 340513f0afSPeter Spreadborough struct tfc_cmm_clr cmm_clr; 350513f0afSPeter Spreadborough int rc; 360513f0afSPeter Spreadborough 370513f0afSPeter Spreadborough cmm_info.dir = dir; 380513f0afSPeter Spreadborough cmm_info.rsubtype = CFA_RSUBTYPE_CMM_ACT; 390513f0afSPeter Spreadborough cmm_info.act_handle = handle; 400513f0afSPeter Spreadborough cmm_clr.clr = reset; 410513f0afSPeter Spreadborough 420513f0afSPeter Spreadborough if (reset) { 430513f0afSPeter Spreadborough cmm_clr.offset_in_byte = 0; 440513f0afSPeter Spreadborough cmm_clr.sz_in_byte = 16; 450513f0afSPeter Spreadborough } 460513f0afSPeter Spreadborough 470513f0afSPeter Spreadborough rc = tfc_act_get(tfcp, 480513f0afSPeter Spreadborough batch_info, 490513f0afSPeter Spreadborough &cmm_info, 500513f0afSPeter Spreadborough &cmm_clr, 51*ca827d42SPeter Spreadborough host_address, 520513f0afSPeter Spreadborough words); 530513f0afSPeter Spreadborough 540513f0afSPeter Spreadborough return rc; 550513f0afSPeter Spreadborough } 560513f0afSPeter Spreadborough 570513f0afSPeter Spreadborough 580513f0afSPeter Spreadborough const struct bnxt_ulp_sc_core_ops ulp_sc_tfc_core_ops = { 590513f0afSPeter Spreadborough .ulp_stats_cache_update = ulp_sc_tfc_stats_cache_update 600513f0afSPeter Spreadborough }; 61