Commit 1e372dbd authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'remove-most-callers-of-kernel_setsockopt-v3'



Christoph Hellwig says:

====================
remove most callers of kernel_setsockopt v3

this series removes most callers of the kernel_setsockopt functions, and
instead switches their users to small functions that implement setting a
sockopt directly using a normal kernel function call with type safety and
all the other benefits of not having a function call.

In some cases these functions seem pretty heavy handed as they do
a lock_sock even for just setting a single variable, but this mirrors
the real setsockopt implementation unlike a few drivers that just set
set the fields directly.

Changes since v2:
 - drop the separately merged kernel_getopt_removal
 - drop the sctp patches, as there is conflicting cleanup going on
 - add an additional ACK for the rxrpc changes

Changes since v1:
 - use ->getname for sctp sockets in dlm
 - add a new ->bind_add struct proto method for dlm/sctp
 - switch the ipv6 and remaining sctp helpers to inline function so that
   the ipv6 and sctp modules are not pulled in by any module that could
   potentially use ipv6 or sctp connections
 - remove arguments to various sock_* helpers that are always used with
   the same constant arguments
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1eba1110 095ae612
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -477,7 +477,7 @@ AF_RXRPC sockets support a few socket options at the SOL_RXRPC level:
	 Encrypted checksum plus packet padded and first eight bytes of packet
	 encrypted - which includes the actual packet length.

     (c) RXRPC_SECURITY_ENCRYPTED
     (c) RXRPC_SECURITY_ENCRYPT

	 Encrypted checksum plus entire packet padded and encrypted, including
	 actual packet length.
@@ -578,7 +578,7 @@ A client would issue an operation by:
     This issues a request_key() to get the key representing the security
     context.  The minimum security level can be set::

	unsigned int sec = RXRPC_SECURITY_ENCRYPTED;
	unsigned int sec = RXRPC_SECURITY_ENCRYPT;
	setsockopt(client, SOL_RXRPC, RXRPC_MIN_SECURITY_LEVEL,
		   &sec, sizeof(sec));

@@ -1090,6 +1090,15 @@ The kernel interface functions are as follows:
     jiffies).  In the event of the timeout occurring, the call will be
     aborted and -ETIME or -ETIMEDOUT will be returned.

 (#) Apply the RXRPC_MIN_SECURITY_LEVEL sockopt to a socket from within in the
     kernel::

       int rxrpc_sock_set_min_security_level(struct sock *sk,
					     unsigned int val);

     This specifies the minimum security level required for calls on this
     socket.


Configurable Parameters
=======================
+0 −28
Original line number Diff line number Diff line
@@ -1570,34 +1570,6 @@ extern void drbd_set_recv_tcq(struct drbd_device *device, int tcq_enabled);
extern void _drbd_clear_done_ee(struct drbd_device *device, struct list_head *to_be_freed);
extern int drbd_connected(struct drbd_peer_device *);

static inline void drbd_tcp_cork(struct socket *sock)
{
	int val = 1;
	(void) kernel_setsockopt(sock, SOL_TCP, TCP_CORK,
			(char*)&val, sizeof(val));
}

static inline void drbd_tcp_uncork(struct socket *sock)
{
	int val = 0;
	(void) kernel_setsockopt(sock, SOL_TCP, TCP_CORK,
			(char*)&val, sizeof(val));
}

static inline void drbd_tcp_nodelay(struct socket *sock)
{
	int val = 1;
	(void) kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY,
			(char*)&val, sizeof(val));
}

static inline void drbd_tcp_quickack(struct socket *sock)
{
	int val = 2;
	(void) kernel_setsockopt(sock, SOL_TCP, TCP_QUICKACK,
			(char*)&val, sizeof(val));
}

/* sets the number of 512 byte sectors of our virtual device */
void drbd_set_my_capacity(struct drbd_device *device, sector_t size);

+1 −1
Original line number Diff line number Diff line
@@ -660,7 +660,7 @@ static int __send_command(struct drbd_connection *connection, int vnr,
	/* DRBD protocol "pings" are latency critical.
	 * This is supposed to trigger tcp_push_pending_frames() */
	if (!err && (cmd == P_PING || cmd == P_PING_ACK))
		drbd_tcp_nodelay(sock->socket);
		tcp_sock_set_nodelay(sock->socket->sk);

	return err;
}
+6 −7
Original line number Diff line number Diff line
@@ -1051,8 +1051,8 @@ randomize:

	/* we don't want delays.
	 * we use TCP_CORK where appropriate, though */
	drbd_tcp_nodelay(sock.socket);
	drbd_tcp_nodelay(msock.socket);
	tcp_sock_set_nodelay(sock.socket->sk);
	tcp_sock_set_nodelay(msock.socket->sk);

	connection->data.socket = sock.socket;
	connection->meta.socket = msock.socket;
@@ -1223,7 +1223,7 @@ static int drbd_recv_header_maybe_unplug(struct drbd_connection *connection, str
		 * quickly as possible, and let remote TCP know what we have
		 * received so far. */
		if (err == -EAGAIN) {
			drbd_tcp_quickack(connection->data.socket);
			tcp_sock_set_quickack(connection->data.socket->sk, 2);
			drbd_unplug_all_devices(connection);
		}
		if (err > 0) {
@@ -4959,8 +4959,7 @@ static int receive_UnplugRemote(struct drbd_connection *connection, struct packe
{
	/* Make sure we've acked all the TCP data associated
	 * with the data requests being unplugged */
	drbd_tcp_quickack(connection->data.socket);

	tcp_sock_set_quickack(connection->data.socket->sk, 2);
	return 0;
}

@@ -6162,7 +6161,7 @@ void drbd_send_acks_wf(struct work_struct *ws)
	rcu_read_unlock();

	if (tcp_cork)
		drbd_tcp_cork(connection->meta.socket);
		tcp_sock_set_cork(connection->meta.socket->sk, true);

	err = drbd_finish_peer_reqs(device);
	kref_put(&device->kref, drbd_destroy_device);
@@ -6175,7 +6174,7 @@ void drbd_send_acks_wf(struct work_struct *ws)
	}

	if (tcp_cork)
		drbd_tcp_uncork(connection->meta.socket);
		tcp_sock_set_cork(connection->meta.socket->sk, false);

	return;
}
+3 −3
Original line number Diff line number Diff line
@@ -2098,7 +2098,7 @@ static void wait_for_work(struct drbd_connection *connection, struct list_head *
	if (uncork) {
		mutex_lock(&connection->data.mutex);
		if (connection->data.socket)
			drbd_tcp_uncork(connection->data.socket);
			tcp_sock_set_cork(connection->data.socket->sk, false);
		mutex_unlock(&connection->data.mutex);
	}

@@ -2153,9 +2153,9 @@ static void wait_for_work(struct drbd_connection *connection, struct list_head *
	mutex_lock(&connection->data.mutex);
	if (connection->data.socket) {
		if (cork)
			drbd_tcp_cork(connection->data.socket);
			tcp_sock_set_cork(connection->data.socket->sk, true);
		else if (!uncork)
			drbd_tcp_uncork(connection->data.socket);
			tcp_sock_set_cork(connection->data.socket->sk, false);
	}
	mutex_unlock(&connection->data.mutex);
}
Loading