diff mbox series

[for-next,2/3] RDMA/cxgb4: Report phys_state in query_port

Message ID 20190722070550.25395-3-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/cxgb4/provider.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index 5e59c5708729..d38c242a1693 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -317,18 +317,24 @@  static int c4iw_query_port(struct ib_device *ibdev, u8 port,
 	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 =