diff options
author | Eric Dumazet <edumazet@google.com> | 2016-11-09 14:24:22 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-09 22:51:33 -0500 |
commit | f522a5fcf6dbba92f05bee5bb07f70fa8e521ab2 (patch) | |
tree | e70b9542b06fc479cd2c057ede31ca623f1b33e4 /net/ipv4/tcp.c | |
parent | d401c1d1e824f8238c4da5f432151fad0945aeab (diff) |
tcp: remove unaligned accesses from tcp_get_info()
After commit 6ed46d1247a5 ("sock_diag: align nlattr properly when
needed"), tcp_get_info() gets 64bit aligned memory, so we can avoid
the unaligned helpers.
Suggested-by: David Miller <davem@davemloft.net>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a7d54cbcdabb..f8f924ca662d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -279,7 +279,6 @@ | |||
279 | 279 | ||
280 | #include <asm/uaccess.h> | 280 | #include <asm/uaccess.h> |
281 | #include <asm/ioctls.h> | 281 | #include <asm/ioctls.h> |
282 | #include <asm/unaligned.h> | ||
283 | #include <net/busy_poll.h> | 282 | #include <net/busy_poll.h> |
284 | 283 | ||
285 | int sysctl_tcp_min_tso_segs __read_mostly = 2; | 284 | int sysctl_tcp_min_tso_segs __read_mostly = 2; |
@@ -2722,11 +2721,11 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) | |||
2722 | /* Report meaningful fields for all TCP states, including listeners */ | 2721 | /* Report meaningful fields for all TCP states, including listeners */ |
2723 | rate = READ_ONCE(sk->sk_pacing_rate); | 2722 | rate = READ_ONCE(sk->sk_pacing_rate); |
2724 | rate64 = rate != ~0U ? rate : ~0ULL; | 2723 | rate64 = rate != ~0U ? rate : ~0ULL; |
2725 | put_unaligned(rate64, &info->tcpi_pacing_rate); | 2724 | info->tcpi_pacing_rate = rate64; |
2726 | 2725 | ||
2727 | rate = READ_ONCE(sk->sk_max_pacing_rate); | 2726 | rate = READ_ONCE(sk->sk_max_pacing_rate); |
2728 | rate64 = rate != ~0U ? rate : ~0ULL; | 2727 | rate64 = rate != ~0U ? rate : ~0ULL; |
2729 | put_unaligned(rate64, &info->tcpi_max_pacing_rate); | 2728 | info->tcpi_max_pacing_rate = rate64; |
2730 | 2729 | ||
2731 | info->tcpi_reordering = tp->reordering; | 2730 | info->tcpi_reordering = tp->reordering; |
2732 | info->tcpi_snd_cwnd = tp->snd_cwnd; | 2731 | info->tcpi_snd_cwnd = tp->snd_cwnd; |
@@ -2792,8 +2791,8 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) | |||
2792 | 2791 | ||
2793 | slow = lock_sock_fast(sk); | 2792 | slow = lock_sock_fast(sk); |
2794 | 2793 | ||
2795 | put_unaligned(tp->bytes_acked, &info->tcpi_bytes_acked); | 2794 | info->tcpi_bytes_acked = tp->bytes_acked; |
2796 | put_unaligned(tp->bytes_received, &info->tcpi_bytes_received); | 2795 | info->tcpi_bytes_received = tp->bytes_received; |
2797 | info->tcpi_notsent_bytes = max_t(int, 0, tp->write_seq - tp->snd_nxt); | 2796 | info->tcpi_notsent_bytes = max_t(int, 0, tp->write_seq - tp->snd_nxt); |
2798 | 2797 | ||
2799 | unlock_sock_fast(sk, slow); | 2798 | unlock_sock_fast(sk, slow); |
@@ -2811,7 +2810,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) | |||
2811 | if (rate && intv) { | 2810 | if (rate && intv) { |
2812 | rate64 = (u64)rate * tp->mss_cache * USEC_PER_SEC; | 2811 | rate64 = (u64)rate * tp->mss_cache * USEC_PER_SEC; |
2813 | do_div(rate64, intv); | 2812 | do_div(rate64, intv); |
2814 | put_unaligned(rate64, &info->tcpi_delivery_rate); | 2813 | info->tcpi_delivery_rate = rate64; |
2815 | } | 2814 | } |
2816 | } | 2815 | } |
2817 | EXPORT_SYMBOL_GPL(tcp_get_info); | 2816 | EXPORT_SYMBOL_GPL(tcp_get_info); |