aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/iface.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 00562a8b99cf..915d04323a32 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -591,19 +591,6 @@ static void ieee80211_set_multicast_list(struct net_device *dev)
591 dev_mc_sync(local->mdev, dev); 591 dev_mc_sync(local->mdev, dev);
592} 592}
593 593
594static void ieee80211_if_setup(struct net_device *dev)
595{
596 ether_setup(dev);
597 dev->hard_start_xmit = ieee80211_subif_start_xmit;
598 dev->wireless_handlers = &ieee80211_iw_handler_def;
599 dev->set_multicast_list = ieee80211_set_multicast_list;
600 dev->change_mtu = ieee80211_change_mtu;
601 dev->open = ieee80211_open;
602 dev->stop = ieee80211_stop;
603 dev->destructor = free_netdev;
604 /* we will validate the address ourselves in ->open */
605 dev->validate_addr = NULL;
606}
607/* 594/*
608 * Called when the netdev is removed or, by the code below, before 595 * Called when the netdev is removed or, by the code below, before
609 * the interface type changes. 596 * the interface type changes.
@@ -671,6 +658,34 @@ static void ieee80211_teardown_sdata(struct net_device *dev)
671 WARN_ON(flushed); 658 WARN_ON(flushed);
672} 659}
673 660
661static const struct net_device_ops ieee80211_dataif_ops = {
662 .ndo_open = ieee80211_open,
663 .ndo_stop = ieee80211_stop,
664 .ndo_uninit = ieee80211_teardown_sdata,
665 .ndo_start_xmit = ieee80211_subif_start_xmit,
666 .ndo_set_multicast_list = ieee80211_set_multicast_list,
667 .ndo_change_mtu = ieee80211_change_mtu,
668 .ndo_set_mac_address = eth_mac_addr,
669};
670
671static const struct net_device_ops ieee80211_monitorif_ops = {
672 .ndo_open = ieee80211_open,
673 .ndo_stop = ieee80211_stop,
674 .ndo_uninit = ieee80211_teardown_sdata,
675 .ndo_start_xmit = ieee80211_monitor_start_xmit,
676 .ndo_set_multicast_list = ieee80211_set_multicast_list,
677 .ndo_change_mtu = ieee80211_change_mtu,
678 .ndo_set_mac_address = eth_mac_addr,
679};
680
681static void ieee80211_if_setup(struct net_device *dev)
682{
683 ether_setup(dev);
684 dev->netdev_ops = &ieee80211_dataif_ops;
685 dev->wireless_handlers = &ieee80211_iw_handler_def;
686 dev->destructor = free_netdev;
687}
688
674/* 689/*
675 * Helper function to initialise an interface to a specific type. 690 * Helper function to initialise an interface to a specific type.
676 */ 691 */
@@ -682,7 +697,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
682 697
683 /* and set some type-dependent values */ 698 /* and set some type-dependent values */
684 sdata->vif.type = type; 699 sdata->vif.type = type;
685 sdata->dev->hard_start_xmit = ieee80211_subif_start_xmit; 700 sdata->dev->netdev_ops = &ieee80211_dataif_ops;
686 sdata->wdev.iftype = type; 701 sdata->wdev.iftype = type;
687 702
688 /* only monitor differs */ 703 /* only monitor differs */
@@ -703,7 +718,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
703 break; 718 break;
704 case NL80211_IFTYPE_MONITOR: 719 case NL80211_IFTYPE_MONITOR:
705 sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP; 720 sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP;
706 sdata->dev->hard_start_xmit = ieee80211_monitor_start_xmit; 721 sdata->dev->netdev_ops = &ieee80211_monitorif_ops;
707 sdata->u.mntr_flags = MONITOR_FLAG_CONTROL | 722 sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
708 MONITOR_FLAG_OTHER_BSS; 723 MONITOR_FLAG_OTHER_BSS;
709 break; 724 break;
@@ -809,8 +824,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
809 if (ret) 824 if (ret)
810 goto fail; 825 goto fail;
811 826
812 ndev->uninit = ieee80211_teardown_sdata;
813
814 if (ieee80211_vif_is_mesh(&sdata->vif) && 827 if (ieee80211_vif_is_mesh(&sdata->vif) &&
815 params && params->mesh_id_len) 828 params && params->mesh_id_len)
816 ieee80211_sdata_set_mesh_id(sdata, 829 ieee80211_sdata_set_mesh_id(sdata,