1*af75078fSIntel /*- 2*af75078fSIntel * BSD LICENSE 3*af75078fSIntel * 4*af75078fSIntel * Copyright(c) 2010-2012 Intel Corporation. All rights reserved. 5*af75078fSIntel * All rights reserved. 6*af75078fSIntel * 7*af75078fSIntel * Redistribution and use in source and binary forms, with or without 8*af75078fSIntel * modification, are permitted provided that the following conditions 9*af75078fSIntel * are met: 10*af75078fSIntel * 11*af75078fSIntel * * Redistributions of source code must retain the above copyright 12*af75078fSIntel * notice, this list of conditions and the following disclaimer. 13*af75078fSIntel * * Redistributions in binary form must reproduce the above copyright 14*af75078fSIntel * notice, this list of conditions and the following disclaimer in 15*af75078fSIntel * the documentation and/or other materials provided with the 16*af75078fSIntel * distribution. 17*af75078fSIntel * * Neither the name of Intel Corporation nor the names of its 18*af75078fSIntel * contributors may be used to endorse or promote products derived 19*af75078fSIntel * from this software without specific prior written permission. 20*af75078fSIntel * 21*af75078fSIntel * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22*af75078fSIntel * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23*af75078fSIntel * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24*af75078fSIntel * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25*af75078fSIntel * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26*af75078fSIntel * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27*af75078fSIntel * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28*af75078fSIntel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29*af75078fSIntel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30*af75078fSIntel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31*af75078fSIntel * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32*af75078fSIntel * 33*af75078fSIntel * version: DPDK.L.1.2.3-3 34*af75078fSIntel */ 35*af75078fSIntel 36*af75078fSIntel #include <stdio.h> 37*af75078fSIntel #include <string.h> 38*af75078fSIntel #include <stdint.h> 39*af75078fSIntel #include <errno.h> 40*af75078fSIntel #include <sys/queue.h> 41*af75078fSIntel 42*af75078fSIntel #include <rte_memory.h> 43*af75078fSIntel #include <rte_memzone.h> 44*af75078fSIntel #include <rte_launch.h> 45*af75078fSIntel #include <rte_tailq.h> 46*af75078fSIntel #include <rte_eal.h> 47*af75078fSIntel #include <rte_per_lcore.h> 48*af75078fSIntel #include <rte_lcore.h> 49*af75078fSIntel #include <rte_debug.h> 50*af75078fSIntel 51*af75078fSIntel #include "main.h" 52*af75078fSIntel 53*af75078fSIntel static int 54*af75078fSIntel lcore_hello(__attribute__((unused)) void *arg) 55*af75078fSIntel { 56*af75078fSIntel unsigned lcore_id; 57*af75078fSIntel lcore_id = rte_lcore_id(); 58*af75078fSIntel printf("hello from core %u\n", lcore_id); 59*af75078fSIntel return 0; 60*af75078fSIntel } 61*af75078fSIntel 62*af75078fSIntel int 63*af75078fSIntel MAIN(int argc, char **argv) 64*af75078fSIntel { 65*af75078fSIntel int ret; 66*af75078fSIntel unsigned lcore_id; 67*af75078fSIntel 68*af75078fSIntel ret = rte_eal_init(argc, argv); 69*af75078fSIntel if (ret < 0) 70*af75078fSIntel rte_panic("Cannot init EAL\n"); 71*af75078fSIntel 72*af75078fSIntel /* call lcore_hello() on every slave lcore */ 73*af75078fSIntel RTE_LCORE_FOREACH_SLAVE(lcore_id) { 74*af75078fSIntel rte_eal_remote_launch(lcore_hello, NULL, lcore_id); 75*af75078fSIntel } 76*af75078fSIntel 77*af75078fSIntel /* call it on master lcore too */ 78*af75078fSIntel lcore_hello(NULL); 79*af75078fSIntel 80*af75078fSIntel rte_eal_mp_wait_lcore(); 81*af75078fSIntel return 0; 82*af75078fSIntel } 83