[dpdk-dev] [PATCH] lib/librte_ether: error handling on MAC address replay

Steve Shin jonshin at cisco.com
Thu Jan 19 19:47:21 CET 2017


This patch fixes a bug in replaying MAC address to the hardware
in rte_eth_dev_config_restore() routine.

Signed-off-by: Steve Shin <jonshin at cisco.com>
---
 lib/librte_ether/rte_ethdev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 4790faf..7e01f10 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -951,10 +951,12 @@ rte_eth_dev_config_restore(uint8_t port_id)
 			continue;
 
 		/* add address to the hardware */
-		if  (*dev->dev_ops->mac_addr_add &&
-			(dev->data->mac_pool_sel[i] & (1ULL << pool)))
-			(*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
-		else {
+		if  (*dev->dev_ops->mac_addr_add) {
+			if (dev->data->mac_pool_sel[i] & (1ULL << pool))
+				(*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
+			else
+				continue;
+		} else {
 			RTE_PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
 					port_id);
 			/* exit the loop but not return an error */
-- 
2.9.3



More information about the dev mailing list