From: Hannes Reinecke <hare@suse.de>
To: Narsimhulu Musini <nmusini@cisco.com>,
JBottomley@Parallels.com, linux-scsi@vger.kernel.org
Cc: Sesidhar Baddela <sebaddel@cisco.com>
Subject: Re: [PATCH 6/9] snic:Add low level queuing interfaces
Date: Mon, 02 Mar 2015 14:32:30 +0100 [thread overview]
Message-ID: <54F4666E.3020609@suse.de> (raw)
In-Reply-To: <1423586616-18177-7-git-send-email-nmusini@cisco.com>
On 02/10/2015 05:43 PM, Narsimhulu Musini wrote:
> These files contain low level queueing interfaces includes
> hardware queues, and management of hardware features.
>
> Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
> Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
> ---
> drivers/scsi/snic/cq_desc.h | 77 ++++
> drivers/scsi/snic/cq_enet_desc.h | 38 ++
> drivers/scsi/snic/vnic_cq.c | 86 ++++
> drivers/scsi/snic/vnic_cq.h | 120 +++++
> drivers/scsi/snic/vnic_cq_fw.h | 62 +++
> drivers/scsi/snic/vnic_dev.c | 895 ++++++++++++++++++++++++++++++++++++++
> drivers/scsi/snic/vnic_dev.h | 165 +++++++
> drivers/scsi/snic/vnic_devcmd.h | 393 +++++++++++++++++
> drivers/scsi/snic/vnic_intr.c | 59 +++
> drivers/scsi/snic/vnic_intr.h | 127 ++++++
> drivers/scsi/snic/vnic_resource.h | 68 +++
> drivers/scsi/snic/vnic_snic.h | 54 +++
> drivers/scsi/snic/vnic_stats.h | 68 +++
> drivers/scsi/snic/vnic_wq.c | 236 ++++++++++
> drivers/scsi/snic/vnic_wq.h | 187 ++++++++
> drivers/scsi/snic/wq_enet_desc.h | 96 ++++
> 16 files changed, 2731 insertions(+)
> create mode 100644 drivers/scsi/snic/cq_desc.h
> create mode 100644 drivers/scsi/snic/cq_enet_desc.h
> create mode 100644 drivers/scsi/snic/vnic_cq.c
> create mode 100644 drivers/scsi/snic/vnic_cq.h
> create mode 100644 drivers/scsi/snic/vnic_cq_fw.h
> create mode 100644 drivers/scsi/snic/vnic_dev.c
> create mode 100644 drivers/scsi/snic/vnic_dev.h
> create mode 100644 drivers/scsi/snic/vnic_devcmd.h
> create mode 100644 drivers/scsi/snic/vnic_intr.c
> create mode 100644 drivers/scsi/snic/vnic_intr.h
> create mode 100644 drivers/scsi/snic/vnic_resource.h
> create mode 100644 drivers/scsi/snic/vnic_snic.h
> create mode 100644 drivers/scsi/snic/vnic_stats.h
> create mode 100644 drivers/scsi/snic/vnic_wq.c
> create mode 100644 drivers/scsi/snic/vnic_wq.h
> create mode 100644 drivers/scsi/snic/wq_enet_desc.h
>
> diff --git a/drivers/scsi/snic/cq_desc.h b/drivers/scsi/snic/cq_desc.h
> new file mode 100644
> index 0000000..a529056
> --- /dev/null
> +++ b/drivers/scsi/snic/cq_desc.h
> @@ -0,0 +1,77 @@
> +/*
> + * Copyright 2014 Cisco Systems, Inc. All rights reserved.
> + *
> + * This program is free software; you may redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#ifndef _CQ_DESC_H_
> +#define _CQ_DESC_H_
> +
> +/*
> + * Completion queue descriptor types
> + */
> +enum cq_desc_types {
> + CQ_DESC_TYPE_WQ_ENET = 0,
> + CQ_DESC_TYPE_DESC_COPY = 1,
> + CQ_DESC_TYPE_WQ_EXCH = 2,
> + CQ_DESC_TYPE_RQ_ENET = 3,
> + CQ_DESC_TYPE_RQ_FCP = 4,
> +};
> +
> +/* Completion queue descriptor: 16B
> + *
> + * All completion queues have this basic layout. The
> + * type_specific area is unique for each completion
> + * queue type.
> + */
> +struct cq_desc {
> + __le16 completed_index;
> + __le16 q_number;
> + u8 type_specific[11];
> + u8 type_color;
> +};
> +
> +#define CQ_DESC_TYPE_BITS 4
> +#define CQ_DESC_TYPE_MASK ((1 << CQ_DESC_TYPE_BITS) - 1)
> +#define CQ_DESC_COLOR_MASK 1
> +#define CQ_DESC_COLOR_SHIFT 7
> +#define CQ_DESC_Q_NUM_BITS 10
> +#define CQ_DESC_Q_NUM_MASK ((1 << CQ_DESC_Q_NUM_BITS) - 1)
> +#define CQ_DESC_COMP_NDX_BITS 12
> +#define CQ_DESC_COMP_NDX_MASK ((1 << CQ_DESC_COMP_NDX_BITS) - 1)
> +
> +static inline void cq_desc_dec(const struct cq_desc *desc_arg,
> + u8 *type, u8 *color, u16 *q_number, u16 *completed_index)
> +{
> + const struct cq_desc *desc = desc_arg;
> + const u8 type_color = desc->type_color;
> +
> + *color = (type_color >> CQ_DESC_COLOR_SHIFT) & CQ_DESC_COLOR_MASK;
> +
> + /*
> + * Make sure color bit is read from desc *before* other fields
> + * are read from desc. Hardware guarantees color bit is last
> + * bit (byte) written. Adding the rmb() prevents the compiler
> + * and/or CPU from reordering the reads which would potentially
> + * result in reading stale values.
> + */
> + rmb();
> +
> + *type = type_color & CQ_DESC_TYPE_MASK;
> + *q_number = le16_to_cpu(desc->q_number) & CQ_DESC_Q_NUM_MASK;
> + *completed_index = le16_to_cpu(desc->completed_index) &
> + CQ_DESC_COMP_NDX_MASK;
> +}
Now you're getting inconsistent.
Either you care for endianness, in which case you need to protect
_all_ hardware-dependent structure with cpu_to_XX and friends,
or you claim that you're hardware is unique to a given
architecture/machine, in which case you can skip the byte swapping.
But mixing them is not a good idea.
(And that comment is valid for the entire patch).
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-03-02 13:32 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-10 16:43 [PATCH 0/9] snic:initial submission of snic driver for Cisco SCSI HBA Narsimhulu Musini
2015-02-10 16:43 ` [PATCH 1/9] snic: snic module infrastructure Narsimhulu Musini
2015-03-02 12:39 ` Hannes Reinecke
2015-03-11 8:33 ` Narsimhulu Musini (nmusini)
2015-02-10 16:43 ` [PATCH 2/9] snic:Add interrupt, resource firmware interfaces Narsimhulu Musini
2015-03-02 12:53 ` Hannes Reinecke
2015-03-11 8:35 ` Narsimhulu Musini (nmusini)
2015-02-10 16:43 ` [PATCH 3/9] snic:Add meta request, handling of meta requests Narsimhulu Musini
2015-03-02 12:56 ` Hannes Reinecke
2015-03-11 8:35 ` Narsimhulu Musini (nmusini)
2015-02-10 16:43 ` [PATCH 4/9] snic:Add snic target discovery Narsimhulu Musini
2015-03-02 12:59 ` Hannes Reinecke
2015-03-11 8:35 ` Narsimhulu Musini (nmusini)
2015-02-10 16:43 ` [PATCH 5/9] snic:add SCSI handling, AEN, and fwreset handling Narsimhulu Musini
2015-03-02 13:26 ` Hannes Reinecke
2015-03-11 8:39 ` Narsimhulu Musini (nmusini)
2015-02-10 16:43 ` [PATCH 6/9] snic:Add low level queuing interfaces Narsimhulu Musini
2015-03-02 13:32 ` Hannes Reinecke [this message]
2015-03-11 8:39 ` Narsimhulu Musini (nmusini)
2015-02-10 16:43 ` [PATCH 7/9] snic:Add sysfs entries to list stats and trace data Narsimhulu Musini
2015-03-02 13:33 ` Hannes Reinecke
2015-03-11 8:39 ` Narsimhulu Musini (nmusini)
2015-02-10 16:43 ` [PATCH 8/9] snic:Add event tracing to capture IO events Narsimhulu Musini
2015-03-02 13:34 ` Hannes Reinecke
2015-03-11 8:40 ` Narsimhulu Musini (nmusini)
2015-02-10 16:43 ` [PATCH 9/9] snic:Add Makefile, patch Kconfig, MAINTAINERS Narsimhulu Musini
2015-03-02 13:35 ` Hannes Reinecke
2015-03-11 8:40 ` Narsimhulu Musini (nmusini)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54F4666E.3020609@suse.de \
--to=hare@suse.de \
--cc=JBottomley@Parallels.com \
--cc=linux-scsi@vger.kernel.org \
--cc=nmusini@cisco.com \
--cc=sebaddel@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.