X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fexception_path%2Fmain.c;h=0bc149dacc40ff6c0e88346db7d136de5cb2bd2c;hb=e9d48c0072d36eb6423b45fba4ec49d0def6c36f;hp=356ec3aaed89dd5c87f78068e5bb89efa5f3fcec;hpb=cdfd5dbb90b05e198b436f97f0ba320d7cd7d8ad;p=dpdk.git diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index 356ec3aaed..0bc149dacc 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -1,35 +1,34 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2013 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ #include @@ -157,10 +156,10 @@ static struct rte_mempool * pktmbuf_pool = NULL; static uint32_t ports_mask = 0; /* Mask of cores that read from NIC and write to tap */ -static uint32_t input_cores_mask = 0; +static uint64_t input_cores_mask = 0; /* Mask of cores that read from tap and write to NIC */ -static uint32_t output_cores_mask = 0; +static uint64_t output_cores_mask = 0; /* Array storing port_id that is associated with each lcore */ static uint8_t port_ids[RTE_MAX_LCORE]; @@ -252,7 +251,7 @@ main_loop(__attribute__((unused)) void *arg) char tap_name[IFNAMSIZ]; int tap_fd; - if ((1 << lcore_id) & input_cores_mask) { + if ((1ULL << lcore_id) & input_cores_mask) { /* Create new tap interface */ rte_snprintf(tap_name, IFNAMSIZ, "tap_dpdk_%.2u", lcore_id); tap_fd = tap_create(tap_name); @@ -285,7 +284,7 @@ main_loop(__attribute__((unused)) void *arg) } } } - else if ((1 << lcore_id) & output_cores_mask) { + else if ((1ULL << lcore_id) & output_cores_mask) { /* Create new tap interface */ rte_snprintf(tap_name, IFNAMSIZ, "tap_dpdk_%.2u", lcore_id); tap_fd = tap_create(tap_name); @@ -345,30 +344,30 @@ print_usage(const char *prgname) } /* Convert string to unsigned number. 0 is returned if error occurs */ -static uint32_t +static uint64_t parse_unsigned(const char *portmask) { char *end = NULL; - unsigned long num; + uint64_t num; - num = strtoul(portmask, &end, 16); + num = strtoull(portmask, &end, 16); if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) return 0; - return (uint32_t)num; + return (uint64_t)num; } /* Record affinities between ports and lcores in global port_ids[] array */ static void setup_port_lcore_affinities(void) { - unsigned i; + unsigned long i; uint8_t tx_port = 0; uint8_t rx_port = 0; /* Setup port_ids[] array, and check masks were ok */ RTE_LCORE_FOREACH(i) { - if (input_cores_mask & (1 << i)) { + if (input_cores_mask & (1ULL << i)) { /* Skip ports that are not enabled */ while ((ports_mask & (1 << rx_port)) == 0) { rx_port++; @@ -378,7 +377,7 @@ setup_port_lcore_affinities(void) port_ids[i] = rx_port++; } - else if (output_cores_mask & (1 << i)) { + else if (output_cores_mask & (1ULL << i)) { /* Skip ports that are not enabled */ while ((ports_mask & (1 << tx_port)) == 0) { tx_port++;