iwlwifi: make broadcast station addition generic
authorReinette Chatre <reinette.chatre@intel.com>
Fri, 22 Jan 2010 22:22:49 +0000 (14:22 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 25 Jan 2010 21:36:22 +0000 (16:36 -0500)
Add function pointer for broadcast station addition so that we can call it
in from iwlcore at a later time. We only distinguish between iwlagn and
iwl3945 broadcast station addition. For the iwl3945 station addition we add
that function to iwlcore since that is where most station functionality
resides, making it part of iwl3945 will require significant code
reorganization that will dilute station management functionality. This
seems to be an efficient solution.

It may seem as though we are removing error checking when adding the 3945
broadcast station but this error checking was never really necessary since
the function returns the station id and the broadcast station id is always
set.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-1000.c
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-sta.c
drivers/net/wireless/iwlwifi/iwl-sta.h

index 85162e2c35d925a4318f7d998ba96a1097595445..4281999cfaaaf865f751d4be7b653e89f6d2690a 100644 (file)
@@ -140,6 +140,7 @@ static struct iwl_lib_ops iwl1000_lib = {
                .temperature = iwl5000_temperature,
                .set_ct_kill = iwl1000_set_ct_threshold,
         },
+       .add_bcast_station = iwl_add_bcast_station,
 };
 
 static const struct iwl_ops iwl1000_ops = {
index 764479f74c8b1239d1dbaa75373ad422189157d2..57194bbd2762b88f5484b5655be09a4aef5a2800 100644 (file)
@@ -1951,11 +1951,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
        }
 
        /* Add the broadcast address so we can send broadcast frames */
-       if (iwl_add_station(priv, iwl_bcast_addr, false, CMD_SYNC, NULL) ==
-           IWL_INVALID_STATION) {
-               IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n");
-               return -EIO;
-       }
+       priv->cfg->ops->lib->add_bcast_station(priv);
 
        /* If we have set the ASSOC_MSK and we are in BSS mode then
         * add the IWL_AP_ID to the station rate table */
@@ -2796,6 +2792,7 @@ static struct iwl_lib_ops iwl3945_lib = {
        .post_associate = iwl3945_post_associate,
        .isr = iwl_isr_legacy,
        .config_ap = iwl3945_config_ap,
+       .add_bcast_station = iwl3945_add_bcast_station,
 };
 
 static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
index c36fef99b4b078ca896481cec0a2383970ead126..aebe8c51d3e18d308e25de8b36ba60d92280009c 100644 (file)
@@ -2206,6 +2206,7 @@ static struct iwl_lib_ops iwl4965_lib = {
                .temperature = iwl4965_temperature_calib,
                .set_ct_kill = iwl4965_set_ct_threshold,
        },
+       .add_bcast_station = iwl_add_bcast_station,
 };
 
 static const struct iwl_ops iwl4965_ops = {
index cbbc0e4f2c76d8ed963ff109ed4a71e9cd4c8ea2..6027e2a658d1c97fa04c70e286f81240a6e10978 100644 (file)
@@ -1503,6 +1503,7 @@ struct iwl_lib_ops iwl5000_lib = {
                .temperature = iwl5000_temperature,
                .set_ct_kill = iwl5000_set_ct_threshold,
         },
+       .add_bcast_station = iwl_add_bcast_station,
 };
 
 static struct iwl_lib_ops iwl5150_lib = {
@@ -1556,6 +1557,7 @@ static struct iwl_lib_ops iwl5150_lib = {
                .temperature = iwl5150_temperature,
                .set_ct_kill = iwl5150_set_ct_threshold,
         },
+       .add_bcast_station = iwl_add_bcast_station,
 };
 
 static const struct iwl_ops iwl5000_ops = {
index f89ef4aa78fdfb095f76dbf4edcb63ed1414b560..81e03e33ec73c3eb66eaccf7bb7a99965ae4624c 100644 (file)
@@ -266,6 +266,7 @@ static struct iwl_lib_ops iwl6000_lib = {
                .temperature = iwl5000_temperature,
                .set_ct_kill = iwl6000_set_ct_threshold,
         },
+       .add_bcast_station = iwl_add_bcast_station,
 };
 
 static const struct iwl_ops iwl6000_ops = {
index e9f786443d1f8db653f77aa1acb525747daf2b13..bed5dda8d6b2a1c86b3721d53ea453257ee57e63 100644 (file)
@@ -203,7 +203,8 @@ int iwl_commit_rxon(struct iwl_priv *priv)
        priv->start_calib = 0;
 
        /* Add the broadcast address so we can send broadcast frames */
-       iwl_add_bcast_station(priv);
+       priv->cfg->ops->lib->add_bcast_station(priv);
+
 
        /* If we have set the ASSOC_MSK and we are in BSS mode then
         * add the IWL_AP_ID to the station rate table */
index 661918347d48cb3409e152323e75420029a8eeb7..e14e32976b8017d4dc34ea774ed0727ce59f23c0 100644 (file)
@@ -188,6 +188,8 @@ struct iwl_lib_ops {
 
        /* temperature */
        struct iwl_temp_ops temp_ops;
+       /* station management */
+       void (*add_bcast_station)(struct iwl_priv *priv);
 };
 
 struct iwl_led_ops {
index 842f156532389fed8f335a3fad606fcc422cba73..fcac73cf82bc60c3f991fd054c42329297234eb3 100644 (file)
@@ -1127,6 +1127,7 @@ static void iwl_sta_init_bcast_lq(struct iwl_priv *priv)
  */
 void iwl_add_bcast_station(struct iwl_priv *priv)
 {
+       IWL_DEBUG_INFO(priv, "Adding broadcast station to station table\n");
        iwl_add_station(priv, iwl_bcast_addr, false, CMD_SYNC, NULL);
 
        /* Set up default rate scaling table in device's station table */
@@ -1134,6 +1135,16 @@ void iwl_add_bcast_station(struct iwl_priv *priv)
 }
 EXPORT_SYMBOL(iwl_add_bcast_station);
 
+/**
+ * iwl3945_add_bcast_station - add broadcast station into station table.
+ */
+void iwl3945_add_bcast_station(struct iwl_priv *priv)
+{
+       IWL_DEBUG_INFO(priv, "Adding broadcast station to station table\n");
+       iwl_add_station(priv, iwl_bcast_addr, false, CMD_SYNC, NULL);
+}
+EXPORT_SYMBOL(iwl3945_add_bcast_station);
+
 /**
  * iwl_get_sta_id - Find station's index within station table
  *
index 8c6850d03e47e6394d1ef3818ea368e78302cd5c..2dc35fe28f56420e9a3fcaef2a57d6105bc54cb9 100644 (file)
@@ -53,6 +53,7 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
 
 int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, bool is_ap);
 void iwl_add_bcast_station(struct iwl_priv *priv);
+void iwl3945_add_bcast_station(struct iwl_priv *priv);
 int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, bool is_ap);
 void iwl_clear_stations_table(struct iwl_priv *priv);
 int iwl_get_free_ucode_key_index(struct iwl_priv *priv);