Lines Matching defs:req

132  * from the req->port address in case the port in question listens
135 static void nvmet_set_disc_traddr(struct nvmet_req *req, struct nvmet_port *port,
138 if (req->ops->disc_traddr)
139 req->ops->disc_traddr(req, port, traddr);
144 static size_t discovery_log_entries(struct nvmet_req *req)
146 struct nvmet_ctrl *ctrl = req->sq->ctrl;
151 list_for_each_entry(p, &req->port->subsystems, entry) {
156 list_for_each_entry(r, &req->port->referrals, entry)
161 static void nvmet_execute_disc_get_log_page(struct nvmet_req *req)
164 struct nvmet_ctrl *ctrl = req->sq->ctrl;
166 u64 offset = nvmet_get_log_page_offset(req->cmd);
167 size_t data_len = nvmet_get_log_page_len(req->cmd);
176 if (!nvmet_check_transfer_len(req, data_len))
179 if (req->cmd->get_log_page.lid != NVME_LOG_DISC) {
180 req->error_loc =
188 req->error_loc =
200 alloc_len = sizeof(*hdr) + entry_size * discovery_log_entries(req);
209 nvmet_set_disc_traddr(req, req->port, traddr);
211 nvmet_format_discovery_entry(hdr, req->port,
216 list_for_each_entry(p, &req->port->subsystems, entry) {
220 nvmet_format_discovery_entry(hdr, req->port,
226 list_for_each_entry(r, &req->port->referrals, entry) {
241 nvmet_clear_aen_bit(req, NVME_AEN_BIT_DISC_CHANGE);
245 status = nvmet_copy_to_sgl(req, 0, buffer + offset, data_len);
248 nvmet_req_complete(req, status);
251 static void nvmet_execute_disc_identify(struct nvmet_req *req)
253 struct nvmet_ctrl *ctrl = req->sq->ctrl;
257 if (!nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE))
260 if (req->cmd->identify.cns != NVME_ID_CNS_CTRL) {
261 req->error_loc = offsetof(struct nvme_identify, cns);
293 if (req->port->inline_data_size)
300 status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
304 nvmet_req_complete(req, status);
307 static void nvmet_execute_disc_set_features(struct nvmet_req *req)
309 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
312 if (!nvmet_check_transfer_len(req, 0))
317 stat = nvmet_set_feat_kato(req);
320 stat = nvmet_set_feat_async_event(req,
324 req->error_loc =
330 nvmet_req_complete(req, stat);
333 static void nvmet_execute_disc_get_features(struct nvmet_req *req)
335 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
338 if (!nvmet_check_transfer_len(req, 0))
343 nvmet_get_feat_kato(req);
346 nvmet_get_feat_async_event(req);
349 req->error_loc =
355 nvmet_req_complete(req, stat);
358 u32 nvmet_discovery_cmd_data_len(struct nvmet_req *req)
360 struct nvme_command *cmd = req->cmd;
364 return nvmet_get_log_page_len(req->cmd);
372 u16 nvmet_parse_discovery_cmd(struct nvmet_req *req)
374 struct nvme_command *cmd = req->cmd;
376 if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) {
379 req->error_loc =
386 req->execute = nvmet_execute_disc_set_features;
389 req->execute = nvmet_execute_disc_get_features;
392 req->execute = nvmet_execute_async_event;
395 req->execute = nvmet_execute_keep_alive;
398 req->execute = nvmet_execute_disc_get_log_page;
401 req->execute = nvmet_execute_disc_identify;
405 req->error_loc = offsetof(struct nvme_common_command, opcode);