Commit 5736c7c4 authored by Andrew Boyer's avatar Andrew Boyer Committed by Jason Gunthorpe

RDMA/rxe: Distinguish between down links and disabled links

In ib_query_port(), use the netdev's IFF_UP flag to determine phys_state
(flag set = down = POLLING, flag clear = disabled = DISABLED).

Callers can then use the phys_state field to distinguish between links
which have a dead partner, cable missing, etc., from links which are
turned off on the local node. This is useful for HA and supportability.
Signed-off-by: default avatarAndrew Boyer <andrew.boyer@dell.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 759ace78
...@@ -65,8 +65,9 @@ ...@@ -65,8 +65,9 @@
*/ */
#define RXE_UVERBS_ABI_VERSION 2 #define RXE_UVERBS_ABI_VERSION 2
#define IB_PHYS_STATE_LINK_UP (5) #define RDMA_LINK_PHYS_STATE_LINK_UP (5)
#define IB_PHYS_STATE_LINK_DOWN (3) #define RDMA_LINK_PHYS_STATE_DISABLED (3)
#define RDMA_LINK_PHYS_STATE_POLLING (2)
#define RXE_ROCE_V2_SPORT (0xc000) #define RXE_ROCE_V2_SPORT (0xc000)
......
...@@ -607,7 +607,6 @@ void rxe_port_up(struct rxe_dev *rxe) ...@@ -607,7 +607,6 @@ void rxe_port_up(struct rxe_dev *rxe)
port = &rxe->port; port = &rxe->port;
port->attr.state = IB_PORT_ACTIVE; port->attr.state = IB_PORT_ACTIVE;
port->attr.phys_state = IB_PHYS_STATE_LINK_UP;
rxe_port_event(rxe, IB_EVENT_PORT_ACTIVE); rxe_port_event(rxe, IB_EVENT_PORT_ACTIVE);
dev_info(&rxe->ib_dev.dev, "set active\n"); dev_info(&rxe->ib_dev.dev, "set active\n");
...@@ -620,7 +619,6 @@ void rxe_port_down(struct rxe_dev *rxe) ...@@ -620,7 +619,6 @@ void rxe_port_down(struct rxe_dev *rxe)
port = &rxe->port; port = &rxe->port;
port->attr.state = IB_PORT_DOWN; port->attr.state = IB_PORT_DOWN;
port->attr.phys_state = IB_PHYS_STATE_LINK_DOWN;
rxe_port_event(rxe, IB_EVENT_PORT_ERR); rxe_port_event(rxe, IB_EVENT_PORT_ERR);
dev_info(&rxe->ib_dev.dev, "set down\n"); dev_info(&rxe->ib_dev.dev, "set down\n");
......
...@@ -71,6 +71,14 @@ static int rxe_query_port(struct ib_device *dev, ...@@ -71,6 +71,14 @@ static int rxe_query_port(struct ib_device *dev,
mutex_lock(&rxe->usdev_lock); mutex_lock(&rxe->usdev_lock);
rc = ib_get_eth_speed(dev, port_num, &attr->active_speed, rc = ib_get_eth_speed(dev, port_num, &attr->active_speed,
&attr->active_width); &attr->active_width);
if (attr->state == IB_PORT_ACTIVE)
attr->phys_state = RDMA_LINK_PHYS_STATE_LINK_UP;
else if (dev_get_flags(rxe->ndev) & IFF_UP)
attr->phys_state = RDMA_LINK_PHYS_STATE_POLLING;
else
attr->phys_state = RDMA_LINK_PHYS_STATE_DISABLED;
mutex_unlock(&rxe->usdev_lock); mutex_unlock(&rxe->usdev_lock);
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment