Lines Matching refs:req
10 static void nvmet_execute_prop_set(struct nvmet_req *req)
12 u64 val = le64_to_cpu(req->cmd->prop_set.value);
15 if (!nvmet_check_transfer_len(req, 0))
18 if (req->cmd->prop_set.attrib & 1) {
19 req->error_loc =
25 switch (le32_to_cpu(req->cmd->prop_set.offset)) {
27 nvmet_update_cc(req->sq->ctrl, val);
30 req->error_loc =
35 nvmet_req_complete(req, status);
38 static void nvmet_execute_prop_get(struct nvmet_req *req)
40 struct nvmet_ctrl *ctrl = req->sq->ctrl;
44 if (!nvmet_check_transfer_len(req, 0))
47 if (req->cmd->prop_get.attrib & 1) {
48 switch (le32_to_cpu(req->cmd->prop_get.offset)) {
57 switch (le32_to_cpu(req->cmd->prop_get.offset)) {
73 if (status && req->cmd->prop_get.attrib & 1) {
74 req->error_loc =
77 req->error_loc =
81 req->cqe->result.u64 = cpu_to_le64(val);
82 nvmet_req_complete(req, status);
85 u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req)
87 struct nvme_command *cmd = req->cmd;
91 req->execute = nvmet_execute_prop_set;
94 req->execute = nvmet_execute_prop_get;
99 req->error_loc = offsetof(struct nvmf_common_command, fctype);
106 static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req)
108 struct nvmf_connect_command *c = &req->cmd->connect;
114 old = cmpxchg(&req->sq->ctrl, NULL, ctrl);
117 req->error_loc = offsetof(struct nvmf_connect_command, opcode);
122 req->error_loc = offsetof(struct nvmf_connect_command, sqsize);
123 req->cqe->result.u32 = IPO_IATTR_CONNECT_SQE(sqsize);
129 nvmet_cq_setup(ctrl, req->cq, qid, sqsize + 1);
130 nvmet_sq_setup(ctrl, req->sq, qid, sqsize + 1);
133 req->sq->sqhd_disabled = true;
134 req->cqe->sq_head = cpu_to_le16(0xffff);
138 ret = ctrl->ops->install_queue(req->sq);
149 req->sq->ctrl = NULL;
153 static void nvmet_execute_admin_connect(struct nvmet_req *req)
155 struct nvmf_connect_command *c = &req->cmd->connect;
160 if (!nvmet_check_transfer_len(req, sizeof(struct nvmf_connect_data)))
169 status = nvmet_copy_from_sgl(req, 0, d, sizeof(*d));
174 req->cqe->result.u32 = 0;
179 req->error_loc = offsetof(struct nvmf_connect_command, recfmt);
188 req->cqe->result.u32 = IPO_IATTR_CONNECT_DATA(cntlid);
194 status = nvmet_alloc_ctrl(d->subsysnqn, d->hostnqn, req,
198 req->error_loc =
207 status = nvmet_install_queue(ctrl, req);
216 req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);
221 nvmet_req_complete(req, status);
224 static void nvmet_execute_io_connect(struct nvmet_req *req)
226 struct nvmf_connect_command *c = &req->cmd->connect;
232 if (!nvmet_check_transfer_len(req, sizeof(struct nvmf_connect_data)))
241 status = nvmet_copy_from_sgl(req, 0, d, sizeof(*d));
246 req->cqe->result.u32 = 0;
258 le16_to_cpu(d->cntlid), req);
267 req->cqe->result.u32 = IPO_IATTR_CONNECT_SQE(qid);
271 status = nvmet_install_queue(ctrl, req);
276 req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);
283 nvmet_req_complete(req, status);
291 u16 nvmet_parse_connect_cmd(struct nvmet_req *req)
293 struct nvme_command *cmd = req->cmd;
298 req->error_loc = offsetof(struct nvme_common_command, opcode);
304 req->error_loc = offsetof(struct nvmf_common_command, fctype);
309 req->execute = nvmet_execute_admin_connect;
311 req->execute = nvmet_execute_io_connect;