[spp] [PATCH 1/3] shared: add rte prefix for DPDK v19.08

Yasufumi Ogawa yasufum.o at gmail.com
Fri Sep 27 13:53:47 CEST 2019


As some structs and functions were renamed in DPDK while updating to
v19.08, this update is to follow the update.

>From this update, it cannot compile with DPDK vf19.05 or before.

Signed-off-by: Yasufumi Ogawa <yasufum.o at gmail.com>
---
 src/shared/secondary/add_port.c               |  6 ++--
 .../secondary/spp_worker_th/cmd_utils.c       |  2 +-
 .../secondary/spp_worker_th/port_capability.c | 30 +++++++++----------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/shared/secondary/add_port.c b/src/shared/secondary/add_port.c
index 2981085..b072140 100644
--- a/src/shared/secondary/add_port.c
+++ b/src/shared/secondary/add_port.c
@@ -142,7 +142,7 @@ int
 add_vhost_pmd(int index)
 {
 	struct rte_eth_conf port_conf = {
-		.rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN }
+		.rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN }
 	};
 	struct rte_mempool *mp;
 	uint16_t vhost_port_id;
@@ -225,7 +225,7 @@ int
 add_pcap_pmd(int index)
 {
 	struct rte_eth_conf port_conf = {
-		.rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN }
+		.rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN }
 	};
 
 	struct rte_mempool *mp;
@@ -306,7 +306,7 @@ int
 add_null_pmd(int index)
 {
 	struct rte_eth_conf port_conf = {
-			.rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN }
+			.rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN }
 	};
 
 	struct rte_mempool *mp;
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index f3d5de8..010a4b6 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -759,7 +759,7 @@ sppwk_convert_mac_str_to_int64(const char *macaddr)
 			break;
 
 		/* Check for mal-formatted address */
-		if (unlikely(token_cnt >= ETHER_ADDR_LEN)) {
+		if (unlikely(token_cnt >= RTE_ETHER_ADDR_LEN)) {
 			RTE_LOG(ERR, WK_CMD_UTILS,
 					"Invalid MAC address `%s`.\n",
 					macaddr);
diff --git a/src/shared/secondary/spp_worker_th/port_capability.c b/src/shared/secondary/spp_worker_th/port_capability.c
index ccef496..5435db0 100644
--- a/src/shared/secondary/spp_worker_th/port_capability.c
+++ b/src/shared/secondary/spp_worker_th/port_capability.c
@@ -57,7 +57,7 @@ void
 sppwk_port_capability_init(void)
 {
 	int cnt = 0;
-	g_vlan_tpid = rte_cpu_to_be_16(ETHER_TYPE_VLAN);
+	g_vlan_tpid = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN);
 	memset(g_port_mng_info, 0x00, sizeof(g_port_mng_info));
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
 		g_port_mng_info[cnt].rx.ref_index = 0;
@@ -105,28 +105,28 @@ add_vlan_tag_one(
 		struct rte_mbuf *pkt,
 		const union sppwk_port_capability *capability)
 {
-	struct ether_hdr *old_ether = NULL;
-	struct ether_hdr *new_ether = NULL;
-	struct vlan_hdr  *vlan      = NULL;
+	struct rte_ether_hdr *old_ether = NULL;
+	struct rte_ether_hdr *new_ether = NULL;
+	struct rte_vlan_hdr  *vlan      = NULL;
 	const struct sppwk_vlan_tag *vlantag = &capability->vlantag;
 
-	old_ether = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	old_ether = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
 	if (old_ether->ether_type == g_vlan_tpid) {
 		/* For packets with VLAN tags, only VLAN ID is updated */
 		new_ether = old_ether;
-		vlan = (struct vlan_hdr *)&new_ether[1];
+		vlan = (struct rte_vlan_hdr *)&new_ether[1];
 	} else {
 		/* For packets without VLAN tag, add VLAN tag. */
-		new_ether = (struct ether_hdr *)rte_pktmbuf_prepend(pkt,
-				sizeof(struct vlan_hdr));
+		new_ether = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt,
+				sizeof(struct rte_vlan_hdr));
 		if (unlikely(new_ether == NULL)) {
 			RTE_LOG(ERR, PORT, "Failed to "
 					"get additional header area.\n");
 			return SPPWK_RET_NG;
 		}
 
-		rte_memcpy(new_ether, old_ether, sizeof(struct ether_hdr));
-		vlan = (struct vlan_hdr *)&new_ether[1];
+		rte_memcpy(new_ether, old_ether, sizeof(struct rte_ether_hdr));
+		vlan = (struct rte_vlan_hdr *)&new_ether[1];
 		vlan->eth_proto = new_ether->ether_type;
 		new_ether->ether_type = g_vlan_tpid;
 	}
@@ -162,15 +162,15 @@ del_vlan_tag_one(
 		struct rte_mbuf *pkt,
 		const union sppwk_port_capability *cbl __attribute__ ((unused)))
 {
-	struct ether_hdr *old_ether = NULL;
-	struct ether_hdr *new_ether = NULL;
+	struct rte_ether_hdr *old_ether = NULL;
+	struct rte_ether_hdr *new_ether = NULL;
 	uint32_t *old, *new;
 
-	old_ether = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	old_ether = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
 	if (old_ether->ether_type == g_vlan_tpid) {
 		/* For packets without VLAN tag, delete VLAN tag. */
-		new_ether = (struct ether_hdr *)rte_pktmbuf_adj(pkt,
-				sizeof(struct vlan_hdr));
+		new_ether = (struct rte_ether_hdr *)rte_pktmbuf_adj(pkt,
+				sizeof(struct rte_vlan_hdr));
 		if (unlikely(new_ether == NULL)) {
 			RTE_LOG(ERR, PORT, "Failed to "
 					"delete unnecessary header area.\n");
-- 
2.17.1



More information about the spp mailing list