Skip to content

Commit 63a1c95

Browse files
Jakub Kicinskidavem330
authored andcommitted
net/tls: byte swap device req TCP seq no upon setting
To avoid a sparse warning byteswap the be32 sequence number before it's stored in the atomic value. While at it drop unnecessary brackets and use kernel's u64 type. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent da68b4a commit 63a1c95

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/net/tls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ static inline void tls_offload_rx_resync_request(struct sock *sk, __be32 seq)
562562
struct tls_context *tls_ctx = tls_get_ctx(sk);
563563
struct tls_offload_context_rx *rx_ctx = tls_offload_ctx_rx(tls_ctx);
564564

565-
atomic64_set(&rx_ctx->resync_req, ((((uint64_t)seq) << 32) | 1));
565+
atomic64_set(&rx_ctx->resync_req, ((u64)ntohl(seq) << 32) | 1);
566566
}
567567

568568

net/tls/tls_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn)
567567

568568
rx_ctx = tls_offload_ctx_rx(tls_ctx);
569569
resync_req = atomic64_read(&rx_ctx->resync_req);
570-
req_seq = ntohl(resync_req >> 32) - ((u32)TLS_HEADER_SIZE - 1);
570+
req_seq = (resync_req >> 32) - ((u32)TLS_HEADER_SIZE - 1);
571571
is_req_pending = resync_req;
572572

573573
if (unlikely(is_req_pending) && req_seq == seq &&

0 commit comments

Comments
 (0)