void rxe_set_port_state(struct rxe_dev *rxe)
  {
 -      if (ib_get_curr_port_state(rxe->ndev) == IB_PORT_ACTIVE)
 +      struct net_device *ndev;
 +
 +      ndev = rxe_ib_device_get_netdev(&rxe->ib_dev);
 +      if (!ndev)
 +              return;
 +
-       if (netif_running(ndev) && netif_carrier_ok(ndev))
++      if (ib_get_curr_port_state(ndev) == IB_PORT_ACTIVE)
                rxe_port_up(rxe);
        else
                rxe_port_down(rxe);
 
        ret = ib_get_eth_speed(ibdev, port_num, &attr->active_speed,
                               &attr->active_width);
  
 -      attr->state = ib_get_curr_port_state(rxe->ndev);
++      attr->state = ib_get_curr_port_state(ndev);
        if (attr->state == IB_PORT_ACTIVE)
                attr->phys_state = IB_PORT_PHYS_STATE_LINK_UP;
 -      else if (dev_get_flags(rxe->ndev) & IFF_UP)
 +      else if (dev_get_flags(ndev) & IFF_UP)
                attr->phys_state = IB_PORT_PHYS_STATE_POLLING;
        else
                attr->phys_state = IB_PORT_PHYS_STATE_DISABLED;
 
  
        rv = ib_get_eth_speed(base_dev, port, &attr->active_speed,
                         &attr->active_width);
 +      if (rv)
 +              return rv;
 +
 +      ndev = ib_device_get_netdev(base_dev, SIW_PORT);
 +      if (!ndev)
 +              return -ENODEV;
 +
        attr->gid_tbl_len = 1;
        attr->max_msg_sz = -1;
 -      attr->max_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu);
 -      attr->active_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu);
 -      attr->state = ib_get_curr_port_state(sdev->netdev);
 +      attr->max_mtu = ib_mtu_int_to_enum(ndev->max_mtu);
 +      attr->active_mtu = ib_mtu_int_to_enum(READ_ONCE(ndev->mtu));
-       attr->phys_state = (netif_running(ndev) && netif_carrier_ok(ndev)) ?
++      attr->state = ib_get_curr_port_state(ndev);
+       attr->phys_state = attr->state == IB_PORT_ACTIVE ?
                IB_PORT_PHYS_STATE_LINK_UP : IB_PORT_PHYS_STATE_DISABLED;
-       attr->state = attr->phys_state == IB_PORT_PHYS_STATE_LINK_UP ?
-               IB_PORT_ACTIVE : IB_PORT_DOWN;
        attr->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_DEVICE_MGMT_SUP;
        /*
         * All zero