stlc45xx IBSS and MESH mode

Max Filippov jcmvbkbc at gmail.com
Sat Nov 15 22:32:56 EET 2008


Hello.

Are you accepting patches? If so, how it should be arranged? What is the 
review procedure?

I have one that adds IBSS/mesh mode support:

diff --git a/stlc45xx.c b/stlc45xx.c
index 690121b..f4ba1ae 100644
--- a/stlc45xx.c
+++ b/stlc45xx.c
@@ -1490,7 +1490,7 @@ static void stlc45xx_tx_edcf(struct stlc45xx *stlc)
        kfree(control);
 }
 
-static void stlc45xx_tx_setup(struct stlc45xx *stlc)
+static void stlc45xx_setup_mac(struct stlc45xx *stlc,u16 mode,const u8 
*bssid)
 {
        struct s_lm_control *control;
        struct s_lmo_setup *setup;
@@ -1507,7 +1507,7 @@ static void stlc45xx_tx_setup(struct stlc45xx *stlc)
        control->length = setup_len;
        control->oid = LM_OID_SETUP;
        
-       setup->flags = LM_SETUP_INFRA;
+       setup->flags = mode;
        setup->antenna = 2;
        setup->rx_align = 0;
        setup->rx_buffer = FIRMWARE_RXBUFFER_START;
@@ -1521,13 +1521,32 @@ static void stlc45xx_tx_setup(struct stlc45xx *stlc)
        setup->osc_start_delay = 65535;
 
        memcpy(setup->macaddr, stlc->mac_addr, ETH_ALEN);
-       memcpy(setup->bssid, stlc->bssid, ETH_ALEN);
+       if (bssid)
+               memcpy(setup->bssid, bssid, ETH_ALEN);
+       else
+               memset(setup->bssid, ~0, ETH_ALEN);
 
        stlc45xx_tx_frame(stlc, FIRMWARE_CONFIG_START, control, len);
        
        kfree(control);
 }
 
+static void stlc45xx_tx_setup(struct stlc45xx *stlc)
+{
+       u16 mode = LM_SETUP_PROMISCUOUS;
+       switch (stlc->mode) {
+       case NL80211_IFTYPE_STATION:
+               mode = LM_SETUP_INFRA;
+               break;
+       case NL80211_IFTYPE_AP:
+       case NL80211_IFTYPE_ADHOC:
+       case NL80211_IFTYPE_MESH_POINT:
+               mode = LM_SETUP_IBSS;
+               break;
+       }
+       stlc45xx_setup_mac(stlc,mode,stlc->bssid);
+}
+
 static void stlc45xx_tx_scan(struct stlc45xx *stlc)
 {
        struct s_lm_control *control;
@@ -1989,6 +2008,8 @@ static int stlc45xx_op_start(struct ieee80211_hw *hw)
 
        WARN_ON(stlc->fw_state != FW_STATE_READY);
 
+       stlc->mode = NL80211_IFTYPE_MONITOR;
+
 out_unlock:
        mutex_unlock(&stlc->mutex);
        
@@ -2018,6 +2039,7 @@ static void stlc45xx_op_stop(struct ieee80211_hw *hw)
        spin_unlock_bh(&stlc->tx_lock);
 
        stlc->fw_state = FW_STATE_OFF;
+       stlc->mode = NL80211_IFTYPE_UNSPECIFIED;
 
        mutex_unlock(&stlc->mutex);
 }
@@ -2027,10 +2049,14 @@ static int stlc45xx_op_add_interface(struct 
ieee80211_hw *hw,
 {
        struct stlc45xx *stlc = hw->priv;
 
-       stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
+       stlc45xx_debug(DEBUG_FUNC, "%s conf->type: %d", __func__,conf->type);
        
        switch (conf->type) {
        case NL80211_IFTYPE_STATION:
+       case NL80211_IFTYPE_AP:
+       case NL80211_IFTYPE_ADHOC:
+       case NL80211_IFTYPE_MESH_POINT:
+               stlc->mode = conf->type;
                break;
        default:
                return -EOPNOTSUPP;
@@ -2038,13 +2064,33 @@ static int stlc45xx_op_add_interface(struct 
ieee80211_hw *hw,
        
        memcpy(stlc->mac_addr, conf->mac_addr, ETH_ALEN);
 
+       switch (conf->type) {
+       case NL80211_IFTYPE_STATION:
+               stlc45xx_setup_mac(stlc,LM_SETUP_INFRA,NULL);
+               break;
+       case NL80211_IFTYPE_AP:
+               stlc45xx_setup_mac(stlc,/*LM_SETUP_AP*/4,stlc->mac_addr);
+               break;
+       case NL80211_IFTYPE_ADHOC:
+       case NL80211_IFTYPE_MESH_POINT:
+               stlc45xx_setup_mac(stlc,LM_SETUP_IBSS,NULL);
+               break;
+       default:
+               BUG();
+       }
+
        return 0;
 }
 
 static void stlc45xx_op_remove_interface(struct ieee80211_hw *hw,
                                         struct ieee80211_if_init_conf *conf)
 {
+       struct stlc45xx *stlc = hw->priv;
+
        stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
+
+       stlc->mode = NL80211_IFTYPE_MONITOR;
+       stlc45xx_setup_mac(stlc,0,NULL);
 }
 
 static int stlc45xx_op_config_interface(struct ieee80211_hw *hw,
@@ -2098,6 +2144,7 @@ static void stlc45xx_op_configure_filter(struct 
ieee80211_hw *hw,
                                      int mc_count,
                                      struct dev_addr_list *mc_list) 
 {
+       stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
        *total_flags = 0;
 }
 
@@ -2108,6 +2155,8 @@ static void stlc45xx_op_bss_info_changed(struct 
ieee80211_hw *hw,
 {
        struct stlc45xx *stlc = hw->priv;
 
+       stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
+
        if (changed & BSS_CHANGED_ASSOC) {
                stlc->associated = info->assoc;
                if (info->assoc)
@@ -2230,6 +2279,7 @@ static int __devinit stlc45xx_probe(struct spi_device 
*spi)
        stlc = hw->priv;
        memset(stlc, 0, sizeof(*stlc));
        
+       stlc->mode = NL80211_IFTYPE_UNSPECIFIED;
        stlc->hw = hw;
        dev_set_drvdata(&spi->dev, stlc);
        stlc->spi = spi;
diff --git a/stlc45xx.h b/stlc45xx.h
index 3dd8466..a953589 100644
--- a/stlc45xx.h
+++ b/stlc45xx.h
@@ -297,6 +297,7 @@ struct stlc45xx
        struct completion fw_comp;
        
        
+       int mode;
        u8 bssid[ETH_ALEN];
        u8 mac_addr[ETH_ALEN];
        int channel;

-- 
Max
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stlc45xx-ibss-mesh.patch
Type: text/x-diff
Size: 4298 bytes
Desc: not available
Url : http://garage.maemo.org/pipermail/stlc45xx-devel/attachments/20081115/4ba0bc08/attachment.bin 


More information about the stlc45xx-devel mailing list