[PATCH 3/7] net/bonding: change mbuf pool and ring allocation

Min Hu (Connor) humin29 at huawei.com
Thu Dec 16 09:59:55 CET 2021


Hi, Robert,

在 2021/12/16 2:19, Robert Sanford 写道:
> - Turn off mbuf pool caching to avoid mbufs lingering in pool caches.
>    At most, we transmit one LACPDU per second, per port.
Could you be more detailed, why does mbuf pool caching is not needed?

> - Fix calculation of ring sizes, taking into account that a ring of
>    size N holds up to N-1 items.
Same to that, why should resvere another items ?
> 
By the way, I found the comment for BOND_MODE_8023AX_SLAVE_RX_PKTS is
is wrong, could you fix it in this patch?
> Signed-off-by: Robert Sanford <rsanford at akamai.com>
> ---
>   drivers/net/bonding/rte_eth_bond_8023ad.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
> index 43231bc..83d3938 100644
> --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
> @@ -1101,9 +1101,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev,
>   	}
>   
>   	snprintf(mem_name, RTE_DIM(mem_name), "slave_port%u_pool", slave_id);
> -	port->mbuf_pool = rte_pktmbuf_pool_create(mem_name, total_tx_desc,
> -		RTE_MEMPOOL_CACHE_MAX_SIZE >= 32 ?
> -			32 : RTE_MEMPOOL_CACHE_MAX_SIZE,
> +	port->mbuf_pool = rte_pktmbuf_pool_create(mem_name, total_tx_desc, 0,
>   		0, element_size, socket_id);
>   
>   	/* Any memory allocation failure in initialization is critical because
> @@ -1113,19 +1111,23 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev,
>   			slave_id, mem_name, rte_strerror(rte_errno));
>   	}
>   
> +	/* Add one extra because ring reserves one. */
>   	snprintf(mem_name, RTE_DIM(mem_name), "slave_%u_rx", slave_id);
>   	port->rx_ring = rte_ring_create(mem_name,
> -			rte_align32pow2(BOND_MODE_8023AX_SLAVE_RX_PKTS), socket_id, 0);
> +			rte_align32pow2(BOND_MODE_8023AX_SLAVE_RX_PKTS + 1),
> +			socket_id, 0);
>   
>   	if (port->rx_ring == NULL) {
>   		rte_panic("Slave %u: Failed to create rx ring '%s': %s\n", slave_id,
>   			mem_name, rte_strerror(rte_errno));
>   	}
>   
> -	/* TX ring is at least one pkt longer to make room for marker packet. */
> +	/* TX ring is at least one pkt longer to make room for marker packet.
> +	 * Add one extra because ring reserves one. */
>   	snprintf(mem_name, RTE_DIM(mem_name), "slave_%u_tx", slave_id);
>   	port->tx_ring = rte_ring_create(mem_name,
> -			rte_align32pow2(BOND_MODE_8023AX_SLAVE_TX_PKTS + 1), socket_id, 0);
> +			rte_align32pow2(BOND_MODE_8023AX_SLAVE_TX_PKTS + 2),
> +			socket_id, 0);
>   
>   	if (port->tx_ring == NULL) {
>   		rte_panic("Slave %u: Failed to create tx ring '%s': %s\n", slave_id,
> 


More information about the dev mailing list