firewire: sbp2: fix payload limit at S1600 and S3200

1394-2008 clause 16.3.4.1 (1394b-2002 clause 16.3.1.1) defines tighter
limits than 1394-2008 clause 6.2.2.3 (1394a-2000 clause 6.2.2.3).

Our previously too large limit doesn't matter though if the controller
reports its max_receive correctly.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+12 -11
+12 -11
drivers/firewire/fw-sbp2.c
··· 168 168 int address_high; 169 169 unsigned int workarounds; 170 170 unsigned int mgt_orb_timeout; 171 + unsigned int max_payload; 171 172 172 173 int dont_block; /* counter for each logical unit */ 173 174 int blocked; /* ditto */ ··· 1157 1156 1158 1157 sbp2_init_workarounds(tgt, model, firmware_revision); 1159 1158 1159 + /* 1160 + * At S100 we can do 512 bytes per packet, at S200 1024 bytes, 1161 + * and so on up to 4096 bytes. The SBP-2 max_payload field 1162 + * specifies the max payload size as 2 ^ (max_payload + 2), so 1163 + * if we set this to max_speed + 7, we get the right value. 1164 + */ 1165 + tgt->max_payload = min(device->max_speed + 7, 10U); 1166 + tgt->max_payload = min(tgt->max_payload, device->card->max_receive - 1); 1167 + 1160 1168 /* Do the login in a workqueue so we can easily reschedule retries. */ 1161 1169 list_for_each_entry(lu, &tgt->lu_list, link) 1162 1170 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); ··· 1444 1434 struct sbp2_logical_unit *lu = cmd->device->hostdata; 1445 1435 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 1446 1436 struct sbp2_command_orb *orb; 1447 - unsigned int max_payload; 1448 1437 int generation, retval = SCSI_MLQUEUE_HOST_BUSY; 1449 1438 1450 1439 /* ··· 1471 1462 orb->done = done; 1472 1463 orb->cmd = cmd; 1473 1464 1474 - orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL); 1475 - /* 1476 - * At speed 100 we can do 512 bytes per packet, at speed 200, 1477 - * 1024 bytes per packet etc. The SBP-2 max_payload field 1478 - * specifies the max payload size as 2 ^ (max_payload + 2), so 1479 - * if we set this to max_speed + 7, we get the right value. 1480 - */ 1481 - max_payload = min(device->max_speed + 7, 1482 - device->card->max_receive - 1); 1465 + orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL); 1483 1466 orb->request.misc = cpu_to_be32( 1484 - COMMAND_ORB_MAX_PAYLOAD(max_payload) | 1467 + COMMAND_ORB_MAX_PAYLOAD(lu->tgt->max_payload) | 1485 1468 COMMAND_ORB_SPEED(device->max_speed) | 1486 1469 COMMAND_ORB_NOTIFY); 1487 1470