コード例 #1
0
ファイル: nvme_qpair.c プロジェクト: rootfs/spdk
static void
nvme_qpair_print_command(struct nvme_qpair *qpair, struct nvme_command *cmd)
{
	nvme_assert(qpair != NULL, ("qpair can not be NULL"));
	nvme_assert(cmd != NULL, ("cmd can not be NULL"));

	if (nvme_qpair_is_admin_queue(qpair)) {
		nvme_admin_qpair_print_command(qpair, cmd);
	} else {
		nvme_io_qpair_print_command(qpair, cmd);
	}
}
コード例 #2
0
ファイル: nvme_ctrlr_cmd.c プロジェクト: jupiturliu/spdk
void
nvme_ctrlr_cmd_get_error_page(struct nvme_controller *ctrlr,
			      struct nvme_error_information_entry *payload, uint32_t num_entries,
			      nvme_cb_fn_t cb_fn, void *cb_arg)
{

	nvme_assert(num_entries > 0, ("%s called with num_entries==0\n", __func__));

	/* Controller's error log page entries is 0-based. */
	nvme_assert(num_entries <= (ctrlr->cdata.elpe + 1),
		    ("%s called with num_entries=%d but (elpe+1)=%d\n", __func__,
		     num_entries, ctrlr->cdata.elpe + 1));

	if (num_entries > (ctrlr->cdata.elpe + 1))
		num_entries = ctrlr->cdata.elpe + 1;

	nvme_ctrlr_cmd_get_log_page(ctrlr, NVME_LOG_ERROR,
				    NVME_GLOBAL_NAMESPACE_TAG, payload, sizeof(*payload) * num_entries,
				    cb_fn, cb_arg);
}
コード例 #3
0
ファイル: nvme_qpair_ut.c プロジェクト: SmartMircoArray/spdk
struct nvme_request *
nvme_allocate_request(void *payload, uint32_t payload_size,
		      nvme_cb_fn_t cb_fn, void *cb_arg)
{
	struct nvme_request *req = NULL;

	nvme_alloc_request(&req);

	if (req == NULL) {
		return req;
	}

	/*
	 * Only memset up to (but not including) the children
	 *  TAILQ_ENTRY.  children, and following members, are
	 *  only used as part of I/O splitting so we avoid
	 *  memsetting them until it is actually needed.
	 *  They will be initialized in nvme_request_add_child()
	 *  if the request is split.
	 */
	memset(req, 0, offsetof(struct nvme_request, children));
	req->cb_fn = cb_fn;
	req->cb_arg = cb_arg;
	req->timeout = true;
	nvme_assert((payload == NULL && payload_size == 0) ||
		    (payload != NULL && payload_size != 0),
		    ("Invalid argument combination of payload and payload_size\n"));
	if (payload == NULL || payload_size == 0) {
		req->u.payload = NULL;
		req->payload_size = 0;
	} else {
		req->u.payload = payload;
		req->payload_size = payload_size;
	}

	return req;
}
コード例 #4
0
ファイル: nvme.c プロジェクト: SmartMircoArray/spdk
void
nvme_free_request(struct nvme_request *req)
{
	nvme_assert(req != NULL, ("nvme_free_request(NULL)\n"));
	nvme_dealloc_request(req);
}