summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>2011-07-18 10:07:02 +0200
committerPhilippe LANGLAIS <philippe.langlais@stericsson.com>2011-10-13 09:46:53 +0200
commitbd35a1cd96dcf246cab4735ece9524670f3591de (patch)
tree0011a61e81e478c5bf773ef83c414c0cabf96caf
parent287bfdb84e714636bff9a0814a1224797f2b3973 (diff)
cw1200: ARP ipv4 filtering
Implementation of ARP ipv4 filtering. Currently firmware support only one IP address. In case of multiple IP addresses (aliases) ARP filtering will be disabled. Change-Id: I787c756fdc131523f68717b86a9d24daf185dd44 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/27319 Reviewed-by: Bartosz MARKOWSKI <bartosz.markowski@tieto.com> Tested-by: Bartosz MARKOWSKI <bartosz.markowski@tieto.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/33486 Tested-by: Dmitry TARNYAGIN <dmitry.tarnyagin@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
-rw-r--r--drivers/staging/cw1200/ap.c32
-rw-r--r--drivers/staging/cw1200/wsm.h9
2 files changed, 36 insertions, 5 deletions
diff --git a/drivers/staging/cw1200/ap.c b/drivers/staging/cw1200/ap.c
index edcd4af885a..908725ab5fe 100644
--- a/drivers/staging/cw1200/ap.c
+++ b/drivers/staging/cw1200/ap.c
@@ -163,7 +163,37 @@ void cw1200_bss_info_changed(struct ieee80211_hw *dev,
}
/* TODO: BSS_CHANGED_IBSS */
- /* TODO: BSS_CHANGED_ARP_FILTER */
+
+ if (changed & BSS_CHANGED_ARP_FILTER) {
+ struct wsm_arp_ipv4_filter filter = {0};
+ int i;
+
+ ap_printk(KERN_DEBUG "[STA] BSS_CHANGED_ARP_FILTER "
+ "enabled: %d, cnt: %d\n",
+ info->arp_filter_enabled,
+ info->arp_addr_cnt);
+
+ if (info->arp_filter_enabled)
+ filter.enable = __cpu_to_le32(1);
+
+ /* Currently only one IP address is supported by firmware.
+ * In case of more IPs arp filtering will be disabled. */
+ if (info->arp_addr_cnt > 0 &&
+ info->arp_addr_cnt <= WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES) {
+ for(i=0; i<info->arp_addr_cnt;i++) {
+ filter.ipv4Address[i] = info->arp_addr_list[i];
+ ap_printk(KERN_DEBUG "[STA] addr[%d]: 0x%X\n",
+ i, filter.ipv4Address[i]);
+ }
+ } else
+ filter.enable = 0;
+
+ ap_printk(KERN_DEBUG "[STA] arp ip filter enable: %d\n",
+ __le32_to_cpu(filter.enable));
+
+ if (wsm_set_arp_ipv4_filter(priv, &filter))
+ WARN_ON(1);
+ }
if (changed & BSS_CHANGED_BEACON_ENABLED)
priv->enable_beacon = info->enable_beacon;
diff --git a/drivers/staging/cw1200/wsm.h b/drivers/staging/cw1200/wsm.h
index 76b9253fa94..97989a01f1c 100644
--- a/drivers/staging/cw1200/wsm.h
+++ b/drivers/staging/cw1200/wsm.h
@@ -374,6 +374,7 @@ struct cw1200_common;
/* 4.10 ArpIpAddressesTable */
#define WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE 0x1001
+#define WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES 1
/* 4.11 TemplateFrame */
#define WSM_MIB_ID_TEMPLATE_FRAME 0x1002
@@ -1471,13 +1472,13 @@ static inline int wsm_set_multicast_filter(struct cw1200_common *priv,
}
/* IPv4 filtering - 4.10 */
-struct wsm_ipv4_filter {
+struct wsm_arp_ipv4_filter {
__le32 enable;
- u8 ipv4Address[4];
+ __be32 ipv4Address[WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES];
} __packed;
-static inline int wsm_set_ipv4_arp_filter(struct cw1200_common *priv,
- struct wsm_ipv4_filter *fp)
+static inline int wsm_set_arp_ipv4_filter(struct cw1200_common *priv,
+ struct wsm_arp_ipv4_filter *fp)
{
return wsm_write_mib(priv, WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE,
fp, sizeof(*fp));