1 /* SPDX-License-Identifier: BSD-3-Clause 2 * 3 * Copyright(c) 2020-2021 Xilinx, Inc. 4 */ 5 6 #ifndef _SFC_MAE_COUNTER_H 7 #define _SFC_MAE_COUNTER_H 8 9 #include "sfc.h" 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 /* Default values for a user of counter RxQ */ 16 #define SFC_MAE_COUNTER_RX_BURST 32 17 #define SFC_COUNTER_RXQ_RX_DESC_COUNT 256 18 19 /* 20 * The refill level is chosen based on requirement to keep number 21 * of give credits operations low. 22 */ 23 #define SFC_COUNTER_RXQ_REFILL_LEVEL (SFC_COUNTER_RXQ_RX_DESC_COUNT / 4) 24 25 /* 26 * SF-122415-TC states that the packetiser that generates packets for 27 * counter stream must support 9k frames. Set it to the maximum supported 28 * size since in case of huge flow of counters, having fewer packets in counter 29 * updates is better. 30 */ 31 #define SFC_MAE_COUNTER_STREAM_PACKET_SIZE 9216 32 33 bool sfc_mae_counter_rxq_required(struct sfc_adapter *sa); 34 35 int sfc_mae_counter_rxq_attach(struct sfc_adapter *sa); 36 void sfc_mae_counter_rxq_detach(struct sfc_adapter *sa); 37 38 int sfc_mae_counter_rxq_init(struct sfc_adapter *sa); 39 void sfc_mae_counter_rxq_fini(struct sfc_adapter *sa); 40 41 int sfc_mae_counters_init(struct sfc_mae_counters *counters, 42 uint32_t nb_counters_max); 43 void sfc_mae_counters_fini(struct sfc_mae_counters *counters); 44 int sfc_mae_counter_enable(struct sfc_adapter *sa, 45 struct sfc_mae_counter_id *counterp); 46 int sfc_mae_counter_disable(struct sfc_adapter *sa, 47 struct sfc_mae_counter_id *counter); 48 int sfc_mae_counter_get(struct sfc_mae_counters *counters, 49 const struct sfc_mae_counter_id *counter, 50 struct rte_flow_query_count *data); 51 52 int sfc_mae_counter_start(struct sfc_adapter *sa); 53 void sfc_mae_counter_stop(struct sfc_adapter *sa); 54 55 /* Check whether MAE Counter-on-Queue (CoQ) prerequisites are satisfied */ 56 bool sfc_mae_counter_stream_enabled(struct sfc_adapter *sa); 57 58 #ifdef __cplusplus 59 } 60 #endif 61 #endif /* _SFC_MAE_COUNTER_H */ 62