linux/drivers/net/ethernet/pensando/ionic/ionic_stats.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
   3
   4#ifndef _IONIC_STATS_H_
   5#define _IONIC_STATS_H_
   6
   7#define IONIC_STAT_TO_OFFSET(type, stat_name) (offsetof(type, stat_name))
   8
   9#define IONIC_STAT_DESC(type, stat_name) { \
  10        .name = #stat_name, \
  11        .offset = IONIC_STAT_TO_OFFSET(type, stat_name) \
  12}
  13
  14#define IONIC_PORT_STAT_DESC(stat_name) \
  15        IONIC_STAT_DESC(struct ionic_port_stats, stat_name)
  16
  17#define IONIC_LIF_STAT_DESC(stat_name) \
  18        IONIC_STAT_DESC(struct ionic_lif_sw_stats, stat_name)
  19
  20#define IONIC_TX_STAT_DESC(stat_name) \
  21        IONIC_STAT_DESC(struct ionic_tx_stats, stat_name)
  22
  23#define IONIC_RX_STAT_DESC(stat_name) \
  24        IONIC_STAT_DESC(struct ionic_rx_stats, stat_name)
  25
  26#define IONIC_TX_Q_STAT_DESC(stat_name) \
  27        IONIC_STAT_DESC(struct ionic_queue, stat_name)
  28
  29#define IONIC_CQ_STAT_DESC(stat_name) \
  30        IONIC_STAT_DESC(struct ionic_cq, stat_name)
  31
  32#define IONIC_INTR_STAT_DESC(stat_name) \
  33        IONIC_STAT_DESC(struct ionic_intr_info, stat_name)
  34
  35#define IONIC_NAPI_STAT_DESC(stat_name) \
  36        IONIC_STAT_DESC(struct ionic_napi_stats, stat_name)
  37
  38/* Interface structure for a particalar stats group */
  39struct ionic_stats_group_intf {
  40        void (*get_strings)(struct ionic_lif *lif, u8 **buf);
  41        void (*get_values)(struct ionic_lif *lif, u64 **buf);
  42        u64 (*get_count)(struct ionic_lif *lif);
  43};
  44
  45extern const struct ionic_stats_group_intf ionic_stats_groups[];
  46extern const int ionic_num_stats_grps;
  47
  48#define IONIC_READ_STAT64(base_ptr, desc_ptr) \
  49        (*((u64 *)(((u8 *)(base_ptr)) + (desc_ptr)->offset)))
  50
  51#define IONIC_READ_STAT_LE64(base_ptr, desc_ptr) \
  52        __le64_to_cpu(*((__le64 *)(((u8 *)(base_ptr)) + (desc_ptr)->offset)))
  53
  54struct ionic_stat_desc {
  55        char name[ETH_GSTRING_LEN];
  56        u64 offset;
  57};
  58
  59#endif /* _IONIC_STATS_H_ */
  60