From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CC5A4A2E8C for ; Thu, 5 Sep 2019 16:53:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7D0561F02F; Thu, 5 Sep 2019 16:53:42 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id DF3771EFC4; Thu, 5 Sep 2019 16:53:31 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2019 07:53:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,470,1559545200"; d="scan'208";a="182846386" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.223.78]) by fmsmga008.fm.intel.com with ESMTP; 05 Sep 2019 07:53:30 -0700 From: Ferruh Yigit To: Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 5 Sep 2019 15:53:13 +0100 Message-Id: <20190905145315.19395-9-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905145315.19395-1-ferruh.yigit@intel.com> References: <20190905145315.19395-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH 08/10] app/testpmd: fix global variable multiple definitions X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Some flow config related global variables are defined in a header file which was causing multiple definitions of the variables, fixed it by moving them to the .c file. Issue has been detected by '-fno-common' gcc flag. Also while being there, removed duplicated 'ACTION_RAW_ENCAP_MAX_DAT definition, moved 'vxlan_encap_conf' & 'nvgre_encap_conf' initialization to 'cmdline_flow.c' which is better location than 'testpmd.c' relocated 'action_raw_encap_data' & 'action_raw_decap_data' struct definitions slightly within the file Fixes: 1960be7d32f8 ("app/testpmd: add VXLAN encap/decap") Fixes: dcd962fc6b4e ("app/testpmd: add NVGRE encap/decap") Fixes: a1191d39cb57 ("app/testpmd: add MPLSoUDP encapsulation") Fixes: 3e77031be855 ("app/testpmd: add MPLSoGRE encapsulation") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit --- app/test-pmd/cmdline_flow.c | 77 +++++++++++++++++++++++++++++-------- app/test-pmd/testpmd.c | 35 ----------------- app/test-pmd/testpmd.h | 18 +++++---- 3 files changed, 71 insertions(+), 59 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 369426cbd..bc2ba7987 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -316,9 +316,7 @@ struct action_rss_data { uint16_t queue[ACTION_RSS_QUEUE_NUM]; }; -/** Maximum number of items in struct rte_flow_action_vxlan_encap. */ -#define ACTION_VXLAN_ENCAP_ITEMS_NUM 6 - +/** Maximum data size in struct rte_flow_action_raw_encap. */ #define ACTION_RAW_ENCAP_MAX_DATA 128 /** Storage for struct rte_flow_action_raw_encap. */ @@ -330,6 +328,13 @@ struct raw_encap_conf { struct raw_encap_conf raw_encap_conf = {.size = 0}; +/** Storage for struct rte_flow_action_raw_encap including external data. */ +struct action_raw_encap_data { + struct rte_flow_action_raw_encap conf; + uint8_t data[ACTION_RAW_ENCAP_MAX_DATA]; + uint8_t preserve[ACTION_RAW_ENCAP_MAX_DATA]; +}; + /** Storage for struct rte_flow_action_raw_decap. */ struct raw_decap_conf { uint8_t data[ACTION_RAW_ENCAP_MAX_DATA]; @@ -338,6 +343,35 @@ struct raw_decap_conf { struct raw_decap_conf raw_decap_conf = {.size = 0}; +/** Storage for struct rte_flow_action_raw_decap including external data. */ +struct action_raw_decap_data { + struct rte_flow_action_raw_decap conf; + uint8_t data[ACTION_RAW_ENCAP_MAX_DATA]; +}; + +struct vxlan_encap_conf vxlan_encap_conf = { + .select_ipv4 = 1, + .select_vlan = 0, + .select_tos_ttl = 0, + .vni = "\x00\x00\x00", + .udp_src = 0, + .udp_dst = RTE_BE16(4789), + .ipv4_src = RTE_IPV4(127, 0, 0, 1), + .ipv4_dst = RTE_IPV4(255, 255, 255, 255), + .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x01", + .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x11\x11", + .vlan_tci = 0, + .ip_tos = 0, + .ip_ttl = 255, + .eth_src = "\x00\x00\x00\x00\x00\x00", + .eth_dst = "\xff\xff\xff\xff\xff\xff", +}; + +/** Maximum number of items in struct rte_flow_action_vxlan_encap. */ +#define ACTION_VXLAN_ENCAP_ITEMS_NUM 6 + /** Storage for struct rte_flow_action_vxlan_encap including external data. */ struct action_vxlan_encap_data { struct rte_flow_action_vxlan_encap conf; @@ -352,6 +386,21 @@ struct action_vxlan_encap_data { struct rte_flow_item_vxlan item_vxlan; }; +struct nvgre_encap_conf nvgre_encap_conf = { + .select_ipv4 = 1, + .select_vlan = 0, + .tni = "\x00\x00\x00", + .ipv4_src = RTE_IPV4(127, 0, 0, 1), + .ipv4_dst = RTE_IPV4(255, 255, 255, 255), + .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x01", + .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x11\x11", + .vlan_tci = 0, + .eth_src = "\x00\x00\x00\x00\x00\x00", + .eth_dst = "\xff\xff\xff\xff\xff\xff", +}; + /** Maximum number of items in struct rte_flow_action_nvgre_encap. */ #define ACTION_NVGRE_ENCAP_ITEMS_NUM 5 @@ -368,21 +417,17 @@ struct action_nvgre_encap_data { struct rte_flow_item_nvgre item_nvgre; }; -/** Maximum data size in struct rte_flow_action_raw_encap. */ -#define ACTION_RAW_ENCAP_MAX_DATA 128 +struct l2_encap_conf l2_encap_conf; -/** Storage for struct rte_flow_action_raw_encap including external data. */ -struct action_raw_encap_data { - struct rte_flow_action_raw_encap conf; - uint8_t data[ACTION_RAW_ENCAP_MAX_DATA]; - uint8_t preserve[ACTION_RAW_ENCAP_MAX_DATA]; -}; +struct l2_decap_conf l2_decap_conf; -/** Storage for struct rte_flow_action_raw_decap including external data. */ -struct action_raw_decap_data { - struct rte_flow_action_raw_decap conf; - uint8_t data[ACTION_RAW_ENCAP_MAX_DATA]; -}; +struct mplsogre_encap_conf mplsogre_encap_conf; + +struct mplsogre_decap_conf mplsogre_decap_conf; + +struct mplsoudp_encap_conf mplsoudp_encap_conf; + +struct mplsoudp_decap_conf mplsoudp_decap_conf; /** Maximum number of subsequent tokens and arguments on the stack. */ #define CTX_STACK_SIZE 16 diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index cbf73e685..e301563d6 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -478,41 +478,6 @@ uint8_t bitrate_enabled; struct gro_status gro_ports[RTE_MAX_ETHPORTS]; uint8_t gro_flush_cycles = GRO_DEFAULT_FLUSH_CYCLES; -struct vxlan_encap_conf vxlan_encap_conf = { - .select_ipv4 = 1, - .select_vlan = 0, - .select_tos_ttl = 0, - .vni = "\x00\x00\x00", - .udp_src = 0, - .udp_dst = RTE_BE16(4789), - .ipv4_src = RTE_IPV4(127, 0, 0, 1), - .ipv4_dst = RTE_IPV4(255, 255, 255, 255), - .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x01", - .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x11\x11", - .vlan_tci = 0, - .ip_tos = 0, - .ip_ttl = 255, - .eth_src = "\x00\x00\x00\x00\x00\x00", - .eth_dst = "\xff\xff\xff\xff\xff\xff", -}; - -struct nvgre_encap_conf nvgre_encap_conf = { - .select_ipv4 = 1, - .select_vlan = 0, - .tni = "\x00\x00\x00", - .ipv4_src = RTE_IPV4(127, 0, 0, 1), - .ipv4_dst = RTE_IPV4(255, 255, 255, 255), - .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x01", - .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x11\x11", - .vlan_tci = 0, - .eth_src = "\x00\x00\x00\x00\x00\x00", - .eth_dst = "\xff\xff\xff\xff\xff\xff", -}; - /* Forward function declarations */ static void setup_attached_port(portid_t pi); static void map_port_queue_stats_mapping_registers(portid_t pi, diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index d73955da1..79adebaeb 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -507,7 +507,8 @@ struct vxlan_encap_conf { uint8_t eth_src[RTE_ETHER_ADDR_LEN]; uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; -struct vxlan_encap_conf vxlan_encap_conf; + +extern struct vxlan_encap_conf vxlan_encap_conf; /* NVGRE encap/decap parameters. */ struct nvgre_encap_conf { @@ -522,7 +523,8 @@ struct nvgre_encap_conf { uint8_t eth_src[RTE_ETHER_ADDR_LEN]; uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; -struct nvgre_encap_conf nvgre_encap_conf; + +extern struct nvgre_encap_conf nvgre_encap_conf; /* L2 encap parameters. */ struct l2_encap_conf { @@ -532,13 +534,13 @@ struct l2_encap_conf { uint8_t eth_src[RTE_ETHER_ADDR_LEN]; uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; -struct l2_encap_conf l2_encap_conf; +extern struct l2_encap_conf l2_encap_conf; /* L2 decap parameters. */ struct l2_decap_conf { uint32_t select_vlan:1; }; -struct l2_decap_conf l2_decap_conf; +extern struct l2_decap_conf l2_decap_conf; /* MPLSoGRE encap parameters. */ struct mplsogre_encap_conf { @@ -553,14 +555,14 @@ struct mplsogre_encap_conf { uint8_t eth_src[RTE_ETHER_ADDR_LEN]; uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; -struct mplsogre_encap_conf mplsogre_encap_conf; +extern struct mplsogre_encap_conf mplsogre_encap_conf; /* MPLSoGRE decap parameters. */ struct mplsogre_decap_conf { uint32_t select_ipv4:1; uint32_t select_vlan:1; }; -struct mplsogre_decap_conf mplsogre_decap_conf; +extern struct mplsogre_decap_conf mplsogre_decap_conf; /* MPLSoUDP encap parameters. */ struct mplsoudp_encap_conf { @@ -577,14 +579,14 @@ struct mplsoudp_encap_conf { uint8_t eth_src[RTE_ETHER_ADDR_LEN]; uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; -struct mplsoudp_encap_conf mplsoudp_encap_conf; +extern struct mplsoudp_encap_conf mplsoudp_encap_conf; /* MPLSoUDP decap parameters. */ struct mplsoudp_decap_conf { uint32_t select_ipv4:1; uint32_t select_vlan:1; }; -struct mplsoudp_decap_conf mplsoudp_decap_conf; +extern struct mplsoudp_decap_conf mplsoudp_decap_conf; static inline unsigned int lcore_num(void) -- 2.21.0