p54: set_filter refactoring
authorChristian Lamparter <chunkeey@web.de>
Wed, 3 Sep 2008 20:25:20 +0000 (22:25 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 8 Sep 2008 18:00:17 +0000 (14:00 -0400)
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>
drivers/net/wireless/p54/p54.h
drivers/net/wireless/p54/p54common.c
drivers/net/wireless/p54/p54common.h

index cd2a39f544b16b6d28c6d9378d837c3a14b1aefe..fd54b273cd9ba1e951a799dde8e3315dc61e0cd9 100644 (file)
@@ -63,6 +63,7 @@ struct p54_common {
        struct mutex conf_mutex;
        u8 mac_addr[ETH_ALEN];
        u8 bssid[ETH_ALEN];
+       __le16 filter_type;
        struct pda_iq_autocal_entry *iq_autocal;
        unsigned int iq_autocal_len;
        struct pda_channel_output_limit *output_limit;
@@ -70,6 +71,7 @@ struct p54_common {
        struct pda_pa_curve_data *curve_data;
        u16 rxhw;
        u8 version;
+       u8 rx_antenna;
        unsigned int tx_hdr_len;
        void *cached_vdcf;
        unsigned int fw_var;
index e96bf1a8f84c4dbeaebd6de85efb02a0d86b67f4..f742abab759424d8e45378dbaf01e46bc1f1aa28 100644 (file)
@@ -786,8 +786,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
 }
 
 static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type,
-                         const u8 *dst, const u8 *src, u8 antenna,
-                         u32 magic3, u32 magic8, u32 magic9)
+                         const u8 *bssid)
 {
        struct p54_common *priv = dev->priv;
        struct p54_control_hdr *hdr;
@@ -806,19 +805,19 @@ static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type,
        p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*filter));
        hdr->type = cpu_to_le16(P54_CONTROL_TYPE_FILTER_SET);
 
-       filter->filter_type = cpu_to_le16(filter_type);
-       memcpy(filter->dst, dst, ETH_ALEN);
-       if (!src)
-               memset(filter->src, ~0, ETH_ALEN);
+       priv->filter_type = filter->filter_type = cpu_to_le16(filter_type);
+       memcpy(filter->mac_addr, priv->mac_addr, ETH_ALEN);
+       if (!bssid)
+               memset(filter->bssid, ~0, ETH_ALEN);
        else
-               memcpy(filter->src, src, ETH_ALEN);
-       filter->antenna = antenna;
-       filter->magic3 = cpu_to_le32(magic3);
+               memcpy(filter->bssid, bssid, ETH_ALEN);
+
+       filter->rx_antenna = priv->rx_antenna;
+       filter->basic_rate_mask = cpu_to_le32(0x15F);
        filter->rx_addr = cpu_to_le32(priv->rx_end);
        filter->max_rx = cpu_to_le16(priv->rx_mtu);
        filter->rxhw = cpu_to_le16(priv->rxhw);
-       filter->magic8 = cpu_to_le16(magic8);
-       filter->magic9 = cpu_to_le16(magic9);
+       filter->wakeup_timer = cpu_to_le16(500);
 
        priv->tx(dev, hdr, sizeof(*hdr) + sizeof(*filter), 1);
        return 0;
@@ -1044,12 +1043,11 @@ static int p54_add_interface(struct ieee80211_hw *dev,
 
        memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
 
-       p54_set_filter(dev, 0, priv->mac_addr, NULL, 0, 1, 0, 0xF642);
-       p54_set_filter(dev, 0, priv->mac_addr, NULL, 1, 0, 0, 0xF642);
+       p54_set_filter(dev, 0, NULL);
 
        switch (conf->type) {
        case IEEE80211_IF_TYPE_STA:
-               p54_set_filter(dev, 1, priv->mac_addr, NULL, 0, 0x15F, 0x1F4, 0);
+               p54_set_filter(dev, 1, NULL);
                break;
        default:
                BUG();  /* impossible */
@@ -1067,7 +1065,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev,
        struct p54_common *priv = dev->priv;
        priv->mode = IEEE80211_IF_TYPE_MNTR;
        memset(priv->mac_addr, 0, ETH_ALEN);
-       p54_set_filter(dev, 0, priv->mac_addr, NULL, 2, 0, 0, 0);
+       p54_set_filter(dev, 0, NULL);
 }
 
 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)
        struct p54_common *priv = dev->priv;
 
        mutex_lock(&priv->conf_mutex);
+       priv->rx_antenna = (conf->antenna_sel_rx == 0) ?
+               2 : conf->antenna_sel_tx - 1;
        ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq));
        p54_set_vdcf(dev);
        mutex_unlock(&priv->conf_mutex);
@@ -1089,8 +1089,7 @@ static int p54_config_interface(struct ieee80211_hw *dev,
        struct p54_common *priv = dev->priv;
 
        mutex_lock(&priv->conf_mutex);
-       p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 0, 1, 0, 0xF642);
-       p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 2, 0, 0, 0);
+       p54_set_filter(dev, 0, conf->bssid);
        p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0);
        memcpy(priv->bssid, conf->bssid, ETH_ALEN);
        mutex_unlock(&priv->conf_mutex);
@@ -1108,11 +1107,9 @@ static void p54_configure_filter(struct ieee80211_hw *dev,
 
        if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
                if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
-                       p54_set_filter(dev, 0, priv->mac_addr,
-                                      NULL, 2, 0, 0, 0);
+                       p54_set_filter(dev, 0, NULL);
                else
-                       p54_set_filter(dev, 0, priv->mac_addr,
-                                      priv->bssid, 2, 0, 0, 0);
+                       p54_set_filter(dev, 0, priv->bssid);
        }
 }
 
index c24b5cddf46bdcb1d35480213490e9b9c7cbb045..7b4ba37abe92a9d502563f5e5de6418492407c88 100644 (file)
@@ -214,17 +214,17 @@ struct p54_tx_control_allocdata {
 
 struct p54_tx_control_filter {
        __le16 filter_type;
-       u8 dst[ETH_ALEN];
-       u8 src[ETH_ALEN];
-       u8 antenna;
-       u8 debug;
-       __le32 magic3;
-       u8 rates[8];    // FIXME: what's this for?
+       u8 mac_addr[ETH_ALEN];
+       u8 bssid[ETH_ALEN];
+       u8 rx_antenna;
+       u8 rx_align;
+       __le32 basic_rate_mask;
+       u8 rts_rates[8];
        __le32 rx_addr;
        __le16 max_rx;
        __le16 rxhw;
-       __le16 magic8;
-       __le16 magic9;
+       __le16 wakeup_timer;
+       __le16 unalloc;
 } __attribute__ ((packed));
 
 struct p54_tx_control_channel {
This page took 0.0412 seconds and 5 git commands to generate.