diff options
author | Christian Lamparter <chunkeey@web.de> | 2008-09-03 16:25:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-08 14:00:17 -0400 |
commit | e0a58eacf540c65763288c81caa74013f62d7234 (patch) | |
tree | af544e422208519cf49ce6c45d4db8427b6fcaeb /drivers/net/wireless/p54/p54common.c | |
parent | 0b7dcd9652c8d6b2a0dd04f3a3e6ca0574560042 (diff) |
p54: set_filter refactoring
p54_set_filter has a way too many unnecessary "magic" parameters and values.
This patch axes all superfluous parameters and gives most of the magic values appropriate names.
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54/p54common.c')
-rw-r--r-- | drivers/net/wireless/p54/p54common.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index e96bf1a8f84c..f742abab7594 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -786,8 +786,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
786 | } | 786 | } |
787 | 787 | ||
788 | static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type, | 788 | static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type, |
789 | const u8 *dst, const u8 *src, u8 antenna, | 789 | const u8 *bssid) |
790 | u32 magic3, u32 magic8, u32 magic9) | ||
791 | { | 790 | { |
792 | struct p54_common *priv = dev->priv; | 791 | struct p54_common *priv = dev->priv; |
793 | struct p54_control_hdr *hdr; | 792 | struct p54_control_hdr *hdr; |
@@ -806,19 +805,19 @@ static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type, | |||
806 | p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*filter)); | 805 | p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*filter)); |
807 | hdr->type = cpu_to_le16(P54_CONTROL_TYPE_FILTER_SET); | 806 | hdr->type = cpu_to_le16(P54_CONTROL_TYPE_FILTER_SET); |
808 | 807 | ||
809 | filter->filter_type = cpu_to_le16(filter_type); | 808 | priv->filter_type = filter->filter_type = cpu_to_le16(filter_type); |
810 | memcpy(filter->dst, dst, ETH_ALEN); | 809 | memcpy(filter->mac_addr, priv->mac_addr, ETH_ALEN); |
811 | if (!src) | 810 | if (!bssid) |
812 | memset(filter->src, ~0, ETH_ALEN); | 811 | memset(filter->bssid, ~0, ETH_ALEN); |
813 | else | 812 | else |
814 | memcpy(filter->src, src, ETH_ALEN); | 813 | memcpy(filter->bssid, bssid, ETH_ALEN); |
815 | filter->antenna = antenna; | 814 | |
816 | filter->magic3 = cpu_to_le32(magic3); | 815 | filter->rx_antenna = priv->rx_antenna; |
816 | filter->basic_rate_mask = cpu_to_le32(0x15F); | ||
817 | filter->rx_addr = cpu_to_le32(priv->rx_end); | 817 | filter->rx_addr = cpu_to_le32(priv->rx_end); |
818 | filter->max_rx = cpu_to_le16(priv->rx_mtu); | 818 | filter->max_rx = cpu_to_le16(priv->rx_mtu); |
819 | filter->rxhw = cpu_to_le16(priv->rxhw); | 819 | filter->rxhw = cpu_to_le16(priv->rxhw); |
820 | filter->magic8 = cpu_to_le16(magic8); | 820 | filter->wakeup_timer = cpu_to_le16(500); |
821 | filter->magic9 = cpu_to_le16(magic9); | ||
822 | 821 | ||
823 | priv->tx(dev, hdr, sizeof(*hdr) + sizeof(*filter), 1); | 822 | priv->tx(dev, hdr, sizeof(*hdr) + sizeof(*filter), 1); |
824 | return 0; | 823 | return 0; |
@@ -1044,12 +1043,11 @@ static int p54_add_interface(struct ieee80211_hw *dev, | |||
1044 | 1043 | ||
1045 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | 1044 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); |
1046 | 1045 | ||
1047 | p54_set_filter(dev, 0, priv->mac_addr, NULL, 0, 1, 0, 0xF642); | 1046 | p54_set_filter(dev, 0, NULL); |
1048 | p54_set_filter(dev, 0, priv->mac_addr, NULL, 1, 0, 0, 0xF642); | ||
1049 | 1047 | ||
1050 | switch (conf->type) { | 1048 | switch (conf->type) { |
1051 | case IEEE80211_IF_TYPE_STA: | 1049 | case IEEE80211_IF_TYPE_STA: |
1052 | p54_set_filter(dev, 1, priv->mac_addr, NULL, 0, 0x15F, 0x1F4, 0); | 1050 | p54_set_filter(dev, 1, NULL); |
1053 | break; | 1051 | break; |
1054 | default: | 1052 | default: |
1055 | BUG(); /* impossible */ | 1053 | BUG(); /* impossible */ |
@@ -1067,7 +1065,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev, | |||
1067 | struct p54_common *priv = dev->priv; | 1065 | struct p54_common *priv = dev->priv; |
1068 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 1066 | priv->mode = IEEE80211_IF_TYPE_MNTR; |
1069 | memset(priv->mac_addr, 0, ETH_ALEN); | 1067 | memset(priv->mac_addr, 0, ETH_ALEN); |
1070 | p54_set_filter(dev, 0, priv->mac_addr, NULL, 2, 0, 0, 0); | 1068 | p54_set_filter(dev, 0, NULL); |
1071 | } | 1069 | } |
1072 | 1070 | ||
1073 | static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) | 1071 | static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) |
@@ -1076,6 +1074,8 @@ static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) | |||
1076 | struct p54_common *priv = dev->priv; | 1074 | struct p54_common *priv = dev->priv; |
1077 | 1075 | ||
1078 | mutex_lock(&priv->conf_mutex); | 1076 | mutex_lock(&priv->conf_mutex); |
1077 | priv->rx_antenna = (conf->antenna_sel_rx == 0) ? | ||
1078 | 2 : conf->antenna_sel_tx - 1; | ||
1079 | ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); | 1079 | ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); |
1080 | p54_set_vdcf(dev); | 1080 | p54_set_vdcf(dev); |
1081 | mutex_unlock(&priv->conf_mutex); | 1081 | mutex_unlock(&priv->conf_mutex); |
@@ -1089,8 +1089,7 @@ static int p54_config_interface(struct ieee80211_hw *dev, | |||
1089 | struct p54_common *priv = dev->priv; | 1089 | struct p54_common *priv = dev->priv; |
1090 | 1090 | ||
1091 | mutex_lock(&priv->conf_mutex); | 1091 | mutex_lock(&priv->conf_mutex); |
1092 | p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 0, 1, 0, 0xF642); | 1092 | p54_set_filter(dev, 0, conf->bssid); |
1093 | p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 2, 0, 0, 0); | ||
1094 | p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); | 1093 | p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); |
1095 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | 1094 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); |
1096 | mutex_unlock(&priv->conf_mutex); | 1095 | mutex_unlock(&priv->conf_mutex); |
@@ -1108,11 +1107,9 @@ static void p54_configure_filter(struct ieee80211_hw *dev, | |||
1108 | 1107 | ||
1109 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | 1108 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { |
1110 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | 1109 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) |
1111 | p54_set_filter(dev, 0, priv->mac_addr, | 1110 | p54_set_filter(dev, 0, NULL); |
1112 | NULL, 2, 0, 0, 0); | ||
1113 | else | 1111 | else |
1114 | p54_set_filter(dev, 0, priv->mac_addr, | 1112 | p54_set_filter(dev, 0, priv->bssid); |
1115 | priv->bssid, 2, 0, 0, 0); | ||
1116 | } | 1113 | } |
1117 | } | 1114 | } |
1118 | 1115 | ||