#include <linux/mlx5/driver.h>
#include <linux/mlx5/fs.h>
#include <linux/rbtree.h>
#include "mlx5_core.h"
#include "fs_core.h"
#include "fs_cmd.h"
#define MLX5_FC_STATS_PERIOD …
#define MLX5_FC_BULK_QUERY_ALLOC_PERIOD …
#define MLX5_SW_MAX_COUNTERS_BULK …
#define MLX5_INIT_COUNTERS_BULK …
#define MLX5_FC_POOL_MAX_THRESHOLD …
#define MLX5_FC_POOL_USED_BUFF_RATIO …
struct mlx5_fc_cache { … };
struct mlx5_fc { … };
static void mlx5_fc_pool_init(struct mlx5_fc_pool *fc_pool, struct mlx5_core_dev *dev);
static void mlx5_fc_pool_cleanup(struct mlx5_fc_pool *fc_pool);
static struct mlx5_fc *mlx5_fc_pool_acquire_counter(struct mlx5_fc_pool *fc_pool);
static void mlx5_fc_pool_release_counter(struct mlx5_fc_pool *fc_pool, struct mlx5_fc *fc);
static struct list_head *mlx5_fc_counters_lookup_next(struct mlx5_core_dev *dev,
u32 id)
{ … }
static void mlx5_fc_stats_insert(struct mlx5_core_dev *dev,
struct mlx5_fc *counter)
{ … }
static void mlx5_fc_stats_remove(struct mlx5_core_dev *dev,
struct mlx5_fc *counter)
{ … }
static int get_init_bulk_query_len(struct mlx5_core_dev *dev)
{ … }
static int get_max_bulk_query_len(struct mlx5_core_dev *dev)
{ … }
static void update_counter_cache(int index, u32 *bulk_raw_data,
struct mlx5_fc_cache *cache)
{ … }
static void mlx5_fc_stats_query_counter_range(struct mlx5_core_dev *dev,
struct mlx5_fc *first,
u32 last_id)
{ … }
static void mlx5_fc_free(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
{ … }
static void mlx5_fc_release(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
{ … }
static void mlx5_fc_stats_bulk_query_size_increase(struct mlx5_core_dev *dev)
{ … }
static void mlx5_fc_stats_work(struct work_struct *work)
{ … }
static struct mlx5_fc *mlx5_fc_single_alloc(struct mlx5_core_dev *dev)
{ … }
static struct mlx5_fc *mlx5_fc_acquire(struct mlx5_core_dev *dev, bool aging)
{ … }
struct mlx5_fc *mlx5_fc_create_ex(struct mlx5_core_dev *dev, bool aging)
{ … }
struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging)
{ … }
EXPORT_SYMBOL(…);
u32 mlx5_fc_id(struct mlx5_fc *counter)
{ … }
EXPORT_SYMBOL(…);
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
{ … }
EXPORT_SYMBOL(…);
int mlx5_init_fc_stats(struct mlx5_core_dev *dev)
{ … }
void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev)
{ … }
int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
u64 *packets, u64 *bytes)
{ … }
EXPORT_SYMBOL(…);
u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter)
{ … }
void mlx5_fc_query_cached(struct mlx5_fc *counter,
u64 *bytes, u64 *packets, u64 *lastuse)
{ … }
void mlx5_fc_query_cached_raw(struct mlx5_fc *counter,
u64 *bytes, u64 *packets, u64 *lastuse)
{ … }
void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev,
struct delayed_work *dwork,
unsigned long delay)
{ … }
void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev,
unsigned long interval)
{ … }
struct mlx5_fc_bulk { … };
static void mlx5_fc_init(struct mlx5_fc *counter, struct mlx5_fc_bulk *bulk,
u32 id)
{ … }
static int mlx5_fc_bulk_get_free_fcs_amount(struct mlx5_fc_bulk *bulk)
{ … }
static struct mlx5_fc_bulk *mlx5_fc_bulk_create(struct mlx5_core_dev *dev)
{ … }
static int
mlx5_fc_bulk_destroy(struct mlx5_core_dev *dev, struct mlx5_fc_bulk *bulk)
{ … }
static struct mlx5_fc *mlx5_fc_bulk_acquire_fc(struct mlx5_fc_bulk *bulk)
{ … }
static int mlx5_fc_bulk_release_fc(struct mlx5_fc_bulk *bulk, struct mlx5_fc *fc)
{ … }
static void mlx5_fc_pool_init(struct mlx5_fc_pool *fc_pool, struct mlx5_core_dev *dev)
{ … }
static void mlx5_fc_pool_cleanup(struct mlx5_fc_pool *fc_pool)
{ … }
static void mlx5_fc_pool_update_threshold(struct mlx5_fc_pool *fc_pool)
{ … }
static struct mlx5_fc_bulk *
mlx5_fc_pool_alloc_new_bulk(struct mlx5_fc_pool *fc_pool)
{ … }
static void
mlx5_fc_pool_free_bulk(struct mlx5_fc_pool *fc_pool, struct mlx5_fc_bulk *bulk)
{ … }
static struct mlx5_fc *
mlx5_fc_pool_acquire_from_list(struct list_head *src_list,
struct list_head *next_list,
bool move_non_full_bulk)
{ … }
static struct mlx5_fc *
mlx5_fc_pool_acquire_counter(struct mlx5_fc_pool *fc_pool)
{ … }
static void
mlx5_fc_pool_release_counter(struct mlx5_fc_pool *fc_pool, struct mlx5_fc *fc)
{ … }