[dpdk-dev] [PATCH v6 08/10] examples/ipsec-secgw: make data-path to use ipsec library

Akhil Goyal akhil.goyal at nxp.com
Fri Jan 4 15:58:44 CET 2019



On 1/4/2019 1:55 AM, Konstantin Ananyev wrote:
>   	/* process ipv4 packets */
> -	inbound_sp_sa(ctx->sp4_ctx, ctx->sa_ctx, &trf.ip4, 0);
> -	route4_pkts(qconf->rt4_ctx, trf.ip4.pkts, trf.ip4.num);
> +	if (trf.ip4.num != 0) {
> +		inbound_sp_sa(ctx->sp4_ctx, ctx->sa_ctx, &trf.ip4, 0);
> +		route4_pkts(qconf->rt4_ctx, trf.ip4.pkts, trf.ip4.num);
> +	}
>   
>   	/* process ipv6 packets */
> -	inbound_sp_sa(ctx->sp6_ctx, ctx->sa_ctx, &trf.ip6, 0);
> -	route6_pkts(qconf->rt6_ctx, trf.ip6.pkts, trf.ip6.num);
> +	if (trf.ip6.num != 0) {
> +		inbound_sp_sa(ctx->sp6_ctx, ctx->sa_ctx, &trf.ip6, 0);
> +		route6_pkts(qconf->rt6_ctx, trf.ip6.pkts, trf.ip6.num);
> +	}
One more thing.
Why do you need these changes. There are multiple places where this 
change is done.

route6_pkts and route4_pkts already checks that internally for 0 pkts.
inbound_sp_sa also does that.
These are getting called from multiple places. So it is better we add this check inside the function itself instead of outside it.



More information about the dev mailing list