aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2016-08-24 12:14:19 -0400
committerDoug Ledford <dledford@redhat.com>2016-08-24 16:51:16 -0400
commit716b076ba4b273f5f85c97448c5110c6d21e73e6 (patch)
tree9457baf9103fe21bfd7664fb616c0146adbb6518
parent3c199b4523c92dc5df027eeeffa657e2ccf453ab (diff)
IB/srpt: Update sport->port_guid with each port refresh
If port_guid is set with the default subnet_prefix, then we get a change event and run a port refresh, we don't update the port_guid. As a result, attempts to create a target device that uses the new subnet_prefix in the wwn will fail to find a match and be rejected by the ib_srpt driver. This makes it impossible to configure a port if it was initialized with a default subnet_prefix and later changed to any non-default subnet-prefix. Updating the port refresh task to always update the wwn based upon the current subnext_prefix solves this problem. Cc: Bart Van Assche <bart.vanassche@sandisk.com> Cc: nab@linux-iscsi.org Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index dfa23b075a88..883bbfe08e0e 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -522,6 +522,11 @@ static int srpt_refresh_port(struct srpt_port *sport)
522 if (ret) 522 if (ret)
523 goto err_query_port; 523 goto err_query_port;
524 524
525 snprintf(sport->port_guid, sizeof(sport->port_guid),
526 "0x%016llx%016llx",
527 be64_to_cpu(sport->gid.global.subnet_prefix),
528 be64_to_cpu(sport->gid.global.interface_id));
529
525 if (!sport->mad_agent) { 530 if (!sport->mad_agent) {
526 memset(&reg_req, 0, sizeof(reg_req)); 531 memset(&reg_req, 0, sizeof(reg_req));
527 reg_req.mgmt_class = IB_MGMT_CLASS_DEVICE_MGMT; 532 reg_req.mgmt_class = IB_MGMT_CLASS_DEVICE_MGMT;
@@ -2548,10 +2553,6 @@ static void srpt_add_one(struct ib_device *device)
2548 sdev->device->name, i); 2553 sdev->device->name, i);
2549 goto err_ring; 2554 goto err_ring;
2550 } 2555 }
2551 snprintf(sport->port_guid, sizeof(sport->port_guid),
2552 "0x%016llx%016llx",
2553 be64_to_cpu(sport->gid.global.subnet_prefix),
2554 be64_to_cpu(sport->gid.global.interface_id));
2555 } 2556 }
2556 2557
2557 spin_lock(&srpt_dev_lock); 2558 spin_lock(&srpt_dev_lock);