Lines Matching refs:tun_entropy
71 void mlx5_init_port_tun_entropy(struct mlx5_tun_entropy *tun_entropy,
76 tun_entropy->mdev = mdev;
77 mutex_init(&tun_entropy->lock);
79 tun_entropy->num_enabling_entries = 0;
80 tun_entropy->num_disabling_entries = 0;
81 tun_entropy->enabled = entropy_flags.calc_supported ?
85 static int mlx5_set_entropy(struct mlx5_tun_entropy *tun_entropy,
91 mlx5_query_port_tun_entropy(tun_entropy->mdev, &entropy_flags);
101 err = mlx5_set_port_gre_tun_entropy_calc(tun_entropy->mdev,
112 mlx5_core_warn(tun_entropy->mdev,
121 if (tun_entropy->num_enabling_entries)
123 err = mlx5_set_port_tun_entropy_calc(tun_entropy->mdev, enable,
127 tun_entropy->enabled = enable;
130 err = mlx5_set_port_tun_entropy_calc(tun_entropy->mdev, 1, 0);
143 int mlx5_tun_entropy_refcount_inc(struct mlx5_tun_entropy *tun_entropy,
148 mutex_lock(&tun_entropy->lock);
151 tun_entropy->enabled) {
156 tun_entropy->num_enabling_entries++;
163 if (tun_entropy->num_disabling_entries == 0)
164 err = mlx5_set_entropy(tun_entropy, reformat_type, 0);
168 tun_entropy->num_disabling_entries++;
170 mutex_unlock(&tun_entropy->lock);
175 void mlx5_tun_entropy_refcount_dec(struct mlx5_tun_entropy *tun_entropy,
178 mutex_lock(&tun_entropy->lock);
180 tun_entropy->num_enabling_entries--;
182 --tun_entropy->num_disabling_entries == 0)
183 mlx5_set_entropy(tun_entropy, reformat_type, 1);
184 mutex_unlock(&tun_entropy->lock);