Skip to contentSkip to conversation

net/bonding: fix mbuf fast free usage

PATCH Superseded Min Hu (Connor) 3 participants 5 messages May 21, 2022 – May 25, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/bonding: fix mbuf fast free usage

Usage of 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload has two
constraints: per-queue all mbufs comes from the same mempool and has refcnt = 1.

Bonding mode Broadcast, Tx mbuf has more than one refcnt. Bonding mode 8023AD, It contains two mempools separately for LACP packets and other packets. In Tx or Rx, Fast mbuf free will operate mbuf from different mempool.

This patch will prevent 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload when in bonding mode Broadcast and mode 8023AD.

Fixes 78aecefed955 ("bond: move param parsing in configure step")
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/bonding/rte_eth_bond_pmd.c +10 -0
index c929b55768..5ca90c7590 100644
@@ -3563,6 +3563,7 @@ 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;
 	uint8_t agg_mode;
@@ -3613,6 +3614,15 @@ 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;
+	}
+
 	/* set the max_rx_pktlen */
 	internals->max_rx_pktlen = internals->candidate_max_rx_pktlen;
 
Signature · 1 line
2.33.0
#1 lore raw
Quoted 6 lines · Min Hu (Connor)

[CAUTION: External Email]

Usage of 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload has two
constraints: per-queue all mbufs comes from the same mempool and has refcnt = 1.

Quoted 8 lines

Bonding mode Broadcast, Tx mbuf has more than one refcnt. Bonding mode 8023AD, It contains two mempools separately for LACP packets and other packets. In Tx or Rx, Fast mbuf free will operate mbuf from different mempool.

This patch will prevent 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload when in bonding mode Broadcast and mode 8023AD.

Hi Connor,

Please find a few syntax comment below, rest lgtm.

Quoted 21 lines
Fixes 78aecefed955 ("bond: move param parsing in configure step")
---
  drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/net/bonding/rte_eth_bond_pmd.c +1 -0
index c929b55768..5ca90c7590 100644
@@ -3563,6 +3563,7 @@ 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;
         uint8_t agg_mode;

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev *dev) · line 3620

Quoted 7 lines
drivers/net/bonding/rte_eth_bond_pmd.c +4 -0
@@ -3613,6 +3614,15 @@ 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)) {

Can you indent above two lines one more tab, to differentiate them from content of the if block.

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev *dev) · line 3621

Quoted 1 line
drivers/net/bonding/rte_eth_bond_pmd.c +1 -0
+               RTE_BOND_LOG(WARNING, "BOND MODE Broadcast & 8023AD don't support MBUF_FAST_FREE offload, force disable it.");

- Why "BOND MODE" is uppercase, if there is no special reason for it, I suggest using lower case.

- Can you break the message to next line, this enables shorter line without breaking the message:
RTE_BOND_LOG(WARNING,
"BOND MODE Broadcast & 8023AD don't support ....

Quoted 10 lines
drivers/net/bonding/rte_eth_bond_pmd.c +4 -1
+               offloads &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+               dev->data->dev_conf.txmode.offloads = offloads;
+       }
+
         /* set the max_rx_pktlen */
         internals->max_rx_pktlen = internals->candidate_max_rx_pktlen;
 
--

2.33.0

#2 lore raw

Thanks Ferruh,
v2 has been sent.

Quoted 74 lines · Ferruh Yigit
Quoted 6 lines · Min Hu (Connor)

[CAUTION: External Email]

Usage of 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload has two
constraints: per-queue all mbufs comes from the same mempool and has refcnt = 1.

Quoted 8 lines

Bonding mode Broadcast, Tx mbuf has more than one refcnt. Bonding mode 8023AD, It contains two mempools separately for LACP packets and other packets. In Tx or Rx, Fast mbuf free will operate mbuf from different mempool.

This patch will prevent 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload when in bonding mode Broadcast and mode 8023AD.

Hi Connor,

Please find a few syntax comment below, rest lgtm.

Quoted 21 lines
Fixes 78aecefed955 ("bond: move param parsing in configure step")

---
  drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++++++++++

  1 file changed, 10 insertions(+)
drivers/net/bonding/rte_eth_bond_pmd.c +1 -0
index c929b55768..5ca90c7590 100644
@@ -3563,6 +3563,7 @@ 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;
          uint8_t agg_mode;

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev *dev) · line 3620

Quoted 7 lines
drivers/net/bonding/rte_eth_bond_pmd.c +4 -0
@@ -3613,6 +3614,15 @@ 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)) {

Can you indent above two lines one more tab, to differentiate them from content of the if block.

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev *dev) · line 3622

Quoted 2 lines
drivers/net/bonding/rte_eth_bond_pmd.c +1 -0
+               RTE_BOND_LOG(WARNING, "BOND MODE Broadcast & 8023AD 
 don't support MBUF_FAST_FREE offload, force disable it.");

- Why "BOND MODE" is uppercase, if there is no special reason for it, I suggest using lower case.

- Can you break the message to next line, this enables shorter line without breaking the message:
RTE_BOND_LOG(WARNING,
    "BOND MODE Broadcast & 8023AD don't support ....

Quoted 10 lines
drivers/net/bonding/rte_eth_bond_pmd.c +4 -0
+               offloads &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+               dev->data->dev_conf.txmode.offloads = offloads;
+       }
+
          /* set the max_rx_pktlen */
          internals->max_rx_pktlen = internals->candidate_max_rx_pktlen;
Signature · 2 lines
-- 
2.33.0

.

#3 lore raw

PATCH v2 1/1 net/bonding: fix mbuf fast free usage

In reply to Min Hu (Connor)

Usage of 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload has two
constraints: per-queue all mbufs comes from the same mempool and has refcnt = 1.

Bonding mode Broadcast, Tx mbuf has more than one refcnt. Bonding mode 8023AD, It contains two mempools separately for LACP packets and other packets. In Tx or Rx, Fast mbuf free will operate mbuf from different mempool.

This patch will prevent 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload when in bonding mode Broadcast and mode 8023AD.

Fixes 78aecefed955 ("bond: move param parsing in configure step")

---
v2:
* fix syntax comment.

---
 drivers/net/bonding/rte_eth_bond_pmd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/bonding/rte_eth_bond_pmd.c +11 -0
index 734d1da540..7ce787d429 100644
@@ -3603,6 +3603,7 @@ 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;
 	uint8_t agg_mode;
@@ -3663,6 +3664,16 @@ 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;
+	}
+
 	/* set the max_rx_pktlen */
 	internals->max_rx_pktlen = internals->candidate_max_rx_pktlen;
 
Signature · 1 line
2.33.0
Applied
#4 lore raw
Quoted 10 lines · Min Hu (Connor)

Usage of 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload has two
constraints: per-queue all mbufs comes from the same mempool and has refcnt = 1.

Bonding mode Broadcast, Tx mbuf has more than one refcnt. Bonding mode 8023AD, It contains two mempools separately for LACP packets and other packets. In Tx or Rx, Fast mbuf free will operate mbuf from different mempool.

Quoted 7 lines

This patch will prevent 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload when in bonding mode Broadcast and mode 8023AD.

Fixes 78aecefed955 ("bond: move param parsing in configure step")

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