discovery.c (c95baf12f5077419db01313ab61c2aac007d40cd) discovery.c (136cc1ffcf0a3309c59d844cb1a4ddad964ea3d8)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Discovery service for the NVMe over Fabrics target.
4 * Copyright (C) 2016 Intel Corporation. All rights reserved.
5 */
6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7#include <linux/slab.h>
8#include <generated/utsrelease.h>

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

166 size_t data_len = nvmet_get_log_page_len(req->cmd);
167 size_t alloc_len;
168 struct nvmet_subsys_link *p;
169 struct nvmet_port *r;
170 u32 numrec = 0;
171 u16 status = 0;
172 void *buffer;
173
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Discovery service for the NVMe over Fabrics target.
4 * Copyright (C) 2016 Intel Corporation. All rights reserved.
5 */
6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7#include <linux/slab.h>
8#include <generated/utsrelease.h>

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

166 size_t data_len = nvmet_get_log_page_len(req->cmd);
167 size_t alloc_len;
168 struct nvmet_subsys_link *p;
169 struct nvmet_port *r;
170 u32 numrec = 0;
171 u16 status = 0;
172 void *buffer;
173
174 if (!nvmet_check_data_len(req, data_len))
174 if (!nvmet_check_transfer_len(req, data_len))
175 return;
176
177 if (req->cmd->get_log_page.lid != NVME_LOG_DISC) {
178 req->error_loc =
179 offsetof(struct nvme_get_log_page_command, lid);
180 status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
181 goto out;
182 }

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

239
240static void nvmet_execute_disc_identify(struct nvmet_req *req)
241{
242 struct nvmet_ctrl *ctrl = req->sq->ctrl;
243 struct nvme_id_ctrl *id;
244 const char model[] = "Linux";
245 u16 status = 0;
246
175 return;
176
177 if (req->cmd->get_log_page.lid != NVME_LOG_DISC) {
178 req->error_loc =
179 offsetof(struct nvme_get_log_page_command, lid);
180 status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
181 goto out;
182 }

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

239
240static void nvmet_execute_disc_identify(struct nvmet_req *req)
241{
242 struct nvmet_ctrl *ctrl = req->sq->ctrl;
243 struct nvme_id_ctrl *id;
244 const char model[] = "Linux";
245 u16 status = 0;
246
247 if (!nvmet_check_data_len(req, NVME_IDENTIFY_DATA_SIZE))
247 if (!nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE))
248 return;
249
250 if (req->cmd->identify.cns != NVME_ID_CNS_CTRL) {
251 req->error_loc = offsetof(struct nvme_identify, cns);
252 status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
253 goto out;
254 }
255

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

293 nvmet_req_complete(req, status);
294}
295
296static void nvmet_execute_disc_set_features(struct nvmet_req *req)
297{
298 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
299 u16 stat;
300
248 return;
249
250 if (req->cmd->identify.cns != NVME_ID_CNS_CTRL) {
251 req->error_loc = offsetof(struct nvme_identify, cns);
252 status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
253 goto out;
254 }
255

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

293 nvmet_req_complete(req, status);
294}
295
296static void nvmet_execute_disc_set_features(struct nvmet_req *req)
297{
298 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
299 u16 stat;
300
301 if (!nvmet_check_data_len(req, 0))
301 if (!nvmet_check_transfer_len(req, 0))
302 return;
303
304 switch (cdw10 & 0xff) {
305 case NVME_FEAT_KATO:
306 stat = nvmet_set_feat_kato(req);
307 break;
308 case NVME_FEAT_ASYNC_EVENT:
309 stat = nvmet_set_feat_async_event(req,

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

319 nvmet_req_complete(req, stat);
320}
321
322static void nvmet_execute_disc_get_features(struct nvmet_req *req)
323{
324 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
325 u16 stat = 0;
326
302 return;
303
304 switch (cdw10 & 0xff) {
305 case NVME_FEAT_KATO:
306 stat = nvmet_set_feat_kato(req);
307 break;
308 case NVME_FEAT_ASYNC_EVENT:
309 stat = nvmet_set_feat_async_event(req,

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

319 nvmet_req_complete(req, stat);
320}
321
322static void nvmet_execute_disc_get_features(struct nvmet_req *req)
323{
324 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
325 u16 stat = 0;
326
327 if (!nvmet_check_data_len(req, 0))
327 if (!nvmet_check_transfer_len(req, 0))
328 return;
329
330 switch (cdw10 & 0xff) {
331 case NVME_FEAT_KATO:
332 nvmet_get_feat_kato(req);
333 break;
334 case NVME_FEAT_ASYNC_EVENT:
335 nvmet_get_feat_async_event(req);

--- 61 unchanged lines hidden ---
328 return;
329
330 switch (cdw10 & 0xff) {
331 case NVME_FEAT_KATO:
332 nvmet_get_feat_kato(req);
333 break;
334 case NVME_FEAT_ASYNC_EVENT:
335 nvmet_get_feat_async_event(req);

--- 61 unchanged lines hidden ---