qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mohit Kapoor <mohit.kap@samsung.com>
To: Keith Busch <kbusch@kernel.org>
Cc: fam@euphon.net, kwolf@redhat.com, p.kalghatgi@samsung.com,
	qemu-block@nongnu.org, k.jensen@samsung.com,
	d.palani@samsung.com, qemu-devel@nongnu.org,
	linux-nvme@lists.infradead.org, mreitz@redhat.com,
	u.kishore@samsung.com, stefanha@redhat.com, its@irrelevant.dk,
	javier.gonz@samsung.com, prakash.v@samsung.com,
	jg123.choi@samsung.com
Subject: Re: [RFC PATCH nvme-cli 2/2] nvme-cli/plugins/mi:add support
Date: Mon, 19 Jul 2021 21:01:41 +0530	[thread overview]
Message-ID: <20210719153141.GA28218@test-zns> (raw)
In-Reply-To: <20210709160430.GB291156@dhcp-10-100-145-180.wdc.com>

[-- 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 --]



      reply	other threads:[~2021-07-19 15:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210709145458epcas5p35826843853e7a8986098c4ff8fba857a@epcas5p3.samsung.com>
2021-07-09 14:53 ` [RFC PATCH nvme-cli 2/2] nvme-cli/plugins/mi:add support Mohit Kapoor
2021-07-09 16:04   ` Keith Busch
2021-07-19 15:31     ` Mohit Kapoor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210719153141.GA28218@test-zns \
    --to=mohit.kap@samsung.com \
    --cc=d.palani@samsung.com \
    --cc=fam@euphon.net \
    --cc=its@irrelevant.dk \
    --cc=javier.gonz@samsung.com \
    --cc=jg123.choi@samsung.com \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mreitz@redhat.com \
    --cc=p.kalghatgi@samsung.com \
    --cc=prakash.v@samsung.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=u.kishore@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).