Commit 9924b030 authored by Israel Rukshin's avatar Israel Rukshin Committed by Sagi Grimberg

nvme-tcp: Use struct nvme_ctrl directly

This patch doesn't change any functionality.
Signed-off-by: default avatarIsrael Rukshin <israelr@mellanox.com>
Reviewed-by: default avatarMax Gurtovoy <maxg@mellanox.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
parent e63440d6
...@@ -1258,7 +1258,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, ...@@ -1258,7 +1258,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
queue->queue_size = queue_size; queue->queue_size = queue_size;
if (qid > 0) if (qid > 0)
queue->cmnd_capsule_len = ctrl->ctrl.ioccsz * 16; queue->cmnd_capsule_len = nctrl->ioccsz * 16;
else else
queue->cmnd_capsule_len = sizeof(struct nvme_command) + queue->cmnd_capsule_len = sizeof(struct nvme_command) +
NVME_TCP_ADMIN_CCSZ; NVME_TCP_ADMIN_CCSZ;
...@@ -1266,7 +1266,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, ...@@ -1266,7 +1266,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
ret = sock_create(ctrl->addr.ss_family, SOCK_STREAM, ret = sock_create(ctrl->addr.ss_family, SOCK_STREAM,
IPPROTO_TCP, &queue->sock); IPPROTO_TCP, &queue->sock);
if (ret) { if (ret) {
dev_err(ctrl->ctrl.device, dev_err(nctrl->device,
"failed to create socket: %d\n", ret); "failed to create socket: %d\n", ret);
return ret; return ret;
} }
...@@ -1276,7 +1276,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, ...@@ -1276,7 +1276,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
ret = kernel_setsockopt(queue->sock, IPPROTO_TCP, TCP_SYNCNT, ret = kernel_setsockopt(queue->sock, IPPROTO_TCP, TCP_SYNCNT,
(char *)&opt, sizeof(opt)); (char *)&opt, sizeof(opt));
if (ret) { if (ret) {
dev_err(ctrl->ctrl.device, dev_err(nctrl->device,
"failed to set TCP_SYNCNT sock opt %d\n", ret); "failed to set TCP_SYNCNT sock opt %d\n", ret);
goto err_sock; goto err_sock;
} }
...@@ -1286,7 +1286,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, ...@@ -1286,7 +1286,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
ret = kernel_setsockopt(queue->sock, IPPROTO_TCP, ret = kernel_setsockopt(queue->sock, IPPROTO_TCP,
TCP_NODELAY, (char *)&opt, sizeof(opt)); TCP_NODELAY, (char *)&opt, sizeof(opt));
if (ret) { if (ret) {
dev_err(ctrl->ctrl.device, dev_err(nctrl->device,
"failed to set TCP_NODELAY sock opt %d\n", ret); "failed to set TCP_NODELAY sock opt %d\n", ret);
goto err_sock; goto err_sock;
} }
...@@ -1299,7 +1299,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, ...@@ -1299,7 +1299,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
ret = kernel_setsockopt(queue->sock, SOL_SOCKET, SO_LINGER, ret = kernel_setsockopt(queue->sock, SOL_SOCKET, SO_LINGER,
(char *)&sol, sizeof(sol)); (char *)&sol, sizeof(sol));
if (ret) { if (ret) {
dev_err(ctrl->ctrl.device, dev_err(nctrl->device,
"failed to set SO_LINGER sock opt %d\n", ret); "failed to set SO_LINGER sock opt %d\n", ret);
goto err_sock; goto err_sock;
} }
...@@ -1317,11 +1317,11 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, ...@@ -1317,11 +1317,11 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
queue->pdu_offset = 0; queue->pdu_offset = 0;
sk_set_memalloc(queue->sock->sk); sk_set_memalloc(queue->sock->sk);
if (ctrl->ctrl.opts->mask & NVMF_OPT_HOST_TRADDR) { if (nctrl->opts->mask & NVMF_OPT_HOST_TRADDR) {
ret = kernel_bind(queue->sock, (struct sockaddr *)&ctrl->src_addr, ret = kernel_bind(queue->sock, (struct sockaddr *)&ctrl->src_addr,
sizeof(ctrl->src_addr)); sizeof(ctrl->src_addr));
if (ret) { if (ret) {
dev_err(ctrl->ctrl.device, dev_err(nctrl->device,
"failed to bind queue %d socket %d\n", "failed to bind queue %d socket %d\n",
qid, ret); qid, ret);
goto err_sock; goto err_sock;
...@@ -1333,7 +1333,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, ...@@ -1333,7 +1333,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
if (queue->hdr_digest || queue->data_digest) { if (queue->hdr_digest || queue->data_digest) {
ret = nvme_tcp_alloc_crypto(queue); ret = nvme_tcp_alloc_crypto(queue);
if (ret) { if (ret) {
dev_err(ctrl->ctrl.device, dev_err(nctrl->device,
"failed to allocate queue %d crypto\n", qid); "failed to allocate queue %d crypto\n", qid);
goto err_sock; goto err_sock;
} }
...@@ -1347,13 +1347,13 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, ...@@ -1347,13 +1347,13 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
goto err_crypto; goto err_crypto;
} }
dev_dbg(ctrl->ctrl.device, "connecting queue %d\n", dev_dbg(nctrl->device, "connecting queue %d\n",
nvme_tcp_queue_id(queue)); nvme_tcp_queue_id(queue));
ret = kernel_connect(queue->sock, (struct sockaddr *)&ctrl->addr, ret = kernel_connect(queue->sock, (struct sockaddr *)&ctrl->addr,
sizeof(ctrl->addr), 0); sizeof(ctrl->addr), 0);
if (ret) { if (ret) {
dev_err(ctrl->ctrl.device, dev_err(nctrl->device,
"failed to connect socket: %d\n", ret); "failed to connect socket: %d\n", ret);
goto err_rcv_pdu; goto err_rcv_pdu;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment