Re: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.

2017-10-26 Thread Darrell Ball


On 10/19/17, 9:56 AM, "ovs-dev-boun...@openvswitch.org on behalf of 
antonio.fische...@intel.com"  wrote:

In case a mempool name could not be generated log a message
and return a null mempool pointer to the caller.

CC: Mark B Kavanagh 
CC: Darrell Ball 
CC: Ciara Loftus 
CC: Kevin Traynor 
CC: Aaron Conole 
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each 
port.")
Signed-off-by: Antonio Fischetti 
---
 lib/netdev-dpdk.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index dc1e9c3..6fc6e1b 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
 int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
h, dmp->socket_id, dmp->mtu, dmp->mp_size);
 if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {

I see you copied me on an earlier version, so I’ll add one comment.
Given MTU size restriction for dpdk and rte max queues and max buf desc 
enforcement, can this condition be met ?
I think there are 11 remaining characters (out of 31) for mp_size and the 
calculation is 

dmp->mp_size = dev->requested_n_rxq * dev->requested_rxq_size
+ dev->requested_n_txq * dev->requested_txq_size
+ MIN(RTE_MAX_LCORE, dev->requested_n_rxq) * NETDEV_MAX_BURST
+ MIN_NB_MBUF;

I got 9 decimal digits max, assuming my math is correct…

Previous filtering for mtu (netdev_dpdk_set_mtu) and max queues 
(dpdk_eth_dev_init)/max buf desc (dpdk_process_queue_size)
enforcement (present and also any future design) should prevent snprintf from 
having an unexpected return value number of chars, which would
mean snprintf should only have an unexpected return value number of chars, if a 
future coding error were to be introduced.
FYI, OVS traditionally deals with other such cases with ovs_assert(), not a 
VLOG_DBG, since it is easier to find the bug earlier.
I believe snprintf at this level should not be catching user config errors.



+VLOG_DBG("snprintf returned %d. Failed to generate a mempool "
+"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
+ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
 return NULL;
 }
 return mp_name;
@@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool 
*mp_exists)
 
 do {
 char *mp_name = dpdk_mp_name(dmp);
+if (!mp_name) {
+rte_free(dmp);
+return NULL;
+}
 
 VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
   "on socket %d for %d Rx and %d Tx queues.",
-- 
2.4.11

___
dev mailing list
d...@openvswitch.org

https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev=DwICAg=uilaK90D4TOVoH58JNXRgQ=BVhFA09CGX7JQ5Ih-uZnsw=cKHgut93ZGYQzoLXpXQWPqcZhBX3NMdQaRnbNlfvhiU=tx4JYNmCFZ-vgGQzTIteThFJN2RSlMtqg34oTwlFEF0=


___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.

2017-10-20 Thread Kavanagh, Mark B
>From: Fischetti, Antonio
>Sent: Friday, October 20, 2017 10:38 AM
>To: Kavanagh, Mark B ; d...@openvswitch.org
>Cc: Darrell Ball ; Loftus, Ciara ;
>Kevin Traynor ; Aaron Conole 
>Subject: RE: [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name
>creation.
>
>
>
>> -Original Message-
>> From: Kavanagh, Mark B
>> Sent: Friday, October 20, 2017 10:28 AM
>> To: Fischetti, Antonio ; d...@openvswitch.org
>> Cc: Darrell Ball ; Loftus, Ciara ;
>> Kevin Traynor ; Aaron Conole 
>> Subject: RE: [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name
>> creation.
>>
>> >From: Fischetti, Antonio
>> >Sent: Thursday, October 19, 2017 5:54 PM
>> >To: d...@openvswitch.org
>> >Cc: Kavanagh, Mark B ; Darrell Ball
>> >; Loftus, Ciara ; Kevin Traynor
>> >; Aaron Conole ; Fischetti,
>Antonio
>> >
>> >Subject: [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name
>creation.
>> >
>> >In case a mempool name could not be generated log a message
>> >and return a null mempool pointer to the caller.
>> >
>> >CC: Mark B Kavanagh 
>> >CC: Darrell Ball 
>> >CC: Ciara Loftus 
>> >CC: Kevin Traynor 
>> >CC: Aaron Conole 
>> >Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each
>> >port.")
>> >Signed-off-by: Antonio Fischetti 
>> >---
>> > lib/netdev-dpdk.c | 7 +++
>> > 1 file changed, 7 insertions(+)
>> >
>> >diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> >index dc1e9c3..6fc6e1b 100644
>> >--- a/lib/netdev-dpdk.c
>> >+++ b/lib/netdev-dpdk.c
>> >@@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
>> > int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
>> >h, dmp->socket_id, dmp->mtu, dmp->mp_size);
>> > if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
>> >+VLOG_DBG("snprintf returned %d. Failed to generate a mempool "
>> >+"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
>> >+ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
>> > return NULL;
>> > }
>> > return mp_name;
>> >@@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool
>> >*mp_exists)
>> >
>> > do {
>> > char *mp_name = dpdk_mp_name(dmp);
>> >+if (!mp_name) {
>> >+rte_free(dmp);
>> >+return NULL;
>> >+}
>>
>>
>> This is a fix, and as such, needs to include 'Fixes: " in the
>commit
>> message.
>>
>> I believe that Kevin made the same comment on this patch in v7.
>
>[Antonio] Actually I added
>   Fixes: d555d9bded5f ("netdev-dpdk: Create separate...
>right before the Signed-off-by line.
>Is that what you meant?

Perfect - I actually hadn't spotted that.

With that: Acked-by: Mark Kavanagh 

Now, it seems that I really do need to go get that coffee...  ;)

>
>
>>
>> Thanks,
>> Mark
>>
>> >
>> > VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
>> >   "on socket %d for %d Rx and %d Tx queues.",
>> >--
>> >2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.

2017-10-20 Thread Fischetti, Antonio


> -Original Message-
> From: Kavanagh, Mark B
> Sent: Friday, October 20, 2017 10:28 AM
> To: Fischetti, Antonio ; d...@openvswitch.org
> Cc: Darrell Ball ; Loftus, Ciara ;
> Kevin Traynor ; Aaron Conole 
> Subject: RE: [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name
> creation.
> 
> >From: Fischetti, Antonio
> >Sent: Thursday, October 19, 2017 5:54 PM
> >To: d...@openvswitch.org
> >Cc: Kavanagh, Mark B ; Darrell Ball
> >; Loftus, Ciara ; Kevin Traynor
> >; Aaron Conole ; Fischetti, Antonio
> >
> >Subject: [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.
> >
> >In case a mempool name could not be generated log a message
> >and return a null mempool pointer to the caller.
> >
> >CC: Mark B Kavanagh 
> >CC: Darrell Ball 
> >CC: Ciara Loftus 
> >CC: Kevin Traynor 
> >CC: Aaron Conole 
> >Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each
> >port.")
> >Signed-off-by: Antonio Fischetti 
> >---
> > lib/netdev-dpdk.c | 7 +++
> > 1 file changed, 7 insertions(+)
> >
> >diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> >index dc1e9c3..6fc6e1b 100644
> >--- a/lib/netdev-dpdk.c
> >+++ b/lib/netdev-dpdk.c
> >@@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
> > int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
> >h, dmp->socket_id, dmp->mtu, dmp->mp_size);
> > if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
> >+VLOG_DBG("snprintf returned %d. Failed to generate a mempool "
> >+"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
> >+ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
> > return NULL;
> > }
> > return mp_name;
> >@@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool
> >*mp_exists)
> >
> > do {
> > char *mp_name = dpdk_mp_name(dmp);
> >+if (!mp_name) {
> >+rte_free(dmp);
> >+return NULL;
> >+}
> 
> 
> This is a fix, and as such, needs to include 'Fixes: " in the 
> commit
> message.
> 
> I believe that Kevin made the same comment on this patch in v7.

[Antonio] Actually I added 
   Fixes: d555d9bded5f ("netdev-dpdk: Create separate...
right before the Signed-off-by line.
Is that what you meant?


> 
> Thanks,
> Mark
> 
> >
> > VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
> >   "on socket %d for %d Rx and %d Tx queues.",
> >--
> >2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.

2017-10-20 Thread Kavanagh, Mark B
>From: Fischetti, Antonio
>Sent: Thursday, October 19, 2017 5:54 PM
>To: d...@openvswitch.org
>Cc: Kavanagh, Mark B ; Darrell Ball
>; Loftus, Ciara ; Kevin Traynor
>; Aaron Conole ; Fischetti, Antonio
>
>Subject: [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.
>
>In case a mempool name could not be generated log a message
>and return a null mempool pointer to the caller.
>
>CC: Mark B Kavanagh 
>CC: Darrell Ball 
>CC: Ciara Loftus 
>CC: Kevin Traynor 
>CC: Aaron Conole 
>Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each
>port.")
>Signed-off-by: Antonio Fischetti 
>---
> lib/netdev-dpdk.c | 7 +++
> 1 file changed, 7 insertions(+)
>
>diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>index dc1e9c3..6fc6e1b 100644
>--- a/lib/netdev-dpdk.c
>+++ b/lib/netdev-dpdk.c
>@@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
> int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
>h, dmp->socket_id, dmp->mtu, dmp->mp_size);
> if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
>+VLOG_DBG("snprintf returned %d. Failed to generate a mempool "
>+"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
>+ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
> return NULL;
> }
> return mp_name;
>@@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool
>*mp_exists)
>
> do {
> char *mp_name = dpdk_mp_name(dmp);
>+if (!mp_name) {
>+rte_free(dmp);
>+return NULL;
>+}


This is a fix, and as such, needs to include 'Fixes: " in the commit 
message.

I believe that Kevin made the same comment on this patch in v7.

Thanks,
Mark
 
>
> VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
>   "on socket %d for %d Rx and %d Tx queues.",
>--
>2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.

2017-10-20 Thread Kevin Traynor
On 10/19/2017 05:54 PM, antonio.fische...@intel.com wrote:
> In case a mempool name could not be generated log a message
> and return a null mempool pointer to the caller.
> 
> CC: Mark B Kavanagh 
> CC: Darrell Ball 
> CC: Ciara Loftus 
> CC: Kevin Traynor 
> CC: Aaron Conole 
> Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each 
> port.")
> Signed-off-by: Antonio Fischetti 
> ---

Acked-by: Kevin Traynor 

>  lib/netdev-dpdk.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index dc1e9c3..6fc6e1b 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
>  int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
> h, dmp->socket_id, dmp->mtu, dmp->mp_size);
>  if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
> +VLOG_DBG("snprintf returned %d. Failed to generate a mempool "
> +"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
> +ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
>  return NULL;
>  }
>  return mp_name;
> @@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool 
> *mp_exists)
>  
>  do {
>  char *mp_name = dpdk_mp_name(dmp);
> +if (!mp_name) {
> +rte_free(dmp);
> +return NULL;
> +}
>  
>  VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
>"on socket %d for %d Rx and %d Tx queues.",
> 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.

2017-10-19 Thread Stokes, Ian
> > -Original Message-
> > From: Stokes, Ian
> > Sent: Thursday, October 19, 2017 6:23 PM
> > To: Fischetti, Antonio <antonio.fische...@intel.com>;
> > d...@openvswitch.org
> > Subject: RE: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in
> > mempool name creation.
> >
> > > In case a mempool name could not be generated log a message and
> > > return a null mempool pointer to the caller.
> > >
> >
> > Now that I look at this, is it the case that the issues have been
> > resolved in patches 1 and 2 but this is a clean up patch for something
> that might happen?
> 
> [Antonio] Exactly. All the issues we saw:
>  - issue with vhostuserclient in a PVP test
>  - issue of new MTU not displayed when an existing mempool is returned.
>  - issue with the NUMA-Aware usecase
> get resolved by patches #1 and #2.
> 
> All remaining patches are small improvements or just cosmetics.
> 
> This patch would be a small improvement to manage the unlikely event of a
> name creation failure that 'might' happen.
> So this has nothing to do with the issues listed above. I added this patch
> to the series because  - after looking at the code - I thought it would be
> good to track and manage an empty mempool name, just to be extra-safe.
> 

Ok, thanks for clarifying Antonio, I'm going to start testing on this patch 
series tomorrow with a view to validation. 

I think most reviewers have acked at this point but I want to flag it again to 
those ccd, I'm anxious to get this patch upstreamed to fix master once it has 
passed validation.
> 
> >
> >
> > > CC: Mark B Kavanagh <mark.b.kavan...@intel.com>
> > > CC: Darrell Ball <dlu...@gmail.com>
> > > CC: Ciara Loftus <ciara.lof...@intel.com>
> > > CC: Kevin Traynor <ktray...@redhat.com>
> > > CC: Aaron Conole <acon...@redhat.com>
> > > Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for
> > > each
> > > port.")
> > > Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com>
> > > ---
> > >  lib/netdev-dpdk.c | 7 +++
> > >  1 file changed, 7 insertions(+)
> > >
> > > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index
> > > dc1e9c3..6fc6e1b
> > > 100644
> > > --- a/lib/netdev-dpdk.c
> > > +++ b/lib/netdev-dpdk.c
> > > @@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
> > >  int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
> "ovs_%x_%d_%d_%u",
> > > h, dmp->socket_id, dmp->mtu, dmp->mp_size);
> > >  if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
> > > +VLOG_DBG("snprintf returned %d. Failed to generate a mempool
> "
> > > +"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
> > > +ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
> > >  return NULL;
> > >  }
> > >  return mp_name;
> > > @@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int
> > > mtu, bool
> > > *mp_exists)
> > >
> > >  do {
> > >  char *mp_name = dpdk_mp_name(dmp);
> > > +if (!mp_name) {
> > > +rte_free(dmp);
> > > +return NULL;
> > > +}
> > >
> > >  VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
> > >"on socket %d for %d Rx and %d Tx queues.",
> > > --
> > > 2.4.11
> > >
> > > ___
> > > dev mailing list
> > > d...@openvswitch.org
> > > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.

2017-10-19 Thread Fischetti, Antonio


> -Original Message-
> From: Stokes, Ian
> Sent: Thursday, October 19, 2017 6:23 PM
> To: Fischetti, Antonio <antonio.fische...@intel.com>; d...@openvswitch.org
> Subject: RE: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool
> name creation.
> 
> > In case a mempool name could not be generated log a message and return a
> > null mempool pointer to the caller.
> >
> 
> Now that I look at this, is it the case that the issues have been resolved in
> patches 1 and 2 but this is a clean up patch for something that might happen?

[Antonio] Exactly. All the issues we saw: 
 - issue with vhostuserclient in a PVP test
 - issue of new MTU not displayed when an existing mempool is returned.
 - issue with the NUMA-Aware usecase
get resolved by patches #1 and #2.

All remaining patches are small improvements or just cosmetics.

This patch would be a small improvement to manage the unlikely event of a name 
creation failure that 'might' happen. 
So this has nothing to do with the issues listed above. I added this patch to 
the series because  - after looking at the code - I thought it would be good to 
track and manage an empty mempool name, just to be extra-safe.


> 
> 
> > CC: Mark B Kavanagh <mark.b.kavan...@intel.com>
> > CC: Darrell Ball <dlu...@gmail.com>
> > CC: Ciara Loftus <ciara.lof...@intel.com>
> > CC: Kevin Traynor <ktray...@redhat.com>
> > CC: Aaron Conole <acon...@redhat.com>
> > Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each
> > port.")
> > Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com>
> > ---
> >  lib/netdev-dpdk.c | 7 +++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index dc1e9c3..6fc6e1b
> > 100644
> > --- a/lib/netdev-dpdk.c
> > +++ b/lib/netdev-dpdk.c
> > @@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
> >  int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
> > h, dmp->socket_id, dmp->mtu, dmp->mp_size);
> >  if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
> > +VLOG_DBG("snprintf returned %d. Failed to generate a mempool "
> > +"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
> > +ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
> >  return NULL;
> >  }
> >  return mp_name;
> > @@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool
> > *mp_exists)
> >
> >  do {
> >  char *mp_name = dpdk_mp_name(dmp);
> > +if (!mp_name) {
> > +rte_free(dmp);
> > +return NULL;
> > +}
> >
> >  VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
> >"on socket %d for %d Rx and %d Tx queues.",
> > --
> > 2.4.11
> >
> > ___
> > dev mailing list
> > d...@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.

2017-10-19 Thread Stokes, Ian
> In case a mempool name could not be generated log a message and return a
> null mempool pointer to the caller.
> 

Now that I look at this, is it the case that the issues have been resolved in 
patches 1 and 2 but this is a clean up patch for something that might happen?


> CC: Mark B Kavanagh 
> CC: Darrell Ball 
> CC: Ciara Loftus 
> CC: Kevin Traynor 
> CC: Aaron Conole 
> Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each
> port.")
> Signed-off-by: Antonio Fischetti 
> ---
>  lib/netdev-dpdk.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index dc1e9c3..6fc6e1b
> 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
>  int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
> h, dmp->socket_id, dmp->mtu, dmp->mp_size);
>  if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
> +VLOG_DBG("snprintf returned %d. Failed to generate a mempool "
> +"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
> +ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
>  return NULL;
>  }
>  return mp_name;
> @@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool
> *mp_exists)
> 
>  do {
>  char *mp_name = dpdk_mp_name(dmp);
> +if (!mp_name) {
> +rte_free(dmp);
> +return NULL;
> +}
> 
>  VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
>"on socket %d for %d Rx and %d Tx queues.",
> --
> 2.4.11
> 
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v8 4/6] netdev-dpdk: manage failure in mempool name creation.

2017-10-19 Thread antonio . fischetti
In case a mempool name could not be generated log a message
and return a null mempool pointer to the caller.

CC: Mark B Kavanagh 
CC: Darrell Ball 
CC: Ciara Loftus 
CC: Kevin Traynor 
CC: Aaron Conole 
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.")
Signed-off-by: Antonio Fischetti 
---
 lib/netdev-dpdk.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index dc1e9c3..6fc6e1b 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
 int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
h, dmp->socket_id, dmp->mtu, dmp->mp_size);
 if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
+VLOG_DBG("snprintf returned %d. Failed to generate a mempool "
+"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
+ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
 return NULL;
 }
 return mp_name;
@@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool 
*mp_exists)
 
 do {
 char *mp_name = dpdk_mp_name(dmp);
+if (!mp_name) {
+rte_free(dmp);
+return NULL;
+}
 
 VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
   "on socket %d for %d Rx and %d Tx queues.",
-- 
2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev