Skip to contentSkip to conversation

qla2xxx: Add EDIF support

PATCH Superseded Nilesh Javali 3 participants 4 messages May 7, 2021 – May 11, 2021

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Nilesh Javali

author maintainer
#0 lore raw

PATCH 1/1 qla2xxx: Add EDIF support

From: Quinn Tran <[email protected]>

Add Encryption for Data In Flight (EDIF) support. This feature allows data of 2 end points to be encrypted. A user application is required to play the role of authentication for both sides. On completion of authentication, user app shall provide a set of Tx/Rx keys and spi's for HW to program into the session.

modprobe qla2xxx ql2xsecenable=1

---
 drivers/scsi/qla2xxx/Makefile       |    3 +-
 drivers/scsi/qla2xxx/qla_attr.c     |    6 +-
 drivers/scsi/qla2xxx/qla_bsg.c      |   95 +-
 drivers/scsi/qla2xxx/qla_bsg.h      |    3 +
 drivers/scsi/qla2xxx/qla_dbg.h      |    1 +
 drivers/scsi/qla2xxx/qla_def.h      |  250 +-
 drivers/scsi/qla2xxx/qla_edif.c     | 3638 +++++++++++++++++++++++++++
 drivers/scsi/qla2xxx/qla_edif.h     |  160 ++
 drivers/scsi/qla2xxx/qla_edif_bsg.h |  225 ++
 drivers/scsi/qla2xxx/qla_fw.h       |   15 +-
 drivers/scsi/qla2xxx/qla_gbl.h      |   64 +-
 drivers/scsi/qla2xxx/qla_gs.c       |    4 +
 drivers/scsi/qla2xxx/qla_init.c     |  183 +-
 drivers/scsi/qla2xxx/qla_iocb.c     |   85 +-
 drivers/scsi/qla2xxx/qla_isr.c      |  313 ++-
 drivers/scsi/qla2xxx/qla_mbx.c      |   45 +-
 drivers/scsi/qla2xxx/qla_mid.c      |    7 +-
 drivers/scsi/qla2xxx/qla_nvme.c     |    4 +
 drivers/scsi/qla2xxx/qla_os.c       |  123 +-
 drivers/scsi/qla2xxx/qla_target.c   |  170 +-
 drivers/scsi/qla2xxx/qla_target.h   |   22 +-
 21 files changed, 5254 insertions(+), 162 deletions(-)
 create mode 100644 drivers/scsi/qla2xxx/qla_edif.c
 create mode 100644 drivers/scsi/qla2xxx/qla_edif.h
 create mode 100644 drivers/scsi/qla2xxx/qla_edif_bsg.h
drivers/scsi/qla2xxx/Makefile +2 -1
index 17d5bc1cc56b..cbc1303e761e 100644
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
 		qla_dbg.o qla_sup.o qla_attr.o qla_mid.o qla_dfs.o qla_bsg.o \
-		qla_nx.o qla_mr.o qla_nx2.o qla_target.o qla_tmpl.o qla_nvme.o
+		qla_nx.o qla_mr.o qla_nx2.o qla_target.o qla_tmpl.o qla_nvme.o \
+		qla_edif.o
 
 obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx.o
 obj-$(CONFIG_TCM_QLA2XXX) += tcm_qla2xxx.o
drivers/scsi/qla2xxx/qla_attr.c +5 -1
index 3aa9869f6fae..2b88bac3a68c 100644
@@ -2435,6 +2435,7 @@ static DEVICE_ATTR(port_speed, 0644, qla2x00_port_speed_show,
     qla2x00_port_speed_store);
 static DEVICE_ATTR(port_no, 0444, qla2x00_port_no_show, NULL);
 static DEVICE_ATTR(fw_attr, 0444, qla2x00_fw_attr_show, NULL);
+static DEVICE_ATTR_RO(edif_doorbell);
 
 
 struct device_attribute *qla2x00_host_attrs[] = {
@@ -2480,6 +2481,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
 	&dev_attr_port_no,
 	&dev_attr_fw_attr,
 	&dev_attr_dport_diagnostics,
+	&dev_attr_edif_doorbell,
 	NULL, /* reserve for qlini_mode */
 	NULL, /* reserve for ql2xiniexchg */
 	NULL, /* reserve for ql2xexchoffld */
@@ -3104,9 +3106,11 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
 
 
 	qla24xx_disable_vp(vha);
-	qla2x00_wait_for_sess_deletion(vha);
 
 	qla_nvme_delete(vha);
+	qla_enode_stop(vha);
+	qla_edb_stop(vha);
+
 	vha->flags.delete_progress = 1;
 
 	qlt_remove_target(ha, vha);
drivers/scsi/qla2xxx/qla_bsg.c +64 -31

188 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_bsg.h +3 -0
index 0274e99e4a12..dd793cf8bc1e 100644
@@ -31,6 +31,7 @@
 #define QL_VND_DPORT_DIAGNOSTICS	0x19
 #define QL_VND_GET_PRIV_STATS_EX	0x1A
 #define QL_VND_SS_GET_FLASH_IMAGE_STATUS	0x1E
+#define QL_VND_EDIF_MGMT                0X1F
 #define QL_VND_MANAGE_HOST_STATS	0x23
 #define QL_VND_GET_HOST_STATS		0x24
 #define QL_VND_GET_TGT_STATS		0x25
@@ -294,4 +295,6 @@ struct qla_active_regions {
 	uint8_t reserved[32];
 } __packed;
 
+#include "qla_edif_bsg.h"
+
 #endif
drivers/scsi/qla2xxx/qla_dbg.h +1 -0
index 9eb708e5e22e..f1f6c740bdcd 100644
@@ -367,6 +367,7 @@ ql_log_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...);
 #define ql_dbg_tgt_mgt	0x00002000 /* Target mode management */
 #define ql_dbg_tgt_tmr	0x00001000 /* Target mode task management */
 #define ql_dbg_tgt_dif  0x00000800 /* Target mode dif */
+#define ql_dbg_edif	0x00000400 /* edif and purex debug */
 
 extern int qla27xx_dump_mpi_ram(struct qla_hw_data *, uint32_t, uint32_t *,
 	uint32_t, void **);
drivers/scsi/qla2xxx/qla_def.h +225 -25

435 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_edif.c new file +3638 -0

2,322 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_edif.h new file +160 -0

160 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_edif_bsg.h new file +225 -0

225 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_fw.h +13 -2
index 49df418030e4..71e5c00011f0 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qla2xxx/qla_gbl.h +62 -2

64 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_gs.c +4 -0
index 5b6e04a91a18..99fb330053ae 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qla2xxx/qla_init.c +154 -29

183 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_iocb.c +80 -5

85 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_isr.c +300 -13

313 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_mbx.c +37 -8

45 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_mid.c +6 -1
index c7caf322f445..432fbba47922 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qla2xxx/qla_nvme.c +4 -0
index 0cacb667a88b..bec3df3d9ace 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qla2xxx/qla_os.c +114 -9

123 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_target.c +137 -33

170 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_target.h +20 -2
index 01620f3eab39..d015c7c5a718 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.19.0.rc0

Part of the diff is not shown here. View the raw message.

#1 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Nilesh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on mkp-scsi/for-next next-20210507] [cannot apply to v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nilesh-Javali/qla2xxx-Add-EDIF-support/20210507-212636
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-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
# https://github.com/0day-ci/linux/commit/123765e7c3f96d59ba2239401abb1a3ed3adf910
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nilesh-Javali/qla2xxx-Add-EDIF-support/20210507-212636 git checkout 123765e7c3f96d59ba2239401abb1a3ed3adf910
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=xtensa

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

All warnings (new ones prefixed by >>):

drivers/scsi/qla2xxx/qla_edif.c: In function 'ql_print_bsg_sglist':

>> drivers/scsi/qla2xxx/qla_edif.c:2288:24: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
    2288 |       "%x: dma(adr=%#llx len=%#x) off=%#x len=%#x\n",
         |                    ~~~~^
         |                        |
         |                        long long unsigned int
         |                    %#x

vim +2288 drivers/scsi/qla2xxx/qla_edif.c

2275
2276 void
2277 ql_print_bsg_sglist(uint level, scsi_qla_host_t *vha, uint id, char *str,
2278 struct bsg_buffer *p)
2279 {
2280 struct scatterlist *sg;
2281 uint i;
2282
2283 ql_dbg(level, vha, id,
2284 "%s->(sg_cnt=%#x payload_len=%#x):\n",
2285 str, p->sg_cnt, p->payload_len);
2286 for_each_sg(p->sg_list, sg, p->sg_cnt, i) {
2287 ql_dbg(level, vha, id,

> 2288			    "%x: dma(adr=%#llx len=%#x) off=%#x len=%#x\n",

2289 i, sg_dma_address(sg), sg_dma_len(sg), sg->offset,
2290 sg->length);
2291 }
2292 }
2293

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

#2 lore raw
In reply to Nilesh Javali
Thank you for the patch! Perhaps something to improve:

Hi Nilesh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on mkp-scsi/for-next next-20210507] [cannot apply to v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nilesh-Javali/qla2xxx-Add-EDIF-support/20210507-212636
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: arm-randconfig-r033-20210507 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a3a8a1a15b524d91b5308db68e9d293b34cd88dd)

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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/123765e7c3f96d59ba2239401abb1a3ed3adf910
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nilesh-Javali/qla2xxx-Add-EDIF-support/20210507-212636 git checkout 123765e7c3f96d59ba2239401abb1a3ed3adf910
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm

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

All warnings (new ones prefixed by >>):

>> drivers/scsi/qla2xxx/qla_edif.c:2289:10: warning: format specifies type 'unsigned long long' but the argument has type 'dma_addr_t' (aka 'unsigned int') [-Wformat]
                       i, sg_dma_address(sg), sg_dma_len(sg), sg->offset,
                          ^~~~~~~~~~~~~~~~~~
   include/linux/scatterlist.h:28:28: note: expanded from macro 'sg_dma_address'
   #define sg_dma_address(sg)      ((sg)->dma_address)
                                   ^~~~~~~~~~~~~~~~~~~

1 warning generated.

vim +2289 drivers/scsi/qla2xxx/qla_edif.c

2275
2276 void
2277 ql_print_bsg_sglist(uint level, scsi_qla_host_t *vha, uint id, char *str,
2278 struct bsg_buffer *p)
2279 {
2280 struct scatterlist *sg;
2281 uint i;
2282
2283 ql_dbg(level, vha, id,
2284 "%s->(sg_cnt=%#x payload_len=%#x):\n",
2285 str, p->sg_cnt, p->payload_len);
2286 for_each_sg(p->sg_list, sg, p->sg_cnt, i) {
2287 ql_dbg(level, vha, id,

  2288			    "%x: dma(adr=%#llx len=%#x) off=%#x len=%#x\n",
> 2289			    i, sg_dma_address(sg), sg_dma_len(sg), sg->offset,
  2290			    sg->length);

2291 }
2292 }
2293

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

#3 lore raw
In reply to Nilesh Javali

Hi Nilesh,

Quoted 9 lines · Nilesh Javali

Add Encryption for Data In Flight (EDIF) support. This feature allows data of 2 end points to be encrypted. A user application is required to play the role of authentication for both sides. On completion of authentication, user app shall provide a set of Tx/Rx keys and spi's for HW to program into the session.

Quoted 7 lines

modprobe qla2xxx ql2xsecenable=1

While you are fixing kernel test robot warnings, I’ll like to see this patch split into logical changes. It’s very hard to review 5K lines of changes into single patch. Also while you are at it, Please provide detail description of the feature and how user will use this feature.

--
Himanshu Madhani Oracle Linux Engineering