From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Ke Wei <kewei.mv@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>,
linux-scsi@vger.kernel.org, kewei@marvell.com,
qswang@marvell.com, jfeng@marvell.com, qzhao@marvell.com
Subject: Re: [PATCH] Marvell 6440 SAS/SATA driver
Date: Fri, 25 Jan 2008 16:39:29 -0600 [thread overview]
Message-ID: <1201300769.3119.78.camel@localhost.localdomain> (raw)
In-Reply-To: <6b2481670801250843g73ff3a6aydb465a654f53ad9d@mail.gmail.com>
On Sat, 2008-01-26 at 00:43 +0800, Ke Wei wrote:
> struct mvs_phy {
> struct mvs_port *port;
> struct asd_sas_phy sas_phy;
> + struct sas_identify identify;
> + __le32 dev_info;
> + __le64 dev_sas_addr;
> + __le32 att_dev_info;
> + __le64 att_dev_sas_addr;
> + u32 type;
> + __le32 phy_status;
> + __le32 irq_status;
> + u8 wide_port_phymap;
> + u32 frame_rcvd_size;
> + u8 frame_rcvd[32];
>
> - u8 frame_rcvd[24 + 1024];
> };
These __le quantites don't look right ... they're all read in by readl,
which will convert little endian to CPU anyway.
> @@ -437,27 +586,55 @@ struct mvs_info {
> dma_addr_t rx_dma;
> u32 rx_cons; /* RX consumer idx */
>
> - __le32 *rx_fis; /* RX'd FIS area */
> + void *rx_fis; /* RX'd FIS area */
Now the received FIS, on the other hand, provided you're storing it in
wire format (which you look to be) *is* little endian data by definition
in the ATA spec.
> -static void mvs_tag_clear(struct mvs_info *mvi, unsigned int tag)
> +static void mvs_tag_clear(struct mvs_info *mvi, u32 tag)
> {
> - mvi->tags[tag / sizeof(unsigned long)] &=
> - ~(1UL << (tag % sizeof(unsigned long)));
> + mvi->tag_in = (mvi->tag_in + 1) & (MVS_SLOTS - 1);
> + mvi->tags[mvi->tag_in] = tag;
> }
>
> -static void mvs_tag_set(struct mvs_info *mvi, unsigned int tag)
> +static void mvs_tag_free(struct mvs_info *mvi, u32 tag)
> {
> - mvi->tags[tag / sizeof(unsigned long)] |=
> - (1UL << (tag % sizeof(unsigned long)));
> + mvi->tag_out = (mvi->tag_out - 1) & (MVS_SLOTS - 1);
> }
>
> -static bool mvs_tag_test(struct mvs_info *mvi, unsigned int tag)
> +static int mvs_tag_alloc(struct mvs_info *mvi, u32 *tag_out)
> {
> - return mvi->tags[tag / sizeof(unsigned long)] &
> - (1UL << (tag % sizeof(unsigned long)));
> + if (mvi->tag_out != mvi->tag_in) {
> + *tag_out = mvi->tags[mvi->tag_out];
> + mvi->tag_out = (mvi->tag_out + 1) & (MVS_SLOTS - 1);
> + return 0;
> + }
> + return -EBUSY;
I really don't think you should be doing this. That single ring governs
all the potential tag slots for everything in this device. If you do a
simple head tail allocation, what can happen is that you get a slow tag
(attached to a format command, or a tape command) and then the ring head
will hit the slow tag and the entire device will halt. I think you need
a bitmap based allocation algorithm to ensure that if you have a free
tag anywhere, you'll use it.
If you look at the aic94xx index functions in aic94xx_hwi.h you'll see
asd_tc_index_get() and asd_tc_index_release() doing exactly what you
want with the native linux bitmap functions (the aic also uses a single
issue queue with indexes into it).
James
next prev parent reply other threads:[~2008-01-25 22:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080122151857.GA8680@ubuntu.domain>
2008-01-22 15:24 ` [PATCH] Marvell 6440 SAS/SATA driver Ke Wei
2008-01-23 3:58 ` Jeff Garzik
2008-01-23 10:54 ` Ke Wei
2008-01-23 11:41 ` Jeff Garzik
2008-01-25 16:43 ` Ke Wei
2008-01-25 17:24 ` Grant Grundler
2008-01-25 17:38 ` James Bottomley
2008-01-25 22:12 ` Jeff Garzik
2008-01-25 17:38 ` Grant Grundler
2008-01-25 22:39 ` James Bottomley [this message]
2008-01-27 15:10 ` Ke Wei
2008-01-27 15:27 ` Ke Wei
2008-01-27 18:13 ` James Bottomley
2008-02-05 13:19 ` Ke Wei
2008-02-05 21:00 ` Luben Tuikov
2008-02-07 0:33 ` Jeff Garzik
2008-01-25 23:00 ` James Bottomley
2008-01-25 23:05 ` Jeff Garzik
2008-01-25 21:27 ` James Bottomley
2008-01-23 19:23 ` Grant Grundler
[not found] <FE3F06125A99254E8D92161AA4569C6F02310B1A@sc-exch02.marvell.com>
2008-02-22 16:26 ` Jeff Garzik
2008-02-22 16:38 ` James Bottomley
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=1201300769.3119.78.camel@localhost.localdomain \
--to=james.bottomley@hansenpartnership.com \
--cc=jeff@garzik.org \
--cc=jfeng@marvell.com \
--cc=kewei.mv@gmail.com \
--cc=kewei@marvell.com \
--cc=linux-scsi@vger.kernel.org \
--cc=qswang@marvell.com \
--cc=qzhao@marvell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox