From: Olivier Matz Date: Tue, 23 Oct 2018 16:24:53 +0000 (+0200) Subject: net: add rte prefix to arp structures X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2a440ed139ee5efaf9dfc634ca1e51f69c76881c;p=dpdk.git net: add rte prefix to arp structures - rename struct arp_hdr as struct rte_arp_hdr - rename struct arp_ipv4 as struct rte_arp_ipv4 Signed-off-by: Olivier Matz --- diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 55d266d77b..c461ef7f55 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -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,7 +347,7 @@ 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_h = (struct rte_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); if (verbose_level > 0) { diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index c3891c7e37..89a66d7e14 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -74,14 +74,14 @@ mempool_alloc_error: 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)) @@ -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 @@ -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, diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index b731132a57..f8987e4329 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), ArpOp); @@ -1125,7 +1125,7 @@ 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) + 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 d41601a176..4b32fee1e1 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 b282e68baa..e3e7e5824f 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -324,7 +324,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; @@ -367,7 +367,7 @@ 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); @@ -435,7 +435,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; @@ -454,7 +454,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; @@ -463,7 +463,7 @@ static void cmd_obj_send_parsed(void *parsed_result, memset(ð_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 = (struct rte_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; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index f0ed9bd682..e09428da9e 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,7 +34,7 @@ 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 = (struct rte_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; diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index 139a84ca55..cf187d778e 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,7 +31,7 @@ struct arp_ipv4 { /** * ARP header. */ -struct arp_hdr { +struct rte_arp_hdr { uint16_t arp_hrd; /* format of hardware address */ #define ARP_HRD_ETHER 1 /* ARP Ethernet address format */ @@ -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__)); /** diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index e894dc76f6..cbc68f20e3 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -74,7 +74,7 @@ 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) { diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index c20cea6e93..b6e013a11c 100644 --- a/test/test/packet_burst_generator.h +++ b/test/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/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index 0fe1d78eb0..db437a9c2c 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -4460,7 +4460,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; @@ -4495,7 +4495,7 @@ 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); @@ -4505,7 +4505,7 @@ 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); @@ -4515,7 +4515,7 @@ 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); @@ -4525,7 +4525,7 @@ 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); @@ -4546,7 +4546,7 @@ 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)) { @@ -4571,7 +4571,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]; @@ -4608,7 +4608,7 @@ 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, @@ -4619,7 +4619,7 @@ 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, @@ -4630,7 +4630,7 @@ 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, @@ -4641,7 +4641,7 @@ 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, @@ -4667,7 +4667,7 @@ 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)) { @@ -4699,7 +4699,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]; @@ -4740,7 +4740,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,