From: "Pali Rohár" <pali.rohar@gmail.com>
To: Luciano Coelho <luca@coelho.fi>,
"John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, freemangordon@abv.bg,
aaro.koskinen@iki.fi, pavel@ucw.cz, sre@ring0.de,
joni.lapilainen@gmail.com,
"Johannes Berg" <johannes@sipsolutions.net>,
"Felipe Contreras" <felipe.contreras@gmail.com>,
"David Gnedt" <david.gnedt@davizone.at>,
"Pali Rohár" <pali.rohar@gmail.com>
Subject: [PATCH v2 07/16] wl1251: implement multicast address filtering
Date: Sun, 8 Dec 2013 10:25:05 +0100 [thread overview]
Message-ID: <1386494714-21070-8-git-send-email-pali.rohar@gmail.com> (raw)
In-Reply-To: <1386494714-21070-1-git-send-email-pali.rohar@gmail.com>
From: David Gnedt <david.gnedt@davizone.at>
Port multicast address filtering from wl1271 driver.
It sets up the hardware multicast address filter in configure_filter() with
addresses supplied through prepare_multicast().
Signed-off-by: David Gnedt <david.gnedt@davizone.at>
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/net/wireless/ti/wl1251/acx.c | 9 ++---
drivers/net/wireless/ti/wl1251/acx.h | 9 ++---
drivers/net/wireless/ti/wl1251/init.c | 2 +-
drivers/net/wireless/ti/wl1251/main.c | 57 +++++++++++++++++++++++++++++--
drivers/net/wireless/ti/wl1251/wl1251.h | 1 +
5 files changed, 67 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c
index 1ec98e9..f772e62 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -408,7 +408,8 @@ out:
return ret;
}
-int wl1251_acx_group_address_tbl(struct wl1251 *wl)
+int wl1251_acx_group_address_tbl(struct wl1251 *wl, bool enable,
+ void *mc_list, u32 mc_list_len)
{
struct acx_dot11_grp_addr_tbl *acx;
int ret;
@@ -422,9 +423,9 @@ int wl1251_acx_group_address_tbl(struct wl1251 *wl)
}
/* MAC filtering */
- acx->enabled = 0;
- acx->num_groups = 0;
- memset(acx->mac_table, 0, ADDRESS_GROUP_MAX_LEN);
+ acx->enabled = enable;
+ acx->num_groups = mc_list_len;
+ memcpy(acx->mac_table, mc_list, mc_list_len * ETH_ALEN);
ret = wl1251_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL,
acx, sizeof(*acx));
diff --git a/drivers/net/wireless/ti/wl1251/acx.h b/drivers/net/wireless/ti/wl1251/acx.h
index bea2e67..820573c 100644
--- a/drivers/net/wireless/ti/wl1251/acx.h
+++ b/drivers/net/wireless/ti/wl1251/acx.h
@@ -350,8 +350,8 @@ struct acx_slot {
} __packed;
-#define ADDRESS_GROUP_MAX (8)
-#define ADDRESS_GROUP_MAX_LEN (ETH_ALEN * ADDRESS_GROUP_MAX)
+#define ACX_MC_ADDRESS_GROUP_MAX (8)
+#define ACX_MC_ADDRESS_GROUP_MAX_LEN (ETH_ALEN * ACX_MC_ADDRESS_GROUP_MAX)
struct acx_dot11_grp_addr_tbl {
struct acx_header header;
@@ -359,7 +359,7 @@ struct acx_dot11_grp_addr_tbl {
u8 enabled;
u8 num_groups;
u8 pad[2];
- u8 mac_table[ADDRESS_GROUP_MAX_LEN];
+ u8 mac_table[ACX_MC_ADDRESS_GROUP_MAX_LEN];
} __packed;
@@ -1464,7 +1464,8 @@ int wl1251_acx_rx_msdu_life_time(struct wl1251 *wl, u32 life_time);
int wl1251_acx_rx_config(struct wl1251 *wl, u32 config, u32 filter);
int wl1251_acx_pd_threshold(struct wl1251 *wl);
int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time);
-int wl1251_acx_group_address_tbl(struct wl1251 *wl);
+int wl1251_acx_group_address_tbl(struct wl1251 *wl, bool enable,
+ void *mc_list, u32 mc_list_len);
int wl1251_acx_service_period_timeout(struct wl1251 *wl);
int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold);
int wl1251_acx_beacon_filter_opt(struct wl1251 *wl, bool enable_filter);
diff --git a/drivers/net/wireless/ti/wl1251/init.c b/drivers/net/wireless/ti/wl1251/init.c
index 92de289..f8a2ea9 100644
--- a/drivers/net/wireless/ti/wl1251/init.c
+++ b/drivers/net/wireless/ti/wl1251/init.c
@@ -127,7 +127,7 @@ int wl1251_hw_init_phy_config(struct wl1251 *wl)
if (ret < 0)
return ret;
- ret = wl1251_acx_group_address_tbl(wl);
+ ret = wl1251_acx_group_address_tbl(wl, true, NULL, 0);
if (ret < 0)
return ret;
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index 39a6105..ee318c8 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -29,6 +29,7 @@
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
+#include <linux/netdevice.h>
#include "wl1251.h"
#include "wl12xx_80211.h"
@@ -678,6 +679,44 @@ out:
return ret;
}
+struct wl1251_filter_params {
+ bool enabled;
+ int mc_list_length;
+ u8 mc_list[ACX_MC_ADDRESS_GROUP_MAX][ETH_ALEN];
+};
+
+static u64 wl1251_op_prepare_multicast(struct ieee80211_hw *hw,
+ struct netdev_hw_addr_list *mc_list)
+{
+ struct wl1251_filter_params *fp;
+ struct netdev_hw_addr *ha;
+ struct wl1251 *wl = hw->priv;
+
+ if (unlikely(wl->state == WL1251_STATE_OFF))
+ return 0;
+
+ fp = kzalloc(sizeof(*fp), GFP_ATOMIC);
+ if (!fp) {
+ wl1251_error("Out of memory setting filters.");
+ return 0;
+ }
+
+ /* update multicast filtering parameters */
+ fp->mc_list_length = 0;
+ if (netdev_hw_addr_list_count(mc_list) > ACX_MC_ADDRESS_GROUP_MAX) {
+ fp->enabled = false;
+ } else {
+ fp->enabled = true;
+ netdev_hw_addr_list_for_each(ha, mc_list) {
+ memcpy(fp->mc_list[fp->mc_list_length],
+ ha->addr, ETH_ALEN);
+ fp->mc_list_length++;
+ }
+ }
+
+ return (u64)(unsigned long)fp;
+}
+
#define WL1251_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \
FIF_ALLMULTI | \
FIF_FCSFAIL | \
@@ -688,8 +727,9 @@ out:
static void wl1251_op_configure_filter(struct ieee80211_hw *hw,
unsigned int changed,
- unsigned int *total,u64 multicast)
+ unsigned int *total, u64 multicast)
{
+ struct wl1251_filter_params *fp = (void *)(unsigned long)multicast;
struct wl1251 *wl = hw->priv;
int ret;
@@ -698,9 +738,11 @@ static void wl1251_op_configure_filter(struct ieee80211_hw *hw,
*total &= WL1251_SUPPORTED_FILTERS;
changed &= WL1251_SUPPORTED_FILTERS;
- if (changed == 0)
+ if (changed == 0) {
/* no filters which we support changed */
+ kfree(fp);
return;
+ }
mutex_lock(&wl->mutex);
@@ -737,6 +779,15 @@ static void wl1251_op_configure_filter(struct ieee80211_hw *hw,
if (ret < 0)
goto out;
+ if (*total & FIF_ALLMULTI || *total & FIF_PROMISC_IN_BSS)
+ ret = wl1251_acx_group_address_tbl(wl, false, NULL, 0);
+ else if (fp)
+ ret = wl1251_acx_group_address_tbl(wl, fp->enabled,
+ fp->mc_list,
+ fp->mc_list_length);
+ if (ret < 0)
+ goto out;
+
/* send filters to firmware */
wl1251_acx_rx_config(wl, wl->rx_config, wl->rx_filter);
@@ -744,6 +795,7 @@ static void wl1251_op_configure_filter(struct ieee80211_hw *hw,
out:
mutex_unlock(&wl->mutex);
+ kfree(fp);
}
/* HW encryption */
@@ -1283,6 +1335,7 @@ static const struct ieee80211_ops wl1251_ops = {
.add_interface = wl1251_op_add_interface,
.remove_interface = wl1251_op_remove_interface,
.config = wl1251_op_config,
+ .prepare_multicast = wl1251_op_prepare_multicast,
.configure_filter = wl1251_op_configure_filter,
.tx = wl1251_op_tx,
.set_key = wl1251_op_set_key,
diff --git a/drivers/net/wireless/ti/wl1251/wl1251.h b/drivers/net/wireless/ti/wl1251/wl1251.h
index 45df03a..93c18d2 100644
--- a/drivers/net/wireless/ti/wl1251/wl1251.h
+++ b/drivers/net/wireless/ti/wl1251/wl1251.h
@@ -93,6 +93,7 @@ enum {
} while (0)
#define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \
+ CFG_MC_FILTER_EN | \
CFG_BSSID_FILTER_EN)
#define WL1251_DEFAULT_RX_FILTER (CFG_RX_PRSP_EN | \
--
1.7.9.5
next prev parent reply other threads:[~2013-12-08 9:25 UTC|newest]
Thread overview: 116+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-26 20:33 [PATCH 00/16] wl1251 patches from linux-n900 tree Pali Rohár
2013-10-26 20:34 ` [PATCH 01/16] mac80211: fix TX device statistics for monitor interfaces Pali Rohár
2013-10-28 5:53 ` Kalle Valo
[not found] ` <87iowiszyu.fsf-5ukZ45wKbUHoml4zekdYB16hYfS7NtTn@public.gmane.org>
2013-12-08 8:45 ` [PATCH] " Pali Rohár
[not found] ` <1386492357-20826-1-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-12-16 12:38 ` Johannes Berg
2013-10-28 13:47 ` [PATCH 01/16] " Johannes Berg
2013-10-26 20:34 ` [PATCH 02/16] wl1251: fix scan behaviour while not associated Pali Rohár
2013-10-30 11:24 ` Pavel Machek
2013-10-26 20:34 ` [PATCH 04/16] wl1251: retry power save entry Pali Rohár
2013-10-26 20:34 ` [PATCH 05/16] wl1251: implement hardware ARP filtering Pali Rohár
2013-10-30 11:28 ` Pavel Machek
2013-10-26 20:34 ` [PATCH 06/16] wl1251: split RX and TX data path initialisation Pali Rohár
2013-10-30 11:31 ` Pavel Machek
2013-10-26 20:34 ` [PATCH 08/16] wl1251: implement multicast address filtering Pali Rohár
2013-10-30 11:41 ` Pavel Machek
2013-10-26 20:34 ` [PATCH 09/16] wl1251: disable power saving in monitor mode Pali Rohár
2013-10-30 11:46 ` Pavel Machek
2013-10-26 20:34 ` [PATCH 10/16] wl1251: fix channel switching " Pali Rohár
2013-10-30 11:47 ` Pavel Machek
2013-10-26 20:34 ` [PATCH 11/16] wl1251: enable tx path in monitor mode if necessary for packet injection Pali Rohár
2013-10-30 11:51 ` Pavel Machek
2013-10-26 20:34 ` [PATCH 12/16] wl1251: disable retry and ACK policy for injected packets Pali Rohár
2013-10-30 11:52 ` Pavel Machek
[not found] ` <1382819655-30430-1-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-26 20:34 ` [PATCH 03/16] wl1251: add sysfs interface for bluetooth coexistence mode configuration Pali Rohár
2013-10-28 23:39 ` Ben Hutchings
2013-10-29 7:09 ` Luca Coelho
2013-10-29 13:35 ` Kalle Valo
[not found] ` <1383003587.3779.49.camel-/LGg1Z1CJKQ+9kgCwbf1HqK4ta4zdZpAajtMo4Cw6ucAvxtiuMwx3w@public.gmane.org>
2013-12-08 7:55 ` Pali Rohár
2013-12-08 16:36 ` Ben Hutchings
2013-10-26 20:34 ` [PATCH 07/16] wl1251: configure hardware en-/decryption for monitor mode Pali Rohár
2013-10-30 11:35 ` Pavel Machek
2013-10-26 20:34 ` [PATCH 13/16] wl1251: enforce changed hw encryption support on monitor state change Pali Rohár
2013-10-30 11:55 ` Pavel Machek
2013-11-08 14:20 ` [PATCH 00/16] wl1251 patches from linux-n900 tree Felipe Contreras
2013-11-25 19:54 ` Pali Rohár
2013-10-26 20:34 ` [PATCH 14/16] wl1251: add nvs file name to module firmware list Pali Rohár
2013-10-30 11:55 ` Pavel Machek
2013-10-26 20:34 ` [PATCH 15/16] wl1251: Add sysfs file tx_mgmt_frm_rate for setting rate Pali Rohár
2013-10-28 13:45 ` Johannes Berg
2013-10-26 20:34 ` [PATCH 16/16] wl1251: Add sysfs file address for setting permanent mac address Pali Rohár
2013-10-28 13:45 ` Johannes Berg
2013-10-28 13:49 ` Pali Rohár
2013-10-28 13:55 ` Johannes Berg
2013-10-28 14:00 ` Pali Rohár
2013-10-28 14:46 ` Dan Williams
2013-10-28 14:56 ` Johannes Berg
2013-10-28 15:04 ` Pali Rohár
2013-10-28 15:29 ` Dan Williams
2013-10-28 16:21 ` Pali Rohár
2013-10-28 15:33 ` Stephen Hemminger
2013-10-28 23:50 ` Ben Hutchings
2013-12-08 9:24 ` [PATCH v2 00/16] wl1251 patches from linux-n900 tree Pali Rohár
2013-12-08 9:24 ` [PATCH v2 01/16] wl1251: fix scan behaviour while not associated Pali Rohár
[not found] ` <1386494714-21070-2-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-12-10 9:21 ` Pavel Machek
[not found] ` <20131210092114.GB22756-tWAi6jLit6GreWDznjuHag@public.gmane.org>
2013-12-10 15:41 ` Kalle Valo
2013-12-10 17:08 ` Pali Rohár
2013-12-11 20:44 ` Ben Hutchings
2013-12-31 9:44 ` Pali Rohár
2013-12-08 9:25 ` [PATCH v2 03/16] wl1251: retry power save entry Pali Rohár
2013-12-10 9:24 ` Pavel Machek
[not found] ` <1386494714-21070-1-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-12-08 9:25 ` [PATCH v2 02/16] wl1251: add sysfs interface for bluetooth coexistence mode configuration Pali Rohár
[not found] ` <1386494714-21070-3-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-12-10 15:46 ` Kalle Valo
2013-12-10 16:09 ` Pali Rohár
2013-12-08 9:25 ` [PATCH v2 04/16] wl1251: implement hardware ARP filtering Pali Rohár
2013-12-10 9:29 ` Pavel Machek
2013-12-10 9:59 ` Michal Kubecek
2013-12-08 9:25 ` [PATCH v2 05/16] wl1251: split RX and TX data path initialisation Pali Rohár
2013-12-10 9:31 ` Pavel Machek
2013-12-08 9:25 ` [PATCH v2 06/16] wl1251: configure hardware en-/decryption for monitor mode Pali Rohár
2013-12-10 9:35 ` Pavel Machek
2013-12-31 9:31 ` Pali Rohár
2013-12-08 9:25 ` [PATCH v2 16/16] wl1251: fix NULL pointer dereference Pali Rohár
2013-12-10 9:42 ` Pavel Machek
2013-12-08 9:25 ` Pali Rohár [this message]
2013-12-10 9:39 ` [PATCH v2 07/16] wl1251: implement multicast address filtering Pavel Machek
2013-12-08 9:25 ` [PATCH v2 08/16] wl1251: disable power saving in monitor mode Pali Rohár
[not found] ` <1386494714-21070-9-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-12-10 9:41 ` Pavel Machek
2013-12-08 9:25 ` [PATCH v2 09/16] wl1251: fix channel switching " Pali Rohár
2013-12-10 9:43 ` Pavel Machek
2013-12-08 9:25 ` [PATCH v2 10/16] wl1251: enable tx path in monitor mode if necessary for packet injection Pali Rohár
2013-12-10 9:44 ` Pavel Machek
2013-12-08 9:25 ` [PATCH v2 11/16] wl1251: disable retry and ACK policy for injected packets Pali Rohár
2013-12-10 9:46 ` Pavel Machek
2013-12-08 9:25 ` [PATCH v2 12/16] wl1251: enforce changed hw encryption support on monitor state change Pali Rohár
2013-12-10 9:48 ` Pavel Machek
2013-12-08 9:25 ` [PATCH v2 13/16] wl1251: add nvs file name to module firmware list Pali Rohár
2013-12-10 9:49 ` Pavel Machek
2013-12-08 9:25 ` [PATCH v2 14/16] wl1251: Add sysfs file tx_mgmt_frm_rate for setting rate Pali Rohár
2013-12-09 16:50 ` Dan Williams
[not found] ` <1386494714-21070-15-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-12-10 15:36 ` Kalle Valo
2013-12-08 9:25 ` [PATCH v2 15/16] wl1251: Add sysfs file address for setting permanent mac address Pali Rohár
2013-12-10 15:49 ` Kalle Valo
2013-12-10 16:10 ` Pali Rohár
2013-12-10 17:14 ` Pali Rohár
2013-12-10 17:49 ` Dan Williams
[not found] ` <1386697762.30202.6.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-12-10 17:52 ` Pali Rohár
2013-12-10 19:22 ` Dan Williams
2013-12-10 19:31 ` Pali Rohár
2013-12-11 21:26 ` Ben Hutchings
2013-12-11 21:17 ` Ben Hutchings
2013-12-11 21:28 ` Ben Hutchings
2013-12-11 21:35 ` Ivajlo Dimitrov
2013-12-11 22:15 ` Ben Hutchings
2013-12-11 22:36 ` Ivajlo Dimitrov
2013-12-12 12:45 ` Sergei Shtylyov
[not found] ` <1386800135.1516.296.camel-/LGg1Z1CJKQ+9kgCwbf1HqK4ta4zdZpAajtMo4Cw6ucAvxtiuMwx3w@public.gmane.org>
2013-12-11 22:53 ` Dan Williams
[not found] ` <1386802416.17188.69.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-12-12 19:55 ` Ben Hutchings
2013-12-12 20:24 ` Ivajlo Dimitrov
2013-12-12 10:56 ` Pavel Machek
2013-12-31 9:47 ` [PATCH v2 00/16] wl1251 patches from linux-n900 tree Pali Rohár
2014-01-06 20:00 ` John W. Linville
2014-01-06 20:26 ` Johannes Berg
2014-01-06 22:03 ` Pavel Machek
2014-01-07 12:15 ` Pavel Machek
2014-01-16 0:21 ` Pavel Machek
[not found] ` <20140116002121.GA3726-tWAi6jLit6GreWDznjuHag@public.gmane.org>
2014-01-16 20:29 ` John W. Linville
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386494714-21070-8-git-send-email-pali.rohar@gmail.com \
--to=pali.rohar@gmail.com \
--cc=aaro.koskinen@iki.fi \
--cc=david.gnedt@davizone.at \
--cc=felipe.contreras@gmail.com \
--cc=freemangordon@abv.bg \
--cc=johannes@sipsolutions.net \
--cc=joni.lapilainen@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=luca@coelho.fi \
--cc=netdev@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=sre@ring0.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).