From: "Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>
To: Yongseok Koh <yskoh@mellanox.com>
Cc: ferruh.yigit@intel.com, dev@dpdk.org, adrien.mazarguil@6wind.com
Subject: Re: [dpdk-dev] [PATCH] net/mlx5: change calculating inline room for Tx
Date: Tue, 18 Apr 2017 08:43:28 +0200 [thread overview]
Message-ID: <20170418064328.GG14075@autoinstall.dev.6wind.com> (raw)
In-Reply-To: <20170413174651.27860-1-yskoh@mellanox.com>
On Thu, Apr 13, 2017 at 10:46:51AM -0700, Yongseok Koh wrote:
> Current implementation is error-prone if the max inline size
> (txq->max_inilne) is decoupled from txq->inline_en and becomes zero. If it
> becomes zero, HW can crash due to WQ overflow.
>
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_rxtx.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
> index 2e208bf96..6254228a9 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.c
> +++ b/drivers/net/mlx5/mlx5_rxtx.c
> @@ -499,6 +499,8 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
> unsigned int j = 0;
> unsigned int k = 0;
> unsigned int max;
> + unsigned int max_inline = txq->max_inline;
> + const unsigned int inline_en = !!max_inline && txq->inline_en;
> uint16_t max_wqe;
> unsigned int comp;
> volatile struct mlx5_wqe_v *wqe = NULL;
> @@ -685,14 +687,14 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
> }
> }
> /* Inline if enough room. */
> - if (txq->inline_en || tso) {
> + if (inline_en || tso) {
> uintptr_t end = (uintptr_t)
> (((uintptr_t)txq->wqes) +
> (1 << txq->wqe_n) * MLX5_WQE_SIZE);
> - unsigned int max_inline = txq->max_inline *
> - RTE_CACHE_LINE_SIZE -
> - (pkt_inline_sz - 2);
> - uintptr_t addr_end = (addr + max_inline) &
> + unsigned int inline_room = max_inline *
> + RTE_CACHE_LINE_SIZE -
> + (pkt_inline_sz - 2);
> + uintptr_t addr_end = (addr + inline_room) &
> ~(RTE_CACHE_LINE_SIZE - 1);
> unsigned int copy_b = (addr_end > addr) ?
> RTE_MIN((addr_end - addr), length) :
> --
> 2.11.0
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
--
Nélio Laranjeiro
6WIND
next prev parent reply other threads:[~2017-04-18 6:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-13 17:46 Yongseok Koh
2017-04-14 6:51 ` Nélio Laranjeiro
2017-04-14 16:52 ` Yongseok Koh
2017-04-18 6:43 ` Nélio Laranjeiro [this message]
2017-04-18 9:35 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170418064328.GG14075@autoinstall.dev.6wind.com \
--to=nelio.laranjeiro@6wind.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=yskoh@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).