Patch "can: raw: add support for SO_TXTIME/SCM_TXTIME" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    can: raw: add support for SO_TXTIME/SCM_TXTIME

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     can-raw-add-support-for-so_txtime-scm_txtime.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 441f593b2aca37ef5de4096f16b22b2e27761fa9
Author: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
Date:   Thu Apr 21 12:31:52 2022 +0200

    can: raw: add support for SO_TXTIME/SCM_TXTIME
    
    [ Upstream commit 51a0d5e51178fcd147c1b8fdab2ed16b561326db ]
    
    This patch calls into sock_cmsg_send() to parse the user supplied
    control information into a struct sockcm_cookie. Then assign the
    requested transmit time to the skb.
    
    This makes it possible to use the Earliest TXTIME First (ETF) packet
    scheduler with the CAN_RAW protocol. The user can send a CAN_RAW frame
    with a TXTIME and the kernel (with the ETF scheduler) will take care
    of sending it to the network interface.
    
    Link: https://lore.kernel.org/all/20220502091946.1916211-3-mkl@xxxxxxxxxxxxxx
    Acked-by: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>
    Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
    Stable-dep-of: 7f6ca95d16b9 ("net: Implement missing getsockopt(SO_TIMESTAMPING_NEW)")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/can/raw.c b/net/can/raw.c
index bb837019d1724..2700153262771 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -770,6 +770,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 {
 	struct sock *sk = sock->sk;
 	struct raw_sock *ro = raw_sk(sk);
+	struct sockcm_cookie sockc;
 	struct sk_buff *skb;
 	struct net_device *dev;
 	int ifindex;
@@ -815,11 +816,19 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 	if (err < 0)
 		goto free_skb;
 
-	skb_setup_tx_timestamp(skb, sk->sk_tsflags);
+	sockcm_init(&sockc, sk);
+	if (msg->msg_controllen) {
+		err = sock_cmsg_send(sk, msg, &sockc);
+		if (unlikely(err))
+			goto free_skb;
+	}
 
 	skb->dev = dev;
 	skb->sk  = sk;
 	skb->priority = sk->sk_priority;
+	skb->tstamp = sockc.transmit_time;
+
+	skb_setup_tx_timestamp(skb, sockc.tsflags);
 
 	err = can_send(skb, ro->loopback);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux