mptcp: implement TCP_NOTSENT_LOWAT support
Add support for such socket option storing the user-space provided value in a new msk field, and using such data to implement the _mptcp_stream_memory_free() helper, similar to the TCP one. To avoid adding more indirect calls in the fast path, open-code a variant of sk_stream_memory_free() in mptcp_sendmsg() and add direct calls to the mptcp stream memory free helper where possible. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/464 Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
				
					committed by
					
						
						David S. Miller
					
				
			
			
				
	
			
			
			
						parent
						
							a74762675f
						
					
				
				
					commit
					29b5e5ef87
				
			@@ -812,6 +812,16 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
 | 
			
		||||
		return 0;
 | 
			
		||||
	case TCP_ULP:
 | 
			
		||||
		return -EOPNOTSUPP;
 | 
			
		||||
	case TCP_NOTSENT_LOWAT:
 | 
			
		||||
		ret = mptcp_get_int_option(msk, optval, optlen, &val);
 | 
			
		||||
		if (ret)
 | 
			
		||||
			return ret;
 | 
			
		||||
 | 
			
		||||
		lock_sock(sk);
 | 
			
		||||
		WRITE_ONCE(msk->notsent_lowat, val);
 | 
			
		||||
		mptcp_write_space(sk);
 | 
			
		||||
		release_sock(sk);
 | 
			
		||||
		return 0;
 | 
			
		||||
	case TCP_CONGESTION:
 | 
			
		||||
		return mptcp_setsockopt_sol_tcp_congestion(msk, optval, optlen);
 | 
			
		||||
	case TCP_CORK:
 | 
			
		||||
@@ -1345,6 +1355,8 @@ static int mptcp_getsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
 | 
			
		||||
		return mptcp_put_int_option(msk, optval, optlen, msk->cork);
 | 
			
		||||
	case TCP_NODELAY:
 | 
			
		||||
		return mptcp_put_int_option(msk, optval, optlen, msk->nodelay);
 | 
			
		||||
	case TCP_NOTSENT_LOWAT:
 | 
			
		||||
		return mptcp_put_int_option(msk, optval, optlen, msk->notsent_lowat);
 | 
			
		||||
	}
 | 
			
		||||
	return -EOPNOTSUPP;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user