Re: [PATCH 00/16] remove eight obsolete architectures

2018-03-15 Thread Hannes Reinecke
On 03/15/2018 10:42 AM, David Howells wrote:
> Do we have anything left that still implements NOMMU?
> 
RISC-V ?
(evil grin :-)

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)


Re: [lldp-devel] Fwd: [PATCH RESEND] Fix segfault on "lldptool -t -i eth2 -V PFC -c enabled"

2017-11-07 Thread Hannes Reinecke
On 11/07/2017 04:56 PM, Sowmini Varadhan wrote:
> 
> We are trying to use DCBX via lldpad for some of our applications,
> and finding/fixing bugs and enhancements as we go. 
> 
> However our attempts to upstream these fixes is encountering silence
> from the lldp-devel list e.g.,
>   http://lists.open-lldp.org/pipermail/lldp-devel/2017-October/001252.html
> 
> Any suggestions on available options for the care and feeding of lldpad? 
> 
> There must be other users/maintainers of DCBX implementations- could you
> please share your experiences in this space?
> 
We tried to get the list maintainership moved to over to us by the time
Intel decided to drop FCoE. But for some reasons this never worked out,
so while the list is technically alive we don't have any means of
managing it.
Maybe we should be moving it to somewhere else.
But yes, we _do_ take fixes for it.

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)


Re: [PATCH V3 2/2] qedf: Add QLogic FastLinQ offload FCoE driver framework.

2017-02-06 Thread Hannes Reinecke
ut, simply free resources */
> + if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO)
> + goto out_free;
> +
> + /* Normalize response data into struct fc_frame */
> + mp_req = &(srr_req->mp_req);
> + fc_hdr = &(mp_req->resp_fc_hdr);
> + resp_len = mp_req->resp_len;
> + resp_buf = mp_req->resp_buf;
> + hdr_len = sizeof(*fc_hdr);
> +
> + buf = kzalloc(QEDF_PAGE_SIZE, GFP_ATOMIC);
> + if (!buf) {
> + QEDF_ERR(&(qedf->dbg_ctx),
> + "Unable to alloc mp buf.\n");
> + goto out_free;
> + }
> +
> + memcpy(buf, fc_hdr, hdr_len);
> + memcpy(buf + hdr_len, resp_buf, resp_len);
> +
> + fp = fc_frame_alloc(lport, resp_len);
> + if (!fp) {
> + QEDF_ERR(&(qedf->dbg_ctx),
> + "fc_frame_alloc failure.\n");
> + goto out_buf;
> + }
> +
> + /* Copy FC Frame header and payload into the frame */
> + fh = (struct fc_frame_header *)fc_frame_header_get(fp);
> + memcpy(fh, buf, hdr_len + resp_len);
> +
Same here: why do you allocate a buffer, just so that you can copy
things out of the buffer again?

[ .. ]
> +static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
> +{
> + struct qedf_ioreq *orig_io_req;
> + struct qedf_ioreq *rec_req;
> + struct qedf_mp_req *mp_req;
> + struct fc_frame_header *fc_hdr, *fh;
> + struct fc_frame *fp;
> + unsigned char *buf;
> + void *resp_buf;
> + u32 resp_len, hdr_len;
> + struct fc_lport *lport;
> + struct qedf_ctx *qedf;
> + int refcount;
> + enum fc_rctl r_ctl;
> + struct fc_els_ls_rjt *rjt;
> + struct fc_els_rec_acc *acc;
> + u8 opcode;
> + u32 offset, e_stat;
> + struct scsi_cmnd *sc_cmd;
> + bool srr_needed = false;
> +
> + rec_req = cb_arg->io_req;
> + qedf = rec_req->fcport->qedf;
> + lport = qedf->lport;
> +
> + orig_io_req = cb_arg->aborted_io_req;
> +
> + if (!orig_io_req)
> + goto out_free;
> +
> + if (rec_req->event != QEDF_IOREQ_EV_ELS_TMO &&
> + rec_req->event != QEDF_IOREQ_EV_ELS_ERR_DETECT)
> + cancel_delayed_work_sync(_io_req->timeout_work);
> +
> + refcount = atomic_read(_io_req->refcount.refcount);
> + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered: orig_io=%p,"
> +" orig_io_xid=0x%x, rec_xid=0x%x, refcount=%d\n",
> +orig_io_req, orig_io_req->xid, rec_req->xid, refcount);
> +
> + /* If a REC times out, free resources */
> + if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO)
> + goto out_free;
> +
> + /* Normalize response data into struct fc_frame */
> + mp_req = &(rec_req->mp_req);
> + fc_hdr = &(mp_req->resp_fc_hdr);
> + resp_len = mp_req->resp_len;
> + acc = resp_buf = mp_req->resp_buf;
> + hdr_len = sizeof(*fc_hdr);
> +
> + buf = kzalloc(QEDF_PAGE_SIZE, GFP_ATOMIC);
> + if (!buf) {
> + QEDF_ERR(&(qedf->dbg_ctx),
> + "Unable to alloc mp buf.\n");
> + goto out_free;
> + }
> +
> + memcpy(buf, fc_hdr, hdr_len);
> + memcpy(buf + hdr_len, resp_buf, resp_len);
> +
> + fp = fc_frame_alloc(lport, resp_len);
> + if (!fp) {
> + QEDF_ERR(&(qedf->dbg_ctx),
> + "fc_frame_alloc failure.\n");
> + goto out_buf;
> + }
> +
> + /* Copy FC Frame header and payload into the frame */
> + fh = (struct fc_frame_header *)fc_frame_header_get(fp);
> + memcpy(fh, buf, hdr_len + resp_len);
> +
Again, same story.

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)


Re: [PATCH V2 2/2] qedf: Add QLogic FastLinQ offload FCoE driver framework.

2017-02-01 Thread Hannes Reinecke

On 01/31/2017 06:08 PM, Chad Dupuis wrote:


On Mon, 30 Jan 2017, 10:34am -, Hannes Reinecke wrote:


On 01/25/2017 09:33 PM, Dupuis, Chad wrote:

From: "Dupuis, Chad" <chad.dup...@cavium.com>


[ .. ]

+   if (opcode == ELS_LS_RJT) {
+   rjt = fc_frame_payload_get(fp, sizeof(*rjt));
+   QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS,
+   "Received LS_RJT for REC: er_reason=0x%x, "
+   "er_explan=0x%x.\n", rjt->er_reason, rjt->er_explan);
+   /*
+* The following response(s) mean that we need to reissue the
+* request on another exchange.  We need to do this without
+* informing the upper layers lest it cause an application
+* error.
+*/
+   if ((rjt->er_reason == ELS_RJT_LOGIC ||
+   rjt->er_reason == ELS_RJT_UNAB) &&
+   rjt->er_explan == ELS_EXPL_OXID_RXID) {
+   QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS,
+   "Handle CMD LOST case.\n");
+   qedf_requeue_io_req(orig_io_req);
+   }


Care to explain this?
I found requeing within the driver without notifying the upper layers
deeply troubling.
I've came across this (or a similar issue) during implementing
FCoE over virtio; there it turned out to be an issue with the target not
handling frames in the correct order.
So it looks you are attempting to solve the problem of a REC being sent
for a command which is not know at the target.
Meaning it's either lost in the fabric, hasn't been seen by the target
(yet), or having already been processed by the target.

The above code would only solve the second problem; however, that would
indicate a command ordering issue as the REC would have arrived at the
target _before_ the originating command.
So doing a resend would only help for _that_ specific case, not for the
others.
And it's not quite clear why resending with a different OXID would help
here; typically it's the _RXID_ which isn't found ...


The problem I've observed is that If I return an error to the SCSI layer
it propogates up to the st driver and the test application would fail
since st would fail the I/O.  As the comment explains we do this on
another exchange internally in the driver so as not to cause the tape
backup application/test to fail.

bnx2fc behaves like this IIRC.


Ah, yes.
I've had this discussion with James Smart, too.
When a command abort fails with 'Invalid OXID/RXID' we should be 
retrying the command with a different set of IDs, as the original

need to quarantined.
(Which, incidentaily, you don't do, right? You cannot re-use that 
particular exchange until you either got a response for it or you reset 
the exchange manager. If you don't you run into the risk of getting an 
invalid completion if for some reason the command _does_ return 
eventually...)


Even though I'd rather like to have it resolved in libfc or even the 
SCSI midlayer itself, it's not something which should hold off the 
entire submission.




[ .. ]

+static void qedf_fcoe_process_vlan_resp(struct qedf_ctx *qedf,
+   struct sk_buff *skb)
+{
+   struct fip_header *fiph;
+   struct fip_desc *desc;
+   u16 vid = 0;
+   ssize_t rlen;
+   size_t dlen;
+
+   fiph = (struct fip_header *)(((void *)skb->data) + 2 * ETH_ALEN + 2);
+
+   rlen = ntohs(fiph->fip_dl_len) * 4;
+   desc = (struct fip_desc *)(fiph + 1);
+   while (rlen > 0) {
+   dlen = desc->fip_dlen * FIP_BPW;
+   switch (desc->fip_dtype) {
+   case FIP_DT_VLAN:
+   vid = ntohs(((struct fip_vlan_desc *)desc)->fd_vlan);
+   break;
+   }
+   desc = (struct fip_desc *)((char *)desc + dlen);
+   rlen -= dlen;
+   }
+
+   QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "VLAN response, "
+  "vid=0x%x.\n", vid);
+
+   if (vid > 0 && qedf->vlan_id != vid) {
+   qedf_set_vlan_id(qedf, vid);
+
+   /* Inform waiter that it's ok to call fcoe_ctlr_link up() */
+   complete(>fipvlan_compl);
+   }
+}
+

As mentioned, this will fail for HP VirtualConnect, which return a vid
of '0', indicating that the FCoE link should run on the interface itself.
And this is actually a valid response, I would think that you should be
calling complete() for any response ...


In testing I would get responses that would seem to contain VID 0 but then
subsequent responses contain the valid VID.  If I try to go with a VID of
0 FIP discovery would fail.  It could be possible that there's a bug in
the code that parses the FIP VLAN response but I'll like to leave this in
for now and it can be removed once I figure where the issue ma

Re: [PATCH V2 2/2] qedf: Add QLogic FastLinQ offload FCoE driver framework.

2017-01-30 Thread Hannes Reinecke
_requeue_io_req(orig_io_req);
> + }

Care to explain this?
I found requeing within the driver without notifying the upper layers
deeply troubling.
I've came across this (or a similar issue) during implementing
FCoE over virtio; there it turned out to be an issue with the target not
handling frames in the correct order.
So it looks you are attempting to solve the problem of a REC being sent
for a command which is not know at the target.
Meaning it's either lost in the fabric, hasn't been seen by the target
(yet), or having already been processed by the target.

The above code would only solve the second problem; however, that would
indicate a command ordering issue as the REC would have arrived at the
target _before_ the originating command.
So doing a resend would only help for _that_ specific case, not for the
others.
And it's not quite clear why resending with a different OXID would help
here; typically it's the _RXID_ which isn't found ...

[ .. ]
> +static void qedf_fcoe_process_vlan_resp(struct qedf_ctx *qedf,
> + struct sk_buff *skb)
> +{
> + struct fip_header *fiph;
> + struct fip_desc *desc;
> + u16 vid = 0;
> + ssize_t rlen;
> + size_t dlen;
> +
> + fiph = (struct fip_header *)(((void *)skb->data) + 2 * ETH_ALEN + 2);
> +
> + rlen = ntohs(fiph->fip_dl_len) * 4;
> + desc = (struct fip_desc *)(fiph + 1);
> + while (rlen > 0) {
> + dlen = desc->fip_dlen * FIP_BPW;
> + switch (desc->fip_dtype) {
> + case FIP_DT_VLAN:
> + vid = ntohs(((struct fip_vlan_desc *)desc)->fd_vlan);
> + break;
> + }
> + desc = (struct fip_desc *)((char *)desc + dlen);
> + rlen -= dlen;
> + }
> +
> + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "VLAN response, "
> +"vid=0x%x.\n", vid);
> +
> + if (vid > 0 && qedf->vlan_id != vid) {
> + qedf_set_vlan_id(qedf, vid);
> +
> + /* Inform waiter that it's ok to call fcoe_ctlr_link up() */
> + complete(>fipvlan_compl);
> + }
> +}
> +
As mentioned, this will fail for HP VirtualConnect, which return a vid
of '0', indicating that the FCoE link should run on the interface itself.
And this is actually a valid response, I would think that you should be
calling complete() for any response ...

[ .. ]
> +/*
> + * FCoE CQ element
> + */
> +struct fcoe_cqe {
> + __le32 cqe_data;
> + /* The task identifier (OX_ID) to be completed */
> +#define FCOE_CQE_TASK_ID_MASK0x
> +#define FCOE_CQE_TASK_ID_SHIFT   0
> + /*
> +  * The CQE type: 0x0 Indicating on a pending work request completion.
> +  * 0x1 - Indicating on an unsolicited event notification. use enum
> +  * fcoe_cqe_type  (use enum fcoe_cqe_type)
> +  */
> +#define FCOE_CQE_CQE_TYPE_MASK   0xF
> +#define FCOE_CQE_CQE_TYPE_SHIFT  16
> +#define FCOE_CQE_RESERVED0_MASK  0xFFF
> +#define FCOE_CQE_RESERVED0_SHIFT 20
> + __le16 reserved1;
> + __le16 fw_cq_prod;
> + union fcoe_cqe_info cqe_info;
> +};
> +
> +
> +
> +
> +
> +
These lines intentionally left blank?

[ .. ]
> +static int qedf_request_msix_irq(struct qedf_ctx *qedf)
> +{
> + int i, rc, cpu;
> +
> + cpu = cpumask_first(cpu_online_mask);
> +     for (i = 0; i < qedf->num_queues; i++) {
> + rc = request_irq(qedf->int_info.msix[i].vector,
> + qedf_msix_handler, 0, "qedf", >fp_array[i]);
> +
> + if (rc) {
> + QEDF_WARN(&(qedf->dbg_ctx), "request_irq failed.\n");
> + qedf_sync_free_irqs(qedf);
> + return rc;
> + }
> +
> + qedf->int_info.used_cnt++;
> + rc = irq_set_affinity_hint(qedf->int_info.msix[i].vector,
> + get_cpu_mask(cpu));
> + cpu = cpumask_next(cpu, cpu_online_mask);
> + }
> +
> + return 0;
> +}
> +
Please use pci_alloc_irq_vectors() here; that avoid you having to do SMP
affinity setting yourself.

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)


Re: [PATCH V2 net-next 1/2] qed: Add support for hardware offloaded FCoE.

2017-01-30 Thread Hannes Reinecke
On 01/25/2017 09:33 PM, Dupuis, Chad wrote:
> From: Arun Easi <arun.e...@qlogic.com>
> 
> This adds the backbone required for the various HW initalizations
> which are necessary for the FCoE driver (qedf) for QLogic FastLinQ
> 4 line of adapters - FW notification, resource initializations, etc.
> 
> Signed-off-by: Arun Easi <arun.e...@cavium.com>
> Signed-off-by: Yuval Mintz <yuval.mi...@cavium.com>
> ---
>  drivers/net/ethernet/qlogic/Kconfig   |   3 +
>  drivers/net/ethernet/qlogic/qed/Makefile  |   1 +
>  drivers/net/ethernet/qlogic/qed/qed.h |  11 +
>  drivers/net/ethernet/qlogic/qed/qed_cxt.c |  98 ++-
>  drivers/net/ethernet/qlogic/qed/qed_cxt.h |   3 +
>  drivers/net/ethernet/qlogic/qed/qed_dcbx.c|  13 +-
>  drivers/net/ethernet/qlogic/qed/qed_dcbx.h|   5 +-
>  drivers/net/ethernet/qlogic/qed/qed_dev.c | 205 -
>  drivers/net/ethernet/qlogic/qed/qed_dev_api.h |  42 +
>  drivers/net/ethernet/qlogic/qed/qed_fcoe.c| 990 
> ++
>  drivers/net/ethernet/qlogic/qed/qed_fcoe.h|  52 ++
>  drivers/net/ethernet/qlogic/qed/qed_hsi.h | 781 -
>  drivers/net/ethernet/qlogic/qed/qed_hw.c  |   3 +
>  drivers/net/ethernet/qlogic/qed/qed_ll2.c |  25 +
>  drivers/net/ethernet/qlogic/qed/qed_ll2.h |   2 +-
>  drivers/net/ethernet/qlogic/qed/qed_main.c|   7 +
>  drivers/net/ethernet/qlogic/qed/qed_mcp.c |   3 +
>  drivers/net/ethernet/qlogic/qed/qed_mcp.h |   1 +
>  drivers/net/ethernet/qlogic/qed/qed_reg_addr.h|   8 +
>  drivers/net/ethernet/qlogic/qed/qed_sp.h  |   4 +
>  drivers/net/ethernet/qlogic/qed/qed_sp_commands.c |   3 +
>  include/linux/qed/common_hsi.h|  10 +-
>  include/linux/qed/fcoe_common.h   | 715 
>  include/linux/qed/qed_fcoe_if.h   | 145 
>  include/linux/qed/qed_if.h|  41 +-
>  25 files changed, 3152 insertions(+), 19 deletions(-)
>  create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.c
>  create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.h
>  create mode 100644 include/linux/qed/fcoe_common.h
>  create mode 100644 include/linux/qed/qed_fcoe_if.h
> 
[ .. ]
> diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.h 
> b/drivers/net/ethernet/qlogic/qed/qed_dcbx.h
> index d70300f..0fabe97 100644
> --- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.h
> +++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.h
> @@ -57,7 +57,6 @@ struct qed_dcbx_app_data {
>   u8 tc;  /* Traffic Class */
>  };
>  
> -#ifdef CONFIG_DCB
>  #define QED_DCBX_VERSION_DISABLED   0
>  #define QED_DCBX_VERSION_IEEE   1
>  #define QED_DCBX_VERSION_CEE2
> @@ -73,7 +72,6 @@ struct qed_dcbx_set {
>   struct qed_dcbx_admin_params config;
>   u32 ver_num;
>  };
> -#endif
>  
>  struct qed_dcbx_results {
>   bool dcbx_enabled;
> @@ -97,9 +95,8 @@ struct qed_dcbx_info {
>   struct qed_dcbx_results results;
>   struct dcbx_mib operational;
>   struct dcbx_mib remote;
> -#ifdef CONFIG_DCB
>   struct qed_dcbx_set set;
> -#endif
> + struct qed_dcbx_get get;
>   u8 dcbx_cap;
>  };
>  
Why did you remove the dependency on 'CONFIG_DCB'?

Other than that:

Reviewed-by: Hannes Reinecke <h...@suse.com>

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)


Re: [Open-FCoE] [PATCH 2/2] qedf: Add QLogic FastLinQ offload FCoE driver framework.

2017-01-18 Thread Hannes Reinecke
On 01/16/2017 08:53 PM, Dupuis, Chad wrote:
> From: "Dupuis, Chad" <chad.dup...@cavium.com>
> 
> The QLogic FastLinQ Driver for FCoE (qedf) is the FCoE specific module for 
> 41000
> Series Converged Network Adapters by QLogic. This patch consists of following
> changes:
> 
> - MAINTAINERS Makefile and Kconfig changes for qedf
> - PCI driver registration
> - libfc/fcoe host level initialization
> - SCSI host template initialization and callbacks
> - Debugfs and log level infrastructure
> - Link handling
> - Firmware interface structures
> - QED core module initialization
> - Light L2 interface callbacks
> - I/O request initialization
> - Firmware I/O completion handling
> - Firmware ELS request/response handling
> - FIP request/response handled by the driver itself
> 
> Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
> Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
> Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
> Signed-off-by: Arun Easi <arun.e...@cavium.com>
> Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>

[ .. ]

> +/* Main thread to process skb's from light-L2 interface */
> +static int qedf_ll2_recv_thread(void *arg)
> +{
> + struct qedf_ctx *qedf = (struct qedf_ctx *)arg;
> + struct qedf_skb_work *work, *work_tmp;
> + unsigned long flags;
> +
> + set_user_nice(current, -20);
> + set_current_state(TASK_INTERRUPTIBLE);
> +
> + while (!kthread_should_stop()) {
> + schedule();
> + if (!list_empty(>ll2_skb_list)) {
> + list_for_each_entry_safe(work, work_tmp,
> + >ll2_skb_list, list) {
> + spin_lock_irqsave(>ll2_lock, flags);
> + list_del(>list);
> + spin_unlock_irqrestore(>ll2_lock, flags);
> + qedf_ll2_process_skb(qedf, work->skb);
> + kfree(work);
> + }
> + }
> + __set_current_state(TASK_INTERRUPTIBLE);
> + }
> +
> + __set_current_state(TASK_RUNNING);
> + return 0;
> +}
> +
Please: don't.

The RT folks are trying to get rid of kthreads altogether as it's a
nightmare to get it to work with cpu hotplugging.
Please convert to workqueues.

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)


Re: [Open-FCoE] [PATCH 1/2] qed: Add support for hardware offloaded FCoE.

2017-01-18 Thread Hannes Reinecke
On 01/16/2017 08:53 PM, Dupuis, Chad wrote:
> From: Arun Easi <arun.e...@qlogic.com>
> 
> This adds the backbone required for the various HW initalizations
> which are necessary for the FCoE driver (qedf) for QLogic FastLinQ
> 4 line of adapters - FW notification, resource initializations, etc.
> 
> Signed-off-by: Arun Easi <arun.e...@cavium.com>
> Signed-off-by: Yuval Mintz <yuval.mi...@cavium.com>
> ---

Reviewed-by: Hannes Reinecke <h...@suse.com>

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)


Re: [Open-FCoE] [PATCH RFC 5/5] qedf: Add FIP request handling

2017-01-09 Thread Hannes Reinecke
On 01/09/2017 05:47 PM, Chad Dupuis wrote:
> 
> On Wed, 28 Dec 2016, 9:11am -, Hannes Reinecke wrote:
> 
>> On 12/23/2016 08:17 PM, Dupuis, Chad wrote:
>>> From: "Dupuis, Chad" <chad.dup...@cavium.com>
>>>
>>> This patch adds handling for FIP requests and responses that are handled by
>>> the driver itself and not by libfcoe.
>>>
>>> Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
>>> Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
>>> Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
>>> Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>
>>> ---
>>>  drivers/scsi/qedf/qedf_fip.c | 267 
>>> +++
>>>  1 file changed, 267 insertions(+)
>>>  create mode 100644 drivers/scsi/qedf/qedf_fip.c
>>>
>>> diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c
>>> new file mode 100644
>>> index 000..4f185c6
>>> --- /dev/null
>>> +++ b/drivers/scsi/qedf/qedf_fip.c
>>> @@ -0,0 +1,267 @@
>>> +/*
>>> + *  QLogic FCoE Offload Driver
>>> + *  Copyright (c) 2016 Cavium Inc.
>>> + *
>>> + *  This software is available under the terms of the GNU General Public 
>>> License
>>> + *  (GPL) Version 2, available from the file COPYING in the main directory 
>>> of
>>> + *  this source tree.
>>> + */
>>> +#include 
>>> +#include 
>>> +#include "qedf.h"
>>> +
>>> +extern const struct qed_fcoe_ops *qed_ops;
>>> +/*
>>> + * FIP VLAN functions that will eventually move to libfcoe.
>>> + */
>>> +
>>> +void qedf_fcoe_send_vlan_req(struct qedf_ctx *qedf)
>>> +{
>>> +   struct sk_buff *skb;
>>> +   char *eth_fr;
>>> +   int fr_len;
>>> +   struct fip_vlan *vlan;
>>> +#define MY_FIP_ALL_FCF_MACS((__u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
>>> +   static u8 my_fcoe_all_fcfs[ETH_ALEN] = MY_FIP_ALL_FCF_MACS;
>>
>> Do you support VN2VN, too?
> 
> Not currently, no.
> 
Ah.

Too bad. Any plans for it?
It certainly eases up P2P setups for FCoE...

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)


Re: [Open-FCoE] [PATCH RFC 2/5] qedf: Add QLogic FastLinQ offload FCoE driver framework.

2017-01-09 Thread Hannes Reinecke
On 01/09/2017 05:45 PM, Chad Dupuis wrote:
> 
> On Wed, 28 Dec 2016, 9:00am -, Hannes Reinecke wrote:
> 
>> On 12/23/2016 08:17 PM, Dupuis, Chad wrote:
>>> From: "Dupuis, Chad" <chad.dup...@cavium.com>
>>>
>>> The QLogic FastLinQ Driver for FCoE (qedf) is the FCoE specific module
>>> for 41000 Series Converged Network Adapters by QLogic.
>>>
>>> This patch consists of following changes:
>>>   - MAINTAINERS Makefile and Kconfig changes for qedf
>>>   - PCI driver registration
>>>   - libfc/fcoe host level initialization
>>>   - SCSI host template initialization and callbacks
>>>   - Debugfs and log level infrastructure
>>>   - Link handling
>>>   - Firmware interface structures
>>>   - QED core module initialization
>>>   - Light L2 interface callbacks
>>>
>>> Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
>>> Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
>>> Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
>>> Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>
>>> ---
>>>  MAINTAINERS  |6 +
>>>  drivers/scsi/Kconfig |1 +
>>>  drivers/scsi/qedf/Kconfig|   11 +
>>>  drivers/scsi/qedf/Makefile   |5 +
>>>  drivers/scsi/qedf/qedf.h |  555 ++
>>>  drivers/scsi/qedf/qedf_attr.c|  165 ++
>>>  drivers/scsi/qedf/qedf_dbg.c |  192 +++
>>>  drivers/scsi/qedf/qedf_dbg.h |  153 ++
>>>  drivers/scsi/qedf/qedf_debugfs.c |  472 +
>>>  drivers/scsi/qedf/qedf_main.c| 3519 
>>> ++
>>>  drivers/scsi/qedf/qedf_version.h |   15 +
>>>  11 files changed, 5094 insertions(+)
>>>  create mode 100644 drivers/scsi/qedf/Kconfig
>>>  create mode 100644 drivers/scsi/qedf/Makefile
>>>  create mode 100644 drivers/scsi/qedf/qedf.h
>>>  create mode 100644 drivers/scsi/qedf/qedf_attr.c
>>>  create mode 100644 drivers/scsi/qedf/qedf_dbg.c
>>>  create mode 100644 drivers/scsi/qedf/qedf_dbg.h
>>>  create mode 100644 drivers/scsi/qedf/qedf_debugfs.c
>>>  create mode 100644 drivers/scsi/qedf/qedf_main.c
>>>  create mode 100644 drivers/scsi/qedf/qedf_version.h
>>>
>> [ .. ]
>>> +/* Returns true if we have a valid vlan, false otherwise */
>>> +static bool qedf_initiate_fipvlan_req(struct qedf_ctx *qedf)
>>> +{
>>> +   int rc;
>>> +
>>> +   if (atomic_read(>link_state) != QEDF_LINK_UP) {
>>> +   QEDF_ERR(&(qedf->dbg_ctx), "Link not up.\n");
>>> +   return  false;
>>> +   }
>>> +
>>> +   while (qedf->fipvlan_retries--) {
>>> +   if (qedf->vlan_id > 0)
>>> +   return true;
>> Some weird FCoE bridges (most notably HP VirtualConnect) return a VLAN
>> ID of '0'. Shouldn't you rather test for '>= 0' here?
> 
> Will look into this but isn't a VLAN ID of 0 not valid?
> 
Well, a VLAN ID of '0' indicates no VLAN at all but rather use the base
interface.
But you still will be seeing a VLAN ID '0' in the FIP VLAN response.


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)


Re: [Open-FCoE] [PATCH RFC 5/5] qedf: Add FIP request handling

2016-12-28 Thread Hannes Reinecke
On 12/23/2016 08:17 PM, Dupuis, Chad wrote:
> From: "Dupuis, Chad" <chad.dup...@cavium.com>
> 
> This patch adds handling for FIP requests and responses that are handled by
> the driver itself and not by libfcoe.
> 
> Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
> Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
> Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
> Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>
> ---
>  drivers/scsi/qedf/qedf_fip.c | 267 
> +++
>  1 file changed, 267 insertions(+)
>  create mode 100644 drivers/scsi/qedf/qedf_fip.c
> 
> diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c
> new file mode 100644
> index 000..4f185c6
> --- /dev/null
> +++ b/drivers/scsi/qedf/qedf_fip.c
> @@ -0,0 +1,267 @@
> +/*
> + *  QLogic FCoE Offload Driver
> + *  Copyright (c) 2016 Cavium Inc.
> + *
> + *  This software is available under the terms of the GNU General Public 
> License
> + *  (GPL) Version 2, available from the file COPYING in the main directory of
> + *  this source tree.
> + */
> +#include 
> +#include 
> +#include "qedf.h"
> +
> +extern const struct qed_fcoe_ops *qed_ops;
> +/*
> + * FIP VLAN functions that will eventually move to libfcoe.
> + */
> +
> +void qedf_fcoe_send_vlan_req(struct qedf_ctx *qedf)
> +{
> + struct sk_buff *skb;
> + char *eth_fr;
> + int fr_len;
> + struct fip_vlan *vlan;
> +#define MY_FIP_ALL_FCF_MACS((__u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
> + static u8 my_fcoe_all_fcfs[ETH_ALEN] = MY_FIP_ALL_FCF_MACS;

Do you support VN2VN, too?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


Re: [Open-FCoE] [PATCH RFC 4/5] qedf: Add offload ELS request handling.

2016-12-28 Thread Hannes Reinecke
On 12/23/2016 08:17 PM, Dupuis, Chad wrote:
> From: "Dupuis, Chad" <chad.dup...@cavium.com>
> 
> This patch adds support for ELS requests that are handled by the firmware for
> offloaded sessions.
> 
> Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
> Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
> Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
> Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>
> ---
>  drivers/scsi/qedf/qedf_els.c | 984 
> +++
>  1 file changed, 984 insertions(+)
>  create mode 100644 drivers/scsi/qedf/qedf_els.c
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


Re: [Open-FCoE] [PATCH RFC 3/5] qedf: Add offloaded I/O request functions.

2016-12-28 Thread Hannes Reinecke
On 12/23/2016 08:17 PM, Dupuis, Chad wrote:
> From: "Dupuis, Chad" <chad.dup...@cavium.com>
> 
> This patch adds various I/O requests types that are handled in firmware:
> 
> - Normal I/O requests
> - ABTS requests
> - Cleanup requests
> - Task management requests
> 
> It also contains:
> 
> - I/O request initialization
> - Firmware completion handling
> 
> Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
> Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
> Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
> Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>
> ---
>  drivers/scsi/qedf/qedf_hsi.h |  427 
>  drivers/scsi/qedf/qedf_io.c  | 2303 
> ++
>  2 files changed, 2730 insertions(+)
>  create mode 100644 drivers/scsi/qedf/qedf_hsi.h
>  create mode 100644 drivers/scsi/qedf/qedf_io.c
> 
[ .. ]

> +static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd 
> *sc_cmd,
> + uint8_t tm_flags)
> +{
> + struct qedf_ioreq *io_req;
> + struct qedf_mp_req *tm_req;
> + struct fcoe_task_context *task;
> + struct fc_frame_header *fc_hdr;
> + struct fcp_cmnd *fcp_cmnd;
> + struct qedf_ctx *qedf = fcport->qedf;
> + int rc = 0;
> + uint16_t xid;
> + uint32_t sid, did;
> + int tmo = 0;
> + unsigned long flags;
> +
> + if (!sc_cmd) {
> + QEDF_ERR(&(qedf->dbg_ctx), "invalid arg\n");
> + return FAILED;
> + }
> +
> + if (!(test_bit(QEDF_RPORT_SESSION_READY, >flags))) {
> + QEDF_ERR(&(qedf->dbg_ctx), "fcport not offloaded\n");
> + rc = FAILED;
> + return FAILED;
> + }
> +
> +     scsi_block_requests(qedf->lport->host);
> +
Typically, EH commands will be executed after the scsi host is stopped
and no commands are outstanding.
So there's no point in issuing 'scsi_block_requests()' here.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


Re: [Open-FCoE] [PATCH RFC 2/5] qedf: Add QLogic FastLinQ offload FCoE driver framework.

2016-12-28 Thread Hannes Reinecke
port_destroy,
> + .vport_disable = qedf_vport_disable,
> + .bsg_request = fc_lport_bsg_request,
> +};
> +
> +static struct fc_function_template qedf_fc_vport_transport_fn = {
> + .show_host_node_name = 1,
> + .show_host_port_name = 1,
> + .show_host_supported_classes = 1,
> + .show_host_supported_fc4s = 1,
> + .show_host_active_fc4s = 1,
> + .show_host_maxframe_size = 1,
> + .show_host_port_id = 1,
> + .show_host_supported_speeds = 1,
> + .get_host_speed = fc_get_host_speed,
> + .show_host_speed = 1,
> + .show_host_port_type = 1,
> + .get_host_port_state = fc_get_host_port_state,
> + .show_host_port_state = 1,
> + .show_host_symbolic_name = 1,
> + .dd_fcrport_size = (sizeof(struct fc_rport_libfc_priv) +
> + sizeof(struct qedf_rport)),
> + .show_rport_maxframe_size = 1,
> + .show_rport_supported_classes = 1,
> + .show_host_fabric_name = 1,
> + .show_starget_node_name = 1,
> + .show_starget_port_name = 1,
> + .show_starget_port_id = 1,
> + .set_rport_dev_loss_tmo = fc_set_rport_loss_tmo,
> + .show_rport_dev_loss_tmo = 1,
> + .get_fc_host_stats = fc_get_host_stats,
> + .issue_fc_host_lip = qedf_fcoe_reset,
> + .bsg_request = fc_lport_bsg_request,
> +};
> +
> +static bool qedf_fp_has_work(struct qedf_fastpath *fp)
> +{
> + struct qedf_ctx *qedf = fp->qedf;
> + struct global_queue *que;
> + struct qed_sb_info *sb_info = fp->sb_info;
> + struct status_block *sb = sb_info->sb_virt;
> + u16 prod_idx;
> +
> + /* Get the pointer to the global CQ this completion is on */
> + que = qedf->global_queues[fp->sb_id];
> +
> + rmb();
> +
> + /* Get the current firmware producer index */
> + prod_idx = sb->pi_array[QEDF_FCOE_PARAMS_GL_RQ_PI];
> +
> + return (que->cq_prod_idx != prod_idx);
> +}
> +
> +/*
> + * Interrupt handler code.
> + */
> +
> +/* Process completion queue and copy CQE contents for deferred processesing
> + *
> + * Return true if we should wake the I/O thread, false if not.
> + */
> +static bool qedf_process_completions(struct qedf_fastpath *fp)
> +{
> + struct qedf_ctx *qedf = fp->qedf;
> + struct qed_sb_info *sb_info = fp->sb_info;
> + struct status_block *sb = sb_info->sb_virt;
> + struct global_queue *que;
> + u16 prod_idx;
> + struct fcoe_cqe *cqe;
> + struct qedf_io_work *work;
> + unsigned long flags;
> + int num_handled = 0;
> + unsigned int cpu;
> + struct qedf_ioreq *io_req = NULL;
> + struct qedf_percpu_iothread_s *iothread;
> + u16 xid;
> + u16 new_cqes;
> + u32 comp_type;
> +
> + /* Get the current firmware producer index */
> + prod_idx = sb->pi_array[QEDF_FCOE_PARAMS_GL_RQ_PI];
> +
> + /* Get the pointer to the global CQ this completion is on */
> + que = qedf->global_queues[fp->sb_id];
> +
> + /* Calculate the amount of new elements since last processing */
> + new_cqes = (prod_idx >= que->cq_prod_idx) ?
> + (prod_idx - que->cq_prod_idx) :
> + 0x1 - que->cq_prod_idx + prod_idx;
> +
> + /* Save producer index */
> + que->cq_prod_idx = prod_idx;
> +
> + while (new_cqes) {
> + fp->completions++;
> + num_handled++;
> + cqe = >cq[que->cq_cons_idx];
> +
> + comp_type = (cqe->cqe_data >> FCOE_CQE_CQE_TYPE_SHIFT) &
> + FCOE_CQE_CQE_TYPE_MASK;
> +
> +     /*
> +  * Process unsolicited CQEs directly in the interrupt handler
> +  * sine we need the fastpath ID
> +  */
> + if (comp_type == FCOE_UNSOLIC_CQE_TYPE)

Re: [Open-FCoE] [PATCH RFC net-next 1/5] qed: Add support for hardware offloaded FCoE.

2016-12-28 Thread Hannes Reinecke
On 12/23/2016 08:17 PM, Dupuis, Chad wrote:
> From: Arun Easi 
> 
> This adds the backbone required for the various HW initalizations
> which are necessary for the FCoE driver (qedf) for QLogic FastLinQ
> 4 line of adapters - FW notification, resource initializations, etc.
> 
> Signed-off-by: Arun Easi 
> Signed-off-by: Yuval Mintz 
> ---
>  drivers/net/ethernet/qlogic/Kconfig   |   3 +
>  drivers/net/ethernet/qlogic/qed/Makefile  |   1 +
>  drivers/net/ethernet/qlogic/qed/qed.h |  11 +
>  drivers/net/ethernet/qlogic/qed/qed_cxt.c |  98 ++-
>  drivers/net/ethernet/qlogic/qed/qed_cxt.h |   3 +
>  drivers/net/ethernet/qlogic/qed/qed_dcbx.c|  11 +
>  drivers/net/ethernet/qlogic/qed/qed_dcbx.h|   1 +
>  drivers/net/ethernet/qlogic/qed/qed_dev.c | 205 -
>  drivers/net/ethernet/qlogic/qed/qed_dev_api.h |  42 +
>  drivers/net/ethernet/qlogic/qed/qed_fcoe.c| 990 
> ++
>  drivers/net/ethernet/qlogic/qed/qed_fcoe.h|  52 ++
>  drivers/net/ethernet/qlogic/qed/qed_hsi.h | 781 -
>  drivers/net/ethernet/qlogic/qed/qed_hw.c  |   3 +
>  drivers/net/ethernet/qlogic/qed/qed_ll2.c |  25 +
>  drivers/net/ethernet/qlogic/qed/qed_ll2.h |   2 +-
>  drivers/net/ethernet/qlogic/qed/qed_main.c|   7 +
>  drivers/net/ethernet/qlogic/qed/qed_mcp.c |   3 +
>  drivers/net/ethernet/qlogic/qed/qed_mcp.h |   1 +
>  drivers/net/ethernet/qlogic/qed/qed_reg_addr.h|   8 +
>  drivers/net/ethernet/qlogic/qed/qed_sp.h  |   4 +
>  drivers/net/ethernet/qlogic/qed/qed_sp_commands.c |   3 +
>  include/linux/qed/common_hsi.h|  10 +-
>  include/linux/qed/fcoe_common.h   | 715 
>  include/linux/qed/qed_fcoe_if.h   | 145 
>  include/linux/qed/qed_if.h|  39 +
>  25 files changed, 3152 insertions(+), 11 deletions(-)
>  create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.c
>  create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.h
>  create mode 100644 include/linux/qed/fcoe_common.h
>  create mode 100644 include/linux/qed/qed_fcoe_if.h
> 
> diff --git a/drivers/net/ethernet/qlogic/Kconfig 
> b/drivers/net/ethernet/qlogic/Kconfig
> index 3cfd105..737b303 100644
> --- a/drivers/net/ethernet/qlogic/Kconfig
> +++ b/drivers/net/ethernet/qlogic/Kconfig
> @@ -113,4 +113,7 @@ config QED_RDMA
>  config QED_ISCSI
>   bool
>  
> +config QED_FCOE
> + bool
> +
>  endif # NET_VENDOR_QLOGIC
> diff --git a/drivers/net/ethernet/qlogic/qed/Makefile 
> b/drivers/net/ethernet/qlogic/qed/Makefile
> index 729e437..e234083 100644
> --- a/drivers/net/ethernet/qlogic/qed/Makefile
> +++ b/drivers/net/ethernet/qlogic/qed/Makefile
> @@ -7,3 +7,4 @@ 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_ooo.o
> +qed-$(CONFIG_QED_FCOE) += qed_fcoe.o
> diff --git a/drivers/net/ethernet/qlogic/qed/qed.h 
> b/drivers/net/ethernet/qlogic/qed/qed.h
> index 44c184e..cbb4ebc 100644
> --- a/drivers/net/ethernet/qlogic/qed/qed.h
> +++ b/drivers/net/ethernet/qlogic/qed/qed.h
> @@ -36,6 +36,7 @@
>  #define QED_WFQ_UNIT 100
>  
>  #define ISCSI_BDQ_ID(_port_id) (_port_id)
> +#define FCOE_BDQ_ID(_port_id) ((_port_id) + 2)
>  #define QED_WID_SIZE(1024)
>  #define QED_PF_DEMS_SIZE(4)
>  
> @@ -143,6 +144,7 @@ struct qed_tunn_update_params {
>   */
>  enum qed_pci_personality {
>   QED_PCI_ETH,
> + QED_PCI_FCOE,
>   QED_PCI_ISCSI,
>   QED_PCI_ETH_ROCE,
>   QED_PCI_DEFAULT /* default in shmem */
> @@ -180,6 +182,7 @@ enum QED_FEATURE {
>   QED_VF,
>   QED_RDMA_CNQ,
>   QED_VF_L2_QUE,
> + QED_FCOE_CQ,
>   QED_MAX_FEATURES,
>  };
>  
> @@ -197,6 +200,7 @@ enum QED_PORT_MODE {
>  
>  enum qed_dev_cap {
>   QED_DEV_CAP_ETH,
> + QED_DEV_CAP_FCOE,
>   QED_DEV_CAP_ISCSI,
>   QED_DEV_CAP_ROCE,
>  };
> @@ -231,6 +235,10 @@ struct qed_hw_info {
>   u32 part_num[4];
>  
>   unsigned char   hw_mac_addr[ETH_ALEN];
> + u64 node_wwn;
> + u64 port_wwn;
> +
> + u16 num_fcoe_conns;
>  
>   struct qed_igu_info *p_igu_info;
>  
> @@ -386,6 +394,7 @@ struct qed_hwfn {
>   struct qed_ooo_info *p_ooo_info;
>   struct qed_rdma_info*p_rdma_info;
>   struct qed_iscsi_info   *p_iscsi_info;
> + struct qed_fcoe_info*p_fcoe_info;
>   struct qed_pf_paramspf_params;
>  
>   bool b_rdma_enabled_in_prs;
> @@ -594,11 +603,13 @@ struct qed_dev {
>  
>   u8  protocol;
>  #define IS_QED_ETH_IF(cdev) ((cdev)->protocol == 

Re: [PATCH v2 3/6] qedi: Add QLogic FastLinQ offload iSCSI driver framework.

2016-11-14 Thread Hannes Reinecke
On 11/15/2016 07:14 AM, Rangankar, Manish wrote:
> Hi Hannes,
> 
> Please find the response below,
> 
> On 11/11/16 10:13 PM, "Hannes Reinecke" <h...@suse.de> wrote:
> 
[ .. ]
>> Please use the irq-affinity rework from Christoph here; that'll save you
>> the additional msix vectors allocation.
> 
> The existing qed* driver(s) and common module (qed) framework is built on
> top of the older pci_enable_msix_*() API. The new framework requires
> re-work on the existing qed common module API. That would need
> co-ordination among other dependent drivers (e.g.: qede network driver,
> which is already in the tree). We would prefer to add this as a follow on
> (to the initial submission) effort, with additional testing done and
> submission co-ordinated across protocol drivers.
> 
Ok, fair enough.

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)


Re: [PATCH v2 5/6] qedi: Add support for iSCSI session management.

2016-11-11 Thread Hannes Reinecke

On 11/08/2016 07:57 AM, Manish Rangankar wrote:

This patch adds support for iscsi_transport LLD Login,
Logout, NOP-IN/NOP-OUT, Async, Reject PDU processing
and Firmware async event handling support.

Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravan...@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>
Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
Signed-off-by: Arun Easi <arun.e...@cavium.com>
Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
---
 drivers/scsi/qedi/qedi_fw.c| 1106 +++
 drivers/scsi/qedi/qedi_gbl.h   |   67 ++
 drivers/scsi/qedi/qedi_iscsi.c | 1611 
 drivers/scsi/qedi/qedi_iscsi.h |  232 ++
 drivers/scsi/qedi/qedi_main.c  |  166 +
 5 files changed, 3182 insertions(+)
 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_iscsi.c
 create mode 100644 drivers/scsi/qedi/qedi_iscsi.h


Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


Re: [PATCH v2 6/6] qedi: Add support for data path.

2016-11-11 Thread Hannes Reinecke

On 11/08/2016 07:57 AM, Manish Rangankar wrote:

This patch adds support for data path and TMF handling.

Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravan...@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>
Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
Signed-off-by: Arun Easi <arun.e...@cavium.com>
Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
---
 drivers/scsi/qedi/qedi_fw.c| 1272 
 drivers/scsi/qedi/qedi_gbl.h   |6 +
 drivers/scsi/qedi/qedi_iscsi.c |   13 +
 drivers/scsi/qedi/qedi_main.c  |4 +
 4 files changed, 1295 insertions(+)


Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


Re: [PATCH v2 4/6] qedi: Add LL2 iSCSI interface for offload iSCSI.

2016-11-11 Thread Hannes Reinecke

On 11/08/2016 07:57 AM, Manish Rangankar wrote:

This patch adds support for iscsiuio interface using Light L2 (LL2) qed
interface.

Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravan...@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>
Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
Signed-off-by: Arun Easi <arun.e...@cavium.com>
Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
---
 drivers/scsi/qedi/qedi.h  |  73 +
 drivers/scsi/qedi/qedi_main.c | 357 ++
 2 files changed, 430 insertions(+)


Oh well; and I thought we could do away with the iscsiuio thingie ...

Sigh.

But nevertheless,

Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


Re: [PATCH v2 3/6] qedi: Add QLogic FastLinQ offload iSCSI driver framework.

2016-11-11 Thread Hannes Reinecke

On 11/08/2016 07:57 AM, Manish Rangankar wrote:

The QLogic FastLinQ Driver for iSCSI (qedi) is the iSCSI specific module
for 41000 Series Converged Network Adapters by QLogic.

This patch consists of following changes:
  - MAINTAINERS Makefile and Kconfig changes for qedi,
  - PCI driver registration,
  - iSCSI host level initialization,
  - Debugfs and log level infrastructure.

Signed-off-by: Nilesh Javali 
Signed-off-by: Adheer Chandravanshi 
Signed-off-by: Chad Dupuis 
Signed-off-by: Saurav Kashyap 
Signed-off-by: Arun Easi 
Signed-off-by: Manish Rangankar 
---
 MAINTAINERS |6 +
 drivers/net/ethernet/qlogic/Kconfig |   12 -
 drivers/scsi/Kconfig|1 +
 drivers/scsi/Makefile   |1 +
 drivers/scsi/qedi/Kconfig   |   10 +
 drivers/scsi/qedi/Makefile  |5 +
 drivers/scsi/qedi/qedi.h|  291 +++
 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_hsi.h|   52 ++
 drivers/scsi/qedi/qedi_main.c   | 1616 +++
 drivers/scsi/qedi/qedi_sysfs.c  |   52 ++
 drivers/scsi/qedi/qedi_version.h|   14 +
 14 files changed, 2579 insertions(+), 12 deletions(-)
 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_hsi.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

diff --git a/MAINTAINERS b/MAINTAINERS
index e5c17a9..04eec14 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9934,6 +9934,12 @@ F:   drivers/net/ethernet/qlogic/qed/
 F: include/linux/qed/
 F: drivers/net/ethernet/qlogic/qede/

+QLOGIC QL41xxx ISCSI DRIVER
+M: qlogic-storage-upstr...@cavium.com
+L: linux-s...@vger.kernel.org
+S: Supported
+F: drivers/scsi/qedi/
+
 QNX4 FILESYSTEM
 M: Anders Larsen 
 W: http://www.alarsen.net/linux/qnx4fs/
diff --git a/drivers/net/ethernet/qlogic/Kconfig 
b/drivers/net/ethernet/qlogic/Kconfig
index 2832570..3cfd105 100644
--- a/drivers/net/ethernet/qlogic/Kconfig
+++ b/drivers/net/ethernet/qlogic/Kconfig
@@ -113,16 +113,4 @@ config QED_RDMA
 config QED_ISCSI
bool

-config QEDI
-   tristate "QLogic QED 25/40/100Gb iSCSI driver"
-   depends on QED
-   select QED_LL2
-   select QED_ISCSI
-   default n
-   ---help---
- This provides a temporary node that allows the compilation
- and logical testing of the hardware offload iSCSI support
- for QLogic QED. This would be replaced by the 'real' option
- once the QEDI driver is added [+relocated].
-
 endif # NET_VENDOR_QLOGIC
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 3e2bdb9..5cf03db 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1254,6 +1254,7 @@ config SCSI_QLOGICPTI

 source "drivers/scsi/qla2xxx/Kconfig"
 source "drivers/scsi/qla4xxx/Kconfig"
+source "drivers/scsi/qedi/Kconfig"

 config SCSI_LPFC
tristate "Emulex LightPulse Fibre Channel Support"
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 38d938d..da9e312 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -132,6 +132,7 @@ obj-$(CONFIG_PS3_ROM)   += ps3rom.o
 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)  += libiscsi.o bnx2i/
+obj-$(CONFIG_QEDI)  += libiscsi.o qedi/
 obj-$(CONFIG_BE2ISCSI) += libiscsi.o be2iscsi/
 obj-$(CONFIG_SCSI_ESAS2R)  += esas2r/
 obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o
diff --git a/drivers/scsi/qedi/Kconfig b/drivers/scsi/qedi/Kconfig
new file mode 100644
index 000..23ca8a2
--- /dev/null
+++ b/drivers/scsi/qedi/Kconfig
@@ -0,0 +1,10 @@
+config QEDI
+   tristate "QLogic QEDI 25/40/100Gb iSCSI Initiator Driver Support"
+   depends on PCI && SCSI
+   depends on QED
+   select SCSI_ISCSI_ATTRS
+   select QED_LL2
+   select QED_ISCSI
+   ---help---
+   This driver supports iSCSI offload for the QLogic FastLinQ
+   41000 Series Converged Network Adapters.
diff --git a/drivers/scsi/qedi/Makefile b/drivers/scsi/qedi/Makefile
new file mode 100644
index 000..2b3e16b
--- /dev/null
+++ b/drivers/scsi/qedi/Makefile
@@ -0,0 +1,5 @@
+obj-$(CONFIG_QEDI) := qedi.o
+qedi-y := qedi_main.o qedi_iscsi.o qedi_fw.o qedi_sysfs.o \
+   

Re: [PATCH v2 2/6] qed: Add iSCSI out of order packet handling.

2016-11-11 Thread Hannes Reinecke

On 11/08/2016 07:56 AM, Manish Rangankar wrote:

From: Yuval Mintz <yuval.mi...@cavium.com>

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 <arun.e...@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mi...@cavium.com>
---
 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  | 503 -
 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  | 173 ++
 drivers/net/ethernet/qlogic/qed/qed_roce.c |   1 +
 drivers/net/ethernet/qlogic/qed/qed_spq.c  |   9 +
 9 files changed, 1201 insertions(+), 12 deletions(-)
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ooo.c
 create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ooo.h


Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


Re: [PATCH v2 1/6] qed: Add support for hardware offloaded iSCSI.

2016-11-11 Thread Hannes Reinecke

On 11/08/2016 07:56 AM, Manish Rangankar wrote:

From: Yuval Mintz <yuval.mi...@cavium.com>

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 <arun.e...@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mi...@cavium.com>
---
 drivers/net/ethernet/qlogic/Kconfig|   15 +
 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_int.h  |1 -
 drivers/net/ethernet/qlogic/qed/qed_iscsi.c| 1276 
 drivers/net/ethernet/qlogic/qed/qed_iscsi.h|   52 +
 drivers/net/ethernet/qlogic/qed/qed_l2.c   |1 -
 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 +
 13 files changed, 1613 insertions(+), 4 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..2832570 100644
--- a/drivers/net/ethernet/qlogic/Kconfig
+++ b/drivers/net/ethernet/qlogic/Kconfig
@@ -110,4 +110,19 @@ config QEDE
 config QED_RDMA
bool

+config QED_ISCSI
+   bool
+
+config QEDI
+   tristate "QLogic QED 25/40/100Gb iSCSI driver"
+   depends on QED
+   select QED_LL2
+   select QED_ISCSI
+   default n
+   ---help---
+ This provides a temporary node that allows the compilation
+ and logical testing of the hardware offload iSCSI support
+ for QLogic QED. This would be replaced by the 'real' option
+ once the QEDI driver is added [+relocated].
+
 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;

10 connections? Only?
Hmm.

Other than that:

Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


Re: [RFC 2/6] qed: Add iSCSI out of order packet handling.

2016-10-19 Thread Hannes Reinecke
On 10/19/2016 07:01 AM, manish.rangan...@cavium.com wrote:
> 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 
> ---
>  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  | 559 
> +++--
>  drivers/net/ethernet/qlogic/qed/qed_ll2.h  |   9 +
>  drivers/net/ethernet/qlogic/qed/qed_ooo.c  | 510 ++
>  drivers/net/ethernet/qlogic/qed/qed_ooo.h  | 116 ++
>  drivers/net/ethernet/qlogic/qed/qed_roce.c |   1 +
>  drivers/net/ethernet/qlogic/qed/qed_spq.c  |   9 +
>  9 files changed, 1195 insertions(+), 26 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 b76669c..9121bf0 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_INFINIBAND_QEDR) += 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 a61b1c0..e5626ae 100644
> --- a/drivers/net/ethernet/qlogic/qed/qed.h
> +++ b/drivers/net/ethernet/qlogic/qed/qed.h
> @@ -380,6 +380,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 a4234c0..060e9a4 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"
> @@ -157,8 +158,10 @@ void qed_resc_free(struct qed_dev *cdev)
>   qed_ll2_free(p_hwfn, p_hwfn->p_ll2_info);
>  #endif
>   if (IS_ENABLED(CONFIG_QEDI) &&
> - p_hwfn->hw_info.personality == QED_PCI_ISCSI)
> + 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);
> @@ -416,6 +419,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
> @@ -543,6 +547,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 */
> @@ -598,8 +606,10 @@ void qed_resc_setup(struct qed_dev *cdev)
>   qed_ll2_setup(p_hwfn, p_hwfn->p_ll2_info);
>  #endif
>   if (IS_ENABLED(CONFIG_QEDI) &&
> - p_hwfn->hw_info.personality == QED_PCI_ISCSI)
> + 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 e67f3c9..4ce12e9 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 

Re: [RFC 1/6] qed: Add support for hardware offloaded iSCSI.

2016-10-19 Thread Hannes Reinecke
On 10/19/2016 07:01 AM, manish.rangan...@cavium.com wrote:
> 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 
> ---
>  drivers/net/ethernet/qlogic/Kconfig|   15 +
>  drivers/net/ethernet/qlogic/qed/Makefile   |1 +
>  drivers/net/ethernet/qlogic/qed/qed.h  |8 +-
>  drivers/net/ethernet/qlogic/qed/qed_dev.c  |   15 +
>  drivers/net/ethernet/qlogic/qed/qed_int.h  |1 -
>  drivers/net/ethernet/qlogic/qed/qed_iscsi.c| 1310 
> 
>  drivers/net/ethernet/qlogic/qed/qed_iscsi.h|   52 +
>  drivers/net/ethernet/qlogic/qed/qed_l2.c   |1 -
>  drivers/net/ethernet/qlogic/qed/qed_ll2.c  |   35 +-
>  drivers/net/ethernet/qlogic/qed/qed_main.c |2 -
>  drivers/net/ethernet/qlogic/qed/qed_mcp.h  |6 -
>  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   |  249 +
>  15 files changed, 1692 insertions(+), 22 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 0df1391f9..bad4fae 100644
> --- a/drivers/net/ethernet/qlogic/Kconfig
> +++ b/drivers/net/ethernet/qlogic/Kconfig
> @@ -118,4 +118,19 @@ config INFINIBAND_QEDR
> for QLogic QED. This would be replaced by the 'real' option
> once the QEDR driver is added [+relocated].
>  
> +config QED_ISCSI
> + bool
> +
> +config QEDI
> + tristate "QLogic QED 25/40/100Gb iSCSI driver"
> + depends on QED
> + select QED_LL2
> + select QED_ISCSI
> + default n
> + ---help---
> +   This provides a temporary node that allows the compilation
> +   and logical testing of the hardware offload iSCSI support
> +   for QLogic QED. This would be replaced by the 'real' option
> +   once the QEDI driver is added [+relocated].
> +
>  endif # NET_VENDOR_QLOGIC
> diff --git a/drivers/net/ethernet/qlogic/qed/Makefile 
> b/drivers/net/ethernet/qlogic/qed/Makefile
> index cda0af7..b76669c 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_INFINIBAND_QEDR) += 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 653bb57..a61b1c0 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)
>  
> @@ -167,6 +168,7 @@ enum QED_RESOURCES {
>   QED_ILT,
>   QED_LL2_QUEUE,
>   QED_RDMA_STATS_QUEUE,
> + QED_CMDQS_CQS,
>   QED_MAX_RESC,
>  };
>  
> @@ -379,6 +381,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;
> @@ -578,6 +581,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;
> @@ -591,6 +596,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;
>  
> @@ -600,7 +606,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 754f6a9..a4234c0 100644
> --- 

Re: [RFC 6/6] qedi: Add support for data path.

2016-10-19 Thread Hannes Reinecke
On 10/19/2016 07:01 AM, manish.rangan...@cavium.com wrote:
> From: Manish Rangankar 
> 
> This patch adds support for data path and TMF handling.
> 
> Signed-off-by: Nilesh Javali 
> Signed-off-by: Adheer Chandravanshi 
> Signed-off-by: Chad Dupuis 
> Signed-off-by: Saurav Kashyap 
> Signed-off-by: Arun Easi 
> Signed-off-by: Manish Rangankar 
> ---
>  drivers/scsi/qedi/qedi_fw.c| 1282 
> 
>  drivers/scsi/qedi/qedi_gbl.h   |6 +
>  drivers/scsi/qedi/qedi_iscsi.c |6 +
>  drivers/scsi/qedi/qedi_main.c  |4 +
>  4 files changed, 1298 insertions(+)
> 
> diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
> index a820785..af1e14d 100644
> --- a/drivers/scsi/qedi/qedi_fw.c
> +++ b/drivers/scsi/qedi/qedi_fw.c
> @@ -147,6 +147,114 @@ static void qedi_process_text_resp(struct qedi_ctx 
> *qedi,
>   spin_unlock(>back_lock);
>  }
>  
> +static void qedi_tmf_resp_work(struct work_struct *work)
> +{
> + struct qedi_cmd *qedi_cmd =
> + container_of(work, struct qedi_cmd, tmf_work);
> + struct qedi_conn *qedi_conn = qedi_cmd->conn;
> + struct qedi_ctx *qedi = qedi_conn->qedi;
> + struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
> + struct iscsi_session *session = conn->session;
> + struct iscsi_tm_rsp *resp_hdr_ptr;
> + struct iscsi_cls_session *cls_sess;
> + int rval = 0;
> +
> + set_bit(QEDI_CONN_FW_CLEANUP, _conn->flags);
> + resp_hdr_ptr =  (struct iscsi_tm_rsp *)qedi_cmd->tmf_resp_buf;
> + cls_sess = iscsi_conn_to_session(qedi_conn->cls_conn);
> +
> + iscsi_block_session(session->cls_session);
> + rval = qedi_cleanup_all_io(qedi, qedi_conn, qedi_cmd->task, true);
> + if (rval) {
> + clear_bit(QEDI_CONN_FW_CLEANUP, _conn->flags);
> + qedi_clear_task_idx(qedi, qedi_cmd->task_id);
> + iscsi_unblock_session(session->cls_session);
> + return;
> + }
> +
> + iscsi_unblock_session(session->cls_session);
> + qedi_clear_task_idx(qedi, qedi_cmd->task_id);
> +
> + spin_lock(>back_lock);
> + __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0);
> + spin_unlock(>back_lock);
> + kfree(resp_hdr_ptr);
> + clear_bit(QEDI_CONN_FW_CLEANUP, _conn->flags);
> +}
> +
> +static void qedi_process_tmf_resp(struct qedi_ctx *qedi,
> +   union iscsi_cqe *cqe,
> +   struct iscsi_task *task,
> +   struct qedi_conn *qedi_conn)
> +
> +{
> + struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
> + struct iscsi_session *session = conn->session;
> + struct iscsi_tmf_response_hdr *cqe_tmp_response;
> + struct iscsi_tm_rsp *resp_hdr_ptr;
> + struct iscsi_tm *tmf_hdr;
> + struct qedi_cmd *qedi_cmd = NULL;
> + u32 *tmp;
> +
> + cqe_tmp_response = >cqe_common.iscsi_hdr.tmf_response;
> +
> + qedi_cmd = task->dd_data;
> + qedi_cmd->tmf_resp_buf = kzalloc(sizeof(*resp_hdr_ptr), GFP_KERNEL);
> + if (!qedi_cmd->tmf_resp_buf) {
> + QEDI_ERR(>dbg_ctx,
> +  "Failed to allocate resp buf, cid=0x%x\n",
> +   qedi_conn->iscsi_conn_id);
> + return;
> + }
> +
> + spin_lock(>back_lock);
> + resp_hdr_ptr =  (struct iscsi_tm_rsp *)qedi_cmd->tmf_resp_buf;
> + memset(resp_hdr_ptr, 0, sizeof(struct iscsi_tm_rsp));
> +
> + /* Fill up the header */
> + resp_hdr_ptr->opcode = cqe_tmp_response->opcode;
> + resp_hdr_ptr->flags = cqe_tmp_response->hdr_flags;
> + resp_hdr_ptr->response = cqe_tmp_response->hdr_response;
> + resp_hdr_ptr->hlength = 0;
> +
> + hton24(resp_hdr_ptr->dlength,
> +(cqe_tmp_response->hdr_second_dword &
> + ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_MASK));
> + tmp = (u32 *)resp_hdr_ptr->dlength;
> + resp_hdr_ptr->itt = build_itt(cqe->cqe_solicited.itid,
> +   conn->session->age);
> + resp_hdr_ptr->statsn = cpu_to_be32(cqe_tmp_response->stat_sn);
> + resp_hdr_ptr->exp_cmdsn  = cpu_to_be32(cqe_tmp_response->exp_cmd_sn);
> + resp_hdr_ptr->max_cmdsn = cpu_to_be32(cqe_tmp_response->max_cmd_sn);
> +
> + tmf_hdr = (struct iscsi_tm *)qedi_cmd->task->hdr;
> +
> + if (likely(qedi_cmd->io_cmd_in_list)) {
> + qedi_cmd->io_cmd_in_list = false;
> + list_del_init(_cmd->io_cmd);
> + qedi_conn->active_cmd_count--;
> + }
> +
> + if (((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
> +   ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) ||
> + ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
> +   ISCSI_TM_FUNC_TARGET_WARM_RESET) ||
> + ((tmf_hdr->flags & 

Re: [RFC 5/6] qedi: Add support for iSCSI session management.

2016-10-19 Thread Hannes Reinecke
On 10/19/2016 07:01 AM, manish.rangan...@cavium.com wrote:
> From: Manish Rangankar 
> 
> This patch adds support for iscsi_transport LLD Login,
> Logout, NOP-IN/NOP-OUT, Async, Reject PDU processing
> and Firmware async event handling support.
> 
> Signed-off-by: Nilesh Javali 
> Signed-off-by: Adheer Chandravanshi 
> Signed-off-by: Chad Dupuis 
> Signed-off-by: Saurav Kashyap 
> Signed-off-by: Arun Easi 
> Signed-off-by: Manish Rangankar 
> ---
>  drivers/scsi/qedi/qedi_fw.c| 1123 
>  drivers/scsi/qedi/qedi_gbl.h   |   67 ++
>  drivers/scsi/qedi/qedi_iscsi.c | 1604 
> 
>  drivers/scsi/qedi/qedi_iscsi.h |  228 ++
>  drivers/scsi/qedi/qedi_main.c  |  164 
>  5 files changed, 3186 insertions(+)
>  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_iscsi.c
>  create mode 100644 drivers/scsi/qedi/qedi_iscsi.h
> 
> diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
> new file mode 100644
> index 000..a820785
> --- /dev/null
> +++ b/drivers/scsi/qedi/qedi_fw.c
> @@ -0,0 +1,1123 @@
> +/*
> + * QLogic iSCSI Offload Driver
> + * Copyright (c) 2016 Cavium Inc.
> + *
> + * This software is available under the terms of the GNU General Public 
> License
> + * (GPL) Version 2, available from the file COPYING in the main directory of
> + * this source tree.
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#include "qedi.h"
> +#include "qedi_iscsi.h"
> +#include "qedi_gbl.h"
> +
> +static int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn,
> +struct iscsi_task *mtask);
> +
> +void qedi_iscsi_unmap_sg_list(struct qedi_cmd *cmd)
> +{
> + struct scsi_cmnd *sc = cmd->scsi_cmd;
> +
> + if (cmd->io_tbl.sge_valid && sc) {
> + scsi_dma_unmap(sc);
> + cmd->io_tbl.sge_valid = 0;
> + }
> +}
> +
> +static void qedi_process_logout_resp(struct qedi_ctx *qedi,
> +  union iscsi_cqe *cqe,
> +  struct iscsi_task *task,
> +  struct qedi_conn *qedi_conn)
> +{
> + struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
> + struct iscsi_logout_rsp *resp_hdr;
> + struct iscsi_session *session = conn->session;
> + struct iscsi_logout_response_hdr *cqe_logout_response;
> + struct qedi_cmd *cmd;
> +
> + cmd = (struct qedi_cmd *)task->dd_data;
> + cqe_logout_response = >cqe_common.iscsi_hdr.logout_response;
> + spin_lock(>back_lock);
> + resp_hdr = (struct iscsi_logout_rsp *)_conn->gen_pdu.resp_hdr;
> + memset(resp_hdr, 0, sizeof(struct iscsi_hdr));
> + resp_hdr->opcode = cqe_logout_response->opcode;
> + resp_hdr->flags = cqe_logout_response->flags;
> + resp_hdr->hlength = 0;
> +
> + resp_hdr->itt = build_itt(cqe->cqe_solicited.itid, conn->session->age);
> + resp_hdr->statsn = cpu_to_be32(cqe_logout_response->stat_sn);
> + resp_hdr->exp_cmdsn = cpu_to_be32(cqe_logout_response->exp_cmd_sn);
> + resp_hdr->max_cmdsn = cpu_to_be32(cqe_logout_response->max_cmd_sn);
> +
> + resp_hdr->t2wait = cpu_to_be32(cqe_logout_response->time2wait);
> + resp_hdr->t2retain = cpu_to_be32(cqe_logout_response->time2retain);
> +
> + QEDI_INFO(>dbg_ctx, QEDI_LOG_TID,
> +   "Freeing tid=0x%x for cid=0x%x\n",
> +   cmd->task_id, qedi_conn->iscsi_conn_id);
> +
> + if (likely(cmd->io_cmd_in_list)) {
> + cmd->io_cmd_in_list = false;
> + list_del_init(>io_cmd);
> + qedi_conn->active_cmd_count--;
> + } else {
> + QEDI_INFO(>dbg_ctx, QEDI_LOG_INFO,
> +   "Active cmd list node already deleted, tid=0x%x, 
> cid=0x%x, io_cmd_node=%p\n",
> +   cmd->task_id, qedi_conn->iscsi_conn_id,
> +   >io_cmd);
> + }
> +
> + cmd->state = RESPONSE_RECEIVED;
> + qedi_clear_task_idx(qedi, cmd->task_id);
> + __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr, NULL, 0);
> +
> + spin_unlock(>back_lock);
> +}
> +
> +static void qedi_process_text_resp(struct qedi_ctx *qedi,
> +union iscsi_cqe *cqe,
> +struct iscsi_task *task,
> +struct qedi_conn *qedi_conn)
> +{
> + struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
> + struct iscsi_session *session = conn->session;
> + struct iscsi_task_context *task_ctx;
> + struct iscsi_text_rsp *resp_hdr_ptr;
> + struct iscsi_text_response_hdr *cqe_text_response;
> + struct qedi_cmd *cmd;
> + int pld_len;
> + u32 *tmp;
> +
> + cmd = (struct 

Re: [RFC 3/6] qedi: Add QLogic FastLinQ offload iSCSI driver framework.

2016-10-19 Thread Hannes Reinecke
On 10/19/2016 07:01 AM, manish.rangan...@cavium.com wrote:
> From: Manish Rangankar 
> 
> The QLogic FastLinQ Driver for iSCSI (qedi) is the iSCSI specific module
> for 41000 Series Converged Network Adapters by QLogic.
> 
> This patch consists of following changes:
>   - MAINTAINERS Makefile and Kconfig changes for qedi,
>   - PCI driver registration,
>   - iSCSI host level initialization,
>   - Debugfs and log level infrastructure.
> 
> Signed-off-by: Nilesh Javali 
> Signed-off-by: Adheer Chandravanshi 
> Signed-off-by: Chad Dupuis 
> Signed-off-by: Saurav Kashyap 
> Signed-off-by: Arun Easi 
> Signed-off-by: Manish Rangankar 
> ---
>  MAINTAINERS |6 +
>  drivers/net/ethernet/qlogic/Kconfig |   12 -
>  drivers/scsi/Kconfig|1 +
>  drivers/scsi/Makefile   |1 +
>  drivers/scsi/qedi/Kconfig   |   10 +
>  drivers/scsi/qedi/Makefile  |5 +
>  drivers/scsi/qedi/qedi.h|  286 +++
>  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_hsi.h|   52 ++
>  drivers/scsi/qedi/qedi_main.c   | 1550 
> +++
>  drivers/scsi/qedi/qedi_sysfs.c  |   52 ++
>  drivers/scsi/qedi/qedi_version.h|   14 +
>  14 files changed, 2508 insertions(+), 12 deletions(-)
>  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_hsi.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
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 5e925a2..906d05f 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9909,6 +9909,12 @@ F: drivers/net/ethernet/qlogic/qed/
>  F:   include/linux/qed/
>  F:   drivers/net/ethernet/qlogic/qede/
>  
> +QLOGIC QL41xxx ISCSI DRIVER
> +M:   qlogic-storage-upstr...@cavium.com
> +L:   linux-s...@vger.kernel.org
> +S:   Supported
> +F:   drivers/scsi/qedi/
> +
>  QNX4 FILESYSTEM
>  M:   Anders Larsen 
>  W:   http://www.alarsen.net/linux/qnx4fs/
> diff --git a/drivers/net/ethernet/qlogic/Kconfig 
> b/drivers/net/ethernet/qlogic/Kconfig
> index bad4fae..28b4366 100644
> --- a/drivers/net/ethernet/qlogic/Kconfig
> +++ b/drivers/net/ethernet/qlogic/Kconfig
> @@ -121,16 +121,4 @@ config INFINIBAND_QEDR
>  config QED_ISCSI
>   bool
>  
> -config QEDI
> - tristate "QLogic QED 25/40/100Gb iSCSI driver"
> - depends on QED
> - select QED_LL2
> - select QED_ISCSI
> - default n
> - ---help---
> -   This provides a temporary node that allows the compilation
> -   and logical testing of the hardware offload iSCSI support
> -   for QLogic QED. This would be replaced by the 'real' option
> -   once the QEDI driver is added [+relocated].
> -
>  endif # NET_VENDOR_QLOGIC
Huh? You just introduce this one in patch 1/6.
Please fold them together so that this can be omitted.

> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
> index 3e2bdb9..5cf03db 100644
> --- a/drivers/scsi/Kconfig
> +++ b/drivers/scsi/Kconfig
> @@ -1254,6 +1254,7 @@ config SCSI_QLOGICPTI
>  
>  source "drivers/scsi/qla2xxx/Kconfig"
>  source "drivers/scsi/qla4xxx/Kconfig"
> +source "drivers/scsi/qedi/Kconfig"
>  
>  config SCSI_LPFC
>   tristate "Emulex LightPulse Fibre Channel Support"
> diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
> index 38d938d..da9e312 100644
> --- a/drivers/scsi/Makefile
> +++ b/drivers/scsi/Makefile
> @@ -132,6 +132,7 @@ obj-$(CONFIG_PS3_ROM) += ps3rom.o
>  obj-$(CONFIG_SCSI_CXGB3_ISCSI)   += libiscsi.o libiscsi_tcp.o cxgbi/
>  obj-$(CONFIG_SCSI_CXGB4_ISCSI)   += libiscsi.o libiscsi_tcp.o cxgbi/
>  obj-$(CONFIG_SCSI_BNX2_ISCSI)+= libiscsi.o bnx2i/
> +obj-$(CONFIG_QEDI)  += libiscsi.o qedi/
>  obj-$(CONFIG_BE2ISCSI)   += libiscsi.o be2iscsi/
>  obj-$(CONFIG_SCSI_ESAS2R)+= esas2r/
>  obj-$(CONFIG_SCSI_PMCRAID)   += pmcraid.o
> diff --git a/drivers/scsi/qedi/Kconfig b/drivers/scsi/qedi/Kconfig
> new file mode 100644
> index 000..23ca8a2
> --- /dev/null
> +++ b/drivers/scsi/qedi/Kconfig
> @@ -0,0 +1,10 @@
> +config QEDI
> + tristate "QLogic QEDI 25/40/100Gb iSCSI Initiator Driver Support"
> + depends on PCI && SCSI
> + depends on QED
> + select SCSI_ISCSI_ATTRS
> + select QED_LL2
> + select QED_ISCSI
> + ---help---
> + This 

Re: [RFC 4/6] qedi: Add LL2 iSCSI interface for offload iSCSI.

2016-10-19 Thread Hannes Reinecke
On 10/19/2016 07:01 AM, manish.rangan...@cavium.com wrote:
> From: Manish Rangankar <manish.rangan...@cavium.com>
> 
> This patch adds support for iscsiuio interface using Light L2 (LL2) qed
> interface.
> 
> Signed-off-by: Nilesh Javali <nilesh.jav...@cavium.com>
> Signed-off-by: Adheer Chandravanshi <adheer.chandravan...@qlogic.com>
> Signed-off-by: Chad Dupuis <chad.dup...@cavium.com>
> Signed-off-by: Saurav Kashyap <saurav.kash...@cavium.com>
> Signed-off-by: Arun Easi <arun.e...@cavium.com>
> Signed-off-by: Manish Rangankar <manish.rangan...@cavium.com>
> ---
>  drivers/scsi/qedi/qedi.h  |  73 +
>  drivers/scsi/qedi/qedi_main.c | 357 
> ++++++
>  2 files changed, 430 insertions(+)
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

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)


Re: [PATCHv2 3/4] pci: Determine actual VPD size on first access

2016-08-10 Thread Hannes Reinecke
On 08/09/2016 08:12 PM, Alexander Duyck wrote:
> On Tue, Aug 9, 2016 at 5:54 AM, Alexey Kardashevskiy <a...@ozlabs.ru> wrote:
>> On 10/02/16 08:04, Bjorn Helgaas wrote:
>>> On Wed, Jan 13, 2016 at 12:25:34PM +0100, Hannes Reinecke wrote:
>>>> PCI-2.2 VPD entries have a maximum size of 32k, but might actually
>>>> be smaller than that. To figure out the actual size one has to read
>>>> the VPD area until the 'end marker' is reached.
>>>> Trying to read VPD data beyond that marker results in 'interesting'
>>>> effects, from simple read errors to crashing the card. And to make
>>>> matters worse not every PCI card implements this properly, leaving
>>>> us with no 'end' marker or even completely invalid data.
>>>> This path tries to determine the size of the VPD data.
>>>> If no valid data can be read an I/O error will be returned when
>>>> reading the sysfs attribute.
>>
>>
>> I have a problem with this particular feature as today VFIO uses this
>> pci_vpd_ API to virtualize access to VPD and the existing code assumes
>> there is just one VPD block with 0x2 start and 0xf end. However I have at
>> least one device where this is not true - "10 Gigabit Ethernet-SR PCI
>> Express Adapter" - it has 2 blocks (made a script to read/parse it as
>> /sys/bus/pci/devices/0001\:03\:00.0/vpd shows it wrong):
> 
> The PCI spec is what essentially assumes that there is only one block.
> If I am not mistaken in the case of this device the second block here
> actually contains device configuration data, not actual VPD data.  The
> issue here is that the second block is being accessed as VPD when it
> isn't.
> 
>> # Large item 42 bytes; name 0x2 Identifier String
>> #002d Large item 74 bytes; name 0x10
>> #007a Small item 1 bytes; name 0xf End Tag
>> ---
>> #0c00 Large item 16 bytes; name 0x2 Identifier String
>> #0c13 Large item 234 bytes; name 0x10
>> #0d00 Large item 252 bytes; name 0x11
>> #0dff Small item 0 bytes; name 0xf End Tag
> 
> The second block here is driver proprietary setup bits.
> 
>> The cxgb3 driver is reading the second bit starting from 0xc00 but since
>> the size is wrongly detected as 0x7c, VFIO blocks access beyond it and the
>> guest driver fails to probe.
>>
>> I also cannot find a clause in the PCI 3.0 spec saying that there must be
>> just a single block, is it there?
> 
> The problem is we need to be able to parse it.  The spec defines a
> series of tags that can be used starting at offset 0.  That is how we
> are supposed to get around through the VPD data.  The problem is we
> can't have more than one end tag and what appears to be happening here
> is that we are defining a second block of data which uses the same
> formatting as VPD but is not VPD.
> 
>> What would the correct fix be? Scanning all 32k of VPD is not an option I
>> suppose as this is what this patch is trying to avoid. Thanks.
> 
> I adding the current cxgb3 maintainer and netdev list to the Cc.  This
> is something that can probably be addressed via a PCI quirk as what
> needs to happen is that we need to extend the VPD in the case of this
> part in order to include this second block.  As long as we can read
> the VPD data all the way out to 0xdff odds are we could probably just
> have the size arbitrarily increased to 0xe00 via the quirk and then
> you would be able to access all of the VPD for the device.  We already
> have code making other modifications to drivers/pci/quirks.c for
> several Broadcom devices and probably just need something similar to
> allow extended access in the case of these devices.
> 
Yes, that's what I think, too.
The Broadcom quirk should work here, too.
(Didn't we do that already?)

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)


[PATCH] fddi: Fixup potential uninitialized bars

2016-01-25 Thread Hannes Reinecke
dfx_get_bars() allocates the various bars, depending on the
bus type. But as the function itself returns void and there
is no default selection there is a risk of the function
returning without allocating any bars.
This patch moves the entries around so that PCI is assumed
to the the default bus, and adds a WARN_ON check if that
should no be the case.
And I've made some minor code reshuffles to keep checkpatch
happy.

Signed-off-by: Hannes Reinecke <h...@suse.com>
---
 drivers/net/fddi/defxx.c | 29 -
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
index 7f975a2..5fcaf03 100644
--- a/drivers/net/fddi/defxx.c
+++ b/drivers/net/fddi/defxx.c
@@ -434,19 +434,10 @@ static void dfx_port_read_long(DFX_board_t *bp, int 
offset, u32 *data)
 static void dfx_get_bars(struct device *bdev,
 resource_size_t *bar_start, resource_size_t *bar_len)
 {
-   int dfx_bus_pci = dev_is_pci(bdev);
int dfx_bus_eisa = DFX_BUS_EISA(bdev);
int dfx_bus_tc = DFX_BUS_TC(bdev);
int dfx_use_mmio = DFX_MMIO || dfx_bus_tc;
 
-   if (dfx_bus_pci) {
-   int num = dfx_use_mmio ? 0 : 1;
-
-   bar_start[0] = pci_resource_start(to_pci_dev(bdev), num);
-   bar_len[0] = pci_resource_len(to_pci_dev(bdev), num);
-   bar_start[2] = bar_start[1] = 0;
-   bar_len[2] = bar_len[1] = 0;
-   }
if (dfx_bus_eisa) {
unsigned long base_addr = to_eisa_device(bdev)->base_addr;
resource_size_t bar_lo;
@@ -476,13 +467,25 @@ static void dfx_get_bars(struct device *bdev,
bar_len[1] = PI_ESIC_K_BURST_HOLDOFF_LEN;
bar_start[2] = base_addr + PI_ESIC_K_ESIC_CSR;
bar_len[2] = PI_ESIC_K_ESIC_CSR_LEN;
-   }
-   if (dfx_bus_tc) {
+   } else if (dfx_bus_tc) {
bar_start[0] = to_tc_dev(bdev)->resource.start +
   PI_TC_K_CSR_OFFSET;
bar_len[0] = PI_TC_K_CSR_LEN;
-   bar_start[2] = bar_start[1] = 0;
-   bar_len[2] = bar_len[1] = 0;
+   bar_start[1] = 0;
+   bar_len[1] = 0;
+   bar_start[2] = 0;
+   bar_len[2] = 0;
+   } else {
+   /* Assume PCI */
+   int num = dfx_use_mmio ? 0 : 1;
+
+   WARN_ON(!dev_is_pci(bdev));
+   bar_start[0] = pci_resource_start(to_pci_dev(bdev), num);
+   bar_len[0] = pci_resource_len(to_pci_dev(bdev), num);
+   bar_start[1] = 0;
+   bar_len[1] = 0;
+   bar_start[2] = 0;
+   bar_len[2] = 0;
}
 }
 
-- 
1.8.5.6



Re: [RFC PATCH 0/4] Make iSCSI network namespace aware

2015-05-21 Thread Hannes Reinecke
On 05/20/2015 08:45 PM, Andy Grover wrote:
 On 05/13/2015 03:12 PM, Chris Leech wrote:
 This is only about the structures and functionality involved in
 maintaining the
 iSCSI session, the SCSI host along with it's discovered targets
 and devices has
 no association with network namespaces.

 These patches are functional, but not complete.  There's no
 isolation enforced
 in the kernel just yet, so it relies on well behaved userspace.  I
 plan on
 fixing that, but wanted some feedback on the idea and approach so
 far.
 
 Seems like a good direction, to me.
 
 What would be the extent of the userspace (open-iscsi) changes
 needed to go along with this?
 
What I would like to see is to split off iscsid to have one
instance/process per session.
With that we could trivially run open-iscsi in containers and
stufflike; currently it'll be hard as there really is only one
iscsid expected to be running in a system.

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries  Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] New Kernel Bugs

2007-11-14 Thread Hannes Reinecke
Matthew Wilcox wrote:
 On Wed, Nov 14, 2007 at 12:46:20AM -0700, Denys Vlasenko wrote:
 Finally they replied and asked to rediff it against their
 git tree. I did that and sent patches back. No reply since then.

 And mind you, the patch is not trying to do anything
 complex, it mostly moves code around, removes 'inline',
 adds 'const'. What should I think about it?
 
 I'm waiting for an ACK/NAK from Hannes, the maintainer.  What should I
 do?
 
I haven't actually been able to test it here (too busy, sorry). If someone
else confirms it does it's job then

Acked-by: Hannes Reinecke [EMAIL PROTECTED]

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries  Storage
[EMAIL PROTECTED] +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 2/2][BNX2]: Add iSCSI support to BNX2 devices.

2007-09-25 Thread Hannes Reinecke
Hi Tomo,

FUJITA Tomonori wrote:
 On Sat, 8 Sep 2007 13:00:36 +0100
 Christoph Hellwig [EMAIL PROTECTED] wrote:
 
 On Sat, Sep 08, 2007 at 07:32:27AM -0400, Jeff Garzik wrote:
 FUJITA Tomonori wrote:
 Yeah, iommu code ignores the lld limitations (the problem is that the
 lld limitations are in request_queue and iommu code can't access to
 request_queue). There is no way to tell iommu code about the lld
 limitations.

 This fact very much wants fixing.

 Absolutely.  Unfortunately everyone wastes their time on creating workarounds
 instead of fixing the underlying problem.
 
 Any ideas on how to fix this?
 
 I chatted to Jens and James on this last week.
 
 - we could just copies the lld limitations to device structure. it's
 hacky but device structure already has hacky stuff.
 
 - we could just link device structure to request_queue structure so
 that iommu code can see request_queue structure.
 
 - we could remove the lld limitations in request_queue strucutre and
 have a new strucutre (something like struct io_restrictions). then
 somehow we could link the new structure with request_queue and device
 strucutres.
 
I'd prefer the latter. These struct io_restrictions could then be used
by dm (which has it's own version right now) to merge queue capabilities.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries  Storage
[EMAIL PROTECTED] +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html