net/sfc: introduce flow allocation and free path
[dpdk.git] / lib / librte_ipsec / ipsec_sqn.h
index 7de10be..0c2f76a 100644 (file)
@@ -56,21 +56,6 @@ sqn_low16(rte_be64_t sqn)
 #endif
 }
 
-/*
- * for given size, calculate required number of buckets.
- */
-static uint32_t
-replay_num_bucket(uint32_t wsz)
-{
-       uint32_t nb;
-
-       nb = rte_align32pow2(RTE_ALIGN_MUL_CEIL(wsz, WINDOW_BUCKET_SIZE) /
-               WINDOW_BUCKET_SIZE);
-       nb = RTE_MAX(nb, (uint32_t)WINDOW_BUCKET_MIN);
-
-       return nb;
-}
-
 /*
  * According to RFC4303 A2.1, determine the high-order bit of sequence number.
  * use 32bit arithmetic inside, return uint64_t.
@@ -167,10 +152,6 @@ esn_inb_update_sqn(struct replay_sqn *rsn, const struct rte_ipsec_sa *sa,
 {
        uint32_t bit, bucket, last_bucket, new_bucket, diff, i;
 
-       /* replay not enabled */
-       if (sa->replay.win_sz == 0)
-               return 0;
-
        /* handle ESN */
        if (IS_ESN(sa))
                sqn = reconstruct_esn(rsn->sqn, sqn, sa->replay.win_sz);
@@ -222,21 +203,6 @@ esn_inb_update_sqn(struct replay_sqn *rsn, const struct rte_ipsec_sa *sa,
  * between writer and readers.
  */
 
-/**
- * Based on number of buckets calculated required size for the
- * structure that holds replay window and sequence number (RSN) information.
- */
-static size_t
-rsn_size(uint32_t nb_bucket)
-{
-       size_t sz;
-       struct replay_sqn *rsn;
-
-       sz = sizeof(*rsn) + nb_bucket * sizeof(rsn->window[0]);
-       sz = RTE_ALIGN_CEIL(sz, RTE_CACHE_LINE_SIZE);
-       return sz;
-}
-
 /**
  * Copy replay window and SQN.
  */
@@ -333,7 +299,7 @@ rsn_update_finish(struct rte_ipsec_sa *sa, struct replay_sqn *rsn)
 
        n = sa->sqn.inb.wridx;
        RTE_ASSERT(n != sa->sqn.inb.rdidx);
-       RTE_ASSERT(rsn - sa->sqn.inb.rsn == n);
+       RTE_ASSERT(rsn == sa->sqn.inb.rsn[n]);
 
        rte_rwlock_write_unlock(&rsn->rwl);
        sa->sqn.inb.rdidx = n;