mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
BACKPORT: 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
20d4947353
, ``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.
Change-Id: Ibdfd5071737190371d4abec5ae76046b5aa8de23
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
This commit is contained in:
parent
cab65020e8
commit
e9ff904465
7 changed files with 16 additions and 25 deletions
|
@ -2083,10 +2083,9 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
|
||||||
* @sk: socket sending this packet
|
* @sk: socket sending this packet
|
||||||
* @tx_flags: filled with instructions for time stamping
|
* @tx_flags: filled with instructions for time stamping
|
||||||
*
|
*
|
||||||
* Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if
|
* Currently only depends on SOCK_TIMESTAMPING* flags.
|
||||||
* parameters are invalid.
|
|
||||||
*/
|
*/
|
||||||
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
|
* sk_eat_skb - Release a skb if it is no longer needed
|
||||||
|
|
|
@ -677,9 +677,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
|
err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto free_skb;
|
goto free_skb;
|
||||||
err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
|
|
||||||
if (err < 0)
|
sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
|
||||||
goto free_skb;
|
|
||||||
|
|
||||||
skb->dev = dev;
|
skb->dev = dev;
|
||||||
skb->sk = sk;
|
skb->sk = sk;
|
||||||
|
|
|
@ -738,9 +738,8 @@ int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
||||||
ipc.opt = NULL;
|
ipc.opt = NULL;
|
||||||
ipc.oif = sk->sk_bound_dev_if;
|
ipc.oif = sk->sk_bound_dev_if;
|
||||||
ipc.tx_flags = 0;
|
ipc.tx_flags = 0;
|
||||||
err = sock_tx_timestamp(sk, &ipc.tx_flags);
|
|
||||||
if (err)
|
sock_tx_timestamp(sk, &ipc.tx_flags);
|
||||||
return err;
|
|
||||||
|
|
||||||
if (msg->msg_controllen) {
|
if (msg->msg_controllen) {
|
||||||
err = ip_cmsg_send(sock_net(sk), msg, &ipc);
|
err = ip_cmsg_send(sock_net(sk), msg, &ipc);
|
||||||
|
|
|
@ -872,9 +872,9 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
||||||
ipc.addr = inet->inet_saddr;
|
ipc.addr = inet->inet_saddr;
|
||||||
|
|
||||||
ipc.oif = sk->sk_bound_dev_if;
|
ipc.oif = sk->sk_bound_dev_if;
|
||||||
err = sock_tx_timestamp(sk, &ipc.tx_flags);
|
|
||||||
if (err)
|
sock_tx_timestamp(sk, &ipc.tx_flags);
|
||||||
return err;
|
|
||||||
if (msg->msg_controllen) {
|
if (msg->msg_controllen) {
|
||||||
err = ip_cmsg_send(sock_net(sk), msg, &ipc);
|
err = ip_cmsg_send(sock_net(sk), msg, &ipc);
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -1314,11 +1314,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For UDP, check if TX timestamp is enabled */
|
/* For UDP, check if TX timestamp is enabled */
|
||||||
if (sk->sk_type == SOCK_DGRAM) {
|
if (sk->sk_type == SOCK_DGRAM)
|
||||||
err = sock_tx_timestamp(sk, &tx_flags);
|
sock_tx_timestamp(sk, &tx_flags);
|
||||||
if (err)
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Let's try using as much space as possible.
|
* Let's try using as much space as possible.
|
||||||
|
|
|
@ -1543,9 +1543,8 @@ retry:
|
||||||
skb->dev = dev;
|
skb->dev = dev;
|
||||||
skb->priority = sk->sk_priority;
|
skb->priority = sk->sk_priority;
|
||||||
skb->mark = sk->sk_mark;
|
skb->mark = sk->sk_mark;
|
||||||
err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
|
|
||||||
if (err < 0)
|
sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
|
||||||
goto out_unlock;
|
|
||||||
|
|
||||||
if (unlikely(extra_len == 4))
|
if (unlikely(extra_len == 4))
|
||||||
skb->no_fcs = 1;
|
skb->no_fcs = 1;
|
||||||
|
@ -2327,9 +2326,8 @@ static int packet_snd(struct socket *sock,
|
||||||
err = skb_copy_datagram_from_iovec(skb, offset, msg->msg_iov, 0, len);
|
err = skb_copy_datagram_from_iovec(skb, offset, msg->msg_iov, 0, len);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
|
|
||||||
if (err < 0)
|
sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
|
||||||
goto out_free;
|
|
||||||
|
|
||||||
if (!gso_type && (len > dev->mtu + reserve + extra_len)) {
|
if (!gso_type && (len > dev->mtu + reserve + extra_len)) {
|
||||||
/* Earlier code assumed this would be a VLAN pkt,
|
/* Earlier code assumed this would be a VLAN pkt,
|
||||||
|
|
|
@ -535,7 +535,7 @@ void sock_release(struct socket *sock)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(sock_release);
|
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;
|
*tx_flags = 0;
|
||||||
if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE))
|
if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE))
|
||||||
|
@ -544,7 +544,6 @@ int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags)
|
||||||
*tx_flags |= SKBTX_SW_TSTAMP;
|
*tx_flags |= SKBTX_SW_TSTAMP;
|
||||||
if (sock_flag(sk, SOCK_WIFI_STATUS))
|
if (sock_flag(sk, SOCK_WIFI_STATUS))
|
||||||
*tx_flags |= SKBTX_WIFI_STATUS;
|
*tx_flags |= SKBTX_WIFI_STATUS;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(sock_tx_timestamp);
|
EXPORT_SYMBOL(sock_tx_timestamp);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue