[dpdk-dev] net/mlx5: fix handling of small mbuf sizes

Message ID 937aac679e571c4fff8ab720f4dd910fe10a283e.1477296585.git.rasland@mellanox.com
State Accepted, archived
Delegated to: Bruce Richardson
Headers show

Commit Message

Raslan Darawsheh Oct. 24, 2016, 8:10 a.m.
When mbufs are smaller than MRU, multi-segment support must be enabled to
default set when not in promiscuous or allmulticast modes.

Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Adrien Mazarguil Oct. 28, 2016, 12:19 p.m. | #1
On Mon, Oct 24, 2016 at 11:10:59AM +0300, Raslan Darawsheh wrote:
> When mbufs are smaller than MRU, multi-segment support must be enabled to
> default set when not in promiscuous or allmulticast modes.
> 
> Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_rxq.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
> index 4dc5cc3..62253ed 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -946,6 +946,12 @@ rxq_ctrl_setup(struct rte_eth_dev *dev, struct rxq_ctrl *rxq_ctrl,
>  	(void)conf; /* Thresholds configuration (ignored). */
>  	/* Enable scattered packets support for this queue if necessary. */
>  	assert(mb_len >= RTE_PKTMBUF_HEADROOM);
> +	/* If smaller than MRU, multi-segment support must be enabled. */
> +	if (mb_len < (priv->mtu > dev->data->dev_conf.rxmode.max_rx_pkt_len ?
> +		     dev->data->dev_conf.rxmode.max_rx_pkt_len :
> +		     priv->mtu
> +		     ))

Let's move poor "))" to the end of the previous line.

> +		dev->data->dev_conf.rxmode.jumbo_frame = 1;
>  	if ((dev->data->dev_conf.rxmode.jumbo_frame) &&
>  	    (dev->data->dev_conf.rxmode.max_rx_pkt_len >
>  	     (mb_len - RTE_PKTMBUF_HEADROOM))) {
> -- 
> 1.9.1

Besides the above comment:

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Thomas Monjalon Nov. 7, 2016, 5:22 p.m. | #2
2016-10-28 14:19, Adrien Mazarguil:
> On Mon, Oct 24, 2016 at 11:10:59AM +0300, Raslan Darawsheh wrote:
> > When mbufs are smaller than MRU, multi-segment support must be enabled to
> > default set when not in promiscuous or allmulticast modes.
> > 
> > Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")
> > 
> > Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
[...]
> > +	/* If smaller than MRU, multi-segment support must be enabled. */
> > +	if (mb_len < (priv->mtu > dev->data->dev_conf.rxmode.max_rx_pkt_len ?
> > +		     dev->data->dev_conf.rxmode.max_rx_pkt_len :
> > +		     priv->mtu
> > +		     ))
> 
> Let's move poor "))" to the end of the previous line.
[...]
> Besides the above comment:
> 
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Fixed and applied, thanks

Patch

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 4dc5cc3..62253ed 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -946,6 +946,12 @@  rxq_ctrl_setup(struct rte_eth_dev *dev, struct rxq_ctrl *rxq_ctrl,
 	(void)conf; /* Thresholds configuration (ignored). */
 	/* Enable scattered packets support for this queue if necessary. */
 	assert(mb_len >= RTE_PKTMBUF_HEADROOM);
+	/* If smaller than MRU, multi-segment support must be enabled. */
+	if (mb_len < (priv->mtu > dev->data->dev_conf.rxmode.max_rx_pkt_len ?
+		     dev->data->dev_conf.rxmode.max_rx_pkt_len :
+		     priv->mtu
+		     ))
+		dev->data->dev_conf.rxmode.jumbo_frame = 1;
 	if ((dev->data->dev_conf.rxmode.jumbo_frame) &&
 	    (dev->data->dev_conf.rxmode.max_rx_pkt_len >
 	     (mb_len - RTE_PKTMBUF_HEADROOM))) {