Commit e45469e5 authored by Anna Emese Nyiri's avatar Anna Emese Nyiri Committed by Jakub Kicinski
Browse files

sock: Introduce SO_RCVPRIORITY socket option



Add new socket option, SO_RCVPRIORITY, to include SO_PRIORITY in the
ancillary data returned by recvmsg().
This is analogous to the existing support for SO_RCVMARK,
as implemented in commit 6fd1d51c ("net: SO_RCVMARK socket option
for SO_MARK with recvmsg()").

Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Suggested-by: default avatarFerenc Fejes <fejes@inf.elte.hu>
Signed-off-by: default avatarAnna Emese Nyiri <annaemesenyiri@gmail.com>
Link: https://patch.msgid.link/20241213084457.45120-5-annaemesenyiri@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent cda7d5ab
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -148,6 +148,8 @@

#define SCM_TS_OPT_ID		81

#define SO_RCVPRIORITY		82

#if !defined(__KERNEL__)

#if __BITS_PER_LONG == 64
+2 −0
Original line number Diff line number Diff line
@@ -159,6 +159,8 @@

#define SCM_TS_OPT_ID		81

#define SO_RCVPRIORITY		82

#if !defined(__KERNEL__)

#if __BITS_PER_LONG == 64
+2 −0
Original line number Diff line number Diff line
@@ -140,6 +140,8 @@

#define SCM_TS_OPT_ID		0x404C

#define SO_RCVPRIORITY		0x404D

#if !defined(__KERNEL__)

#if __BITS_PER_LONG == 64
+2 −0
Original line number Diff line number Diff line
@@ -141,6 +141,8 @@

#define SCM_TS_OPT_ID            0x005a

#define SO_RCVPRIORITY           0x005b

#if !defined(__KERNEL__)


+3 −1
Original line number Diff line number Diff line
@@ -953,6 +953,7 @@ enum sock_flags {
	SOCK_XDP, /* XDP is attached */
	SOCK_TSTAMP_NEW, /* Indicates 64 bit timestamps always */
	SOCK_RCVMARK, /* Receive SO_MARK  ancillary data with packet */
	SOCK_RCVPRIORITY, /* Receive SO_PRIORITY ancillary data with packet */
};

#define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE))
@@ -2660,7 +2661,8 @@ static inline void sock_recv_cmsgs(struct msghdr *msg, struct sock *sk,
{
#define FLAGS_RECV_CMSGS ((1UL << SOCK_RXQ_OVFL)			| \
			   (1UL << SOCK_RCVTSTAMP)			| \
			   (1UL << SOCK_RCVMARK))
			   (1UL << SOCK_RCVMARK)			|\
			   (1UL << SOCK_RCVPRIORITY))
#define TSFLAGS_ANY	  (SOF_TIMESTAMPING_SOFTWARE			| \
			   SOF_TIMESTAMPING_RAW_HARDWARE)

Loading