[ovs-dev,3/4] netdev-dpdk: log an err message when a mempool name is empty.

Message ID 1506438251-16537-3-git-send-email-antonio.fischetti@intel.com
State New
Headers show
Series
  • [ovs-dev,1/4] netdev-dpdk: fix mempool management with vhu client.
Related show

Commit Message

Fischetti, Antonio Sept. 26, 2017, 3:04 p.m.
Log an error message when the creation of a name for a
new mempool fails.

CC: Ciara Loftus <ciara.loftus@intel.com>
CC: Kevin Traynor <ktraynor@redhat.com>
CC: Aaron Conole <aconole@redhat.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
---
 lib/netdev-dpdk.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Darrell Ball Sept. 26, 2017, 8:22 p.m. | #1
On 9/26/17, 8:06 AM, "ovs-dev-bounces@openvswitch.org on behalf of antonio.fischetti@intel.com" <ovs-dev-bounces@openvswitch.org on behalf of antonio.fischetti@intel.com> wrote:

    Log an error message when the creation of a name for a
    new mempool fails.
    
    CC: Ciara Loftus <ciara.loftus@intel.com>
    CC: Kevin Traynor <ktraynor@redhat.com>
    CC: Aaron Conole <aconole@redhat.com>
    Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>

    ---
     lib/netdev-dpdk.c | 3 +++
     1 file changed, 3 insertions(+)
    
    diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
    index f3f42ee..7c673ec 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_%u",
                            h, dmp->mtu, dmp->mp_size);
         if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
    +        VLOG_ERR("Failed to generate a mempool name for \"%s\". "
    +                "Hash:0x%x, mtu:%d, mbufs:%u",
    +                dmp->if_name, h, dmp->mtu, dmp->mp_size);

[Darrell] “Unlikely” to fail but this could be an ovs_assert(…)


             return NULL;
         }
         return mp_name;
    -- 
    2.4.11
    
    _______________________________________________
    dev mailing list
    dev@openvswitch.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=VXc6b9RFgB9FaMDL4JevWOtvj0gTpvDJYBS30fvVj8Y&s=Eeo-qAFITbCVhSWvMvxHDN4IzLsDEIYI1MmIsoUtDOE&e=
Fischetti, Antonio Sept. 28, 2017, 1:41 p.m. | #2
> -----Original Message-----

> From: Darrell Ball [mailto:dball@vmware.com]

> Sent: Tuesday, September 26, 2017 9:22 PM

> To: Fischetti, Antonio <antonio.fischetti@intel.com>; dev@openvswitch.org

> Subject: Re: [ovs-dev] [PATCH 3/4] netdev-dpdk: log an err message when a

> mempool name is empty.

> 

> 

> 

> On 9/26/17, 8:06 AM, "ovs-dev-bounces@openvswitch.org on behalf of

> antonio.fischetti@intel.com" <ovs-dev-bounces@openvswitch.org on behalf of

> antonio.fischetti@intel.com> wrote:

> 

>     Log an error message when the creation of a name for a

>     new mempool fails.

> 

>     CC: Ciara Loftus <ciara.loftus@intel.com>

>     CC: Kevin Traynor <ktraynor@redhat.com>

>     CC: Aaron Conole <aconole@redhat.com>

>     Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>

>     ---

>      lib/netdev-dpdk.c | 3 +++

>      1 file changed, 3 insertions(+)

> 

>     diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c

>     index f3f42ee..7c673ec 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_%u",

>                             h, dmp->mtu, dmp->mp_size);

>          if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {

>     +        VLOG_ERR("Failed to generate a mempool name for \"%s\". "

>     +                "Hash:0x%x, mtu:%d, mbufs:%u",

>     +                dmp->if_name, h, dmp->mtu, dmp->mp_size);

> 

> [Darrell] “Unlikely” to fail but this could be an ovs_assert(…)


[Antonio] ok will replace with
     ovs_assert(ret >= 0 && ret < RTE_MEMPOOL_NAMESIZE);

> 

> 

>              return NULL;

>          }

>          return mp_name;

>     --

>     2.4.11

> 

>     _______________________________________________

>     dev mailing list

>     dev@openvswitch.org

>     https://urldefense.proofpoint.com/v2/url?u=https-

> 3A__mail.openvswitch.org_mailman_listinfo_ovs-

> 2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-

> uZnsw&m=VXc6b9RFgB9FaMDL4JevWOtvj0gTpvDJYBS30fvVj8Y&s=Eeo-

> qAFITbCVhSWvMvxHDN4IzLsDEIYI1MmIsoUtDOE&e=

>

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index f3f42ee..7c673ec 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_%u",
                        h, dmp->mtu, dmp->mp_size);
     if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
+        VLOG_ERR("Failed to generate a mempool name for \"%s\". "
+                "Hash:0x%x, mtu:%d, mbufs:%u",
+                dmp->if_name, h, dmp->mtu, dmp->mp_size);
         return NULL;
     }
     return mp_name;