Skip to content

Commit

Permalink
net/bonding: fix mbuf fast free usage
Browse files Browse the repository at this point in the history
[ upstream commit 18c4145 ]

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: 78aecef ("bond: move param parsing in configure step")

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
hushenggitcount authored and kevintraynor committed Jun 8, 2022
1 parent fa7ae86 commit 046b694
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/net/bonding/rte_eth_bond_pmd.c
Expand Up @@ -3582,6 +3582,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;
Expand Down Expand Up @@ -3642,6 +3643,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;

Expand Down

0 comments on commit 046b694

Please sign in to comment.