* [dpdk-stable] [PATCH v1] net/mlx4: fix single port configuration
@ 2018-01-23 23:32 Ophir Munk
2018-01-26 16:44 ` Adrien Mazarguil
0 siblings, 1 reply; 4+ messages in thread
From: Ophir Munk @ 2018-01-23 23:32 UTC (permalink / raw)
To: dev, Adrien Mazarguil; +Cc: Thomas Monjalon, Olga Shern, Ophir Munk, stable
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: 82642799 ("net/mlx4: check max number of ports dynamically")
Cc: stable@dpdk.org
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
drivers/net/mlx4/mlx4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 ")",
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [PATCH v1] net/mlx4: fix single port configuration
2018-01-23 23:32 [dpdk-stable] [PATCH v1] net/mlx4: fix single port configuration Ophir Munk
@ 2018-01-26 16:44 ` Adrien Mazarguil
2018-01-28 7:22 ` Shahaf Shuler
0 siblings, 1 reply; 4+ messages in thread
From: Adrien Mazarguil @ 2018-01-26 16:44 UTC (permalink / raw)
To: Ophir Munk; +Cc: dev, Thomas Monjalon, Olga Shern, stable
Hi Ophir,
On Tue, Jan 23, 2018 at 11:32:47PM +0000, Ophir Munk wrote:
> 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: 82642799 ("net/mlx4: check max number of ports dynamically")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
I was too busy to reply earlier, thanks for taking care of this issue.
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
--
Adrien Mazarguil
6WIND
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [PATCH v1] net/mlx4: fix single port configuration
2018-01-26 16:44 ` Adrien Mazarguil
@ 2018-01-28 7:22 ` Shahaf Shuler
0 siblings, 0 replies; 4+ messages in thread
From: Shahaf Shuler @ 2018-01-28 7:22 UTC (permalink / raw)
To: Adrien Mazarguil, Ophir Munk; +Cc: dev, Thomas Monjalon, Olga Shern, stable
Friday, January 26, 2018 6:44 PM, Adrien Mazarguil:
> Hi Ophir,
>
> On Tue, Jan 23, 2018 at 11:32:47PM +0000, Ophir Munk wrote:
> > 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: 82642799 ("net/mlx4: check max number of ports dynamically")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
>
> I was too busy to reply earlier, thanks for taking care of this issue.
>
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Applied to next-net-mlx, thanks.
>
> --
> Adrien Mazarguil
> 6WIND
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-stable] [PATCH v1] net/mlx4: fix single port configuration
@ 2018-01-23 23:29 Ophir Munk
0 siblings, 0 replies; 4+ messages in thread
From: Ophir Munk @ 2018-01-23 23:29 UTC (permalink / raw)
To: Ophir Munk; +Cc: stable
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: 82642799 ("net/mlx4: check max number of ports dynamically")
Cc: stable@dpdk.org
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
drivers/net/mlx4/mlx4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 ")",
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-28 7:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-23 23:32 [dpdk-stable] [PATCH v1] net/mlx4: fix single port configuration Ophir Munk
2018-01-26 16:44 ` Adrien Mazarguil
2018-01-28 7:22 ` Shahaf Shuler
-- strict thread matches above, loose matches on Subject: below --
2018-01-23 23:29 Ophir Munk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).