Skip to content

Commit

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

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: 18c4145 ("net/bonding: fix mbuf fast free usage")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  • Loading branch information
LiHuiSong1 authored and kevintraynor committed Nov 23, 2022
1 parent a0521c1 commit 89f4c06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
5 changes: 5 additions & 0 deletions drivers/net/bonding/rte_eth_bond_api.c
Expand Up @@ -541,6 +541,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;

Expand Down
11 changes: 0 additions & 11 deletions drivers/net/bonding/rte_eth_bond_pmd.c
Expand Up @@ -3599,7 +3599,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;
uint8_t agg_mode;
Expand Down Expand Up @@ -3660,16 +3659,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;
}

/* set the max_rx_pktlen */
internals->max_rx_pktlen = internals->candidate_max_rx_pktlen;

Expand Down

0 comments on commit 89f4c06

Please sign in to comment.