All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kristian Høgsberg" <krh@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: linux-kernel@vger.kernel.org, Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: Re: [PATCH 3/3] Import fw-sbp2 driver.
Date: Thu, 14 Dec 2006 15:48:12 -0500	[thread overview]
Message-ID: <4581B88C.9040104@redhat.com> (raw)
In-Reply-To: <45750C9A.607@garzik.org>

Jeff Garzik wrote:

Again, thanks for your comments, I've added patches to my git repo, will send 
out a new set on LKML before the end of this week.

>> +/* I don't know why the SCSI stack doesn't define something like 
>> this... */
>> +typedef void (*scsi_done_fn_t) (struct scsi_cmnd *);
> 
> submit a patch?

Hehe, yeah, that might work.

>> +struct sbp2_status {
>> +    unsigned int orb_high:16;
> 
> unsigned short?  probably generates better code than a bitfield:16

This and all other bit fields are now just u32s that I access by shifting and 
masking.

>> +struct sbp2_login_response {
>> +    u16 login_id;
>> +    u16 length;
>> +    u32 command_block_agent_high;
>> +    u32 command_block_agent_low;
>> +    u32 reconnect_hold;
>> +};
> 
> __le16 and __le32?

This struct is filled in using fw_memcpy_from_be32() to copy and byteswap the 
incoming payload, so the fields here are always cpu endian.  The two u16 
fields assume little endian ordering though, I fixed that.

>> +sbp2_send_management_orb(struct fw_unit *unit, int node_id, int 
>> generation,
>> +             int function, int lun, void *response)
>> +{
>> +    struct fw_device *device = fw_device(unit->device.parent);
>> +    struct sbp2_device *sd = unit->device.driver_data;
>> +    struct sbp2_management_orb *orb;
>> +    unsigned long timeout;
>> +    int retval = -EIO;
>> +
>> +    orb = kzalloc(sizeof *orb, GFP_ATOMIC);
>> +    if (orb == NULL)
>> +        return -ENOMEM;
>> +
>> +    /* The sbp2 device is going to send a block read request to
>> +     * read out the request from host memory, so map it for
>> +     * dma. */
>> +    orb->base.request_bus =
>> +        dma_map_single(device->card->device, &orb->request,
>> +                   sizeof orb->request, DMA_TO_DEVICE);
>> +
>> +    orb->response_bus =
>> +        dma_map_single(device->card->device, &orb->response,
>> +                   sizeof orb->response, DMA_FROM_DEVICE);
> 
> check for DMA mapping error

Oops, fixed.

>> +    if (sd->workarounds)
>> +        fw_notify("Workarounds for node %s: 0x%x "
>> +              "(firmware_revision 0x%06x, model_id 0x%06x)\n",
>> +              unit->device.bus_id,
>> +              sd->workarounds, firmware_revision, model);
>> +
>> +    /* FIXME: Make this work for multi-lun devices. */
>> +    lun = 0;
> 
> doesn't allowing the stack to issue REPORT LUNS take care of this?

Possibly, I don't have firewire multi-LUN devices to test with here.  The LUNs 
are also discoverable from the firewire config rom, which is why I put the 
comment there.  This doesn't mean that the SCSI commands for discovering LUNs 
doesn't also work.

>> +/* SCSI stack integration */
>> +
>> +static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, 
>> scsi_done_fn_t done)
>> +{
>> +    if (cmd->cmnd[0] == REQUEST_SENSE) {
>> +        fw_notify("request_sense");
>> +        memcpy(cmd->request_buffer, cmd->sense_buffer, 
>> cmd->request_bufflen);
>> +        memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
>> +        cmd->result = DID_OK << 16;
>> +        done(cmd);
>> +        return 0;
>> +    }
> 
> this is a broken emulation.  this command is specified to not repeatedly 
> return the same sense data.

I copied it over from the old stack under the assumption that it fixed 
something for some device.  I took it out and tested with the 10 or so storage 
devices I have here and it makes no difference.  I've never seen the 
fw_notify() that I put in there trigger.  I'm taking out this workaround for 
now, unless someone can tell me why it should stay there.

Kristian

  parent reply	other threads:[~2006-12-14 20:50 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-05  5:22 [PATCH 0/3] New firewire stack Kristian Høgsberg
2006-12-05  5:22 ` [PATCH 2/3] Import fw-ohci driver Kristian Høgsberg
2006-12-05  5:54   ` Pete Zaitcev
2006-12-05  5:58   ` Jeff Garzik
2006-12-05  6:09     ` Benjamin Herrenschmidt
2006-12-09  2:08     ` Kristian Høgsberg
2006-12-09  7:31       ` Stefan Richter
2006-12-10 21:47         ` Kristian Høgsberg
2006-12-10 22:59           ` Stefan Richter
2006-12-10 23:00             ` alignment and packing of struct types (was Re: [PATCH 2/3] Import fw-ohci driver.) Stefan Richter
2006-12-05  5:22 ` [PATCH 3/3] Import fw-sbp2 driver Kristian Høgsberg
2006-12-05  6:07   ` Jeff Garzik
2006-12-05 18:18     ` Stefan Richter
2006-12-14 20:48     ` Kristian Høgsberg [this message]
2006-12-14 21:40       ` Stefan Richter
2006-12-15 15:08         ` Kristian Høgsberg
2006-12-15 18:27           ` Stefan Richter
2006-12-05  5:42 ` [PATCH 0/3] New firewire stack Benjamin Herrenschmidt
2006-12-05  6:20   ` Kristian Høgsberg
2006-12-05 16:28     ` Ray Lee
2006-12-05 23:24       ` Kristian Høgsberg
2006-12-05  7:05   ` David Miller
2006-12-05 16:42     ` Kristian Høgsberg
2006-12-05 18:49       ` Stefan Richter
2006-12-05 21:41         ` Benjamin Herrenschmidt
2006-12-05 23:15           ` Stefan Richter
2006-12-05  8:46 ` Marcel Holtmann
2006-12-05 15:13   ` Kristian Høgsberg
2006-12-05 15:30     ` Marcel Holtmann
2006-12-06 16:21       ` Geert Uytterhoeven
2006-12-06 16:32         ` Stefan Richter
2006-12-05 16:05     ` Erik Mouw
2006-07-12 14:56       ` Pavel Machek
2006-12-08 15:09         ` Stefan Richter
2006-12-09 19:44           ` Kristian Høgsberg
2006-12-10 12:57             ` Stefan Richter
2006-12-10 22:17               ` Kristian Høgsberg
2006-12-10 23:21                 ` Stefan Richter
2006-12-09 21:51           ` Benjamin Herrenschmidt
2006-12-09 22:51             ` Stefan Richter
2006-12-05 16:53       ` Marcel Holtmann
2006-12-05 23:27         ` Kristian Høgsberg
2006-12-05 18:49 ` Alexey Dobriyan
2006-12-05 19:53   ` Stefan Richter
2006-12-05 23:21   ` Kristian Høgsberg
2006-12-06  5:35     ` Ben Collins
2006-12-06  8:56       ` Stefan Richter
2006-12-06 11:40         ` Alexander Neundorf
2006-12-06 12:38           ` Stefan Richter
2006-12-06 21:21             ` Kristian Høgsberg
2006-12-06 14:49         ` Ben Collins
2006-12-07  0:31           ` Kristian Høgsberg
2006-12-06  8:36     ` Stefan Richter
2006-12-06 22:27       ` Kristian Høgsberg
2006-12-06 23:55         ` Stefan Richter
2006-12-05 23:23 ` Olaf Hering

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=4581B88C.9040104@redhat.com \
    --to=krh@redhat.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    /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.