DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings
@ 2019-04-27  9:47 wangyunjian
  2019-04-27  9:47 ` wangyunjian
  2019-04-29  8:03 ` David Marchand
  0 siblings, 2 replies; 8+ messages in thread
From: wangyunjian @ 2019-04-27  9:47 UTC (permalink / raw)
  To: dev; +Cc: xudingke, Yunjian Wang

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;
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings
  2019-04-27  9:47 [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings wangyunjian
@ 2019-04-27  9:47 ` wangyunjian
  2019-04-29  8:03 ` David Marchand
  1 sibling, 0 replies; 8+ messages in thread
From: wangyunjian @ 2019-04-27  9:47 UTC (permalink / raw)
  To: dev; +Cc: xudingke, Yunjian Wang

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;
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings
  2019-04-27  9:47 [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings 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
  1 sibling, 2 replies; 8+ messages in thread
From: David Marchand @ 2019-04-29  8:03 UTC (permalink / raw)
  To: wangyunjian, Thomas Monjalon, Andrew Rybchenko, Yigit, Ferruh
  Cc: dev, xudingke

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings
  2019-04-29  8:03 ` David Marchand
@ 2019-04-29  8:03   ` David Marchand
  2019-05-08 13:52   ` Andrew Rybchenko
  1 sibling, 0 replies; 8+ messages in thread
From: David Marchand @ 2019-04-29  8:03 UTC (permalink / raw)
  To: wangyunjian, Thomas Monjalon, Andrew Rybchenko, Yigit, Ferruh
  Cc: dev, xudingke

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings
  2019-04-29  8:03 ` David Marchand
  2019-04-29  8:03   ` David Marchand
@ 2019-05-08 13:52   ` Andrew Rybchenko
  2019-05-08 13:52     ` Andrew Rybchenko
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Rybchenko @ 2019-05-08 13:52 UTC (permalink / raw)
  To: David Marchand, wangyunjian, Thomas Monjalon, Yigit, Ferruh; +Cc: dev, xudingke

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/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings
  2019-05-08 13:52   ` Andrew Rybchenko
@ 2019-05-08 13:52     ` Andrew Rybchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Rybchenko @ 2019-05-08 13:52 UTC (permalink / raw)
  To: David Marchand, wangyunjian, Thomas Monjalon, Yigit, Ferruh; +Cc: dev, xudingke

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/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings
@ 2019-04-27  8:38 wangyunjian
  2019-04-27  8:38 ` wangyunjian
  0 siblings, 1 reply; 8+ messages in thread
From: wangyunjian @ 2019-04-27  8:38 UTC (permalink / raw)
  To: dev; +Cc: xudingke, Yunjian Wang

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index d7cfa3d..3242737 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",
+	rc = snprintf(z_name, sizeof(z_name), "p%dq%d%s0x%zx_%d",
 		      dev->data->port_id, queue_id, ring_name);
-	if (rc >= RTE_MEMZONE_NAMESIZE) {
+	if (rc >= RTE_MEMZONE_NAMESIZE || rx < 0) {
 		RTE_ETHDEV_LOG(ERR, "ring name too long\n");
 		rte_errno = ENAMETOOLONG;
 		return NULL;
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings
  2019-04-27  8:38 wangyunjian
@ 2019-04-27  8:38 ` wangyunjian
  0 siblings, 0 replies; 8+ messages in thread
From: wangyunjian @ 2019-04-27  8:38 UTC (permalink / raw)
  To: dev; +Cc: xudingke, Yunjian Wang

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index d7cfa3d..3242737 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",
+	rc = snprintf(z_name, sizeof(z_name), "p%dq%d%s0x%zx_%d",
 		      dev->data->port_id, queue_id, ring_name);
-	if (rc >= RTE_MEMZONE_NAMESIZE) {
+	if (rc >= RTE_MEMZONE_NAMESIZE || rx < 0) {
 		RTE_ETHDEV_LOG(ERR, "ring name too long\n");
 		rte_errno = ENAMETOOLONG;
 		return NULL;
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-08 13:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-27  9:47 [dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings 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
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

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).