net: add rte prefix to IP structure
[dpdk.git] / examples / ipsec-secgw / ipsec-secgw.c
index 478dd80..fd81b6c 100644 (file)
@@ -211,7 +211,7 @@ static struct lcore_conf lcore_conf[RTE_MAX_LCORE];
 static struct rte_eth_conf port_conf = {
        .rxmode = {
                .mq_mode        = ETH_MQ_RX_RSS,
-               .max_rx_pkt_len = ETHER_MAX_LEN,
+               .max_rx_pkt_len = RTE_ETHER_MAX_LEN,
                .split_hdr_size = 0,
                .offloads = DEV_RX_OFFLOAD_CHECKSUM,
        },
@@ -233,11 +233,11 @@ static inline void
 prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
 {
        uint8_t *nlp;
-       struct ether_hdr *eth;
+       struct rte_ether_hdr *eth;
 
-       eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
-       if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) {
-               nlp = (uint8_t *)rte_pktmbuf_adj(pkt, ETHER_HDR_LEN);
+       eth = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
+       if (eth->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) {
+               nlp = (uint8_t *)rte_pktmbuf_adj(pkt, RTE_ETHER_HDR_LEN);
                nlp = RTE_PTR_ADD(nlp, offsetof(struct ip, ip_p));
                if (*nlp == IPPROTO_ESP)
                        t->ipsec.pkts[(t->ipsec.num)++] = pkt;
@@ -247,8 +247,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
                }
                pkt->l2_len = 0;
                pkt->l3_len = sizeof(struct ip);
-       } else if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) {
-               nlp = (uint8_t *)rte_pktmbuf_adj(pkt, ETHER_HDR_LEN);
+       } else if (eth->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) {
+               nlp = (uint8_t *)rte_pktmbuf_adj(pkt, RTE_ETHER_HDR_LEN);
                nlp = RTE_PTR_ADD(nlp, offsetof(struct ip6_hdr, ip6_nxt));
                if (*nlp == IPPROTO_ESP)
                        t->ipsec.pkts[(t->ipsec.num)++] = pkt;
@@ -325,36 +325,37 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port,
                const struct lcore_conf *qconf)
 {
        struct ip *ip;
-       struct ether_hdr *ethhdr;
+       struct rte_ether_hdr *ethhdr;
 
        ip = rte_pktmbuf_mtod(pkt, struct ip *);
 
-       ethhdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN);
+       ethhdr = (struct rte_ether_hdr *)
+               rte_pktmbuf_prepend(pkt, RTE_ETHER_HDR_LEN);
 
        if (ip->ip_v == IPVERSION) {
                pkt->ol_flags |= qconf->outbound.ipv4_offloads;
                pkt->l3_len = sizeof(struct ip);
-               pkt->l2_len = ETHER_HDR_LEN;
+               pkt->l2_len = RTE_ETHER_HDR_LEN;
 
                ip->ip_sum = 0;
 
                /* calculate IPv4 cksum in SW */
                if ((pkt->ol_flags & PKT_TX_IP_CKSUM) == 0)
-                       ip->ip_sum = rte_ipv4_cksum((struct ipv4_hdr *)ip);
+                       ip->ip_sum = rte_ipv4_cksum((struct rte_ipv4_hdr *)ip);
 
-               ethhdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
+               ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4);
        } else {
                pkt->ol_flags |= qconf->outbound.ipv6_offloads;
                pkt->l3_len = sizeof(struct ip6_hdr);
-               pkt->l2_len = ETHER_HDR_LEN;
+               pkt->l2_len = RTE_ETHER_HDR_LEN;
 
-               ethhdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6);
+               ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6);
        }
 
        memcpy(&ethhdr->s_addr, &ethaddr_tbl[port].src,
-                       sizeof(struct ether_addr));
+                       sizeof(struct rte_ether_addr));
        memcpy(&ethhdr->d_addr, &ethaddr_tbl[port].dst,
-                       sizeof(struct ether_addr));
+                       sizeof(struct rte_ether_addr));
 }
 
 static inline void
@@ -1424,10 +1425,10 @@ parse_args(int32_t argc, char **argv)
 }
 
 static void
-print_ethaddr(const char *name, const struct ether_addr *eth_addr)
+print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
 {
-       char buf[ETHER_ADDR_FMT_SIZE];
-       ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+       char buf[RTE_ETHER_ADDR_FMT_SIZE];
+       rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
        printf("%s%s", name, buf);
 }
 
@@ -1435,7 +1436,7 @@ print_ethaddr(const char *name, const struct ether_addr *eth_addr)
  * Update destination ethaddr for the port.
  */
 int
-add_dst_ethaddr(uint16_t port, const struct ether_addr *addr)
+add_dst_ethaddr(uint16_t port, const struct rte_ether_addr *addr)
 {
        if (port >= RTE_DIM(ethaddr_tbl))
                return -EINVAL;
@@ -1832,7 +1833,7 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads)
        uint16_t tx_queueid, rx_queueid, queue, lcore_id;
        int32_t ret, socket_id;
        struct lcore_conf *qconf;
-       struct ether_addr ethaddr;
+       struct rte_ether_addr ethaddr;
        struct rte_eth_conf local_port_conf = port_conf;
 
        rte_eth_dev_info_get(portid, &dev_info);