提交 d549f55f 编写于 作者: R Roland Dreier

RDMA/ocrdma: Don't call vlan_dev_real_dev() for non-VLAN netdevs

If CONFIG_VLAN_8021Q is not set, then vlan_dev_real_dev() just goes BUG(),
so we shouldn't call it unless we're actually dealing with a VLAN netdev.
Reported-by: NFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 0d7614f0
...@@ -161,7 +161,7 @@ static void ocrdma_add_default_sgid(struct ocrdma_dev *dev) ...@@ -161,7 +161,7 @@ static void ocrdma_add_default_sgid(struct ocrdma_dev *dev)
ocrdma_get_guid(dev, &sgid->raw[8]); 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) static void ocrdma_add_vlan_sgids(struct ocrdma_dev *dev)
{ {
struct net_device *netdev, *tmp; struct net_device *netdev, *tmp;
...@@ -202,14 +202,13 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev) ...@@ -202,14 +202,13 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev)
return 0; return 0;
} }
#if IS_ENABLED(CONFIG_IPV6) || IS_ENABLED(CONFIG_VLAN_8021Q) #if IS_ENABLED(CONFIG_IPV6)
static int ocrdma_inet6addr_event(struct notifier_block *notifier, static int ocrdma_inet6addr_event(struct notifier_block *notifier,
unsigned long event, void *ptr) unsigned long event, void *ptr)
{ {
struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr; struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr;
struct net_device *event_netdev = ifa->idev->dev; struct net_device *netdev = ifa->idev->dev;
struct net_device *netdev = NULL;
struct ib_event gid_event; struct ib_event gid_event;
struct ocrdma_dev *dev; struct ocrdma_dev *dev;
bool found = false; bool found = false;
...@@ -217,11 +216,12 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier, ...@@ -217,11 +216,12 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier,
bool is_vlan = false; bool is_vlan = false;
u16 vid = 0; u16 vid = 0;
netdev = vlan_dev_real_dev(event_netdev); is_vlan = netdev->priv_flags & IFF_802_1Q_VLAN;
if (netdev != event_netdev) { if (is_vlan) {
is_vlan = true; vid = vlan_dev_vlan_id(netdev);
vid = vlan_dev_vlan_id(event_netdev); netdev = vlan_dev_real_dev(netdev);
} }
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(dev, &ocrdma_dev_list, entry) { list_for_each_entry_rcu(dev, &ocrdma_dev_list, entry) {
if (dev->nic_info.netdev == netdev) { if (dev->nic_info.netdev == netdev) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册