DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Cc: stephen@networkplumber.org, ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 01/15] net: add rte prefix to arp structures
Date: Tue, 21 May 2019 18:13:01 +0200	[thread overview]
Message-ID: <20190521161315.25500-2-olivier.matz@6wind.com> (raw)
In-Reply-To: <20190521161315.25500-1-olivier.matz@6wind.com>

Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields
to avoid conflict with the #defines in gnu libc.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test-pmd/icmpecho.c                | 24 ++++++++++-----------
 app/test/packet_burst_generator.c      | 12 +++++------
 app/test/packet_burst_generator.h      |  2 +-
 app/test/test_link_bonding.c           | 38 +++++++++++++++++++++-------------
 drivers/net/bonding/rte_eth_bond_alb.c | 26 +++++++++++------------
 drivers/net/bonding/rte_eth_bond_pmd.c | 10 +++++----
 drivers/net/i40e/i40e_fdir.c           |  4 ++--
 examples/bond/main.c                   | 26 ++++++++++++-----------
 lib/librte_net/rte_arp.c               | 14 ++++++-------
 lib/librte_net/rte_arp.h               | 16 +++++++-------
 10 files changed, 93 insertions(+), 79 deletions(-)

diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c
index 55d266d77..0f92d14ad 100644
--- a/app/test-pmd/icmpecho.c
+++ b/app/test-pmd/icmpecho.c
@@ -38,7 +38,7 @@
 static const char *
 arp_op_name(uint16_t arp_op)
 {
-	switch (arp_op ) {
+	switch (arp_op) {
 	case ARP_OP_REQUEST:
 		return "ARP Request";
 	case ARP_OP_REPLY:
@@ -277,7 +277,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 	struct rte_mbuf *pkt;
 	struct ether_hdr *eth_h;
 	struct vlan_hdr *vlan_h;
-	struct arp_hdr  *arp_h;
+	struct rte_arp_hdr  *arp_h;
 	struct ipv4_hdr *ip_h;
 	struct icmp_hdr *icmp_h;
 	struct ether_addr eth_addr;
@@ -347,22 +347,22 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 
 		/* Reply to ARP requests */
 		if (eth_type == ETHER_TYPE_ARP) {
-			arp_h = (struct arp_hdr *) ((char *)eth_h + l2_len);
-			arp_op = RTE_BE_TO_CPU_16(arp_h->arp_op);
-			arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_pro);
+			arp_h = (struct rte_arp_hdr *) ((char *)eth_h + l2_len);
+			arp_op = RTE_BE_TO_CPU_16(arp_h->arp_opcode);
+			arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_protocol);
 			if (verbose_level > 0) {
 				printf("  ARP:  hrd=%d proto=0x%04x hln=%d "
 				       "pln=%d op=%u (%s)\n",
-				       RTE_BE_TO_CPU_16(arp_h->arp_hrd),
-				       arp_pro, arp_h->arp_hln,
-				       arp_h->arp_pln, arp_op,
+				       RTE_BE_TO_CPU_16(arp_h->arp_hardware),
+				       arp_pro, arp_h->arp_hlen,
+				       arp_h->arp_plen, arp_op,
 				       arp_op_name(arp_op));
 			}
-			if ((RTE_BE_TO_CPU_16(arp_h->arp_hrd) !=
+			if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) !=
 			     ARP_HRD_ETHER) ||
 			    (arp_pro != ETHER_TYPE_IPv4) ||
-			    (arp_h->arp_hln != 6) ||
-			    (arp_h->arp_pln != 4)
+			    (arp_h->arp_hlen != 6) ||
+			    (arp_h->arp_plen != 4)
 			    ) {
 				rte_pktmbuf_free(pkt);
 				if (verbose_level > 0)
@@ -396,7 +396,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 			ether_addr_copy(&ports[fs->tx_port].eth_addr,
 					&eth_h->s_addr);
 
-			arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY);
+			arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY);
 			ether_addr_copy(&arp_h->arp_data.arp_tha, &eth_addr);
 			ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha);
 			ether_addr_copy(&eth_h->s_addr, &arp_h->arp_data.arp_sha);
diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c
index e894dc76f..0b12058bb 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -74,15 +74,15 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac,
 }
 
 void
-initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac,
+initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac,
 		struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip,
 		uint32_t opcode)
 {
-	arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER);
-	arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
-	arp_hdr->arp_hln = ETHER_ADDR_LEN;
-	arp_hdr->arp_pln = sizeof(uint32_t);
-	arp_hdr->arp_op = rte_cpu_to_be_16(opcode);
+	arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER);
+	arp_hdr->arp_protocol = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
+	arp_hdr->arp_hlen = ETHER_ADDR_LEN;
+	arp_hdr->arp_plen = sizeof(uint32_t);
+	arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode);
 	ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha);
 	arp_hdr->arp_data.arp_sip = src_ip;
 	ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha);
diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h
index c20cea6e9..b6e013a11 100644
--- a/app/test/packet_burst_generator.h
+++ b/app/test/packet_burst_generator.h
@@ -29,7 +29,7 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac,
 		uint8_t vlan_enabled, uint16_t van_id);
 
 void
-initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac,
+initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac,
 		struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip,
 		uint32_t opcode);
 
diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 0438e76cc..6ff0f5b9c 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -4469,7 +4469,7 @@ test_alb_change_mac_in_reply_sent(void)
 	struct rte_mbuf *pkts_sent[MAX_PKT_BURST];
 
 	struct ether_hdr *eth_pkt;
-	struct arp_hdr *arp_pkt;
+	struct rte_arp_hdr *arp_pkt;
 
 	int slave_idx, nb_pkts, pkt_idx;
 	int retval = 0;
@@ -4504,7 +4504,8 @@ test_alb_change_mac_in_reply_sent(void)
 	eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
 	initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0,
 			0);
-	arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+	arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+					sizeof(struct ether_hdr));
 	initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1,
 			ARP_OP_REPLY);
 	rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1);
@@ -4514,7 +4515,8 @@ test_alb_change_mac_in_reply_sent(void)
 	eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
 	initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0,
 			0);
-	arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+	arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+					sizeof(struct ether_hdr));
 	initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2,
 			ARP_OP_REPLY);
 	rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1);
@@ -4524,7 +4526,8 @@ test_alb_change_mac_in_reply_sent(void)
 	eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
 	initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0,
 			0);
-	arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+	arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+					sizeof(struct ether_hdr));
 	initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3,
 			ARP_OP_REPLY);
 	rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1);
@@ -4534,7 +4537,8 @@ test_alb_change_mac_in_reply_sent(void)
 	eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
 	initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0,
 			0);
-	arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+	arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+					sizeof(struct ether_hdr));
 	initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4,
 			ARP_OP_REPLY);
 	rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1);
@@ -4555,7 +4559,8 @@ test_alb_change_mac_in_reply_sent(void)
 
 		for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) {
 			eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *);
-			arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+			arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+						sizeof(struct ether_hdr));
 
 			if (slave_idx%2 == 0) {
 				if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) {
@@ -4580,7 +4585,7 @@ static int
 test_alb_reply_from_client(void)
 {
 	struct ether_hdr *eth_pkt;
-	struct arp_hdr *arp_pkt;
+	struct rte_arp_hdr *arp_pkt;
 
 	struct rte_mbuf *pkt;
 	struct rte_mbuf *pkts_sent[MAX_PKT_BURST];
@@ -4617,7 +4622,8 @@ test_alb_reply_from_client(void)
 	eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
 	initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0,
 			0);
-	arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+	arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+					sizeof(struct ether_hdr));
 	initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host,
 			ARP_OP_REPLY);
 	virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt,
@@ -4628,7 +4634,8 @@ test_alb_reply_from_client(void)
 	eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
 	initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0,
 			0);
-	arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+	arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+					sizeof(struct ether_hdr));
 	initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host,
 			ARP_OP_REPLY);
 	virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt,
@@ -4639,7 +4646,8 @@ test_alb_reply_from_client(void)
 	eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
 	initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0,
 			0);
-	arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+	arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+					sizeof(struct ether_hdr));
 	initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host,
 			ARP_OP_REPLY);
 	virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt,
@@ -4650,7 +4658,8 @@ test_alb_reply_from_client(void)
 	eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
 	initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0,
 			0);
-	arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+	arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+					sizeof(struct ether_hdr));
 	initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host,
 			ARP_OP_REPLY);
 	virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt,
@@ -4676,7 +4685,8 @@ test_alb_reply_from_client(void)
 
 		for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) {
 			eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *);
-			arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr));
+			arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt +
+						sizeof(struct ether_hdr));
 
 			if (slave_idx%2 == 0) {
 				if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) {
@@ -4708,7 +4718,7 @@ test_alb_receive_vlan_reply(void)
 {
 	struct ether_hdr *eth_pkt;
 	struct vlan_hdr *vlan_pkt;
-	struct arp_hdr *arp_pkt;
+	struct rte_arp_hdr *arp_pkt;
 
 	struct rte_mbuf *pkt;
 	struct rte_mbuf *pkts_sent[MAX_PKT_BURST];
@@ -4749,7 +4759,7 @@ test_alb_receive_vlan_reply(void)
 	vlan_pkt = vlan_pkt+1;
 	vlan_pkt->vlan_tci = rte_cpu_to_be_16(2);
 	vlan_pkt->eth_proto = rte_cpu_to_be_16(ETHER_TYPE_ARP);
-	arp_pkt = (struct arp_hdr *)((char *)(vlan_pkt + 1));
+	arp_pkt = (struct rte_arp_hdr *)((char *)(vlan_pkt + 1));
 	initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host,
 			ARP_OP_REPLY);
 	virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt,
diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c
index d3e16d4bd..703223937 100644
--- a/drivers/net/bonding/rte_eth_bond_alb.c
+++ b/drivers/net/bonding/rte_eth_bond_alb.c
@@ -74,17 +74,17 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev)
 
 void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset,
 		struct bond_dev_private *internals) {
-	struct arp_hdr *arp;
+	struct rte_arp_hdr *arp;
 
 	struct client_data *hash_table = internals->mode6.client_table;
 	struct client_data *client_info;
 
 	uint8_t hash_index;
 
-	arp = (struct arp_hdr *) ((char *) (eth_h + 1) + offset);
+	arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset);
 
 	/* ARP Requests are forwarded to the application with no changes */
-	if (arp->arp_op != rte_cpu_to_be_16(ARP_OP_REPLY))
+	if (arp->arp_opcode != rte_cpu_to_be_16(ARP_OP_REPLY))
 		return;
 
 	/* From now on, we analyze only ARP Reply packets */
@@ -123,7 +123,7 @@ uint16_t
 bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset,
 		struct bond_dev_private *internals)
 {
-	struct arp_hdr *arp;
+	struct rte_arp_hdr *arp;
 
 	struct client_data *hash_table = internals->mode6.client_table;
 	struct client_data *client_info;
@@ -132,7 +132,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset,
 
 	struct ether_addr bonding_mac;
 
-	arp = (struct arp_hdr *)((char *)(eth_h + 1) + offset);
+	arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset);
 
 	/*
 	 * Traffic with src MAC other than bonding should be sent on
@@ -150,7 +150,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset,
 	client_info = &hash_table[hash_index];
 
 	rte_spinlock_lock(&internals->mode6.lock);
-	if (arp->arp_op == rte_cpu_to_be_16(ARP_OP_REPLY)) {
+	if (arp->arp_opcode == rte_cpu_to_be_16(ARP_OP_REPLY)) {
 		if (client_info->in_use) {
 			if (client_info->app_ip == arp->arp_data.arp_sip &&
 				client_info->cli_ip == arp->arp_data.arp_tip) {
@@ -196,7 +196,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info,
 		struct rte_mbuf *pkt, struct bond_dev_private *internals)
 {
 	struct ether_hdr *eth_h;
-	struct arp_hdr *arp_h;
+	struct rte_arp_hdr *arp_h;
 	uint16_t slave_idx;
 
 	rte_spinlock_lock(&internals->mode6.lock);
@@ -209,7 +209,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info,
 	else
 		eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP);
 
-	arp_h = (struct arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr)
+	arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr)
 			+ client_info->vlan_count * sizeof(struct vlan_hdr));
 
 	memcpy(eth_h + 1, client_info->vlan,
@@ -220,11 +220,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info,
 	ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha);
 	arp_h->arp_data.arp_tip = client_info->cli_ip;
 
-	arp_h->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER);
-	arp_h->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
-	arp_h->arp_hln = ETHER_ADDR_LEN;
-	arp_h->arp_pln = sizeof(uint32_t);
-	arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY);
+	arp_h->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER);
+	arp_h->arp_protocol = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
+	arp_h->arp_hlen = ETHER_ADDR_LEN;
+	arp_h->arp_plen = sizeof(uint32_t);
+	arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY);
 
 	slave_idx = client_info->slave_idx;
 	rte_spinlock_unlock(&internals->mode6.lock);
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 2c4da90c6..fa8f81e2b 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -589,7 +589,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h,
 {
 	struct ipv4_hdr *ipv4_h;
 #ifdef RTE_LIBRTE_BOND_DEBUG_ALB
-	struct arp_hdr *arp_h;
+	struct rte_arp_hdr *arp_h;
 	char dst_ip[16];
 	char ArpOp[24];
 	char buf[16];
@@ -614,7 +614,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h,
 	}
 #ifdef RTE_LIBRTE_BOND_DEBUG_ALB
 	else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) {
-		arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset);
+		arp_h = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset);
 		ipv4_addr_to_dot(arp_h->arp_data.arp_sip, src_ip, MaxIPv4String);
 		ipv4_addr_to_dot(arp_h->arp_data.arp_tip, dst_ip, MaxIPv4String);
 		arp_op_name(rte_be_to_cpu_16(arp_h->arp_op),
@@ -1132,8 +1132,10 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 						     "Failed to allocate ARP packet from pool");
 					continue;
 				}
-				pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr)
-						+ client_info->vlan_count * sizeof(struct vlan_hdr);
+				pkt_size = sizeof(struct ether_hdr) +
+					sizeof(struct rte_arp_hdr) +
+					client_info->vlan_count *
+					sizeof(struct vlan_hdr);
 				upd_pkt->data_len = pkt_size;
 				upd_pkt->pkt_len = pkt_size;
 
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index d41601a17..4b32fee1e 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -911,7 +911,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 		 */
 		if (fdir_input->flow.l2_flow.ether_type ==
 				rte_cpu_to_be_16(ETHER_TYPE_ARP))
-			payload += sizeof(struct arp_hdr);
+			payload += sizeof(struct rte_arp_hdr);
 		set_idx = I40E_FLXPLD_L2_IDX;
 		break;
 	default:
@@ -1197,7 +1197,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 		 */
 		if (fdir_input->flow.l2_flow.ether_type ==
 				rte_cpu_to_be_16(ETHER_TYPE_ARP))
-			payload += sizeof(struct arp_hdr);
+			payload += sizeof(struct rte_arp_hdr);
 		set_idx = I40E_FLXPLD_L2_IDX;
 	} else if (fdir_input->flow_ext.customized_pctype) {
 		/* If customized pctype is used */
diff --git a/examples/bond/main.c b/examples/bond/main.c
index ef86194ff..24479649e 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -339,7 +339,7 @@ static int lcore_main(__attribute__((unused)) void *arg1)
 	struct ether_addr d_addr;
 
 	struct ether_hdr *eth_hdr;
-	struct arp_hdr *arp_hdr;
+	struct rte_arp_hdr *arp_hdr;
 	struct ipv4_hdr *ipv4_hdr;
 	uint16_t ether_type, offset;
 
@@ -382,10 +382,11 @@ static int lcore_main(__attribute__((unused)) void *arg1)
 					global_flag_stru_p->port_packets[1]++;
 					rte_spinlock_unlock(&global_flag_stru_p->lock);
 				}
-				arp_hdr = (struct arp_hdr *)((char *)(eth_hdr + 1) + offset);
+				arp_hdr = (struct rte_arp_hdr *)(
+					(char *)(eth_hdr + 1) + offset);
 				if (arp_hdr->arp_data.arp_tip == bond_ip) {
-					if (arp_hdr->arp_op == rte_cpu_to_be_16(ARP_OP_REQUEST)) {
-						arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY);
+					if (arp_hdr->arp_opcode == rte_cpu_to_be_16(ARP_OP_REQUEST)) {
+						arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY);
 						/* Switch src and dst data and set bonding MAC */
 						ether_addr_copy(&eth_hdr->s_addr, &eth_hdr->d_addr);
 						rte_eth_macaddr_get(BOND_PORT, &eth_hdr->s_addr);
@@ -450,7 +451,7 @@ static void cmd_obj_send_parsed(void *parsed_result,
 
 	struct rte_mbuf *created_pkt;
 	struct ether_hdr *eth_hdr;
-	struct arp_hdr *arp_hdr;
+	struct rte_arp_hdr *arp_hdr;
 
 	uint32_t bond_ip;
 	size_t pkt_size;
@@ -469,7 +470,7 @@ static void cmd_obj_send_parsed(void *parsed_result,
 		return;
 	}
 
-	pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr);
+	pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr);
 	created_pkt->data_len = pkt_size;
 	created_pkt->pkt_len = pkt_size;
 
@@ -478,12 +479,13 @@ static void cmd_obj_send_parsed(void *parsed_result,
 	memset(&eth_hdr->d_addr, 0xFF, ETHER_ADDR_LEN);
 	eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP);
 
-	arp_hdr = (struct arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr));
-	arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER);
-	arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
-	arp_hdr->arp_hln = ETHER_ADDR_LEN;
-	arp_hdr->arp_pln = sizeof(uint32_t);
-	arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REQUEST);
+	arp_hdr = (struct rte_arp_hdr *)(
+		(char *)eth_hdr + sizeof(struct ether_hdr));
+	arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER);
+	arp_hdr->arp_protocol = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
+	arp_hdr->arp_hlen = ETHER_ADDR_LEN;
+	arp_hdr->arp_plen = sizeof(uint32_t);
+	arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REQUEST);
 
 	rte_eth_macaddr_get(BOND_PORT, &arp_hdr->arp_data.arp_sha);
 	arp_hdr->arp_data.arp_sip = bond_ip;
diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c
index f0ed9bd68..c80ebc7e1 100644
--- a/lib/librte_net/rte_arp.c
+++ b/lib/librte_net/rte_arp.c
@@ -12,7 +12,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool,
 		const struct ether_addr *mac)
 {
 	struct ether_hdr *eth_hdr;
-	struct arp_hdr *rarp;
+	struct rte_arp_hdr *rarp;
 	struct rte_mbuf *mbuf;
 
 	if (mpool == NULL)
@@ -34,12 +34,12 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool,
 	eth_hdr->ether_type = htons(ETHER_TYPE_RARP);
 
 	/* RARP header. */
-	rarp = (struct arp_hdr *)(eth_hdr + 1);
-	rarp->arp_hrd = htons(ARP_HRD_ETHER);
-	rarp->arp_pro = htons(ETHER_TYPE_IPv4);
-	rarp->arp_hln = ETHER_ADDR_LEN;
-	rarp->arp_pln = 4;
-	rarp->arp_op  = htons(ARP_OP_REVREQUEST);
+	rarp = (struct rte_arp_hdr *)(eth_hdr + 1);
+	rarp->arp_hardware = htons(ARP_HRD_ETHER);
+	rarp->arp_protocol = htons(ETHER_TYPE_IPv4);
+	rarp->arp_hlen = ETHER_ADDR_LEN;
+	rarp->arp_plen = 4;
+	rarp->arp_opcode  = htons(ARP_OP_REVREQUEST);
 
 	ether_addr_copy(mac, &rarp->arp_data.arp_sha);
 	ether_addr_copy(mac, &rarp->arp_data.arp_tha);
diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h
index 139a84ca5..c9b5cd49d 100644
--- a/lib/librte_net/rte_arp.h
+++ b/lib/librte_net/rte_arp.h
@@ -21,7 +21,7 @@ extern "C" {
 /**
  * ARP header IPv4 payload.
  */
-struct arp_ipv4 {
+struct rte_arp_ipv4 {
 	struct ether_addr arp_sha;  /**< sender hardware address */
 	uint32_t          arp_sip;  /**< sender IP address */
 	struct ether_addr arp_tha;  /**< target hardware address */
@@ -31,14 +31,14 @@ struct arp_ipv4 {
 /**
  * ARP header.
  */
-struct arp_hdr {
-	uint16_t arp_hrd;    /* format of hardware address */
+struct rte_arp_hdr {
+	uint16_t arp_hardware;    /* format of hardware address */
 #define ARP_HRD_ETHER     1  /* ARP Ethernet address format */
 
-	uint16_t arp_pro;    /* format of protocol address */
-	uint8_t  arp_hln;    /* length of hardware address */
-	uint8_t  arp_pln;    /* length of protocol address */
-	uint16_t arp_op;     /* ARP opcode (command) */
+	uint16_t arp_protocol;    /* format of protocol address */
+	uint8_t  arp_hlen;    /* length of hardware address */
+	uint8_t  arp_plen;    /* length of protocol address */
+	uint16_t arp_opcode;     /* ARP opcode (command) */
 #define	ARP_OP_REQUEST    1 /* request to resolve address */
 #define	ARP_OP_REPLY      2 /* response to previous request */
 #define	ARP_OP_REVREQUEST 3 /* request proto addr given hardware */
@@ -46,7 +46,7 @@ struct arp_hdr {
 #define	ARP_OP_INVREQUEST 8 /* request to identify peer */
 #define	ARP_OP_INVREPLY   9 /* response identifying peer */
 
-	struct arp_ipv4 arp_data;
+	struct rte_arp_ipv4 arp_data;
 } __attribute__((__packed__));
 
 /**
-- 
2.11.0


  reply	other threads:[~2019-05-21 16:13 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24  8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 01/14] net: add rte prefix to arp structures Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 02/14] net: add rte prefix to arp defines Olivier Matz
2018-10-24 14:53   ` Wiles, Keith
2018-10-26  7:25     ` Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 03/14] net: add rte prefix to ether structures Olivier Matz
2018-12-20 22:04   ` Ferruh Yigit
2018-10-24  8:18 ` [dpdk-dev] [RFC 04/14] net: add rte prefix to ether functions Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 05/14] net: add rte prefix to ether defines Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 06/14] net: add rte prefix to esp structure Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 07/14] net: add rte prefix to gre structure Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 08/14] net: add rte prefix to icmp structure Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 09/14] net: add rte prefix to icmp defines Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 10/14] net: add rte prefix to ip structure Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 11/14] net: add rte prefix to ip defines Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 12/14] net: add rte prefix to sctp structure Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 13/14] net: add rte prefix to tcp structure Olivier Matz
2018-10-24  8:18 ` [dpdk-dev] [RFC 14/14] net: add rte prefix to udp structure Olivier Matz
2018-10-24  8:32 ` [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz
2018-10-24 14:56 ` Wiles, Keith
2018-10-26  7:22   ` Olivier Matz
2018-10-24 16:09 ` Stephen Hemminger
2018-10-24 16:39 ` Bruce Richardson
2018-10-26  7:20   ` Olivier Matz
2018-10-26 10:15     ` Bruce Richardson
2018-10-26 11:28       ` Olivier Matz
2018-10-24 18:38 ` Stephen Hemminger
2018-10-26  7:56   ` Olivier Matz
2018-12-20 21:59 ` Ferruh Yigit
2018-12-20 23:48   ` Stephen Hemminger
2018-12-21 14:38     ` Wiles, Keith
2018-12-21 15:14       ` Ferruh Yigit
2018-12-27  9:35         ` Olivier Matz
2019-02-13 11:48           ` Yigit, Ferruh
2019-02-18 12:37             ` Ferruh Yigit
2019-02-18 16:58               ` Olivier Matz
2019-04-10  8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz
2019-04-10  8:32   ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-22 16:00     ` Stephen Hemminger
2019-04-22 16:00       ` Stephen Hemminger
2019-05-13 11:59       ` Olivier Matz
2019-05-13 11:59         ` Olivier Matz
2019-04-22 16:03     ` Stephen Hemminger
2019-04-22 16:03       ` Stephen Hemminger
2019-05-13 12:04       ` Olivier Matz
2019-05-13 12:04         ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 02/14] net: add rte prefix to arp defines Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 03/14] net: add rte prefix to ether structures Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 04/14] net: add rte prefix to ether functions Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 05/14] net: add rte prefix to ether defines Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 06/14] net: add rte prefix to esp structure Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 07/14] net: add rte prefix to gre structure Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 08/14] net: add rte prefix to icmp structure Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 09/14] net: add rte prefix to icmp defines Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 10/14] net: add rte prefix to ip structure Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-22 16:05     ` Stephen Hemminger
2019-04-22 16:05       ` Stephen Hemminger
2019-05-13 12:02       ` Olivier Matz
2019-05-13 12:02         ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 12/14] net: add rte prefix to sctp structure Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 13/14] net: add rte prefix to tcp structure Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-04-10  8:32   ` [dpdk-dev] [RFC v2 14/14] net: add rte prefix to udp structure Olivier Matz
2019-04-10  8:32     ` Olivier Matz
2019-05-20 17:11   ` [dpdk-dev] [RFC v2 00/14] prefix network structures Ferruh Yigit
2019-05-21 16:15     ` Olivier Matz
2019-05-21 16:13   ` [dpdk-dev] [PATCH 00/15] " Olivier Matz
2019-05-21 16:13     ` Olivier Matz [this message]
2019-05-24 11:37       ` [dpdk-dev] [PATCH 01/15] net: add rte prefix to arp structures Ferruh Yigit
2019-05-21 16:13     ` [dpdk-dev] [PATCH 02/15] net: add rte prefix to arp defines Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 03/15] net: add rte prefix to ether structures Olivier Matz
2019-05-29  8:39       ` David Marchand
2019-05-21 16:13     ` [dpdk-dev] [PATCH 04/15] net: add rte prefix to ether functions Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 05/15] net: add rte prefix to ether defines Olivier Matz
2019-05-24 11:37       ` Ferruh Yigit
2019-05-21 16:13     ` [dpdk-dev] [PATCH 06/15] net: add rte prefix to esp structure Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 07/15] net: add rte prefix to gre structure Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 08/15] net: add rte prefix to icmp structure Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 09/15] net: add rte prefix to icmp defines Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 10/15] net: add rte prefix to ip structure Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 11/15] net: add rte prefix to ip defines Olivier Matz
2019-05-29  8:41       ` David Marchand
2019-05-21 16:13     ` [dpdk-dev] [PATCH 12/15] net: add rte prefix to sctp structure Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 13/15] net: add rte prefix to tcp structure Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 14/15] net: add rte prefix to udp structure Olivier Matz
2019-05-21 16:13     ` [dpdk-dev] [PATCH 15/15] doc: announce network api change Olivier Matz
2019-05-21 16:23     ` [dpdk-dev] [PATCH 00/15] prefix network structures Stephen Hemminger
2019-05-23 11:41     ` Maxime Coquelin
2019-05-24 11:38     ` Ferruh Yigit
2019-05-29  7:59       ` David Marchand
2019-05-29 14:46         ` Olivier Matz
2019-05-29 17:29           ` David Marchand
2019-05-29 21:15             ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190521161315.25500-2-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).