net/sfc: fix cleanup order of SW stats
[dpdk.git] / drivers / net / sfc / sfc_mae.h
index 0241fe3..7e3b6a7 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "efx.h"
 
+#include "sfc_stats.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -54,10 +56,20 @@ struct sfc_mae_encap_header {
 
 TAILQ_HEAD(sfc_mae_encap_headers, sfc_mae_encap_header);
 
+/* Counter ID */
+struct sfc_mae_counter_id {
+       /* ID of a counter in MAE */
+       efx_counter_t                   mae_id;
+       /* ID of a counter in RTE */
+       uint32_t                        rte_id;
+};
+
 /** Action set registry entry */
 struct sfc_mae_action_set {
        TAILQ_ENTRY(sfc_mae_action_set) entries;
        unsigned int                    refcnt;
+       struct sfc_mae_counter_id       *counters;
+       uint32_t                        n_counters;
        efx_mae_actions_t               *spec;
        struct sfc_mae_encap_header     *encap_header;
        struct sfc_mae_fw_rsrc          fw_rsrc;
@@ -83,6 +95,50 @@ struct sfc_mae_bounce_eh {
        efx_tunnel_protocol_t           type;
 };
 
+/** Counter collection entry */
+struct sfc_mae_counter {
+       bool                            inuse;
+       uint32_t                        generation_count;
+       union sfc_pkts_bytes            value;
+       union sfc_pkts_bytes            reset;
+};
+
+struct sfc_mae_counters_xstats {
+       uint64_t                        not_inuse_update;
+       uint64_t                        realloc_update;
+};
+
+struct sfc_mae_counters {
+       /** An array of all MAE counters */
+       struct sfc_mae_counter          *mae_counters;
+       /** Extra statistics for counters */
+       struct sfc_mae_counters_xstats  xstats;
+       /** Count of all MAE counters */
+       unsigned int                    n_mae_counters;
+};
+
+struct sfc_mae_counter_registry {
+       /* Common counter information */
+       /** Counters collection */
+       struct sfc_mae_counters         counters;
+
+       /* Information used by counter update service */
+       /** Callback to get packets from RxQ */
+       eth_rx_burst_t                  rx_pkt_burst;
+       /** Data for the callback to get packets */
+       struct sfc_dp_rxq               *rx_dp;
+       /** Number of buffers pushed to the RxQ */
+       unsigned int                    pushed_n_buffers;
+       /** Are credits used by counter stream */
+       bool                            use_credits;
+
+       /* Information used by configuration routines */
+       /** Counter service core ID */
+       uint32_t                        service_core_id;
+       /** Counter service ID */
+       uint32_t                        service_id;
+};
+
 struct sfc_mae {
        /** Assigned switch domain identifier */
        uint16_t                        switch_domain_id;
@@ -104,6 +160,10 @@ struct sfc_mae {
        struct sfc_mae_action_sets      action_sets;
        /** Encap. header bounce buffer */
        struct sfc_mae_bounce_eh        bounce_eh;
+       /** Flag indicating whether counter-only RxQ is running */
+       bool                            counter_rxq_running;
+       /** Counter registry */
+       struct sfc_mae_counter_registry counter_registry;
 };
 
 struct sfc_adapter;
@@ -244,6 +304,7 @@ int sfc_mae_rule_parse_actions(struct sfc_adapter *sa,
 sfc_flow_verify_cb_t sfc_mae_flow_verify;
 sfc_flow_insert_cb_t sfc_mae_flow_insert;
 sfc_flow_remove_cb_t sfc_mae_flow_remove;
+sfc_flow_query_cb_t sfc_mae_flow_query;
 
 #ifdef __cplusplus
 }