summaryrefslogtreecommitdiff
path: root/drivers/net/mlx4/mlx4.c
diff options
context:
space:
mode:
authorOphir Munk <ophirmu@mellanox.com>2018-01-23 23:32:47 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2018-01-29 10:44:44 +0100
commita43fba2c1ea2e2f602c603f8338542f165b1c06b (patch)
tree2af8b9c4c5767654adad25523bc49b223fe85315 /drivers/net/mlx4/mlx4.c
parent709676bc9c60290ce2f22e2ddca0ac54b3015f1e (diff)
downloaddpdk-a43fba2c1ea2e2f602c603f8338542f165b1c06b.zip
dpdk-a43fba2c1ea2e2f602c603f8338542f165b1c06b.tar.gz
dpdk-a43fba2c1ea2e2f602c603f8338542f165b1c06b.tar.xz
net/mlx4: fix single port configuration
The number of mlx4 present ports is calculated as follows: conf.ports.present |= (UINT64_C(1) << device_attr.phys_port_cnt) - 1; That is - all ones sequence (due to -1 subtraction) When retrieving the number of ports, 1 must be added in order to obtain the correct number of ports to the power of 2, as follows: uint32_t ports = rte_log2_u32(conf->ports.present + 1); If 1 was not added, in the case of one port, the number of ports would be falsely calculated as 0. Fixes: 8264279967dc ("net/mlx4: check max number of ports dynamically") Cc: stable@dpdk.org Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Diffstat (limited to 'drivers/net/mlx4/mlx4.c')
-rw-r--r--drivers/net/mlx4/mlx4.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 2a721e7..952dae0 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -337,7 +337,7 @@ mlx4_arg_parse(const char *key, const char *val, struct mlx4_conf *conf)
return -rte_errno;
}
if (strcmp(MLX4_PMD_PORT_KVARG, key) == 0) {
- uint32_t ports = rte_log2_u32(conf->ports.present);
+ uint32_t ports = rte_log2_u32(conf->ports.present + 1);
if (tmp >= ports) {
ERROR("port index %lu outside range [0,%" PRIu32 ")",