[dpdk-dev] [PATCH v3 4/8] ipsec: change the way unprocessed mbufs are accounted
Akhil Goyal
akhil.goyal at nxp.com
Thu Mar 28 11:52:44 CET 2019
On 3/26/2019 9:13 PM, Konstantin Ananyev wrote:
> As was pointed in one of previous reviews - we can avoid updating
> contents of mbuf array for successfully processed packets.
> Instead store indexes of failed packets, to move them beyond the good
> ones later.
>
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev at intel.com>
> ---
> lib/librte_ipsec/sa.c | 166 +++++++++++++++++++++++-------------------
> 1 file changed, 93 insertions(+), 73 deletions(-)
>
> diff --git a/lib/librte_ipsec/sa.c b/lib/librte_ipsec/sa.c
> index 97c0f8c61..009efd1d3 100644
> --- a/lib/librte_ipsec/sa.c
> +++ b/lib/librte_ipsec/sa.c
> @@ -450,14 +450,31 @@ rte_ipsec_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm,
> return sz;
> }
>
> -static inline void
> -mbuf_bulk_copy(struct rte_mbuf *dst[], struct rte_mbuf * const src[],
> - uint32_t num)
> +/*
> + * Move bad (unprocessed) mbufs beyond the good (processed) ones.
> + * dr[] contains the indexes of bad mbufs insinde the mb[].
spell check.
dr[],drb,drn looks cryptic can we have better naming which is more readable.
> + */
> +static void
> +mbuf_bad_move(struct rte_mbuf *mb[], const uint32_t dr[], uint32_t num,
move_bad_mbufs() would be better.
> + uint32_t drn)
> {
> - uint32_t i;
> + uint32_t i, j, k;
> + struct rte_mbuf *drb[drn];
> +
> + j = 0;
> + k = 0;
>
> - for (i = 0; i != num; i++)
> - dst[i] = src[i];
> + /* copy bad ones into a temp place */
> + for (i = 0; i != num; i++) {
> + if (j != drn && i == dr[j])
> + drb[j++] = mb[i];
> + else
> + mb[k++] = mb[i];
> + }
> +
> + /* copy bad ones after the good ones */
> + for (i = 0; i != drn; i++)
> + mb[k + i] = drb[i];
> }
>
Apart from that
Acked-by: Akhil Goyal <akhil.goyal at nxp.com>
More information about the dev
mailing list