net/bonding: fix error in bonding mode 4 with dedicated queues enabled

Message ID 20220924141953.273290-1-usman.tanveer@emumba.com (mailing list archive)
State Changes Requested, archived
Delegated to: Andrew Rybchenko
Headers
Series net/bonding: fix error in bonding mode 4 with dedicated queues enabled |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS

Commit Message

Usman Tanveer Sept. 24, 2022, 2:19 p.m. UTC
  when dedicated queues are enable with bonding mode 4 (mlx5), the
application sets the flow, which cannot be set if the device is not
started. This fixed the issue by starting the device just before
setting the flow. Because device should be started to set the flow.
Also it does not effect other driver codes (I have tried on ixgbe).

Bugzilla ID: 759

Signed-off-by: Usman Tanveer <usman.tanveer@emumba.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
  

Comments

Chas Williams Sept. 25, 2022, 10:42 a.m. UTC | #1
It's probably cleaner to just move the bond_ethdev_8023ad_flow_set
until after the device start. For the reader, they don't need to
understand why you might not have started the device earlier.

On 9/24/22 10:19, Usman Tanveer wrote:
> when dedicated queues are enable with bonding mode 4 (mlx5), the
> application sets the flow, which cannot be set if the device is not
> started. This fixed the issue by starting the device just before
> setting the flow. Because device should be started to set the flow.
> Also it does not effect other driver codes (I have tried on ixgbe).
> 
> Bugzilla ID: 759
> 
> Signed-off-by: Usman Tanveer <usman.tanveer@emumba.com>
> ---
>   drivers/net/bonding/rte_eth_bond_pmd.c | 19 ++++++++++++++-----
>   1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 73e6972035..2dfb613ea6 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1829,6 +1829,13 @@ slave_start(struct rte_eth_dev *bonded_eth_dev,
>   				slave_eth_dev->data->port_id, errval);
>   		}
>   
> +		errval = rte_eth_dev_start(slave_eth_dev->data->port_id);
> +		if (errval != 0) {
> +			RTE_BOND_LOG(ERR, "rte_eth_dev_start: port=%u, err (%d)",
> +					slave_eth_dev->data->port_id, errval);
> +			return -1;
> +		}
> +
>   		errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev,
>   				slave_eth_dev->data->port_id);
>   		if (errval != 0) {
> @@ -1840,11 +1847,13 @@ slave_start(struct rte_eth_dev *bonded_eth_dev,
>   	}
>   
>   	/* Start device */
> -	errval = rte_eth_dev_start(slave_eth_dev->data->port_id);
> -	if (errval != 0) {
> -		RTE_BOND_LOG(ERR, "rte_eth_dev_start: port=%u, err (%d)",
> -				slave_eth_dev->data->port_id, errval);
> -		return -1;
> +	if (!slave_eth_dev->data->dev_started) {
> +		errval = rte_eth_dev_start(slave_eth_dev->data->port_id);
> +		if (errval != 0) {
> +			RTE_BOND_LOG(ERR, "rte_eth_dev_start: port=%u, err (%d)",
> +					slave_eth_dev->data->port_id, errval);
> +			return -1;
> +		}
>   	}
>   
>   	/* If RSS is enabled for bonding, synchronize RETA */
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 73e6972035..2dfb613ea6 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1829,6 +1829,13 @@  slave_start(struct rte_eth_dev *bonded_eth_dev,
 				slave_eth_dev->data->port_id, errval);
 		}
 
+		errval = rte_eth_dev_start(slave_eth_dev->data->port_id);
+		if (errval != 0) {
+			RTE_BOND_LOG(ERR, "rte_eth_dev_start: port=%u, err (%d)",
+					slave_eth_dev->data->port_id, errval);
+			return -1;
+		}
+
 		errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev,
 				slave_eth_dev->data->port_id);
 		if (errval != 0) {
@@ -1840,11 +1847,13 @@  slave_start(struct rte_eth_dev *bonded_eth_dev,
 	}
 
 	/* Start device */
-	errval = rte_eth_dev_start(slave_eth_dev->data->port_id);
-	if (errval != 0) {
-		RTE_BOND_LOG(ERR, "rte_eth_dev_start: port=%u, err (%d)",
-				slave_eth_dev->data->port_id, errval);
-		return -1;
+	if (!slave_eth_dev->data->dev_started) {
+		errval = rte_eth_dev_start(slave_eth_dev->data->port_id);
+		if (errval != 0) {
+			RTE_BOND_LOG(ERR, "rte_eth_dev_start: port=%u, err (%d)",
+					slave_eth_dev->data->port_id, errval);
+			return -1;
+		}
 	}
 
 	/* If RSS is enabled for bonding, synchronize RETA */