[PATCH 3/6] examples/ipsec-secgw: add lookaside event mode

Volodymyr Fialko vfialko at marvell.com
Fri Aug 5 12:06:42 CEST 2022


snip
> >  static inline int
> >  process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
> > -		struct rte_event *ev)
> > +	const struct eh_event_link_info *ev_link, struct rte_event *ev)
> >  {
> >  	struct ipsec_sa *sa = NULL;
> >  	struct rte_mbuf *pkt;
> > @@ -340,7 +437,22 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx,
> > struct route_table *rt,
> >  			goto drop_pkt_and_exit;
> >  		}
> >  		break;
> > +	case PKT_TYPE_IPSEC_IPV4:
> > +	case PKT_TYPE_IPSEC_IPV6:
> > +		rte_pktmbuf_adj(pkt, RTE_ETHER_HDR_LEN);
> > +		pkt_l3_len_set(pkt);
> 
> One small question, in case free_pkts() happens inside pkt_l3_len_set(pkt),
> can the pkt still be used in sad_lookup() below?
> Should return value be added to pkt_l3_len_set() in case pkt free?
> 
Hi, thank you for noticing this.
Return value should be checked, I'll address this issue in v2.

> > +
> > +		sad_lookup(&ctx->sa_ctx->sad, &pkt, (void **)&sa, 1);
> > +		sa = ipsec_mask_saptr(sa);
> > +		if (unlikely(sa == NULL)) {
> > +			RTE_LOG_DP(DEBUG, IPSEC, "Cannot find sa\n");
> > +			goto drop_pkt_and_exit;
> > +		}
> >
snip


More information about the dev mailing list