ipsec: optimize SA outbound sequence update

For SA outbound packets, rte_atomic64_add_return is used to generate
SQN atomically. Use C11 atomics with RELAXED ordering for outbound SQN
update instead of rte_atomic ops which enforce unnecessary barriers on
aarch64.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This commit is contained in:
Phil Yang 2020-04-24 12:33:04 +08:00 committed by Akhil Goyal
parent 34e0ec71e4
commit 1a805dee01
3 changed files with 5 additions and 8 deletions

View file

@ -128,10 +128,10 @@ esn_outb_update_sqn(struct rte_ipsec_sa *sa, uint32_t *num)
n = *num;
if (SQN_ATOMIC(sa))
sqn = (uint64_t)rte_atomic64_add_return(&sa->sqn.outb.atom, n);
sqn = __atomic_add_fetch(&sa->sqn.outb, n, __ATOMIC_RELAXED);
else {
sqn = sa->sqn.outb.raw + n;
sa->sqn.outb.raw = sqn;
sqn = sa->sqn.outb + n;
sa->sqn.outb = sqn;
}
/* overflow */

View file

@ -283,7 +283,7 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen)
{
uint8_t algo_type;
sa->sqn.outb.raw = 1;
sa->sqn.outb = 1;
algo_type = sa->algo_type;

View file

@ -119,10 +119,7 @@ struct rte_ipsec_sa {
* place from other frequently accesed data.
*/
union {
union {
rte_atomic64_t atom;
uint64_t raw;
} outb;
uint64_t outb;
struct {
uint32_t rdidx; /* read index */
uint32_t wridx; /* write index */