From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> Hi, Compiling SPP without `-std=c99` for C99 mode is failed on some environment such as CentOS7. It is required to be enable to compile without specific options on every envs. This series of patches is to update for compilation on CentOS7 without C99 mode option. Yasufumi Ogawa (3): spp_nfv: remove declaration in for loop spp_primary: remove declaration in for loop spp_vf: change inline func calls static inside src/nfv/main.c | 2 +- src/nfv/nfv_status.c | 4 ++-- src/nfv/nfv_utils.h | 3 ++- src/primary/init.c | 3 ++- src/vf/common/spp_port.c | 6 +++--- 5 files changed, 10 insertions(+), 8 deletions(-) -- 2.7.4
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> For some environment, declaration in for loop cause an error. error: ‘for’ loop initial declarations are only allowed in C99 mode This update is move this declaration from. Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> --- src/nfv/main.c | 2 +- src/nfv/nfv_status.c | 4 ++-- src/nfv/nfv_utils.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nfv/main.c b/src/nfv/main.c index 4ecc553..fbcef0c 100644 --- a/src/nfv/main.c +++ b/src/nfv/main.c @@ -248,7 +248,7 @@ main(int argc, char *argv[]) lcore_id_used[lcore_id] = 1; } sprintf(log_msg, "Used lcores: "); - for (int i = 0; i < RTE_MAX_LCORE; i++) { + for (i = 0; i < RTE_MAX_LCORE; i++) { if (lcore_id_used[i] == 1) sprintf(log_msg + strlen(log_msg), "%d ", i); } diff --git a/src/nfv/nfv_status.c b/src/nfv/nfv_status.c index a3ad597..d29e083 100644 --- a/src/nfv/nfv_status.c +++ b/src/nfv/nfv_status.c @@ -54,9 +54,9 @@ int append_lcore_info_json(char *str, uint8_t lcore_id_used[RTE_MAX_LCORE]) { - + int i; sprintf(str + strlen(str), "\"lcores\":["); - for (int i = 0; i < RTE_MAX_LCORE; i++) { + for (i = 0; i < RTE_MAX_LCORE; i++) { if (lcore_id_used[i] == 1) sprintf(str + strlen(str), "%d,", i); } diff --git a/src/nfv/nfv_utils.h b/src/nfv/nfv_utils.h index aca5f13..9d4f9dd 100644 --- a/src/nfv/nfv_utils.h +++ b/src/nfv/nfv_utils.h @@ -107,7 +107,8 @@ forward_array_reset(void) /* Return a type of port as a enum member of porttype_map structure. */ static enum port_type get_port_type(char *portname) { - for (int i = 0; portmap[i].port_name != NULL; i++) { + int i; + for (i = 0; portmap[i].port_name != NULL; i++) { const char *port_name = portmap[i].port_name; if (strncmp(portname, port_name, strlen(port_name)) == 0) return portmap[i].port_type; -- 2.7.4
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> For some environment, declaration in for loop cause an error. This update is to move it from. Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> --- src/primary/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/primary/init.c b/src/primary/init.c index 28ad0a7..60e5c47 100644 --- a/src/primary/init.c +++ b/src/primary/init.c @@ -111,6 +111,7 @@ init(int argc, char *argv[]) const struct rte_memzone *mz; uint16_t count, total_ports; char log_msg[1024] = { '\0' }; /* temporary log message */ + int i; /* init EAL, parsing EAL args */ retval = rte_eal_init(argc, argv); @@ -169,7 +170,7 @@ init(int argc, char *argv[]) lcore_id_used[lcore_id] = 1; } sprintf(log_msg, "Used lcores: "); - for (int i = 0; i < RTE_MAX_LCORE; i++) { + for (i = 0; i < RTE_MAX_LCORE; i++) { if (lcore_id_used[i] == 1) sprintf(log_msg + strlen(log_msg), "%d ", i); } -- 2.7.4
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> Change `extern inline` funcitons to static to avoid compile error like as following in some environments. error: ‘rte_eth_tx_burst’ is static but used in inline function ‘spp_eth_tx_burst’ which is not static In this case, static rte_eth_tx_burst() should not be called from inline function. Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> --- src/vf/common/spp_port.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vf/common/spp_port.c b/src/vf/common/spp_port.c index fd76d79..06422c3 100644 --- a/src/vf/common/spp_port.c +++ b/src/vf/common/spp_port.c @@ -57,7 +57,7 @@ spp_port_ability_init(void) } /* Get information of port ability. */ -extern inline void +void spp_port_ability_get_info( int port_id, enum spp_port_rxtx rxtx, struct spp_port_ability **info) @@ -365,7 +365,7 @@ port_ability_each_operation(uint16_t port_id, } /* Wrapper function for rte_eth_rx_burst(). */ -extern inline uint16_t +uint16_t spp_eth_rx_burst( uint16_t port_id, uint16_t queue_id __attribute__ ((unused)), struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) @@ -387,7 +387,7 @@ spp_eth_rx_burst( } /* Wrapper function for rte_eth_tx_burst(). */ -extern inline uint16_t +uint16_t spp_eth_tx_burst( uint16_t port_id, uint16_t queue_id __attribute__ ((unused)), struct rte_mbuf **tx_pkts, uint16_t nb_pkts) -- 2.7.4