diff mbox

[ovs-dev,V2] netdev-dpdk: fix mempool_configure error state

Message ID 1489404926-7008-1-git-send-email-mark.b.kavanagh@intel.com
State Accepted
Delegated to: Darrell Ball
Headers show

Commit Message

Mark Kavanagh March 13, 2017, 11:35 a.m. UTC
netdev_dpdk_mempool_configure obtains a handle to a
DPDK memory pool via a call to dpdk_mp_get. If dpdk_mp_get
fails, the former informs the user that insufficient memory
is available, and  returns ENOMEM. However, this is
potentially misleading, as there are a number of reasons why
creation of a mempool can fail (as per rte_mempool_create),
including:
   - insufficient memory available
   - mempool already exists
   - other memory allocation error

Update the error log to reflect this fact, and return rte_errno
in the event of error, instead of ENOMEM.

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Fixes: 0072e931 ("netdev-dpdk: add support for jumbo frames")
---
 lib/netdev-dpdk.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Stokes, Ian March 13, 2017, 11:46 a.m. UTC | #1
> netdev_dpdk_mempool_configure obtains a handle to a DPDK memory pool via a
> call to dpdk_mp_get. If dpdk_mp_get fails, the former informs the user
> that insufficient memory is available, and  returns ENOMEM. However, this
> is potentially misleading, as there are a number of reasons why creation
> of a mempool can fail (as per rte_mempool_create),
> including:
>    - insufficient memory available
>    - mempool already exists
>    - other memory allocation error
> 
> Update the error log to reflect this fact, and return rte_errno in the
> event of error, instead of ENOMEM.
> 
> Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
> Fixes: 0072e931 ("netdev-dpdk: add support for jumbo frames")
> ---
>  lib/netdev-dpdk.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ddc651b..858d995
> 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -571,10 +571,11 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk
> *dev)
> 
>      mp = dpdk_mp_get(dev->requested_socket_id,
> FRAME_LEN_TO_MTU(buf_size));
>      if (!mp) {
> -        VLOG_ERR("Insufficient memory to create memory pool for netdev "
> -                 "%s, with MTU %d on socket %d\n",
> -                 dev->up.name, dev->requested_mtu, dev-
> >requested_socket_id);
> -        return ENOMEM;
> +        VLOG_ERR("Failed to create memory pool for netdev "
> +                 "%s, with MTU %d on socket %d: %s\n",
> +                 dev->up.name, dev->requested_mtu, dev-
> >requested_socket_id,
> +                 rte_strerror(rte_errno));
> +        return rte_errno;
>      } else {
>          dpdk_mp_put(dev->dpdk_mp);
>          dev->dpdk_mp = mp;
> --

LGTM,

Acked-by: Ian Stokes <ian.stokes@intel.com>
Darrell Ball May 3, 2017, 2 a.m. UTC | #2
Acked-by: Darrell Ball <dlu998@gmail.com>

On 3/13/17, 4:46 AM, "ovs-dev-bounces@openvswitch.org on behalf of Stokes, Ian" <ovs-dev-bounces@openvswitch.org on behalf of ian.stokes@intel.com> wrote:

    > netdev_dpdk_mempool_configure obtains a handle to a DPDK memory pool via a
    > call to dpdk_mp_get. If dpdk_mp_get fails, the former informs the user
    > that insufficient memory is available, and  returns ENOMEM. However, this
    > is potentially misleading, as there are a number of reasons why creation
    > of a mempool can fail (as per rte_mempool_create),
    > including:
    >    - insufficient memory available
    >    - mempool already exists
    >    - other memory allocation error
    > 
    > Update the error log to reflect this fact, and return rte_errno in the
    > event of error, instead of ENOMEM.
    > 
    > Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
    > Fixes: 0072e931 ("netdev-dpdk: add support for jumbo frames")
    > ---
    >  lib/netdev-dpdk.c | 9 +++++----
    >  1 file changed, 5 insertions(+), 4 deletions(-)
    > 
    > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ddc651b..858d995
    > 100644
    > --- a/lib/netdev-dpdk.c
    > +++ b/lib/netdev-dpdk.c
    > @@ -571,10 +571,11 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk
    > *dev)
    > 
    >      mp = dpdk_mp_get(dev->requested_socket_id,
    > FRAME_LEN_TO_MTU(buf_size));
    >      if (!mp) {
    > -        VLOG_ERR("Insufficient memory to create memory pool for netdev "
    > -                 "%s, with MTU %d on socket %d\n",
    > -                 dev->up.name, dev->requested_mtu, dev-
    > >requested_socket_id);
    > -        return ENOMEM;
    > +        VLOG_ERR("Failed to create memory pool for netdev "
    > +                 "%s, with MTU %d on socket %d: %s\n",
    > +                 dev->up.name, dev->requested_mtu, dev-
    > >requested_socket_id,
    > +                 rte_strerror(rte_errno));
    > +        return rte_errno;
    >      } else {
    >          dpdk_mp_put(dev->dpdk_mp);
    >          dev->dpdk_mp = mp;
    > --
    
    LGTM,
    
    Acked-by: Ian Stokes <ian.stokes@intel.com>
    _______________________________________________
    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=rHNfhapnunpdSieFttCrIEo6q9W5-AWLYwHHz2_xGcc&s=XuLt4RImAA0v8RMjewVcw0qEIwbaRN9g5ZUWHgpl1q0&e=
Ben Pfaff May 3, 2017, 6:36 p.m. UTC | #3
Thanks everyone, I applied this to master.

Let me know if this should be applied to older branches.

On Wed, May 03, 2017 at 02:00:31AM +0000, Darrell Ball wrote:
> Acked-by: Darrell Ball <dlu998@gmail.com>
> 
> On 3/13/17, 4:46 AM, "ovs-dev-bounces@openvswitch.org on behalf of Stokes, Ian" <ovs-dev-bounces@openvswitch.org on behalf of ian.stokes@intel.com> wrote:
> 
>     > netdev_dpdk_mempool_configure obtains a handle to a DPDK memory pool via a
>     > call to dpdk_mp_get. If dpdk_mp_get fails, the former informs the user
>     > that insufficient memory is available, and  returns ENOMEM. However, this
>     > is potentially misleading, as there are a number of reasons why creation
>     > of a mempool can fail (as per rte_mempool_create),
>     > including:
>     >    - insufficient memory available
>     >    - mempool already exists
>     >    - other memory allocation error
>     > 
>     > Update the error log to reflect this fact, and return rte_errno in the
>     > event of error, instead of ENOMEM.
>     > 
>     > Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
>     > Fixes: 0072e931 ("netdev-dpdk: add support for jumbo frames")
>     > ---
>     >  lib/netdev-dpdk.c | 9 +++++----
>     >  1 file changed, 5 insertions(+), 4 deletions(-)
>     > 
>     > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ddc651b..858d995
>     > 100644
>     > --- a/lib/netdev-dpdk.c
>     > +++ b/lib/netdev-dpdk.c
>     > @@ -571,10 +571,11 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk
>     > *dev)
>     > 
>     >      mp = dpdk_mp_get(dev->requested_socket_id,
>     > FRAME_LEN_TO_MTU(buf_size));
>     >      if (!mp) {
>     > -        VLOG_ERR("Insufficient memory to create memory pool for netdev "
>     > -                 "%s, with MTU %d on socket %d\n",
>     > -                 dev->up.name, dev->requested_mtu, dev-
>     > >requested_socket_id);
>     > -        return ENOMEM;
>     > +        VLOG_ERR("Failed to create memory pool for netdev "
>     > +                 "%s, with MTU %d on socket %d: %s\n",
>     > +                 dev->up.name, dev->requested_mtu, dev-
>     > >requested_socket_id,
>     > +                 rte_strerror(rte_errno));
>     > +        return rte_errno;
>     >      } else {
>     >          dpdk_mp_put(dev->dpdk_mp);
>     >          dev->dpdk_mp = mp;
>     > --
>     
>     LGTM,
>     
>     Acked-by: Ian Stokes <ian.stokes@intel.com>
>     _______________________________________________
>     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=rHNfhapnunpdSieFttCrIEo6q9W5-AWLYwHHz2_xGcc&s=XuLt4RImAA0v8RMjewVcw0qEIwbaRN9g5ZUWHgpl1q0&e= 
>     
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Darrell Ball May 3, 2017, 6:47 p.m. UTC | #4
Please apply to 2.6 and 2.7

Thanks Darrell

On 5/3/17, 11:36 AM, "Ben Pfaff" <blp@ovn.org> wrote:

    Thanks everyone, I applied this to master.
    
    Let me know if this should be applied to older branches.
    
    On Wed, May 03, 2017 at 02:00:31AM +0000, Darrell Ball wrote:
    > Acked-by: Darrell Ball <dlu998@gmail.com>
    > 
    > On 3/13/17, 4:46 AM, "ovs-dev-bounces@openvswitch.org on behalf of Stokes, Ian" <ovs-dev-bounces@openvswitch.org on behalf of ian.stokes@intel.com> wrote:
    > 
    >     > netdev_dpdk_mempool_configure obtains a handle to a DPDK memory pool via a
    >     > call to dpdk_mp_get. If dpdk_mp_get fails, the former informs the user
    >     > that insufficient memory is available, and  returns ENOMEM. However, this
    >     > is potentially misleading, as there are a number of reasons why creation
    >     > of a mempool can fail (as per rte_mempool_create),
    >     > including:
    >     >    - insufficient memory available
    >     >    - mempool already exists
    >     >    - other memory allocation error
    >     > 
    >     > Update the error log to reflect this fact, and return rte_errno in the
    >     > event of error, instead of ENOMEM.
    >     > 
    >     > Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
    >     > Fixes: 0072e931 ("netdev-dpdk: add support for jumbo frames")
    >     > ---
    >     >  lib/netdev-dpdk.c | 9 +++++----
    >     >  1 file changed, 5 insertions(+), 4 deletions(-)
    >     > 
    >     > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ddc651b..858d995
    >     > 100644
    >     > --- a/lib/netdev-dpdk.c
    >     > +++ b/lib/netdev-dpdk.c
    >     > @@ -571,10 +571,11 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk
    >     > *dev)
    >     > 
    >     >      mp = dpdk_mp_get(dev->requested_socket_id,
    >     > FRAME_LEN_TO_MTU(buf_size));
    >     >      if (!mp) {
    >     > -        VLOG_ERR("Insufficient memory to create memory pool for netdev "
    >     > -                 "%s, with MTU %d on socket %d\n",
    >     > -                 dev->up.name, dev->requested_mtu, dev-
    >     > >requested_socket_id);
    >     > -        return ENOMEM;
    >     > +        VLOG_ERR("Failed to create memory pool for netdev "
    >     > +                 "%s, with MTU %d on socket %d: %s\n",
    >     > +                 dev->up.name, dev->requested_mtu, dev-
    >     > >requested_socket_id,
    >     > +                 rte_strerror(rte_errno));
    >     > +        return rte_errno;
    >     >      } else {
    >     >          dpdk_mp_put(dev->dpdk_mp);
    >     >          dev->dpdk_mp = mp;
    >     > --
    >     
    >     LGTM,
    >     
    >     Acked-by: Ian Stokes <ian.stokes@intel.com>
    >     _______________________________________________
    >     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=rHNfhapnunpdSieFttCrIEo6q9W5-AWLYwHHz2_xGcc&s=XuLt4RImAA0v8RMjewVcw0qEIwbaRN9g5ZUWHgpl1q0&e= 
    >     
    > 
    > _______________________________________________
    > dev mailing list
    > dev@openvswitch.org
    > https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwIBAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=S3ECK2lzJLndMOyUW15rHESiD31XWikkz61RCbMGj8s&s=UlT8nlxmhVpmfbPGn4yvDb63igi9w5gYVmJi2Xy-iGc&e=
Ben Pfaff May 3, 2017, 7:32 p.m. UTC | #5
Done.

On Wed, May 03, 2017 at 06:47:09PM +0000, Darrell Ball wrote:
> Please apply to 2.6 and 2.7
> 
> Thanks Darrell
> 
> On 5/3/17, 11:36 AM, "Ben Pfaff" <blp@ovn.org> wrote:
> 
>     Thanks everyone, I applied this to master.
>     
>     Let me know if this should be applied to older branches.
>     
>     On Wed, May 03, 2017 at 02:00:31AM +0000, Darrell Ball wrote:
>     > Acked-by: Darrell Ball <dlu998@gmail.com>
>     > 
>     > On 3/13/17, 4:46 AM, "ovs-dev-bounces@openvswitch.org on behalf of Stokes, Ian" <ovs-dev-bounces@openvswitch.org on behalf of ian.stokes@intel.com> wrote:
>     > 
>     >     > netdev_dpdk_mempool_configure obtains a handle to a DPDK memory pool via a
>     >     > call to dpdk_mp_get. If dpdk_mp_get fails, the former informs the user
>     >     > that insufficient memory is available, and  returns ENOMEM. However, this
>     >     > is potentially misleading, as there are a number of reasons why creation
>     >     > of a mempool can fail (as per rte_mempool_create),
>     >     > including:
>     >     >    - insufficient memory available
>     >     >    - mempool already exists
>     >     >    - other memory allocation error
>     >     > 
>     >     > Update the error log to reflect this fact, and return rte_errno in the
>     >     > event of error, instead of ENOMEM.
>     >     > 
>     >     > Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
>     >     > Fixes: 0072e931 ("netdev-dpdk: add support for jumbo frames")
>     >     > ---
>     >     >  lib/netdev-dpdk.c | 9 +++++----
>     >     >  1 file changed, 5 insertions(+), 4 deletions(-)
>     >     > 
>     >     > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ddc651b..858d995
>     >     > 100644
>     >     > --- a/lib/netdev-dpdk.c
>     >     > +++ b/lib/netdev-dpdk.c
>     >     > @@ -571,10 +571,11 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk
>     >     > *dev)
>     >     > 
>     >     >      mp = dpdk_mp_get(dev->requested_socket_id,
>     >     > FRAME_LEN_TO_MTU(buf_size));
>     >     >      if (!mp) {
>     >     > -        VLOG_ERR("Insufficient memory to create memory pool for netdev "
>     >     > -                 "%s, with MTU %d on socket %d\n",
>     >     > -                 dev->up.name, dev->requested_mtu, dev-
>     >     > >requested_socket_id);
>     >     > -        return ENOMEM;
>     >     > +        VLOG_ERR("Failed to create memory pool for netdev "
>     >     > +                 "%s, with MTU %d on socket %d: %s\n",
>     >     > +                 dev->up.name, dev->requested_mtu, dev-
>     >     > >requested_socket_id,
>     >     > +                 rte_strerror(rte_errno));
>     >     > +        return rte_errno;
>     >     >      } else {
>     >     >          dpdk_mp_put(dev->dpdk_mp);
>     >     >          dev->dpdk_mp = mp;
>     >     > --
>     >     
>     >     LGTM,
>     >     
>     >     Acked-by: Ian Stokes <ian.stokes@intel.com>
>     >     _______________________________________________
>     >     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=rHNfhapnunpdSieFttCrIEo6q9W5-AWLYwHHz2_xGcc&s=XuLt4RImAA0v8RMjewVcw0qEIwbaRN9g5ZUWHgpl1q0&e= 
>     >     
>     > 
>     > _______________________________________________
>     > dev mailing list
>     > dev@openvswitch.org
>     > https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwIBAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=S3ECK2lzJLndMOyUW15rHESiD31XWikkz61RCbMGj8s&s=UlT8nlxmhVpmfbPGn4yvDb63igi9w5gYVmJi2Xy-iGc&e= 
>     
>
diff mbox

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index ddc651b..858d995 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -571,10 +571,11 @@  netdev_dpdk_mempool_configure(struct netdev_dpdk *dev)
 
     mp = dpdk_mp_get(dev->requested_socket_id, FRAME_LEN_TO_MTU(buf_size));
     if (!mp) {
-        VLOG_ERR("Insufficient memory to create memory pool for netdev "
-                 "%s, with MTU %d on socket %d\n",
-                 dev->up.name, dev->requested_mtu, dev->requested_socket_id);
-        return ENOMEM;
+        VLOG_ERR("Failed to create memory pool for netdev "
+                 "%s, with MTU %d on socket %d: %s\n",
+                 dev->up.name, dev->requested_mtu, dev->requested_socket_id,
+                 rte_strerror(rte_errno));
+        return rte_errno;
     } else {
         dpdk_mp_put(dev->dpdk_mp);
         dev->dpdk_mp = mp;