mac80211: convert master interface to netdev_ops

Also call our own ieee80211_master_setup routine instead of
overwriting almost all the values from ether_setup; this
loses a few assignments that are pointless on the master
interface anyway.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Johannes Berg 2009-01-30 13:36:25 +01:00 committed by John W. Linville
parent 587e729ecf
commit 7230645e32

View File

@ -791,6 +791,23 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
} }
EXPORT_SYMBOL(ieee80211_alloc_hw); EXPORT_SYMBOL(ieee80211_alloc_hw);
static const struct net_device_ops ieee80211_master_ops = {
.ndo_start_xmit = ieee80211_master_start_xmit,
.ndo_open = ieee80211_master_open,
.ndo_stop = ieee80211_master_stop,
.ndo_set_multicast_list = ieee80211_master_set_multicast_list,
.ndo_select_queue = ieee80211_select_queue,
};
static void ieee80211_master_setup(struct net_device *mdev)
{
mdev->type = ARPHRD_IEEE80211;
mdev->netdev_ops = &ieee80211_master_ops;
mdev->header_ops = &ieee80211_header_ops;
mdev->tx_queue_len = 1000;
mdev->addr_len = ETH_ALEN;
}
int ieee80211_register_hw(struct ieee80211_hw *hw) int ieee80211_register_hw(struct ieee80211_hw *hw)
{ {
struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_local *local = hw_to_local(hw);
@ -840,7 +857,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
hw->ampdu_queues = 0; hw->ampdu_queues = 0;
mdev = alloc_netdev_mq(sizeof(struct ieee80211_master_priv), mdev = alloc_netdev_mq(sizeof(struct ieee80211_master_priv),
"wmaster%d", ether_setup, "wmaster%d", ieee80211_master_setup,
ieee80211_num_queues(hw)); ieee80211_num_queues(hw));
if (!mdev) if (!mdev)
goto fail_mdev_alloc; goto fail_mdev_alloc;
@ -851,13 +868,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
ieee80211_rx_bss_list_init(local); ieee80211_rx_bss_list_init(local);
mdev->hard_start_xmit = ieee80211_master_start_xmit;
mdev->open = ieee80211_master_open;
mdev->stop = ieee80211_master_stop;
mdev->type = ARPHRD_IEEE80211;
mdev->header_ops = &ieee80211_header_ops;
mdev->set_multicast_list = ieee80211_master_set_multicast_list;
local->hw.workqueue = local->hw.workqueue =
create_singlethread_workqueue(wiphy_name(local->hw.wiphy)); create_singlethread_workqueue(wiphy_name(local->hw.wiphy));
if (!local->hw.workqueue) { if (!local->hw.workqueue) {
@ -923,8 +933,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
goto fail_wep; goto fail_wep;
} }
local->mdev->select_queue = ieee80211_select_queue;
/* add one default STA interface if supported */ /* add one default STA interface if supported */
if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) {
result = ieee80211_if_add(local, "wlan%d", NULL, result = ieee80211_if_add(local, "wlan%d", NULL,