Message ID | 20240103020133.664928-1-pizhenwei@bytedance.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | RDMA/rxe: Fix port state on associating netdev successfully | expand |
在 2024/1/3 10:01, zhenwei pi 写道: > Originally, after adding a RXE device successfully, the RXE device > gets ready, it still reports 'PORT_DOWN' state. Set the state to > *IB_PORT_ACTIVE* once it becomes ready to access. IB_PORT_ACTIVE is set in the function rxe_port_up. The followings are the call chain. rxe_net_add -- > rxe_register_device -- > ib_register_device -- > enable_device_and_get -- > rxe_enable_driver -- > rxe_set_port_state -- > rxe_port_up In this commit, in rxe_net_add, the port->attr.state is set to IB_PORT_ACTIVE. But then in the function rxe_init_port_param, port->attr.state is set to IB_PORT_DOWN again. Zhu Yanjun > > Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> > --- > drivers/infiniband/sw/rxe/rxe_net.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c > index cd59666158b1..eafcb2351a7b 100644 > --- a/drivers/infiniband/sw/rxe/rxe_net.c > +++ b/drivers/infiniband/sw/rxe/rxe_net.c > @@ -524,6 +524,7 @@ int rxe_net_add(const char *ibdev_name, struct net_device *ndev) > { > int err; > struct rxe_dev *rxe = NULL; > + struct rxe_port *port; > > rxe = ib_alloc_device(rxe_dev, ib_dev); > if (!rxe) > @@ -537,6 +538,11 @@ int rxe_net_add(const char *ibdev_name, struct net_device *ndev) > return err; > } > > + if (netif_running(ndev) && netif_carrier_ok(ndev)) { > + port = &rxe->port; > + port->attr.state = IB_PORT_ACTIVE; > + } > + > return 0; > } >
On 1/3/24 14:47, Zhu Yanjun wrote: > 在 2024/1/3 10:01, zhenwei pi 写道: >> Originally, after adding a RXE device successfully, the RXE device >> gets ready, it still reports 'PORT_DOWN' state. Set the state to >> *IB_PORT_ACTIVE* once it becomes ready to access. > > IB_PORT_ACTIVE is set in the function rxe_port_up. > > The followings are the call chain. > > rxe_net_add -- > rxe_register_device -- > ib_register_device -- > > enable_device_and_get -- > rxe_enable_driver -- > rxe_set_port_state -- > > rxe_port_up > > In this commit, in rxe_net_add, the port->attr.state is set to > IB_PORT_ACTIVE. > > But then in the function rxe_init_port_param, port->attr.state is set to > IB_PORT_DOWN again. > > Zhu Yanjun > Thanks, I guess anything got wrong in my env(virtual interface in a virtual machine), let's drop this. >> >> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> >> --- >> drivers/infiniband/sw/rxe/rxe_net.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c >> b/drivers/infiniband/sw/rxe/rxe_net.c >> index cd59666158b1..eafcb2351a7b 100644 >> --- a/drivers/infiniband/sw/rxe/rxe_net.c >> +++ b/drivers/infiniband/sw/rxe/rxe_net.c >> @@ -524,6 +524,7 @@ int rxe_net_add(const char *ibdev_name, struct >> net_device *ndev) >> { >> int err; >> struct rxe_dev *rxe = NULL; >> + struct rxe_port *port; >> rxe = ib_alloc_device(rxe_dev, ib_dev); >> if (!rxe) >> @@ -537,6 +538,11 @@ int rxe_net_add(const char *ibdev_name, struct >> net_device *ndev) >> return err; >> } >> + if (netif_running(ndev) && netif_carrier_ok(ndev)) { >> + port = &rxe->port; >> + port->attr.state = IB_PORT_ACTIVE; >> + } >> + >> return 0; >> } >
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index cd59666158b1..eafcb2351a7b 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -524,6 +524,7 @@ int rxe_net_add(const char *ibdev_name, struct net_device *ndev) { int err; struct rxe_dev *rxe = NULL; + struct rxe_port *port; rxe = ib_alloc_device(rxe_dev, ib_dev); if (!rxe) @@ -537,6 +538,11 @@ int rxe_net_add(const char *ibdev_name, struct net_device *ndev) return err; } + if (netif_running(ndev) && netif_carrier_ok(ndev)) { + port = &rxe->port; + port->attr.state = IB_PORT_ACTIVE; + } + return 0; }
Originally, after adding a RXE device successfully, the RXE device gets ready, it still reports 'PORT_DOWN' state. Set the state to *IB_PORT_ACTIVE* once it becomes ready to access. Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> --- drivers/infiniband/sw/rxe/rxe_net.c | 6 ++++++ 1 file changed, 6 insertions(+)