Skip to content

Commit

Permalink
net: Introduce SO_INCOMING_NAPI_ID
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ssamudrala authored and davem330 committed Mar 25, 2017
1 parent bf3b9f6 commit 6d43390
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/alpha/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _UAPI_ASM_SOCKET_H */
2 changes: 2 additions & 0 deletions arch/avr32/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _UAPI__ASM_AVR32_SOCKET_H */
2 changes: 2 additions & 0 deletions arch/frv/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,7 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _ASM_SOCKET_H */

2 changes: 2 additions & 0 deletions arch/ia64/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _ASM_IA64_SOCKET_H */
2 changes: 2 additions & 0 deletions arch/m32r/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _ASM_M32R_SOCKET_H */
1 change: 1 addition & 0 deletions arch/mips/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _UAPI_ASM_SOCKET_H */
2 changes: 2 additions & 0 deletions arch/mn10300/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _ASM_SOCKET_H */
2 changes: 2 additions & 0 deletions arch/parisc/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,6 @@

#define SO_MEMINFO 0x4030

#define SO_INCOMING_NAPI_ID 0x4031

#endif /* _UAPI_ASM_SOCKET_H */
2 changes: 2 additions & 0 deletions arch/powerpc/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _ASM_POWERPC_SOCKET_H */
2 changes: 2 additions & 0 deletions arch/s390/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _ASM_SOCKET_H */
2 changes: 2 additions & 0 deletions arch/sparc/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions arch/xtensa/include/uapi/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* _XTENSA_SOCKET_H */
2 changes: 2 additions & 0 deletions include/uapi/asm-generic/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,6 @@

#define SO_MEMINFO 55

#define SO_INCOMING_NAPI_ID 56

#endif /* __ASM_GENERIC_SOCKET_H */
12 changes: 12 additions & 0 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 6d43390

Please sign in to comment.