Re: [PATCHv1] RDMA/ocrdma: Fixed CONFIG_VLAN_8021Q.

2012-08-15 Thread Roland Dreier
On Sat, Aug 11, 2012 at 6:28 AM, Parav Pandit parav.pan...@emulex.com wrote:
 +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
 +}

As I said before, I don't think this wrapper is needed, and even if it were,
it would be much better to write it without using the preprocessor (as I said,
you can do if (IS_ENABLED(...)) in C code now too).

I'm going to stick to my simpler version unless there is something wrong
with it...

 - R.
--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv1] RDMA/ocrdma: Fixed CONFIG_VLAN_8021Q.

2012-08-11 Thread Parav Pandit
Fixed avoiding checking real vlan dev in scenario
when VLAN is disabled and ipv6 is enabled.

Reported-by: Fengguang Wu fengguang...@intel.com
Signed-off-by: Parav Pandit parav.pan...@emulex.com
---
 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)
-- 
1.6.0.2

--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html