1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
8 #define WINDOW_BUCKET_BITS 6 /* uint64_t */
9 #define WINDOW_BUCKET_SIZE (1 << WINDOW_BUCKET_BITS)
10 #define WINDOW_BIT_LOC_MASK (WINDOW_BUCKET_SIZE - 1)
12 /* minimum number of bucket, power of 2*/
13 #define WINDOW_BUCKET_MIN 2
14 #define WINDOW_BUCKET_MAX (INT16_MAX + 1)
16 #define IS_ESN(sa) ((sa)->sqn_mask == UINT64_MAX)
19 * for given size, calculate required number of buckets.
22 replay_num_bucket(uint32_t wsz)
26 nb = rte_align32pow2(RTE_ALIGN_MUL_CEIL(wsz, WINDOW_BUCKET_SIZE) /
28 nb = RTE_MAX(nb, (uint32_t)WINDOW_BUCKET_MIN);
34 * Based on number of buckets calculated required size for the
35 * structure that holds replay window and sequence number (RSN) information.
38 rsn_size(uint32_t nb_bucket)
41 struct replay_sqn *rsn;
43 sz = sizeof(*rsn) + nb_bucket * sizeof(rsn->window[0]);
44 sz = RTE_ALIGN_CEIL(sz, RTE_CACHE_LINE_SIZE);
48 #endif /* _IPSEC_SQN_H_ */