From patchwork Thu Jul 8 14:50:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luciano Coelho X-Patchwork-Id: 110874 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o68EokYn025835 for ; Thu, 8 Jul 2010 14:50:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755225Ab0GHOup (ORCPT ); Thu, 8 Jul 2010 10:50:45 -0400 Received: from smtp.nokia.com ([192.100.122.233]:40385 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753825Ab0GHOup (ORCPT ); Thu, 8 Jul 2010 10:50:45 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o68EoCAK016340; Thu, 8 Jul 2010 17:50:36 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 8 Jul 2010 17:50:11 +0300 Received: from mgw-sa01.ext.nokia.com ([147.243.1.47]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 8 Jul 2010 17:50:11 +0300 Received: from localhost.localdomain (chilepepper.research.nokia.com [172.21.50.167]) by mgw-sa01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o68Eo8dF005922; Thu, 8 Jul 2010 17:50:11 +0300 From: Luciano Coelho To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, Juuso Oikarinen Subject: [PATCH 07/13] wl1271: Update hardware ARP filtering configuration handling Date: Thu, 8 Jul 2010 17:50:02 +0300 Message-Id: <1278600608-22411-8-git-send-email-luciano.coelho@nokia.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1278600608-22411-1-git-send-email-luciano.coelho@nokia.com> References: <1278600608-22411-1-git-send-email-luciano.coelho@nokia.com> X-OriginalArrivalTime: 08 Jul 2010 14:50:11.0134 (UTC) FILETIME=[DD9B45E0:01CB1EAC] X-Nokia-AV: Clean Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 08 Jul 2010 14:50:47 +0000 (UTC) diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.c b/drivers/net/wireless/wl12xx/wl1271_acx.c index b45ebbc..bb245f0 100644 --- a/drivers/net/wireless/wl12xx/wl1271_acx.c +++ b/drivers/net/wireless/wl12xx/wl1271_acx.c @@ -1075,12 +1075,12 @@ out: return ret; } -int wl1271_acx_arp_ip_filter(struct wl1271 *wl, u8 mode, u8 *address) +int wl1271_acx_arp_ip_filter(struct wl1271 *wl, bool enable, __be32 address) { struct wl1271_acx_arp_filter *acx; int ret; - wl1271_debug(DEBUG_ACX, "acx arp ip filter, mode: %d", mode); + wl1271_debug(DEBUG_ACX, "acx arp ip filter, enable: %d", enable); acx = kzalloc(sizeof(*acx), GFP_KERNEL); if (!acx) { @@ -1089,10 +1089,10 @@ int wl1271_acx_arp_ip_filter(struct wl1271 *wl, u8 mode, u8 *address) } acx->version = ACX_IPV4_VERSION; - acx->enable = mode; + acx->enable = enable; - if (mode != ACX_ARP_DISABLE) - memcpy(acx->address, address, ACX_IPV4_ADDR_SIZE); + if (enable == true) + memcpy(acx->address, &address, ACX_IPV4_ADDR_SIZE); ret = wl1271_cmd_configure(wl, ACX_ARP_IP_FILTER, acx, sizeof(*acx)); diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.h b/drivers/net/wireless/wl12xx/wl1271_acx.h index 6a6f3e3..d915683 100644 --- a/drivers/net/wireless/wl12xx/wl1271_acx.h +++ b/drivers/net/wireless/wl12xx/wl1271_acx.h @@ -1117,7 +1117,7 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl); int wl1271_acx_init_rx_interrupt(struct wl1271 *wl); int wl1271_acx_smart_reflex(struct wl1271 *wl); int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable); -int wl1271_acx_arp_ip_filter(struct wl1271 *wl, u8 mode, u8 *address); +int wl1271_acx_arp_ip_filter(struct wl1271 *wl, bool enable, __be32 address); int wl1271_acx_pm_config(struct wl1271 *wl); int wl1271_acx_keep_alive_mode(struct wl1271 *wl, bool enable); int wl1271_acx_keep_alive_config(struct wl1271 *wl, u8 index, u8 tpl_valid); diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 3a64896..15c99dd 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c @@ -1312,53 +1312,6 @@ struct wl1271_filter_params { u8 mc_list[ACX_MC_ADDRESS_GROUP_MAX][ETH_ALEN]; }; -static int wl1271_op_configure_arp_filter(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct in_ifaddr *ifa_list) -{ - struct wl1271 *wl = hw->priv; - int ret = 0; - - WARN_ON(vif != wl->vif); - - /* disable filtering if there are multiple addresses */ - if (ifa_list && ifa_list->ifa_next) - ifa_list = NULL; - - mutex_lock(&wl->mutex); - - if (wl->state == WL1271_STATE_OFF) - goto out; - - WARN_ON(wl->bss_type != BSS_TYPE_STA_BSS); - - ret = wl1271_ps_elp_wakeup(wl, false); - if (ret < 0) - goto out; - - if (ifa_list) { - ret = wl1271_cmd_build_arp_reply(wl, &ifa_list->ifa_address); - if (ret < 0) - goto out_sleep; - ret = wl1271_acx_arp_ip_filter(wl, ACX_ARP_FILTER_AND_REPLY, - (u8 *)&ifa_list->ifa_address); - if (ret < 0) - goto out_sleep; - } else { - ret = wl1271_acx_arp_ip_filter(wl, ACX_ARP_DISABLE, NULL); - if (ret < 0) - goto out_sleep; - } - -out_sleep: - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - static u64 wl1271_op_prepare_multicast(struct ieee80211_hw *hw, struct netdev_hw_addr_list *mc_list) { @@ -1869,6 +1822,19 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, } } + if (changed & BSS_CHANGED_ARP_FILTER) { + __be32 addr = bss_conf->arp_addr_list[0]; + WARN_ON(wl->bss_type != BSS_TYPE_STA_BSS); + + if (bss_conf->arp_addr_cnt == 1 && bss_conf->arp_filter_enabled) + ret = wl1271_acx_arp_ip_filter(wl, true, addr); + else + ret = wl1271_acx_arp_ip_filter(wl, false, addr); + + if (ret < 0) + goto out_sleep; + } + if (do_join) { ret = wl1271_join(wl, set_assoc); if (ret < 0) { @@ -2174,7 +2140,6 @@ static const struct ieee80211_ops wl1271_ops = { .add_interface = wl1271_op_add_interface, .remove_interface = wl1271_op_remove_interface, .config = wl1271_op_config, - .configure_arp_filter = wl1271_op_configure_arp_filter, .prepare_multicast = wl1271_op_prepare_multicast, .configure_filter = wl1271_op_configure_filter, .tx = wl1271_op_tx,