Lines Matching refs: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) {
238 nvmet_clear_aen_bit(req, NVME_AEN_BIT_DISC_CHANGE);
242 status = nvmet_copy_to_sgl(req, 0, buffer + offset, data_len);
245 nvmet_req_complete(req, status);
248 static void nvmet_execute_disc_identify(struct nvmet_req *req)
250 struct nvmet_ctrl *ctrl = req->sq->ctrl;
254 if (!nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE))
257 if (req->cmd->identify.cns != NVME_ID_CNS_CTRL) {
258 req->error_loc = offsetof(struct nvme_identify, cns);
290 if (req->port->inline_data_size)
297 status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
301 nvmet_req_complete(req, status);
304 static void nvmet_execute_disc_set_features(struct nvmet_req *req)
306 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
309 if (!nvmet_check_transfer_len(req, 0))
314 stat = nvmet_set_feat_kato(req);
317 stat = nvmet_set_feat_async_event(req,
321 req->error_loc =
327 nvmet_req_complete(req, stat);
330 static void nvmet_execute_disc_get_features(struct nvmet_req *req)
332 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
335 if (!nvmet_check_transfer_len(req, 0))
340 nvmet_get_feat_kato(req);
343 nvmet_get_feat_async_event(req);
346 req->error_loc =
352 nvmet_req_complete(req, stat);
355 u16 nvmet_parse_discovery_cmd(struct nvmet_req *req)
357 struct nvme_command *cmd = req->cmd;
359 if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) {
362 req->error_loc =
369 req->execute = nvmet_execute_disc_set_features;
372 req->execute = nvmet_execute_disc_get_features;
375 req->execute = nvmet_execute_async_event;
378 req->execute = nvmet_execute_keep_alive;
381 req->execute = nvmet_execute_disc_get_log_page;
384 req->execute = nvmet_execute_disc_identify;
388 req->error_loc = offsetof(struct nvme_common_command, opcode);