| 121 | } |
| 122 | |
| 123 | static int32_t |
| 124 | ipsec_sa_size(uint64_t type, uint32_t *wnd_sz, uint32_t *nb_bucket) |
| 125 | { |
| 126 | uint32_t n, sz, wsz; |
| 127 | |
| 128 | wsz = *wnd_sz; |
| 129 | n = 0; |
| 130 | |
| 131 | if ((type & RTE_IPSEC_SATP_DIR_MASK) == RTE_IPSEC_SATP_DIR_IB) { |
| 132 | |
| 133 | /* |
| 134 | * RFC 4303 recommends 64 as minimum window size. |
| 135 | * there is no point to use ESN mode without SQN window, |
| 136 | * so make sure we have at least 64 window when ESN is enabled. |
| 137 | */ |
| 138 | wsz = ((type & RTE_IPSEC_SATP_ESN_MASK) == |
| 139 | RTE_IPSEC_SATP_ESN_DISABLE) ? |
| 140 | wsz : RTE_MAX(wsz, (uint32_t)WINDOW_BUCKET_SIZE); |
| 141 | if (wsz != 0) |
| 142 | n = replay_num_bucket(wsz); |
| 143 | } |
| 144 | |
| 145 | if (n > WINDOW_BUCKET_MAX) |
| 146 | return -EINVAL; |
| 147 | |
| 148 | *wnd_sz = wsz; |
| 149 | *nb_bucket = n; |
| 150 | |
| 151 | sz = rsn_size(n); |
| 152 | if ((type & RTE_IPSEC_SATP_SQN_MASK) == RTE_IPSEC_SATP_SQN_ATOM) |
| 153 | sz *= REPLAY_SQN_NUM; |
| 154 | |
| 155 | sz += sizeof(struct rte_ipsec_sa); |
| 156 | return sz; |
| 157 | } |
| 158 | |
| 159 | void |
| 160 | rte_ipsec_sa_fini(struct rte_ipsec_sa *sa) |
no test coverage detected