X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fipsec-secgw%2Fipsec-secgw.c;h=478dd80c22c4d97faa77ec05e0920b27118bc220;hb=1999aeb3689e01c7644fd9c149b892d335a92069;hp=b253eea2bfe94ecc19716588815614bebdadc432;hpb=da7a540e1dc64495785d4f0d6e6b20b27bf28580;p=dpdk.git diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index b253eea2bf..478dd80c22 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -438,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; } @@ -453,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; } @@ -541,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; } @@ -1439,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); @@ -1793,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; @@ -1813,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; } } }