On Mon, Aug 10, 2020 at 4:26 PM Harman Kalra <hka...@marvell.com> wrote: > > Scatter gather mode should get enabled: > - If mbuf size is less than max received packet length. > - MTU is reconfigured greater than mbuf size. > > Fixes: 0e2efd02db58 ("net/octeontx2: add MTU set operation") > Cc: sta...@dpdk.org > > Signed-off-by: Harman Kalra <hka...@marvell.com>
Applied to dpdk-next-net-mrvl/master. Thanks > --- > drivers/net/octeontx2/otx2_ethdev.c | 30 +++++++++++++++++++++++++ > drivers/net/octeontx2/otx2_ethdev.h | 2 ++ > drivers/net/octeontx2/otx2_ethdev_ops.c | 9 +------- > 3 files changed, 33 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/octeontx2/otx2_ethdev.c > b/drivers/net/octeontx2/otx2_ethdev.c > index 33b72bd4d..bee1e2a76 100644 > --- a/drivers/net/octeontx2/otx2_ethdev.c > +++ b/drivers/net/octeontx2/otx2_ethdev.c > @@ -657,6 +657,9 @@ otx2_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, > uint16_t rq, > } > } > > + /* Setup scatter mode if needed by jumbo */ > + otx2_nix_enable_mseg_on_jumbo(rxq); > + > return 0; > > free_rxq: > @@ -878,6 +881,33 @@ nix_sqb_unlock(struct rte_mempool *mp) > return 0; > } > > +void > +otx2_nix_enable_mseg_on_jumbo(struct otx2_eth_rxq *rxq) > +{ > + struct rte_pktmbuf_pool_private *mbp_priv; > + struct rte_eth_dev *eth_dev; > + struct otx2_eth_dev *dev; > + uint32_t buffsz; > + > + eth_dev = rxq->eth_dev; > + dev = otx2_eth_pmd_priv(eth_dev); > + > + /* Get rx buffer size */ > + mbp_priv = rte_mempool_get_priv(rxq->pool); > + buffsz = mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM; > + > + if (eth_dev->data->dev_conf.rxmode.max_rx_pkt_len > buffsz) { > + dev->rx_offloads |= DEV_RX_OFFLOAD_SCATTER; > + dev->tx_offloads |= DEV_TX_OFFLOAD_MULTI_SEGS; > + > + /* Setting up the rx[tx]_offload_flags due to change > + * in rx[tx]_offloads. > + */ > + dev->rx_offload_flags |= nix_rx_offload_flags(eth_dev); > + dev->tx_offload_flags |= nix_tx_offload_flags(eth_dev); > + } > +} > + > static int > nix_sq_init(struct otx2_eth_txq *txq) > { > diff --git a/drivers/net/octeontx2/otx2_ethdev.h > b/drivers/net/octeontx2/otx2_ethdev.h > index e9efe52bb..11cdd8afd 100644 > --- a/drivers/net/octeontx2/otx2_ethdev.h > +++ b/drivers/net/octeontx2/otx2_ethdev.h > @@ -437,6 +437,8 @@ int otx2_nix_set_mc_addr_list(struct rte_eth_dev *eth_dev, > /* MTU */ > int otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu); > int otx2_nix_recalc_mtu(struct rte_eth_dev *eth_dev); > +void otx2_nix_enable_mseg_on_jumbo(struct otx2_eth_rxq *rxq); > + > > /* Link */ > void otx2_nix_toggle_flag_link_cfg(struct otx2_eth_dev *dev, bool set); > diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c > b/drivers/net/octeontx2/otx2_ethdev_ops.c > index faecf216c..b36d37b9f 100644 > --- a/drivers/net/octeontx2/otx2_ethdev_ops.c > +++ b/drivers/net/octeontx2/otx2_ethdev_ops.c > @@ -72,22 +72,15 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t > mtu) > int > otx2_nix_recalc_mtu(struct rte_eth_dev *eth_dev) > { > - struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); > struct rte_eth_dev_data *data = eth_dev->data; > - struct rte_pktmbuf_pool_private *mbp_priv; > struct otx2_eth_rxq *rxq; > - uint32_t buffsz; > uint16_t mtu; > int rc; > > - /* Get rx buffer size */ > rxq = data->rx_queues[0]; > - mbp_priv = rte_mempool_get_priv(rxq->pool); > - buffsz = mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM; > > /* Setup scatter mode if needed by jumbo */ > - if (data->dev_conf.rxmode.max_rx_pkt_len > buffsz) > - dev->rx_offloads |= DEV_RX_OFFLOAD_SCATTER; > + otx2_nix_enable_mseg_on_jumbo(rxq); > > /* Setup MTU based on max_rx_pkt_len */ > mtu = data->dev_conf.rxmode.max_rx_pkt_len - NIX_L2_OVERHEAD; > -- > 2.18.0 >