Re: [PATCH v3 0/3] Add QLogic FastLinQ iSCSI (qedi) driver.

2016-12-01 Thread Rangankar, Manish
Hi Dave,

Please consider applying the qed patches 1 & 2 to net-next.

Patch 3, qedi, goes to SCSI. Martin P. is ok to have you take qedi
(already Acked) through your tree. Please let us know which way you
prefer.


Thanks,
Manish

On 01/12/16 1:51 PM, "Rangankar, Manish" 
wrote:

>This series introduces hardware offload iSCSI initiator driver for the
>41000 Series Converged Network Adapters (579xx chip) by Qlogic. The
>overall
>driver design includes a common module ('qed') and protocol specific
>dependent modules ('qedi' for iSCSI).
>
>This is an open iSCSI driver, modifications to open iSCSI user components
>'iscsid', 'iscsiuio', etc. are required for the solution to work. The user
>space changes are also in the process of being submitted.
>
>https://groups.google.com/forum/#!forum/open-iscsi
>
>The 'qed' common module, under drivers/net/ethernet/qlogic/qed/, is
>enhanced with functionality required for the iSCSI support. This series
>is based on:
>
>net tree base: Merge of net and net-next as of 11/29/2016
>
>Changes from RFC v2:
>
>  1. qedi patches are squashed into single patch to prevent krobot
> warning.
>  2. Fixed 'hw_p_cpuq' incompatible pointer type.
>  3. Fixed sparse incompatible types in comparison expression.
>  4. Misc fixes with latest 'checkpatch --strict' option.
>  5. Remove int_mode option from MODULE_PARAM.
>  6. Prefix all MODULE_PARAM params with qedi_*.
>  7. Use CONFIG_QED_ISCSI instead of CONFIG_QEDI
>  8. Added bad task mem access fix.
>
>Manish Rangankar (1):
>  qedi: Add QLogic FastLinQ offload iSCSI driver framework.
>
>Yuval Mintz (2):
>  qed: Add support for hardware offloaded iSCSI.
>  qed: Add iSCSI out of order packet handling.
>
> MAINTAINERS|6 +
> drivers/net/ethernet/qlogic/Kconfig|3 +
> drivers/net/ethernet/qlogic/qed/Makefile   |1 +
> drivers/net/ethernet/qlogic/qed/qed.h  |8 +-
> drivers/net/ethernet/qlogic/qed/qed_dev.c  |   22 +
> drivers/net/ethernet/qlogic/qed/qed_iscsi.c| 1277 +
> drivers/net/ethernet/qlogic/qed/qed_iscsi.h|   52 +
> drivers/net/ethernet/qlogic/qed/qed_ll2.c  |  555 +-
> drivers/net/ethernet/qlogic/qed/qed_ll2.h  |9 +
> drivers/net/ethernet/qlogic/qed/qed_ooo.c  |  501 +
> drivers/net/ethernet/qlogic/qed/qed_ooo.h  |  176 ++
> drivers/net/ethernet/qlogic/qed/qed_reg_addr.h |2 +
> drivers/net/ethernet/qlogic/qed/qed_roce.c |1 +
> drivers/net/ethernet/qlogic/qed/qed_spq.c  |   24 +
> drivers/scsi/Kconfig   |1 +
> drivers/scsi/Makefile  |1 +
> drivers/scsi/qedi/Kconfig  |   10 +
> drivers/scsi/qedi/Makefile |5 +
> drivers/scsi/qedi/qedi.h   |  364 
> drivers/scsi/qedi/qedi_dbg.c   |  143 ++
> drivers/scsi/qedi/qedi_dbg.h   |  144 ++
> drivers/scsi/qedi/qedi_debugfs.c   |  244 +++
> drivers/scsi/qedi/qedi_fw.c| 2378
>
> drivers/scsi/qedi/qedi_gbl.h   |   73 +
> drivers/scsi/qedi/qedi_hsi.h   |   52 +
> drivers/scsi/qedi/qedi_iscsi.c | 1624 
> drivers/scsi/qedi/qedi_iscsi.h |  232 +++
> drivers/scsi/qedi/qedi_main.c  | 2127
>+
> drivers/scsi/qedi/qedi_sysfs.c |   52 +
> drivers/scsi/qedi/qedi_version.h   |   14 +
> include/linux/qed/qed_if.h |2 +
> include/linux/qed/qed_iscsi_if.h   |  229 +++
> 32 files changed, 10303 insertions(+), 29 deletions(-)
> create mode 100644 drivers/net/ethernet/qlogic/qed/qed_iscsi.c
> create mode 100644 drivers/net/ethernet/qlogic/qed/qed_iscsi.h
> create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ooo.c
> create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ooo.h
> create mode 100644 drivers/scsi/qedi/Kconfig
> create mode 100644 drivers/scsi/qedi/Makefile
> create mode 100644 drivers/scsi/qedi/qedi.h
> create mode 100644 drivers/scsi/qedi/qedi_dbg.c
> create mode 100644 drivers/scsi/qedi/qedi_dbg.h
> create mode 100644 drivers/scsi/qedi/qedi_debugfs.c
> create mode 100644 drivers/scsi/qedi/qedi_fw.c
> create mode 100644 drivers/scsi/qedi/qedi_gbl.h
> create mode 100644 drivers/scsi/qedi/qedi_hsi.h
> create mode 100644 drivers/scsi/qedi/qedi_iscsi.c
> create mode 100644 drivers/scsi/qedi/qedi_iscsi.h
> create mode 100644 drivers/scsi/qedi/qedi_main.c
> create mode 100644 drivers/scsi/qedi/qedi_sysfs.c
> create mode 100644 drivers/scsi/qedi/qedi_version.h
> create mode 100644 include/linux/qed/qed_iscsi_if.h
>
>-- 
>1.8.3.1
>

--
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 v2] xen/scsifront: don't request a slot on the ring until request is ready

2016-12-01 Thread Juergen Gross
Instead of requesting a new slot on the ring to the backend early, do
so only after all has been setup for the request to be sent. This
makes error handling easier as we don't need to undo the request id
allocation and ring slot allocation.

Suggested-by: Jan Beulich 
Signed-off-by: Juergen Gross 
---
Aargh! Need more coffee! Resend with corrected mail address for Martin Petersen
---
 drivers/scsi/xen-scsifront.c | 190 +++
 1 file changed, 84 insertions(+), 106 deletions(-)

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index c01316c..9aa1fe1 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -79,10 +79,13 @@
 struct vscsifrnt_shadow {
/* command between backend and frontend */
unsigned char act;
+   uint8_t nr_segments;
uint16_t rqid;
+   uint16_t ref_rqid;
 
unsigned int nr_grants; /* number of grants in gref[] */
struct scsiif_request_segment *sg;  /* scatter/gather elements */
+   struct scsiif_request_segment seg[VSCSIIF_SG_TABLESIZE];
 
/* Do reset or abort function. */
wait_queue_head_t wq_reset; /* reset work queue   */
@@ -172,68 +175,90 @@ static void scsifront_put_rqid(struct vscsifrnt_info 
*info, uint32_t id)
scsifront_wake_up(info);
 }
 
-static struct vscsiif_request *scsifront_pre_req(struct vscsifrnt_info *info)
+static int scsifront_do_request(struct vscsifrnt_info *info,
+   struct vscsifrnt_shadow *shadow)
 {
struct vscsiif_front_ring *ring = &(info->ring);
struct vscsiif_request *ring_req;
+   struct scsi_cmnd *sc = shadow->sc;
uint32_t id;
+   int i, notify;
+
+   if (RING_FULL(>ring))
+   return -EBUSY;
 
id = scsifront_get_rqid(info);  /* use id in response */
if (id >= VSCSIIF_MAX_REQS)
-   return NULL;
+   return -EBUSY;
+
+   info->shadow[id] = shadow;
+   shadow->rqid = id;
 
ring_req = RING_GET_REQUEST(&(info->ring), ring->req_prod_pvt);
-
ring->req_prod_pvt++;
 
-   ring_req->rqid = (uint16_t)id;
+   ring_req->rqid= id;
+   ring_req->act = shadow->act;
+   ring_req->ref_rqid= shadow->ref_rqid;
+   ring_req->nr_segments = shadow->nr_segments;
 
-   return ring_req;
-}
+   ring_req->id  = sc->device->id;
+   ring_req->lun = sc->device->lun;
+   ring_req->channel = sc->device->channel;
+   ring_req->cmd_len = sc->cmd_len;
 
-static void scsifront_do_request(struct vscsifrnt_info *info)
-{
-   struct vscsiif_front_ring *ring = &(info->ring);
-   int notify;
+   BUG_ON(sc->cmd_len > VSCSIIF_MAX_COMMAND_SIZE);
+
+   memcpy(ring_req->cmnd, sc->cmnd, sc->cmd_len);
+
+   ring_req->sc_data_direction   = (uint8_t)sc->sc_data_direction;
+   ring_req->timeout_per_command = sc->request->timeout / HZ;
+
+   for (i = 0; i < (shadow->nr_segments & ~VSCSIIF_SG_GRANT); i++)
+   ring_req->seg[i] = shadow->seg[i];
 
RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(ring, notify);
if (notify)
notify_remote_via_irq(info->irq);
+
+   return 0;
 }
 
-static void scsifront_gnttab_done(struct vscsifrnt_info *info, uint32_t id)
+static void scsifront_gnttab_done(struct vscsifrnt_info *info,
+ struct vscsifrnt_shadow *shadow)
 {
-   struct vscsifrnt_shadow *s = info->shadow[id];
int i;
 
-   if (s->sc->sc_data_direction == DMA_NONE)
+   if (shadow->sc->sc_data_direction == DMA_NONE)
return;
 
-   for (i = 0; i < s->nr_grants; i++) {
-   if (unlikely(gnttab_query_foreign_access(s->gref[i]) != 0)) {
+   for (i = 0; i < shadow->nr_grants; i++) {
+   if (unlikely(gnttab_query_foreign_access(shadow->gref[i]))) {
shost_printk(KERN_ALERT, info->host, KBUILD_MODNAME
 "grant still in use by backend\n");
BUG();
}
-   gnttab_end_foreign_access(s->gref[i], 0, 0UL);
+   gnttab_end_foreign_access(shadow->gref[i], 0, 0UL);
}
 
-   kfree(s->sg);
+   kfree(shadow->sg);
 }
 
 static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info,
   struct vscsiif_response *ring_rsp)
 {
+   struct vscsifrnt_shadow *shadow;
struct scsi_cmnd *sc;
uint32_t id;
uint8_t sense_len;
 
id = ring_rsp->rqid;
-   sc = info->shadow[id]->sc;
+   shadow = info->shadow[id];
+   sc = shadow->sc;
 
BUG_ON(sc == NULL);
 
-   scsifront_gnttab_done(info, id);
+   scsifront_gnttab_done(info, shadow);
scsifront_put_rqid(info, id);
 
sc->result = ring_rsp->rslt;
@@ -366,7 +391,6 @@ static void 

[PATCH v2] xen/scsifront: don't request a slot on the ring until request is ready

2016-12-01 Thread Juergen Gross
Instead of requesting a new slot on the ring to the backend early, do
so only after all has been setup for the request to be sent. This
makes error handling easier as we don't need to undo the request id
allocation and ring slot allocation.

Suggested-by: Jan Beulich 
Signed-off-by: Juergen Gross 
---
Resend with corrected mail address for Martin Peter
---
 drivers/scsi/xen-scsifront.c | 190 +++
 1 file changed, 84 insertions(+), 106 deletions(-)

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index c01316c..9aa1fe1 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -79,10 +79,13 @@
 struct vscsifrnt_shadow {
/* command between backend and frontend */
unsigned char act;
+   uint8_t nr_segments;
uint16_t rqid;
+   uint16_t ref_rqid;
 
unsigned int nr_grants; /* number of grants in gref[] */
struct scsiif_request_segment *sg;  /* scatter/gather elements */
+   struct scsiif_request_segment seg[VSCSIIF_SG_TABLESIZE];
 
/* Do reset or abort function. */
wait_queue_head_t wq_reset; /* reset work queue   */
@@ -172,68 +175,90 @@ static void scsifront_put_rqid(struct vscsifrnt_info 
*info, uint32_t id)
scsifront_wake_up(info);
 }
 
-static struct vscsiif_request *scsifront_pre_req(struct vscsifrnt_info *info)
+static int scsifront_do_request(struct vscsifrnt_info *info,
+   struct vscsifrnt_shadow *shadow)
 {
struct vscsiif_front_ring *ring = &(info->ring);
struct vscsiif_request *ring_req;
+   struct scsi_cmnd *sc = shadow->sc;
uint32_t id;
+   int i, notify;
+
+   if (RING_FULL(>ring))
+   return -EBUSY;
 
id = scsifront_get_rqid(info);  /* use id in response */
if (id >= VSCSIIF_MAX_REQS)
-   return NULL;
+   return -EBUSY;
+
+   info->shadow[id] = shadow;
+   shadow->rqid = id;
 
ring_req = RING_GET_REQUEST(&(info->ring), ring->req_prod_pvt);
-
ring->req_prod_pvt++;
 
-   ring_req->rqid = (uint16_t)id;
+   ring_req->rqid= id;
+   ring_req->act = shadow->act;
+   ring_req->ref_rqid= shadow->ref_rqid;
+   ring_req->nr_segments = shadow->nr_segments;
 
-   return ring_req;
-}
+   ring_req->id  = sc->device->id;
+   ring_req->lun = sc->device->lun;
+   ring_req->channel = sc->device->channel;
+   ring_req->cmd_len = sc->cmd_len;
 
-static void scsifront_do_request(struct vscsifrnt_info *info)
-{
-   struct vscsiif_front_ring *ring = &(info->ring);
-   int notify;
+   BUG_ON(sc->cmd_len > VSCSIIF_MAX_COMMAND_SIZE);
+
+   memcpy(ring_req->cmnd, sc->cmnd, sc->cmd_len);
+
+   ring_req->sc_data_direction   = (uint8_t)sc->sc_data_direction;
+   ring_req->timeout_per_command = sc->request->timeout / HZ;
+
+   for (i = 0; i < (shadow->nr_segments & ~VSCSIIF_SG_GRANT); i++)
+   ring_req->seg[i] = shadow->seg[i];
 
RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(ring, notify);
if (notify)
notify_remote_via_irq(info->irq);
+
+   return 0;
 }
 
-static void scsifront_gnttab_done(struct vscsifrnt_info *info, uint32_t id)
+static void scsifront_gnttab_done(struct vscsifrnt_info *info,
+ struct vscsifrnt_shadow *shadow)
 {
-   struct vscsifrnt_shadow *s = info->shadow[id];
int i;
 
-   if (s->sc->sc_data_direction == DMA_NONE)
+   if (shadow->sc->sc_data_direction == DMA_NONE)
return;
 
-   for (i = 0; i < s->nr_grants; i++) {
-   if (unlikely(gnttab_query_foreign_access(s->gref[i]) != 0)) {
+   for (i = 0; i < shadow->nr_grants; i++) {
+   if (unlikely(gnttab_query_foreign_access(shadow->gref[i]))) {
shost_printk(KERN_ALERT, info->host, KBUILD_MODNAME
 "grant still in use by backend\n");
BUG();
}
-   gnttab_end_foreign_access(s->gref[i], 0, 0UL);
+   gnttab_end_foreign_access(shadow->gref[i], 0, 0UL);
}
 
-   kfree(s->sg);
+   kfree(shadow->sg);
 }
 
 static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info,
   struct vscsiif_response *ring_rsp)
 {
+   struct vscsifrnt_shadow *shadow;
struct scsi_cmnd *sc;
uint32_t id;
uint8_t sense_len;
 
id = ring_rsp->rqid;
-   sc = info->shadow[id]->sc;
+   shadow = info->shadow[id];
+   sc = shadow->sc;
 
BUG_ON(sc == NULL);
 
-   scsifront_gnttab_done(info, id);
+   scsifront_gnttab_done(info, shadow);
scsifront_put_rqid(info, id);
 
sc->result = ring_rsp->rslt;
@@ -366,7 +391,6 @@ static void scsifront_finish_all(struct 

[PATCH v2] xen/scsifront: don't request a slot on the ring until request is ready

2016-12-01 Thread Juergen Gross
Instead of requesting a new slot on the ring to the backend early, do
so only after all has been setup for the request to be sent. This
makes error handling easier as we don't need to undo the request id
allocation and ring slot allocation.

Suggested-by: Jan Beulich 
Signed-off-by: Juergen Gross 
---
 drivers/scsi/xen-scsifront.c | 190 +++
 1 file changed, 84 insertions(+), 106 deletions(-)

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index c01316c..9aa1fe1 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -79,10 +79,13 @@
 struct vscsifrnt_shadow {
/* command between backend and frontend */
unsigned char act;
+   uint8_t nr_segments;
uint16_t rqid;
+   uint16_t ref_rqid;
 
unsigned int nr_grants; /* number of grants in gref[] */
struct scsiif_request_segment *sg;  /* scatter/gather elements */
+   struct scsiif_request_segment seg[VSCSIIF_SG_TABLESIZE];
 
/* Do reset or abort function. */
wait_queue_head_t wq_reset; /* reset work queue   */
@@ -172,68 +175,90 @@ static void scsifront_put_rqid(struct vscsifrnt_info 
*info, uint32_t id)
scsifront_wake_up(info);
 }
 
-static struct vscsiif_request *scsifront_pre_req(struct vscsifrnt_info *info)
+static int scsifront_do_request(struct vscsifrnt_info *info,
+   struct vscsifrnt_shadow *shadow)
 {
struct vscsiif_front_ring *ring = &(info->ring);
struct vscsiif_request *ring_req;
+   struct scsi_cmnd *sc = shadow->sc;
uint32_t id;
+   int i, notify;
+
+   if (RING_FULL(>ring))
+   return -EBUSY;
 
id = scsifront_get_rqid(info);  /* use id in response */
if (id >= VSCSIIF_MAX_REQS)
-   return NULL;
+   return -EBUSY;
+
+   info->shadow[id] = shadow;
+   shadow->rqid = id;
 
ring_req = RING_GET_REQUEST(&(info->ring), ring->req_prod_pvt);
-
ring->req_prod_pvt++;
 
-   ring_req->rqid = (uint16_t)id;
+   ring_req->rqid= id;
+   ring_req->act = shadow->act;
+   ring_req->ref_rqid= shadow->ref_rqid;
+   ring_req->nr_segments = shadow->nr_segments;
 
-   return ring_req;
-}
+   ring_req->id  = sc->device->id;
+   ring_req->lun = sc->device->lun;
+   ring_req->channel = sc->device->channel;
+   ring_req->cmd_len = sc->cmd_len;
 
-static void scsifront_do_request(struct vscsifrnt_info *info)
-{
-   struct vscsiif_front_ring *ring = &(info->ring);
-   int notify;
+   BUG_ON(sc->cmd_len > VSCSIIF_MAX_COMMAND_SIZE);
+
+   memcpy(ring_req->cmnd, sc->cmnd, sc->cmd_len);
+
+   ring_req->sc_data_direction   = (uint8_t)sc->sc_data_direction;
+   ring_req->timeout_per_command = sc->request->timeout / HZ;
+
+   for (i = 0; i < (shadow->nr_segments & ~VSCSIIF_SG_GRANT); i++)
+   ring_req->seg[i] = shadow->seg[i];
 
RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(ring, notify);
if (notify)
notify_remote_via_irq(info->irq);
+
+   return 0;
 }
 
-static void scsifront_gnttab_done(struct vscsifrnt_info *info, uint32_t id)
+static void scsifront_gnttab_done(struct vscsifrnt_info *info,
+ struct vscsifrnt_shadow *shadow)
 {
-   struct vscsifrnt_shadow *s = info->shadow[id];
int i;
 
-   if (s->sc->sc_data_direction == DMA_NONE)
+   if (shadow->sc->sc_data_direction == DMA_NONE)
return;
 
-   for (i = 0; i < s->nr_grants; i++) {
-   if (unlikely(gnttab_query_foreign_access(s->gref[i]) != 0)) {
+   for (i = 0; i < shadow->nr_grants; i++) {
+   if (unlikely(gnttab_query_foreign_access(shadow->gref[i]))) {
shost_printk(KERN_ALERT, info->host, KBUILD_MODNAME
 "grant still in use by backend\n");
BUG();
}
-   gnttab_end_foreign_access(s->gref[i], 0, 0UL);
+   gnttab_end_foreign_access(shadow->gref[i], 0, 0UL);
}
 
-   kfree(s->sg);
+   kfree(shadow->sg);
 }
 
 static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info,
   struct vscsiif_response *ring_rsp)
 {
+   struct vscsifrnt_shadow *shadow;
struct scsi_cmnd *sc;
uint32_t id;
uint8_t sense_len;
 
id = ring_rsp->rqid;
-   sc = info->shadow[id]->sc;
+   shadow = info->shadow[id];
+   sc = shadow->sc;
 
BUG_ON(sc == NULL);
 
-   scsifront_gnttab_done(info, id);
+   scsifront_gnttab_done(info, shadow);
scsifront_put_rqid(info, id);
 
sc->result = ring_rsp->rslt;
@@ -366,7 +391,6 @@ static void scsifront_finish_all(struct vscsifrnt_info 
*info)
 
 static int map_data_for_request(struct 

Re: [PATCH] scsi_dh_alua: Add return value and check for alua_rtpg_queue() to avoid DM devices I/Os hang

2016-12-01 Thread Bart Van Assche
On 12/01/16 19:21, tang.jun...@zte.com.cn wrote:
> Hello Bart,
>> * Even if queue_delayed_work() returns 0 the qdata work passed to
>> alua_rtpg_queue() is still added to the pg->rtpg_list and hence will be
>> executed once the delayed work is executed. So I think that the
>> condition you described (fn() not called) cannot happen.
>
> I find it by reading code.
>
> How did you think that it will be
> executed once the delayed work is executed?
> It is not re-queued to the pg->rtpg_work again.
> It is triggered by pgpath->activate_path.work in dm-mod,
> and maybe it would never run anymore.

Hello Tang,

Are you aware that if queue_delayed_work() returns 0 that that means 
that a work item has already been queued (pg->rtpg_work in this case)? 
 From kernel/workqueue.c:

/**
  * queue_delayed_work_on - queue work on specific CPU after delay
  * @cpu: CPU number to execute work on
  * @wq: workqueue to use
  * @dwork: work to queue
  * @delay: number of jiffies to wait before queueing
  *
  * Return: %false if @work was already on a queue, %true otherwise.  If
  * @delay is zero and @dwork is idle, it will be scheduled for immediate
  * execution.
  */

Bart.

--
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_dh_alua: Add return value and check for alua_rtpg_queue() to avoid DM devices I/Os hang

2016-12-01 Thread Bart Van Assche
On 12/01/16 17:49, tang.jun...@zte.com.cn wrote:
>> Bart wrote:
>> Please drop this patch. I think the alua_rtpg_queue() caller should
>> ensure that pg != NULL.
>
> Failure may also be occurred in queue_delayed_work(),
> since it would cause serious problems,
> so I think we are worth checking for it.

Hello Tang,

Have you been able to trigger the condition explained in the patch 
description or is this only something you think that can happen based on 
your interpretation of the source code? My comments about the checks 
that have been added are:
* All alua_rtpg_queue() callers pass a non-NULL pointer as first 
argument which means that the return statement under "if (!pg)" in 
alua_rtpg_queue() is never executed.
* Even if queue_delayed_work() returns 0 the qdata work passed to 
alua_rtpg_queue() is still added to the pg->rtpg_list and hence will be 
executed once the delayed work is executed. So I think that the 
condition you described (fn() not called) cannot happen. From 
alua_rtpg_work():

list_splice_init(>rtpg_list, _list);
 [ ... ]
list_for_each_entry_safe(qdata, tmp, _list, entry) {
list_del(>entry);
if (qdata->callback_fn)
qdata->callback_fn(qdata->callback_data, err);
kfree(qdata);
}

Bart.

--
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 0/2] hpsa: fix rmmod issues

2016-12-01 Thread Don Brace
> -Original Message-
> From: Martin Wilck [mailto:mwi...@suse.de]
> Sent: Monday, November 21, 2016 8:04 AM
> To: Don Brace
> Cc: dl-esc-Team ESD Storage Dev Support; iss_storage...@hp.com; linux-
> s...@vger.kernel.org; jbottom...@odin.com; h...@lst.de; h...@suse.de;
> Martin Wilck
> Subject: [PATCH 0/2] hpsa: fix rmmod issues
> 
> EXTERNAL EMAIL
> 
> 
> This patch set fixes two issues I encountered when removing the
> hpsa modules with rmmod.
> 
> Comments and reviews are welcome.
> 
> Martin Wilck (2):
>   hpsa: cleanup sas_phy structures in sysfs when unloading
>   hpsa: destroy sas transport properties before scsi_host
> 
>  drivers/scsi/hpsa.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --
> 2.10.1

I have both patches applied and I still get stack traces.



[252338.604903] [ cut here ]
[252338.627899] WARNING: CPU: 69 PID: 23977 at fs/sysfs/group.c:237 
sysfs_remove_group+0x8e/0x90
[252338.668726] sysfs group 'power' not found for kobject '5:0:0:0'
[252338.697526] Modules linked in: hpsa(OE-) scsi_transport_sas(OE) 
ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 
ipt_REJECT nf_reject_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack 
nf_conntrack cfg80211 rfkill ebtable_nat ebtable_broute bridge stp llc 
ebtable_filter ebtables ip6table_mangle ip6table_security ip6table_raw 
ip6table_filter ip6_tables iptable_mangle iptable_security iptable_raw 
iptable_filter ip_tables osst ch st sb_edac edac_core x86_pkg_temp_thermal 
coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel lrw 
iTCO_wdt gf128mul glue_helper iTCO_vendor_support ablk_helper cryptd pcspkr 
ioatdma lpc_ich hpwdt hpilo mfd_core dca ipmi_si wmi ipmi_msghandler 
pcc_cpufreq acpi_cpufreq acpi_power_meter uinput mgag200 i2c_algo_bit 
drm_kms_helper syscopyarea
[252339.038528]  sysfillrect sysimgblt fb_sys_fops ttm drm crc32c_intel 
serio_raw tg3 ptp usb_storage i2c_core pps_core dm_mirror dm_region_hash dm_log 
dm_mod [last unloaded: scsi_transport_sas]
[252339.113923] CPU: 69 PID: 23977 Comm: rmmod Tainted: GW  OE   
4.9.0-rc71+ #24
[252339.151296] Hardware name: HP ProLiant DL580 Gen8, BIOS P79 08/18/2016
[252339.183354]  c9000ff1bbf0 815909bd c9000ff1bc40 

[252339.219046]  c9000ff1bc30 81090901 00ed0246 

[252339.255044]  81f71560 88204584dd38 882051e93670 
00ae1090
[252339.290927] Call Trace:
[252339.303968]  [] dump_stack+0x85/0xc8
[252339.329624]  [] __warn+0xd1/0xf0
[252339.354037]  [] warn_slowpath_fmt+0x5f/0x80
[252339.382084]  [] ? mutex_unlock+0xe/0x10
[252339.408515]  [] ? kernfs_find_and_get_ns+0x4a/0x60
[252339.439571]  [] sysfs_remove_group+0x8e/0x90
[252339.468069]  [] dpm_sysfs_remove+0x57/0x60
[252339.495701]  [] device_del+0x58/0x270
[252339.521474]  [] device_unregister+0x1a/0x60
[252339.549796]  [] bsg_unregister_queue+0x60/0xa0
[252339.578999]  [] __scsi_remove_device+0xaa/0xd0
[252339.608230]  [] scsi_forget_host+0x69/0x70
[252339.635723]  [] scsi_remove_host+0x82/0x130
[252339.663738]  [] hpsa_remove_one+0x93/0x190 [hpsa]
[252339.694960]  [] pci_device_remove+0x39/0xc0
[252339.723128]  [] __device_release_driver+0x9a/0x150
[252339.753539]  [] driver_detach+0xc1/0xd0
[252339.779784]  [] bus_remove_driver+0x58/0xd0
[252339.807519]  [] driver_unregister+0x2c/0x50
[252339.835948]  [] pci_unregister_driver+0x2a/0x80
[252339.865660]  [] hpsa_cleanup+0x10/0x7a7 [hpsa]
[252339.894682]  [] SyS_delete_module+0x1bc/0x220
[252339.924020]  [] do_syscall_64+0x6c/0x200
[252339.950862]  [] entry_SYSCALL64_slow_path+0x25/0x25
[252339.982292] ---[ end trace 03cf2c42f2f658e5 ]---
--
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 27/39] Annotate hardware config module parameters in drivers/scsi/

2016-12-01 Thread Finn Thain

On Thu, 1 Dec 2016, David Howells wrote:

> When the kernel is running in secure boot mode, we lock down the kernel 
> to prevent userspace from modifying the running kernel image.  Whilst 
> this includes prohibiting access to things like /dev/mem, it must also 
> prevent access by means of configuring driver modules in such a way as 
> to cause a device to access or modify the kernel image.
> 

I can see how base addresses and IO ports are relevant, but the irq 
parameter changes below don't protect the kernel image AFAICT. What's the 
rationale for those changes? I think it should be stated here.

> To this end, annotate module_param* statements that refer to hardware 
> configuration and indicate for future reference what type of parameter 
> they specify.  The parameter parser in the core sees this information 
> and can skip such parameters with an error message if the kernel is 
> locked down. The module initialisation then runs as normal, but just 
> sees whatever the default values for those parameters is.
> 
> Note that we do still need to do the module initialisation because some 
> drivers have viable defaults set in case parameters aren't specified and 
> some drivers support automatic configuration (e.g. PNP or PCI) in 
> addition to manually coded parameters.
> 
> This patch annotates drivers in drivers/scsi/.
> 
> Suggested-by: One Thousand Gnomes 
> Signed-off-by: David Howells 
> cc: "Juergen E. Fischer" 
> cc: "James E.J. Bottomley" 
> cc: "Martin K. Petersen" 
> cc: Dario Ballabio 
> cc: Finn Thain 
> cc: Michael Schmitz 
> cc: Achim Leubner 
> cc: linux-scsi@vger.kernel.org
> ---
> 
>  drivers/scsi/aha152x.c   |4 ++--
>  drivers/scsi/aha1542.c   |2 +-
>  drivers/scsi/g_NCR5380.c |8 
>  drivers/scsi/gdth.c  |2 +-
>  drivers/scsi/qlogicfas.c |4 ++--
>  5 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
> index f44d0487236e..ce5dc73d85bb 100644
> --- a/drivers/scsi/aha152x.c
> +++ b/drivers/scsi/aha152x.c
> @@ -331,11 +331,11 @@ MODULE_LICENSE("GPL");
>  #if !defined(PCMCIA)
>  #if defined(MODULE)
>  static int io[] = {0, 0};
> -module_param_array(io, int, NULL, 0);
> +module_param_hw_array(io, int, ioport, NULL, 0);
>  MODULE_PARM_DESC(io,"base io address of controller");
>  
>  static int irq[] = {0, 0};
> -module_param_array(irq, int, NULL, 0);
> +module_param_hw_array(irq, int, irq, NULL, 0);
>  MODULE_PARM_DESC(irq,"interrupt for controller");
>  
>  static int scsiid[] = {7, 7};
> diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
> index 7db448ec8beb..a23cc9ac5acd 100644
> --- a/drivers/scsi/aha1542.c
> +++ b/drivers/scsi/aha1542.c
> @@ -31,7 +31,7 @@ module_param(isapnp, bool, 0);
>  MODULE_PARM_DESC(isapnp, "enable PnP support (default=1)");
>  
>  static int io[MAXBOARDS] = { 0x330, 0x334, 0, 0 };
> -module_param_array(io, int, NULL, 0);
> +module_param_hw_array(io, int, ioport, NULL, 0);
>  MODULE_PARM_DESC(io, "base IO address of controller 
> (0x130,0x134,0x230,0x234,0x330,0x334, default=0x330,0x334)");
>  
>  /* time AHA spends on the AT-bus during data transfer */
> diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
> index cbf010324c18..cf4fa7a2e738 100644
> --- a/drivers/scsi/g_NCR5380.c
> +++ b/drivers/scsi/g_NCR5380.c
> @@ -44,8 +44,8 @@ static int ncr_53c400;
>  static int ncr_53c400a;
>  static int dtc_3181e;
>  static int hp_c2502;
> -module_param(ncr_irq, int, 0);
> -module_param(ncr_addr, int, 0);
> +module_param_hw(ncr_irq, int, irq, 0);
> +module_param_hw(ncr_addr, int, ioport, 0);
>  module_param(ncr_5380, int, 0);
>  module_param(ncr_53c400, int, 0);
>  module_param(ncr_53c400a, int, 0);
> @@ -53,11 +53,11 @@ module_param(dtc_3181e, int, 0);
>  module_param(hp_c2502, int, 0);
>  
>  static int irq[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
> -module_param_array(irq, int, NULL, 0);
> +module_param_hw_array(irq, int, irq, NULL, 0);
>  MODULE_PARM_DESC(irq, "IRQ number(s)");
>  
>  static int base[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
> -module_param_array(base, int, NULL, 0);
> +module_param_hw_array(base, int, ioport, NULL, 0);
>  MODULE_PARM_DESC(base, "base address(es)");
>  
>  static int card[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
> diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
> index 0a767740bf02..4ec08fb2dfa8 100644
> --- a/drivers/scsi/gdth.c
> +++ b/drivers/scsi/gdth.c
> @@ -353,7 +353,7 @@ static int probe_eisa_isa = 0;
>  static int force_dma32 = 0;
>  
>  /* parameters for modprobe/insmod */
> -module_param_array(irq, int, NULL, 0);
> +module_param_hw_array(irq, int, irq, NULL, 0);
>  module_param(disable, int, 0);
>  module_param(reserve_mode, int, 0);
>  module_param_array(reserve_list, int, NULL, 0);
> diff --git 

RE: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS command

2016-12-01 Thread Don Brace

> -Original Message-
> From: Hannes Reinecke [mailto:h...@suse.de]
> Sent: Friday, November 18, 2016 1:33 AM
> To: Martin K. Petersen
> Cc: Christoph Hellwig; James Bottomley; Don Brace; Martin Wilck; linux-
> s...@vger.kernel.org; Hannes Reinecke; Hannes Reinecke
> Subject: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS command
> 
> EXTERNAL EMAIL
> 
> 
> Older SmartArray controller do not support the extended REPORT PHYS
> command, so fallback to use the legacy version here.
> 
> Signed-off-by: Hannes Reinecke 
> ---
>  drivers/scsi/hpsa.c | 28 ++--
>  1 file changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 488e17c..3d89f74 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -3628,8 +3628,32 @@ static int hpsa_scsi_do_report_luns(struct
> ctlr_info *h, int logical,
>  static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h,
> struct ReportExtendedLUNdata *buf, int bufsize)
>  {
> -   return hpsa_scsi_do_report_luns(h, 0, buf, bufsize,
> -   HPSA_REPORT_PHYS_EXTENDED);
> +   int rc;
> +   struct ReportLUNdata *lbuf;
> +
> +   rc = hpsa_scsi_do_report_luns(h, 0, buf, bufsize,
> + HPSA_REPORT_PHYS_EXTENDED);
> +   if (!rc || !hpsa_allow_any)
> +   return rc;
> +
> +   /* REPORT PHYS EXTENDED is not supported */
> +   lbuf = kzalloc(sizeof(*lbuf), GFP_KERNEL);
> +   if (!lbuf)
> +   return -ENOMEM;
> +
> +   rc = hpsa_scsi_do_report_luns(h, 0, lbuf, sizeof(*lbuf), 0);
> +   if (!rc) {
> +   int i;
> +   u32 nphys;
> +
> +   /* Copy ReportLUNdata header */
> +   memcpy(buf, lbuf, 8);
> +   nphys = be32_to_cpu(*((__be32 *)lbuf->LUNListLength)) / 24;
> +   for (i = 0; i < nphys; i++)
> +   memcpy(buf->LUN[i].lunid, lbuf->LUN[i], 8);
> +   }
> +   kfree(lbuf);
> +   return rc;
>  }
> 
>  static inline int hpsa_scsi_do_report_log_luns(struct ctlr_info *h,
> --
> 1.8.5.6

For a non-extended REPORT_PHYS, the buffer size is 8, so the divisor needs to 
be 8.
REPORT_PHYS_EXTENDED has been around a long time, which controller and fw are 
you testing this on so I can
Also run some tests.

Thanks,
Don Brace
ESC - Smart Storage
Microsemi Corporation




--
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] scsi_dh_alua: Fix RCU annotations

2016-12-01 Thread Bart Van Assche
This patch avoids that sparse complains about RCU pointer dereferences.

Signed-off-by: Bart Van Assche 
Cc: Hannes Reinecke 
Cc: tang.junhui 
Cc: 
---
 drivers/scsi/device_handler/scsi_dh_alua.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c 
b/drivers/scsi/device_handler/scsi_dh_alua.c
index 7bb2068..815e648 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -95,7 +95,7 @@ struct alua_port_group {
 
 struct alua_dh_data {
struct list_headnode;
-   struct alua_port_group  *pg;
+   struct alua_port_group __rcu *pg;
int group_id;
spinlock_t  pg_lock;
struct scsi_device  *sdev;
@@ -369,7 +369,7 @@ static int alua_check_vpd(struct scsi_device *sdev, struct 
alua_dh_data *h,
 
/* Check for existing port group references */
spin_lock(>pg_lock);
-   old_pg = h->pg;
+   old_pg = rcu_dereference_protected(h->pg, lockdep_is_held(>pg_lock));
if (old_pg != pg) {
/* port group has changed. Update to new port group */
if (h->pg) {
@@ -388,7 +388,9 @@ static int alua_check_vpd(struct scsi_device *sdev, struct 
alua_dh_data *h,
list_add_rcu(>node, >dh_list);
spin_unlock_irqrestore(>lock, flags);
 
-   alua_rtpg_queue(h->pg, sdev, NULL, true);
+   alua_rtpg_queue(rcu_dereference_protected(h->pg,
+ lockdep_is_held(>pg_lock)),
+   sdev, NULL, true);
spin_unlock(>pg_lock);
 
if (old_pg)
@@ -940,7 +942,7 @@ static int alua_initialize(struct scsi_device *sdev, struct 
alua_dh_data *h)
 static int alua_set_params(struct scsi_device *sdev, const char *params)
 {
struct alua_dh_data *h = sdev->handler_data;
-   struct alua_port_group __rcu *pg = NULL;
+   struct alua_port_group *pg = NULL;
unsigned int optimize = 0, argc;
const char *p = params;
int result = SCSI_DH_OK;
@@ -987,7 +989,7 @@ static int alua_activate(struct scsi_device *sdev,
struct alua_dh_data *h = sdev->handler_data;
int err = SCSI_DH_OK;
struct alua_queue_data *qdata;
-   struct alua_port_group __rcu *pg;
+   struct alua_port_group *pg;
 
qdata = kzalloc(sizeof(*qdata), GFP_KERNEL);
if (!qdata) {
@@ -1051,7 +1053,7 @@ static void alua_check(struct scsi_device *sdev, bool 
force)
 static int alua_prep_fn(struct scsi_device *sdev, struct request *req)
 {
struct alua_dh_data *h = sdev->handler_data;
-   struct alua_port_group __rcu *pg;
+   struct alua_port_group *pg;
unsigned char state = SCSI_ACCESS_STATE_OPTIMAL;
int ret = BLKPREP_OK;
 
@@ -1121,7 +1123,7 @@ static void alua_bus_detach(struct scsi_device *sdev)
struct alua_port_group *pg;
 
spin_lock(>pg_lock);
-   pg = h->pg;
+   pg = rcu_dereference_protected(h->pg, lockdep_is_held(>pg_lock));
rcu_assign_pointer(h->pg, NULL);
h->sdev = NULL;
spin_unlock(>pg_lock);
-- 
2.10.2

--
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 01/11] megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid Controllers

2016-12-01 Thread Linus Torvalds
These were all garbage,

Not only is the "From" name bogus ("root"), but they all got marked as
spam because you didn't use the right smtp server, and they don't have
the proper broadcom DKIM hashes.

Please fix your setup.

Linus

On Thu, Dec 1, 2016 at 11:10 AM, Sasikumar Chandrasekaran
 wrote:
> From: root 
>
> This patch contains new pci device ids for SAS3.5 Generic Megaraid Controllers
--
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/11] megaraid_sas: EEDP Escape Mode Support for SAS3.5 Generic Megaraid Controllers

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

An UNMAP command on a PI formatted device will leave the Logical Block 
Application
Tag and Logical Block Reference Tag as all F's (for those LBAs that are 
unmapped).
To avoid IO errors if those LBAs are subsequently read before they are written 
with
valid tag fields, the MPI SCSI IO requests need to set the EEDPFlags element 
EEDP
Escape Mode field, Bits [7:6] appropriately.  A value of 2 should be set to 
disable
all PI checks if the Logical Block Application Tag is 0x for PI types 1 and 
2.
A value of 3 should be set to disable all PI checks if the Logical Block 
Application
Tag is 0x and the Logical Block Reference Tag is 0x for PI type 3.

This patch is depending on patch 2

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 1 +
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 9de9e66..7f26b14 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1589,6 +1589,7 @@ static int megasas_create_sg_sense_fusion(struct 
megasas_instance *instance)
MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
MPI2_SCSIIO_EEDPFLAGS_CHECK_REMOVE_OP |
MPI2_SCSIIO_EEDPFLAGS_CHECK_APPTAG |
+   MPI25_SCSIIO_EEDPFLAGS_DO_NOT_DISABLE_MODE |
MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD);
} else {
io_request->EEDPFlags = cpu_to_le16(
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h 
b/drivers/scsi/megaraid/megaraid_sas_fusion.h
index e3bee04..9d22ade 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.h
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h
@@ -175,6 +175,8 @@ enum REGION_TYPE {
 #define MPI2_SCSIIO_EEDPFLAGS_CHECK_APPTAG  (0x0200)
 #define MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD   (0x0100)
 #define MPI2_SCSIIO_EEDPFLAGS_INSERT_OP (0x0004)
+/* EEDP escape mode */
+#define MPI25_SCSIIO_EEDPFLAGS_DO_NOT_DISABLE_MODE  (0x0040)
 #define MPI2_FUNCTION_SCSI_IO_REQUEST   (0x00) /* SCSI IO */
 #define MPI2_FUNCTION_SCSI_TASK_MGMT(0x01)
 #define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY   (0x03)
-- 
1.8.3.1

--
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 01/11] megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid Controllers

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

This patch contains new pci device ids for SAS3.5 Generic Megaraid Controllers

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas.h| 11 ++-
 drivers/scsi/megaraid/megaraid_sas_base.c   | 20 +++-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 29 ++---
 3 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index 0d2625b..f24ce88 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -56,6 +56,14 @@
 #define PCI_DEVICE_ID_LSI_INTRUDER_24  0x00cf
 #define PCI_DEVICE_ID_LSI_CUTLASS_52   0x0052
 #define PCI_DEVICE_ID_LSI_CUTLASS_53   0x0053
+#define PCI_DEVICE_ID_LSI_MECTOR   0x00D4
+#define PCI_DEVICE_ID_LSI_VENTURA  0x0014
+#define PCI_DEVICE_ID_LSI_CRUSADER 0x0015
+#define PCI_DEVICE_ID_LSI_HARPOON  0x0016
+#define PCI_DEVICE_ID_LSI_TOMCAT   0x0017
+#define PCI_DEVICE_ID_LSI_VENTURA_4PORT0x001B
+#define PCI_DEVICE_ID_LSI_CRUSADER_4PORT   0x001C
+#define PCI_DEVICE_ID_LSI_MARLIN   0x00D3
 
 /*
  * Intel HBA SSDIDs
@@ -1478,7 +1486,7 @@ struct megasas_register_set {
 
u32 inbound_high_queue_port ;   /*00C4h*/
 
-   u32 reserved_5; /*00C8h*/
+   u32 inbound_single_queue_port;  /*00C8h*/
u32 res_6[11];  /*CCh*/
u32 host_diag;
u32 seq_offset;
@@ -2143,6 +2151,7 @@ struct megasas_instance {
u8 is_rdpq;
bool dev_handle;
bool fw_sync_cache_support;
+   bool is_ventura;
 };
 struct MR_LD_VF_MAP {
u32 size;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 5462676..b7166b8 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -155,6 +155,15 @@ static int megasas_register_aen(struct megasas_instance 
*instance,
/* Intruder 24 port*/
{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CUTLASS_52)},
{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CUTLASS_53)},
+   /* VENTURA */
+   {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VENTURA)},
+   {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_MARLIN)},
+   {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_MECTOR)},
+   {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CRUSADER)},
+   {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_HARPOON)},
+   {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_TOMCAT)},
+   {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VENTURA_4PORT)},
+   {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CRUSADER_4PORT)},
{}
 };
 
@@ -5723,6 +5732,15 @@ static int megasas_probe_one(struct pci_dev *pdev,
instance->pdev = pdev;
 
switch (instance->pdev->device) {
+   case PCI_DEVICE_ID_LSI_VENTURA:
+   case PCI_DEVICE_ID_LSI_MARLIN:
+   case PCI_DEVICE_ID_LSI_MECTOR:
+   case PCI_DEVICE_ID_LSI_CRUSADER:
+   case PCI_DEVICE_ID_LSI_HARPOON:
+   case PCI_DEVICE_ID_LSI_TOMCAT:
+   case PCI_DEVICE_ID_LSI_VENTURA_4PORT:
+   case PCI_DEVICE_ID_LSI_CRUSADER_4PORT:
+instance->is_ventura = true;
case PCI_DEVICE_ID_LSI_FUSION:
case PCI_DEVICE_ID_LSI_PLASMA:
case PCI_DEVICE_ID_LSI_INVADER:
@@ -5747,7 +5765,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) ||
(instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA))
fusion->adapter_type = THUNDERBOLT_SERIES;
-   else
+   else if (!instance->is_ventura)
fusion->adapter_type = INVADER_SERIES;
}
break;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 24778ba..e048423 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -189,15 +189,29 @@ inline void megasas_return_cmd_fusion(struct 
megasas_instance *instance,
  */
 static void
 megasas_fire_cmd_fusion(struct megasas_instance *instance,
-   union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc)
+   union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc, bool is_32bit)
 {
+   struct megasas_register_set __iomem *regs = instance->reg_set;
+   unsigned long flags;
+   
+   if (is_32bit)
+   writel(le32_to_cpu(req_desc->u.low),
+   &(regs)->inbound_single_queue_port);
+   else if (instance->is_ventura) {
+   spin_lock_irqsave(>hba_lock, flags);

[PATCH 08/11] megaraid_sas: Enable or Disable Fast path based on the PCI Threshold Bandwidth

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

Large SEQ IO workload should sent as non fast path commands

This patch is depending on patch 7

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas.h|  8 +
 drivers/scsi/megaraid/megaraid_sas_base.c   | 49 +
 drivers/scsi/megaraid/megaraid_sas_fp.c | 21 -
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 20 +++-
 drivers/scsi/megaraid/megaraid_sas_fusion.h |  5 +--
 5 files changed, 86 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index 2da47b9..40b8295 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1432,6 +1432,8 @@ enum FW_BOOT_CONTEXT {
 #define MFI_1068_FW_HANDSHAKE_OFFSET   0x64
 #define MFI_1068_FW_READY  0x
 
+#define MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL HZ
+
 #define MR_MAX_REPLY_QUEUES_OFFSET  0X001F
 #define MR_MAX_REPLY_QUEUES_EXT_OFFSET  0X003FC000
 #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT14
@@ -2104,6 +2106,10 @@ struct megasas_instance {
atomic_t ldio_outstanding;
atomic_t fw_reset_no_pci_access;
 
+   atomic64_t bytes_wrote; /* used for raid1 fast path enable or disable */
+   atomic_t r1_write_fp_capable;
+
+
struct megasas_instance_template *instancet;
struct tasklet_struct isr_tasklet;
struct work_struct work_init;
@@ -2146,6 +2152,7 @@ struct megasas_instance {
long reset_flags;
struct mutex reset_mutex;
struct timer_list sriov_heartbeat_timer;
+   struct timer_list r1_fp_hold_timer;
char skip_heartbeat_timer_del;
u8 requestorId;
char PlasmaFW111;
@@ -2162,6 +2169,7 @@ struct megasas_instance {
bool is_ventura;
bool msix_combined;
u16 maxRaidMapSize;
+   u64  pci_threshold_bandwidth; /* used to control the fp writes */
 };
 struct MR_LD_VF_MAP {
u32 size;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index cfd379a..be11e9d 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1943,6 +1943,9 @@ void megaraid_sas_kill_hba(struct megasas_instance 
*instance)
}
/* Complete outstanding ioctls when adapter is killed */
megasas_complete_outstanding_ioctls(instance);
+   if (instance->is_ventura)
+   del_timer_sync(>r1_fp_hold_timer);
+
 }
 
  /**
@@ -2441,6 +2444,24 @@ void megasas_sriov_heartbeat_handler(unsigned long 
instance_addr)
}
 }
 
+/*Handler for disabling/enabling raid 1 fast paths*/
+void megasas_change_r1_fp_status(unsigned long instance_addr)
+{
+   struct megasas_instance *instance =
+   (struct megasas_instance *)instance_addr;
+   if (atomic64_read(>bytes_wrote) >=
+   instance->pci_threshold_bandwidth) {
+
+   atomic64_set(>bytes_wrote, 0);
+   atomic_set(>r1_write_fp_capable, 0);
+   } else {
+   atomic64_set(>bytes_wrote, 0);
+   atomic_set(>r1_write_fp_capable, 1);
+   }
+   mod_timer(>r1_fp_hold_timer,
+   jiffies + 
MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL);
+}
+
 /**
  * megasas_wait_for_outstanding -  Wait for all outstanding cmds
  * @instance:  Adapter soft state
@@ -5367,6 +5388,18 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
instance->skip_heartbeat_timer_del = 1;
}
 
+   if (instance->is_ventura) {
+   atomic64_set(>bytes_wrote, 0);
+   atomic_set(>r1_write_fp_capable, 1);
+   megasas_start_timer(instance,
+   >r1_fp_hold_timer,
+   megasas_change_r1_fp_status,
+   MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL);
+   dev_info(>pdev->dev, "starting the raid 1 fp timer"
+   " with interval %d \n",
+   MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL);
+   }
+
return 0;
 
 fail_get_ld_pd_list:
@@ -6160,6 +6193,9 @@ static void megasas_shutdown_controller(struct 
megasas_instance *instance,
if (instance->requestorId && !instance->skip_heartbeat_timer_del)
del_timer_sync(>sriov_heartbeat_timer);
 
+   if (instance->is_ventura)
+   del_timer_sync(>r1_fp_hold_timer);
+
megasas_flush_cache(instance);
megasas_shutdown_controller(instance, MR_DCMD_HIBERNATE_SHUTDOWN);
 
@@ -6279,6 +6315,16 @@ static void megasas_shutdown_controller(struct 
megasas_instance *instance,
megasas_setup_jbod_map(instance);
instance->unload = 0;
 
+   if (instance->is_ventura) {
+  

[PATCH 07/11] megaraid_sas: Add the Support for SAS3.5 Generic Megaraid Controllers Capabilities

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

The Megaraid driver has to support the SAS3.5 Generic Megaraid Controllers 
Firmware functionality.

This patch is depending on patch 6

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 53 ++---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 18 +-
 drivers/scsi/megaraid/megaraid_sas_fusion.h |  1 +
 3 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index b74609c..cfd379a 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5058,34 +5058,29 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
 
reg_set = instance->reg_set;
 
-   switch (instance->pdev->device) {
-   case PCI_DEVICE_ID_LSI_FUSION:
-   case PCI_DEVICE_ID_LSI_PLASMA:
-   case PCI_DEVICE_ID_LSI_INVADER:
-   case PCI_DEVICE_ID_LSI_FURY:
-   case PCI_DEVICE_ID_LSI_INTRUDER:
-   case PCI_DEVICE_ID_LSI_INTRUDER_24:
-   case PCI_DEVICE_ID_LSI_CUTLASS_52:
-   case PCI_DEVICE_ID_LSI_CUTLASS_53:
+   if (fusion)
instance->instancet = _instance_template_fusion;
-   break;
-   case PCI_DEVICE_ID_LSI_SAS1078R:
-   case PCI_DEVICE_ID_LSI_SAS1078DE:
-   instance->instancet = _instance_template_ppc;
-   break;
-   case PCI_DEVICE_ID_LSI_SAS1078GEN2:
-   case PCI_DEVICE_ID_LSI_SAS0079GEN2:
-   instance->instancet = _instance_template_gen2;
-   break;
-   case PCI_DEVICE_ID_LSI_SAS0073SKINNY:
-   case PCI_DEVICE_ID_LSI_SAS0071SKINNY:
-   instance->instancet = _instance_template_skinny;
-   break;
-   case PCI_DEVICE_ID_LSI_SAS1064R:
-   case PCI_DEVICE_ID_DELL_PERC5:
-   default:
-   instance->instancet = _instance_template_xscale;
-   break;
+   else {
+   switch (instance->pdev->device) {
+   case PCI_DEVICE_ID_LSI_SAS1078R:
+   case PCI_DEVICE_ID_LSI_SAS1078DE:
+   instance->instancet = _instance_template_ppc;
+   break;
+   case PCI_DEVICE_ID_LSI_SAS1078GEN2:
+   case PCI_DEVICE_ID_LSI_SAS0079GEN2:
+   instance->instancet = _instance_template_gen2;
+   break;
+   case PCI_DEVICE_ID_LSI_SAS0073SKINNY:
+   case PCI_DEVICE_ID_LSI_SAS0071SKINNY:
+   instance->instancet = _instance_template_skinny;
+   break;
+   case PCI_DEVICE_ID_LSI_SAS1064R:
+   case PCI_DEVICE_ID_DELL_PERC5:
+   default:
+   instance->instancet = _instance_template_xscale;
+   instance->pd_list_not_supported = 1;
+   break;
+   }
}
 
if (megasas_transition_to_ready(instance, 0)) {
@@ -5827,7 +5822,9 @@ static int megasas_probe_one(struct pci_dev *pdev,
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) ||
(instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA))
fusion->adapter_type = THUNDERBOLT_SERIES;
-   else if (!instance->is_ventura)
+   else if (instance->is_ventura)
+   fusion->adapter_type = VENTURA_SERIES;
+   else
fusion->adapter_type = INVADER_SERIES;
}
break;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index e0b188d..331cacd 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -244,7 +244,9 @@ inline void megasas_return_cmd_fusion(struct 
megasas_instance *instance,
 
reg_set = instance->reg_set;
 
-   cur_max_fw_cmds = readl(>reg_set->outbound_scratch_pad_3) & 
0x00;
+   /* ventura FW does not fill outbound_scratch_pad_3 with queue depth */
+   if (!instance->is_ventura)
+   cur_max_fw_cmds = 
readl(>reg_set->outbound_scratch_pad_3) & 0x00;
 
if (dual_qdepth_disable || !cur_max_fw_cmds)
cur_max_fw_cmds = 
instance->instancet->read_fw_status_reg(reg_set) & 0x00;
@@ -842,7 +844,7 @@ static int megasas_create_sg_sense_fusion(struct 
megasas_instance *instance)
drv_ops = (MFI_CAPABILITIES *) &(init_frame->driver_operations);
 
/* driver support Extended MSIX */
-   if (fusion->adapter_type == INVADER_SERIES)
+   if (fusion->adapter_type >= INVADER_SERIES)
drv_ops->mfi_capabilities.support_additional_msix = 1;
/* driver supports HA / Remote LUN over Fast Path interface */
drv_ops->mfi_capabilities.support_fp_remote_lun = 1;
@@ -1496,7 +1498,7 @@ 

[PATCH 00/11] Updates for scsi-next

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 


Sasikumar Chandrasekaran (11):
  megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid
Controllers
  megaraid_sas: 128 MSIX Support
  megaraid_sas: EEDP Escape Mode Support for SAS3.5 Generic Megaraid
Controllers
  megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and
IO Coalescing
  megaraid_sas: SAS3.5 Generic Megaraid Controllers Fast Path for RAID
1/10 Writes
  megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid
Controllers
  megaraid_sas: Add the Support for SAS3.5 Generic Megaraid Controllers
Capabilities
  megaraid_sas: Enable or Disable Fast path based on the PCI Threshold
Bandwidth
  megaraid_sas: ldio_outstanding variable is not decremented in
completion path
  megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid
Controllers
  megaraid_sas: driver version upgrade

 drivers/scsi/megaraid/megaraid_sas.h| 139 --
 drivers/scsi/megaraid/megaraid_sas_base.c   | 242 +++---
 drivers/scsi/megaraid/megaraid_sas_fp.c | 319 +++--
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 687 
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 318 -
 5 files changed, 1474 insertions(+), 231 deletions(-)

-- 
1.8.3.1

--
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 11/11] megaraid_sas: driver version upgrade

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

Upgrade driver version.

This patch is depending on patch 10

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index e4bb93d..bc5e042 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -35,8 +35,8 @@
 /*
  * MegaRAID SAS Driver meta data
  */
-#define MEGASAS_VERSION"06.812.07.00-rc1"
-#define MEGASAS_RELDATE"August 22, 2016"
+#define MEGASAS_VERSION"07.700.00.00-rc1"
+#define MEGASAS_RELDATE"November 29, 2016"
 
 /*
  * Device IDs
-- 
1.8.3.1

--
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/11] megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid Controllers

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

SAS3.5 Generic Megaraid Controllers FW will support new dynamic RaidMap to have 
different
sizes for different number of supported VDs.

This patch is depending on patch 5

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas.h|   7 +
 drivers/scsi/megaraid/megaraid_sas_base.c   |  57 --
 drivers/scsi/megaraid/megaraid_sas_fp.c | 278 +---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 148 ++-
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 177 +-
 5 files changed, 602 insertions(+), 65 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index 9263ba3..2da47b9 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1437,6 +1437,12 @@ enum FW_BOOT_CONTEXT {
 #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT14
 #define MR_MAX_MSIX_REG_ARRAY   16
 #define MR_RDPQ_MODE_OFFSET0X0080
+
+#define MR_MAX_RAID_MAP_SIZE_OFFSET_SHIFT  16
+#define MR_MAX_RAID_MAP_SIZE_MASK  0x1FF
+#define MR_MIN_MAP_SIZE0x1
+/* 64k */
+
 #define MR_CAN_HANDLE_SYNC_CACHE_OFFSET0X0100
 
 /*
@@ -2155,6 +2161,7 @@ struct megasas_instance {
bool fw_sync_cache_support;
bool is_ventura;
bool msix_combined;
+   u16 maxRaidMapSize;
 };
 struct MR_LD_VF_MAP {
u32 size;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 86f25d5..b74609c 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4427,8 +4427,7 @@ int megasas_alloc_cmds(struct megasas_instance *instance)
 static void megasas_update_ext_vd_details(struct megasas_instance *instance)
 {
struct fusion_context *fusion;
-   u32 old_map_sz;
-   u32 new_map_sz;
+   u32 ventura_map_sz = 0;
 
fusion = instance->ctrl_context;
/* For MFI based controllers return dummy success */
@@ -4458,21 +4457,37 @@ static void megasas_update_ext_vd_details(struct 
megasas_instance *instance)
instance->supportmax256vd ? "Extended VD(240 VD)firmware" :
"Legacy(64 VD) firmware");
 
-   old_map_sz = sizeof(struct MR_FW_RAID_MAP) +
-   (sizeof(struct MR_LD_SPAN_MAP) *
-   (instance->fw_supported_vd_count - 1));
-   new_map_sz = sizeof(struct MR_FW_RAID_MAP_EXT);
-   fusion->drv_map_sz = sizeof(struct MR_DRV_RAID_MAP) +
-   (sizeof(struct MR_LD_SPAN_MAP) *
-   (instance->drv_supported_vd_count - 1));
-
-   fusion->max_map_sz = max(old_map_sz, new_map_sz);
+   if (instance->maxRaidMapSize) {
+   ventura_map_sz = instance->maxRaidMapSize *
+   MR_MIN_MAP_SIZE; /* 64k */
+   fusion->current_map_sz = ventura_map_sz;
+   fusion->max_map_sz = ventura_map_sz;
+   } else {
+   fusion->old_map_sz =  sizeof(struct MR_FW_RAID_MAP) +
+   (sizeof(struct MR_LD_SPAN_MAP) *
+   (instance->fw_supported_vd_count - 1));
+   fusion->new_map_sz =  sizeof(struct MR_FW_RAID_MAP_EXT);
 
+   fusion->max_map_sz = max(fusion->old_map_sz, 
fusion->new_map_sz);
 
-   if (instance->supportmax256vd)
-   fusion->current_map_sz = new_map_sz;
-   else
-   fusion->current_map_sz = old_map_sz;
+   if (instance->supportmax256vd)
+   fusion->current_map_sz = fusion->new_map_sz;
+   else
+   fusion->current_map_sz = fusion->old_map_sz;
+   }
+   /* irrespective of FW raid maps, driver raid map is constant */
+   fusion->drv_map_sz = sizeof(struct MR_DRV_RAID_MAP_ALL);
+#if VD_EXT_DEBUG
+   dev_info(>pdev->dev, "instance->maxRaidMapSize 0x%x \n ",
+   instance->maxRaidMapSize);
+   dev_info(>pdev->dev,
+   "new_map_sz = 0x%x, old_map_sz = 0x%x, "
+   "ventura_map_sz = 0x%x, current_map_sz = 0x%x "
+   "fusion->drv_map_sz =0x%x, size of driver raid 
map 0x%lx\n",
+   fusion->new_map_sz, fusion->old_map_sz,
+   ventura_map_sz, fusion->current_map_sz,
+   fusion->drv_map_sz, sizeof(struct 
MR_DRV_RAID_MAP_ALL));
+#endif
 }
 
 /**
@@ -5013,7 +5028,7 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
 {
u32 max_sectors_1;
u32 max_sectors_2;
-   u32 tmp_sectors, msix_enable, scratch_pad_2;
+   u32 tmp_sectors, msix_enable, scratch_pad_2, 

[PATCH 09/11] megaraid_sas: ldio_outstanding variable is not decremented in completion path

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

ldio outstanding variable needs to be decremented in io completion path for
iMR dual queue depth

This patch is depending on patch 8

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 3aab189..e8016bc 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -2558,8 +2558,6 @@ void megasas_prepare_secondRaid1_IO(struct 
megasas_instance *instance,
 
if (atomic_inc_return(>fw_outstanding) >
instance->host->can_queue) {
-   dev_err(>pdev->dev, "Throttle IOs beyond"
-   "Controller queue depth\n");
atomic_dec(>fw_outstanding);
return SCSI_MLQUEUE_HOST_BUSY;
}
@@ -2786,6 +2784,8 @@ void megasas_prepare_secondRaid1_IO(struct 
megasas_instance *instance,
extStatus, data_length, sense);
scsi_io_req->RaidContext.raid_context.status = 
0;
scsi_io_req->RaidContext.raid_context.exStatus 
= 0;
+   if (instance->ldio_threshold && 
megasas_cmd_type(scmd_local) == READ_WRITE_LDIO)
+   atomic_dec(>ldio_outstanding);
megasas_return_cmd_fusion(instance, cmd_fusion);
scsi_dma_unmap(scmd_local);
scmd_local->scsi_done(scmd_local);
@@ -3931,7 +3931,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int 
reason)
scmd_local->result =
megasas_check_mpio_paths(instance,
scmd_local);
-   if (megasas_cmd_type(scmd_local) == 
READ_WRITE_LDIO)
+   if (instance->ldio_threshold && 
megasas_cmd_type(scmd_local) == READ_WRITE_LDIO)
atomic_dec(>ldio_outstanding);
megasas_return_cmd_fusion(instance, cmd_fusion);
scsi_dma_unmap(scmd_local);
-- 
1.8.3.1

--
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/11] megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and IO Coalescing

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

Detect sequential IO streams and pass those IOs directly to FW.

This patch is depending on patch 3

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas.h|   1 +
 drivers/scsi/megaraid/megaraid_sas_base.c   |  40 +++-
 drivers/scsi/megaraid/megaraid_sas_fp.c |   2 +
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 151 +++-
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 123 +-
 5 files changed, 287 insertions(+), 30 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index af94f58..ee6bd5c 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -2073,6 +2073,7 @@ struct megasas_instance {
/* used to sync fire the cmd to fw */
spinlock_t hba_lock;
/* used to synch producer, consumer ptrs in dpc */
+   spinlock_t stream_lock;
spinlock_t completion_lock;
struct dma_pool *frame_dma_pool;
struct dma_pool *sense_dma_pool;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 7c8c313..86f25d5 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5018,7 +5018,7 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
struct megasas_register_set __iomem *reg_set;
struct megasas_ctrl_info *ctrl_info = NULL;
unsigned long bar_list;
-   int i, loop, fw_msix_count = 0;
+   int i, j, loop, fw_msix_count = 0;
struct IOV_111 *iovPtr;
struct fusion_context *fusion;
 
@@ -5205,6 +5205,33 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
}
 
memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
+
+   /* stream detection initialization */
+   if (instance->is_ventura) {
+   fusion->streamDetectByLD =
+   kzalloc(sizeof(PTR_LD_STREAM_DETECT) * MAX_LOGICAL_DRIVES_EXT,
+   GFP_KERNEL);
+   if (!fusion->streamDetectByLD) {
+   dev_err(>pdev->dev,
+   "unable to allocate stream detection 
for pool of LDs\n");
+   goto fail_get_ld_pd_list;
+   }
+   for (i = 0; i < MAX_LOGICAL_DRIVES_EXT; ++i) {
+   fusion->streamDetectByLD[i] =
+   kmalloc(sizeof(LD_STREAM_DETECT), GFP_KERNEL);
+   if (!fusion->streamDetectByLD[i]) {
+   dev_err(>pdev->dev,
+   "unable to allocate stream detect by 
LD\n ");
+for (j = 0; j < i; ++j)
+   kfree(fusion->streamDetectByLD[j]);
+   kfree(fusion->streamDetectByLD);
+   fusion->streamDetectByLD = NULL;
+   goto fail_get_ld_pd_list;
+   }
+   fusion->streamDetectByLD[i]->mruBitMap = 
MR_STREAM_BITMAP;
+   }
+   }
+
if (megasas_ld_list_query(instance,
  MR_LD_QUERY_TYPE_EXPOSED_TO_HOST))
megasas_get_ld_list(instance);
@@ -5324,6 +5351,8 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
 
return 0;
 
+fail_get_ld_pd_list:
+   instance->instancet->disable_intr(instance);
 fail_get_pd_list:
instance->instancet->disable_intr(instance);
megasas_destroy_irqs(instance);
@@ -5860,6 +5889,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 
spin_lock_init(>mfi_pool_lock);
spin_lock_init(>hba_lock);
+   spin_lock_init(>stream_lock);
spin_lock_init(>completion_lock);
 
mutex_init(>reset_mutex);
@@ -6360,6 +6390,14 @@ static void megasas_detach_one(struct pci_dev *pdev)
if (instance->msix_vectors)
pci_disable_msix(instance->pdev);
 
+   if (instance->is_ventura) {
+   for (i = 0; i < MAX_LOGICAL_DRIVES_EXT; ++i)
+   kfree(fusion->streamDetectByLD[i]);
+   kfree(fusion->streamDetectByLD);
+   fusion->streamDetectByLD = NULL;
+   }
+
+
if (instance->ctrl_context) {
megasas_release_fusion(instance);
pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c 
b/drivers/scsi/megaraid/megaraid_sas_fp.c
index f237d00..d9483bc 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -935,6 +935,8 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 
ld, u64 stripRow,
 
ld = MR_TargetIdToLdGet(ldTgtId, map);
raid = MR_LdRaidGet(ld, map);
+   /*check read 

[PATCH 05/11] megaraid_sas: SAS3.5 Generic Megaraid Controllers Fast Path for RAID 1/10 Writes

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

To improve RAID 1/10 Write performance, OS drivers need to issue the required 
Write
IOs as Fast Path IOs (after the appropriate checks allowing Fast Path to be 
used)
to the appropriate physical drives (translated from the OS logical IO) and wait 
for
all Write IOs to complete.  If any of the Write IOs fail or time out, the IO 
will be
re issued to FW as an LD IO so FW can perform the error handling.

This patch is depending on patch 4

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas.h|   1 +
 drivers/scsi/megaraid/megaraid_sas_fp.c |  32 ++-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 325 
 drivers/scsi/megaraid/megaraid_sas_fusion.h |  15 +-
 4 files changed, 317 insertions(+), 56 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index ee6bd5c..9263ba3 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -2059,6 +2059,7 @@ struct megasas_instance {
 
u16 max_num_sge;
u16 max_fw_cmds;
+   u16 max_mpt_cmds;
u16 max_mfi_cmds;
u16 max_scsi_cmds;
u16 ldio_threshold;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c 
b/drivers/scsi/megaraid/megaraid_sas_fp.c
index d9483bc..5922d15 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -737,7 +737,7 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance 
*instance, u32 ld,
struct MR_DRV_RAID_MAP_ALL *map)
 {
struct MR_LD_RAID  *raid = MR_LdRaidGet(ld, map);
-   u32 pd, arRef;
+   u32 pd, arRef, r1_alt_pd;
u8  physArm, span;
u64 row;
u8  retval = TRUE;
@@ -772,9 +772,15 @@ static u8 mr_spanset_get_phy_params(struct 
megasas_instance *instance, u32 ld,
arRef   = MR_LdSpanArrayGet(ld, span, map);
pd  = MR_ArPdGet(arRef, physArm, map);
 
-   if (pd != MR_PD_INVALID)
+   if (pd != MR_PD_INVALID) {
*pDevHandle = MR_PdDevHandleGet(pd, map);
-   else {
+   /* get second pd also for raid 1/10 fast path writes*/
+   if (raid->level == 1) {
+   r1_alt_pd = MR_ArPdGet(arRef, physArm + 1, map);
+   if (r1_alt_pd != MR_PD_INVALID)
+   io_info->r1_alt_dev_handle = 
MR_PdDevHandleGet(r1_alt_pd, map);
+   }
+   } else {
*pDevHandle = cpu_to_le16(MR_PD_INVALID);
if ((raid->level >= 5) &&
((fusion->adapter_type == THUNDERBOLT_SERIES)  ||
@@ -819,7 +825,7 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 
ld, u64 stripRow,
struct MR_DRV_RAID_MAP_ALL *map)
 {
struct MR_LD_RAID  *raid = MR_LdRaidGet(ld, map);
-   u32 pd, arRef;
+   u32 pd, arRef, r1_alt_pd;
u8  physArm, span;
u64 row;
u8  retval = TRUE;
@@ -867,10 +873,15 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 
ld, u64 stripRow,
arRef   = MR_LdSpanArrayGet(ld, span, map);
pd  = MR_ArPdGet(arRef, physArm, map); /* Get the pd */
 
-   if (pd != MR_PD_INVALID)
-   /* Get dev handle from Pd. */
-   *pDevHandle = MR_PdDevHandleGet(pd, map);
-   else {
+   if (pd != MR_PD_INVALID) {
+   *pDevHandle = MR_PdDevHandleGet(pd, map); /* Get dev handle 
from Pd. */
+   /* get second pd also for raid 1/10 fast path writes*/
+   if (raid->level == 1) {
+   r1_alt_pd = MR_ArPdGet(arRef, physArm + 1, map);
+   if (r1_alt_pd != MR_PD_INVALID)
+   io_info->r1_alt_dev_handle = 
MR_PdDevHandleGet(r1_alt_pd, map);
+   }
+   } else {
/* set dev handle as invalid. */
*pDevHandle = cpu_to_le16(MR_PD_INVALID);
if ((raid->level >= 5) &&
@@ -1126,6 +1137,11 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, 
u32 ld, u64 stripRow,
/* If IO on an invalid Pd, then FP is not possible.*/
if (io_info->devHandle == cpu_to_le16(MR_PD_INVALID))
io_info->fpOkForIo = FALSE;
+   /* set raid 1/10 fast path write capable bit in io_info */
+   if (io_info->fpOkForIo &&
+   (io_info->r1_alt_dev_handle != MR_PD_INVALID) &&
+   (raid->level == 1) && !isRead)
+   io_info->isRaid_1_fp_write = 1;
return retval;
} else if (isRead) {
uint stripIdx;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 3ad929b..116f300 100644
--- 

[PATCH 10/11] megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid Controllers

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

Update Linux driver to use new pdTargetId field for JBOD target ID

This patch is depending on patch 9

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas.h| 106 +---
 drivers/scsi/megaraid/megaraid_sas_base.c   |   5 +-
 drivers/scsi/megaraid/megaraid_sas_fusion.c |  11 ++-
 drivers/scsi/megaraid/megaraid_sas_fusion.h |   3 +-
 4 files changed, 94 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index 40b8295..e4bb93d 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1320,7 +1320,56 @@ struct megasas_ctrl_info {
 #endif
} adapterOperations3;
 
-   u8  pad[0x800-0x7EC];
+   struct {
+#if defined(__BIG_ENDIAN_BITFIELD)
+   u8 reserved:7;
+   /* Indicates whether the CPLD image is part of
+   *  the package and stored in flash   
+   */
+   u8 cpldInFlash:1;
+#else
+   u8 cpldInFlash:1;
+   u8 reserved:7;
+#endif
+   u8 reserved1[3];
+   /* Null terminated string. Has the version
+   *  information if cpldInFlash = FALSE 
+   */
+   u8 userCodeDefinition[12];
+   } cpld;  /* Valid only if upgradableCPLD is TRUE */
+
+   struct {
+   #if defined(__BIG_ENDIAN_BITFIELD)
+   u16 reserved:8;
+   u16 FWSwapsBBUVPDInfo   :1;
+   u16 supportPdMapTargetId:1;
+   u16 supportSESCtrlInMultipathCfg:1;
+   u16 imageUploadSupported:1;
+   u16 supportEncryptedMfc :1;
+   u16 supportedEncAlgo:1;
+   u16 supportIbuttonLess  :1;
+   u16 ctrlInfoExtSupported:1;
+   #else
+
+   u16 ctrlInfoExtSupported:1;
+   u16 supportIbuttonLess  :1;
+   u16 supportedEncAlgo:1;
+   u16 supportEncryptedMfc :1;
+   u16 imageUploadSupported:1;
+   /* FW supports LUN based association and target port based */
+   u16 supportSESCtrlInMultipathCfg:1;
+   /* association for the SES device connected in multipath mode */
+/* FW defines Jbod target Id within MR_PD_CFG_SEQ */
+   u16 supportPdMapTargetId:1;
+   /* FW swaps relevant fields in MR_BBU_VPD_INFO_FIXED to
+   *  provide the data in little endian order 
+   */
+   u16 FWSwapsBBUVPDInfo   :1;
+   u16 reserved:8;
+   #endif
+   } adapterOperations4;
+
+u8  pad[0x800-0x7FE];  /* 0x7FE pad to 2K for 
expansion */
 } __packed;
 
 /*
@@ -1560,33 +1609,35 @@ struct megasas_header {
 typedef union _MFI_CAPABILITIES {
struct {
 #if   defined(__BIG_ENDIAN_BITFIELD)
-   u32 reserved:20;
-   u32 support_qd_throttling:1;
-   u32 support_fp_rlbypass:1;
-   u32 support_vfid_in_ioframe:1;
-   u32 support_ext_io_size:1;
-   u32 support_ext_queue_depth:1;
-   u32 security_protocol_cmds_fw:1;
-   u32 support_core_affinity:1;
-   u32 support_ndrive_r1_lb:1;
-   u32 support_max_255lds:1;
-   u32 support_fastpath_wb:1;
-   u32 support_additional_msix:1;
-   u32 support_fp_remote_lun:1;
+   u32 reserved:19;
+   u32 supportPdMapTargetId:1;
+   u32 support_qd_throttling:1;
+   u32 support_fp_rlbypass:1;
+   u32 support_vfid_in_ioframe:1;
+   u32 support_ext_io_size:1;
+   u32 support_ext_queue_depth:1;
+   u32 security_protocol_cmds_fw:1;
+   u32 support_core_affinity:1;
+   u32 support_ndrive_r1_lb:1;
+   u32 support_max_255lds:1;
+   u32 support_fastpath_wb:1;
+   u32 support_additional_msix:1;
+   u32 support_fp_remote_lun:1;
 #else
-   u32 support_fp_remote_lun:1;
-   u32 support_additional_msix:1;
-   u32 support_fastpath_wb:1;
-   u32 support_max_255lds:1;
-   u32 support_ndrive_r1_lb:1;
-   u32 support_core_affinity:1;
-   u32 security_protocol_cmds_fw:1;
-   u32 support_ext_queue_depth:1;
-   u32 support_ext_io_size:1;
-   u32 support_vfid_in_ioframe:1;
-   u32 support_fp_rlbypass:1;
-   u32 support_qd_throttling:1;
-   u32 reserved:20;
+   u32 support_fp_remote_lun:1;
+   u32 support_additional_msix:1;
+   u32 support_fastpath_wb:1;
+   u32 support_max_255lds:1;
+   u32 support_ndrive_r1_lb:1;

[PATCH 02/11] megaraid_sas: 128 MSIX Support

2016-12-01 Thread Sasikumar Chandrasekaran
From: root 

SAS3.5 Generic Megaraid based Controllers will have the support for 128 MSI-X 
vectors,
resulting in the need to support 128 reply queues

This patch is depending on patch 1

Signed-off-by: Sasikumar Chandrasekaran 
---
 drivers/scsi/megaraid/megaraid_sas.h|  1 +
 drivers/scsi/megaraid/megaraid_sas_base.c   | 24 +---
 drivers/scsi/megaraid/megaraid_sas_fusion.c |  4 ++--
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index f24ce88..af94f58 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -2152,6 +2152,7 @@ struct megasas_instance {
bool dev_handle;
bool fw_sync_cache_support;
bool is_ventura;
+   bool msix_combined;
 };
 struct MR_LD_VF_MAP {
u32 size;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index b7166b8..7c8c313 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5089,13 +5089,7 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
goto fail_ready_state;
}
 
-   /*
-* MSI-X host index 0 is common for all adapter.
-* It is used for all MPT based Adapters.
-*/
-   instance->reply_post_host_index_addr[0] =
-   (u32 __iomem *)((u8 __iomem *)instance->reg_set +
-   MPI2_REPLY_POST_HOST_INDEX_OFFSET);
+
 
/* Check if MSI-X is supported while in ready state */
msix_enable = (instance->instancet->read_fw_status_reg(reg_set) &
@@ -5113,6 +5107,9 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
instance->msix_vectors = ((scratch_pad_2
& MR_MAX_REPLY_QUEUES_EXT_OFFSET)
>> 
MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT) + 1;
+   if (instance->msix_vectors > 16)
+   instance->msix_combined = true;
+
if (rdpq_enable)
instance->is_rdpq = (scratch_pad_2 & 
MR_RDPQ_MODE_OFFSET) ?
1 : 0;
@@ -5146,6 +5143,19 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
else
instance->msix_vectors = 0;
}
+   /*
+* MSI-X host index 0 is common for all adapter.
+* It is used for all MPT based Adapters.
+*/
+   if (instance->msix_combined) {
+   instance->reply_post_host_index_addr[0] =
+   (u32 *)((u8 *)instance->reg_set +
+   MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET);
+   } else {
+   instance->reply_post_host_index_addr[0] =
+   (u32 *)((u8 *)instance->reg_set +
+   MPI2_REPLY_POST_HOST_INDEX_OFFSET);
+   }
 
dev_info(>pdev->dev,
"firmware supports msix\t: (%d)", fw_msix_count);
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index e048423..9de9e66 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -2391,7 +2391,7 @@ static void megasas_build_ld_nonrw_fusion(struct 
megasas_instance *instance,
 * pending to be completed
 */
if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) {
-   if (fusion->adapter_type == INVADER_SERIES)
+   if (instance->msix_combined)
writel(((MSIxIndex & 0x7) << 24) |
fusion->last_reply_idx[MSIxIndex],

instance->reply_post_host_index_addr[MSIxIndex/8]);
@@ -2407,7 +2407,7 @@ static void megasas_build_ld_nonrw_fusion(struct 
megasas_instance *instance,
return IRQ_NONE;
 
wmb();
-   if (fusion->adapter_type == INVADER_SERIES)
+   if (instance->msix_combined)
writel(((MSIxIndex & 0x7) << 24) |
fusion->last_reply_idx[MSIxIndex],
instance->reply_post_host_index_addr[MSIxIndex/8]);
-- 
1.8.3.1

--
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_dh_alua: Add return value and check for alua_rtpg_queue() to avoid DM devices I/Os hang

2016-12-01 Thread Bart Van Assche

On 11/24/2016 02:25 AM, tang.jun...@zte.com.cn wrote:

Activate_complete fn() must be called in alua_activate() if
alua_rtpg_queue() failed, otherwise, it would cause I/Os hang in DM
devices. So this patch add return value and check for alua_rtpg_queue().


Hello Tang,

Please drop this patch. I think the alua_rtpg_queue() caller should 
ensure that pg != NULL.


Bart.
--
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 1/2] blk-mq: Fix failed allocation path when mapping queues

2016-12-01 Thread Gabriel Krisman Bertazi
Gabriel Krisman Bertazi  writes:

> My one concern about this patch is if remapping an arbitrary queue to
> hctx_0 could result in outstanding requests getting submitted to the
> wrong hctx.  I couldn't observe this happening during tests, but I'm not
> entirely sure it'll never happen.  I believe the queue will be empty if
> we are trying to allocate tags for it, unless it was using another alive
> hctx queue and for some reason got reassigned to this new hctx.  is this
> possible at all?

I no longer believe this case to be an issue for accepting this patch,
since if a queue enters this path and get's remapped to hctx_0, it means
the ctx would already be getting remaped to a new queue anyway, and it
should use the requests that were just mapped for that queue.  So, for a
correctness standpoint it doesn't matter which queue we are remaping,
the failed hctx or hctx_0, no request would get redirected to the wrong
queue with this change.

Jens, do you think this set is good for merging in 4.10?  It fixes some
issues for us on low memory conditions.

-- 
Gabriel Krisman Bertazi

--
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/5] qla2xxx: Fix mailbox command timeout due to starvation

2016-12-01 Thread Madhani, Himanshu

On 11/30/16, 11:58 PM, "Hannes Reinecke"  wrote:

>On 11/30/2016 09:24 PM, Himanshu Madhani wrote:
>> From: Samy 
>> 
>> Signed-off-by: Samy 
>> Signed-off-by: Himanshu Madhani 
>> ---
>>  drivers/scsi/qla2xxx/qla_def.h |  3 ++
>>  drivers/scsi/qla2xxx/qla_mbx.c | 88 
>> ++
>>  drivers/scsi/qla2xxx/qla_os.c  | 24 
>>  3 files changed, 91 insertions(+), 24 deletions(-)
>> 
>This could do with a some description.

Thanks for the review. Will add more description when submitting revised 
series. 

>
>Otherwise:
>
>Reviewed-by: Hannes Reinecke 
>
>Cheers
>
>Hannes
>-- 
>Dr. Hannes Reinecke   Teamlead Storage & Networking
>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)


[PATCH scsi 3/3] scsi: cxgb4i,libcxgbi,cxgb4: add T6 iSCSI completion feature

2016-12-01 Thread Varun Prakash
T6 adapters reduce number of completions to host by
generating single completion for all the directly placed(DDP)
iSCSI pdus in a sequence.

This patch adds new structure for completion hw cmd
(struct cpl_rx_iscsi_cmp) and implements T6 completion
feature.

Signed-off-by: Varun Prakash 
---
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |  13 ++
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c  | 219 
 drivers/scsi/cxgbi/libcxgbi.c   |  19 +++
 drivers/scsi/cxgbi/libcxgbi.h   |   1 +
 4 files changed, 226 insertions(+), 26 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h 
b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
index fba3b2a..a267173 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
@@ -76,6 +76,7 @@ enum {
CPL_PASS_ESTABLISH= 0x41,
CPL_RX_DATA_DDP   = 0x42,
CPL_PASS_ACCEPT_REQ   = 0x44,
+   CPL_RX_ISCSI_CMP  = 0x45,
CPL_TRACE_PKT_T5  = 0x48,
CPL_RX_ISCSI_DDP  = 0x49,
 
@@ -934,6 +935,18 @@ struct cpl_iscsi_data {
__u8 status;
 };
 
+struct cpl_rx_iscsi_cmp {
+   union opcode_tid ot;
+   __be16 pdu_len_ddp;
+   __be16 len;
+   __be32 seq;
+   __be16 urg;
+   __u8 rsvd;
+   __u8 status;
+   __be32 ulp_crc;
+   __be32 ddpvld;
+};
+
 struct cpl_tx_data_iso {
__be32 op_to_scsi;
__u8   reserved1;
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index a6fc990..8f797db 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -1231,6 +1231,101 @@ static void do_rx_iscsi_hdr(struct cxgbi_device *cdev, 
struct sk_buff *skb)
__kfree_skb(skb);
 }
 
+static void do_rx_iscsi_data(struct cxgbi_device *cdev, struct sk_buff *skb)
+{
+   struct cxgbi_sock *csk;
+   struct cpl_iscsi_hdr *cpl = (struct cpl_iscsi_hdr *)skb->data;
+   struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
+   struct tid_info *t = lldi->tids;
+   struct sk_buff *lskb;
+   u32 tid = GET_TID(cpl);
+   u16 pdu_len_ddp = be16_to_cpu(cpl->pdu_len_ddp);
+
+   csk = lookup_tid(t, tid);
+   if (unlikely(!csk)) {
+   pr_err("can't find conn. for tid %u.\n", tid);
+   goto rel_skb;
+   }
+
+   log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_PDU_RX,
+ "csk 0x%p,%u,0x%lx, tid %u, skb 0x%p,%u, 0x%x.\n",
+ csk, csk->state, csk->flags, csk->tid, skb,
+ skb->len, pdu_len_ddp);
+
+   spin_lock_bh(>lock);
+
+   if (unlikely(csk->state >= CTP_PASSIVE_CLOSE)) {
+   log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
+ "csk 0x%p,%u,0x%lx,%u, bad state.\n",
+ csk, csk->state, csk->flags, csk->tid);
+
+   if (csk->state != CTP_ABORTING)
+   goto abort_conn;
+   else
+   goto discard;
+   }
+
+   cxgbi_skcb_tcp_seq(skb) = be32_to_cpu(cpl->seq);
+   cxgbi_skcb_flags(skb) = 0;
+
+   skb_reset_transport_header(skb);
+   __skb_pull(skb, sizeof(*cpl));
+   __pskb_trim(skb, ntohs(cpl->len));
+
+   if (!csk->skb_ulp_lhdr)
+   csk->skb_ulp_lhdr = skb;
+
+   lskb = csk->skb_ulp_lhdr;
+   cxgbi_skcb_set_flag(lskb, SKCBF_RX_DATA);
+
+   log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_PDU_RX,
+ "csk 0x%p,%u,0x%lx, skb 0x%p data, 0x%p.\n",
+ csk, csk->state, csk->flags, skb, lskb);
+
+   __skb_queue_tail(>receive_queue, skb);
+   spin_unlock_bh(>lock);
+   return;
+
+abort_conn:
+   send_abort_req(csk);
+discard:
+   spin_unlock_bh(>lock);
+rel_skb:
+   __kfree_skb(skb);
+}
+
+static void
+cxgb4i_process_ddpvld(struct cxgbi_sock *csk,
+ struct sk_buff *skb, u32 ddpvld)
+{
+   if (ddpvld & (1 << CPL_RX_DDP_STATUS_HCRC_SHIFT)) {
+   pr_info("csk 0x%p, lhdr 0x%p, status 0x%x, hcrc bad 0x%lx.\n",
+   csk, skb, ddpvld, cxgbi_skcb_flags(skb));
+   cxgbi_skcb_set_flag(skb, SKCBF_RX_HCRC_ERR);
+   }
+
+   if (ddpvld & (1 << CPL_RX_DDP_STATUS_DCRC_SHIFT)) {
+   pr_info("csk 0x%p, lhdr 0x%p, status 0x%x, dcrc bad 0x%lx.\n",
+   csk, skb, ddpvld, cxgbi_skcb_flags(skb));
+   cxgbi_skcb_set_flag(skb, SKCBF_RX_DCRC_ERR);
+   }
+
+   if (ddpvld & (1 << CPL_RX_DDP_STATUS_PAD_SHIFT)) {
+   log_debug(1 << CXGBI_DBG_PDU_RX,
+ "csk 0x%p, lhdr 0x%p, status 0x%x, pad bad.\n",
+ csk, skb, ddpvld);
+   cxgbi_skcb_set_flag(skb, SKCBF_RX_PAD_ERR);
+   }
+
+   if ((ddpvld & (1 << CPL_RX_DDP_STATUS_DDP_SHIFT)) &&
+   !cxgbi_skcb_test_flag(skb, SKCBF_RX_DATA)) {
+   log_debug(1 << 

[PATCH scsi 1/3] scsi: cxgb4i: use cxgb4_tp_smt_idx() to get smt_idx

2016-12-01 Thread Varun Prakash
cxgb4_tp_smt_idx() is defined in cxgb4 driver, it returns
smt_idx for T4,T5,T6 adapters.

Signed-off-by: Varun Prakash 
---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 0039beb..90522d4 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -1451,8 +1451,8 @@ static int init_act_open(struct cxgbi_sock *csk)
csk->mtu = dst_mtu(csk->dst);
cxgb4_best_mtu(lldi->mtus, csk->mtu, >mss_idx);
csk->tx_chan = cxgb4_port_chan(ndev);
-   /* SMT two entries per row */
-   csk->smac_idx = ((cxgb4_port_viid(ndev) & 0x7F)) << 1;
+   csk->smac_idx = cxgb4_tp_smt_idx(lldi->adapter_type,
+cxgb4_port_viid(ndev));
step = lldi->ntxq / lldi->nchan;
csk->txq_idx = cxgb4_port_idx(ndev) * step;
step = lldi->nrxq / lldi->nchan;
-- 
2.0.2

--
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 scsi 2/3] scsi: cxgb4i,libcxgbi: add active open cmd for T6 adapters

2016-12-01 Thread Varun Prakash
Add T6 active open cmd to open active connections
on T6 adapters.

Signed-off-by: Varun Prakash 
---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 86 --
 drivers/scsi/cxgbi/libcxgbi.c  |  6 +--
 2 files changed, 77 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 90522d4..a6fc990 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -188,7 +188,6 @@ static void send_act_open_req(struct cxgbi_sock *csk, 
struct sk_buff *skb,
struct l2t_entry *e)
 {
struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk->cdev);
-   int t4 = is_t4(lldi->adapter_type);
int wscale = cxgbi_sock_compute_wscale(csk->mss_idx);
unsigned long long opt0;
unsigned int opt2;
@@ -231,7 +230,7 @@ static void send_act_open_req(struct cxgbi_sock *csk, 
struct sk_buff *skb,
csk, >local_ip, ntohs(req->local_port),
>peer_ip, ntohs(req->peer_port),
csk->atid, csk->rss_qid);
-   } else {
+   } else if (is_t5(lldi->adapter_type)) {
struct cpl_t5_act_open_req *req =
(struct cpl_t5_act_open_req *)skb->head;
u32 isn = (prandom_u32() & ~7UL) - 1;
@@ -259,12 +258,45 @@ static void send_act_open_req(struct cxgbi_sock *csk, 
struct sk_buff *skb,
csk, >local_ip, ntohs(req->local_port),
>peer_ip, ntohs(req->peer_port),
csk->atid, csk->rss_qid);
+   } else {
+   struct cpl_t6_act_open_req *req =
+   (struct cpl_t6_act_open_req *)skb->head;
+   u32 isn = (prandom_u32() & ~7UL) - 1;
+
+   INIT_TP_WR(req, 0);
+   OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
+   qid_atid));
+   req->local_port = csk->saddr.sin_port;
+   req->peer_port = csk->daddr.sin_port;
+   req->local_ip = csk->saddr.sin_addr.s_addr;
+   req->peer_ip = csk->daddr.sin_addr.s_addr;
+   req->opt0 = cpu_to_be64(opt0);
+   req->params = cpu_to_be64(FILTER_TUPLE_V(
+   cxgb4_select_ntuple(
+   csk->cdev->ports[csk->port_id],
+   csk->l2t)));
+   req->rsvd = cpu_to_be32(isn);
+
+   opt2 |= T5_ISS_VALID;
+   opt2 |= RX_FC_DISABLE_F;
+   opt2 |= T5_OPT_2_VALID_F;
+
+   req->opt2 = cpu_to_be32(opt2);
+   req->rsvd2 = cpu_to_be32(0);
+   req->opt3 = cpu_to_be32(0);
+
+   log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
+ "csk t6 0x%p, %pI4:%u-%pI4:%u, atid %d, qid %u.\n",
+ csk, >local_ip, ntohs(req->local_port),
+ >peer_ip, ntohs(req->peer_port),
+ csk->atid, csk->rss_qid);
}
 
set_wr_txq(skb, CPL_PRIORITY_SETUP, csk->port_id);
 
pr_info_ipaddr("t%d csk 0x%p,%u,0x%lx,%u, rss_qid %u.\n",
-  (>saddr), (>daddr), t4 ? 4 : 5, csk,
+  (>saddr), (>daddr),
+  CHELSIO_CHIP_VERSION(lldi->adapter_type), csk,
   csk->state, csk->flags, csk->atid, csk->rss_qid);
 
cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t);
@@ -275,7 +307,6 @@ static void send_act_open_req6(struct cxgbi_sock *csk, 
struct sk_buff *skb,
   struct l2t_entry *e)
 {
struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk->cdev);
-   int t4 = is_t4(lldi->adapter_type);
int wscale = cxgbi_sock_compute_wscale(csk->mss_idx);
unsigned long long opt0;
unsigned int opt2;
@@ -293,10 +324,9 @@ static void send_act_open_req6(struct cxgbi_sock *csk, 
struct sk_buff *skb,
 
opt2 = RX_CHANNEL_V(0) |
RSS_QUEUE_VALID_F |
-   RX_FC_DISABLE_F |
RSS_QUEUE_V(csk->rss_qid);
 
-   if (t4) {
+   if (is_t4(lldi->adapter_type)) {
struct cpl_act_open_req6 *req =
(struct cpl_act_open_req6 *)skb->head;
 
@@ -321,7 +351,7 @@ static void send_act_open_req6(struct cxgbi_sock *csk, 
struct sk_buff *skb,
req->params = cpu_to_be32(cxgb4_select_ntuple(
  csk->cdev->ports[csk->port_id],
  csk->l2t));
-   } else {
+   } else if (is_t5(lldi->adapter_type)) {
struct cpl_t5_act_open_req6 *req =
(struct cpl_t5_act_open_req6 *)skb->head;
 
@@ -344,12 +374,41 @@ static void send_act_open_req6(struct 

[PATCH scsi 0/3] cxgb4i: add support for Chelsio T6 adapters

2016-12-01 Thread Varun Prakash
This patch series adds support for Chelsio T6 adapters
in iSCSI initiator offload driver(cxgb4i).

Varun Prakash (3):
  scsi: cxgb4i: use cxgb4_tp_smt_idx() to get smt_idx
  scsi: cxgb4i,libcxgbi: add active open cmd for T6 adapters
  scsi: cxgb4i,libcxgbi,cxgb4: add T6 iSCSI completion feature

 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |  13 ++
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c  | 309 
 drivers/scsi/cxgbi/libcxgbi.c   |  25 ++-
 drivers/scsi/cxgbi/libcxgbi.h   |   1 +
 4 files changed, 305 insertions(+), 43 deletions(-)

-- 
2.0.2

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


LSF/MM 2017: Call for Proposals

2016-12-01 Thread Jeff Layton
The annual Linux Storage, Filesystem and Memory Management (LSF/MM)
Summit for 2017 will be held on March 20th and 21st at the Hyatt
Cambridge, Cambridge, MA. LSF/MM is an invitation-only technical
workshop to map out improvements to the Linux storage, filesystem and
memory management subsystems that will make their way into the mainline
kernel within the coming years.


http://events.linuxfoundation.org/events/linux-storage-filesystem-and-mm-summit

Like last year, LSF/MM will be colocated with the Linux Foundation Vault
conference which takes place on March 22nd and 23rd in the same Venue.
For those that do not know, Vault is designed to be an event where open
source storage and filesystem practitioners meet storage implementors
and, as such, it would be of benefit for LSF/MM attendees to attend.

Unlike past years, Vault admission is not free for LSF/MM attendees this
year unless they're giving a talk. There is a discount for LSF/MM
attendees, however we would also like to encourage folks to submit talk
proposals to speak at the Vault conference.

http://events.linuxfoundation.org/events/vault

On behalf of the committee I am issuing a call for agenda proposals that
are suitable for cross-track discussion as well as technical subjects
for the breakout sessions.

If advance notice is required for visa applications then please point
that out in your proposal or request to attend, and submit the topic
as soon as possible.

1) Proposals for agenda topics should be sent before January 15th, 2016
to:

lsf...@lists.linux-foundation.org

and cc the Linux list or lists that are relevant for the topic in
question:

ATA:   linux-...@vger.kernel.org
Block: linux-bl...@vger.kernel.org
FS:linux-fsde...@vger.kernel.org
MM:linux...@kvack.org
SCSI:  linux-scsi@vger.kernel.org
NVMe:  linux-n...@lists.infradead.org

Please tag your proposal with [LSF/MM TOPIC] to make it easier to track.
In addition, please make sure to start a new thread for each topic
rather than following up to an existing one.  Agenda topics and
attendees will be selected by the program committee, but the final
agenda will be formed by consensus of the attendees on the day.

2) Requests to attend the summit for those that are not proposing a
topic should be sent to:

lsf...@lists.linux-foundation.org

Please summarise what expertise you will bring to the meeting, and what
you would like to discuss. Please also tag your email with [LSF/MM
ATTEND] and send it as a new thread so there is less chance of it
getting lost.

We will try to cap attendance at around 25-30 per track to facilitate
discussions although the final numbers will depend on the room sizes at
the venue.

Brief presentations are allowed to guide discussion, but are strongly
discouraged. There will be no recording or audio bridge. However, we
expect that written minutes will be published as we did in previous
years:

2016: https://lwn.net/Articles/lsfmm2016/

2015: https://lwn.net/Articles/lsfmm2015/

2014: http://lwn.net/Articles/LSFMM2014/

2013: http://lwn.net/Articles/548089/

3) If you have feedback on last year's meeting that we can use to
improve this year's, please also send that to:

lsf...@lists.linux-foundation.org

Thank you on behalf of the program committee:

Storage:
James Bottomley
Martin K. Petersen (track chair)
Sagi Grimberg

Filesystems:
Anna Schumaker
Chris Mason
Eric Sandeen
Jan Kara
Jeff Layton (summit chair)
Josef Bacik (track chair)
Trond Myklebust

MM:
Johannes Weiner
Rik van Riel (track chair)
-- 
Jeff Layton 
--
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: SG does not ignore dxferp (direct io + mmap)

2016-12-01 Thread Martin K. Petersen
> "Ewan" == Ewan D Milne  writes:

>> I think what we need to understand is what caused the regression in
>> the first place, I probably should have been bisecting the original
>> failure rather than trying to find where it started working.

Ewan> Bisecting leads to this commit:

commit 37f19e57a0de3c4a3417aa13ff4d04f1e0dee4b3
Author: Christoph Hellwig 
Date:   Sun Jan 18 16:16:33 2015 +0100

block: merge __bio_map_user_iov into bio_map_user_iov

And also remove the unused bdev argument.

Signed-off-by: Christoph Hellwig 
Reviewed-by: Ming Lei 
Signed-off-by: Jens Axboe 

Specifically, the problem appears to be caused by the removal of
the setting of bio->bi_bdev, which would previously be set to NULL.
If I add:

diff --git a/block/bio.c b/block/bio.c
index 0723d4c..ecac37b 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1351,6 +1351,7 @@ struct bio *bio_map_user_iov(struct request_queue
*q,
if (iter->type & WRITE)
bio->bi_rw |= REQ_WRITE;
 
+   bio->bi_bdev = NULL;
bio->bi_flags |= (1 << BIO_USER_MAPPED);
 
/*

Ewan> The test passes (no zero byte corruption).

Ewan> Setting dxferp would cause map_data.null_mapped to be set before
Ewan> it is passed to blk_rq_map_user(_iov) which would cause a
Ewan> difference in behavior.

Christoph?

-- 
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 v2] isci: switch to pci_alloc_irq_vectors

2016-12-01 Thread Martin K. Petersen
> "Christoph" == Christoph Hellwig  writes:

Applied to 4.10/scsi-queue.

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


[PATCH 27/39] Annotate hardware config module parameters in drivers/scsi/

2016-12-01 Thread David Howells
When the kernel is running in secure boot mode, we lock down the kernel to
prevent userspace from modifying the running kernel image.  Whilst this
includes prohibiting access to things like /dev/mem, it must also prevent
access by means of configuring driver modules in such a way as to cause a
device to access or modify the kernel image.

To this end, annotate module_param* statements that refer to hardware
configuration and indicate for future reference what type of parameter they
specify.  The parameter parser in the core sees this information and can
skip such parameters with an error message if the kernel is locked down.
The module initialisation then runs as normal, but just sees whatever the
default values for those parameters is.

Note that we do still need to do the module initialisation because some
drivers have viable defaults set in case parameters aren't specified and
some drivers support automatic configuration (e.g. PNP or PCI) in addition
to manually coded parameters.

This patch annotates drivers in drivers/scsi/.

Suggested-by: One Thousand Gnomes 
Signed-off-by: David Howells 
cc: "Juergen E. Fischer" 
cc: "James E.J. Bottomley" 
cc: "Martin K. Petersen" 
cc: Dario Ballabio 
cc: Finn Thain 
cc: Michael Schmitz 
cc: Achim Leubner 
cc: linux-scsi@vger.kernel.org
---

 drivers/scsi/aha152x.c   |4 ++--
 drivers/scsi/aha1542.c   |2 +-
 drivers/scsi/g_NCR5380.c |8 
 drivers/scsi/gdth.c  |2 +-
 drivers/scsi/qlogicfas.c |4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index f44d0487236e..ce5dc73d85bb 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -331,11 +331,11 @@ MODULE_LICENSE("GPL");
 #if !defined(PCMCIA)
 #if defined(MODULE)
 static int io[] = {0, 0};
-module_param_array(io, int, NULL, 0);
+module_param_hw_array(io, int, ioport, NULL, 0);
 MODULE_PARM_DESC(io,"base io address of controller");
 
 static int irq[] = {0, 0};
-module_param_array(irq, int, NULL, 0);
+module_param_hw_array(irq, int, irq, NULL, 0);
 MODULE_PARM_DESC(irq,"interrupt for controller");
 
 static int scsiid[] = {7, 7};
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 7db448ec8beb..a23cc9ac5acd 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -31,7 +31,7 @@ module_param(isapnp, bool, 0);
 MODULE_PARM_DESC(isapnp, "enable PnP support (default=1)");
 
 static int io[MAXBOARDS] = { 0x330, 0x334, 0, 0 };
-module_param_array(io, int, NULL, 0);
+module_param_hw_array(io, int, ioport, NULL, 0);
 MODULE_PARM_DESC(io, "base IO address of controller 
(0x130,0x134,0x230,0x234,0x330,0x334, default=0x330,0x334)");
 
 /* time AHA spends on the AT-bus during data transfer */
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index cbf010324c18..cf4fa7a2e738 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -44,8 +44,8 @@ static int ncr_53c400;
 static int ncr_53c400a;
 static int dtc_3181e;
 static int hp_c2502;
-module_param(ncr_irq, int, 0);
-module_param(ncr_addr, int, 0);
+module_param_hw(ncr_irq, int, irq, 0);
+module_param_hw(ncr_addr, int, ioport, 0);
 module_param(ncr_5380, int, 0);
 module_param(ncr_53c400, int, 0);
 module_param(ncr_53c400a, int, 0);
@@ -53,11 +53,11 @@ module_param(dtc_3181e, int, 0);
 module_param(hp_c2502, int, 0);
 
 static int irq[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
-module_param_array(irq, int, NULL, 0);
+module_param_hw_array(irq, int, irq, NULL, 0);
 MODULE_PARM_DESC(irq, "IRQ number(s)");
 
 static int base[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
-module_param_array(base, int, NULL, 0);
+module_param_hw_array(base, int, ioport, NULL, 0);
 MODULE_PARM_DESC(base, "base address(es)");
 
 static int card[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 0a767740bf02..4ec08fb2dfa8 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -353,7 +353,7 @@ static int probe_eisa_isa = 0;
 static int force_dma32 = 0;
 
 /* parameters for modprobe/insmod */
-module_param_array(irq, int, NULL, 0);
+module_param_hw_array(irq, int, irq, NULL, 0);
 module_param(disable, int, 0);
 module_param(reserve_mode, int, 0);
 module_param_array(reserve_list, int, NULL, 0);
diff --git a/drivers/scsi/qlogicfas.c b/drivers/scsi/qlogicfas.c
index 61cac87fb86f..840823b99e51 100644
--- a/drivers/scsi/qlogicfas.c
+++ b/drivers/scsi/qlogicfas.c
@@ -137,8 +137,8 @@ static struct Scsi_Host *__qlogicfas_detect(struct 
scsi_host_template *host,
 static struct qlogicfas408_priv *cards;
 static int iobase[MAX_QLOGICFAS];
 static int irq[MAX_QLOGICFAS] = { [0 ... MAX_QLOGICFAS-1] = -1 };
-module_param_array(iobase, int, NULL, 0);
-module_param_array(irq, int, NULL, 0);

Re: [PATCH v2 4/5] qla2xxx: Add Block Multi Queue functionality.

2016-12-01 Thread Christoph Hellwig
> - pci_disable_msix(ha->pdev);
> + pci_free_irq_vectors(ha->pdev);

Please make the switch to pci_alloc_irq_vectors / pci_free_irq_vectors
a se[arate patch.

> + ret = pci_alloc_irq_vectors(ha->pdev,
> + MIN_MSIX_COUNT, ha->msix_count, PCI_IRQ_MSIX);

And for proper blk-mq support you must use PCI_IRQ_AFFINITY to get
the affinity right.

>   /* Recalculate queue values */
> - if (ql2xmqsupport) {
> + if (ha->mqiobase && ql2xmqsupport) {

Where is that change coming from?

>   cpus = num_online_cpus();
>   ha->max_req_queues = (ha->msix_count - 1 > cpus) ?
>   (cpus + 1) : (ha->msix_count - 1);
> - ha->max_rsp_queues = ha->max_req_queues;
>  
>   /* ATIOQ needs 1 vector. That's 1 less QPair */
>   if (QLA_TGT_MODE_ENABLED())
>   ha->max_req_queues--;

And don't do your own look at online cpus and queue spreading, that's
what PCI_IRQ_AFFINITY and blk_mq_pci_map_queues are for.

>   "MSI: Enabled.\n");
> @@ -3273,11 +3261,10 @@ struct qla_init_msix_entry {
>  
>   if (ha->flags.msix_enabled)
>   qla24xx_disable_msix(ha);
> - else if (ha->flags.msi_enabled) {
> - free_irq(ha->pdev->irq, rsp);
> - pci_disable_msi(ha->pdev);
> - } else
> - free_irq(ha->pdev->irq, rsp);
> + else {
> + free_irq(pci_irq_vector(ha->pdev, 0), rsp);
> + pci_free_irq_vectors(ha->pdev);
> + }

Please also kill off qla24xx_disable_msix, and have a single
callsite that iterates over all vectors and finally calls
pci_free_irq_vectors.

> - if (ql2xmqsupport) {
> + if (ql2xmqsupport && ha->max_qpairs) {

Where does this come from?
--
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] fs: configfs: don't return anything from drop_link

2016-12-01 Thread Christoph Hellwig
Thanks a lot Andrzej!

I've applied the patch, but I undid the reformatting of the nvmet
code to keep the patch as simple as possible.
--
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 v3 net-next 1/3] qed: Add support for hardware offloaded iSCSI.

2016-12-01 Thread Manish Rangankar
From: Yuval Mintz 

This adds the backbone required for the various HW initalizations
which are necessary for the iSCSI driver (qedi) for QLogic FastLinQ
4 line of adapters - FW notification, resource initializations, etc.

Signed-off-by: Arun Easi 
Signed-off-by: Yuval Mintz 
Reviewed-by: Johannes Thumshirn 
Reviewed-by: Hannes Reinecke 
---
 drivers/net/ethernet/qlogic/Kconfig|3 +
 drivers/net/ethernet/qlogic/qed/Makefile   |1 +
 drivers/net/ethernet/qlogic/qed/qed.h  |7 +-
 drivers/net/ethernet/qlogic/qed/qed_dev.c  |   12 +
 drivers/net/ethernet/qlogic/qed/qed_iscsi.c| 1277 
 drivers/net/ethernet/qlogic/qed/qed_iscsi.h|   52 +
 drivers/net/ethernet/qlogic/qed/qed_ll2.c  |4 +-
 drivers/net/ethernet/qlogic/qed/qed_reg_addr.h |2 +
 drivers/net/ethernet/qlogic/qed/qed_spq.c  |   15 +
 include/linux/qed/qed_if.h |2 +
 include/linux/qed/qed_iscsi_if.h   |  229 +
 11 files changed, 1602 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_iscsi.c
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_iscsi.h
 create mode 100644 include/linux/qed/qed_iscsi_if.h

diff --git a/drivers/net/ethernet/qlogic/Kconfig 
b/drivers/net/ethernet/qlogic/Kconfig
index 32f2a45..3cfd105 100644
--- a/drivers/net/ethernet/qlogic/Kconfig
+++ b/drivers/net/ethernet/qlogic/Kconfig
@@ -110,4 +110,7 @@ config QEDE
 config QED_RDMA
bool
 
+config QED_ISCSI
+   bool
+
 endif # NET_VENDOR_QLOGIC
diff --git a/drivers/net/ethernet/qlogic/qed/Makefile 
b/drivers/net/ethernet/qlogic/qed/Makefile
index 967acf3..597e15c 100644
--- a/drivers/net/ethernet/qlogic/qed/Makefile
+++ b/drivers/net/ethernet/qlogic/qed/Makefile
@@ -6,3 +6,4 @@ qed-y := qed_cxt.o qed_dev.o qed_hw.o qed_init_fw_funcs.o 
qed_init_ops.o \
 qed-$(CONFIG_QED_SRIOV) += qed_sriov.o qed_vf.o
 qed-$(CONFIG_QED_LL2) += qed_ll2.o
 qed-$(CONFIG_QED_RDMA) += qed_roce.o
+qed-$(CONFIG_QED_ISCSI) += qed_iscsi.o
diff --git a/drivers/net/ethernet/qlogic/qed/qed.h 
b/drivers/net/ethernet/qlogic/qed/qed.h
index 50b8a01..15286c1 100644
--- a/drivers/net/ethernet/qlogic/qed/qed.h
+++ b/drivers/net/ethernet/qlogic/qed/qed.h
@@ -35,6 +35,7 @@
 
 #define QED_WFQ_UNIT   100
 
+#define ISCSI_BDQ_ID(_port_id) (_port_id)
 #define QED_WID_SIZE(1024)
 #define QED_PF_DEMS_SIZE(4)
 
@@ -392,6 +393,7 @@ struct qed_hwfn {
boolusing_ll2;
struct qed_ll2_info *p_ll2_info;
struct qed_rdma_info*p_rdma_info;
+   struct qed_iscsi_info   *p_iscsi_info;
struct qed_pf_paramspf_params;
 
bool b_rdma_enabled_in_prs;
@@ -593,6 +595,8 @@ struct qed_dev {
/* Linux specific here */
struct  qede_dev*edev;
struct  pci_dev *pdev;
+   u32 flags;
+#define QED_FLAG_STORAGE_STARTED   (BIT(0))
int msg_enable;
 
struct pci_params   pci_params;
@@ -606,6 +610,7 @@ struct qed_dev {
union {
struct qed_common_cb_ops*common;
struct qed_eth_cb_ops   *eth;
+   struct qed_iscsi_cb_ops *iscsi;
} protocol_ops;
void*ops_cookie;
 
@@ -615,7 +620,7 @@ struct qed_dev {
struct qed_cb_ll2_info  *ll2;
u8  ll2_mac_address[ETH_ALEN];
 #endif
-
+   DECLARE_HASHTABLE(connections, 10);
const struct firmware   *firmware;
 
u32 rdma_max_sge;
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c 
b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index 5be7b8a..e3612be 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -29,6 +29,7 @@
 #include "qed_hw.h"
 #include "qed_init_ops.h"
 #include "qed_int.h"
+#include "qed_iscsi.h"
 #include "qed_ll2.h"
 #include "qed_mcp.h"
 #include "qed_reg_addr.h"
@@ -155,6 +156,8 @@ void qed_resc_free(struct qed_dev *cdev)
 #ifdef CONFIG_QED_LL2
qed_ll2_free(p_hwfn, p_hwfn->p_ll2_info);
 #endif
+   if (p_hwfn->hw_info.personality == QED_PCI_ISCSI)
+   qed_iscsi_free(p_hwfn, p_hwfn->p_iscsi_info);
qed_iov_free(p_hwfn);
qed_dmae_info_free(p_hwfn);
qed_dcbx_info_free(p_hwfn, p_hwfn->p_dcbx_info);
@@ -411,6 +414,7 @@ int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt 
*p_ptt)
 
 int qed_resc_alloc(struct qed_dev *cdev)
 {
+   struct qed_iscsi_info *p_iscsi_info;
 #ifdef CONFIG_QED_LL2
struct qed_ll2_info *p_ll2_info;
 #endif
@@ -533,6 +537,12 @@ int qed_resc_alloc(struct qed_dev *cdev)
p_hwfn->p_ll2_info = 

Re: [PATCH v2 3/5] qla2xxx: Add multiple queue pair functionality.

2016-12-01 Thread Hannes Reinecke
On 11/30/2016 09:24 PM, Himanshu Madhani wrote:
> From: Michael Hernandez 
> 
> Replaced existing multiple queue functionality with framework
> that allows for the creation of pairs of request and response queues,
> either at start of day or dynamically.
> 
> Signed-off-by: Sawan Chandak 
> Signed-off-by: Michael Hernandez 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/Makefile |   3 +-
>  drivers/scsi/qla2xxx/qla_attr.c   |  36 ++--
>  drivers/scsi/qla2xxx/qla_bottom.c | 398 
> ++
>  drivers/scsi/qla2xxx/qla_dbg.c|   4 +-
>  drivers/scsi/qla2xxx/qla_def.h| 114 +--
>  drivers/scsi/qla2xxx/qla_gbl.h|  34 +++-
>  drivers/scsi/qla2xxx/qla_init.c   |  14 +-
>  drivers/scsi/qla2xxx/qla_inline.h |  30 +++
>  drivers/scsi/qla2xxx/qla_iocb.c   |  56 ++
>  drivers/scsi/qla2xxx/qla_isr.c| 109 +--
>  drivers/scsi/qla2xxx/qla_mbx.c|  44 +++--
>  drivers/scsi/qla2xxx/qla_mid.c| 116 +--
>  drivers/scsi/qla2xxx/qla_mq.c | 279 ++
>  drivers/scsi/qla2xxx/qla_os.c | 235 +++---
>  drivers/scsi/qla2xxx/qla_target.c |   4 +
>  drivers/scsi/qla2xxx/qla_top.c|  95 +
>  16 files changed, 1230 insertions(+), 341 deletions(-)
>  create mode 100644 drivers/scsi/qla2xxx/qla_bottom.c
>  create mode 100644 drivers/scsi/qla2xxx/qla_mq.c
>  create mode 100644 drivers/scsi/qla2xxx/qla_top.c
> 
[ .. ]
> diff --git a/drivers/scsi/qla2xxx/qla_bottom.c 
> b/drivers/scsi/qla2xxx/qla_bottom.c
> new file mode 100644
> index 000..8bf757e
> --- /dev/null
> +++ b/drivers/scsi/qla2xxx/qla_bottom.c
> @@ -0,0 +1,398 @@
> +/*
> + * QLogic Fibre Channel HBA Driver
> + * Copyright (c)  2016 QLogic Corporation
> + *
> + * See LICENSE.qla2xxx for copyright and licensing details.
> + */
> +#include "qla_def.h"
> +
> +/**
> + * qla2xxx_start_scsi_mq() - Send a SCSI command to the ISP
> + * @sp: command to send to the ISP
> + *
> + * Returns non-zero if a failure occurred, else zero.
> + */
> +
> +static int
> +qla2xxx_start_scsi_mq(srb_t *sp)
> +{
> + int nseg;
> + unsigned long   flags;
> + uint32_t*clr_ptr;
> + uint32_tindex;
> + uint32_thandle;
> + struct cmd_type_7 *cmd_pkt;
> + uint16_tcnt;
> + uint16_treq_cnt;
> + uint16_ttot_dsds;
> + struct req_que *req = NULL;
> + struct rsp_que *rsp = NULL;
> + struct scsi_cmnd *cmd = GET_CMD_SP(sp);
> + struct scsi_qla_host *vha = sp->fcport->vha;
> + struct qla_hw_data *ha = vha->hw;
> + struct qla_qpair *qpair = sp->qpair;
> +
> + /* Setup qpair pointers */
> + rsp = qpair->rsp;
> + req = qpair->req;
> +
> + /* So we know we haven't pci_map'ed anything yet */
> + tot_dsds = 0;
> +
> + /* Send marker if required */
> + if (vha->marker_needed != 0) {
> + if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL) !=
> + QLA_SUCCESS)
> + return QLA_FUNCTION_FAILED;
> + vha->marker_needed = 0;
> + }
> +
> + /* Acquire qpair specific lock */
> + spin_lock_irqsave(>qp_lock, flags);
> +
> + /* Check for room in outstanding command list. */
> + handle = req->current_outstanding_cmd;
> + for (index = 1; index < req->num_outstanding_cmds; index++) {
> + handle++;
> + if (handle == req->num_outstanding_cmds)
> + handle = 1;
> + if (!req->outstanding_cmds[handle])
> + break;
> + }
> + if (index == req->num_outstanding_cmds)
> + goto queuing_error;
> +
> + /* Map the sg table so we have an accurate count of sg entries needed */
> + if (scsi_sg_count(cmd)) {
> + nseg = dma_map_sg(>pdev->dev, scsi_sglist(cmd),
> + scsi_sg_count(cmd), cmd->sc_data_direction);
> + if (unlikely(!nseg))
> + goto queuing_error;
> + } else
> + nseg = 0;
> +
> + tot_dsds = nseg;
> + req_cnt = qla24xx_calc_iocbs(vha, tot_dsds);
> + if (req->cnt < (req_cnt + 2)) {
> + cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr :
> + RD_REG_DWORD_RELAXED(req->req_q_out);
> + if (req->ring_index < cnt)
> + req->cnt = cnt - req->ring_index;
> + else
> + req->cnt = req->length -
> + (req->ring_index - cnt);
> + if (req->cnt < (req_cnt + 2))
> + goto queuing_error;
> + }
> +
> + /* Build command packet. */
> + req->current_outstanding_cmd = handle;
> + req->outstanding_cmds[handle] = sp;
> + sp->handle = handle;
> + cmd->host_scribble = (unsigned char *)(unsigned long)handle;
> + req->cnt -= 

[PATCH v3 0/3] Add QLogic FastLinQ iSCSI (qedi) driver.

2016-12-01 Thread Manish Rangankar
This series introduces hardware offload iSCSI initiator driver for the
41000 Series Converged Network Adapters (579xx chip) by Qlogic. The overall
driver design includes a common module ('qed') and protocol specific
dependent modules ('qedi' for iSCSI).

This is an open iSCSI driver, modifications to open iSCSI user components
'iscsid', 'iscsiuio', etc. are required for the solution to work. The user
space changes are also in the process of being submitted.

https://groups.google.com/forum/#!forum/open-iscsi

The 'qed' common module, under drivers/net/ethernet/qlogic/qed/, is
enhanced with functionality required for the iSCSI support. This series
is based on:

net tree base: Merge of net and net-next as of 11/29/2016

Changes from RFC v2:

  1. qedi patches are squashed into single patch to prevent krobot
 warning.
  2. Fixed 'hw_p_cpuq' incompatible pointer type. 
  3. Fixed sparse incompatible types in comparison expression. 
  4. Misc fixes with latest 'checkpatch --strict' option.
  5. Remove int_mode option from MODULE_PARAM.
  6. Prefix all MODULE_PARAM params with qedi_*.
  7. Use CONFIG_QED_ISCSI instead of CONFIG_QEDI
  8. Added bad task mem access fix.

Manish Rangankar (1):
  qedi: Add QLogic FastLinQ offload iSCSI driver framework.

Yuval Mintz (2):
  qed: Add support for hardware offloaded iSCSI.
  qed: Add iSCSI out of order packet handling.

 MAINTAINERS|6 +
 drivers/net/ethernet/qlogic/Kconfig|3 +
 drivers/net/ethernet/qlogic/qed/Makefile   |1 +
 drivers/net/ethernet/qlogic/qed/qed.h  |8 +-
 drivers/net/ethernet/qlogic/qed/qed_dev.c  |   22 +
 drivers/net/ethernet/qlogic/qed/qed_iscsi.c| 1277 +
 drivers/net/ethernet/qlogic/qed/qed_iscsi.h|   52 +
 drivers/net/ethernet/qlogic/qed/qed_ll2.c  |  555 +-
 drivers/net/ethernet/qlogic/qed/qed_ll2.h  |9 +
 drivers/net/ethernet/qlogic/qed/qed_ooo.c  |  501 +
 drivers/net/ethernet/qlogic/qed/qed_ooo.h  |  176 ++
 drivers/net/ethernet/qlogic/qed/qed_reg_addr.h |2 +
 drivers/net/ethernet/qlogic/qed/qed_roce.c |1 +
 drivers/net/ethernet/qlogic/qed/qed_spq.c  |   24 +
 drivers/scsi/Kconfig   |1 +
 drivers/scsi/Makefile  |1 +
 drivers/scsi/qedi/Kconfig  |   10 +
 drivers/scsi/qedi/Makefile |5 +
 drivers/scsi/qedi/qedi.h   |  364 
 drivers/scsi/qedi/qedi_dbg.c   |  143 ++
 drivers/scsi/qedi/qedi_dbg.h   |  144 ++
 drivers/scsi/qedi/qedi_debugfs.c   |  244 +++
 drivers/scsi/qedi/qedi_fw.c| 2378 
 drivers/scsi/qedi/qedi_gbl.h   |   73 +
 drivers/scsi/qedi/qedi_hsi.h   |   52 +
 drivers/scsi/qedi/qedi_iscsi.c | 1624 
 drivers/scsi/qedi/qedi_iscsi.h |  232 +++
 drivers/scsi/qedi/qedi_main.c  | 2127 +
 drivers/scsi/qedi/qedi_sysfs.c |   52 +
 drivers/scsi/qedi/qedi_version.h   |   14 +
 include/linux/qed/qed_if.h |2 +
 include/linux/qed/qed_iscsi_if.h   |  229 +++
 32 files changed, 10303 insertions(+), 29 deletions(-)
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_iscsi.c
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_iscsi.h
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ooo.c
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ooo.h
 create mode 100644 drivers/scsi/qedi/Kconfig
 create mode 100644 drivers/scsi/qedi/Makefile
 create mode 100644 drivers/scsi/qedi/qedi.h
 create mode 100644 drivers/scsi/qedi/qedi_dbg.c
 create mode 100644 drivers/scsi/qedi/qedi_dbg.h
 create mode 100644 drivers/scsi/qedi/qedi_debugfs.c
 create mode 100644 drivers/scsi/qedi/qedi_fw.c
 create mode 100644 drivers/scsi/qedi/qedi_gbl.h
 create mode 100644 drivers/scsi/qedi/qedi_hsi.h
 create mode 100644 drivers/scsi/qedi/qedi_iscsi.c
 create mode 100644 drivers/scsi/qedi/qedi_iscsi.h
 create mode 100644 drivers/scsi/qedi/qedi_main.c
 create mode 100644 drivers/scsi/qedi/qedi_sysfs.c
 create mode 100644 drivers/scsi/qedi/qedi_version.h
 create mode 100644 include/linux/qed/qed_iscsi_if.h

-- 
1.8.3.1

--
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 v3 net-next 2/3] qed: Add iSCSI out of order packet handling.

2016-12-01 Thread Manish Rangankar
From: Yuval Mintz 

This patch adds out of order packet handling for hardware offloaded
iSCSI. Out of order packet handling requires driver buffer allocation
and assistance.

Signed-off-by: Arun Easi 
Signed-off-by: Yuval Mintz 
Reviewed-by: Johannes Thumshirn 
Reviewed-by: Hannes Reinecke 
---
 drivers/net/ethernet/qlogic/qed/Makefile   |   2 +-
 drivers/net/ethernet/qlogic/qed/qed.h  |   1 +
 drivers/net/ethernet/qlogic/qed/qed_dev.c  |  14 +-
 drivers/net/ethernet/qlogic/qed/qed_ll2.c  | 551 +++--
 drivers/net/ethernet/qlogic/qed/qed_ll2.h  |   9 +
 drivers/net/ethernet/qlogic/qed/qed_ooo.c  | 501 ++
 drivers/net/ethernet/qlogic/qed/qed_ooo.h  | 176 +
 drivers/net/ethernet/qlogic/qed/qed_roce.c |   1 +
 drivers/net/ethernet/qlogic/qed/qed_spq.c  |   9 +
 9 files changed, 1234 insertions(+), 30 deletions(-)
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ooo.c
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ooo.h

diff --git a/drivers/net/ethernet/qlogic/qed/Makefile 
b/drivers/net/ethernet/qlogic/qed/Makefile
index 597e15c..729e437 100644
--- a/drivers/net/ethernet/qlogic/qed/Makefile
+++ b/drivers/net/ethernet/qlogic/qed/Makefile
@@ -6,4 +6,4 @@ qed-y := qed_cxt.o qed_dev.o qed_hw.o qed_init_fw_funcs.o 
qed_init_ops.o \
 qed-$(CONFIG_QED_SRIOV) += qed_sriov.o qed_vf.o
 qed-$(CONFIG_QED_LL2) += qed_ll2.o
 qed-$(CONFIG_QED_RDMA) += qed_roce.o
-qed-$(CONFIG_QED_ISCSI) += qed_iscsi.o
+qed-$(CONFIG_QED_ISCSI) += qed_iscsi.o qed_ooo.o
diff --git a/drivers/net/ethernet/qlogic/qed/qed.h 
b/drivers/net/ethernet/qlogic/qed/qed.h
index 15286c1..85c2c6a 100644
--- a/drivers/net/ethernet/qlogic/qed/qed.h
+++ b/drivers/net/ethernet/qlogic/qed/qed.h
@@ -392,6 +392,7 @@ struct qed_hwfn {
/* Protocol related */
boolusing_ll2;
struct qed_ll2_info *p_ll2_info;
+   struct qed_ooo_info *p_ooo_info;
struct qed_rdma_info*p_rdma_info;
struct qed_iscsi_info   *p_iscsi_info;
struct qed_pf_paramspf_params;
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c 
b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index e3612be..896429c 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -32,6 +32,7 @@
 #include "qed_iscsi.h"
 #include "qed_ll2.h"
 #include "qed_mcp.h"
+#include "qed_ooo.h"
 #include "qed_reg_addr.h"
 #include "qed_sp.h"
 #include "qed_sriov.h"
@@ -156,8 +157,10 @@ void qed_resc_free(struct qed_dev *cdev)
 #ifdef CONFIG_QED_LL2
qed_ll2_free(p_hwfn, p_hwfn->p_ll2_info);
 #endif
-   if (p_hwfn->hw_info.personality == QED_PCI_ISCSI)
+   if (p_hwfn->hw_info.personality == QED_PCI_ISCSI) {
qed_iscsi_free(p_hwfn, p_hwfn->p_iscsi_info);
+   qed_ooo_free(p_hwfn, p_hwfn->p_ooo_info);
+   }
qed_iov_free(p_hwfn);
qed_dmae_info_free(p_hwfn);
qed_dcbx_info_free(p_hwfn, p_hwfn->p_dcbx_info);
@@ -415,6 +418,7 @@ int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt 
*p_ptt)
 int qed_resc_alloc(struct qed_dev *cdev)
 {
struct qed_iscsi_info *p_iscsi_info;
+   struct qed_ooo_info *p_ooo_info;
 #ifdef CONFIG_QED_LL2
struct qed_ll2_info *p_ll2_info;
 #endif
@@ -542,6 +546,10 @@ int qed_resc_alloc(struct qed_dev *cdev)
if (!p_iscsi_info)
goto alloc_no_mem;
p_hwfn->p_iscsi_info = p_iscsi_info;
+   p_ooo_info = qed_ooo_alloc(p_hwfn);
+   if (!p_ooo_info)
+   goto alloc_no_mem;
+   p_hwfn->p_ooo_info = p_ooo_info;
}
 
/* DMA info initialization */
@@ -596,8 +604,10 @@ void qed_resc_setup(struct qed_dev *cdev)
if (p_hwfn->using_ll2)
qed_ll2_setup(p_hwfn, p_hwfn->p_ll2_info);
 #endif
-   if (p_hwfn->hw_info.personality == QED_PCI_ISCSI)
+   if (p_hwfn->hw_info.personality == QED_PCI_ISCSI) {
qed_iscsi_setup(p_hwfn, p_hwfn->p_iscsi_info);
+   qed_ooo_setup(p_hwfn, p_hwfn->p_ooo_info);
+   }
}
 }
 
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c 
b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index 84d7e91..de4e2a2 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -36,6 +36,7 @@
 #include "qed_int.h"
 #include "qed_ll2.h"
 #include "qed_mcp.h"
+#include "qed_ooo.h"
 #include "qed_reg_addr.h"
 #include "qed_sp.h"
 #include "qed_roce.h"
@@ -296,25 +297,34 @@ static void qed_ll2_txq_flush(struct qed_hwfn *p_hwfn, u8 
connection_handle)
   

Re: [PATCH v2 1/5] qla2xxx: Only allow operational MBX to proceed during RESET.

2016-12-01 Thread Hannes Reinecke
On 11/30/2016 09:24 PM, Himanshu Madhani wrote:
> Signed-off-by: Himanshu Madhani 
> Signed-off-by: Giridhar Malavali 
> ---
>  drivers/scsi/qla2xxx/qla_mbx.c | 52 
> ++
>  1 file changed, 52 insertions(+)
> 
Reviewed-by: Hannes Reinecke 

Cheers

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
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