net: Introduce SO_INCOMING_NAPI_ID

This socket option returns the NAPI ID associated with the queue on which
the last frame is received. This information can be used by the apps to
split the incoming flows among the threads based on the Rx queue on which
they are received.

If the NAPI ID actually represents a sender_cpu then the value is ignored
and 0 is returned.

Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Sridhar Samudrala 2017-03-24 10:08:36 -07:00 committed by David S. Miller
parent bf3b9f6372
commit 6d4339028b
14 changed files with 37 additions and 0 deletions

View File

@ -101,4 +101,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _UAPI_ASM_SOCKET_H */

View File

@ -94,4 +94,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _UAPI__ASM_AVR32_SOCKET_H */

View File

@ -94,5 +94,7 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _ASM_SOCKET_H */

View File

@ -103,4 +103,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _ASM_IA64_SOCKET_H */

View File

@ -94,4 +94,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _ASM_M32R_SOCKET_H */

View File

@ -112,5 +112,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _UAPI_ASM_SOCKET_H */

View File

@ -94,4 +94,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _ASM_SOCKET_H */

View File

@ -93,4 +93,6 @@
#define SO_MEMINFO 0x4030
#define SO_INCOMING_NAPI_ID 0x4031
#endif /* _UAPI_ASM_SOCKET_H */

View File

@ -101,4 +101,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _ASM_POWERPC_SOCKET_H */

View File

@ -100,4 +100,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _ASM_SOCKET_H */

View File

@ -90,6 +90,8 @@
#define SO_MEMINFO 0x0039
#define SO_INCOMING_NAPI_ID 0x003a
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002

View File

@ -105,4 +105,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* _XTENSA_SOCKET_H */

View File

@ -96,4 +96,6 @@
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#endif /* __ASM_GENERIC_SOCKET_H */

View File

@ -1328,6 +1328,18 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
goto lenout;
}
#ifdef CONFIG_NET_RX_BUSY_POLL
case SO_INCOMING_NAPI_ID:
v.val = READ_ONCE(sk->sk_napi_id);
/* aggregate non-NAPI IDs down to 0 */
if (v.val < MIN_NAPI_ID)
v.val = 0;
break;
#endif
default:
/* We implement the SO_SNDLOWAT etc to not be settable
* (1003.1g 7).