Root/package/madwifi/patches/432-netdev_ops.patch

1Convert to net_device_ops for Linux 2.6.29+
2http://madwifi-project.org/changeset/4005
3--- a/ath/if_ath.c
4+++ b/ath/if_ath.c
5@@ -566,6 +566,20 @@ static inline int rate_factor(int mode)
6 
7 /* Initialize ath_softc structure */
8 
9+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
10+static const struct net_device_ops ath_netdev_ops = {
11+ .ndo_open = ath_init,
12+ .ndo_stop = ath_stop,
13+ .ndo_start_xmit = ath_hardstart,
14+ .ndo_tx_timeout = ath_tx_timeout,
15+ .ndo_set_multicast_list = ath_mode_init,
16+ .ndo_do_ioctl = ath_ioctl,
17+ .ndo_get_stats = ath_getstats,
18+ .ndo_set_mac_address = ath_set_mac_address,
19+ .ndo_change_mtu = ath_change_mtu,
20+};
21+#endif
22+
23 int
24 ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
25 {
26@@ -865,16 +879,20 @@ ath_attach(u_int16_t devid, struct net_d
27     }
28 
29     /* NB: ether_setup is done by bus-specific code */
30+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
31     dev->open = ath_init;
32     dev->stop = ath_stop;
33     dev->hard_start_xmit = ath_hardstart;
34     dev->tx_timeout = ath_tx_timeout;
35- dev->watchdog_timeo = 5 * HZ;
36     dev->set_multicast_list = ath_mode_init;
37     dev->do_ioctl = ath_ioctl;
38     dev->get_stats = ath_getstats;
39     dev->set_mac_address = ath_set_mac_address;
40     dev->change_mtu = ath_change_mtu;
41+#else
42+ dev->netdev_ops = &ath_netdev_ops;
43+#endif
44+ dev->watchdog_timeo = 5 * HZ;
45     dev->tx_queue_len = ATH_TXBUF - ATH_TXBUF_MGT_RESERVED;
46 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
47     netif_napi_add(dev, &sc->sc_napi, ath_rx_poll, 64);
48@@ -1257,7 +1275,6 @@ ath_detach(struct net_device *dev)
49     ath_dynamic_sysctl_unregister(sc);
50     ATH_LOCK_DESTROY(sc);
51     ATH_HAL_LOCK_DESTROY(sc);
52- dev->stop = NULL; /* prevent calling ath_stop again */
53     unregister_netdev(dev);
54     return 0;
55 }
56@@ -12732,8 +12749,13 @@ ath_rcv_dev_event(struct notifier_block
57     struct net_device *dev = (struct net_device *)ptr;
58     struct ath_softc *sc = (struct ath_softc *)netdev_priv(dev);
59 
60+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
61     if (!dev || !sc || dev->open != &ath_init)
62         return 0;
63+#else
64+ if (!dev || !sc || dev->netdev_ops->ndo_open != &ath_init)
65+ return 0;
66+#endif
67 
68     switch (event) {
69     case NETDEV_CHANGENAME:
70--- a/net80211/ieee80211.c
71+++ b/net80211/ieee80211.c
72@@ -451,6 +451,18 @@ ieee80211_ifdetach(struct ieee80211com *
73 }
74 EXPORT_SYMBOL(ieee80211_ifdetach);
75 
76+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
77+static const struct net_device_ops ieee80211_netdev_ops = {
78+ .ndo_get_stats = ieee80211_getstats,
79+ .ndo_open = ieee80211_open,
80+ .ndo_stop = ieee80211_stop,
81+ .ndo_start_xmit = ieee80211_hardstart,
82+ .ndo_set_multicast_list = ieee80211_set_multicast_list,
83+ .ndo_change_mtu = ieee80211_change_mtu,
84+ .ndo_do_ioctl = ieee80211_ioctl,
85+};
86+#endif
87+
88 int
89 ieee80211_vap_setup(struct ieee80211com *ic, struct net_device *dev,
90     const char *name, int opmode, int flags, struct ieee80211vap *master)
91@@ -471,16 +483,21 @@ ieee80211_vap_setup(struct ieee80211com
92         } else
93             strncpy(dev->name, name, sizeof(dev->name));
94     }
95+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
96 
97     dev->get_stats = ieee80211_getstats;
98     dev->open = ieee80211_open;
99     dev->stop = ieee80211_stop;
100     dev->hard_start_xmit = ieee80211_hardstart;
101     dev->set_multicast_list = ieee80211_set_multicast_list;
102+ dev->do_ioctl = ieee80211_ioctl;
103 #if 0
104     dev->set_mac_address = ieee80211_set_mac_address;
105 #endif
106      dev->change_mtu = ieee80211_change_mtu;
107+#else
108+ dev->netdev_ops = &ieee80211_netdev_ops;
109+#endif
110     dev->tx_queue_len = 0; /* NB: bypass queuing */
111     dev->hard_header_len = parent->hard_header_len;
112     /*
113@@ -1824,7 +1841,11 @@ ieee80211_set_multicast_list(struct net_
114     IEEE80211_UNLOCK_IRQ(ic);
115 
116     /* XXX: Merge multicast list into parent device */
117+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
118     parent->set_multicast_list(ic->ic_dev);
119+#else
120+ parent->netdev_ops->ndo_set_multicast_list(ic->ic_dev);
121+#endif
122 }
123 
124 void
125--- a/net80211/ieee80211_linux.c
126+++ b/net80211/ieee80211_linux.c
127@@ -984,8 +984,14 @@ ieee80211_rcv_dev_event(struct notifier_
128     void *ptr)
129 {
130     struct net_device *dev = (struct net_device *) ptr;
131+
132+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
133     if (!dev || dev->open != &ieee80211_open)
134         return 0;
135+#else
136+ if (!dev || dev->netdev_ops->ndo_open != &ieee80211_open)
137+ return 0;
138+#endif
139 
140     switch (event) {
141     case NETDEV_CHANGENAME:
142--- a/net80211/ieee80211_var.h
143+++ b/net80211/ieee80211_var.h
144@@ -739,6 +739,7 @@ void ieee80211_build_sc_ie(struct ieee80
145 void ieee80211_dfs_action(struct ieee80211com *);
146 void ieee80211_expire_channel_excl_restrictions(struct ieee80211com *);
147 void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
148+int ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
149 
150 /*
151  * Iterate through ic_channels to enumerate all distinct ic_ieee channel numbers.
152--- a/net80211/ieee80211_wireless.c
153+++ b/net80211/ieee80211_wireless.c
154@@ -5954,7 +5954,7 @@ static struct iw_handler_def ieee80211_i
155 /*
156  * Handle private ioctl requests.
157  */
158-static int
159+int
160 ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
161 {
162     struct ieee80211vap *vap = netdev_priv(dev);
163@@ -6044,7 +6044,6 @@ ieee80211_ioctl_vattach(struct ieee80211
164 {
165     struct net_device *dev = vap->iv_dev;
166 
167- dev->do_ioctl = ieee80211_ioctl;
168 #if IW_HANDLER_VERSION < 7
169     dev->get_wireless_stats = ieee80211_iw_getstats;
170 #endif
171--- a/net80211/ieee80211_input.c
172+++ b/net80211/ieee80211_input.c
173@@ -1188,7 +1188,11 @@ ieee80211_deliver_data(struct ieee80211_
174             skb1->protocol = __constant_htons(ETH_P_802_2);
175             /* XXX insert vlan tag before queue it? */
176             ni_tmp = SKB_CB(skb1)->ni; /* remember node so we can free it */
177+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
178             ret = dev->hard_start_xmit(skb1, dev);
179+#else
180+ ret = dev->netdev_ops->ndo_start_xmit(skb1, dev);
181+#endif
182 
183             if (ret == NETDEV_TX_BUSY)
184                 ieee80211_dev_kfree_skb(&skb1);
185

Archive Download this file



interactive