diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-04-14 04:08:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-14 15:41:49 -0400 |
commit | bf84a01063eaab2f1a37d72d1b903445b3a25a4e (patch) | |
tree | fea0862757422b93ee4f158bf2a6f855a605d5b9 | |
parent | 9d9f163c82c678f1efe6e7d40d8691dca08c3eab (diff) |
net: sock: make sock_tx_timestamp void
Currently, sock_tx_timestamp() always returns 0. The comment that
describes the sock_tx_timestamp() function wrongly says that it
returns an error when an invalid argument is passed (from commit
20d4947353be, ``net: socket infrastructure for SO_TIMESTAMPING'').
Make the function void, so that we can also remove all the unneeded
if conditions that check for such a _non-existant_ error case in the
output path.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/sock.h | 5 | ||||
-rw-r--r-- | net/can/raw.c | 5 | ||||
-rw-r--r-- | net/ipv4/ping.c | 5 | ||||
-rw-r--r-- | net/ipv4/udp.c | 6 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 7 | ||||
-rw-r--r-- | net/packet/af_packet.c | 10 | ||||
-rw-r--r-- | net/socket.c | 3 |
7 files changed, 16 insertions, 25 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 08f05f964737..5c97b0fc5623 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -2159,10 +2159,9 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, | |||
2159 | * @sk: socket sending this packet | 2159 | * @sk: socket sending this packet |
2160 | * @tx_flags: filled with instructions for time stamping | 2160 | * @tx_flags: filled with instructions for time stamping |
2161 | * | 2161 | * |
2162 | * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if | 2162 | * Currently only depends on SOCK_TIMESTAMPING* flags. |
2163 | * parameters are invalid. | ||
2164 | */ | 2163 | */ |
2165 | extern int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); | 2164 | extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); |
2166 | 2165 | ||
2167 | /** | 2166 | /** |
2168 | * sk_eat_skb - Release a skb if it is no longer needed | 2167 | * sk_eat_skb - Release a skb if it is no longer needed |
diff --git a/net/can/raw.c b/net/can/raw.c index c1764e41ddaf..1085e65f848e 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -711,9 +711,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
711 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); | 711 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); |
712 | if (err < 0) | 712 | if (err < 0) |
713 | goto free_skb; | 713 | goto free_skb; |
714 | err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags); | 714 | |
715 | if (err < 0) | 715 | sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags); |
716 | goto free_skb; | ||
717 | 716 | ||
718 | skb->dev = dev; | 717 | skb->dev = dev; |
719 | skb->sk = sk; | 718 | skb->sk = sk; |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 2e91006d6076..7d93d62cd5fd 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -514,9 +514,8 @@ static int ping_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
514 | ipc.opt = NULL; | 514 | ipc.opt = NULL; |
515 | ipc.oif = sk->sk_bound_dev_if; | 515 | ipc.oif = sk->sk_bound_dev_if; |
516 | ipc.tx_flags = 0; | 516 | ipc.tx_flags = 0; |
517 | err = sock_tx_timestamp(sk, &ipc.tx_flags); | 517 | |
518 | if (err) | 518 | sock_tx_timestamp(sk, &ipc.tx_flags); |
519 | return err; | ||
520 | 519 | ||
521 | if (msg->msg_controllen) { | 520 | if (msg->msg_controllen) { |
522 | err = ip_cmsg_send(sock_net(sk), msg, &ipc); | 521 | err = ip_cmsg_send(sock_net(sk), msg, &ipc); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 7117d1467b02..2722db024a0b 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -902,9 +902,9 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
902 | ipc.addr = inet->inet_saddr; | 902 | ipc.addr = inet->inet_saddr; |
903 | 903 | ||
904 | ipc.oif = sk->sk_bound_dev_if; | 904 | ipc.oif = sk->sk_bound_dev_if; |
905 | err = sock_tx_timestamp(sk, &ipc.tx_flags); | 905 | |
906 | if (err) | 906 | sock_tx_timestamp(sk, &ipc.tx_flags); |
907 | return err; | 907 | |
908 | if (msg->msg_controllen) { | 908 | if (msg->msg_controllen) { |
909 | err = ip_cmsg_send(sock_net(sk), msg, &ipc); | 909 | err = ip_cmsg_send(sock_net(sk), msg, &ipc); |
910 | if (err) | 910 | if (err) |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 155eccfa7760..d2eedf192330 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1224,11 +1224,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | /* For UDP, check if TX timestamp is enabled */ | 1226 | /* For UDP, check if TX timestamp is enabled */ |
1227 | if (sk->sk_type == SOCK_DGRAM) { | 1227 | if (sk->sk_type == SOCK_DGRAM) |
1228 | err = sock_tx_timestamp(sk, &tx_flags); | 1228 | sock_tx_timestamp(sk, &tx_flags); |
1229 | if (err) | ||
1230 | goto error; | ||
1231 | } | ||
1232 | 1229 | ||
1233 | /* | 1230 | /* |
1234 | * Let's try using as much space as possible. | 1231 | * Let's try using as much space as possible. |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 8e4644ff8d34..77d71f84758c 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1505,9 +1505,8 @@ retry: | |||
1505 | skb->dev = dev; | 1505 | skb->dev = dev; |
1506 | skb->priority = sk->sk_priority; | 1506 | skb->priority = sk->sk_priority; |
1507 | skb->mark = sk->sk_mark; | 1507 | skb->mark = sk->sk_mark; |
1508 | err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags); | 1508 | |
1509 | if (err < 0) | 1509 | sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags); |
1510 | goto out_unlock; | ||
1511 | 1510 | ||
1512 | if (unlikely(extra_len == 4)) | 1511 | if (unlikely(extra_len == 4)) |
1513 | skb->no_fcs = 1; | 1512 | skb->no_fcs = 1; |
@@ -2312,9 +2311,8 @@ static int packet_snd(struct socket *sock, | |||
2312 | err = skb_copy_datagram_from_iovec(skb, offset, msg->msg_iov, 0, len); | 2311 | err = skb_copy_datagram_from_iovec(skb, offset, msg->msg_iov, 0, len); |
2313 | if (err) | 2312 | if (err) |
2314 | goto out_free; | 2313 | goto out_free; |
2315 | err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags); | 2314 | |
2316 | if (err < 0) | 2315 | sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags); |
2317 | goto out_free; | ||
2318 | 2316 | ||
2319 | if (!gso_type && (len > dev->mtu + reserve + extra_len)) { | 2317 | if (!gso_type && (len > dev->mtu + reserve + extra_len)) { |
2320 | /* Earlier code assumed this would be a VLAN pkt, | 2318 | /* Earlier code assumed this would be a VLAN pkt, |
diff --git a/net/socket.c b/net/socket.c index 88f759adf3af..36883fea44f3 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -600,7 +600,7 @@ void sock_release(struct socket *sock) | |||
600 | } | 600 | } |
601 | EXPORT_SYMBOL(sock_release); | 601 | EXPORT_SYMBOL(sock_release); |
602 | 602 | ||
603 | int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags) | 603 | void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags) |
604 | { | 604 | { |
605 | *tx_flags = 0; | 605 | *tx_flags = 0; |
606 | if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE)) | 606 | if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE)) |
@@ -609,7 +609,6 @@ int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags) | |||
609 | *tx_flags |= SKBTX_SW_TSTAMP; | 609 | *tx_flags |= SKBTX_SW_TSTAMP; |
610 | if (sock_flag(sk, SOCK_WIFI_STATUS)) | 610 | if (sock_flag(sk, SOCK_WIFI_STATUS)) |
611 | *tx_flags |= SKBTX_WIFI_STATUS; | 611 | *tx_flags |= SKBTX_WIFI_STATUS; |
612 | return 0; | ||
613 | } | 612 | } |
614 | EXPORT_SYMBOL(sock_tx_timestamp); | 613 | EXPORT_SYMBOL(sock_tx_timestamp); |
615 | 614 | ||