diff mbox

[ovs-dev] lib/netdev-dpdk: increase ring name length for dpdkr ports

Message ID 1452396528-3436-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it
State Not Applicable
Headers show

Commit Message

Mauricio Vásquez Jan. 10, 2016, 3:28 a.m. UTC
A ring name length of 10 characters is not enough for dpdkr ports
starting from dpdkr10, then it is increased to 20 characters.

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
---
 lib/netdev-dpdk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Aaron Conole Jan. 10, 2016, 5:17 p.m. UTC | #1
Greetings Mauricio,

Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it> writes:
> A ring name length of 10 characters is not enough for dpdkr ports
> starting from dpdkr10, then it is increased to 20 characters.
>
> Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
> ---
>  lib/netdev-dpdk.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index b209df2..60c4262 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -1921,7 +1921,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no,
>                   unsigned int *eth_port_id)
>  {
>      struct dpdk_ring *ivshmem;
> -    char ring_name[10];
> +    char ring_name[20];

I think here it would be better to use ``RTE_RING_NAMESIZE`` rather than
the constant 20.

Thanks,
-Aaron
Mauricio Vásquez Jan. 10, 2016, 6:31 p.m. UTC | #2
Dear Aaron,

I completely agree with you, I've sent a second version:
http://openvswitch.org/pipermail/dev/2016-January/064228.html

Thank you very much,
Mauricio Vasquez B

On 10 January 2016 at 12:17, Aaron Conole <aconole@bytheb.org> wrote:

> Greetings Mauricio,
>
> Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it> writes:
> > A ring name length of 10 characters is not enough for dpdkr ports
> > starting from dpdkr10, then it is increased to 20 characters.
> >
> > Signed-off-by: Mauricio Vasquez B <
> mauricio.vasquezbernal@studenti.polito.it>
> > ---
> >  lib/netdev-dpdk.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> > index b209df2..60c4262 100644
> > --- a/lib/netdev-dpdk.c
> > +++ b/lib/netdev-dpdk.c
> > @@ -1921,7 +1921,7 @@ dpdk_ring_create(const char dev_name[], unsigned
> int port_no,
> >                   unsigned int *eth_port_id)
> >  {
> >      struct dpdk_ring *ivshmem;
> > -    char ring_name[10];
> > +    char ring_name[20];
>
> I think here it would be better to use ``RTE_RING_NAMESIZE`` rather than
> the constant 20.
>
> Thanks,
> -Aaron
>
diff mbox

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index b209df2..60c4262 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1921,7 +1921,7 @@  dpdk_ring_create(const char dev_name[], unsigned int port_no,
                  unsigned int *eth_port_id)
 {
     struct dpdk_ring *ivshmem;
-    char ring_name[10];
+    char ring_name[20];
     int err;
 
     ivshmem = dpdk_rte_mzalloc(sizeof *ivshmem);
@@ -1930,7 +1930,7 @@  dpdk_ring_create(const char dev_name[], unsigned int port_no,
     }
 
     /* XXX: Add support for multiquque ring. */
-    err = snprintf(ring_name, 10, "%s_tx", dev_name);
+    err = snprintf(ring_name, sizeof(ring_name), "%s_tx", dev_name);
     if (err < 0) {
         return -err;
     }
@@ -1943,7 +1943,7 @@  dpdk_ring_create(const char dev_name[], unsigned int port_no,
         return ENOMEM;
     }
 
-    err = snprintf(ring_name, 10, "%s_rx", dev_name);
+    err = snprintf(ring_name, sizeof(ring_name), "%s_rx", dev_name);
     if (err < 0) {
         return -err;
     }