tcp.c (f21c4769d0de00f4873792f8e6f2d1c04c8cd898) tcp.c (f4b9e6c90c572519041f4c5d9c4c3dd50aff42d4)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * NVMe over Fabrics TCP host.
4 * Copyright (c) 2018 Lightbits Labs. All rights reserved.
5 */
6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7#include <linux/module.h>
8#include <linux/init.h>

--- 403 unchanged lines hidden (view full) ---

412}
413
414static int nvme_tcp_init_request(struct blk_mq_tag_set *set,
415 struct request *rq, unsigned int hctx_idx,
416 unsigned int numa_node)
417{
418 struct nvme_tcp_ctrl *ctrl = set->driver_data;
419 struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * NVMe over Fabrics TCP host.
4 * Copyright (c) 2018 Lightbits Labs. All rights reserved.
5 */
6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7#include <linux/module.h>
8#include <linux/init.h>

--- 403 unchanged lines hidden (view full) ---

412}
413
414static int nvme_tcp_init_request(struct blk_mq_tag_set *set,
415 struct request *rq, unsigned int hctx_idx,
416 unsigned int numa_node)
417{
418 struct nvme_tcp_ctrl *ctrl = set->driver_data;
419 struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
420 struct nvme_tcp_cmd_pdu *pdu;
420 int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0;
421 struct nvme_tcp_queue *queue = &ctrl->queues[queue_idx];
422 u8 hdgst = nvme_tcp_hdgst_len(queue);
423
424 req->pdu = page_frag_alloc(&queue->pf_cache,
425 sizeof(struct nvme_tcp_cmd_pdu) + hdgst,
426 GFP_KERNEL | __GFP_ZERO);
427 if (!req->pdu)
428 return -ENOMEM;
429
421 int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0;
422 struct nvme_tcp_queue *queue = &ctrl->queues[queue_idx];
423 u8 hdgst = nvme_tcp_hdgst_len(queue);
424
425 req->pdu = page_frag_alloc(&queue->pf_cache,
426 sizeof(struct nvme_tcp_cmd_pdu) + hdgst,
427 GFP_KERNEL | __GFP_ZERO);
428 if (!req->pdu)
429 return -ENOMEM;
430
431 pdu = req->pdu;
430 req->queue = queue;
431 nvme_req(rq)->ctrl = &ctrl->ctrl;
432 req->queue = queue;
433 nvme_req(rq)->ctrl = &ctrl->ctrl;
434 nvme_req(rq)->cmd = &pdu->cmd;
432
433 return 0;
434}
435
436static int nvme_tcp_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
437 unsigned int hctx_idx)
438{
439 struct nvme_tcp_ctrl *ctrl = data;

--- 1814 unchanged lines hidden (view full) ---

2254 struct request *rq)
2255{
2256 struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
2257 struct nvme_tcp_cmd_pdu *pdu = req->pdu;
2258 struct nvme_tcp_queue *queue = req->queue;
2259 u8 hdgst = nvme_tcp_hdgst_len(queue), ddgst = 0;
2260 blk_status_t ret;
2261
435
436 return 0;
437}
438
439static int nvme_tcp_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
440 unsigned int hctx_idx)
441{
442 struct nvme_tcp_ctrl *ctrl = data;

--- 1814 unchanged lines hidden (view full) ---

2257 struct request *rq)
2258{
2259 struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
2260 struct nvme_tcp_cmd_pdu *pdu = req->pdu;
2261 struct nvme_tcp_queue *queue = req->queue;
2262 u8 hdgst = nvme_tcp_hdgst_len(queue), ddgst = 0;
2263 blk_status_t ret;
2264
2262 ret = nvme_setup_cmd(ns, rq, &pdu->cmd);
2265 ret = nvme_setup_cmd(ns, rq);
2263 if (ret)
2264 return ret;
2265
2266 req->state = NVME_TCP_SEND_CMD_PDU;
2267 req->offset = 0;
2268 req->data_sent = 0;
2269 req->pdu_len = 0;
2270 req->pdu_sent = 0;

--- 318 unchanged lines hidden ---
2266 if (ret)
2267 return ret;
2268
2269 req->state = NVME_TCP_SEND_CMD_PDU;
2270 req->offset = 0;
2271 req->data_sent = 0;
2272 req->pdu_len = 0;
2273 req->pdu_sent = 0;

--- 318 unchanged lines hidden ---