From patchwork Fri Dec 20 20:26:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Upinder Malhi (umalhi)" X-Patchwork-Id: 3391691 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C0CAB9F344 for ; Fri, 20 Dec 2013 20:27:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB72020666 for ; Fri, 20 Dec 2013 20:27:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0096520703 for ; Fri, 20 Dec 2013 20:27:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752362Ab3LTU1O (ORCPT ); Fri, 20 Dec 2013 15:27:14 -0500 Received: from mtv-iport-1.cisco.com ([173.36.130.12]:18422 "EHLO mtv-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751296Ab3LTU1L (ORCPT ); Fri, 20 Dec 2013 15:27:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1811; q=dns/txt; s=iport; t=1387571231; x=1388780831; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=XBUTiMEpxUlKJM4RC/Wc/5eNcMzMQW6eHnoGAxJs5HE=; b=LCA5NaEwFEZK2EMqHPPWEW+xlPpbB+Ond/fnOwbgsjq/5Tx3vPc+ikks jl5qgCzI/W5ScmpfK1yGMXDZ1DF/rlXVCTdyBDAgdq59pK6ZSymkxqgvT H66TtKL/PHxNsjyWzJSmYw2q5AF675veX3RE94okNpf/+yKu1idhz4iSH Q=; X-IronPort-AV: E=Sophos;i="4.95,523,1384300800"; d="scan'208";a="97830922" Received: from mtv-core-3.cisco.com ([171.68.58.8]) by mtv-iport-1.cisco.com with ESMTP; 20 Dec 2013 20:27:10 +0000 Received: from sjc-savbu-bld03.cisco.com (sjc-savbu-bld03.cisco.com [171.71.188.58]) by mtv-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id rBKKRAPq001726; Fri, 20 Dec 2013 20:27:10 GMT Received: by sjc-savbu-bld03.cisco.com (Postfix, from userid 246720) id 081783F820; Fri, 20 Dec 2013 12:27:10 -0800 (PST) From: Upinder Malhi To: linux-rdma@vger.kernel.org, roland@kernel.org Cc: Upinder Malhi Subject: [PATCH for-next 13/15] IB/usnic: Handle NETDEV_CHANGE Date: Fri, 20 Dec 2013 12:26:44 -0800 Message-Id: <1387571206-8043-14-git-send-email-umalhi@cisco.com> X-Mailer: git-send-email 1.8.0-rc0 In-Reply-To: <1387571206-8043-1-git-send-email-umalhi@cisco.com> References: <1387571206-8043-1-git-send-email-umalhi@cisco.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-15.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_DEF_DKIM_WL autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP usNIC netdev notifier handler does not correctly handle the NETDEV_CHANGE event. This patch adds handling for NETDEV_CHANGE. Signed-off-by: Upinder Malhi --- drivers/infiniband/hw/usnic/usnic_ib_main.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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;