History

net, wireless: overwrite default_ethtool_ops

Since: commit 2c60db037034d27f8c636403355d52872da92f81 Author: Eric Dumazet <edumazet@google.com> Date: Sun Sep 16 09:17:26 2012 +0000 net: provide a default dev->ethtool_ops wireless core does not correctly assign ethtool_ops. After alloc_netdev*() call, some cfg80211 drivers provide they own ethtool_ops, but some do not. For them, wireless core provide generic cfg80211_ethtool_ops, which is assigned in NETDEV_REGISTER notify call: if (!dev->ethtool_ops) dev->ethtool_ops = &cfg80211_ethtool_ops; But after Eric's commit, dev->ethtool_ops is no longer NULL (on cfg80211 drivers without custom ethtool_ops), but points to &default_ethtool_ops. In order to fix the problem, provide function which will overwrite default_ethtool_ops and use it by wireless core.

Stanislaw Gruszka committed 13 years ago

Commit d07d7501 parent f7e9e233 files · +12 −2Browse files

Unified · Split

3 files
  1. include/linux/netdevice.h +3 −0
  2. net/core/dev.c +8 −0
  3. net/wireless/core.c +1 −2
include/linux/netdevice.h+3−0
@@ -60,6 +60,9 @@ struct wireless_dev; · 59 unmodified lines
60#define SET_ETHTOOL_OPS(netdev,ops) \60#define SET_ETHTOOL_OPS(netdev,ops) \
61 ( (netdev)->ethtool_ops = (ops) )61 ( (netdev)->ethtool_ops = (ops) )
62 62
63extern void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops);
65
63/* hardware address assignment types */66/* hardware address assignment types */
64#define NET_ADDR_PERM 0 /* address is permanent (default) */67#define NET_ADDR_PERM 0 /* address is permanent (default) */
65#define NET_ADDR_RANDOM 1 /* address is generated randomly */68#define NET_ADDR_RANDOM 1 /* address is generated randomly */
net/core/dev.c+8−0
@@ -6121,6 +6121,14 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev) · 6120 unmodified lines
6121 6121
6122static const struct ethtool_ops default_ethtool_ops;6122static const struct ethtool_ops default_ethtool_ops;
6123 6123
6124void netdev_set_default_ethtool_ops(struct net_device *dev,
6125 const struct ethtool_ops *ops)
6126{
6127 if (dev->ethtool_ops == &default_ethtool_ops)
6128 dev->ethtool_ops = ops;
6129}
6130EXPORT_SYMBOL_GPL(netdev_set_default_ethtool_ops);
6131
6124/**6132/**
6125 * alloc_netdev_mqs - allocate network device6133 * alloc_netdev_mqs - allocate network device
6126 * @sizeof_priv: size of private data to allocate space for6134 * @sizeof_priv: size of private data to allocate space for
net/wireless/core.c+1−2
@@ -866,8 +866,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, · 865 unmodified lines
866 /* allow mac80211 to determine the timeout */866 /* allow mac80211 to determine the timeout */
867 wdev->ps_timeout = -1;867 wdev->ps_timeout = -1;
868 868
869 if (!dev->ethtool_ops)869 netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
870 dev->ethtool_ops = &cfg80211_ethtool_ops;
871 870
872 if ((wdev->iftype == NL80211_IFTYPE_STATION ||871 if ((wdev->iftype == NL80211_IFTYPE_STATION ||
873 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||872 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||