]> git.ipfire.org Git - people/ms/linux.git/commitdiff
net: sock: make sock_tx_timestamp void
authorDaniel Borkmann <dborkman@redhat.com>
Sun, 14 Apr 2013 08:08:13 +0000 (08:08 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 14 Apr 2013 19:41:49 +0000 (15:41 -0400)
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>
include/net/sock.h
net/can/raw.c
net/ipv4/ping.c
net/ipv4/udp.c
net/ipv6/ip6_output.c
net/packet/af_packet.c
net/socket.c

index 08f05f964737433390e898448bc27885ded905e8..5c97b0fc5623aa4bb44db9082d6631ad0a27fafe 100644 (file)
@@ -2159,10 +2159,9 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
  * @sk:                socket sending this packet
  * @tx_flags:  filled with instructions for time stamping
  *
- * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if
- * parameters are invalid.
+ * Currently only depends on SOCK_TIMESTAMPING* flags.
  */
-extern int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
+extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
 
 /**
  * sk_eat_skb - Release a skb if it is no longer needed
index c1764e41ddaf924fed4e31972b938a84bb87b6f7..1085e65f848eab9a3a634ad16b37d70bd80830b5 100644 (file)
@@ -711,9 +711,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
        err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
        if (err < 0)
                goto free_skb;
-       err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
-       if (err < 0)
-               goto free_skb;
+
+       sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
 
        skb->dev = dev;
        skb->sk  = sk;
index 2e91006d6076492fb0fe3b0bdf831c42bca56756..7d93d62cd5fdae9f7f8a3f2e5c35f2a203df92e0 100644 (file)
@@ -514,9 +514,8 @@ static int ping_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
        ipc.opt = NULL;
        ipc.oif = sk->sk_bound_dev_if;
        ipc.tx_flags = 0;
-       err = sock_tx_timestamp(sk, &ipc.tx_flags);
-       if (err)
-               return err;
+
+       sock_tx_timestamp(sk, &ipc.tx_flags);
 
        if (msg->msg_controllen) {
                err = ip_cmsg_send(sock_net(sk), msg, &ipc);
index 7117d1467b020c5aec59ca87ff8f6b91422a8816..2722db024a0bf772a433cdb192a40e82904afc42 100644 (file)
@@ -902,9 +902,9 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
        ipc.addr = inet->inet_saddr;
 
        ipc.oif = sk->sk_bound_dev_if;
-       err = sock_tx_timestamp(sk, &ipc.tx_flags);
-       if (err)
-               return err;
+
+       sock_tx_timestamp(sk, &ipc.tx_flags);
+
        if (msg->msg_controllen) {
                err = ip_cmsg_send(sock_net(sk), msg, &ipc);
                if (err)
index 155eccfa77604fcd63bbeeff1db23ed184082dd6..d2eedf192330caf5a963c27ddaceffae5e4886b8 100644 (file)
@@ -1224,11 +1224,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
        }
 
        /* For UDP, check if TX timestamp is enabled */
-       if (sk->sk_type == SOCK_DGRAM) {
-               err = sock_tx_timestamp(sk, &tx_flags);
-               if (err)
-                       goto error;
-       }
+       if (sk->sk_type == SOCK_DGRAM)
+               sock_tx_timestamp(sk, &tx_flags);
 
        /*
         * Let's try using as much space as possible.
index 8e4644ff8d34253784fdd801965f71420e4bb249..77d71f84758c01375fc148faedfa95ee7dc31d16 100644 (file)
@@ -1505,9 +1505,8 @@ retry:
        skb->dev = dev;
        skb->priority = sk->sk_priority;
        skb->mark = sk->sk_mark;
-       err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
-       if (err < 0)
-               goto out_unlock;
+
+       sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
 
        if (unlikely(extra_len == 4))
                skb->no_fcs = 1;
@@ -2312,9 +2311,8 @@ static int packet_snd(struct socket *sock,
        err = skb_copy_datagram_from_iovec(skb, offset, msg->msg_iov, 0, len);
        if (err)
                goto out_free;
-       err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
-       if (err < 0)
-               goto out_free;
+
+       sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
 
        if (!gso_type && (len > dev->mtu + reserve + extra_len)) {
                /* Earlier code assumed this would be a VLAN pkt,
index 88f759adf3afba28af3b1a694220c18f5e895616..36883fea44f3c0cf2e44f399023f274014546339 100644 (file)
@@ -600,7 +600,7 @@ void sock_release(struct socket *sock)
 }
 EXPORT_SYMBOL(sock_release);
 
-int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags)
+void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags)
 {
        *tx_flags = 0;
        if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE))
@@ -609,7 +609,6 @@ int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags)
                *tx_flags |= SKBTX_SW_TSTAMP;
        if (sock_flag(sk, SOCK_WIFI_STATUS))
                *tx_flags |= SKBTX_WIFI_STATUS;
-       return 0;
 }
 EXPORT_SYMBOL(sock_tx_timestamp);