Commit 7360778b authored by Stefan Metzmacher's avatar Stefan Metzmacher Committed by Steve French
Browse files

smb: client: make use of smbdirect_socket_init()



It's much safer to initialize the whole structure at
the beginning than doing it all over the place
and then miss to move it if code changes.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarStefan Metzmacher <metze@samba.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 5a0d5ae6
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -1398,13 +1398,6 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
	struct smbdirect_recv_io *response;
	int i;

	INIT_LIST_HEAD(&sc->recv_io.reassembly.list);
	spin_lock_init(&sc->recv_io.reassembly.lock);
	sc->recv_io.reassembly.data_length = 0;
	sc->recv_io.reassembly.queue_length = 0;

	INIT_LIST_HEAD(&sc->recv_io.free.list);
	spin_lock_init(&sc->recv_io.free.lock);
	info->count_receive_queue = 0;

	init_waitqueue_head(&info->wait_receive_queues);
@@ -1706,14 +1699,12 @@ static struct smbd_connection *_smbd_get_connection(
	if (!info)
		return NULL;
	sc = &info->socket;
	smbdirect_socket_init(sc);
	sp = &sc->parameters;

	info->initiator_depth = 1;
	info->responder_resources = SMBD_CM_RESPONDER_RESOURCES;

	init_waitqueue_head(&sc->status_wait);

	sc->status = SMBDIRECT_SOCKET_CREATED;
	rc = smbd_ia_open(info, dstaddr, port);
	if (rc) {
		log_rdma_event(INFO, "smbd_ia_open rc=%d\n", rc);
@@ -1823,8 +1814,6 @@ static struct smbd_connection *_smbd_get_connection(
	log_rdma_event(INFO, "connecting to IP %pI4 port %d\n",
		&addr_in->sin_addr, port);

	init_waitqueue_head(&sc->recv_io.reassembly.wait_queue);

	WARN_ON_ONCE(sc->status != SMBDIRECT_SOCKET_RDMA_CONNECT_NEEDED);
	sc->status = SMBDIRECT_SOCKET_RDMA_CONNECT_RUNNING;
	rc = rdma_connect(sc->rdma.cm_id, &conn_param);