[2/2] app/testpmd: remove fast free offload for bond3 and bond4

Message ID 20221108084038.25136-3-lihuisong@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers
Series net/bonding: fix mbuf fast free for bond3 and bond4 |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

lihuisong (C) Nov. 8, 2022, 8:40 a.m. UTC
  The port configurations of bonding device need to be updated when add a
slave device. But mbuf fast free offload can't be used in bonding mode
Broadcast and mode 8023AD. So remove this offload for both mode in case
of failing to initialize bonding device.

Fixes: 76376bd9cd49 ("app/testpmd: update bond port configurations when add slave")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 app/test-pmd/testpmd.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Stephen Hemminger Nov. 8, 2022, 6:01 p.m. UTC | #1
On Tue, 8 Nov 2022 16:40:38 +0800
Huisong Li <lihuisong@huawei.com> wrote:

> The port configurations of bonding device need to be updated when add a
> slave device. But mbuf fast free offload can't be used in bonding mode
> Broadcast and mode 8023AD. So remove this offload for both mode in case
> of failing to initialize bonding device.
> 
> Fixes: 76376bd9cd49 ("app/testpmd: update bond port configurations when add slave")
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
	int ret;
>  
> @@ -2825,6 +2826,13 @@ update_bonding_port_dev_conf(portid_t bond_pid)
>  	if (port->dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
>  		port->dev_conf.txmode.offloads |=
>  				RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
> +	/* Bond mode broadcast & 8023AD don't support MBUF_FAST_FREE offload */
> +	bonding_mode = rte_eth_bond_mode_get(bond_pid);
> +	if (bonding_mode == BONDING_MODE_8023AD ||
> +	    bonding_mode == BONDING_MODE_BROADCAST)
> +		port->dev_conf.txmode.offloads &=
> +				~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
> +

This would be better handled in the bonding driver.
It should return the correct txmode offloads based on bonding mode.
That way it would work for any application not just testpmd.
  
lihuisong (C) Nov. 9, 2022, 1:11 a.m. UTC | #2
在 2022/11/9 2:01, Stephen Hemminger 写道:
> On Tue, 8 Nov 2022 16:40:38 +0800
> Huisong Li <lihuisong@huawei.com> wrote:
>
>> The port configurations of bonding device need to be updated when add a
>> slave device. But mbuf fast free offload can't be used in bonding mode
>> Broadcast and mode 8023AD. So remove this offload for both mode in case
>> of failing to initialize bonding device.
>>
>> Fixes: 76376bd9cd49 ("app/testpmd: update bond port configurations when add slave")
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> 	int ret;
>>   
>> @@ -2825,6 +2826,13 @@ update_bonding_port_dev_conf(portid_t bond_pid)
>>   	if (port->dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
>>   		port->dev_conf.txmode.offloads |=
>>   				RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
>> +	/* Bond mode broadcast & 8023AD don't support MBUF_FAST_FREE offload */
>> +	bonding_mode = rte_eth_bond_mode_get(bond_pid);
>> +	if (bonding_mode == BONDING_MODE_8023AD ||
>> +	    bonding_mode == BONDING_MODE_BROADCAST)
>> +		port->dev_conf.txmode.offloads &=
>> +				~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
>> +
> This would be better handled in the bonding driver.
> It should return the correct txmode offloads based on bonding mode.
> That way it would work for any application not just testpmd.
Good idea. I will fix it in v2.
> .
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7381dfd9e5..4063ffe0f2 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2812,6 +2812,7 @@  update_bonding_port_dev_conf(portid_t bond_pid)
 {
 #ifdef RTE_NET_BOND
 	struct rte_port *port = &ports[bond_pid];
+	uint8_t bonding_mode;
 	uint16_t i;
 	int ret;
 
@@ -2825,6 +2826,13 @@  update_bonding_port_dev_conf(portid_t bond_pid)
 	if (port->dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
 		port->dev_conf.txmode.offloads |=
 				RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+	/* Bond mode broadcast & 8023AD don't support MBUF_FAST_FREE offload */
+	bonding_mode = rte_eth_bond_mode_get(bond_pid);
+	if (bonding_mode == BONDING_MODE_8023AD ||
+	    bonding_mode == BONDING_MODE_BROADCAST)
+		port->dev_conf.txmode.offloads &=
+				~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+
 	/* Apply Tx offloads configuration */
 	for (i = 0; i < port->dev_info.max_tx_queues; i++)
 		port->txq[i].conf.offloads = port->dev_conf.txmode.offloads;