]> www.infradead.org Git - linux.git/commitdiff
RDMA/rxe: Remove deliver net device event
authorYuyu Li <liyuyu6@huawei.com>
Fri, 22 Nov 2024 10:53:02 +0000 (18:53 +0800)
committerLeon Romanovsky <leon@kernel.org>
Wed, 25 Dec 2024 07:35:47 +0000 (02:35 -0500)
Since the netdev events of link status is now handled in ib_core,
remove the related code in drivers.

In addition, remove the setting of port->attr.state in rxe_port_up()
and rxe_port_down(), as it is only used in rxe_query_port(), and it
can be replaced by ib_get_curr_port_state().

Signed-off-by: Yuyu Li <liyuyu6@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/sw/rxe/rxe_net.c
drivers/infiniband/sw/rxe/rxe_verbs.c

index 75d1407db52d4dbf3673c35c41dd159ee6de8d56..d400aaab0e70003da71c999bfdb3e5c88daa1010 100644 (file)
@@ -563,11 +563,6 @@ static void rxe_port_event(struct rxe_dev *rxe,
 /* Caller must hold net_info_lock */
 void rxe_port_up(struct rxe_dev *rxe)
 {
-       struct rxe_port *port;
-
-       port = &rxe->port;
-       port->attr.state = IB_PORT_ACTIVE;
-
        rxe_port_event(rxe, IB_EVENT_PORT_ACTIVE);
        dev_info(&rxe->ib_dev.dev, "set active\n");
 }
@@ -575,11 +570,6 @@ void rxe_port_up(struct rxe_dev *rxe)
 /* Caller must hold net_info_lock */
 void rxe_port_down(struct rxe_dev *rxe)
 {
-       struct rxe_port *port;
-
-       port = &rxe->port;
-       port->attr.state = IB_PORT_DOWN;
-
        rxe_port_event(rxe, IB_EVENT_PORT_ERR);
        rxe_counter_inc(rxe, RXE_CNT_LINK_DOWNED);
        dev_info(&rxe->ib_dev.dev, "set down\n");
@@ -587,7 +577,7 @@ void rxe_port_down(struct rxe_dev *rxe)
 
 void rxe_set_port_state(struct rxe_dev *rxe)
 {
-       if (netif_running(rxe->ndev) && netif_carrier_ok(rxe->ndev))
+       if (ib_get_curr_port_state(rxe->ndev) == IB_PORT_ACTIVE)
                rxe_port_up(rxe);
        else
                rxe_port_down(rxe);
@@ -607,18 +597,14 @@ static int rxe_notify(struct notifier_block *not_blk,
        case NETDEV_UNREGISTER:
                ib_unregister_device_queued(&rxe->ib_dev);
                break;
-       case NETDEV_UP:
-               rxe_port_up(rxe);
-               break;
-       case NETDEV_DOWN:
-               rxe_port_down(rxe);
-               break;
        case NETDEV_CHANGEMTU:
                rxe_dbg_dev(rxe, "%s changed mtu to %d\n", ndev->name, ndev->mtu);
                rxe_set_mtu(rxe, ndev->mtu);
                break;
+       case NETDEV_DOWN:
        case NETDEV_CHANGE:
-               rxe_set_port_state(rxe);
+               if (ib_get_curr_port_state(ndev) == IB_PORT_DOWN)
+                       rxe_counter_inc(rxe, RXE_CNT_LINK_DOWNED);
                break;
        case NETDEV_REBOOT:
        case NETDEV_GOING_DOWN:
index ffd5b07ad3e6ce4c1a78c1fe95b8076eb0ac2bc6..dad3cacb904880644cd8c62abd869e32ba7102f5 100644 (file)
@@ -55,6 +55,7 @@ static int rxe_query_port(struct ib_device *ibdev,
        ret = ib_get_eth_speed(ibdev, port_num, &attr->active_speed,
                               &attr->active_width);
 
+       attr->state = ib_get_curr_port_state(rxe->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)