wl1251: implement multicast address filtering
PATCH 14/18 wl1251: implement multicast address filtering
Port multicast address filtering from wl1271 driver.
It sets up the hardware multicast address filter in configure_filter() with addresses supplied through prepare_multicast().
--- drivers/net/wireless/wl1251/acx.c | 9 +++-- drivers/net/wireless/wl1251/acx.h | 9 +++-- drivers/net/wireless/wl1251/init.c | 2 +- drivers/net/wireless/wl1251/main.c | 67 ++++++++++++++++++++++++++++++---- drivers/net/wireless/wl1251/wl1251.h | 3 +- 5 files changed, 73 insertions(+), 17 deletions(-)
drivers/net/wireless/wl1251/acx.c +5 -3
@@ -410,7 +410,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;
@@ -424,9 +425,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));
drivers/net/wireless/wl1251/acx.h +3 -2
@@ -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);
drivers/net/wireless/wl1251/init.c +1 -0
@@ -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/wl1251/main.c
b/drivers/net/wireless/wl1251/main.c
index cc49e2b..d6ae6d5 100644
drivers/net/wireless/wl1251/main.c +40 -1
58 lines not on this page · raw message
ieee80211_hw *hw,
*total &= WL1251_SUPPORTED_FILTERS;
changed &= WL1251_SUPPORTED_FILTERS;
- if (changed == 0)
- /* no filters which we support changed */
- return;
-
mutex_lock(&wl->mutex);
- if (wl->state == WL1251_STATE_OFF)
+ if (unlikely(wl->state == WL1251_STATE_OFF))
goto out;
ret = wl1251_ps_elp_wakeup(wl);
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_sleep;
+
+ if (changed == 0)
+ /* no filters which we support changed */
+ goto out_sleep;
+
wl->rx_config = WL1251_DEFAULT_RX_CONFIG; wl->rx_filter = WL1251_DEFAULT_RX_FILTER;
if (!is_zero_ether_addr(wl->bssid))
wl->rx_config |= CFG_BSSID_FILTER_EN;
- if (*total & FIF_PROMISC_IN_BSS)
+ if (*total & FIF_PROMISC_IN_BSS) {
wl->rx_config &= ~CFG_UNI_FILTER_EN;
+ wl->rx_config &= ~CFG_MC_FILTER_EN;
+ }
if (*total & FIF_ALLMULTI)
/*
* CFG_MC_FILTER_EN in rx_config needs to be 0 to receive
@@ -735,6 +786,7 @@ out_sleep:
out:
mutex_unlock(&wl->mutex);
+ kfree(fp);
}
/* HW encryption */
@@ -1260,6 +1312,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,
(quoted diff) +0 -0
b/drivers/net/wireless/wl1251/wl1251.h
index 1f9579c..184ceff 100644
drivers/net/wireless/wl1251/wl1251.h +2 -0
@@ -92,7 +92,8 @@ enum { true); \ } while (0) -#define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN) +#define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \ + CFG_MC_FILTER_EN)#define WL1251_DEFAULT_RX_FILTER (CFG_RX_PRSP_EN | \ CFG_RX_MGMT_EN | \
Signature · 1 line
1.7.0.4
PATCH 14/18 wl1251: implement multicast address filtering
Port multicast address filtering from wl1271 driver.
It sets up the hardware multicast address filter in configure_filter() with addresses supplied through prepare_multicast().
---
Sorry for the partly broken patches, I thought I configured my client the right way. I tried to stop the mails at my mailserver, but it was mostly already too late.
--- drivers/net/wireless/wl1251/acx.c | 9 +++-- drivers/net/wireless/wl1251/acx.h | 9 +++-- drivers/net/wireless/wl1251/init.c | 2 +- drivers/net/wireless/wl1251/main.c | 67 ++++++++++++++++++++++++++++++---- drivers/net/wireless/wl1251/wl1251.h | 3 +- 5 files changed, 73 insertions(+), 17 deletions(-)
drivers/net/wireless/wl1251/acx.c +5 -4
@@ -410,7 +410,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;
@@ -424,9 +425,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));
drivers/net/wireless/wl1251/acx.h +5 -4
@@ -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);
drivers/net/wireless/wl1251/init.c +1 -1
@@ -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;
drivers/net/wireless/wl1251/main.c +60 -7
118 lines not on this page · raw message
drivers/net/wireless/wl1251/wl1251.h +2 -1
@@ -92,7 +92,8 @@ enum { true); \ } while (0) -#define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN) +#define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \ + CFG_MC_FILTER_EN)#define WL1251_DEFAULT_RX_FILTER (CFG_RX_PRSP_EN | \ CFG_RX_MGMT_EN | \
Signature · 1 line
1.7.0.4
Quoted 3 lines · David Gnedt
Port multicast address filtering from wl1271 driver.
It sets up the hardware multicast address filter inconfigure_filter()with addresses supplied throughprepare_multicast().
Thanks, looks good to me.
Quoted 1 line
Signed-off-by David Gnedt <[email protected]>
Signature · 1 line
Kalle Valo