From: Anatoly Burakov Date: Wed, 18 Jun 2014 14:50:35 +0000 (+0100) Subject: examples/ip_frag: check for non-existent ports X-Git-Tag: spdx-start~10585 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=eaa8d3bf6d0f6405648fdc6eb9b1a73c08d2cef6;p=dpdk.git examples/ip_frag: check for non-existent ports Signed-off-by: Anatoly Burakov Acked-by: Thomas Monjalon --- diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 02e40a1357..ac575553c4 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -886,6 +886,10 @@ MAIN(int argc, char **argv) if (init_mem() < 0) rte_panic("Cannot initialize memory structures!\n"); + /* check if portmask has non-existent ports */ + if (enabled_port_mask & ~(RTE_LEN2MASK(nb_ports, unsigned))) + rte_exit(EXIT_FAILURE, "Non-existent ports in portmask!\n"); + /* initialize all ports */ for (portid = 0; portid < nb_ports; portid++) { /* skip ports that are not enabled */ diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 7311b29f07..d612c311b2 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -1093,6 +1093,10 @@ MAIN(int argc, char **argv) if (init_mem() < 0) rte_panic("Cannot initialize memory structures!\n"); + /* check if portmask has non-existent ports */ + if (enabled_port_mask & ~(RTE_LEN2MASK(nb_ports, unsigned))) + rte_exit(EXIT_FAILURE, "Non-existent ports in portmask!\n"); + /* initialize all ports */ for (portid = 0; portid < nb_ports; portid++) { /* skip ports that are not enabled */