Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130410
b: refs/heads/master
c: a08e100
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Richter committed Jan 28, 2009
1 parent 10f4321 commit 65c06f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c1fbdd78517a9323ea5f5767c8ceb10aabc40fc2
refs/heads/master: a08e100aece16e33a45b82924ad85f4066c4ed1c
23 changes: 12 additions & 11 deletions trunk/drivers/firewire/fw-sbp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ struct sbp2_target {
int address_high;
unsigned int workarounds;
unsigned int mgt_orb_timeout;
unsigned int max_payload;

int dont_block; /* counter for each logical unit */
int blocked; /* ditto */
Expand Down Expand Up @@ -1156,6 +1157,15 @@ static int sbp2_probe(struct device *dev)

sbp2_init_workarounds(tgt, model, firmware_revision);

/*
* At S100 we can do 512 bytes per packet, at S200 1024 bytes,
* and so on up to 4096 bytes. The SBP-2 max_payload field
* specifies the max payload size as 2 ^ (max_payload + 2), so
* if we set this to max_speed + 7, we get the right value.
*/
tgt->max_payload = min(device->max_speed + 7, 10U);
tgt->max_payload = min(tgt->max_payload, device->card->max_receive - 1);

/* Do the login in a workqueue so we can easily reschedule retries. */
list_for_each_entry(lu, &tgt->lu_list, link)
sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
Expand Down Expand Up @@ -1434,7 +1444,6 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
struct sbp2_logical_unit *lu = cmd->device->hostdata;
struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
struct sbp2_command_orb *orb;
unsigned int max_payload;
int generation, retval = SCSI_MLQUEUE_HOST_BUSY;

/*
Expand Down Expand Up @@ -1462,17 +1471,9 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
orb->done = done;
orb->cmd = cmd;

orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL);
/*
* At speed 100 we can do 512 bytes per packet, at speed 200,
* 1024 bytes per packet etc. The SBP-2 max_payload field
* specifies the max payload size as 2 ^ (max_payload + 2), so
* if we set this to max_speed + 7, we get the right value.
*/
max_payload = min(device->max_speed + 7,
device->card->max_receive - 1);
orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL);
orb->request.misc = cpu_to_be32(
COMMAND_ORB_MAX_PAYLOAD(max_payload) |
COMMAND_ORB_MAX_PAYLOAD(lu->tgt->max_payload) |
COMMAND_ORB_SPEED(device->max_speed) |
COMMAND_ORB_NOTIFY);

Expand Down

0 comments on commit 65c06f6

Please sign in to comment.