DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: David Marchand <david.marchand@redhat.com>,
	wangyunjian <wangyunjian@huawei.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	"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: Wed, 8 May 2019 16:52:22 +0300	[thread overview]
Message-ID: <b36bc72e-e3d1-7f48-1f92-8b7c6b2e45a8@solarflare.com> (raw)
In-Reply-To: <CAJFAV8w5uMs3SJa57N=v40uDQ8-jzFEmsg0S30Q-P=c9CQTkxw@mail.gmail.com>

On 4/29/19 11:03 AM, David Marchand wrote:
> On Sat, Apr 27, 2019 at 11:48 AM wangyunjian <wangyunjian@huawei.com 
> <mailto:wangyunjian@huawei.com>> wrote:
>
>     From: Yunjian Wang <wangyunjian@huawei.com
>     <mailto: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
>     <mailto: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?
>

I don't think the patch is a right way to go.
It is related to [1] which has a long discussion.

Andrew.

[1] https://patches.dpdk.org/patch/51952/

  parent reply	other threads:[~2019-05-08 13:52 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
2019-04-29  8:03   ` David Marchand
2019-05-08 13:52   ` Andrew Rybchenko [this message]
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=b36bc72e-e3d1-7f48-1f92-8b7c6b2e45a8@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=david.marchand@redhat.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).