aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwl8k.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2009-10-22 14:20:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-11-04 18:44:45 -0500
commit32060e1b64f23fe315a35d2df8c2c7ad010df73e (patch)
treef5687cbeb3485a3abea2dbc9bcd7966744d05fd8 /drivers/net/wireless/mwl8k.c
parent77165d8809cda1a77bc8752148a6252d7735c12e (diff)
mwl8k: clear hardware MAC address if no STA interface configured
If there is no STA interface configured, clear the hardware MAC address to prevent ACKing frames sent to our MAC address. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwl8k.c')
-rw-r--r--drivers/net/wireless/mwl8k.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 53447f6a0e54..fcf7139c77c8 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -280,6 +280,7 @@ static const struct ieee80211_rate mwl8k_rates[] = {
280#define MWL8K_CMD_MIMO_CONFIG 0x0125 280#define MWL8K_CMD_MIMO_CONFIG 0x0125
281#define MWL8K_CMD_USE_FIXED_RATE 0x0126 281#define MWL8K_CMD_USE_FIXED_RATE 0x0126
282#define MWL8K_CMD_ENABLE_SNIFFER 0x0150 282#define MWL8K_CMD_ENABLE_SNIFFER 0x0150
283#define MWL8K_CMD_SET_MAC_ADDR 0x0202
283#define MWL8K_CMD_SET_RATEADAPT_MODE 0x0203 284#define MWL8K_CMD_SET_RATEADAPT_MODE 0x0203
284#define MWL8K_CMD_UPDATE_STADB 0x1123 285#define MWL8K_CMD_UPDATE_STADB 0x1123
285 286
@@ -309,6 +310,7 @@ static const char *mwl8k_cmd_name(u16 cmd, char *buf, int bufsize)
309 MWL8K_CMDNAME(MIMO_CONFIG); 310 MWL8K_CMDNAME(MIMO_CONFIG);
310 MWL8K_CMDNAME(USE_FIXED_RATE); 311 MWL8K_CMDNAME(USE_FIXED_RATE);
311 MWL8K_CMDNAME(ENABLE_SNIFFER); 312 MWL8K_CMDNAME(ENABLE_SNIFFER);
313 MWL8K_CMDNAME(SET_MAC_ADDR);
312 MWL8K_CMDNAME(SET_RATEADAPT_MODE); 314 MWL8K_CMDNAME(SET_RATEADAPT_MODE);
313 MWL8K_CMDNAME(UPDATE_STADB); 315 MWL8K_CMDNAME(UPDATE_STADB);
314 default: 316 default:
@@ -1903,6 +1905,34 @@ static int mwl8k_enable_sniffer(struct ieee80211_hw *hw, bool enable)
1903} 1905}
1904 1906
1905/* 1907/*
1908 * CMD_SET_MAC_ADDR.
1909 */
1910struct mwl8k_cmd_set_mac_addr {
1911 struct mwl8k_cmd_pkt header;
1912 __u8 mac_addr[ETH_ALEN];
1913} __attribute__((packed));
1914
1915static int mwl8k_set_mac_addr(struct ieee80211_hw *hw, u8 *mac)
1916{
1917 struct mwl8k_cmd_set_mac_addr *cmd;
1918 int rc;
1919
1920 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
1921 if (cmd == NULL)
1922 return -ENOMEM;
1923
1924 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_MAC_ADDR);
1925 cmd->header.length = cpu_to_le16(sizeof(*cmd));
1926 memcpy(cmd->mac_addr, mac, ETH_ALEN);
1927
1928 rc = mwl8k_post_cmd(hw, &cmd->header);
1929 kfree(cmd);
1930
1931 return rc;
1932}
1933
1934
1935/*
1906 * CMD_SET_RATEADAPT_MODE. 1936 * CMD_SET_RATEADAPT_MODE.
1907 */ 1937 */
1908struct mwl8k_cmd_set_rate_adapt_mode { 1938struct mwl8k_cmd_set_rate_adapt_mode {
@@ -2527,7 +2557,8 @@ static int mwl8k_add_interface(struct ieee80211_hw *hw,
2527 mwl8k_vif = MWL8K_VIF(conf->vif); 2557 mwl8k_vif = MWL8K_VIF(conf->vif);
2528 memset(mwl8k_vif, 0, sizeof(*mwl8k_vif)); 2558 memset(mwl8k_vif, 0, sizeof(*mwl8k_vif));
2529 2559
2530 /* Save the mac address */ 2560 /* Set and save the mac address */
2561 mwl8k_set_mac_addr(hw, conf->mac_addr);
2531 memcpy(mwl8k_vif->mac_addr, conf->mac_addr, ETH_ALEN); 2562 memcpy(mwl8k_vif->mac_addr, conf->mac_addr, ETH_ALEN);
2532 2563
2533 /* Back pointer to parent config block */ 2564 /* Back pointer to parent config block */
@@ -2555,6 +2586,8 @@ static void mwl8k_remove_interface(struct ieee80211_hw *hw,
2555 if (priv->vif == NULL) 2586 if (priv->vif == NULL)
2556 return; 2587 return;
2557 2588
2589 mwl8k_set_mac_addr(hw, "\x00\x00\x00\x00\x00\x00");
2590
2558 priv->vif = NULL; 2591 priv->vif = NULL;
2559} 2592}
2560 2593
@@ -3025,6 +3058,14 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
3025 goto err_stop_firmware; 3058 goto err_stop_firmware;
3026 } 3059 }
3027 3060
3061 /* Clear MAC address */
3062 rc = mwl8k_set_mac_addr(hw, "\x00\x00\x00\x00\x00\x00");
3063 if (rc) {
3064 printk(KERN_ERR "%s: Cannot clear MAC address\n",
3065 wiphy_name(hw->wiphy));
3066 goto err_stop_firmware;
3067 }
3068
3028 /* Disable interrupts */ 3069 /* Disable interrupts */
3029 iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); 3070 iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK);
3030 free_irq(priv->pdev->irq, hw); 3071 free_irq(priv->pdev->irq, hw);