[dpdk-stable] [PATCH 19.11 6/6] net/mlx5: fix multi-segment inline for the first segments

Christian Ehrhardt christian.ehrhardt at canonical.com
Tue Aug 17 13:55:15 CEST 2021


On Mon, Aug 16, 2021 at 6:30 PM Bing Zhao <bingz at nvidia.com> wrote:
>
> From: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
>
> [ upstream commit ec837ad0fc7c6df4912cc2706b9cd54b225f4a34 ]

While not applying this causes build fails on some platforms.

Looks like:
[  974s] ../drivers/net/mlx5/mlx5_rxtx.c: In function
‘mlx5_tx_packet_multi_inline’:
[  974s] ../drivers/net/mlx5/mlx5_rxtx.c:3356:31: error:
‘PKT_TX_DYNF_NOINLINE’ undeclared (first use in this function)
[  974s]  3356 |   } else if (mbuf->ol_flags & PKT_TX_DYNF_NOINLINE ||
[  974s]       |                               ^~~~~~~~~~~~~~~~~~~~
[  974s] ../drivers/net/mlx5/mlx5_rxtx.c:3356:31: note: each
undeclared identifier is reported only once for each function it
appears in
[  974s] ninja: build stopped: subcommand failed.

And indeed this is the only occurrence

$ grep -Hrn PKT_TX_DYNF_NOINLINE *
drivers/net/mlx5/mlx5_rxtx.c:3356: } else if (mbuf->ol_flags &
PKT_TX_DYNF_NOINLINE ||

Since it only happens on some releases I'd assume the other
arch/distros just do not build this?
It seems to only affect those building with meson.

For now I've removed this patch again from 19.11 - please have a look
and let me know if you'll provide a refreshed backport.



> Before 19.08 release the Tx burst routines of mlx5 PMD
> provided data inline for the first short segments of the
> multi-segment packets. In the release 19.08 mlx5 Tx datapath
> was refactored and this behavior was broken, affecting the
> performance.
>
> For example, the T-Rex traffic generator might use small
> leading segments to handle packet headers and performance
> degradation was noticed.
>
> If the first segments of the multi-segment packet are short
> and the overall length is below the inline threshold it
> should be inline into the WQE to fix the performance.
>
> Fixes: 18a1c20044c0 ("net/mlx5: implement Tx burst template")
> Cc: stable at dpdk.org
>
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
> Signed-off-by: Bing Zhao <bingz at nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_rxtx.c | 27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
> index 73dbf68d2b..094e359e55 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.c
> +++ b/drivers/net/mlx5/mlx5_rxtx.c
> @@ -3336,6 +3336,8 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *restrict txq,
>                 unsigned int nxlen;
>                 uintptr_t start;
>
> +               mbuf = loc->mbuf;
> +               nxlen = rte_pktmbuf_data_len(mbuf);
>                 /*
>                  * Packet length exceeds the allowed inline
>                  * data length, check whether the minimal
> @@ -3345,27 +3347,23 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *restrict txq,
>                         assert(txq->inlen_mode >= MLX5_ESEG_MIN_INLINE_SIZE);
>                         assert(txq->inlen_mode <= txq->inlen_send);
>                         inlen = txq->inlen_mode;
> -               } else {
> -                       if (!vlan || txq->vlan_en) {
> -                               /*
> -                                * VLAN insertion will be done inside by HW.
> -                                * It is not utmost effective - VLAN flag is
> -                                * checked twice, but we should proceed the
> -                                * inlining length correctly and take into
> -                                * account the VLAN header being inserted.
> -                                */
> -                               return mlx5_tx_packet_multi_send
> -                                                       (txq, loc, olx);
> -                       }
> +               } else if (vlan && !txq->vlan_en) {
> +                       /*
> +                        * VLAN insertion is requested and hardware does not
> +                        * support the offload, will do with software inline.
> +                        */
>                         inlen = MLX5_ESEG_MIN_INLINE_SIZE;
> +               } else if (mbuf->ol_flags & PKT_TX_DYNF_NOINLINE ||
> +                          nxlen > txq->inlen_send) {
> +                       return mlx5_tx_packet_multi_send(txq, loc, olx);
> +               } else {
> +                       goto do_first;
>                 }
>                 /*
>                  * Now we know the minimal amount of data is requested
>                  * to inline. Check whether we should inline the buffers
>                  * from the chain beginning to eliminate some mbufs.
>                  */
> -               mbuf = loc->mbuf;
> -               nxlen = rte_pktmbuf_data_len(mbuf);
>                 if (unlikely(nxlen <= txq->inlen_send)) {
>                         /* We can inline first mbuf at least. */
>                         if (nxlen < inlen) {
> @@ -3387,6 +3385,7 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *restrict txq,
>                                         goto do_align;
>                                 }
>                         }
> +do_first:
>                         do {
>                                 inlen = nxlen;
>                                 mbuf = NEXT(mbuf);
> --
> 2.21.0
>


-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd


More information about the stable mailing list