From patchwork Fri Aug 10 16:28:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 1305261 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0A4E83FC33 for ; Fri, 10 Aug 2012 12:22:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751908Ab2HJMW3 (ORCPT ); Fri, 10 Aug 2012 08:22:29 -0400 Received: from cmexedge1.ext.emulex.com ([138.239.224.99]:53926 "EHLO CMEXEDGE1.ext.emulex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751842Ab2HJMW3 (ORCPT ); Fri, 10 Aug 2012 08:22:29 -0400 Received: from exht1.ad.emulex.com (138.239.113.183) by CMEXEDGE1.ext.emulex.com (138.239.224.99) with Microsoft SMTP Server (TLS) id 14.2.283.3; Fri, 10 Aug 2012 05:22:52 -0700 Received: from localhost.localdomain (10.192.199.176) by exht1.ad.emulex.com (138.239.113.183) with Microsoft SMTP Server id 8.3.159.2; Fri, 10 Aug 2012 05:22:26 -0700 From: Parav Pandit To: CC: Parav Pandit Subject: [PATCH] RDMA/ocrdma: Fixed CONFIG_VLAN_8021Q. Date: Fri, 10 Aug 2012 21:58:11 +0530 X-Mailer: git-send-email 1.6.0.2 MIME-Version: 1.0 Message-ID: <9ac93bde-c809-45c2-86e2-a50ea6a1020f@exht1.ad.emulex.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Fixed avoiding checking real vlan dev in scenario when VLAN is disabled and ipv6 is enabled. Signed-off-by: Parav Pandit --- drivers/infiniband/hw/ocrdma/ocrdma_main.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index 5a04452..7146ffd 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c @@ -161,7 +161,7 @@ static void ocrdma_add_default_sgid(struct ocrdma_dev *dev) ocrdma_get_guid(dev, &sgid->raw[8]); } -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) +#if IS_ENABLED(CONFIG_VLAN_8021Q) || IS_ENABLED(CONFIG_VLAN_8021Q_MODULE) static void ocrdma_add_vlan_sgids(struct ocrdma_dev *dev) { struct net_device *netdev, *tmp; @@ -202,8 +202,16 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev) return 0; } -#if IS_ENABLED(CONFIG_IPV6) || IS_ENABLED(CONFIG_VLAN_8021Q) +static struct net_device *ocrdma_get_real_netdev(struct net_device *netdev) +{ +#if IS_ENABLED(CONFIG_VLAN_8021Q) || IS_ENABLED(CONFIG_VLAN_8021Q_MODULE) + return vlan_dev_real_dev(netdev); +#else + return netdev; +#endif +} +#if IS_ENABLED(CONFIG_IPV6) static int ocrdma_inet6addr_event(struct notifier_block *notifier, unsigned long event, void *ptr) { @@ -217,7 +225,7 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier, bool is_vlan = false; u16 vid = 0; - netdev = vlan_dev_real_dev(event_netdev); + netdev = ocrdma_get_real_netdev(event_netdev); if (netdev != event_netdev) { is_vlan = true; vid = vlan_dev_vlan_id(event_netdev); @@ -262,7 +270,7 @@ static struct notifier_block ocrdma_inet6addr_notifier = { .notifier_call = ocrdma_inet6addr_event }; -#endif /* IPV6 and VLAN */ +#endif /* IPV6 */ static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device, u8 port_num)