简体   繁体   English

linux中的ioctl()有没有办法为nvme IO请求指定提交队列ID

[英]Is there any way for ioctl() in linux to specify submission queue ID for a nvme IO request

I am working on a testing tool for nvme-cli(written in c and can run on linux).我正在为 nvme-cli 开发一个测试工具(用 c 编写,可以在 linux 上运行)。

For SSD validation purpose, we are actually looking for sending I/O commands to a particular Submission queue(IO Queue pair).出于 SSD 验证的目的,我们实际上是在寻找将 I/O 命令发送到特定提交队列(IO 队列对)。 We needed this because we wanted threading, but for threading to happen we need to send I/O requests to different queues else the I/O requests would be processed serially.我们需要这样做是因为我们想要线程化,但是为了实现线程化,我们需要将 I/O 请求发送到不同的队列,否则 I/O 请求将被串行处理。

So is there any way in ioctl() where we can specify the Submission queue IDs?那么在 ioctl() 中有什么方法可以指定提交队列 ID?

Here is how a nvme IO is requested with ioctl()以下是使用ioctl()请求 nvme IO 的方式

 ioctl(fd, NVME_IOCTL_SUBMIT_IO, &io);

This invokes nvme_ioctl() in the driver here !这在这里调用驱动程序中的nvme_ioctl()

nvme_ioctl() intern invokes the nvme_submit_io() Function here ! nvme_ioctl()实习生在这里调用nvme_submit_io()函数!

nvme_submit_io() has the a parameter struct nvme_ns *ns where the structure has a field name queue view here ! nvme_submit_io()有一个参数struct nvme_ns *ns ,这里的结构有一个字段名queue 视图

I wanted to know if we can invoke ioctl() with a additional new parameter queue_id which is to be assigned to queue field of struct nvme_ns *ns in the nvme_submit_io() function.我想知道我们是否可以使用附加的新参数queue_id调用ioctl() ,该参数将分配给nvme_submit_io()函数中struct nvme_ns *ns queue字段。

Can I know if we can do like this?我能知道我们是否可以这样做吗?

If yes, please give me some brief steps.如果是,请给我一些简短的步骤。 If NO, please suggest me any possible solution.如果否,请建议我任何可能的解决方案。

Since i am new to nvme or ioctl, please correct me if i am wrong.由于我是 nvme 或 ioctl 的新手,如果我错了,请纠正我。

Look a little bit into nvme_submit_io() , it calls nvme_submit_user_cmd() Refer here .稍微看一下nvme_submit_io() ,它调用nvme_submit_user_cmd() 参考这里 You will see nvme_alloc_request(q, cmd, 0, NVME_QID_ANY) .您将看到nvme_alloc_request(q, cmd, 0, NVME_QID_ANY) The request allocates to NVME_QID_ANY means it not specify QID and let the hardware queue mapping to decide which queue is going to send.请求分配给NVME_QID_ANY意味着它不指定 QID 并让硬件队列映射来决定要发送哪个队列。

Back to your question.回到你的问题。 AFAIK, there has NO native way to specify QID when sending ioctl cmd. AFAIK,在发送 ioctl cmd 时没有指定 QID 的本机方法。 If you really want to.如果你真的想要。 You need to modify native nvme source code and build your own nvme driver.您需要修改原生 nvme 源代码并构建您自己的 nvme 驱动程序。

HINT: Try to let nvme_alloc_request can receive specified QID, instead of NVME_QID_ANY .提示:尝试让nvme_alloc_request可以接收指定的 QID,而不是NVME_QID_ANY

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM