git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
examples: fix port mask parsing failure handling
[dpdk.git]
/
examples
/
distributor
/
main.c
diff --git
a/examples/distributor/main.c
b/examples/distributor/main.c
index
49b4e61
..
dca48c2
100644
(file)
--- a/
examples/distributor/main.c
+++ b/
examples/distributor/main.c
@@
-192,7
+192,13
@@
port_init(uint16_t port, struct rte_mempool *mbuf_pool)
}
struct rte_ether_addr addr;
}
struct rte_ether_addr addr;
- rte_eth_macaddr_get(port, &addr);
+ retval = rte_eth_macaddr_get(port, &addr);
+ if (retval < 0) {
+ printf("Failed to get MAC address (port %u): %s\n",
+ port, rte_strerror(-retval));
+ return retval;
+ }
+
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
port,
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
port,
@@
-641,10
+647,7
@@
parse_portmask(const char *portmask)
/* parse hexadecimal string */
pm = strtoul(portmask, &end, 16);
if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
/* parse hexadecimal string */
pm = strtoul(portmask, &end, 16);
if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
- return -1;
-
- if (pm == 0)
- return -1;
+ return 0;
return pm;
}
return pm;
}