Re: [PATCH v4 9/9] snic:Add Makefile, patch Kconfig, MAINTAINERS
On 04/09/2015 01:49 PM, Narsimhulu Musini wrote: Kconfig for kbuild Makefile to build snic module Updated MAINTAINERS file Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 9/9] snic:Add Makefile, patch Kconfig, MAINTAINERS
Kconfig for kbuild Makefile to build snic module Updated MAINTAINERS file Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v3 - Added additional config section (CONFIG_SNIC_DEBUG_FS) for enabling debugging functionality. * v2 - Added compile time flags for debugfs dependent functionality. MAINTAINERS| 7 +++ drivers/scsi/Kconfig | 17 + drivers/scsi/Makefile | 1 + drivers/scsi/snic/Makefile | 21 + 4 files changed, 46 insertions(+) create mode 100644 drivers/scsi/snic/Makefile diff --git a/MAINTAINERS b/MAINTAINERS index 2a97e05..368fb76 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2536,6 +2536,13 @@ L: linux-scsi@vger.kernel.org S: Supported F: drivers/scsi/fnic/ +CISCO SCSI HBA DRIVER +M: Narsimhulu Musini nmus...@cisco.com +M: Sesidhar Baddela sebad...@cisco.com +L: linux-scsi@vger.kernel.org +S: Supported +F: drivers/scsi/snic/ + CMPC ACPI DRIVER M: Thadeu Lima de Souza Cascardo casca...@holoscopio.com M: Daniel Oliveira Nascimento d...@syst.com.br diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 9c92f41..a6d3901 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -634,6 +634,23 @@ config FCOE_FNIC file:Documentation/scsi/scsi.txt. The module will be called fnic. +config SCSI_SNIC + tristate Cisco SNIC Driver + depends on PCI SCSI X86 + help + This is support for the Cisco PCI-Express SCSI HBA. + + To compile this driver as a module, choose M here and read + file:Documentation/scsi/scsi.txt. + The module will be called snic. + +config SCSI_SNIC_DEBUG_FS + bool Cisco SNIC Driver Debugfs Support + depends on SCSI_SNIC DEBUG_FS + help + This enables to list debugging information from SNIC Driver + available via debugfs file system + config SCSI_DMX3191D tristate DMX3191D SCSI support depends on PCI SCSI diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 58158f1..f643942 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_LIBFC) += libfc/ obj-$(CONFIG_LIBFCOE) += fcoe/ obj-$(CONFIG_FCOE) += fcoe/ obj-$(CONFIG_FCOE_FNIC)+= fnic/ +obj-$(CONFIG_SCSI_SNIC)+= snic/ obj-$(CONFIG_SCSI_BNX2X_FCOE) += libfc/ fcoe/ bnx2fc/ obj-$(CONFIG_ISCSI_TCP)+= libiscsi.o libiscsi_tcp.o iscsi_tcp.o obj-$(CONFIG_INFINIBAND_ISER) += libiscsi.o diff --git a/drivers/scsi/snic/Makefile b/drivers/scsi/snic/Makefile new file mode 100644 index 000..572102a --- /dev/null +++ b/drivers/scsi/snic/Makefile @@ -0,0 +1,21 @@ +obj-$(CONFIG_SCSI_SNIC) += snic.o + +snic-y := \ + snic_attrs.o \ + snic_main.o \ + snic_res.o \ + snic_isr.o \ + snic_ctl.o \ + snic_io.o \ + snic_scsi.o \ + snic_disc.o \ + vnic_cq.o \ + vnic_intr.o \ + vnic_dev.o \ + vnic_wq.o + +ifeq ($(CONFIG_SCSI_SNIC_DEBUG_FS), y) +ccflags-y += -DSNIC_DEBUG_FS +snic-y += snic_debugfs.o \ + snic_trc.o +endif -- 1.8.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 6/9] snic:Add low level queuing interfaces
Hi Narsimhulu, please find my comment at the bottom. On 04/09/2015 01:49 PM, Narsimhulu Musini wrote: These files contain low level queueing interfaces includes hardware queues, and management of hardware features. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v3 - Cleaned up unused functions. * v2 - driver supports x86-64 arch, so removed cpu_to_XX API to maintain consistency. drivers/scsi/snic/cq_desc.h | 76 drivers/scsi/snic/cq_enet_desc.h | 38 ++ drivers/scsi/snic/vnic_cq.c | 86 + drivers/scsi/snic/vnic_cq.h | 120 ++ drivers/scsi/snic/vnic_cq_fw.h| 62 drivers/scsi/snic/vnic_dev.c | 749 ++ drivers/scsi/snic/vnic_dev.h | 140 +++ drivers/scsi/snic/vnic_devcmd.h | 270 ++ drivers/scsi/snic/vnic_intr.c | 59 +++ drivers/scsi/snic/vnic_intr.h | 119 ++ drivers/scsi/snic/vnic_resource.h | 68 drivers/scsi/snic/vnic_snic.h | 54 +++ drivers/scsi/snic/vnic_stats.h| 68 drivers/scsi/snic/vnic_wq.c | 236 drivers/scsi/snic/vnic_wq.h | 187 ++ drivers/scsi/snic/wq_enet_desc.h | 91 + 16 files changed, 2423 insertions(+) create mode 100644 drivers/scsi/snic/cq_desc.h create mode 100644 drivers/scsi/snic/cq_enet_desc.h create mode 100644 drivers/scsi/snic/vnic_cq.c create mode 100644 drivers/scsi/snic/vnic_cq.h create mode 100644 drivers/scsi/snic/vnic_cq_fw.h create mode 100644 drivers/scsi/snic/vnic_dev.c create mode 100644 drivers/scsi/snic/vnic_dev.h create mode 100644 drivers/scsi/snic/vnic_devcmd.h create mode 100644 drivers/scsi/snic/vnic_intr.c create mode 100644 drivers/scsi/snic/vnic_intr.h create mode 100644 drivers/scsi/snic/vnic_resource.h create mode 100644 drivers/scsi/snic/vnic_snic.h create mode 100644 drivers/scsi/snic/vnic_stats.h create mode 100644 drivers/scsi/snic/vnic_wq.c create mode 100644 drivers/scsi/snic/vnic_wq.h create mode 100644 drivers/scsi/snic/wq_enet_desc.h diff --git a/drivers/scsi/snic/cq_desc.h b/drivers/scsi/snic/cq_desc.h new file mode 100644 index 000..630edfa --- /dev/null +++ b/drivers/scsi/snic/cq_desc.h @@ -0,0 +1,76 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef _CQ_DESC_H_ +#define _CQ_DESC_H_ + +/* + * Completion queue descriptor types + */ +enum cq_desc_types { + CQ_DESC_TYPE_WQ_ENET = 0, + CQ_DESC_TYPE_DESC_COPY = 1, + CQ_DESC_TYPE_WQ_EXCH = 2, + CQ_DESC_TYPE_RQ_ENET = 3, + CQ_DESC_TYPE_RQ_FCP = 4, +}; + +/* Completion queue descriptor: 16B + * + * All completion queues have this basic layout. The + * type_specific area is unique for each completion + * queue type. + */ +struct cq_desc { + u16 completed_index; + u16 q_number; + u8 type_specific[11]; + u8 type_color; +}; + +#define CQ_DESC_TYPE_BITS4 +#define CQ_DESC_TYPE_MASK((1 CQ_DESC_TYPE_BITS) - 1) +#define CQ_DESC_COLOR_MASK 1 +#define CQ_DESC_COLOR_SHIFT 7 +#define CQ_DESC_Q_NUM_BITS 10 +#define CQ_DESC_Q_NUM_MASK ((1 CQ_DESC_Q_NUM_BITS) - 1) +#define CQ_DESC_COMP_NDX_BITS12 +#define CQ_DESC_COMP_NDX_MASK((1 CQ_DESC_COMP_NDX_BITS) - 1) + +static inline void cq_desc_dec(const struct cq_desc *desc_arg, + u8 *type, u8 *color, u16 *q_number, u16 *completed_index) +{ + const struct cq_desc *desc = desc_arg; + const u8 type_color = desc-type_color; + + *color = (type_color CQ_DESC_COLOR_SHIFT) CQ_DESC_COLOR_MASK; + + /* + * Make sure color bit is read from desc *before* other fields + * are read from desc. Hardware guarantees color bit is last + * bit (byte) written. Adding the rmb() prevents the compiler + * and/or CPU from reordering the reads which would potentially + * result in reading stale values. + */ + rmb(); + + *type = type_color CQ_DESC_TYPE_MASK; + *q_number = desc-q_number CQ_DESC_Q_NUM_MASK; + *completed_index = desc-completed_index CQ_DESC_COMP_NDX_MASK; +} + +#endif /* _CQ_DESC_H_ */ diff --git
Re: [PATCH v4 5/9] snic:add SCSI handling, AEN, and fwreset handling
Hi Narsimhulu, please find some comments inline. On 04/09/2015 01:49 PM, Narsimhulu Musini wrote: snic_scsi.c contains scsi handling, includes queuing io, abort, lun reset, and host reset. Also it handles asynchronous event notifications from FW. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v2 - Changed queuecommand to lock-free version. - Converted custom error codes to standard error codes. drivers/scsi/snic/snic_scsi.c | 2638 + 1 file changed, 2638 insertions(+) create mode 100644 drivers/scsi/snic/snic_scsi.c diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c new file mode 100644 index 000..5d877f0 --- /dev/null +++ b/drivers/scsi/snic/snic_scsi.c @@ -0,0 +1,2638 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include linux/mempool.h +#include linux/errno.h +#include linux/init.h +#include linux/workqueue.h +#include linux/pci.h +#include linux/spinlock.h +#include linux/delay.h +#include linux/gfp.h +#include scsi/scsi.h +#include scsi/scsi_host.h +#include scsi/scsi_device.h +#include scsi/scsi_cmnd.h +#include scsi/scsi_tcq.h +#include scsi/scsi_dbg.h + +#include snic_io.h +#include snic.h + +#define snic_cmd_tag(sc) (((struct scsi_cmnd *) sc)-request-tag) + +const char *snic_state_str[] = { + [SNIC_INIT] = SNIC_INIT, + [SNIC_ERROR]= SNIC_ERROR, + [SNIC_ONLINE] = SNIC_ONLINE, + [SNIC_OFFLINE] = SNIC_OFFLINE, + [SNIC_FWRESET] = SNIC_FWRESET, +}; + +static const char * const snic_req_state_str[] = { + [SNIC_IOREQ_NOT_INITED] = SNIC_IOREQ_NOT_INITED, + [SNIC_IOREQ_PENDING]= SNIC_IOREQ_PENDING, + [SNIC_IOREQ_ABTS_PENDING] = SNIC_IOREQ_ABTS_PENDING, + [SNIC_IOREQ_ABTS_COMPLETE] = SNIC_IOREQ_ABTS_COMPELTE, + [SNIC_IOREQ_LR_PENDING] = SNIC_IOREQ_LR_PENDING, + [SNIC_IOREQ_LR_COMPLETE] = SNIC_IOREQ_LR_COMPELTE, + [SNIC_IOREQ_COMPLETE] = SNIC_IOREQ_CMD_COMPELTE, +}; + +/* snic cmd status strings */ +static const char * const snic_io_status_str[] = { + [SNIC_STAT_IO_SUCCESS] = SNIC_STAT_IO_SUCCESS, /* 0x0 */ + [SNIC_STAT_INVALID_HDR] = SNIC_STAT_INVALID_HDR, + [SNIC_STAT_OUT_OF_RES] = SNIC_STAT_OUT_OF_RES, + [SNIC_STAT_INVALID_PARM] = SNIC_STAT_INVALID_PARM, + [SNIC_STAT_REQ_NOT_SUP] = SNIC_STAT_REQ_NOT_SUP, + [SNIC_STAT_IO_NOT_FOUND] = SNIC_STAT_IO_NOT_FOUND, + [SNIC_STAT_ABORTED] = SNIC_STAT_ABORTED, + [SNIC_STAT_TIMEOUT] = SNIC_STAT_TIMEOUT, + [SNIC_STAT_SGL_INVALID] = SNIC_STAT_SGL_INVALID, + [SNIC_STAT_DATA_CNT_MISMATCH] = SNIC_STAT_DATA_CNT_MISMATCH, + [SNIC_STAT_FW_ERR] = SNIC_STAT_FW_ERR, + [SNIC_STAT_ITMF_REJECT] = SNIC_STAT_ITMF_REJECT, + [SNIC_STAT_ITMF_FAIL] = SNIC_STAT_ITMF_FAIL, + [SNIC_STAT_ITMF_INCORRECT_LUN] = SNIC_STAT_ITMF_INCORRECT_LUN, + [SNIC_STAT_CMND_REJECT] = SNIC_STAT_CMND_REJECT, + [SNIC_STAT_DEV_OFFLINE] = SNIC_STAT_DEV_OFFLINE, + [SNIC_STAT_NO_BOOTLUN] = SNIC_STAT_NO_BOOTLUN, + [SNIC_STAT_SCSI_ERR]= SNIC_STAT_SCSI_ERR, + [SNIC_STAT_NOT_READY] = SNIC_STAT_NOT_READY, + [SNIC_STAT_FATAL_ERROR] = SNIC_STAT_FATAL_ERROR, +}; + +static void snic_scsi_cleanup(struct snic *, int); + +const char * +snic_state_to_str(unsigned int state) +{ + if (state = ARRAY_SIZE(snic_state_str) || !snic_state_str[state]) + return Unknown; + + return snic_state_str[state]; +} + +static const char * +snic_io_status_to_str(unsigned int state) +{ + if ((state = ARRAY_SIZE(snic_io_status_str)) || + (!snic_io_status_str[state])) + return Unknown; + + return snic_io_status_str[state]; +} + +static const char * +snic_ioreq_state_to_str(unsigned int state) +{ + if (state = ARRAY_SIZE(snic_req_state_str) || + !snic_req_state_str[state]) + return Unknown; + + return snic_req_state_str[state]; +} + +static inline spinlock_t * +snic_io_lock_hash(struct snic *snic, struct scsi_cmnd *sc) +{ + u32 hash = snic_cmd_tag(sc) (SNIC_IO_LOCKS - 1); + + return
Re: [PATCH v4 4/9] snic:Add snic target discovery
Hi Narsimhulu, please find some comments inline. On 04/09/2015 01:49 PM, Narsimhulu Musini wrote: snic_disc.h contains snic target structure definition. snic_disc.c contains target discovery, setup, lookup, and cleanup snic_ctl.c contains retrieval of snic capabilities includes max ios, size, SGs per request, and max concurrent requests. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v3 - Cleaned up redundant comment. drivers/scsi/snic/snic_ctl.c | 276 +++ drivers/scsi/snic/snic_disc.c | 602 ++ drivers/scsi/snic/snic_disc.h | 124 + 3 files changed, 1002 insertions(+) create mode 100644 drivers/scsi/snic/snic_ctl.c create mode 100644 drivers/scsi/snic/snic_disc.c create mode 100644 drivers/scsi/snic/snic_disc.h diff --git a/drivers/scsi/snic/snic_ctl.c b/drivers/scsi/snic/snic_ctl.c new file mode 100644 index 000..4bc55be --- /dev/null +++ b/drivers/scsi/snic/snic_ctl.c @@ -0,0 +1,276 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include linux/errno.h +#include linux/pci.h +#include linux/slab.h + +#include linux/interrupt.h +#include linux/workqueue.h +#include linux/spinlock.h +#include linux/mempool.h +#include scsi/scsi_tcq.h +#include linux/ctype.h + +#include snic_io.h +#include snic.h +#include cq_enet_desc.h +#include snic_fwint.h + +/* + * snic_handle_link : Handles link flaps. + */ +void +snic_handle_link(struct work_struct *work) +{ + struct snic *snic = container_of(work, struct snic, link_work); + + if (snic-config.xpt_type != SNIC_DAS) { + SNIC_HOST_INFO(snic-shost, Link Event Received.\n); + SNIC_ASSERT_NOT_IMPL(1); + + return; + } + + snic-link_status = vnic_dev_link_status(snic-vdev); + snic-link_down_cnt = vnic_dev_link_down_cnt(snic-vdev); + SNIC_HOST_INFO(snic-shost, Link Event: Link %s.\n, +((snic-link_status) ? Up : Down)); +} + + +/* + * snic_ver_enc : Encodes version str to int + * version string is similar to netmask string + */ +static int +snic_ver_enc(const char *s) +{ + int v[4] = {0}; + int i = 0, x = 0; + char c; + const char *p = s; + + /* validate version string */ + if ((strlen(s) 15) || (strlen(s) 7)) + goto end; + + while ((c = *p++)) { + if (c == '.') { + i++; + continue; + } + + if (i 4 || !isdigit(c)) + goto end; + + v[i] = v[i] * 10 + (c - '0'); + } + + /* validate sub version numbers */ + for (i = 3; i = 0; i--) + if (v[i] 0xff) + goto end; + + x |= (v[0] 24) | v[1] 16 | v[2] 8 | v[3]; + +end: + if (x == 0) { + SNIC_ERR(Invalid version string [%s].\n, s); + + return -1; + } + + return x; +} /* end of snic_ver_enc */ + +/* + * snic_qeueue_exch_ver_req : + * + * Queues Exchange Version Request, to communicate host information + * in return, it gets firmware version details + */ +int +snic_queue_exch_ver_req(struct snic *snic) +{ + struct snic_req_info *rqi = NULL; + struct snic_host_req *req = NULL; + int ret = 0; + + SNIC_HOST_INFO(snic-shost, Exch Ver Req Preparing...\n); + + rqi = snic_req_init(snic, 0); + if (!rqi) { + SNIC_HOST_ERR(snic-shost, + Queuing Exch Ver Req failed, err = %d\n, + ret); + + ret = -ENOMEM; + goto error; + } + + req = rqi_to_req(rqi); + + /* Initialize snic_host_req */ + snic_io_hdr_enc(req-hdr, SNIC_REQ_EXCH_VER, 0, SCSI_NO_TAG, + snic-config.hid, 0, (u64)rqi); + req-u.exch_ver.drvr_ver = snic_ver_enc(SNIC_DRV_VERSION); + req-u.exch_ver.os_type = SNIC_OS_LINUX; + + snic_handle_untagged_req(snic, rqi); + + ret = snic_queue_wq_desc(snic, req, sizeof(*req)); + if (ret) { + snic_release_untagged_req(snic, rqi); +
Re: [PATCH v4 3/9] snic:Add meta request, handling of meta requests.
On 04/09/2015 01:49 PM, Narsimhulu Musini wrote: snic_io.h contains meta request structure definition meta request contains high level information about firmware requests. such as request information, size, SGLs. snic_io.c contains interfaces to handle meta request, firmware acknowledgment, and high level generic queueing interface. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 2/9] snic:Add interrupt, resource firmware interfaces
On 04/09/2015 01:49 PM, Narsimhulu Musini wrote: snic_fwint.h contains firmware interface structures. snic_res.h contains firmware request initialization snic_res.c contains retrieval of resource configuration, and allocation, and initialization of HW Queues. snic_isr.c contains interrupt request, release, and handling Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 4/9] snic:Add snic target discovery
snic_disc.h contains snic target structure definition. snic_disc.c contains target discovery, setup, lookup, and cleanup snic_ctl.c contains retrieval of snic capabilities includes max ios, size, SGs per request, and max concurrent requests. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v3 - Cleaned up redundant comment. drivers/scsi/snic/snic_ctl.c | 276 +++ drivers/scsi/snic/snic_disc.c | 602 ++ drivers/scsi/snic/snic_disc.h | 124 + 3 files changed, 1002 insertions(+) create mode 100644 drivers/scsi/snic/snic_ctl.c create mode 100644 drivers/scsi/snic/snic_disc.c create mode 100644 drivers/scsi/snic/snic_disc.h diff --git a/drivers/scsi/snic/snic_ctl.c b/drivers/scsi/snic/snic_ctl.c new file mode 100644 index 000..4bc55be --- /dev/null +++ b/drivers/scsi/snic/snic_ctl.c @@ -0,0 +1,276 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include linux/errno.h +#include linux/pci.h +#include linux/slab.h + +#include linux/interrupt.h +#include linux/workqueue.h +#include linux/spinlock.h +#include linux/mempool.h +#include scsi/scsi_tcq.h +#include linux/ctype.h + +#include snic_io.h +#include snic.h +#include cq_enet_desc.h +#include snic_fwint.h + +/* + * snic_handle_link : Handles link flaps. + */ +void +snic_handle_link(struct work_struct *work) +{ + struct snic *snic = container_of(work, struct snic, link_work); + + if (snic-config.xpt_type != SNIC_DAS) { + SNIC_HOST_INFO(snic-shost, Link Event Received.\n); + SNIC_ASSERT_NOT_IMPL(1); + + return; + } + + snic-link_status = vnic_dev_link_status(snic-vdev); + snic-link_down_cnt = vnic_dev_link_down_cnt(snic-vdev); + SNIC_HOST_INFO(snic-shost, Link Event: Link %s.\n, + ((snic-link_status) ? Up : Down)); +} + + +/* + * snic_ver_enc : Encodes version str to int + * version string is similar to netmask string + */ +static int +snic_ver_enc(const char *s) +{ + int v[4] = {0}; + int i = 0, x = 0; + char c; + const char *p = s; + + /* validate version string */ + if ((strlen(s) 15) || (strlen(s) 7)) + goto end; + + while ((c = *p++)) { + if (c == '.') { + i++; + continue; + } + + if (i 4 || !isdigit(c)) + goto end; + + v[i] = v[i] * 10 + (c - '0'); + } + + /* validate sub version numbers */ + for (i = 3; i = 0; i--) + if (v[i] 0xff) + goto end; + + x |= (v[0] 24) | v[1] 16 | v[2] 8 | v[3]; + +end: + if (x == 0) { + SNIC_ERR(Invalid version string [%s].\n, s); + + return -1; + } + + return x; +} /* end of snic_ver_enc */ + +/* + * snic_qeueue_exch_ver_req : + * + * Queues Exchange Version Request, to communicate host information + * in return, it gets firmware version details + */ +int +snic_queue_exch_ver_req(struct snic *snic) +{ + struct snic_req_info *rqi = NULL; + struct snic_host_req *req = NULL; + int ret = 0; + + SNIC_HOST_INFO(snic-shost, Exch Ver Req Preparing...\n); + + rqi = snic_req_init(snic, 0); + if (!rqi) { + SNIC_HOST_ERR(snic-shost, + Queuing Exch Ver Req failed, err = %d\n, + ret); + + ret = -ENOMEM; + goto error; + } + + req = rqi_to_req(rqi); + + /* Initialize snic_host_req */ + snic_io_hdr_enc(req-hdr, SNIC_REQ_EXCH_VER, 0, SCSI_NO_TAG, + snic-config.hid, 0, (u64)rqi); + req-u.exch_ver.drvr_ver = snic_ver_enc(SNIC_DRV_VERSION); + req-u.exch_ver.os_type = SNIC_OS_LINUX; + + snic_handle_untagged_req(snic, rqi); + + ret = snic_queue_wq_desc(snic, req, sizeof(*req)); + if (ret) { + snic_release_untagged_req(snic, rqi); + SNIC_HOST_ERR(snic-shost, + Queuing Exch Ver Req failed, err = %d\n, + ret); +
[PATCH v4 1/9] snic: snic module infrastructure
snic_main.c contains module load and unload, global driver context, PCI Registration, PCI probe and remove, SCSI ML registration functionality. snic.h contains snic structure definition, snic global context, and prototypes. snic_attrs.c contains device attributes to list snic state, link state, and driver version under /sys/class/scsi_host/hostid/ Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v4 - Replaced scratch pad usage with private data structure for internal use. - Changed cmd_per_lun to default queue depth. - Removed snic_os.h file and replaced the wrappers with direct linux API. * v3 - Cleaned up unused functions, structure members, and redundant comments. - Fixed a typo in time computation. * v2 - Added Compile time macro for debugfs dependent functionality. drivers/scsi/snic/snic.h | 415 drivers/scsi/snic/snic_attrs.c | 79 +++ drivers/scsi/snic/snic_main.c | 1039 3 files changed, 1533 insertions(+) create mode 100644 drivers/scsi/snic/snic.h create mode 100644 drivers/scsi/snic/snic_attrs.c create mode 100644 drivers/scsi/snic/snic_main.c diff --git a/drivers/scsi/snic/snic.h b/drivers/scsi/snic/snic.h new file mode 100644 index 000..533abf0 --- /dev/null +++ b/drivers/scsi/snic/snic.h @@ -0,0 +1,415 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef _SNIC_H_ +#define _SNIC_H_ + +#include linux/module.h +#include linux/netdevice.h +#include linux/workqueue.h +#include linux/bitops.h +#include linux/mempool.h +#include scsi/scsi_cmnd.h +#include scsi/scsi.h +#include scsi/scsi_host.h + +#include snic_disc.h +#include snic_io.h +#include snic_res.h +#include snic_trc.h +#include snic_stats.h +#include vnic_dev.h +#include vnic_wq.h +#include vnic_cq.h +#include vnic_intr.h +#include vnic_stats.h +#include vnic_snic.h + +#define SNIC_DRV_NAME snic +#define SNIC_DRV_DESCRIPTION Cisco SCSI NIC Driver +#define SNIC_DRV_VERSION 0.0.1.18 +#define PFXSNIC_DRV_NAME : +#define DFXSNIC_DRV_NAME %d: + +#define DESC_CLEAN_LOW_WATERMARK 8 +#define SNIC_UCSM_DFLT_THROTTLE_CNT_BLD 16 /* UCSM default throttle count */ +#define SNIC_MAX_IO_REQ50 /* scsi_cmnd tag map entries */ +#define SNIC_MIN_IO_REQ8 /* Min IO throttle count */ +#define SNIC_IO_LOCKS 64 /* IO locks: power of 2 */ +#define SNIC_DFLT_QUEUE_DEPTH 32 /* Default Queue Depth */ +#define SNIC_MAX_QUEUE_DEPTH 64 /* Max Queue Depth */ +#define SNIC_DFLT_CMD_TIMEOUT 90 /* Extended tmo for FW */ + +/* + * Tag bits used for special requests. + */ +#define SNIC_TAG_ABORT BIT(30) /* Tag indicating abort */ +#define SNIC_TAG_DEV_RST BIT(29) /* Tag for device reset */ +#define SNIC_TAG_IOCTL_DEV_RST BIT(28) /* Tag for User Device Reset */ +#define SNIC_TAG_MASK (BIT(24) - 1) /* Mask for lookup */ +#define SNIC_NO_TAG-1 + +/* + * Command flags to identify the type of command and for other future use + */ +#define SNIC_NO_FLAGS 0 +#define SNIC_IO_INITIALIZEDBIT(0) +#define SNIC_IO_ISSUED BIT(1) +#define SNIC_IO_DONE BIT(2) +#define SNIC_IO_REQ_NULL BIT(3) +#define SNIC_IO_ABTS_PENDING BIT(4) +#define SNIC_IO_ABORTEDBIT(5) +#define SNIC_IO_ABTS_ISSUEDBIT(6) +#define SNIC_IO_TERM_ISSUEDBIT(7) +#define SNIC_IO_ABTS_TIMEDOUT BIT(8) +#define SNIC_IO_ABTS_TERM_DONE BIT(9) +#define SNIC_IO_ABTS_TERM_REQ_NULL BIT(10) +#define SNIC_IO_ABTS_TERM_TIMEDOUT BIT(11) +#define SNIC_IO_INTERNAL_TERM_PENDING BIT(12) +#define SNIC_IO_INTERNAL_TERM_ISSUED BIT(13) +#define SNIC_DEVICE_RESET BIT(14) +#define SNIC_DEV_RST_ISSUEDBIT(15) +#define SNIC_DEV_RST_TIMEDOUT BIT(16) +#define SNIC_DEV_RST_ABTS_ISSUED BIT(17) +#define SNIC_DEV_RST_TERM_ISSUED BIT(18) +#define SNIC_DEV_RST_DONE BIT(19) +#define SNIC_DEV_RST_REQ_NULL BIT(20) +#define SNIC_DEV_RST_ABTS_DONE
[PATCH v4 0/9] snic:initial submission of snic driver for Cisco SCSI HBA
The following patch series adds snic driver for Cisco SCSI HBA Cisco has developed a new PCI HBA interface called sNIC, which stands for SCSI NIC. This is a new storage feature supported on specialized network adapter. The new PCI function provides a uniform host interface and abstracts backend storage. * v4 - Incorporated Christoph Hellwig's comments. * v3 - Incorporated Dr. Hannes Reinecke's review comments. * v2 - Incorporated Dr. Hannes Reinecke's review comments. Thanks Narsimhulu Musini Sesidhar Baddela Narsimhulu Musini (9): snic: snic module infrastructure snic:Add interrupt, resource firmware interfaces snic:Add meta request, handling of meta requests. snic:Add snic target discovery snic:add SCSI handling, AEN, and fwreset handling snic:Add low level queuing interfaces snic:Add sysfs entries to list stats and trace data snic:Add event tracing to capture IO events. snic:Add Makefile, patch Kconfig, MAINTAINERS MAINTAINERS |7 + drivers/scsi/Kconfig | 17 + drivers/scsi/Makefile |1 + drivers/scsi/snic/Makefile| 21 + drivers/scsi/snic/cq_desc.h | 76 ++ drivers/scsi/snic/cq_enet_desc.h | 38 + drivers/scsi/snic/snic.h | 415 ++ drivers/scsi/snic/snic_attrs.c| 79 ++ drivers/scsi/snic/snic_ctl.c | 276 drivers/scsi/snic/snic_debugfs.c | 562 drivers/scsi/snic/snic_disc.c | 602 + drivers/scsi/snic/snic_disc.h | 124 ++ drivers/scsi/snic/snic_fwint.h| 525 drivers/scsi/snic/snic_io.c | 519 drivers/scsi/snic/snic_io.h | 118 ++ drivers/scsi/snic/snic_isr.c | 209 +++ drivers/scsi/snic/snic_main.c | 1039 +++ drivers/scsi/snic/snic_res.c | 297 + drivers/scsi/snic/snic_res.h | 96 ++ drivers/scsi/snic/snic_scsi.c | 2638 + drivers/scsi/snic/snic_stats.h| 123 ++ drivers/scsi/snic/snic_trc.c | 182 +++ drivers/scsi/snic/snic_trc.h | 121 ++ drivers/scsi/snic/vnic_cq.c | 86 ++ drivers/scsi/snic/vnic_cq.h | 120 ++ drivers/scsi/snic/vnic_cq_fw.h| 62 + drivers/scsi/snic/vnic_dev.c | 749 +++ drivers/scsi/snic/vnic_dev.h | 140 ++ drivers/scsi/snic/vnic_devcmd.h | 270 drivers/scsi/snic/vnic_intr.c | 59 + drivers/scsi/snic/vnic_intr.h | 119 ++ drivers/scsi/snic/vnic_resource.h | 68 + drivers/scsi/snic/vnic_snic.h | 54 + drivers/scsi/snic/vnic_stats.h| 68 + drivers/scsi/snic/vnic_wq.c | 236 drivers/scsi/snic/vnic_wq.h | 187 +++ drivers/scsi/snic/wq_enet_desc.h | 91 ++ 37 files changed, 10394 insertions(+) create mode 100644 drivers/scsi/snic/Makefile create mode 100644 drivers/scsi/snic/cq_desc.h create mode 100644 drivers/scsi/snic/cq_enet_desc.h create mode 100644 drivers/scsi/snic/snic.h create mode 100644 drivers/scsi/snic/snic_attrs.c create mode 100644 drivers/scsi/snic/snic_ctl.c create mode 100644 drivers/scsi/snic/snic_debugfs.c create mode 100644 drivers/scsi/snic/snic_disc.c create mode 100644 drivers/scsi/snic/snic_disc.h create mode 100644 drivers/scsi/snic/snic_fwint.h create mode 100644 drivers/scsi/snic/snic_io.c create mode 100644 drivers/scsi/snic/snic_io.h create mode 100644 drivers/scsi/snic/snic_isr.c create mode 100644 drivers/scsi/snic/snic_main.c create mode 100644 drivers/scsi/snic/snic_res.c create mode 100644 drivers/scsi/snic/snic_res.h create mode 100644 drivers/scsi/snic/snic_scsi.c create mode 100644 drivers/scsi/snic/snic_stats.h create mode 100644 drivers/scsi/snic/snic_trc.c create mode 100644 drivers/scsi/snic/snic_trc.h create mode 100644 drivers/scsi/snic/vnic_cq.c create mode 100644 drivers/scsi/snic/vnic_cq.h create mode 100644 drivers/scsi/snic/vnic_cq_fw.h create mode 100644 drivers/scsi/snic/vnic_dev.c create mode 100644 drivers/scsi/snic/vnic_dev.h create mode 100644 drivers/scsi/snic/vnic_devcmd.h create mode 100644 drivers/scsi/snic/vnic_intr.c create mode 100644 drivers/scsi/snic/vnic_intr.h create mode 100644 drivers/scsi/snic/vnic_resource.h create mode 100644 drivers/scsi/snic/vnic_snic.h create mode 100644 drivers/scsi/snic/vnic_stats.h create mode 100644 drivers/scsi/snic/vnic_wq.c create mode 100644 drivers/scsi/snic/vnic_wq.h create mode 100644 drivers/scsi/snic/wq_enet_desc.h -- 1.8.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 3/9] snic:Add meta request, handling of meta requests.
snic_io.h contains meta request structure definition meta request contains high level information about firmware requests. such as request information, size, SGLs. snic_io.c contains interfaces to handle meta request, firmware acknowledgment, and high level generic queueing interface. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v3 - Removed request alignment functionality. drivers/scsi/snic/snic_io.c | 519 drivers/scsi/snic/snic_io.h | 118 ++ 2 files changed, 637 insertions(+) create mode 100644 drivers/scsi/snic/snic_io.c create mode 100644 drivers/scsi/snic/snic_io.h diff --git a/drivers/scsi/snic/snic_io.c b/drivers/scsi/snic/snic_io.c new file mode 100644 index 000..75235ea --- /dev/null +++ b/drivers/scsi/snic/snic_io.c @@ -0,0 +1,519 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include linux/errno.h +#include linux/pci.h +#include linux/slab.h + +#include linux/interrupt.h +#include linux/workqueue.h +#include linux/spinlock.h +#include linux/mempool.h +#include scsi/scsi_tcq.h + +#include snic_io.h +#include snic.h +#include cq_enet_desc.h +#include snic_fwint.h + +static void +snic_wq_cmpl_frame_send(struct vnic_wq *wq, + struct cq_desc *cq_desc, + struct vnic_wq_buf *buf, + void *opaque) +{ + struct snic *snic = vnic_dev_priv(wq-vdev); + + SNIC_BUG_ON(buf-os_buf == NULL); + + if (snic_log_level SNIC_DESC_LOGGING) + SNIC_HOST_INFO(snic-shost, + Ack received for snic_host_req %p.\n, + buf-os_buf); + + SNIC_TRC(snic-shost-host_no, 0, 0, +((u64)(buf-os_buf) - sizeof(struct snic_req_info)), 0, 0, 0); + pci_unmap_single(snic-pdev, buf-dma_addr, buf-len, PCI_DMA_TODEVICE); + buf-os_buf = NULL; +} + +static int +snic_wq_cmpl_handler_cont(struct vnic_dev *vdev, + struct cq_desc *cq_desc, + u8 type, + u16 q_num, + u16 cmpl_idx, + void *opaque) +{ + struct snic *snic = vnic_dev_priv(vdev); + unsigned long flags; + + SNIC_BUG_ON(q_num != 0); + + spin_lock_irqsave(snic-wq_lock[q_num], flags); + vnic_wq_service(snic-wq[q_num], + cq_desc, + cmpl_idx, + snic_wq_cmpl_frame_send, + NULL); + spin_unlock_irqrestore(snic-wq_lock[q_num], flags); + + return 0; +} /* end of snic_cmpl_handler_cont */ + +int +snic_wq_cmpl_handler(struct snic *snic, int work_to_do) +{ + unsigned int work_done = 0; + unsigned int i; + + snic-s_stats.misc.last_ack_time = jiffies; + for (i = 0; i snic-wq_count; i++) { + work_done += vnic_cq_service(snic-cq[i], + work_to_do, + snic_wq_cmpl_handler_cont, + NULL); + } + + return work_done; +} /* end of snic_wq_cmpl_handler */ + +void +snic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf) +{ + + struct snic_host_req *req = buf-os_buf; + struct snic *snic = vnic_dev_priv(wq-vdev); + struct snic_req_info *rqi = NULL; + unsigned long flags; + + pci_unmap_single(snic-pdev, buf-dma_addr, buf-len, PCI_DMA_TODEVICE); + + rqi = req_to_rqi(req); + spin_lock_irqsave(snic-spl_cmd_lock, flags); + if (list_empty(rqi-list)) { + spin_unlock_irqrestore(snic-spl_cmd_lock, flags); + goto end; + } + + SNIC_BUG_ON(rqi-list.next == NULL); /* if not added to spl_cmd_list */ + list_del_init(rqi-list); + spin_unlock_irqrestore(snic-spl_cmd_lock, flags); + + if (rqi-sge_va) { + snic_pci_unmap_rsp_buf(snic, rqi); + kfree((void *)rqi-sge_va); + rqi-sge_va = 0; + } + snic_req_free(snic, rqi); + SNIC_HOST_INFO(snic-shost, snic_free_wq_buf .. freed.\n); + +end: +
[PATCH v4 6/9] snic:Add low level queuing interfaces
These files contain low level queueing interfaces includes hardware queues, and management of hardware features. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v3 - Cleaned up unused functions. * v2 - driver supports x86-64 arch, so removed cpu_to_XX API to maintain consistency. drivers/scsi/snic/cq_desc.h | 76 drivers/scsi/snic/cq_enet_desc.h | 38 ++ drivers/scsi/snic/vnic_cq.c | 86 + drivers/scsi/snic/vnic_cq.h | 120 ++ drivers/scsi/snic/vnic_cq_fw.h| 62 drivers/scsi/snic/vnic_dev.c | 749 ++ drivers/scsi/snic/vnic_dev.h | 140 +++ drivers/scsi/snic/vnic_devcmd.h | 270 ++ drivers/scsi/snic/vnic_intr.c | 59 +++ drivers/scsi/snic/vnic_intr.h | 119 ++ drivers/scsi/snic/vnic_resource.h | 68 drivers/scsi/snic/vnic_snic.h | 54 +++ drivers/scsi/snic/vnic_stats.h| 68 drivers/scsi/snic/vnic_wq.c | 236 drivers/scsi/snic/vnic_wq.h | 187 ++ drivers/scsi/snic/wq_enet_desc.h | 91 + 16 files changed, 2423 insertions(+) create mode 100644 drivers/scsi/snic/cq_desc.h create mode 100644 drivers/scsi/snic/cq_enet_desc.h create mode 100644 drivers/scsi/snic/vnic_cq.c create mode 100644 drivers/scsi/snic/vnic_cq.h create mode 100644 drivers/scsi/snic/vnic_cq_fw.h create mode 100644 drivers/scsi/snic/vnic_dev.c create mode 100644 drivers/scsi/snic/vnic_dev.h create mode 100644 drivers/scsi/snic/vnic_devcmd.h create mode 100644 drivers/scsi/snic/vnic_intr.c create mode 100644 drivers/scsi/snic/vnic_intr.h create mode 100644 drivers/scsi/snic/vnic_resource.h create mode 100644 drivers/scsi/snic/vnic_snic.h create mode 100644 drivers/scsi/snic/vnic_stats.h create mode 100644 drivers/scsi/snic/vnic_wq.c create mode 100644 drivers/scsi/snic/vnic_wq.h create mode 100644 drivers/scsi/snic/wq_enet_desc.h diff --git a/drivers/scsi/snic/cq_desc.h b/drivers/scsi/snic/cq_desc.h new file mode 100644 index 000..630edfa --- /dev/null +++ b/drivers/scsi/snic/cq_desc.h @@ -0,0 +1,76 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef _CQ_DESC_H_ +#define _CQ_DESC_H_ + +/* + * Completion queue descriptor types + */ +enum cq_desc_types { + CQ_DESC_TYPE_WQ_ENET = 0, + CQ_DESC_TYPE_DESC_COPY = 1, + CQ_DESC_TYPE_WQ_EXCH = 2, + CQ_DESC_TYPE_RQ_ENET = 3, + CQ_DESC_TYPE_RQ_FCP = 4, +}; + +/* Completion queue descriptor: 16B + * + * All completion queues have this basic layout. The + * type_specific area is unique for each completion + * queue type. + */ +struct cq_desc { + u16 completed_index; + u16 q_number; + u8 type_specific[11]; + u8 type_color; +}; + +#define CQ_DESC_TYPE_BITS4 +#define CQ_DESC_TYPE_MASK((1 CQ_DESC_TYPE_BITS) - 1) +#define CQ_DESC_COLOR_MASK 1 +#define CQ_DESC_COLOR_SHIFT 7 +#define CQ_DESC_Q_NUM_BITS 10 +#define CQ_DESC_Q_NUM_MASK ((1 CQ_DESC_Q_NUM_BITS) - 1) +#define CQ_DESC_COMP_NDX_BITS12 +#define CQ_DESC_COMP_NDX_MASK((1 CQ_DESC_COMP_NDX_BITS) - 1) + +static inline void cq_desc_dec(const struct cq_desc *desc_arg, + u8 *type, u8 *color, u16 *q_number, u16 *completed_index) +{ + const struct cq_desc *desc = desc_arg; + const u8 type_color = desc-type_color; + + *color = (type_color CQ_DESC_COLOR_SHIFT) CQ_DESC_COLOR_MASK; + + /* +* Make sure color bit is read from desc *before* other fields +* are read from desc. Hardware guarantees color bit is last +* bit (byte) written. Adding the rmb() prevents the compiler +* and/or CPU from reordering the reads which would potentially +* result in reading stale values. +*/ + rmb(); + + *type = type_color CQ_DESC_TYPE_MASK; + *q_number = desc-q_number CQ_DESC_Q_NUM_MASK; + *completed_index = desc-completed_index CQ_DESC_COMP_NDX_MASK; +} + +#endif /* _CQ_DESC_H_ */ diff --git a/drivers/scsi/snic/cq_enet_desc.h b/drivers/scsi/snic/cq_enet_desc.h new file mode 100644 index 000..99ecd20 --- /dev/null +++ b/drivers/scsi/snic/cq_enet_desc.h @@ -0,0 +1,38 @@ +/* + * Copyright
[PATCH v4 5/9] snic:add SCSI handling, AEN, and fwreset handling
snic_scsi.c contains scsi handling, includes queuing io, abort, lun reset, and host reset. Also it handles asynchronous event notifications from FW. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v2 - Changed queuecommand to lock-free version. - Converted custom error codes to standard error codes. drivers/scsi/snic/snic_scsi.c | 2638 + 1 file changed, 2638 insertions(+) create mode 100644 drivers/scsi/snic/snic_scsi.c diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c new file mode 100644 index 000..5d877f0 --- /dev/null +++ b/drivers/scsi/snic/snic_scsi.c @@ -0,0 +1,2638 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include linux/mempool.h +#include linux/errno.h +#include linux/init.h +#include linux/workqueue.h +#include linux/pci.h +#include linux/spinlock.h +#include linux/delay.h +#include linux/gfp.h +#include scsi/scsi.h +#include scsi/scsi_host.h +#include scsi/scsi_device.h +#include scsi/scsi_cmnd.h +#include scsi/scsi_tcq.h +#include scsi/scsi_dbg.h + +#include snic_io.h +#include snic.h + +#define snic_cmd_tag(sc) (((struct scsi_cmnd *) sc)-request-tag) + +const char *snic_state_str[] = { + [SNIC_INIT] = SNIC_INIT, + [SNIC_ERROR]= SNIC_ERROR, + [SNIC_ONLINE] = SNIC_ONLINE, + [SNIC_OFFLINE] = SNIC_OFFLINE, + [SNIC_FWRESET] = SNIC_FWRESET, +}; + +static const char * const snic_req_state_str[] = { + [SNIC_IOREQ_NOT_INITED] = SNIC_IOREQ_NOT_INITED, + [SNIC_IOREQ_PENDING]= SNIC_IOREQ_PENDING, + [SNIC_IOREQ_ABTS_PENDING] = SNIC_IOREQ_ABTS_PENDING, + [SNIC_IOREQ_ABTS_COMPLETE] = SNIC_IOREQ_ABTS_COMPELTE, + [SNIC_IOREQ_LR_PENDING] = SNIC_IOREQ_LR_PENDING, + [SNIC_IOREQ_LR_COMPLETE] = SNIC_IOREQ_LR_COMPELTE, + [SNIC_IOREQ_COMPLETE] = SNIC_IOREQ_CMD_COMPELTE, +}; + +/* snic cmd status strings */ +static const char * const snic_io_status_str[] = { + [SNIC_STAT_IO_SUCCESS] = SNIC_STAT_IO_SUCCESS, /* 0x0 */ + [SNIC_STAT_INVALID_HDR] = SNIC_STAT_INVALID_HDR, + [SNIC_STAT_OUT_OF_RES] = SNIC_STAT_OUT_OF_RES, + [SNIC_STAT_INVALID_PARM] = SNIC_STAT_INVALID_PARM, + [SNIC_STAT_REQ_NOT_SUP] = SNIC_STAT_REQ_NOT_SUP, + [SNIC_STAT_IO_NOT_FOUND] = SNIC_STAT_IO_NOT_FOUND, + [SNIC_STAT_ABORTED] = SNIC_STAT_ABORTED, + [SNIC_STAT_TIMEOUT] = SNIC_STAT_TIMEOUT, + [SNIC_STAT_SGL_INVALID] = SNIC_STAT_SGL_INVALID, + [SNIC_STAT_DATA_CNT_MISMATCH] = SNIC_STAT_DATA_CNT_MISMATCH, + [SNIC_STAT_FW_ERR] = SNIC_STAT_FW_ERR, + [SNIC_STAT_ITMF_REJECT] = SNIC_STAT_ITMF_REJECT, + [SNIC_STAT_ITMF_FAIL] = SNIC_STAT_ITMF_FAIL, + [SNIC_STAT_ITMF_INCORRECT_LUN] = SNIC_STAT_ITMF_INCORRECT_LUN, + [SNIC_STAT_CMND_REJECT] = SNIC_STAT_CMND_REJECT, + [SNIC_STAT_DEV_OFFLINE] = SNIC_STAT_DEV_OFFLINE, + [SNIC_STAT_NO_BOOTLUN] = SNIC_STAT_NO_BOOTLUN, + [SNIC_STAT_SCSI_ERR]= SNIC_STAT_SCSI_ERR, + [SNIC_STAT_NOT_READY] = SNIC_STAT_NOT_READY, + [SNIC_STAT_FATAL_ERROR] = SNIC_STAT_FATAL_ERROR, +}; + +static void snic_scsi_cleanup(struct snic *, int); + +const char * +snic_state_to_str(unsigned int state) +{ + if (state = ARRAY_SIZE(snic_state_str) || !snic_state_str[state]) + return Unknown; + + return snic_state_str[state]; +} + +static const char * +snic_io_status_to_str(unsigned int state) +{ + if ((state = ARRAY_SIZE(snic_io_status_str)) || +(!snic_io_status_str[state])) + return Unknown; + + return snic_io_status_str[state]; +} + +static const char * +snic_ioreq_state_to_str(unsigned int state) +{ + if (state = ARRAY_SIZE(snic_req_state_str) || + !snic_req_state_str[state]) + return Unknown; + + return snic_req_state_str[state]; +} + +static inline spinlock_t * +snic_io_lock_hash(struct snic *snic, struct scsi_cmnd *sc) +{ + u32 hash = snic_cmd_tag(sc) (SNIC_IO_LOCKS - 1); + + return snic-io_req_lock[hash]; +} + +static inline spinlock_t * +snic_io_lock_tag(struct snic *snic, int tag) +{ + return snic-io_req_lock[tag (SNIC_IO_LOCKS
[PATCH v4 2/9] snic:Add interrupt, resource firmware interfaces
snic_fwint.h contains firmware interface structures. snic_res.h contains firmware request initialization snic_res.c contains retrieval of resource configuration, and allocation, and initialization of HW Queues. snic_isr.c contains interrupt request, release, and handling Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v4 - Updated comment on future changes when hardware supports multiple queues. * v3 - Cleaned up unused structure definitions and functions. drivers/scsi/snic/snic_fwint.h | 525 + drivers/scsi/snic/snic_isr.c | 209 drivers/scsi/snic/snic_res.c | 297 +++ drivers/scsi/snic/snic_res.h | 96 4 files changed, 1127 insertions(+) create mode 100644 drivers/scsi/snic/snic_fwint.h create mode 100644 drivers/scsi/snic/snic_isr.c create mode 100644 drivers/scsi/snic/snic_res.c create mode 100644 drivers/scsi/snic/snic_res.h diff --git a/drivers/scsi/snic/snic_fwint.h b/drivers/scsi/snic/snic_fwint.h new file mode 100644 index 000..1142e52 --- /dev/null +++ b/drivers/scsi/snic/snic_fwint.h @@ -0,0 +1,525 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __SNIC_FWINT_H +#define __SNIC_FWINT_H + +#define SNIC_CDB_LEN 32 /* SCSI CDB size 32, can be used for 16 bytes */ +#define LUN_ADDR_LEN 8 + +/* + * Command entry type + */ +enum snic_io_type { + /* +* Initiator request types +*/ + SNIC_REQ_REPORT_TGTS = 0x2, /* Report Targets */ + SNIC_REQ_ICMND, /* Initiator command for SCSI IO */ + SNIC_REQ_ITMF, /* Initiator command for Task Mgmt */ + SNIC_REQ_HBA_RESET, /* SNIC Reset */ + SNIC_REQ_EXCH_VER, /* Exchange Version Information */ + SNIC_REQ_TGT_INFO, /* Backend/Target Information */ + SNIC_REQ_BOOT_LUNS, + + /* +* Response type +*/ + SNIC_RSP_REPORT_TGTS_CMPL = 0x12,/* Report Targets Completion */ + SNIC_RSP_ICMND_CMPL,/* SCSI IO Completion */ + SNIC_RSP_ITMF_CMPL, /* Task Management Completion */ + SNIC_RSP_HBA_RESET_CMPL,/* SNIC Reset Completion */ + SNIC_RSP_EXCH_VER_CMPL, /* Exchange Version Completion*/ + SNIC_RSP_BOOT_LUNS_CMPL, + + /* +* Misc Request types +*/ + SNIC_MSG_ACK = 0x80,/* Ack: snic_notify_msg */ + SNIC_MSG_ASYNC_EVNOTIFY,/* Asynchronous Event Notification */ +}; /* end of enum snic_io_type */ + + +/* + * Header status codes from firmware + */ +enum snic_io_status { + SNIC_STAT_IO_SUCCESS = 0, /* request was successful */ + + /* +* If a request to the fw is rejected, the original request header +* will be returned with the status set to one of the following: +*/ + SNIC_STAT_INVALID_HDR, /* header contains invalid data */ + SNIC_STAT_OUT_OF_RES, /* out of resources to complete request */ + SNIC_STAT_INVALID_PARM, /* some parameter in request is not valid */ + SNIC_STAT_REQ_NOT_SUP, /* req type is not supported */ + SNIC_STAT_IO_NOT_FOUND, /* requested IO was not found */ + + /* +* Once a request is processed, the fw will usually return +* a cmpl message type. In cases where errors occurred, +* the header status would be filled in with one of the following: +*/ + SNIC_STAT_ABORTED, /* req was aborted */ + SNIC_STAT_TIMEOUT, /* req was timed out */ + SNIC_STAT_SGL_INVALID, /* req was aborted due to sgl error */ + SNIC_STAT_DATA_CNT_MISMATCH,/*recv/sent more/less data than expec */ + SNIC_STAT_FW_ERR, /* req was terminated due to fw error */ + SNIC_STAT_ITMF_REJECT, /* itmf req was rejected by target */ + SNIC_STAT_ITMF_FAIL,/* itmf req was failed */ + SNIC_STAT_ITMF_INCORRECT_LUN, /* itmf req has incorrect LUN id*/ + SNIC_STAT_CMND_REJECT, /* req was invalid and rejected */ + SNIC_STAT_DEV_OFFLINE, /* req sent to offline device */ +
[PATCH 11/14] qla2xxx: Prevent multiple firmware dump collection for ISP27XX.
For ISP27XX, driver will capture new firmware dump even if there is one already collected. Prevent this from happening by checking fw_dumped flag. Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_dbg.c |2 +- drivers/scsi/qla2xxx/qla_tmpl.c |4 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index b06b6b5..0e6ee3c 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -60,7 +60,7 @@ * | || 0xb13c-0xb140 | * | || 0xb149 | * | MultiQ | 0xc00c | | - * | Misc | 0xd213 | 0xd016-0xd017 | + * | Misc | 0xd300 | 0xd016-0xd017 | * | || 0xd021,0xd024 | * | || 0xd025,0xd029 | * | || 0xd02a,0xd02e | diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index 7f67fb2..58fc115 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -947,6 +947,10 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked) ql_log(ql_log_warn, vha, 0xd01e, fwdump buffer missing.\n); else if (!vha-hw-fw_dump_template) ql_log(ql_log_warn, vha, 0xd01f, fwdump template missing.\n); + else if (vha-hw-fw_dumped) + ql_log(ql_log_warn, vha, 0xd300, + Firmware has been previously dumped (%p), +-- ignoring request\n, vha-hw-fw_dump); else qla27xx_execute_fwdt_template(vha); -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/14] qla2xxx: Add message for sucessful FW dump collected for ISP27XX.
o Added message indicating firmware dump was sucessfully collected for ISP27XX. o Improve logging to help debug firmware dump process for ISP27XX. Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_dbg.c |2 +- drivers/scsi/qla2xxx/qla_tmpl.c |8 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index d77fe43..5774c53 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -60,7 +60,7 @@ * | || 0xb13c-0xb140 | * | || 0xb149 | * | MultiQ | 0xc00c | | - * | Misc | 0xd213 | 0xd011-0xd017 | + * | Misc | 0xd213 | 0xd016-0xd017 | * | || 0xd021,0xd024 | * | || 0xd025,0xd029 | * | || 0xd02a,0xd02e | diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index 7a92f60..1437fce 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -219,6 +219,8 @@ qla27xx_skip_entry(struct qla27xx_fwdt_entry *ent, void *buf) { if (buf) ent-hdr.driver_flags |= DRIVER_FLAG_SKIP_ENTRY; + ql_dbg(ql_dbg_misc + ql_dbg_verbose, NULL, 0xd011, + Skipping entry %d\n, ent-hdr.entry_type); } static int @@ -784,6 +786,12 @@ qla27xx_walk_template(struct scsi_qla_host *vha, ql_dbg(ql_dbg_misc, vha, 0xd01b, %s: len=%lx\n, __func__, *len); + + if (buf) + ql_log(ql_log_warn, vha, 0xd015, + Firmware dump saved to temp buffer (%ld/%p)\n, + vha-host_no, vha-hw-fw_dump); + } static void -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/14] qla2xxx: Disable Interrupt handshake for ISP27XX.
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_def.h |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 222d70a..9a8aa11 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3132,7 +3132,8 @@ struct qla_hw_data { IS_QLA25XX(ha) || IS_QLA81XX(ha) || \ IS_QLA82XX(ha) || IS_QLA83XX(ha) || \ IS_QLA8044(ha) || IS_QLA27XX(ha)) -#define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha)) +#define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha) || \ + IS_QLA27XX(ha)) #define IS_NOPOLLING_TYPE(ha) (IS_QLA81XX(ha) (ha)-flags.msix_enabled) #define IS_FAC_REQUIRED(ha)(IS_QLA81XX(ha) || IS_QLA83XX(ha) || \ IS_QLA27XX(ha)) -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/14] qla2xxx: Increase the wait time for firmware to be ready for P3P.
From: Chad Dupuis chad.dup...@qlogic.com Signed-off-by: Chad Dupuis chad.dup...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_init.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index e59f25b..cb294e5 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -2243,8 +2243,11 @@ qla2x00_fw_ready(scsi_qla_host_t *vha) rval = QLA_SUCCESS; - /* 20 seconds for loop down. */ - min_wait = 20; + /* Time to wait for loop down */ + if (IS_P3P_TYPE(ha)) + min_wait = 30; + else + min_wait = 20; /* * Firmware should take at most one RATOV to login, plus 5 seconds for -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
re: ufs: add ioctl interface for query request
Hello Dolev Raviv, The patch 4aca8e8975db: ufs: add ioctl interface for query request from Mar 12, 2015, leads to the following Smatch warning: drivers/scsi/ufs/ufshcd.c:4386 ufshcd_query_ioctl() warn: maybe return -EFAULT instead of the bytes remaining? drivers/scsi/ufs/ufshcd.c 4364 /* copy to user */ 4365 err = copy_to_user(buffer, ioctl_data, 4366 sizeof(struct ufs_ioctl_query_data)); 4367 if (err) 4368 dev_err(hba-dev, %s: Failed copying back to user.\n, 4369 __func__); copy_to/from_user() returns the number of bytes not copied and not an error code. Printing these error messages in the ioctl means the user can trigger a DoS by filling up /var/log/messages. They make the code uglier. We should stop here if the copy fails and goto out_release_mem otherwise we might end up returning success by mistake. The normal way to do it is: if (copy_to_user(buffer, ioctl_data, sizeof(struct ufs_ioctl_query_data))) { err = -EFAULT; goto out_release_mem; } 4370 err = copy_to_user(buffer + sizeof(struct ufs_ioctl_query_data), 4371 data_ptr, ioctl_data-buf_size); 4372 if (err) 4373 dev_err(hba-dev, %s: err %d copying back to user.\n, 4374 __func__, err); 4375 goto out_release_mem; 4376 4377 out_einval: 4378 dev_err(hba-dev, 4379 %s: illegal ufs query ioctl data, opcode 0x%x, idn 0x%x\n, 4380 __func__, ioctl_data-opcode, (unsigned int)ioctl_data-idn); 4381 err = -EINVAL; 4382 out_release_mem: 4383 kfree(ioctl_data); 4384 kfree(desc); 4385 out: 4386 return err; 4387 } regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 15/21] lpfc: Implement support for wire-only DIF devices
James == James Smart james.sm...@emulex.com writes: James fyi - in the v3 of the lpfc 10.5.0.0 patches I just posted, I James pulled the patch. We will see what to do with it. We may come James back with a set of generic midlayer patches. We already have a DIF blacklist. We could have an explicit whitelist as well. But it begs the question: Why on earth are 3Par not following the spec? And why don't they just fix their firmware to report the right thing? -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi_transport_fc: Add support for 25Gbit speed
On 04/02/2015 09:50 PM, James Smart wrote: Add FC transport support for 25Gbit speed Signed-off-by: James Smart james.sm...@emulex.com Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes ReineckezSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/14] i2c-parport: return proper error values from attach
It doesn't really matter that the error codes are different, it matters that they are meaningful. As much as possible you should pass error codes from the lower layers. parport_claim_or_block() and i2c_bit_add_bus() return proper error codes so you should record and transmit them. Oh, surely yes. I assumed they don't and this series is a first step to fix this. Should have looked myself. Thanks for jumping in here. signature.asc Description: Digital signature
Re: [PATCH 5/6] ipr: AF DASD raw mode implementation in ipr driver
On Thu, 2015-03-26 at 11:23 -0500, Brian King wrote: From: Wen Xiong wenxi...@linux.vnet.ibm.com This patch implements raw mode support for AF DASD in ipr driver which allows for tools to send commands directly to physical devices which are members of RAID arrays when enabled in the firmware. Signed-off-by: Wen Xiongwenxi...@linux.vnet.ibm.com Signed-off-by: Brian King brk...@linux.vnet.ibm.com --- drivers/scsi/ipr.c | 85 + drivers/scsi/ipr.h |3 + 2 files changed, 88 insertions(+) diff -puN drivers/scsi/ipr.c~ipr_sispipe drivers/scsi/ipr.c --- linux/drivers/scsi/ipr.c~ipr_sispipe 2015-03-26 10:53:55.540578199 -0500 +++ linux-bjking1/drivers/scsi/ipr.c 2015-03-26 10:57:00.570080498 -0500 [...] @@ -6152,6 +6228,13 @@ static void ipr_erp_start(struct ipr_ioa break; case IPR_IOASC_NR_INIT_CMD_REQUIRED: break; + case IPR_IOASC_IR_NON_OPTIMIZED: + if (res-raw_mode){ Missing space here ... checkpatch would have picked this up; please use it. James -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/14] i2c-parport: return proper error values from attach
On Thu, 9 Apr 2015 09:13:07 +0200, Wolfram Sang wrote: On Wed, Apr 08, 2015 at 04:50:38PM +0530, Sudip Mukherjee wrote: now that we are monitoring the return value from attach, make the required changes to return proper value from its attach function. Signed-off-by: Sudip Mukherjee su...@vectorindia.org --- drivers/i2c/busses/i2c-parport.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index a1fac5a..761a775 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c @@ -160,14 +160,14 @@ static void i2c_parport_irq(void *data) SMBus alert received but no ARA client!\n); } -static void i2c_parport_attach(struct parport *port) +static int i2c_parport_attach(struct parport *port) { struct i2c_par *adapter; adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); if (adapter == NULL) { printk(KERN_ERR i2c-parport: Failed to kzalloc\n); - return; + return -ENOMEM; ENOMEM does not need printout. Please remove printk while we are here. pr_debug(i2c-parport: attaching to %s\n, port-name); @@ -230,13 +230,14 @@ static void i2c_parport_attach(struct parport *port) mutex_lock(adapter_list_lock); list_add_tail(adapter-node, adapter_list); mutex_unlock(adapter_list_lock); - return; + return 0; err_unregister: parport_release(adapter-pdev); parport_unregister_device(adapter-pdev); err_free: kfree(adapter); + return -ENODEV; Ideally, we would return different -Esomething for each failing case. We can leave that for someone who is acutally using the driver. However, I wonder if ENODEV is a proper catch-all case because the driver core will not report failures. It doesn't really matter that the error codes are different, it matters that they are meaningful. As much as possible you should pass error codes from the lower layers. parport_claim_or_block() and i2c_bit_add_bus() return proper error codes so you should record and transmit them. Only parport_register_device() does not, so you have to craft one and -ENODEV seems appropriate to me. Note: I can test this driver. -- Jean Delvare SUSE L3 Support -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/14] qla2xxx: Add serdes read/write support for ISP27XX
From: Andrew Vasquez andrew.vasq...@qlogic.com Signed-off-by: Andrew Vasquez andrew.vasq...@qlogic.com Signed-off-by: Harish Zunjarrao harish.zunjar...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_mbx.c | 15 +++ 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 72971da..fe7b87d 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -2838,7 +2838,7 @@ qla2x00_write_serdes_word(scsi_qla_host_t *vha, uint16_t addr, uint16_t data) mbx_cmd_t mc; mbx_cmd_t *mcp = mc; - if (!IS_QLA2031(vha-hw)) + if (!IS_QLA2031(vha-hw) !IS_QLA27XX(vha-hw)) return QLA_FUNCTION_FAILED; ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1182, @@ -2846,7 +2846,11 @@ qla2x00_write_serdes_word(scsi_qla_host_t *vha, uint16_t addr, uint16_t data) mcp-mb[0] = MBC_WRITE_SERDES; mcp-mb[1] = addr; - mcp-mb[2] = data 0xff; + if (IS_QLA2031(vha-hw)) + mcp-mb[2] = data 0xff; + else + mcp-mb[2] = data; + mcp-mb[3] = 0; mcp-out_mb = MBX_3|MBX_2|MBX_1|MBX_0; mcp-in_mb = MBX_0; @@ -2872,7 +2876,7 @@ qla2x00_read_serdes_word(scsi_qla_host_t *vha, uint16_t addr, uint16_t *data) mbx_cmd_t mc; mbx_cmd_t *mcp = mc; - if (!IS_QLA2031(vha-hw)) + if (!IS_QLA2031(vha-hw) !IS_QLA27XX(vha-hw)) return QLA_FUNCTION_FAILED; ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1185, @@ -2887,7 +2891,10 @@ qla2x00_read_serdes_word(scsi_qla_host_t *vha, uint16_t addr, uint16_t *data) mcp-flags = 0; rval = qla2x00_mailbox_command(vha, mcp); - *data = mcp-mb[1] 0xff; + if (IS_QLA2031(vha-hw)) + *data = mcp-mb[1] 0xff; + else + *data = mcp-mb[1]; if (rval != QLA_SUCCESS) { ql_dbg(ql_dbg_mbx, vha, 0x1186, -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/14] qla2xxx: Fix crash due to wrong casting of reg for ISP27XX.
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_tmpl.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index a8c0c73..7a92f60 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -190,7 +190,7 @@ static inline void qla27xx_write_reg(__iomem struct device_reg_24xx *reg, uint offset, uint32_t data, void *buf) { - __iomem void *window = reg + offset; + __iomem void *window = (void *)reg + offset; if (buf) { WRT_REG_DWORD(window, data); -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/14] qla2xxx: Patches for scsi misc branch.
Hi James, Please apply the following patches to the scsi tree at your earliest convenience for inclusion in the next mainline merge window. Thanks, Himanshu Andrew Vasquez (1): qla2xxx: Add serdes read/write support for ISP27XX Chad Dupuis (1): qla2xxx: Increase the wait time for firmware to be ready for P3P. Himanshu Madhani (8): qla2xxx: Fix warnings reported by static checker. qla2xxx: Fix crash due to wrong casting of reg for ISP27XX. qla2xxx: Add message for sucessful FW dump collected for ISP27XX. qla2xxx: Add udev notification to save fw dump for ISP27XX qla2xxx: Add debugging info for MBX timeout. qla2xxx: Disable Interrupt handshake for ISP27XX. qla2xxx: Prevent multiple firmware dump collection for ISP27XX. qla2xxx: Update driver version to 8.07.00.18-k Nigel Kirkland (1): qla2xxx: Fix beacon blink for ISP27XX. Sawan Chandak (3): qla2xxx: Add support to load firmware from file for ISP 26XX/27XX. qla2xxx: Fix virtual port configuration, when switch port is disabled/enabled. qla2xxx: Restore physical port WWPN only, when port down detected for FA-WWPN port. drivers/scsi/qla2xxx/Kconfig |3 + drivers/scsi/qla2xxx/qla_dbg.c |6 +- drivers/scsi/qla2xxx/qla_def.h | 16 +--- drivers/scsi/qla2xxx/qla_init.c| 75 ++-- drivers/scsi/qla2xxx/qla_isr.c | 17 +++- drivers/scsi/qla2xxx/qla_mbx.c | 31 -- drivers/scsi/qla2xxx/qla_mid.c | 22 +++ drivers/scsi/qla2xxx/qla_os.c |3 + drivers/scsi/qla2xxx/qla_sup.c | 11 +++-- drivers/scsi/qla2xxx/qla_tmpl.c| 15 +++- drivers/scsi/qla2xxx/qla_version.h |2 +- 11 files changed, 158 insertions(+), 43 deletions(-) -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/14] qla2xxx: Add udev notification to save fw dump for ISP27XX
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_tmpl.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index 1437fce..7f67fb2 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -787,11 +787,12 @@ qla27xx_walk_template(struct scsi_qla_host *vha, ql_dbg(ql_dbg_misc, vha, 0xd01b, %s: len=%lx\n, __func__, *len); - if (buf) + if (buf) { ql_log(ql_log_warn, vha, 0xd015, Firmware dump saved to temp buffer (%ld/%p)\n, vha-host_no, vha-hw-fw_dump); - + qla2x00_post_uevent_work(vha, QLA_UEVENT_CODE_FW_DUMP); + } } static void -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/14] qla2xxx: Fix beacon blink for ISP27XX.
From: Nigel Kirkland nigel.kirkl...@qlogic.com Signed-off-by: Nigel Kirkland nigel.kirkl...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_sup.c | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index b656a05..028e8c8 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c @@ -1718,13 +1718,16 @@ qla83xx_beacon_blink(struct scsi_qla_host *vha) uint16_t orig_led_cfg[6]; uint32_t led_10_value, led_43_value; - if (!IS_QLA83XX(ha) !IS_QLA81XX(ha)) + if (!IS_QLA83XX(ha) !IS_QLA81XX(ha) !IS_QLA27XX(ha)) return; if (!ha-beacon_blink_led) return; - if (IS_QLA2031(ha)) { + if (IS_QLA27XX(ha)) { + qla2x00_write_ram_word(vha, 0x1003, 0x4230); + qla2x00_write_ram_word(vha, 0x1004, 0x4230); + } else if (IS_QLA2031(ha)) { led_select_value = qla83xx_select_led_port(ha); qla83xx_wr_reg(vha, led_select_value, 0x4230); @@ -1811,7 +1814,7 @@ qla24xx_beacon_on(struct scsi_qla_host *vha) return QLA_FUNCTION_FAILED; } - if (IS_QLA2031(ha)) + if (IS_QLA2031(ha) || IS_QLA27XX(ha)) goto skip_gpio; spin_lock_irqsave(ha-hardware_lock, flags); @@ -1848,7 +1851,7 @@ qla24xx_beacon_off(struct scsi_qla_host *vha) ha-beacon_blink_led = 0; - if (IS_QLA2031(ha)) + if (IS_QLA2031(ha) || IS_QLA27XX(ha)) goto set_fw_options; if (IS_QLA8031(ha) || IS_QLA81XX(ha)) -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/14] qla2xxx: Restore physical port WWPN only, when port down detected for FA-WWPN port.
From: Sawan Chandak sawan.chan...@qlogic.com For FA-WWPN is enabled port, if NPIV created on that port and, if port link is brought down, then WWPN was restored from flash for both physical and NPIV port. This will result in NPIV port and physical port sharing same WWPN. Any application refreshing ports information will not be able to scan NPIV port because of this behavior. So while restoring WWPN, only restore physical port WWPN. Signed-off-by: Sawan Chandak sawan.chan...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_isr.c | 17 + 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 72dfbc1..6dc14cd 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -756,14 +756,23 @@ skip_rio: /* * In case of loop down, restore WWPN from * NVRAM in case of FA-WWPN capable ISP +* Restore for Physical Port only */ - if (ha-flags.fawwpn_enabled) { - void *wwpn = ha-init_cb-port_name; + if (!vha-vp_idx) { + if (ha-flags.fawwpn_enabled) { + void *wwpn = ha-init_cb-port_name; + memcpy(vha-port_name, wwpn, WWN_SIZE); + fc_host_port_name(vha-host) = + wwn_to_u64(vha-port_name); + ql_dbg(ql_dbg_init + ql_dbg_verbose, + vha, 0x0144, LOOP DOWN detected, + restore WWPN %016llx\n, + wwn_to_u64(vha-port_name)); + } - memcpy(vha-port_name, wwpn, WWN_SIZE); + clear_bit(VP_CONFIG_OK, vha-vp_flags); } - clear_bit(VP_CONFIG_OK, vha-vp_flags); vha-device_flags |= DFLG_NO_CABLE; qla2x00_mark_all_devices_lost(vha, 1); } -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 7/9] snic:Add sysfs entries to list stats and trace data
snic_stats.h contains stats structre definitions for various events in snic driver. snic_debugfs.c contains setup and cleanup of sysfs entries for listing stats, resetting stats, enabling/disabling trace, and listing trace data. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- drivers/scsi/snic/snic_debugfs.c | 562 +++ drivers/scsi/snic/snic_stats.h | 123 + 2 files changed, 685 insertions(+) create mode 100644 drivers/scsi/snic/snic_debugfs.c create mode 100644 drivers/scsi/snic/snic_stats.h diff --git a/drivers/scsi/snic/snic_debugfs.c b/drivers/scsi/snic/snic_debugfs.c new file mode 100644 index 000..31b2642 --- /dev/null +++ b/drivers/scsi/snic/snic_debugfs.c @@ -0,0 +1,562 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include linux/module.h +#include linux/errno.h +#include linux/debugfs.h + +#include snic.h + +/* + * snic_debugfs_init - Initialize debugfs for snic debug logging + * + * Description: + * When Debugfs is configured this routine sets up fnic debugfs + * filesystem. If not already created. this routine will crate the + * fnic directory and statistics directory for trace buffer and + * stats logging + */ + +int +snic_debugfs_init(void) +{ + int rc = -1; + struct dentry *de = NULL; + + de = debugfs_create_dir(snic, NULL); + if (!de) { + SNIC_DBG(Cannot create debugfs root\n); + + return rc; + } + snic_glob-trc_root = de; + + de = debugfs_create_dir(statistics, snic_glob-trc_root); + if (!de) { + SNIC_DBG(Cannot create Statistics directory\n); + + return rc; + } + snic_glob-stats_root = de; + + rc = 0; + + return rc; +} /* end of snic_debugfs_init */ + +/* + * snic_debugfs_term - Tear down debugfs intrastructure + * + * Description: + * When Debufs is configured this routine removes debugfs file system + * elements that are specific to snic + */ +void +snic_debugfs_term(void) +{ + debugfs_remove(snic_glob-stats_root); + snic_glob-stats_root = NULL; + + debugfs_remove(snic_glob-trc_root); + snic_glob-trc_root = NULL; +} + +/* + * snic_reset_stats_open - Open the reset_stats file + */ +static int +snic_reset_stats_open(struct inode *inode, struct file *filp) +{ + SNIC_BUG_ON(!inode-i_private); + filp-private_data = inode-i_private; + + return 0; +} + +/* + * snic_reset_stats_read - Read a reset_stats debugfs file + * @filp: The file pointer to read from. + * @ubuf: The buffer tocopy the data to. + * @cnt: The number of bytes to read. + * @ppos: The position in the file to start reading frm. + * + * Description: + * This routine reads value of variable reset_stats + * and stores into local @buf. It will start reading file @ppos and + * copy up to @cnt of data to @ubuf from @buf. + * + * Returns: + * This function returns the amount of data that was read. + */ +static ssize_t +snic_reset_stats_read(struct file *filp, + char __user *ubuf, + size_t cnt, + loff_t *ppos) +{ + struct snic *snic = (struct snic *) filp-private_data; + char buf[64]; + int len; + + len = sprintf(buf, %u\n, snic-reset_stats); + + return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); +} + +/* + * snic_reset_stats_write - Write to reset_stats debugfs file + * @filp: The file pointer to write from + * @ubuf: The buffer to copy the data from. + * @cnt: The number of bytes to write. + * @ppos: The position in the file to start writing to. + * + * Description: + * This routine writes data from user buffer @ubuf to buffer @buf and + * resets cumulative stats of snic. + * + * Returns: + * This function returns the amount of data that was written. + */ +static ssize_t +snic_reset_stats_write(struct file *filp, + const char __user *ubuf, + size_t cnt, + loff_t *ppos) +{ + struct snic *snic = (struct snic *) filp-private_data; + struct snic_stats *stats = snic-s_stats; + u64 *io_stats_p = (u64 *) stats-io; + u64 *fw_stats_p = (u64 *) stats-fw; +
Re: [PATCH v4 7/9] snic:Add sysfs entries to list stats and trace data
On 04/09/2015 01:49 PM, Narsimhulu Musini wrote: snic_stats.h contains stats structre definitions for various events in snic driver. snic_debugfs.c contains setup and cleanup of sysfs entries for listing stats, resetting stats, enabling/disabling trace, and listing trace data. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/14] qla2xxx: Fix virtual port configuration, when switch port is disabled/enabled.
From: Sawan Chandak sawan.chan...@qlogic.com On some vendor switches, when switch port is toggled (down /up), then in some condition driver tries to configure virtual port, before FW is actually in ready state to process any commands on wire. At this time, configuring virtual port can fail. Add fix in driver to make driver wait, for FW to be ready state before Signed-off-by: Sawan Chandak sawan.chan...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_def.h |1 + drivers/scsi/qla2xxx/qla_isr.c |2 ++ drivers/scsi/qla2xxx/qla_mid.c | 22 ++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 9a8aa11..e86201d 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3590,6 +3590,7 @@ typedef struct scsi_qla_host { #define VP_BIND_NEEDED 2 #define VP_DELETE_NEEDED 3 #define VP_SCR_NEEDED 4 /* State Change Request registration */ +#define VP_CONFIG_OK 5 /* Flag to cfg VP, if FW is ready */ atomic_tvp_state; #define VP_OFFLINE 0 #define VP_ACTIVE 1 diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index a04a1b1..72dfbc1 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -763,6 +763,7 @@ skip_rio: memcpy(vha-port_name, wwpn, WWN_SIZE); } + clear_bit(VP_CONFIG_OK, vha-vp_flags); vha-device_flags |= DFLG_NO_CABLE; qla2x00_mark_all_devices_lost(vha, 1); } @@ -947,6 +948,7 @@ skip_rio: set_bit(LOOP_RESYNC_NEEDED, vha-dpc_flags); set_bit(LOCAL_LOOP_UPDATE, vha-dpc_flags); + set_bit(VP_CONFIG_OK, vha-vp_flags); qlt_async_event(mb[0], vha, mb); break; diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 5c2e031..8f458ef 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -306,19 +306,25 @@ qla2x00_vp_abort_isp(scsi_qla_host_t *vha) static int qla2x00_do_dpc_vp(scsi_qla_host_t *vha) { + struct qla_hw_data *ha = vha-hw; + scsi_qla_host_t *base_vha = pci_get_drvdata(ha-pdev); + ql_dbg(ql_dbg_dpc + ql_dbg_verbose, vha, 0x4012, Entering %s vp_flags: 0x%lx.\n, __func__, vha-vp_flags); qla2x00_do_work(vha); - if (test_and_clear_bit(VP_IDX_ACQUIRED, vha-vp_flags)) { - /* VP acquired. complete port configuration */ - ql_dbg(ql_dbg_dpc, vha, 0x4014, - Configure VP scheduled.\n); - qla24xx_configure_vp(vha); - ql_dbg(ql_dbg_dpc, vha, 0x4015, - Configure VP end.\n); - return 0; + /* Check if Fw is ready to configure VP first */ + if (test_bit(VP_CONFIG_OK, base_vha-vp_flags)) { + if (test_and_clear_bit(VP_IDX_ACQUIRED, vha-vp_flags)) { + /* VP acquired. complete port configuration */ + ql_dbg(ql_dbg_dpc, vha, 0x4014, + Configure VP scheduled.\n); + qla24xx_configure_vp(vha); + ql_dbg(ql_dbg_dpc, vha, 0x4015, + Configure VP end.\n); + return 0; + } } if (test_bit(FCPORT_UPDATE_NEEDED, vha-dpc_flags)) { -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 14/14] qla2xxx: Update driver version to 8.07.00.18-k
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_version.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index d88b862..2ed9ab9 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h @@ -7,7 +7,7 @@ /* * Driver version */ -#define QLA2XXX_VERSION 8.07.00.16-k +#define QLA2XXX_VERSION 8.07.00.18-k #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 7 -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/2] target/rd: Don't pass imcomplete scatterlist entries to sbc_dif_verify_*
On Wed, 2015-04-08 at 23:25 +0900, Akinobu Mita wrote: 2015-04-08 14:13 GMT+09:00 Nicholas A. Bellinger n...@linux-iscsi.org: On Sun, 2015-04-05 at 23:59 +0900, Akinobu Mita wrote: The scatterlist for protection information which is passed to sbc_dif_verify_read() or sbc_dif_verify_write() requires that neighboring scatterlist entries are contiguous or chained so that they can be iterated by sg_next(). However, the protection information for RD-MCP backends could be located in the multiple scatterlist arrays when the ramdisk space is too large. So if the read/write request straddles this boundary, sbc_dif_verify_read() or sbc_dif_verify_write() can't iterate all scatterlist entries. This fixes it by allocating temporary scatterlist if it is needed. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Cc: Nicholas Bellinger n...@linux-iscsi.org Cc: Sagi Grimberg sa...@dev.mellanox.co.il Cc: Martin K. Petersen martin.peter...@oracle.com Cc: Christoph Hellwig h...@lst.de Cc: James E.J. Bottomley james.bottom...@hansenpartnership.com Cc: target-de...@vger.kernel.org Cc: linux-scsi@vger.kernel.org --- * No change from v1 drivers/target/target_core_rd.c | 39 +++ 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index ac5e8d2..6e25eaa 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c @@ -390,11 +390,12 @@ static sense_reason_t rd_do_prot_rw(struct se_cmd *cmd, dif_verify dif_verify) struct se_device *se_dev = cmd-se_dev; struct rd_dev *dev = RD_DEV(se_dev); struct rd_dev_sg_table *prot_table; + bool need_to_release = false; struct scatterlist *prot_sg; u32 sectors = cmd-data_length / se_dev-dev_attrib.block_size; - u32 prot_offset, prot_page; + u32 prot_offset, prot_page, prot_npages; u64 tmp; - sense_reason_t rc; + sense_reason_t rc = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; tmp = cmd-t_task_lba * se_dev-prot_length; prot_offset = do_div(tmp, PAGE_SIZE); @@ -404,10 +405,40 @@ static sense_reason_t rd_do_prot_rw(struct se_cmd *cmd, dif_verify dif_verify) if (!prot_table) return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; - prot_sg = prot_table-sg_table[prot_page - - prot_table-page_start_offset]; + prot_npages = DIV_ROUND_UP(prot_offset + sectors * se_dev-prot_length, +PAGE_SIZE); + + /* prot pages straddles multiple scatterlist tables */ + if (prot_table-page_end_offset prot_page + prot_npages - 1) { + int i; + + prot_sg = kcalloc(prot_npages, sizeof(*prot_sg), GFP_KERNEL); + if (!prot_sg) + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; + + need_to_release = true; + sg_init_table(prot_sg, prot_npages); + + for (i = 0; i prot_npages; i++) { + if (prot_page + i prot_table-page_end_offset) { + prot_table = rd_get_prot_table(dev, + prot_page + i); + if (!prot_table) + goto out; + sg_unmark_end(prot_sg[i - 1]); + } + prot_sg[i] = prot_table-sg_table[prot_page + i - + prot_table-page_start_offset]; + } + } else { + prot_sg = prot_table-sg_table[prot_page - + prot_table-page_start_offset]; + } Mmm, how about just explicitly doing sg_link() at prot_table scatterlist creation time instead..? Yeap, that would be an optimal solution. But some architectures don't support sg chaining (i.e. !CONFIG_ARCH_HAS_SG_CHAIN). That would save the extra allocation above, and AFAICT make for simpler code. Do you prefer fixing it conditionally with using #ifdef ? (i.e. sg chaining at creating time if CONFIG_ARCH_HAS_SG_CHAIN is defined, otherwise do the extra allocation above) If so, I'll resubmit the patch with such changes. Yes please. It would be nice to use sg_link() for the typical case when available, as long as the #idefs aren't too ugly and limited to target_core_rd.c code. --nab -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi_transport_fc: Add support for 25Gbit speed
On Thu, 2015-04-02 at 15:50 -0400, James Smart wrote: Add FC transport support for 25Gbit speed Signed-off-by: James Smart james.sm...@emulex.com --- drivers/scsi/scsi_transport_fc.c | 1 + include/scsi/scsi_transport_fc.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 5d6f348..24eaaf6 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -265,6 +265,7 @@ static const struct { { FC_PORTSPEED_40GBIT, 40 Gbit }, { FC_PORTSPEED_50GBIT, 50 Gbit }, { FC_PORTSPEED_100GBIT, 100 Gbit }, + { FC_PORTSPEED_25GBIT, 25 Gbit }, { FC_PORTSPEED_NOT_NEGOTIATED, Not Negotiated }, }; fc_bitfield_name_search(port_speed, fc_port_speed_names) diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 007a0bc..784bc2c 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -135,6 +135,7 @@ enum fc_vport_state { #define FC_PORTSPEED_40GBIT 0x100 #define FC_PORTSPEED_50GBIT 0x200 #define FC_PORTSPEED_100GBIT 0x400 +#define FC_PORTSPEED_25GBIT 0x800 #define FC_PORTSPEED_NOT_NEGOTIATED (1 15) /* Speed not established */ /* Reviewed-by: Ewan D. Milne emi...@redhat.com -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/14] i2c-parport: return proper error values from attach
On Wed, Apr 08, 2015 at 04:50:38PM +0530, Sudip Mukherjee wrote: now that we are monitoring the return value from attach, make the required changes to return proper value from its attach function. Signed-off-by: Sudip Mukherjee su...@vectorindia.org --- drivers/i2c/busses/i2c-parport.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index a1fac5a..761a775 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c @@ -160,14 +160,14 @@ static void i2c_parport_irq(void *data) SMBus alert received but no ARA client!\n); } -static void i2c_parport_attach(struct parport *port) +static int i2c_parport_attach(struct parport *port) { struct i2c_par *adapter; adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); if (adapter == NULL) { printk(KERN_ERR i2c-parport: Failed to kzalloc\n); - return; + return -ENOMEM; ENOMEM does not need printout. Please remove printk while we are here. pr_debug(i2c-parport: attaching to %s\n, port-name); @@ -230,13 +230,14 @@ static void i2c_parport_attach(struct parport *port) mutex_lock(adapter_list_lock); list_add_tail(adapter-node, adapter_list); mutex_unlock(adapter_list_lock); - return; + return 0; err_unregister: parport_release(adapter-pdev); parport_unregister_device(adapter-pdev); err_free: kfree(adapter); + return -ENODEV; Ideally, we would return different -Esomething for each failing case. We can leave that for someone who is acutally using the driver. However, I wonder if ENODEV is a proper catch-all case because the driver core will not report failures. signature.asc Description: Digital signature
Re: [PATCH 15/21] lpfc: Implement support for wire-only DIF devices
fyi - in the v3 of the lpfc 10.5.0.0 patches I just posted, I pulled the patch. We will see what to do with it. We may come back with a set of generic midlayer patches. -- james s On 4/5/2015 12:06 PM, Christoph Hellwig wrote: On Fri, Apr 03, 2015 at 05:13:00PM -0400, James Smart wrote: Implement support for wire-only DIF devices This patch adds the ability to support auto-enablement of wire-only DIF (DIF is generated on TX to target, stripped on RX; OS unaware DIF in use) for a select set of devices. Currently, there is only 1 device vendor supported: 3PARdata. When the feature is enabled, Inquiry commands are trapped, the vendor matched, and DIF enablement checked. In 3Par's case, there's a vendor specific check to see if the LUN supports DIF. If supported, DIF will be enabled on a per-lun basis. The driver will trap READS/WRITEs from the OS, check for LUN DIF enablement, and if set, turns on write-only DIF. NAK. We do support proper DIF, and anyone who wants it should enable the real thing. And even if we would want to support a hack like this we'd do it genericly an not in a driver. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/9] snic: snic module infrastructure
On 04/09/2015 01:49 PM, Narsimhulu Musini wrote: snic_main.c contains module load and unload, global driver context, PCI Registration, PCI probe and remove, SCSI ML registration functionality. snic.h contains snic structure definition, snic global context, and prototypes. snic_attrs.c contains device attributes to list snic state, link state, and driver version under /sys/class/scsi_host/hostid/ Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 8/9] snic:Add event tracing to capture IO events.
On 04/09/2015 01:49 PM, Narsimhulu Musini wrote: snic_trc.h contains global trace structure definitions for snic driver snic_trc.c adds tracing functionality to capture various IO events. It maintains global trace buffer to maintain recent history of IO events. It helps to understand the sequence of events prior to particular IO event, or hung, panic, etc,. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 8/9] snic:Add event tracing to capture IO events.
snic_trc.h contains global trace structure definitions for snic driver snic_trc.c adds tracing functionality to capture various IO events. It maintains global trace buffer to maintain recent history of IO events. It helps to understand the sequence of events prior to particular IO event, or hung, panic, etc,. Signed-off-by: Narsimhulu Musini nmus...@cisco.com Signed-off-by: Sesidhar Baddela sebad...@cisco.com --- * v2 - Added compile time macro SNIC_DEBUG_FS to handle debugfs dependent functionality. drivers/scsi/snic/snic_trc.c | 182 +++ drivers/scsi/snic/snic_trc.h | 121 2 files changed, 303 insertions(+) create mode 100644 drivers/scsi/snic/snic_trc.c create mode 100644 drivers/scsi/snic/snic_trc.h diff --git a/drivers/scsi/snic/snic_trc.c b/drivers/scsi/snic/snic_trc.c new file mode 100644 index 000..c9e6f96 --- /dev/null +++ b/drivers/scsi/snic/snic_trc.c @@ -0,0 +1,182 @@ +/* + * Copyright 2014 Cisco Systems, Inc. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include linux/module.h +#include linux/mempool.h +#include linux/errno.h + +#include snic_io.h +#include snic.h + +/* + * snic_get_trc_buf : Allocates a trace record and returns. + */ +struct snic_trc_data * +snic_get_trc_buf(void) +{ + struct snic_trc *trc = snic_glob-trc; + struct snic_trc_data *td = NULL; + unsigned long flags; + + spin_lock_irqsave(trc-lock, flags); + td = trc-buf[trc-wr_idx]; + trc-wr_idx++; + + if (trc-wr_idx == trc-max_idx) + trc-wr_idx = 0; + + if (trc-wr_idx != trc-rd_idx) { + spin_unlock_irqrestore(trc-lock, flags); + + goto end; + } + + trc-rd_idx++; + if (trc-rd_idx == trc-max_idx) + trc-rd_idx = 0; + + td-ts = 0; /* Marker for checking the record, for complete data*/ + spin_unlock_irqrestore(trc-lock, flags); + +end: + + return td; +} /* end of snic_get_trc_buf */ + +/* + * snic_fmt_trc_data : Formats trace data for printing. + */ +static int +snic_fmt_trc_data(struct snic_trc_data *td, char *buf, int buf_sz) +{ + int len = 0; + struct timespec tmspec; + + jiffies_to_timespec(td-ts, tmspec); + + len += snprintf(buf, buf_sz, + %lu.%10lu %-25s %3d %4x %16llx %16llx %16llx %16llx %16llx\n, + tmspec.tv_sec, + tmspec.tv_nsec, + td-fn, + td-hno, + td-tag, + td-data[0], td-data[1], td-data[2], td-data[3], + td-data[4]); + + return len; +} /* end of snic_fmt_trc_data */ + +/* + * snic_get_trc_data : Returns a formatted trace buffer. + */ +int +snic_get_trc_data(char *buf, int buf_sz) +{ + struct snic_trc_data *td = NULL; + struct snic_trc *trc = snic_glob-trc; + unsigned long flags; + + spin_lock_irqsave(trc-lock, flags); + if (trc-rd_idx == trc-wr_idx) { + spin_unlock_irqrestore(trc-lock, flags); + + return -1; + } + td = trc-buf[trc-rd_idx]; + + if (td-ts == 0) { + /* write in progress. */ + spin_unlock_irqrestore(trc-lock, flags); + + return -1; + } + + trc-rd_idx++; + if (trc-rd_idx == trc-max_idx) + trc-rd_idx = 0; + spin_unlock_irqrestore(trc-lock, flags); + + return snic_fmt_trc_data(td, buf, buf_sz); +} /* end of snic_get_trc_data */ + +/* + * snic_trc_init() : Configures Trace Functionality for snic. + */ +int +snic_trc_init(void) +{ + struct snic_trc *trc = snic_glob-trc; + void *tbuf = NULL; + int tbuf_sz = 0, ret; + + BUILD_BUG_ON(sizeof(struct snic_trc_data) != 64); + + tbuf_sz = (snic_trace_max_pages * PAGE_SIZE); + tbuf = vmalloc(tbuf_sz); + if (!tbuf) { + SNIC_ERR(Failed to Allocate Trace Buffer Size. %d\n, tbuf_sz); + SNIC_ERR(Trace Facility not enabled.\n); + ret = -ENOMEM; + + return ret; + } + + memset(tbuf, 0, tbuf_sz); + trc-buf = (struct snic_trc_data *) tbuf; + spin_lock_init(trc-lock); + + ret =