0

I am working on a testing tool for nvme-cli(written in c and can run on linux).

For SSD validation purpose, we are actually looking for sending I/O commands to a particular Submission queue(IO Queue pair). 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.

So is there any way in ioctl() where we can specify the Submission queue IDs?

Here is how a nvme IO is requested with ioctl()

 ioctl(fd, NVME_IOCTL_SUBMIT_IO, &io);

This invokes nvme_ioctl() in the driver here!

nvme_ioctl() intern invokes the nvme_submit_io() Function here!

nvme_submit_io() has the a parameter struct nvme_ns *ns where the structure has a field name queueview here!

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.

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.

Arjun G S
  • 23
  • 13
  • This question is implied to be improved version of the [previous one](https://stackoverflow.com/questions/47899389/is-there-any-alternative-for-ioctl-in-linux-to-interact-with-nvme-drives), isn't it? If so, instead of asking new question, **improve existing question** via editing. `I wanted to know if we can invoke ioctl() with a additional new parameter ...` - ioctl accepts exactly 3 parameters, you cannot pass more. – Tsyvarev Dec 21 '17 at 08:26
  • @Tsyvarev Can I end-up with any solution, is there any other way i can solve this?? Is the any other procedure alternative to `ioctl()` where we can send additional parameters?? – Arjun G S Dec 21 '17 at 09:26
  • Some of your [previous question](https://stackoverflow.com/questions/47668183/is-there-a-way-to-have-a-ioctl-with-newcustomized-command) was about writting new ioctl command. Why do not follow that approach? – Tsyvarev Dec 21 '17 at 09:51
  • @Tsyvarev for adding new ioctl command, doesn't the device need to support that option? – Ora Dec 21 '17 at 10:02
  • Yes, device needs to be designed so. However, by this line `struct nvme_ns *ns = bdev->bd_disk->private_data;` (in `nvme_ioctl` function) I understand, that `ns` structure and its fields (with `.queue` among them) are *specific for the block device*. So, the only way to use another queue is to send ioctl request to **another file, representing another disk**. I am not familiar with nvme, but this is just the code means for me. – Tsyvarev Dec 21 '17 at 10:24
  • `@Tsyvarev` regarding `writting new ioctl command` adding a new ioctl command requires addition of new modules(functions) in the driver. But from building a tool perspective, adding new modules for driver is not a good design. So we are interested in finding a way where we can use existing driver modules to get the required functionality. – Arjun G S Dec 21 '17 at 11:28

1 Answers1

0

Look a little bit into nvme_submit_io(), it calls nvme_submit_user_cmd() Refer here. You will see 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.

Back to your question. AFAIK, there has NO native way to specify QID when sending ioctl cmd. If you really want to. You need to modify native nvme source code and build your own nvme driver.

HINT: Try to let nvme_alloc_request can receive specified QID, instead of NVME_QID_ANY.

Robert
  • 1