* Re: [RFC PATCH nvme-cli 2/2] nvme-cli/plugins/mi:add support
[not found] ` <20210709160430.GB291156@dhcp-10-100-145-180.wdc.com>
@ 2021-07-19 15:31 ` Mohit Kapoor
0 siblings, 0 replies; only message in thread
From: Mohit Kapoor @ 2021-07-19 15:31 UTC (permalink / raw)
To: Keith Busch
Cc: linux-nvme, qemu-devel, its, stefanha, fam, kwolf, mreitz,
qemu-block, k.jensen, p.kalghatgi, javier.gonz, prakash.v,
d.palani, u.kishore, jg123.choi
[-- Attachment #1: Type: text/plain, Size: 2063 bytes --]
On Fri, Jul 09, 2021 at 09:04:30AM -0700, Keith Busch wrote:
>> +int hal_init()
>> +{
>> + int retval = -1;
>> + switch (GetSidebandInterface()) {
>> + case qemu_nvme_mi:
>> + retval = qemu_mi_init();
>> + break;
>> + default:
>> + break;
>> + }
>> + return retval;
>> +}
>> +
>> +int hal_open()
>> +{
>> + int retval = -1;
>> + switch (GetSidebandInterface()) {
>> + case qemu_nvme_mi:
>> + retval = qemu_mi_open();
>> + break;
>> + default:
>> + break;
>> + }
>> + return retval;
>> +}
>> +
>> +int hal_close()
>> +{
>> + int retval = -1;
>> + switch (GetSidebandInterface()) {
>> + case qemu_nvme_mi:
>> + retval = qemu_mi_close();
>> + break;
>> + default:
>> + break;
>> + }
>> + return retval;
>> +}
>> +
>> +int hal_i2c_write(uint8_t *data_out, uint16_t num_bytes)
>> +{
>> + int retval = -1;
>> + switch (GetSidebandInterface()) {
>> + case qemu_nvme_mi:
>> + retval = qemu_mi_write(data_out, num_bytes);
>> + break;
>> + default:
>> + break;
>> + }
>> + return retval;
>> +}
>> +
>> +int hal_i2c_read(uint8_t *data_in, uint16_t num_bytes)
>> +{
>> + uint32_t retval = -1;
>> + switch (GetSidebandInterface()) {
>> + case qemu_nvme_mi:
>> + retval = qemu_mi_read(data_in, num_bytes);
>> + break;
>> + default:
>> + break;
>> + }
>> + return retval;
>> +}
>
>I'm really not a fan of having non-standard interfaces. If you were
>going to do that, though, you should create a struct of function
>pointers so that you don't need these repetitive "switch (...)"
>statements.
>
>But if we're going to have OOB MI support in toolign, they should all
>use the same standard defined interface.
>
Thanks for your comments.
We are planning to incorporate smbus/i2c interface in nvme-cli & qemu
and the patch will be shared in a few days.
While sharing the above patch, we will take care of the hardware
interface layer based on function pointer implementation as well.
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
[-- Attachment #3: Type: text/plain, Size: 158 bytes --]
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-19 15:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20210709145458epcas5p35826843853e7a8986098c4ff8fba857a@epcas5p3.samsung.com>
[not found] ` <20210709145352.GA14300@test-zns>
[not found] ` <20210709160430.GB291156@dhcp-10-100-145-180.wdc.com>
2021-07-19 15:31 ` [RFC PATCH nvme-cli 2/2] nvme-cli/plugins/mi:add support Mohit Kapoor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox