diff mbox series

[RFC,v2,net-next,02/10] net: ipv4: raw: Hook into time based transmission.

Message ID 20180117230621.26074-3-jesus.sanchez-palencia@intel.com
State RFC
Headers show
Series Time based packet transmission | expand

Commit Message

Jesus Sanchez-Palencia Jan. 17, 2018, 11:06 p.m. UTC
From: Richard Cochran <rcochran@linutronix.de>

For raw 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/raw.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Eric Dumazet Jan. 18, 2018, 12:28 a.m. UTC | #1
On Wed, 2018-01-17 at 15:06 -0800, Jesus Sanchez-Palencia wrote:
> From: Richard Cochran <rcochran@linutronix.de>
> 
> For raw 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/raw.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
> index 136544b36a46..e37ea8ab6a78 100644
> --- a/net/ipv4/raw.c
> +++ b/net/ipv4/raw.c
> @@ -381,6 +381,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
>  
>  	skb->priority = sk->sk_priority;
>  	skb->mark = sk->sk_mark;
> +	skb->tstamp = sockc->transmit_time;
>  	skb_dst_set(skb, &rt->dst);
>  	*rtp = NULL;
>  
> @@ -562,6 +563,7 @@ static int raw_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.opt = NULL;
>  	ipc.tx_flags = 0;


It seems that skb_scrub_packet() will clear skb->tstamp, meaning  that
going through a tunnel will break your feature.

Maybe we need to remove skb->tstamp clear from skb_scrub_packet() and
do the cleaning only in forwarding path.
diff mbox series

Patch

diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 136544b36a46..e37ea8ab6a78 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -381,6 +381,7 @@  static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
 
 	skb->priority = sk->sk_priority;
 	skb->mark = sk->sk_mark;
+	skb->tstamp = sockc->transmit_time;
 	skb_dst_set(skb, &rt->dst);
 	*rtp = NULL;
 
@@ -562,6 +563,7 @@  static int raw_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.opt = NULL;
 	ipc.tx_flags = 0;