Commit 3c4f2085 authored by Ivo van Doorn's avatar Ivo van Doorn Committed by David S. Miller

rt2x00: Move packet filter flags

The packet filter flags don't belong in the interface structure
because they are device based instead of interface based.
So move the filter fields out of struct interface and into rt2x00_dev.

Additionally we shouldn't change the filter based on the working
mode, if such a thing is needed than mac80211 should have done that.
Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e37ea213
...@@ -1422,7 +1422,6 @@ static void rt2400pci_configure_filter(struct ieee80211_hw *hw, ...@@ -1422,7 +1422,6 @@ static void rt2400pci_configure_filter(struct ieee80211_hw *hw,
struct dev_addr_list *mc_list) struct dev_addr_list *mc_list)
{ {
struct rt2x00_dev *rt2x00dev = hw->priv; struct rt2x00_dev *rt2x00dev = hw->priv;
struct interface *intf = &rt2x00dev->interface;
u32 reg; u32 reg;
/* /*
...@@ -1441,21 +1440,18 @@ static void rt2400pci_configure_filter(struct ieee80211_hw *hw, ...@@ -1441,21 +1440,18 @@ static void rt2400pci_configure_filter(struct ieee80211_hw *hw,
* Apply some rules to the filters: * Apply some rules to the filters:
* - Some filters imply different filters to be set. * - Some filters imply different filters to be set.
* - Some things we can't filter out at all. * - Some things we can't filter out at all.
* - Some filters are set based on interface type.
*/ */
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (*total_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
*total_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS;
/* /*
* Check if there is any work left for us. * Check if there is any work left for us.
*/ */
if (intf->filter == *total_flags) if (rt2x00dev->packet_filter == *total_flags)
return; return;
intf->filter = *total_flags; rt2x00dev->packet_filter = *total_flags;
/* /*
* Start configuration steps. * Start configuration steps.
......
...@@ -1751,7 +1751,6 @@ static void rt2500pci_configure_filter(struct ieee80211_hw *hw, ...@@ -1751,7 +1751,6 @@ static void rt2500pci_configure_filter(struct ieee80211_hw *hw,
struct dev_addr_list *mc_list) struct dev_addr_list *mc_list)
{ {
struct rt2x00_dev *rt2x00dev = hw->priv; struct rt2x00_dev *rt2x00dev = hw->priv;
struct interface *intf = &rt2x00dev->interface;
u32 reg; u32 reg;
/* /*
...@@ -1770,22 +1769,19 @@ static void rt2500pci_configure_filter(struct ieee80211_hw *hw, ...@@ -1770,22 +1769,19 @@ static void rt2500pci_configure_filter(struct ieee80211_hw *hw,
* Apply some rules to the filters: * Apply some rules to the filters:
* - Some filters imply different filters to be set. * - Some filters imply different filters to be set.
* - Some things we can't filter out at all. * - Some things we can't filter out at all.
* - Some filters are set based on interface type.
*/ */
if (mc_count) if (mc_count)
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (*total_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
*total_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS;
/* /*
* Check if there is any work left for us. * Check if there is any work left for us.
*/ */
if (intf->filter == *total_flags) if (rt2x00dev->packet_filter == *total_flags)
return; return;
intf->filter = *total_flags; rt2x00dev->packet_filter = *total_flags;
/* /*
* Start configuration steps. * Start configuration steps.
......
...@@ -1611,7 +1611,6 @@ static void rt2500usb_configure_filter(struct ieee80211_hw *hw, ...@@ -1611,7 +1611,6 @@ static void rt2500usb_configure_filter(struct ieee80211_hw *hw,
struct dev_addr_list *mc_list) struct dev_addr_list *mc_list)
{ {
struct rt2x00_dev *rt2x00dev = hw->priv; struct rt2x00_dev *rt2x00dev = hw->priv;
struct interface *intf = &rt2x00dev->interface;
u16 reg; u16 reg;
/* /*
...@@ -1630,22 +1629,19 @@ static void rt2500usb_configure_filter(struct ieee80211_hw *hw, ...@@ -1630,22 +1629,19 @@ static void rt2500usb_configure_filter(struct ieee80211_hw *hw,
* Apply some rules to the filters: * Apply some rules to the filters:
* - Some filters imply different filters to be set. * - Some filters imply different filters to be set.
* - Some things we can't filter out at all. * - Some things we can't filter out at all.
* - Some filters are set based on interface type.
*/ */
if (mc_count) if (mc_count)
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (*total_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
*total_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS;
/* /*
* Check if there is any work left for us. * Check if there is any work left for us.
*/ */
if (intf->filter == *total_flags) if (rt2x00dev->packet_filter == *total_flags)
return; return;
intf->filter = *total_flags; rt2x00dev->packet_filter = *total_flags;
/* /*
* When in atomic context, reschedule and let rt2x00lib * When in atomic context, reschedule and let rt2x00lib
......
...@@ -388,11 +388,6 @@ struct interface { ...@@ -388,11 +388,6 @@ struct interface {
* BBSID of the AP to associate with. * BBSID of the AP to associate with.
*/ */
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
/*
* Store the packet filter mode for the current interface.
*/
unsigned int filter;
}; };
static inline int is_interface_present(struct interface *intf) static inline int is_interface_present(struct interface *intf)
...@@ -675,6 +670,13 @@ struct rt2x00_dev { ...@@ -675,6 +670,13 @@ struct rt2x00_dev {
*/ */
struct mutex usb_cache_mutex; struct mutex usb_cache_mutex;
/*
* Current packet filter configuration for the device.
* This contains all currently active FIF_* flags send
* to us by mac80211 during configure_filter().
*/
unsigned int packet_filter;
/* /*
* Interface configuration. * Interface configuration.
*/ */
......
...@@ -417,7 +417,7 @@ static void rt2x00lib_packetfilter_scheduled(struct work_struct *work) ...@@ -417,7 +417,7 @@ static void rt2x00lib_packetfilter_scheduled(struct work_struct *work)
{ {
struct rt2x00_dev *rt2x00dev = struct rt2x00_dev *rt2x00dev =
container_of(work, struct rt2x00_dev, filter_work); container_of(work, struct rt2x00_dev, filter_work);
unsigned int filter = rt2x00dev->interface.filter; unsigned int filter = rt2x00dev->packet_filter;
/* /*
* Since we had stored the filter inside interface.filter, * Since we had stored the filter inside interface.filter,
...@@ -425,7 +425,7 @@ static void rt2x00lib_packetfilter_scheduled(struct work_struct *work) ...@@ -425,7 +425,7 @@ static void rt2x00lib_packetfilter_scheduled(struct work_struct *work)
* assume nothing has changed (*total_flags will be compared * assume nothing has changed (*total_flags will be compared
* to interface.filter to determine if any action is required). * to interface.filter to determine if any action is required).
*/ */
rt2x00dev->interface.filter = 0; rt2x00dev->packet_filter = 0;
rt2x00dev->ops->hw->configure_filter(rt2x00dev->hw, rt2x00dev->ops->hw->configure_filter(rt2x00dev->hw,
filter, &filter, 0, NULL); filter, &filter, 0, NULL);
......
...@@ -2310,7 +2310,6 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw, ...@@ -2310,7 +2310,6 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw,
struct dev_addr_list *mc_list) struct dev_addr_list *mc_list)
{ {
struct rt2x00_dev *rt2x00dev = hw->priv; struct rt2x00_dev *rt2x00dev = hw->priv;
struct interface *intf = &rt2x00dev->interface;
u32 reg; u32 reg;
/* /*
...@@ -2329,22 +2328,19 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw, ...@@ -2329,22 +2328,19 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw,
* Apply some rules to the filters: * Apply some rules to the filters:
* - Some filters imply different filters to be set. * - Some filters imply different filters to be set.
* - Some things we can't filter out at all. * - Some things we can't filter out at all.
* - Some filters are set based on interface type.
*/ */
if (mc_count) if (mc_count)
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (*total_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
*total_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS;
/* /*
* Check if there is any work left for us. * Check if there is any work left for us.
*/ */
if (intf->filter == *total_flags) if (rt2x00dev->packet_filter == *total_flags)
return; return;
intf->filter = *total_flags; rt2x00dev->packet_filter = *total_flags;
/* /*
* Start configuration steps. * Start configuration steps.
......
...@@ -1846,7 +1846,6 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw, ...@@ -1846,7 +1846,6 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw,
struct dev_addr_list *mc_list) struct dev_addr_list *mc_list)
{ {
struct rt2x00_dev *rt2x00dev = hw->priv; struct rt2x00_dev *rt2x00dev = hw->priv;
struct interface *intf = &rt2x00dev->interface;
u32 reg; u32 reg;
/* /*
...@@ -1865,22 +1864,19 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw, ...@@ -1865,22 +1864,19 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw,
* Apply some rules to the filters: * Apply some rules to the filters:
* - Some filters imply different filters to be set. * - Some filters imply different filters to be set.
* - Some things we can't filter out at all. * - Some things we can't filter out at all.
* - Some filters are set based on interface type.
*/ */
if (mc_count) if (mc_count)
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (*total_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
*total_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS;
/* /*
* Check if there is any work left for us. * Check if there is any work left for us.
*/ */
if (intf->filter == *total_flags) if (rt2x00dev->packet_filter == *total_flags)
return; return;
intf->filter = *total_flags; rt2x00dev->packet_filter = *total_flags;
/* /*
* When in atomic context, reschedule and let rt2x00lib * When in atomic context, reschedule and let rt2x00lib
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment