summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorOlivier Matz <olivier.matz@6wind.com>2019-05-21 18:13:01 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2019-05-24 13:34:44 +0200
commitf2745bfebc2b5d35bd8cdd3504d5b832abefca83 (patch)
treef4596c4277dc98166d4c4b1141b4068c827b7743 /examples
parentdf5ff0ba729606c107c474ae1913cef40d6a5625 (diff)
downloaddpdk-f2745bfebc2b5d35bd8cdd3504d5b832abefca83.zip
dpdk-f2745bfebc2b5d35bd8cdd3504d5b832abefca83.tar.gz
dpdk-f2745bfebc2b5d35bd8cdd3504d5b832abefca83.tar.xz
net: add rte prefix to ARP structures
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> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/bond/main.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/examples/bond/main.c b/examples/bond/main.c
index ef86194..2447964 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;