[V2] net/bonding: fix bond3 and bond4 process mbuf fast free

Message ID 20221109022237.49757-1-lihuisong@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Andrew Rybchenko
Headers
Series [V2] net/bonding: fix bond3 and bond4 process mbuf fast free |

Checks

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

Commit Message

lihuisong (C) Nov. 9, 2022, 2:22 a.m. UTC
  The RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload can't be used in bonding
mode Broadcast and mode 8023AD. Currently, bonding driver forcibly removes
from the dev->data->dev_conf.txmode.offloads and processes as success in
bond_ethdev_configure(). But this still cause that rte_eth_dev_configure()
fails to execute because of the failure of validating Tx offload in the
eth_dev_validate_offloads(). So this patch moves the modification of txmode
offlaods to the stage of adding slave device to report the correct txmode
offloads.

Fixes: 18c41457cbae ("net/bonding: fix mbuf fast free usage")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 -v2: report the correct txmode offloads based on bonding mode in the
      bonding driver, and not in testpmd.
---
 drivers/net/bonding/rte_eth_bond_api.c |  5 +++++
 drivers/net/bonding/rte_eth_bond_pmd.c | 11 -----------
 2 files changed, 5 insertions(+), 11 deletions(-)
  

Comments

Stephen Hemminger Nov. 9, 2022, 3:24 a.m. UTC | #1
On Wed, 9 Nov 2022 10:22:37 +0800
Huisong Li <lihuisong@huawei.com> wrote:

> The RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload can't be used in bonding
> mode Broadcast and mode 8023AD. Currently, bonding driver forcibly removes
> from the dev->data->dev_conf.txmode.offloads and processes as success in
> bond_ethdev_configure(). But this still cause that rte_eth_dev_configure()
> fails to execute because of the failure of validating Tx offload in the
> eth_dev_validate_offloads(). So this patch moves the modification of txmode
> offlaods to the stage of adding slave device to report the correct txmode
> offloads.
> 
> Fixes: 18c41457cbae ("net/bonding: fix mbuf fast free usage")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>

Looks good thanks.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
Andrew Rybchenko Nov. 9, 2022, 10:37 a.m. UTC | #2
On 11/9/22 06:24, Stephen Hemminger wrote:
> On Wed, 9 Nov 2022 10:22:37 +0800
> Huisong Li <lihuisong@huawei.com> wrote:
> 
>> The RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload can't be used in bonding
>> mode Broadcast and mode 8023AD. Currently, bonding driver forcibly removes
>> from the dev->data->dev_conf.txmode.offloads and processes as success in
>> bond_ethdev_configure(). But this still cause that rte_eth_dev_configure()
>> fails to execute because of the failure of validating Tx offload in the
>> eth_dev_validate_offloads(). So this patch moves the modification of txmode
>> offlaods to the stage of adding slave device to report the correct txmode
>> offloads.
>>
>> Fixes: 18c41457cbae ("net/bonding: fix mbuf fast free usage")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> 
> Looks good thanks.
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 694fe86115..c0178369b4 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -544,6 +544,11 @@  __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
 			return ret;
 	}
 
+	/* Bond mode Broadcast & 8023AD don't support MBUF_FAST_FREE offload. */
+	if (internals->mode == BONDING_MODE_8023AD ||
+	    internals->mode == BONDING_MODE_BROADCAST)
+		internals->tx_offload_capa &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+
 	bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &=
 			internals->flow_type_rss_offloads;
 
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 864e073db8..2efaad1e8e 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3643,7 +3643,6 @@  bond_ethdev_configure(struct rte_eth_dev *dev)
 	const char *name = dev->device->name;
 	struct bond_dev_private *internals = dev->data->dev_private;
 	struct rte_kvargs *kvlist = internals->kvlist;
-	uint64_t offloads;
 	int arg_count;
 	uint16_t port_id = dev - rte_eth_devices;
 	uint32_t link_speeds;
@@ -3708,16 +3707,6 @@  bond_ethdev_configure(struct rte_eth_dev *dev)
 		}
 	}
 
-	offloads = dev->data->dev_conf.txmode.offloads;
-	if ((offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) &&
-			(internals->mode == BONDING_MODE_8023AD ||
-			internals->mode == BONDING_MODE_BROADCAST)) {
-		RTE_BOND_LOG(WARNING,
-			"bond mode broadcast & 8023AD don't support MBUF_FAST_FREE offload, force disable it.");
-		offloads &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
-		dev->data->dev_conf.txmode.offloads = offloads;
-	}
-
 	link_speeds = dev->data->dev_conf.link_speeds;
 	/*
 	 * The default value of 'link_speeds' is zero. From its definition,