Skip to contentSkip to conversation

nvmet-passthru: Add passthru code to process commands

PATCH Rong Chen 1 participant 1 message Jun 28, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Rong Chen

author
#1 lore raw
Quoted 6 lines · Logan Gunthorpe
Quoted 4 lines · kernel test robot

Hi Logan,

I love your patch! Yet something to improve:

Quoted 8 lines
Quoted 6 lines

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.8-rc2 next-20200626] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

The patch set is supposed to be based on nvme-5.9. There was a valid base-commit tag in the cover letter.

Hi Logan,

Thanks for the feedback, we'll fix it.

Best Regards,
Rong Chen

Quoted 128 lines

Thanks,

Logan

Quoted 121 lines
url:    https://github.com/0day-ci/linux/commits/Logan-Gunthorpe/nvmet-add-target-passthru-commands-support/20200626-234457
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5e857ce6eae7ca21b2055cca4885545e29228fe2
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

drivers/nvme/target/passthru.c: In function 'nvmet_passthru_override_id_ctrl':

Quoted 1 line
Quoted 1 line

drivers/nvme/target/passthru.c:212:15: error: 'const struct nvmet_fabrics_ops' has no member named 'flags'

      212 |  if (ctrl->ops->flags & NVMF_KEYED_SGLS)
          |               ^~
Quoted 1 line
Quoted 1 line

drivers/nvme/target/passthru.c:212:25: error: 'NVMF_KEYED_SGLS' undeclared (first use in this function)

      212 |  if (ctrl->ops->flags & NVMF_KEYED_SGLS)
          |                         ^~~~~~~~~~~~~~~
    drivers/nvme/target/passthru.c:212:25: note: each undeclared identifier is reported only once for each function it appears in

vim +212 drivers/nvme/target/passthru.c

    156	
    157	static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req)
    158	{
    159		struct nvmet_ctrl *ctrl = req->sq->ctrl;
    160		struct nvme_ctrl *pctrl = ctrl->subsys->passthru_ctrl;
    161		u16 status = NVME_SC_SUCCESS;
    162		struct nvme_id_ctrl *id;
    163		u32 max_hw_sectors;
    164		int page_shift;
    165	
    166		id = kzalloc(sizeof(*id), GFP_KERNEL);
    167		if (!id)
    168			return NVME_SC_INTERNAL;
    169	
    170		status = nvmet_copy_from_sgl(req, 0, id, sizeof(*id));
    171		if (status)
    172			goto out_free;
    173	
    174		id->cntlid = cpu_to_le16(ctrl->cntlid);
    175		id->ver = cpu_to_le32(ctrl->subsys->ver);
    176	
    177		/*
    178		 * The passthru NVMe driver may have a limit on the number of segments
    179		 * which depends on the host's memory fragementation. To solve this,
    180		 * ensure mdts is limitted to the pages equal to the number of
    181		 * segments.
    182		 */
    183		max_hw_sectors = min_not_zero(pctrl->max_segments << (PAGE_SHIFT - 9),
    184					      pctrl->max_hw_sectors);
    185	
    186		page_shift = NVME_CAP_MPSMIN(ctrl->cap) + 12;
    187	
    188		id->mdts = ilog2(max_hw_sectors) + 9 - page_shift;
    189	
    190		id->acl = 3;
    191		/*
    192		 * We export aerl limit for the fabrics controller, update this when
    193		 * passthru based aerl support is added.
    194		 */
    195		id->aerl = NVMET_ASYNC_EVENTS - 1;
    196	
    197		/* emulate kas as most of the PCIe ctrl don't have a support for kas */
    198		id->kas = cpu_to_le16(NVMET_KAS);
    199	
    200		/* don't support host memory buffer */
    201		id->hmpre = 0;
    202		id->hmmin = 0;
    203	
    204		id->sqes = min_t(__u8, ((0x6 << 4) | 0x6), id->sqes);
    205		id->cqes = min_t(__u8, ((0x4 << 4) | 0x4), id->cqes);
    206		id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
    207	
    208		/* don't support fuse commands */
    209		id->fuses = 0;
    210	
    211		id->sgls = cpu_to_le32(1 << 0); /* we always support SGLs */
Quoted 1 line

212 if (ctrl->ops->flags & NVMF_KEYED_SGLS)

    213			id->sgls |= cpu_to_le32(1 << 2);
    214		if (req->port->inline_data_size)
    215			id->sgls |= cpu_to_le32(1 << 20);
    216	
    217		/*
    218		 * When passsthru controller is setup using nvme-loop transport it will
    219		 * export the passthru ctrl subsysnqn (PCIe NVMe ctrl) and will fail in
    220		 * the nvme/host/core.c in the nvme_init_subsystem()->nvme_active_ctrl()
    221		 * code path with duplicate ctr subsynqn. In order to prevent that we
    222		 * mask the passthru-ctrl subsysnqn with the target ctrl subsysnqn.
    223		 */
    224		memcpy(id->subnqn, ctrl->subsysnqn, sizeof(id->subnqn));
    225	
    226		/* use fabric id-ctrl values */
    227		id->ioccsz = cpu_to_le32((sizeof(struct nvme_command) +
    228					req->port->inline_data_size) / 16);
    229		id->iorcsz = cpu_to_le32(sizeof(struct nvme_completion) / 16);
    230	
    231		id->msdbd = ctrl->ops->msdbd;
    232	
    233		/* Support multipath connections with fabrics */
    234		id->cmic |= 1 << 1;
    235	
    236		/* Disable reservations, see nvmet_parse_passthru_io_cmd() */
    237		id->oncs &= cpu_to_le16(~NVME_CTRL_ONCS_RESERVATIONS);
    238	
    239		status = nvmet_copy_to_sgl(req, 0, id, sizeof(struct nvme_id_ctrl));
    240	
    241	out_free:
    242		kfree(id);
    243		return status;
    244	}
    245	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org