net: Introduce SO_INCOMING_NAPI_ID
authorSridhar Samudrala <sridhar.samudrala@intel.com>
Fri, 24 Mar 2017 17:08:36 +0000 (10:08 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Mar 2017 03:49:31 +0000 (20:49 -0700)
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>
14 files changed:
arch/alpha/include/uapi/asm/socket.h
arch/avr32/include/uapi/asm/socket.h
arch/frv/include/uapi/asm/socket.h
arch/ia64/include/uapi/asm/socket.h
arch/m32r/include/uapi/asm/socket.h
arch/mips/include/uapi/asm/socket.h
arch/mn10300/include/uapi/asm/socket.h
arch/parisc/include/uapi/asm/socket.h
arch/powerpc/include/uapi/asm/socket.h
arch/s390/include/uapi/asm/socket.h
arch/sparc/include/uapi/asm/socket.h
arch/xtensa/include/uapi/asm/socket.h
include/uapi/asm-generic/socket.h
net/core/sock.c

index 089db42c1b40275e4ebbaf295e82ede323a74da5..1bb8cac61a284d7a9ac2150d079170f09044a692 100644 (file)
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* _UAPI_ASM_SOCKET_H */
index 6eabcbd2f82a3a410835a2653a81a071b4d395a5..f824eeb0f2e4c6d8ba639765f1d5394988ffd81e 100644 (file)
@@ -94,4 +94,6 @@
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* _UAPI__ASM_AVR32_SOCKET_H */
index bd497f8356b98d1656142bef775bec69c64d446a..a8ad9bebfc47e908d1b2d0b9d5ff4423ce29f631 100644 (file)
@@ -94,5 +94,7 @@
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* _ASM_SOCKET_H */
 
index f1bb546861687fd8947738e16dfd7b02d189082b..6af3253e420952697bd70518a7a1701bcf016a7d 100644 (file)
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* _ASM_IA64_SOCKET_H */
index 459c46076f6f8b8f30b1cccd916e63c29c62bc6f..e98b6bb897c0d06af2018297b97b9780e404e8e8 100644 (file)
@@ -94,4 +94,6 @@
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* _ASM_M32R_SOCKET_H */
index 688c18dd62ef69b382e7b78ed28cbfe2b2d06160..ae2b62e39d4dbe7ba7911322404d84b718e27940 100644 (file)
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
 
 #endif /* _UAPI_ASM_SOCKET_H */
index 312d2c457a047b69b27f3a2e245f1f17bb5f94ef..e4ac1843ee0172436ca682d7669c23d763445045 100644 (file)
@@ -94,4 +94,6 @@
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* _ASM_SOCKET_H */
index b98ec38f208331f6c117df77f5b24e94fdcf200e..f754c793e82a417ef5d50142e6a642059a108771 100644 (file)
@@ -93,4 +93,6 @@
 
 #define SO_MEMINFO             0x4030
 
+#define SO_INCOMING_NAPI_ID    0x4031
+
 #endif /* _UAPI_ASM_SOCKET_H */
index 099a889240f6706ba41f504b7faf899e2fa53f39..5f84af7dcb2e59482419dc8d72b24c61c80d4818 100644 (file)
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* _ASM_POWERPC_SOCKET_H */
index 6199bb34f7fa67ced2068f1c3730612162a80e20..25ac4960e70758afedeb92bbcb546f6121fccf4b 100644 (file)
 
 #define        SO_MEMINFO              55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* _ASM_SOCKET_H */
index 12cd8c2ec42282a0ed4b01dfa00c31126f680ac6..b05513acd589ba8d763f5da7bdd7bc16a59ac95c 100644 (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
index d0b85f6c14840f5749f46b8991ed8b3e72f2e76d..786606c81edd07af0b68a3c75079f2d80ba8a7c1 100644 (file)
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* _XTENSA_SOCKET_H */
index 8313702c1eae5c684251c3105e3170a5a3a6a6d2..c98a52fb572a4e9ad59410f43931aa81205212ec 100644 (file)
@@ -96,4 +96,6 @@
 
 #define SO_MEMINFO             55
 
+#define SO_INCOMING_NAPI_ID    56
+
 #endif /* __ASM_GENERIC_SOCKET_H */
index 4b762f2a3552b3637f7365ad374f85f8090e27db..1a58a9dc6888c4e8f1ae28048a522d8d248e5b93 100644 (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).