net/ixgbe: fix Tx threshold setup
[dpdk.git] / examples / ipsec-secgw / ipsec-secgw.c
index 8e7cd1b..478dd80 100644 (file)
@@ -260,7 +260,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
                pkt->l3_len = sizeof(struct ip6_hdr);
        } else {
                /* Unknown/Unsupported type, drop the packet */
-               RTE_LOG(ERR, IPSEC, "Unsupported packet type\n");
+               RTE_LOG(ERR, IPSEC, "Unsupported packet type 0x%x\n",
+                       rte_be_to_cpu_16(eth->ether_type));
                rte_pktmbuf_free(pkt);
        }
 
@@ -437,11 +438,11 @@ inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip,
        for (i = 0; i < ip->num; i++) {
                m = ip->pkts[i];
                res = ip->res[i];
-               if (res & BYPASS) {
+               if (res == BYPASS) {
                        ip->pkts[j++] = m;
                        continue;
                }
-               if (res & DISCARD) {
+               if (res == DISCARD) {
                        rte_pktmbuf_free(m);
                        continue;
                }
@@ -452,9 +453,8 @@ inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip,
                        continue;
                }
 
-               sa_idx = ip->res[i] & PROTECT_MASK;
-               if (sa_idx >= IPSEC_SA_MAX_ENTRIES ||
-                               !inbound_sa_check(sa, m, sa_idx)) {
+               sa_idx = SPI2IDX(res);
+               if (!inbound_sa_check(sa, m, sa_idx)) {
                        rte_pktmbuf_free(m);
                        continue;
                }
@@ -540,16 +540,15 @@ outbound_sp(struct sp_ctx *sp, struct traffic_type *ip,
        j = 0;
        for (i = 0; i < ip->num; i++) {
                m = ip->pkts[i];
-               sa_idx = ip->res[i] & PROTECT_MASK;
-               if (ip->res[i] & DISCARD)
+               sa_idx = SPI2IDX(ip->res[i]);
+               if (ip->res[i] == DISCARD)
                        rte_pktmbuf_free(m);
-               else if (ip->res[i] & BYPASS)
+               else if (ip->res[i] == BYPASS)
                        ip->pkts[j++] = m;
-               else if (sa_idx < IPSEC_SA_MAX_ENTRIES) {
+               else {
                        ipsec->res[ipsec->num] = sa_idx;
                        ipsec->pkts[ipsec->num++] = m;
-               } else /* invalid SA idx */
-                       rte_pktmbuf_free(m);
+               }
        }
        ip->num = j;
 }
@@ -984,7 +983,8 @@ main_loop(__attribute__((unused)) void *dummy)
                        socket_ctx[socket_id].session_priv_pool;
 
        if (qconf->nb_rx_queue == 0) {
-               RTE_LOG(INFO, IPSEC, "lcore %u has nothing to do\n", lcore_id);
+               RTE_LOG(DEBUG, IPSEC, "lcore %u has nothing to do\n",
+                       lcore_id);
                return 0;
        }
 
@@ -1437,7 +1437,7 @@ print_ethaddr(const char *name, const struct ether_addr *eth_addr)
 int
 add_dst_ethaddr(uint16_t port, const struct ether_addr *addr)
 {
-       if (port > RTE_DIM(ethaddr_tbl))
+       if (port >= RTE_DIM(ethaddr_tbl))
                return -EINVAL;
 
        ethaddr_tbl[port].dst = ETHADDR_TO_UINT64(addr);
@@ -1791,7 +1791,7 @@ cryptodevs_init(void)
                                rte_eth_dev_get_sec_ctx(port_id)) {
                        int socket_id = rte_eth_dev_socket_id(port_id);
 
-                       if (!socket_ctx[socket_id].session_pool) {
+                       if (!socket_ctx[socket_id].session_priv_pool) {
                                char mp_name[RTE_MEMPOOL_NAMESIZE];
                                struct rte_mempool *sess_mp;
 
@@ -1811,7 +1811,8 @@ cryptodevs_init(void)
                                else
                                        printf("Allocated session pool "
                                                "on socket %d\n", socket_id);
-                               socket_ctx[socket_id].session_pool = sess_mp;
+                               socket_ctx[socket_id].session_priv_pool =
+                                               sess_mp;
                        }
                }
        }