mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	tcp: avoid indirect call to tcp_stream_memory_free()
Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
		
							parent
							
								
									d3cd4924e3
								
							
						
					
					
						commit
						1c5f2ced13
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
					@ -60,7 +60,7 @@
 | 
				
			||||||
#include <linux/rculist_nulls.h>
 | 
					#include <linux/rculist_nulls.h>
 | 
				
			||||||
#include <linux/poll.h>
 | 
					#include <linux/poll.h>
 | 
				
			||||||
#include <linux/sockptr.h>
 | 
					#include <linux/sockptr.h>
 | 
				
			||||||
 | 
					#include <linux/indirect_call_wrapper.h>
 | 
				
			||||||
#include <linux/atomic.h>
 | 
					#include <linux/atomic.h>
 | 
				
			||||||
#include <linux/refcount.h>
 | 
					#include <linux/refcount.h>
 | 
				
			||||||
#include <net/dst.h>
 | 
					#include <net/dst.h>
 | 
				
			||||||
| 
						 | 
					@ -1264,13 +1264,17 @@ static inline void sk_refcnt_debug_release(const struct sock *sk)
 | 
				
			||||||
#define sk_refcnt_debug_release(sk) do { } while (0)
 | 
					#define sk_refcnt_debug_release(sk) do { } while (0)
 | 
				
			||||||
#endif /* SOCK_REFCNT_DEBUG */
 | 
					#endif /* SOCK_REFCNT_DEBUG */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					INDIRECT_CALLABLE_DECLARE(bool tcp_stream_memory_free(const struct sock *sk, int wake));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline bool __sk_stream_memory_free(const struct sock *sk, int wake)
 | 
					static inline bool __sk_stream_memory_free(const struct sock *sk, int wake)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (READ_ONCE(sk->sk_wmem_queued) >= READ_ONCE(sk->sk_sndbuf))
 | 
						if (READ_ONCE(sk->sk_wmem_queued) >= READ_ONCE(sk->sk_sndbuf))
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return sk->sk_prot->stream_memory_free ?
 | 
						return sk->sk_prot->stream_memory_free ?
 | 
				
			||||||
		sk->sk_prot->stream_memory_free(sk, wake) : true;
 | 
							INDIRECT_CALL_1(sk->sk_prot->stream_memory_free,
 | 
				
			||||||
 | 
								        tcp_stream_memory_free,
 | 
				
			||||||
 | 
									sk, wake) : true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline bool sk_stream_memory_free(const struct sock *sk)
 | 
					static inline bool sk_stream_memory_free(const struct sock *sk)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue