Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Mar 2018 22:12:31 -0800
From:      Conrad Meyer <cem@freebsd.org>
To:        Alexander Motin <mav@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r330759 - in head: sbin/nvmecontrol sys/dev/nvme
Message-ID:  <CAG6CVpXc9uxHTFGVn_XF4EzWt8gPvT31fDZPzWCT_L5vtrDe2Q@mail.gmail.com>
In-Reply-To: <201803110509.w2B5928t008519@repo.freebsd.org>
References:  <201803110509.w2B5928t008519@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Mar 10, 2018 at 9:09 PM, Alexander Motin <mav@freebsd.org> wrote:
> Author: mav
> Date: Sun Mar 11 05:09:02 2018
> New Revision: 330759
> URL: https://svnweb.freebsd.org/changeset/base/330759
>
> Log:
>   Add new identify data structures fields from NVMe 1.3a.
>
> ...
> Modified: head/sbin/nvmecontrol/identify.c
> ==============================================================================
> --- head/sbin/nvmecontrol/identify.c    Sun Mar 11 04:37:05 2018        (r330758)
> +++ head/sbin/nvmecontrol/identify.c    Sun Mar 11 05:09:02 2018        (r330759)
> @@ -95,25 +95,35 @@ print_controller(struct nvme_controller_data *cdata)
> ...
> +           ((cdata->mic >> NVME_CTRLR_DATA_MIC_SRIOVVF_SHIFT) &
> +            NVME_CTRLR_DATA_MIC_SRIOVVF_MASK) ? "SR-IOV VF, " : "",
> +           ((cdata->mic >> NVME_CTRLR_DATA_MIC_MCTRLRS_SHIFT) &
> +            NVME_CTRLR_DATA_MIC_MCTRLRS_MASK) ? "Multiple controllers, " : "",
> +           ((cdata->mic >> NVME_CTRLR_DATA_MIC_MPORTS_SHIFT) &
> +            NVME_CTRLR_DATA_MIC_MPORTS_MASK) ? "Multiple ports" : "");
> ...
> Modified: head/sys/dev/nvme/nvme.h
> ==============================================================================
> --- head/sys/dev/nvme/nvme.h    Sun Mar 11 04:37:05 2018        (r330758)
> +++ head/sys/dev/nvme/nvme.h    Sun Mar 11 05:09:02 2018        (r330759)
> @@ -153,6 +153,17 @@
>  #define NVME_PWR_ST_APS_SHIFT                          (6)
>  #define NVME_PWR_ST_APS_MASK                           (0x3)
>
> +/** Controller Multi-path I/O and Namespace Sharing Capabilities */
> +/* More then one port */
> +#define NVME_CTRLR_DATA_MIC_MPORTS_SHIFT               (0)
> +#define NVME_CTRLR_DATA_MIC_MPORTS_MASK                        (0x1)
> +/* More then one controller */
> +#define NVME_CTRLR_DATA_MIC_MCTRLRS_SHIFT              (1)
> +#define NVME_CTRLR_DATA_MIC_MCTRLRS_MASK               (0x1)
> +/* SR-IOV Virtual Function */
> +#define NVME_CTRLR_DATA_MIC_SRIOVVF_SHIFT              (2)
> +#define NVME_CTRLR_DATA_MIC_SRIOVVF_MASK               (0x1)
> +
>  /** OACS - optional admin command support */
>  /* supports security send/receive commands */
>  #define NVME_CTRLR_DATA_OACS_SECURITY_SHIFT            (0)
> @@ -166,6 +177,21 @@
>  /* supports namespace management commands */
>  #define NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT              (3)
>  #define NVME_CTRLR_DATA_OACS_NSMGMT_MASK               (0x1)
> +/* supports Device Self-test command */
> +#define NVME_CTRLR_DATA_OACS_SELFTEST_SHIFT            (4)
> +#define NVME_CTRLR_DATA_OACS_SELFTEST_MASK             (0x1)
> +/* supports Directives */
> +#define NVME_CTRLR_DATA_OACS_DIRECTIVES_SHIFT          (5)
> +#define NVME_CTRLR_DATA_OACS_DIRECTIVES_MASK           (0x1)
> +/* supports NVMe-MI Send/Receive */
> +#define NVME_CTRLR_DATA_OACS_NVMEMI_SHIFT              (6)
> +#define NVME_CTRLR_DATA_OACS_NVMEMI_MASK               (0x1)
> +/* supports Virtualization Management */
> +#define NVME_CTRLR_DATA_OACS_VM_SHIFT                  (7)
> +#define NVME_CTRLR_DATA_OACS_VM_MASK                   (0x1)
> +/* supports Doorbell Buffer Config */
> +#define NVME_CTRLR_DATA_OACS_DBBUFFER_SHIFT            (8)
> +#define NVME_CTRLR_DATA_OACS_DBBUFFER_MASK             (0x1)

This seems like a suboptimal way to represent and check single flag
bits.  Is there a reason the conventional (1<<N) was not used?

Thanks,
Conrad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXc9uxHTFGVn_XF4EzWt8gPvT31fDZPzWCT_L5vtrDe2Q>