diff options
| -rw-r--r-- | drivers/firewire/fw-sbp2.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 705a20ce6b4a..794badeee0e2 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
| @@ -151,9 +151,16 @@ struct sbp2_target { | |||
| 151 | struct list_head lu_list; | 151 | struct list_head lu_list; |
| 152 | }; | 152 | }; |
| 153 | 153 | ||
| 154 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 | 154 | /* |
| 155 | * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be | ||
| 156 | * provided in the config rom. A high timeout value really only matters | ||
| 157 | * on initial login, where we'll just use 20s rather than hassling with | ||
| 158 | * reading the config rom, since it really wouldn't buy us much. | ||
| 159 | */ | ||
| 160 | #define SBP2_LOGIN_ORB_TIMEOUT 20000 /* Timeout in ms */ | ||
| 155 | #define SBP2_ORB_TIMEOUT 2000 /* Timeout in ms */ | 161 | #define SBP2_ORB_TIMEOUT 2000 /* Timeout in ms */ |
| 156 | #define SBP2_ORB_NULL 0x80000000 | 162 | #define SBP2_ORB_NULL 0x80000000 |
| 163 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 | ||
| 157 | 164 | ||
| 158 | #define SBP2_DIRECTION_TO_MEDIA 0x0 | 165 | #define SBP2_DIRECTION_TO_MEDIA 0x0 |
| 159 | #define SBP2_DIRECTION_FROM_MEDIA 0x1 | 166 | #define SBP2_DIRECTION_FROM_MEDIA 0x1 |
| @@ -488,6 +495,7 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, | |||
| 488 | { | 495 | { |
| 489 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); | 496 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); |
| 490 | struct sbp2_management_orb *orb; | 497 | struct sbp2_management_orb *orb; |
| 498 | unsigned int timeout; | ||
| 491 | int retval = -ENOMEM; | 499 | int retval = -ENOMEM; |
| 492 | 500 | ||
| 493 | orb = kzalloc(sizeof(*orb), GFP_ATOMIC); | 501 | orb = kzalloc(sizeof(*orb), GFP_ATOMIC); |
| @@ -519,6 +527,9 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, | |||
| 519 | orb->request.misc |= | 527 | orb->request.misc |= |
| 520 | MANAGEMENT_ORB_RECONNECT(2) | | 528 | MANAGEMENT_ORB_RECONNECT(2) | |
| 521 | MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login); | 529 | MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login); |
| 530 | timeout = SBP2_LOGIN_ORB_TIMEOUT; | ||
| 531 | } else { | ||
| 532 | timeout = SBP2_ORB_TIMEOUT; | ||
| 522 | } | 533 | } |
| 523 | 534 | ||
| 524 | fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request)); | 535 | fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request)); |
| @@ -535,8 +546,7 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, | |||
| 535 | sbp2_send_orb(&orb->base, lu, node_id, generation, | 546 | sbp2_send_orb(&orb->base, lu, node_id, generation, |
| 536 | lu->tgt->management_agent_address); | 547 | lu->tgt->management_agent_address); |
| 537 | 548 | ||
| 538 | wait_for_completion_timeout(&orb->done, | 549 | wait_for_completion_timeout(&orb->done, msecs_to_jiffies(timeout)); |
| 539 | msecs_to_jiffies(SBP2_ORB_TIMEOUT)); | ||
| 540 | 550 | ||
| 541 | retval = -EIO; | 551 | retval = -EIO; |
| 542 | if (sbp2_cancel_orbs(lu) == 0) { | 552 | if (sbp2_cancel_orbs(lu) == 0) { |
