From patchwork Sat Aug 11 13:28:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 1307701 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 70A5CDF2D2 for ; Sat, 11 Aug 2012 09:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753127Ab2HKJWg (ORCPT ); Sat, 11 Aug 2012 05:22:36 -0400 Received: from cmexedge1.ext.emulex.com ([138.239.224.99]:35733 "EHLO CMEXEDGE1.ext.emulex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753124Ab2HKJWf (ORCPT ); Sat, 11 Aug 2012 05:22:35 -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; Sat, 11 Aug 2012 02:22:59 -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; Sat, 11 Aug 2012 02:22:30 -0700 From: Parav Pandit To: CC: Parav Pandit Subject: [PATCHv1] RDMA/ocrdma: Fixed CONFIG_VLAN_8021Q. Date: Sat, 11 Aug 2012 18:58:10 +0530 X-Mailer: git-send-email 1.6.0.2 MIME-Version: 1.0 Message-ID: <79b2796a-f2a1-4ca4-8f19-17729e18af48@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. Reported-by: Fengguang Wu 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..f4e3696 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) 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) + 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)