X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcrypto%2Focteontx2%2Fotx2_ipsec_anti_replay.h;h=b2b1f77284a4252ee4dacdd7792be5d06f9fa6cc;hb=e863fe3a13da89787fdf3b5c590101a3c0f10af6;hp=d599692a75b2a230f49137966b57dfbcae74e4fe;hpb=cc882d6469e5059b11d1fc2db81cdb8607b050bb;p=dpdk.git diff --git a/drivers/crypto/octeontx2/otx2_ipsec_anti_replay.h b/drivers/crypto/octeontx2/otx2_ipsec_anti_replay.h index d599692a75..b2b1f77284 100644 --- a/drivers/crypto/octeontx2/otx2_ipsec_anti_replay.h +++ b/drivers/crypto/octeontx2/otx2_ipsec_anti_replay.h @@ -204,4 +204,25 @@ cpt_ipsec_ip_antireplay_check(struct otx2_ipsec_fp_in_sa *sa, char *data) return ret; } + +static inline uint32_t +anti_replay_get_seqh(uint32_t winsz, uint32_t seql, + uint32_t esn_hi, uint32_t esn_low) +{ + uint32_t win_low = esn_low - winsz + 1; + + if (esn_low > winsz - 1) { + /* Window is in one sequence number subspace */ + if (seql > win_low) + return esn_hi; + else + return esn_hi + 1; + } else { + /* Window is split across two sequence number subspaces */ + if (seql > win_low) + return esn_hi - 1; + else + return esn_hi; + } +} #endif /* __OTX2_IPSEC_ANTI_REPLAY_H__ */