diff mbox

[v1,for-next,13/15] IB/usnic: Handle NETDEV_CHANGE

Message ID 1389307663-11296-14-git-send-email-umalhi@cisco.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Upinder Malhi (umalhi) Jan. 9, 2014, 10:47 p.m. UTC
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(-)
diff mbox

Patch

diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index 1cf22d5..ae4e544 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -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;