diff mbox

scsi: libcxgbi: in case of vlan pass 0 as ifindex to find route

Message ID 1507643730-5236-1-git-send-email-varun@chelsio.com (mailing list archive)
State Accepted
Headers show

Commit Message

Varun Prakash Oct. 10, 2017, 1:55 p.m. UTC
In case of vlan pass 0 as ifindex to find route instead of
passing real_dev ifindex, if we pass real_dev ifindex
then ip_route_output_ports() and ip6_route_output() will
check for route through real_dev not through vlan interface.

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

Comments

Martin K. Petersen Oct. 11, 2017, 6:27 p.m. UTC | #1
Varun,

> In case of vlan pass 0 as ifindex to find route instead of passing
> real_dev ifindex, if we pass real_dev ifindex then
> ip_route_output_ports() and ip6_route_output() will check for route
> through real_dev not through vlan interface.

Applied to 4.15/scsi-queue. Thank you!
diff mbox

Patch

diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 512c8f1..8503ac9 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -2556,7 +2556,10 @@  struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
 			goto err_out;
 		}
 
-		ifindex = hba->ndev->ifindex;
+		rtnl_lock();
+		if (!vlan_uses_dev(hba->ndev))
+			ifindex = hba->ndev->ifindex;
+		rtnl_unlock();
 	}
 
 	if (dst_addr->sa_family == AF_INET) {