+
+ if (sa->replay_win_sz) {
+ if (sa->replay_win_sz > OTX2_IPSEC_MAX_REPLAY_WIN_SZ) {
+ snprintf(err_str, ERR_STR_SZ,
+ "Replay window size is not supported");
+ ret = -ENOTSUP;
+ goto sa_clear;
+ }
+ sa->replay = rte_zmalloc(NULL, sizeof(struct otx2_ipsec_replay),
+ 0);
+ if (sa->replay == NULL) {
+ snprintf(err_str, ERR_STR_SZ,
+ "Could not allocate memory");
+ ret = -ENOMEM;
+ goto sa_clear;
+ }
+
+ rte_spinlock_init(&sa->replay->lock);
+ /*
+ * Set window bottom to 1, base and top to size of
+ * window
+ */
+ sa->replay->winb = 1;
+ sa->replay->wint = sa->replay_win_sz;
+ sa->replay->base = sa->replay_win_sz;
+ sa->esn_low = 0;
+ sa->esn_hi = 0;
+ }
+
+ rte_io_wmb();
+ ctl->valid = 1;
+
+ rte_spinlock_unlock(&dev->ipsec_tbl_lock);
+ return 0;
+
+sa_clear:
+ memset(sa, 0, sizeof(struct otx2_ipsec_fp_in_sa));
+
+tbl_unlock:
+ rte_spinlock_unlock(&dev->ipsec_tbl_lock);
+
+ otx2_err("%s", err_str);
+