DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: wangyunjian <wangyunjian@huawei.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Andrew Rybchenko <arybchenko@solarflare.com>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>
Cc: dev <dev@dpdk.org>, xudingke@huawei.com
Subject: Re: [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings
Date: Mon, 29 Apr 2019 10:03:51 +0200	[thread overview]
Message-ID: <CAJFAV8w5uMs3SJa57N=v40uDQ8-jzFEmsg0S30Q-P=c9CQTkxw@mail.gmail.com> (raw)
Message-ID: <20190429080351.G57URG-Mah76jGNLB0yzqv0j9tHgtUhWhp0U2UlHlOw@z> (raw)
In-Reply-To: <1556358462-9920-1-git-send-email-wangyunjian@huawei.com>

On Sat, Apr 27, 2019 at 11:48 AM wangyunjian <wangyunjian@huawei.com> wrote:

> From: Yunjian Wang <wangyunjian@huawei.com>
>
> The current dma zone name consists of the port_id, queue_id and
> ring_name. If a port_id is reused, a new nic maybe use same dma
> zone name. At this time, the zone size of the new driver is
> differnt. When the zone is reused, it may cause illegal access
> to memory.
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  lib/librte_ethdev/rte_ethdev.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.c
> b/lib/librte_ethdev/rte_ethdev.c
> index d7cfa3d..0703cda 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -3630,9 +3630,9 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id,
> uint16_t queue_idx,
>         const struct rte_memzone *mz;
>         int rc;
>
> -       rc = snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s",
> -                     dev->data->port_id, queue_id, ring_name);
> -       if (rc >= RTE_MEMZONE_NAMESIZE) {
> +       rc = snprintf(z_name, sizeof(z_name), "p%dq%d%s0x%zx_%d",
> +                     dev->data->port_id, queue_id, ring_name, size,
> align);
> +       if (rc >= RTE_MEMZONE_NAMESIZE || rc < 0) {
>                 RTE_ETHDEV_LOG(ERR, "ring name too long\n");
>                 rte_errno = ENAMETOOLONG;
>                 return NULL;
>

In such a case, we are leaving the previous memzone in place and just
creating a new one.
Should the driver free the previous memzone instead?

I can't see this in existing drivers.
Do we actually expect to reuse the existing memzones?


-- 
David Marchand

  parent reply	other threads:[~2019-04-29  8:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-27  9:47 wangyunjian
2019-04-27  9:47 ` wangyunjian
2019-04-29  8:03 ` David Marchand [this message]
2019-04-29  8:03   ` David Marchand
2019-05-08 13:52   ` Andrew Rybchenko
2019-05-08 13:52     ` Andrew Rybchenko
  -- strict thread matches above, loose matches on Subject: below --
2019-04-27  8:38 wangyunjian
2019-04-27  8:38 ` wangyunjian

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='CAJFAV8w5uMs3SJa57N=v40uDQ8-jzFEmsg0S30Q-P=c9CQTkxw@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    --cc=wangyunjian@huawei.com \
    --cc=xudingke@huawei.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).