[dpdk-dev] net/mlx4: fix targetless internal rule creation

Message ID 1508834730-30271-1-git-send-email-matan@mellanox.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Matan Azrad Oct. 24, 2017, 8:45 a.m. UTC
  The corrupted code allowed to create internal rule with no any target queue
in case the rule creation ocured before queues creation.

For example, when user calls rte_eth_dev_default_mac_addr_set after probe
and before dev_configure, mlx4 failis because the RSS queue number was 0.

The fix prevents internal rules creation before queues creation based on
future creation before traffic start.

Fixes: 7d8675956f57 ("net/mlx4: add RSS support outside flow API")

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx4/mlx4_flow.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Adrien Mazarguil Oct. 24, 2017, 9:21 a.m. UTC | #1
On Tue, Oct 24, 2017 at 08:45:30AM +0000, Matan Azrad wrote:
> The corrupted code allowed to create internal rule with no any target queue
> in case the rule creation ocured before queues creation.

ocured => occurred

> 
> For example, when user calls rte_eth_dev_default_mac_addr_set after probe
> and before dev_configure, mlx4 failis because the RSS queue number was 0.

failis => fails

> 
> The fix prevents internal rules creation before queues creation based on
> future creation before traffic start.
> 
> Fixes: 7d8675956f57 ("net/mlx4: add RSS support outside flow API")

Since adding MAC addresses before dev_configure() was not taken into account
in the design of the affected function, I suggest appending:

Fixes: bdcad2f4843a ("net/mlx4: refactor internal flow rules")

> Signed-off-by: Matan Azrad <matan@mellanox.com>

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Thanks.
  

Patch

diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c
index a0f431b..7a6097f 100644
--- a/drivers/net/mlx4/mlx4_flow.c
+++ b/drivers/net/mlx4/mlx4_flow.c
@@ -1290,6 +1290,9 @@  struct mlx4_drop {
 	unsigned int i;
 	int err = 0;
 
+	/* Nothing to be done if there are no Rx queues. */
+	if (!queues)
+		goto error;
 	/* Prepare default RSS configuration. */
 	*rss_conf = (struct rte_flow_action_rss){
 		.rss_conf = NULL, /* Rely on default fallback settings. */