patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/octeontx2: fix multi seg mode for jumbo packets
@ 2020-08-10 10:55 Harman Kalra
  2020-09-28  5:21 ` [dpdk-stable] [dpdk-dev] " Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Harman Kalra @ 2020-08-10 10:55 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K; +Cc: dev, Harman Kalra, stable

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: stable@dpdk.org

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/octeontx2: fix multi seg mode for jumbo packets
  2020-08-10 10:55 [dpdk-stable] [PATCH] net/octeontx2: fix multi seg mode for jumbo packets Harman Kalra
@ 2020-09-28  5:21 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2020-09-28  5:21 UTC (permalink / raw)
  To: Harman Kalra, Ferruh Yigit
  Cc: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, dpdk-dev, dpdk stable

On Mon, Aug 10, 2020 at 4:26 PM Harman Kalra <hkalra@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: stable@dpdk.org
>
> Signed-off-by: Harman Kalra <hkalra@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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-28  5:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 10:55 [dpdk-stable] [PATCH] net/octeontx2: fix multi seg mode for jumbo packets Harman Kalra
2020-09-28  5:21 ` [dpdk-stable] [dpdk-dev] " Jerin Jacob

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git