diff mbox series

scsi: libcxgbi: update route finding logic

Message ID 1555253611-3826-1-git-send-email-varun@chelsio.com (mailing list archive)
State Mainlined
Commit 74dea0bed79353ce2aadcb06406d3a9d28bae57b
Headers show
Series scsi: libcxgbi: update route finding logic | expand

Commit Message

Varun Prakash April 14, 2019, 2:53 p.m. UTC
To support vlan and bridge devices first find
route using ifindex 0, if route is not found
through net device associated with input scsi host
then find route using ifindex of net device.

Signed-off-by: Varun Prakash <varun@chelsio.com>
---
 drivers/scsi/cxgbi/libcxgbi.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Martin K. Petersen April 16, 2019, 2:14 a.m. UTC | #1
Varun,

> To support vlan and bridge devices first find route using ifindex 0,
> if route is not found through net device associated with input scsi
> host then find route using ifindex of net device.

Applied to 5.2/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index b7d28d4..c383663 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -2563,13 +2563,9 @@  struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
 			pr_info("shost 0x%p, priv NULL.\n", shost);
 			goto err_out;
 		}
-
-		rtnl_lock();
-		if (!vlan_uses_dev(hba->ndev))
-			ifindex = hba->ndev->ifindex;
-		rtnl_unlock();
 	}
 
+check_route:
 	if (dst_addr->sa_family == AF_INET) {
 		csk = cxgbi_check_route(dst_addr, ifindex);
 #if IS_ENABLED(CONFIG_IPV6)
@@ -2590,6 +2586,13 @@  struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
 	if (!hba)
 		hba = csk->cdev->hbas[csk->port_id];
 	else if (hba != csk->cdev->hbas[csk->port_id]) {
+		if (ifindex != hba->ndev->ifindex) {
+			cxgbi_sock_put(csk);
+			cxgbi_sock_closed(csk);
+			ifindex = hba->ndev->ifindex;
+			goto check_route;
+		}
+
 		pr_info("Could not connect through requested host %u"
 			"hba 0x%p != 0x%p (%u).\n",
 			shost->host_no, hba,