@@ -148,20 +148,16 @@ static void usnic_ib_handle_usdev_event(struct usnic_ib_dev *us_ibdev,
ib_dispatch_event(&ib_event);
break;
case NETDEV_UP:
- if (!us_ibdev->link_up) {
+ case NETDEV_DOWN:
+ case NETDEV_CHANGE:
+ if (!us_ibdev->link_up && netif_carrier_ok(netdev)) {
us_ibdev->link_up = true;
usnic_info("Link UP on %s\n", us_ibdev->ib_dev.name);
ib_event.event = IB_EVENT_PORT_ACTIVE;
ib_event.device = &us_ibdev->ib_dev;
ib_event.element.port_num = 1;
ib_dispatch_event(&ib_event);
- } else {
- usnic_dbg("Ignorning Link UP on %s\n",
- us_ibdev->ib_dev.name);
- }
- break;
- case NETDEV_DOWN:
- if (us_ibdev->link_up) {
+ } else if (us_ibdev->link_up && !netif_carrier_ok(netdev)) {
us_ibdev->link_up = false;
usnic_info("Link DOWN on %s\n", us_ibdev->ib_dev.name);
usnic_ib_qp_grp_modify_active_to_err(us_ibdev);
@@ -170,7 +166,8 @@ static void usnic_ib_handle_usdev_event(struct usnic_ib_dev *us_ibdev,
ib_event.element.port_num = 1;
ib_dispatch_event(&ib_event);
} else {
- usnic_dbg("Ignorning Link DOWN on %s\n",
+ usnic_dbg("Ignorning %s on %s\n",
+ usnic_ib_netdev_event_to_string(event),
us_ibdev->ib_dev.name);
}
break;
usNIC netdev notifier handler does not correctly handle the NETDEV_CHANGE event. This patch adds handling for NETDEV_CHANGE. Signed-off-by: Upinder Malhi <umalhi@cisco.com> --- drivers/infiniband/hw/usnic/usnic_ib_main.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)