Commit 0f19b41e authored by Johannes Berg's avatar Johannes Berg

mac80211: remove ARP filter enable/disable logic

Depending on the driver, having ARP filtering for
some addresses may be possible. Remove the logic
that tracks whether ARP filter is enabled or not
and give the driver the total number of addresses
instead of the length of the list so it can make
its own decision.
Reviewed-by: default avatarLuciano Coelho <coelho@ti.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent de5fad81
...@@ -539,9 +539,8 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw, ...@@ -539,9 +539,8 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_ARP_FILTER) { if (changed & BSS_CHANGED_ARP_FILTER) {
/* Hardware ARP filter address list or state changed */ /* Hardware ARP filter address list or state changed */
brcms_err(core, "%s: arp filtering: enabled %s, count %d" brcms_err(core, "%s: arp filtering: %d addresses"
" (implement)\n", __func__, info->arp_filter_enabled ? " (implement)\n", __func__, info->arp_addr_cnt);
"true" : "false", info->arp_addr_cnt);
} }
if (changed & BSS_CHANGED_QOS) { if (changed & BSS_CHANGED_QOS) {
......
...@@ -4113,8 +4113,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -4113,8 +4113,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
wlvif->sta.qos = bss_conf->qos; wlvif->sta.qos = bss_conf->qos;
WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS); WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS);
if (bss_conf->arp_addr_cnt == 1 && if (bss_conf->arp_addr_cnt == 1 && bss_conf->assoc) {
bss_conf->arp_filter_enabled) {
wlvif->ip_addr = addr; wlvif->ip_addr = addr;
/* /*
* The template should have been configured only upon * The template should have been configured only upon
......
...@@ -297,11 +297,9 @@ enum ieee80211_rssi_event { ...@@ -297,11 +297,9 @@ enum ieee80211_rssi_event {
* may filter ARP queries targeted for other addresses than listed here. * may filter ARP queries targeted for other addresses than listed here.
* The driver must allow ARP queries targeted for all address listed here * The driver must allow ARP queries targeted for all address listed here
* to pass through. An empty list implies no ARP queries need to pass. * to pass through. An empty list implies no ARP queries need to pass.
* @arp_addr_cnt: Number of addresses currently on the list. * @arp_addr_cnt: Number of addresses currently on the list. Note that this
* @arp_filter_enabled: Enable ARP filtering - if enabled, the hardware may * may be larger than %IEEE80211_BSS_ARP_ADDR_LIST_LEN (the arp_addr_list
* filter ARP queries based on the @arp_addr_list, if disabled, the * array size), it's up to the driver what to do in that case.
* hardware must not perform any ARP filtering. Note, that the filter will
* be enabled also in promiscuous mode.
* @qos: This is a QoS-enabled BSS. * @qos: This is a QoS-enabled BSS.
* @idle: This interface is idle. There's also a global idle flag in the * @idle: This interface is idle. There's also a global idle flag in the
* hardware config which may be more appropriate depending on what * hardware config which may be more appropriate depending on what
...@@ -338,8 +336,7 @@ struct ieee80211_bss_conf { ...@@ -338,8 +336,7 @@ struct ieee80211_bss_conf {
u32 cqm_rssi_hyst; u32 cqm_rssi_hyst;
struct cfg80211_chan_def chandef; struct cfg80211_chan_def chandef;
__be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
u8 arp_addr_cnt; int arp_addr_cnt;
bool arp_filter_enabled;
bool qos; bool qos;
bool idle; bool idle;
bool ps; bool ps;
......
...@@ -747,8 +747,6 @@ struct ieee80211_sub_if_data { ...@@ -747,8 +747,6 @@ struct ieee80211_sub_if_data {
struct work_struct work; struct work_struct work;
struct sk_buff_head skb_queue; struct sk_buff_head skb_queue;
bool arp_filter_state;
u8 needed_rx_chains; u8 needed_rx_chains;
enum ieee80211_smps_mode smps_mode; enum ieee80211_smps_mode smps_mode;
......
...@@ -1574,9 +1574,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ...@@ -1574,9 +1574,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
/* initialise type-independent data */ /* initialise type-independent data */
sdata->wdev.wiphy = local->hw.wiphy; sdata->wdev.wiphy = local->hw.wiphy;
sdata->local = local; sdata->local = local;
#ifdef CONFIG_INET
sdata->arp_filter_state = true;
#endif
for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++) for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++)
skb_queue_head_init(&sdata->fragments[i].skb_list); skb_queue_head_init(&sdata->fragments[i].skb_list);
......
...@@ -349,27 +349,19 @@ static int ieee80211_ifa_changed(struct notifier_block *nb, ...@@ -349,27 +349,19 @@ static int ieee80211_ifa_changed(struct notifier_block *nb,
/* Copy the addresses to the bss_conf list */ /* Copy the addresses to the bss_conf list */
ifa = idev->ifa_list; ifa = idev->ifa_list;
while (c < IEEE80211_BSS_ARP_ADDR_LIST_LEN && ifa) { while (ifa) {
bss_conf->arp_addr_list[c] = ifa->ifa_address; if (c < IEEE80211_BSS_ARP_ADDR_LIST_LEN)
bss_conf->arp_addr_list[c] = ifa->ifa_address;
ifa = ifa->ifa_next; ifa = ifa->ifa_next;
c++; c++;
} }
/* If not all addresses fit the list, disable filtering */
if (ifa) {
sdata->arp_filter_state = false;
c = 0;
} else {
sdata->arp_filter_state = true;
}
bss_conf->arp_addr_cnt = c; bss_conf->arp_addr_cnt = c;
/* Configure driver only if associated (which also implies it is up) */ /* Configure driver only if associated (which also implies it is up) */
if (ifmgd->associated) { if (ifmgd->associated)
bss_conf->arp_filter_enabled = sdata->arp_filter_state;
ieee80211_bss_info_change_notify(sdata, ieee80211_bss_info_change_notify(sdata,
BSS_CHANGED_ARP_FILTER); BSS_CHANGED_ARP_FILTER);
}
mutex_unlock(&ifmgd->mtx); mutex_unlock(&ifmgd->mtx);
......
...@@ -1465,10 +1465,8 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, ...@@ -1465,10 +1465,8 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
bss_info_changed |= BSS_CHANGED_CQM; bss_info_changed |= BSS_CHANGED_CQM;
/* Enable ARP filtering */ /* Enable ARP filtering */
if (bss_conf->arp_filter_enabled != sdata->arp_filter_state) { if (bss_conf->arp_addr_cnt)
bss_conf->arp_filter_enabled = sdata->arp_filter_state;
bss_info_changed |= BSS_CHANGED_ARP_FILTER; bss_info_changed |= BSS_CHANGED_ARP_FILTER;
}
ieee80211_bss_info_change_notify(sdata, bss_info_changed); ieee80211_bss_info_change_notify(sdata, bss_info_changed);
...@@ -1582,10 +1580,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -1582,10 +1580,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
cancel_work_sync(&local->dynamic_ps_enable_work); cancel_work_sync(&local->dynamic_ps_enable_work);
/* Disable ARP filtering */ /* Disable ARP filtering */
if (sdata->vif.bss_conf.arp_filter_enabled) { if (sdata->vif.bss_conf.arp_addr_cnt)
sdata->vif.bss_conf.arp_filter_enabled = false;
changed |= BSS_CHANGED_ARP_FILTER; changed |= BSS_CHANGED_ARP_FILTER;
}
sdata->vif.bss_conf.qos = false; sdata->vif.bss_conf.qos = false;
changed |= BSS_CHANGED_QOS; changed |= BSS_CHANGED_QOS;
......
...@@ -347,8 +347,11 @@ TRACE_EVENT(drv_bss_info_changed, ...@@ -347,8 +347,11 @@ TRACE_EVENT(drv_bss_info_changed,
__field(s32, cqm_rssi_hyst); __field(s32, cqm_rssi_hyst);
__field(u32, channel_width); __field(u32, channel_width);
__field(u32, channel_cfreq1); __field(u32, channel_cfreq1);
__dynamic_array(u32, arp_addr_list, info->arp_addr_cnt); __dynamic_array(u32, arp_addr_list,
__field(bool, arp_filter_enabled); info->arp_addr_cnt > IEEE80211_BSS_ARP_ADDR_LIST_LEN ?
IEEE80211_BSS_ARP_ADDR_LIST_LEN :
info->arp_addr_cnt);
__field(int, arp_addr_cnt);
__field(bool, qos); __field(bool, qos);
__field(bool, idle); __field(bool, idle);
__field(bool, ps); __field(bool, ps);
...@@ -384,9 +387,11 @@ TRACE_EVENT(drv_bss_info_changed, ...@@ -384,9 +387,11 @@ TRACE_EVENT(drv_bss_info_changed,
__entry->cqm_rssi_hyst = info->cqm_rssi_hyst; __entry->cqm_rssi_hyst = info->cqm_rssi_hyst;
__entry->channel_width = info->chandef.width; __entry->channel_width = info->chandef.width;
__entry->channel_cfreq1 = info->chandef.center_freq1; __entry->channel_cfreq1 = info->chandef.center_freq1;
__entry->arp_addr_cnt = info->arp_addr_cnt;
memcpy(__get_dynamic_array(arp_addr_list), info->arp_addr_list, memcpy(__get_dynamic_array(arp_addr_list), info->arp_addr_list,
sizeof(u32) * info->arp_addr_cnt); sizeof(u32) * (info->arp_addr_cnt > IEEE80211_BSS_ARP_ADDR_LIST_LEN ?
__entry->arp_filter_enabled = info->arp_filter_enabled; IEEE80211_BSS_ARP_ADDR_LIST_LEN :
info->arp_addr_cnt));
__entry->qos = info->qos; __entry->qos = info->qos;
__entry->idle = info->idle; __entry->idle = info->idle;
__entry->ps = info->ps; __entry->ps = info->ps;
......
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