diff mbox series

[RFC,v3,net-next,06/18] net: ipv4: udp: Hook into time based transmission.

Message ID 20180307011230.24001-7-jesus.sanchez-palencia@intel.com
State RFC, archived
Delegated to: David Miller
Headers show
Series Time based packet transmission | expand

Commit Message

Jesus Sanchez-Palencia March 7, 2018, 1:12 a.m. UTC
From: Richard Cochran <rcochran@linutronix.de>

For udp packets, copy the desired future transmit time from the CMSG
cookie into the skb.

Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
---
 net/ipv4/udp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Willem de Bruijn March 7, 2018, 5 p.m. UTC | #1
On Tue, Mar 6, 2018 at 8:12 PM, Jesus Sanchez-Palencia
<jesus.sanchez-palencia@intel.com> wrote:
> From: Richard Cochran <rcochran@linutronix.de>
>
> For udp packets, copy the desired future transmit time from the CMSG
> cookie into the skb.
>
> Signed-off-by: Richard Cochran <rcochran@linutronix.de>
> Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
> ---
>  net/ipv4/udp.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 3013404d0935..d683bbde526b 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -926,6 +926,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
>         }
>
>         ipc.sockc.tsflags = sk->sk_tsflags;
> +       ipc.sockc.transmit_time = 0;
>         ipc.addr = inet->inet_saddr;
>         ipc.oif = sk->sk_bound_dev_if;
>
> @@ -1040,8 +1041,10 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
>                                   sizeof(struct udphdr), &ipc, &rt,
>                                   msg->msg_flags);
>                 err = PTR_ERR(skb);
> -               if (!IS_ERR_OR_NULL(skb))
> +               if (!IS_ERR_OR_NULL(skb)) {
> +                       skb->tstamp = ipc.sockc.transmit_time;
>                         err = udp_send_skb(skb, fl4);
> +               }

similar comment to raw: this implements only for a subset of udp requests:
those that can take the fast path.
diff mbox series

Patch

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 3013404d0935..d683bbde526b 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -926,6 +926,7 @@  int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 	}
 
 	ipc.sockc.tsflags = sk->sk_tsflags;
+	ipc.sockc.transmit_time = 0;
 	ipc.addr = inet->inet_saddr;
 	ipc.oif = sk->sk_bound_dev_if;
 
@@ -1040,8 +1041,10 @@  int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 				  sizeof(struct udphdr), &ipc, &rt,
 				  msg->msg_flags);
 		err = PTR_ERR(skb);
-		if (!IS_ERR_OR_NULL(skb))
+		if (!IS_ERR_OR_NULL(skb)) {
+			skb->tstamp = ipc.sockc.transmit_time;
 			err = udp_send_skb(skb, fl4);
+		}
 		goto out;
 	}