diff mbox series

[for-next,1/3] RDMA/cxgb3: Report phys_state in query_port

Message ID 20190722070550.25395-2-kamalheib1@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series {cxgb3, cxgb4, i40iw} Report phys_state | expand

Commit Message

Kamal Heib July 22, 2019, 7:05 a.m. UTC
Add support for reporting physical state when calling query_port() via
the sysfs interface.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/cxgb3/iwch_provider.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index e775c1a1a450..7b0b7bfc570a 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -1004,18 +1004,24 @@  static int iwch_query_port(struct ib_device *ibdev,
 	props->max_mtu = IB_MTU_4096;
 	props->active_mtu = ib_mtu_int_to_enum(netdev->mtu);
 
-	if (!netif_carrier_ok(netdev))
+	if (!netif_carrier_ok(netdev)) {
 		props->state = IB_PORT_DOWN;
-	else {
+		props->phys_state = 3;
+	} else {
 		inetdev = in_dev_get(netdev);
 		if (inetdev) {
-			if (inetdev->ifa_list)
+			if (inetdev->ifa_list) {
 				props->state = IB_PORT_ACTIVE;
-			else
+				props->phys_state = 5;
+			} else {
 				props->state = IB_PORT_INIT;
+				props->phys_state = 4;
+			}
 			in_dev_put(inetdev);
-		} else
+		} else {
 			props->state = IB_PORT_INIT;
+			props->phys_state = 4;
+		}
 	}
 
 	props->port_cap_flags =