hostap: convert to net_device_ops
authorStephen Hemminger <shemminger@vyatta.com>
Fri, 20 Mar 2009 19:36:43 +0000 (19:36 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Mar 2009 05:55:36 +0000 (22:55 -0700)
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireless/hostap/hostap_hw.c
drivers/net/wireless/hostap/hostap_main.c

index e80ff608dd2aea93b280811a69b80e233030914c..3dad1cf8f241f3fbbbefa2bbcf4643e257c1d2be 100644 (file)
@@ -3222,7 +3222,6 @@ while (0)
 
        hostap_setup_dev(dev, local, HOSTAP_INTERFACE_MASTER);
 
-       dev->hard_start_xmit = hostap_master_start_xmit;
        dev->type = ARPHRD_IEEE80211;
        dev->header_ops = &hostap_80211_ops;
 
index 792dd14c894eeb7a4052dad45dab801017579b5a..6fe122f18c0dcd68f8de72db16cc3310338aaf2b 100644 (file)
@@ -815,6 +815,46 @@ const struct header_ops hostap_80211_ops = {
 };
 EXPORT_SYMBOL(hostap_80211_ops);
 
+
+static const struct net_device_ops hostap_netdev_ops = {
+       .ndo_start_xmit         = hostap_data_start_xmit,
+
+       .ndo_open               = prism2_open,
+       .ndo_stop               = prism2_close,
+       .ndo_do_ioctl           = hostap_ioctl,
+       .ndo_set_mac_address    = prism2_set_mac_address,
+       .ndo_set_multicast_list = hostap_set_multicast_list,
+       .ndo_change_mtu         = prism2_change_mtu,
+       .ndo_tx_timeout         = prism2_tx_timeout,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
+static const struct net_device_ops hostap_mgmt_netdev_ops = {
+       .ndo_start_xmit         = hostap_mgmt_start_xmit,
+
+       .ndo_open               = prism2_open,
+       .ndo_stop               = prism2_close,
+       .ndo_do_ioctl           = hostap_ioctl,
+       .ndo_set_mac_address    = prism2_set_mac_address,
+       .ndo_set_multicast_list = hostap_set_multicast_list,
+       .ndo_change_mtu         = prism2_change_mtu,
+       .ndo_tx_timeout         = prism2_tx_timeout,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
+static const struct net_device_ops hostap_master_ops = {
+       .ndo_start_xmit         = hostap_master_start_xmit,
+
+       .ndo_open               = prism2_open,
+       .ndo_stop               = prism2_close,
+       .ndo_do_ioctl           = hostap_ioctl,
+       .ndo_set_mac_address    = prism2_set_mac_address,
+       .ndo_set_multicast_list = hostap_set_multicast_list,
+       .ndo_change_mtu         = prism2_change_mtu,
+       .ndo_tx_timeout         = prism2_tx_timeout,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 void hostap_setup_dev(struct net_device *dev, local_info_t *local,
                      int type)
 {
@@ -830,30 +870,25 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local,
                iface->wireless_data.spy_data = &iface->spy_data;
                dev->wireless_data = &iface->wireless_data;
        }
-       dev->wireless_handlers =
-               (struct iw_handler_def *) &hostap_iw_handler_def;
-       dev->do_ioctl = hostap_ioctl;
-       dev->open = prism2_open;
-       dev->stop = prism2_close;
-       dev->set_mac_address = prism2_set_mac_address;
-       dev->set_multicast_list = hostap_set_multicast_list;
-       dev->change_mtu = prism2_change_mtu;
-       dev->tx_timeout = prism2_tx_timeout;
+       dev->wireless_handlers = &hostap_iw_handler_def;
        dev->watchdog_timeo = TX_TIMEOUT;
 
-       if (type == HOSTAP_INTERFACE_AP) {
-               dev->hard_start_xmit = hostap_mgmt_start_xmit;
+       switch(type) {
+       case HOSTAP_INTERFACE_AP:
+               dev->netdev_ops = &hostap_mgmt_netdev_ops;
                dev->type = ARPHRD_IEEE80211;
                dev->header_ops = &hostap_80211_ops;
-       } else {
-               dev->hard_start_xmit = hostap_data_start_xmit;
+               break;
+       case HOSTAP_INTERFACE_MASTER:
+               dev->tx_queue_len = 0;  /* use main radio device queue */
+               dev->netdev_ops = &hostap_master_ops;
+               break;
+       default:
+               dev->netdev_ops = &hostap_netdev_ops;
        }
 
        dev->mtu = local->mtu;
-       if (type != HOSTAP_INTERFACE_MASTER) {
-               /* use main radio device queue */
-               dev->tx_queue_len = 0;
-       }
+
 
        SET_ETHTOOL_OPS(dev, &prism2_ethtool_ops);