From: Chien Tung <chien.tin.tung@intel.com>
Date: Mon, 23 Aug 2010 14:32:36 +0000 (+0000)
Subject: RDMA/nes: Report correct port state if interface is down
X-Git-Tag: firefly_0821_release~7613^2~3618^2^10~1
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=293277215636e1586fcf6386b0b64457c6dfdb68;p=firefly-linux-kernel-4.4.55.git

RDMA/nes: Report correct port state if interface is down

With commit cd6860eb ("RDMA/nes: Fix hangs on ifdown") we no longer
remove nes interfaces on ifdown.  On nes_query_port(), add an
additional check of the netdev queue and report IB_PORT_DOWN if the
queue is not running.

Signed-off-by: Chien Tung <chien.tin.tung@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
---

diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index b89972c6a357..2374efbdda6b 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -584,7 +584,9 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr
 	props->lmc = 0;
 	props->sm_lid = 0;
 	props->sm_sl = 0;
-	if (nesvnic->linkup)
+	if (netif_queue_stopped(netdev))
+		props->state = IB_PORT_DOWN;
+	else if (nesvnic->linkup)
 		props->state = IB_PORT_ACTIVE;
 	else
 		props->state = IB_PORT_DOWN;