mirror of https://gitee.com/openkylin/linux.git
net/tls: simplify seq calculation in handle_device_resync()
We subtract "TLS_HEADER_SIZE - 1" from req_seq, then if they match we add the same constant to seq. Just add it to seq, and we don't have to touch req_seq. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
46088059aa
commit
4967373959
|
@ -576,14 +576,13 @@ void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn)
|
||||||
|
|
||||||
rx_ctx = tls_offload_ctx_rx(tls_ctx);
|
rx_ctx = tls_offload_ctx_rx(tls_ctx);
|
||||||
resync_req = atomic64_read(&rx_ctx->resync_req);
|
resync_req = atomic64_read(&rx_ctx->resync_req);
|
||||||
req_seq = (resync_req >> 32) - ((u32)TLS_HEADER_SIZE - 1);
|
req_seq = resync_req >> 32;
|
||||||
|
seq += TLS_HEADER_SIZE - 1;
|
||||||
is_req_pending = resync_req;
|
is_req_pending = resync_req;
|
||||||
|
|
||||||
if (unlikely(is_req_pending) && req_seq == seq &&
|
if (unlikely(is_req_pending) && req_seq == seq &&
|
||||||
atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0)) {
|
atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0))
|
||||||
seq += TLS_HEADER_SIZE - 1;
|
|
||||||
tls_device_resync_rx(tls_ctx, sk, seq, rcd_sn);
|
tls_device_resync_rx(tls_ctx, sk, seq, rcd_sn);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tls_device_reencrypt(struct sock *sk, struct sk_buff *skb)
|
static int tls_device_reencrypt(struct sock *sk, struct sk_buff *skb)
|
||||||
|
|
Loading…
Reference in New Issue