Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme: export nvme_configure_[sq|cq] to public #31

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions include/vfn/nvme/ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,49 @@ int nvme_del_ctrl(struct nvme_ctrl *ctrl);
*/
int nvme_reset(struct nvme_ctrl *ctrl);

/**
* nvme_configure_sq - Configure a submission queue instance
* @ctrl: Controller to configure a submission queue instance
* @qid: Queue identifier
* @qsize: Queue size
* @cq: Corresponding completion queue instance
* @flags: Submission queue configuration flags
*
* Create a submission queue instance for the given @qid. This allocates
* memory spaces for the submission queue and map it to IOMMU page table for
* the DMA operations.
*
* The newly created SQ instance can be referred by ``ctrl->sq[qid]``.
*
* **Note** This helper does not issue a Create I/O Submission Queue admin
* command to the admin submission queue. Caller should prepare command
* submission with the instance to be configured.
*
* Return: ``0`` on success, ``-1`` on error and set ``errno``.
*/
int nvme_configure_sq(struct nvme_ctrl *ctrl, int qid, int qsize,
struct nvme_cq *cq, unsigned long flags);

/**
* nvme_configure_cq - Configure a completion queue instance
* @ctrl: Controller to configure a completion queue instance
* @qid: Queue identifier
* @qsize: Queue size
* @vector: interrupt vector
*
* Create a completion queue instance for the given @qid. This allocates
* memory spaces for the completion queue and map it to IOMMU page table for
* the DMA operations.
*
* The newly created CQ instance can be referred by ``ctrl->cq[qid]``.
*
* **Note** This helper does not issue a Create I/O Completion Queue admin
* command to the admin submission queue. Caller should prepare command
* submission with the instance to be configured.
*
* Return: ``0`` on success, ``-1`` on error and set ``errno``.
*/
int nvme_configure_cq(struct nvme_ctrl *ctrl, int qid, int qsize, int vector);

/**
* nvme_configure_adminq - Configure admin sq/cq pair
Expand Down
6 changes: 3 additions & 3 deletions src/nvme/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int nvme_del_ctrl(struct nvme_ctrl *ctrl)
return 0;
}

static int nvme_configure_cq(struct nvme_ctrl *ctrl, int qid, int qsize, int vector)
int nvme_configure_cq(struct nvme_ctrl *ctrl, int qid, int qsize, int vector)
{
struct nvme_cq *cq = &ctrl->cq[qid];
uint64_t cap;
Expand Down Expand Up @@ -181,8 +181,8 @@ void nvme_discard_cq(struct nvme_ctrl *ctrl, struct nvme_cq *cq)
memset(cq, 0x0, sizeof(*cq));
}

static int nvme_configure_sq(struct nvme_ctrl *ctrl, int qid, int qsize,
struct nvme_cq *cq, unsigned long UNUSED flags)
int nvme_configure_sq(struct nvme_ctrl *ctrl, int qid, int qsize,
struct nvme_cq *cq, unsigned long UNUSED flags)
{
struct nvme_sq *sq = &ctrl->sq[qid];
uint64_t cap;
Expand Down
Loading