Convert to net_device_ops for Linux 2.6.29+

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@4002 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
proski 2009-04-15 04:21:12 +00:00
parent ac79ec6182
commit 43c86cb332
3 changed files with 50 additions and 1 deletions

View File

@ -470,6 +470,20 @@ MODULE_PARM_DESC(ieee80211_debug, "Load-time 802.11 debug output enable");
(bssid)[0] |= (((id) << 2) | 0x02); \
} while (0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
static const struct net_device_ops ath_netdev_ops = {
.ndo_open = ath_init,
.ndo_stop = ath_stop,
.ndo_start_xmit = ath_hardstart,
.ndo_tx_timeout = ath_tx_timeout,
.ndo_set_multicast_list = ath_mode_init,
.ndo_do_ioctl = ath_ioctl,
.ndo_get_stats = ath_getstats,
.ndo_set_mac_address = ath_set_mac_address,
.ndo_change_mtu = ath_change_mtu,
};
#endif
/* Initialize ath_softc structure */
int
@ -818,16 +832,20 @@ ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
}
/* NB: ether_setup is done by bus-specific code */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
dev->open = ath_init;
dev->stop = ath_stop;
dev->hard_start_xmit = ath_hardstart;
dev->tx_timeout = ath_tx_timeout;
dev->watchdog_timeo = 5 * HZ;
dev->set_multicast_list = ath_mode_init;
dev->do_ioctl = ath_ioctl;
dev->get_stats = ath_getstats;
dev->set_mac_address = ath_set_mac_address;
dev->change_mtu = ath_change_mtu;
#else
dev->netdev_ops = &ath_netdev_ops;
#endif
dev->watchdog_timeo = 5 * HZ;
dev->tx_queue_len = ATH_TXBUF - ATH_TXBUF_MGT_RESERVED;
#ifdef USE_HEADERLEN_RESV
dev->hard_header_len += sizeof(struct ieee80211_qosframe) +
@ -12144,8 +12162,13 @@ ath_rcv_dev_event(struct notifier_block *this, unsigned long event,
struct net_device *dev = (struct net_device *)ptr;
struct ath_softc *sc = (struct ath_softc *)netdev_priv(dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
if (!dev || !sc || dev->open != &ath_init)
return 0;
#else
if (!dev || !sc || dev->netdev_ops->ndo_open != &ath_init)
return 0;
#endif
switch (event) {
case NETDEV_CHANGENAME:

View File

@ -400,6 +400,18 @@ ieee80211_ifdetach(struct ieee80211com *ic)
}
EXPORT_SYMBOL(ieee80211_ifdetach);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
static const struct net_device_ops ieee80211_netdev_ops = {
.ndo_get_stats = ieee80211_getstats,
.ndo_open = ieee80211_open,
.ndo_stop = ieee80211_stop,
.ndo_start_xmit = ieee80211_hardstart,
.ndo_set_multicast_list = ieee80211_set_multicast_list,
.ndo_change_mtu = ieee80211_change_mtu,
.ndo_do_ioctl = ieee80211_ioctl,
};
#endif
int
ieee80211_vap_setup(struct ieee80211com *ic, struct net_device *dev,
const char *name, int opmode, int flags)
@ -421,6 +433,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct net_device *dev,
strncpy(dev->name, name, sizeof(dev->name));
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
dev->get_stats = ieee80211_getstats;
dev->open = ieee80211_open;
dev->stop = ieee80211_stop;
@ -428,6 +441,9 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct net_device *dev,
dev->set_multicast_list = ieee80211_set_multicast_list;
dev->change_mtu = ieee80211_change_mtu;
dev->do_ioctl = ieee80211_ioctl;
#else
dev->netdev_ops = &ieee80211_netdev_ops;
#endif
dev->tx_queue_len = 0; /* NB: bypass queuing */
dev->hard_header_len = parent->hard_header_len;
/*
@ -1733,7 +1749,11 @@ ieee80211_set_multicast_list(struct net_device *dev)
IEEE80211_UNLOCK_IRQ(ic);
/* XXX: Merge multicast list into parent device */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
parent->set_multicast_list(ic->ic_dev);
#else
parent->netdev_ops->ndo_set_multicast_list(ic->ic_dev);
#endif
}
void

View File

@ -962,8 +962,14 @@ ieee80211_rcv_dev_event(struct notifier_block *this, unsigned long event,
void *ptr)
{
struct net_device *dev = (struct net_device *)ptr;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
if (!dev || dev->open != &ieee80211_open)
return 0;
#else
if (!dev || dev->netdev_ops->ndo_open != &ieee80211_open)
return 0;
#endif
switch (event) {
case NETDEV_CHANGENAME: