mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
net/mlx4: Use bitmap_weight_and()
Use bitmap_weight_and() instead of hand writing it. This saves a few LoC and is slightly faster, should it mater. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/r/a29c2348a062408bec45cee2601b2417310e5ea7.1684865809.git.christophe.jaillet@wanadoo.fr Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
e8f8b33230
commit
623a713853
1 changed files with 2 additions and 5 deletions
|
@ -1374,16 +1374,13 @@ static int mlx4_mf_bond(struct mlx4_dev *dev)
|
|||
int nvfs;
|
||||
struct mlx4_slaves_pport slaves_port1;
|
||||
struct mlx4_slaves_pport slaves_port2;
|
||||
DECLARE_BITMAP(slaves_port_1_2, MLX4_MFUNC_MAX);
|
||||
|
||||
slaves_port1 = mlx4_phys_to_slaves_pport(dev, 1);
|
||||
slaves_port2 = mlx4_phys_to_slaves_pport(dev, 2);
|
||||
bitmap_and(slaves_port_1_2,
|
||||
slaves_port1.slaves, slaves_port2.slaves,
|
||||
dev->persist->num_vfs + 1);
|
||||
|
||||
/* only single port vfs are allowed */
|
||||
if (bitmap_weight(slaves_port_1_2, dev->persist->num_vfs + 1) > 1) {
|
||||
if (bitmap_weight_and(slaves_port1.slaves, slaves_port2.slaves,
|
||||
dev->persist->num_vfs + 1) > 1) {
|
||||
mlx4_warn(dev, "HA mode unsupported for dual ported VFs\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue