struct mlx4_en_priv *priv = netdev_priv(dev);
struct bitmap_iterator it;
- bitmap_iterator_init(&it, priv->stats_bitmap, NUM_ALL_STATS);
+ bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS);
switch (sset) {
case ETH_SS_STATS:
int i;
struct bitmap_iterator it;
- bitmap_iterator_init(&it, priv->stats_bitmap, NUM_ALL_STATS);
+ bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS);
spin_lock_bh(&priv->stats_lock);
int i, strings = 0;
struct bitmap_iterator it;
- bitmap_iterator_init(&it, priv->stats_bitmap, NUM_ALL_STATS);
+ bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS);
switch (stringset) {
case ETH_SS_TEST:
}
void mlx4_en_set_stats_bitmap(struct mlx4_dev *dev,
- unsigned long *stats_bitmap)
+ struct mlx4_en_stats_bitmap *stats_bitmap)
{
int last_i = 0;
- bitmap_zero(stats_bitmap, NUM_ALL_STATS);
+ mutex_init(&stats_bitmap->mutex);
+ bitmap_zero(stats_bitmap->bitmap, NUM_ALL_STATS);
if (mlx4_is_slave(dev)) {
- bitmap_set(stats_bitmap, last_i +
+ bitmap_set(stats_bitmap->bitmap, last_i +
MLX4_FIND_NETDEV_STAT(rx_packets), 1);
- bitmap_set(stats_bitmap, last_i +
+ bitmap_set(stats_bitmap->bitmap, last_i +
MLX4_FIND_NETDEV_STAT(tx_packets), 1);
- bitmap_set(stats_bitmap, last_i +
+ bitmap_set(stats_bitmap->bitmap, last_i +
MLX4_FIND_NETDEV_STAT(rx_bytes), 1);
- bitmap_set(stats_bitmap, last_i +
+ bitmap_set(stats_bitmap->bitmap, last_i +
MLX4_FIND_NETDEV_STAT(tx_bytes), 1);
- bitmap_set(stats_bitmap, last_i +
+ bitmap_set(stats_bitmap->bitmap, last_i +
MLX4_FIND_NETDEV_STAT(rx_dropped), 1);
- bitmap_set(stats_bitmap, last_i +
+ bitmap_set(stats_bitmap->bitmap, last_i +
MLX4_FIND_NETDEV_STAT(tx_dropped), 1);
} else {
- bitmap_set(stats_bitmap, last_i, NUM_MAIN_STATS);
+ bitmap_set(stats_bitmap->bitmap, last_i, NUM_MAIN_STATS);
}
last_i += NUM_MAIN_STATS;
- bitmap_set(stats_bitmap, last_i, NUM_PORT_STATS);
+ bitmap_set(stats_bitmap->bitmap, last_i, NUM_PORT_STATS);
last_i += NUM_PORT_STATS;
if (!mlx4_is_slave(dev))
- bitmap_set(stats_bitmap, last_i, NUM_PKT_STATS);
+ bitmap_set(stats_bitmap->bitmap, last_i, NUM_PKT_STATS);
}
int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
queue_delayed_work(mdev->workqueue, &priv->service_task,
SERVICE_TASK_DELAY);
- mlx4_en_set_stats_bitmap(mdev->dev, priv->stats_bitmap);
+ mlx4_en_set_stats_bitmap(mdev->dev, &priv->stats_bitmap);
return 0;
#define MLX4_EN_MAC_HASH_SIZE (1 << BITS_PER_BYTE)
#define MLX4_EN_MAC_HASH_IDX 5
+struct mlx4_en_stats_bitmap {
+ DECLARE_BITMAP(bitmap, NUM_ALL_STATS);
+ struct mutex mutex; /* for mutual access to stats bitmap */
+};
+
struct mlx4_en_priv {
struct mlx4_en_dev *mdev;
struct mlx4_en_port_profile *prof;
struct mlx4_en_perf_stats pstats;
struct mlx4_en_pkt_stats pkstats;
struct mlx4_en_port_stats port_stats;
- DECLARE_BITMAP(stats_bitmap, NUM_ALL_STATS);
+ struct mlx4_en_stats_bitmap stats_bitmap;
struct list_head mc_list;
struct list_head curr_list;
u64 broadcast_id;
void mlx4_en_stop_port(struct net_device *dev, int detach);
void mlx4_en_set_stats_bitmap(struct mlx4_dev *dev,
- unsigned long *stats_bitmap);
+ struct mlx4_en_stats_bitmap *stats_bitmap);
void mlx4_en_free_resources(struct mlx4_en_priv *priv);
int mlx4_en_alloc_resources(struct mlx4_en_priv *priv);