OSDN Git Service

net/tls: byte swap device req TCP seq no upon setting
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 25 Apr 2019 19:32:04 +0000 (12:32 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 27 Apr 2019 20:52:21 +0000 (16:52 -0400)
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>
include/net/tls.h
net/tls/tls_device.c

index 41a2ee6..39ea62f 100644 (file)
@@ -562,7 +562,7 @@ static inline void tls_offload_rx_resync_request(struct sock *sk, __be32 seq)
        struct tls_context *tls_ctx = tls_get_ctx(sk);
        struct tls_offload_context_rx *rx_ctx = tls_offload_ctx_rx(tls_ctx);
 
-       atomic64_set(&rx_ctx->resync_req, ((((uint64_t)seq) << 32) | 1));
+       atomic64_set(&rx_ctx->resync_req, ((u64)ntohl(seq) << 32) | 1);
 }
 
 
index 79475b1..26f26e7 100644 (file)
@@ -567,7 +567,7 @@ void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn)
 
        rx_ctx = tls_offload_ctx_rx(tls_ctx);
        resync_req = atomic64_read(&rx_ctx->resync_req);
-       req_seq = ntohl(resync_req >> 32) - ((u32)TLS_HEADER_SIZE - 1);
+       req_seq = (resync_req >> 32) - ((u32)TLS_HEADER_SIZE - 1);
        is_req_pending = resync_req;
 
        if (unlikely(is_req_pending) && req_seq == seq &&