[dpdk-dev] bond: replace rte_panic with errno code return

Message ID 1464362453-5732-2-git-send-email-michalx.k.jastrzebski@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Michal Jastrzebski May 27, 2016, 3:20 p.m. UTC
  This patch modifies bond_mode_alb_enable function.
When mempool allocation fails errno code is returned
instead of rte_panic. This allow to decide on application level
if it should quit or retry for mempool allocation.

Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
---
 drivers/net/bonding/rte_eth_bond_alb.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Iremonger, Bernard May 27, 2016, 4:13 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michal Jastrzebski
> Sent: Friday, May 27, 2016 4:21 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] bond: replace rte_panic with errno code return
> 
> This patch modifies bond_mode_alb_enable function.
> When mempool allocation fails errno code is returned instead of rte_panic.
> This allow to decide on application level if it should quit or retry for mempool
> allocation.
> 
> Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>

Acked-by: Bernard Iremonger<bernard.iremonger@intel.com>
  
Bruce Richardson June 13, 2016, 1:57 p.m. UTC | #2
On Fri, May 27, 2016 at 04:13:04PM +0000, Iremonger, Bernard wrote:
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michal Jastrzebski
> > Sent: Friday, May 27, 2016 4:21 PM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH] bond: replace rte_panic with errno code return
> > 
> > This patch modifies bond_mode_alb_enable function.
> > When mempool allocation fails errno code is returned instead of rte_panic.
> > This allow to decide on application level if it should quit or retry for mempool
> > allocation.
> > 
> > Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
> 
> Acked-by: Bernard Iremonger<bernard.iremonger@intel.com>
> 
Applied to dpdk-next-net/rel_16_07

/Bruce
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c
index 3157543..194c1da 100644
--- a/drivers/net/bonding/rte_eth_bond_alb.c
+++ b/drivers/net/bonding/rte_eth_bond_alb.c
@@ -90,14 +90,14 @@  bond_mode_alb_enable(struct rte_eth_dev *bond_dev)
 		if (internals->mode6.mempool == NULL) {
 			RTE_LOG(ERR, PMD, "%s: Failed to initialize ALB mempool.\n",
 					bond_dev->data->name);
-			rte_panic(
-					"Failed to allocate memory pool ('%s')\n"
-					"for bond device '%s'\n",
-					mem_name, bond_dev->data->name);
+			goto mempool_alloc_error;
 		}
 	}
 
 	return 0;
+
+	mempool_alloc_error:
+	return -ENOMEM;
 }
 
 void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset,