Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 64099
b: refs/heads/master
c: 5d7cbfd
h: refs/heads/master
i:
  64097: ea8e606
  64095: 9c81983
v: v3
  • Loading branch information
Roland Dreier committed Aug 3, 2007
1 parent abda81e commit d62d7e6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 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: 699924b1e1ea3c9307eb582b9cc386e4af88aaae
refs/heads/master: 5d7cbfd63136e4469a896acfadb33e19ed62f068
29 changes: 20 additions & 9 deletions trunk/drivers/infiniband/ulp/srp/ib_srp.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,12 @@ module_param(topspin_workarounds, int, 0444);
MODULE_PARM_DESC(topspin_workarounds,
"Enable workarounds for Topspin/Cisco SRP target bugs if != 0");

static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad };

static int mellanox_workarounds = 1;

module_param(mellanox_workarounds, int, 0444);
MODULE_PARM_DESC(mellanox_workarounds,
"Enable workarounds for Mellanox SRP target bugs if != 0");

static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 };

static void srp_add_one(struct ib_device *device);
static void srp_remove_one(struct ib_device *device);
static void srp_completion(struct ib_cq *cq, void *target_ptr);
Expand All @@ -108,6 +104,22 @@ static const char *srp_target_info(struct Scsi_Host *host)
return host_to_target(host)->target_name;
}

static int srp_target_is_topspin(struct srp_target_port *target)
{
static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad };

return topspin_workarounds &&
!memcmp(&target->ioc_guid, topspin_oui, sizeof topspin_oui);
}

static int srp_target_is_mellanox(struct srp_target_port *target)
{
static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 };

return mellanox_workarounds &&
!memcmp(&target->ioc_guid, mellanox_oui, sizeof mellanox_oui);
}

static struct srp_iu *srp_alloc_iu(struct srp_host *host, size_t size,
gfp_t gfp_mask,
enum dma_data_direction direction)
Expand Down Expand Up @@ -360,7 +372,7 @@ static int srp_send_req(struct srp_target_port *target)
* zero out the first 8 bytes of our initiator port ID and set
* the second 8 bytes to the local node GUID.
*/
if (topspin_workarounds && !memcmp(&target->ioc_guid, topspin_oui, 3)) {
if (srp_target_is_topspin(target)) {
printk(KERN_DEBUG PFX "Topspin/Cisco initiator port ID workaround "
"activated for target GUID %016llx\n",
(unsigned long long) be64_to_cpu(target->ioc_guid));
Expand Down Expand Up @@ -585,8 +597,8 @@ static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat,
if (!dev->fmr_pool)
return -ENODEV;

if ((ib_sg_dma_address(ibdev, &scat[0]) & ~dev->fmr_page_mask) &&
mellanox_workarounds && !memcmp(&target->ioc_guid, mellanox_oui, 3))
if (srp_target_is_mellanox(target) &&
(ib_sg_dma_address(ibdev, &scat[0]) & ~dev->fmr_page_mask))
return -EINVAL;

len = page_cnt = 0;
Expand Down Expand Up @@ -1087,8 +1099,7 @@ static void srp_cm_rej_handler(struct ib_cm_id *cm_id,
break;

case IB_CM_REJ_PORT_REDIRECT:
if (topspin_workarounds &&
!memcmp(&target->ioc_guid, topspin_oui, 3)) {
if (srp_target_is_topspin(target)) {
/*
* Topspin/Cisco SRP gateways incorrectly send
* reject reason code 25 when they mean 24
Expand Down

0 comments on commit d62d7e6

Please sign in to comment.