app/crypto-perf: support lookaside IPsec
[dpdk.git] / examples / ipsec-secgw / ipsec-secgw.c
index 59971dc..744bb61 100644 (file)
@@ -24,7 +24,6 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
@@ -426,7 +425,7 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
                        return;
                }
 
-               switch (iph6->proto) {
+               switch (next_proto) {
                case IPPROTO_ESP:
                        t->ipsec.pkts[(t->ipsec.num)++] = pkt;
                        break;
@@ -545,9 +544,9 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port,
                ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
        }
 
-       memcpy(&ethhdr->s_addr, &ethaddr_tbl[port].src,
+       memcpy(&ethhdr->src_addr, &ethaddr_tbl[port].src,
                        sizeof(struct rte_ether_addr));
-       memcpy(&ethhdr->d_addr, &ethaddr_tbl[port].dst,
+       memcpy(&ethhdr->dst_addr, &ethaddr_tbl[port].dst,
                        sizeof(struct rte_ether_addr));
 }
 
@@ -848,16 +847,6 @@ process_pkts_inbound_nosp(struct ipsec_ctx *ipsec_ctx,
        struct rte_mbuf *m;
        uint32_t nb_pkts_in, i, idx;
 
-       /* Drop any IPv4 traffic from unprotected ports */
-       free_pkts(traffic->ip4.pkts, traffic->ip4.num);
-
-       traffic->ip4.num = 0;
-
-       /* Drop any IPv6 traffic from unprotected ports */
-       free_pkts(traffic->ip6.pkts, traffic->ip6.num);
-
-       traffic->ip6.num = 0;
-
        if (app_sa_prm.enable == 0) {
 
                nb_pkts_in = ipsec_inbound(ipsec_ctx, traffic->ipsec.pkts,
@@ -1495,6 +1484,8 @@ parse_portmask(const char *portmask)
        char *end = NULL;
        unsigned long pm;
 
+       errno = 0;
+
        /* parse hexadecimal string */
        pm = strtoul(portmask, &end, 16);
        if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
@@ -3076,6 +3067,9 @@ main(int32_t argc, char **argv)
                rte_eth_dev_close(portid);
                printf(" Done\n");
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
        printf("Bye...\n");
 
        return 0;