Skip to content

Commit 354928d

Browse files
Stanislaw Gruszkalinvjw
Stanislaw Gruszka
authored andcommitted
iwlwifi: make tx_cmd_pool kmem cache global
Otherwise we are not able to run more than one device per driver: [ 24.743045] kmem_cache_create: duplicate cache iwl_dev_cmd [ 24.743051] Pid: 3165, comm: NetworkManager Not tainted 3.3.0-rc2-wl+ #5 [ 24.743054] Call Trace: [ 24.743066] [<ffffffff811717d5>] kmem_cache_create+0x655/0x700 [ 24.743101] [<ffffffffa03b9f8b>] iwl_alive_notify+0x1cb/0x1f0 [iwlwifi] [ 24.743111] [<ffffffffa03ba442>] iwl_load_ucode_wait_alive+0x1b2/0x220 [iwlwifi] [ 24.743142] [<ffffffffa03ba893>] iwl_run_init_ucode+0x73/0x100 [iwlwifi] [ 24.743152] [<ffffffffa03b8fa1>] __iwl_up+0x81/0x220 [iwlwifi] [ 24.743161] [<ffffffffa03b91c0>] iwlagn_mac_start+0x80/0x190 [iwlwifi] [ 24.743188] [<ffffffffa03307b3>] ieee80211_do_open+0x293/0x770 [mac80211] Signed-off-by: Stanislaw Gruszka <[email protected]> Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Wey-Yi Guy <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 9a71686 commit 354928d

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

drivers/net/wireless/iwlwifi/iwl-agn-tx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
367367
if (info->flags & IEEE80211_TX_CTL_AMPDU)
368368
is_agg = true;
369369

370-
dev_cmd = kmem_cache_alloc(priv->tx_cmd_pool, GFP_ATOMIC);
370+
dev_cmd = kmem_cache_alloc(iwl_tx_cmd_pool, GFP_ATOMIC);
371371

372372
if (unlikely(!dev_cmd))
373373
goto drop_unlock_priv;
@@ -458,7 +458,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
458458

459459
drop_unlock_sta:
460460
if (dev_cmd)
461-
kmem_cache_free(priv->tx_cmd_pool, dev_cmd);
461+
kmem_cache_free(iwl_tx_cmd_pool, dev_cmd);
462462
spin_unlock(&priv->sta_lock);
463463
drop_unlock_priv:
464464
return -1;
@@ -1078,7 +1078,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
10781078

10791079
info = IEEE80211_SKB_CB(skb);
10801080
ctx = info->driver_data[0];
1081-
kmem_cache_free(priv->tx_cmd_pool,
1081+
kmem_cache_free(iwl_tx_cmd_pool,
10821082
(info->driver_data[1]));
10831083

10841084
memset(&info->status, 0, sizeof(info->status));
@@ -1229,7 +1229,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
12291229
WARN_ON_ONCE(1);
12301230

12311231
info = IEEE80211_SKB_CB(skb);
1232-
kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
1232+
kmem_cache_free(iwl_tx_cmd_pool, (info->driver_data[1]));
12331233

12341234
if (freed == 1) {
12351235
/* this is the first skb we deliver in this batch */

drivers/net/wireless/iwlwifi/iwl-agn.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,8 +1102,6 @@ static void iwl_uninit_drv(struct iwl_priv *priv)
11021102
{
11031103
iwl_free_geos(priv);
11041104
iwl_free_channel_map(priv);
1105-
if (priv->tx_cmd_pool)
1106-
kmem_cache_destroy(priv->tx_cmd_pool);
11071105
kfree(priv->scan_cmd);
11081106
kfree(priv->beacon_cmd);
11091107
kfree(rcu_dereference_raw(priv->noa_data));
@@ -1477,34 +1475,45 @@ const struct iwl_op_mode_ops iwl_dvm_ops = {
14771475
* driver and module entry point
14781476
*
14791477
*****************************************************************************/
1478+
1479+
struct kmem_cache *iwl_tx_cmd_pool;
1480+
14801481
static int __init iwl_init(void)
14811482
{
14821483

14831484
int ret;
14841485
pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
14851486
pr_info(DRV_COPYRIGHT "\n");
14861487

1488+
iwl_tx_cmd_pool = kmem_cache_create("iwl_dev_cmd",
1489+
sizeof(struct iwl_device_cmd),
1490+
sizeof(void *), 0, NULL);
1491+
if (!iwl_tx_cmd_pool)
1492+
return -ENOMEM;
1493+
14871494
ret = iwlagn_rate_control_register();
14881495
if (ret) {
14891496
pr_err("Unable to register rate control algorithm: %d\n", ret);
1490-
return ret;
1497+
goto error_rc_register;
14911498
}
14921499

14931500
ret = iwl_pci_register_driver();
1494-
14951501
if (ret)
1496-
goto error_register;
1502+
goto error_pci_register;
14971503
return ret;
14981504

1499-
error_register:
1505+
error_pci_register:
15001506
iwlagn_rate_control_unregister();
1507+
error_rc_register:
1508+
kmem_cache_destroy(iwl_tx_cmd_pool);
15011509
return ret;
15021510
}
15031511

15041512
static void __exit iwl_exit(void)
15051513
{
15061514
iwl_pci_unregister_driver();
15071515
iwlagn_rate_control_unregister();
1516+
kmem_cache_destroy(iwl_tx_cmd_pool);
15081517
}
15091518

15101519
module_exit(iwl_exit);

drivers/net/wireless/iwlwifi/iwl-core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,10 +1470,9 @@ void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
14701470

14711471
void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb)
14721472
{
1473-
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
14741473
struct ieee80211_tx_info *info;
14751474

14761475
info = IEEE80211_SKB_CB(skb);
1477-
kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
1476+
kmem_cache_free(iwl_tx_cmd_pool, (info->driver_data[1]));
14781477
dev_kfree_skb_any(skb);
14791478
}

drivers/net/wireless/iwlwifi/iwl-dev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ struct iwl_priv {
725725
struct ieee80211_hw *hw;
726726
struct ieee80211_channel *ieee_channels;
727727
struct ieee80211_rate *ieee_rates;
728-
struct kmem_cache *tx_cmd_pool;
729728

730729
struct list_head calib_results;
731730

@@ -983,6 +982,7 @@ struct iwl_priv {
983982
bool have_rekey_data;
984983
}; /*iwl_priv */
985984

985+
extern struct kmem_cache *iwl_tx_cmd_pool;
986986
extern struct iwl_mod_params iwlagn_mod_params;
987987

988988
static inline struct iwl_rxon_context *

drivers/net/wireless/iwlwifi/iwl-ucode.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,15 +318,6 @@ static int iwl_alive_notify(struct iwl_priv *priv)
318318
{
319319
int ret;
320320

321-
if (!priv->tx_cmd_pool)
322-
priv->tx_cmd_pool =
323-
kmem_cache_create("iwl_dev_cmd",
324-
sizeof(struct iwl_device_cmd),
325-
sizeof(void *), 0, NULL);
326-
327-
if (!priv->tx_cmd_pool)
328-
return -ENOMEM;
329-
330321
iwl_trans_fw_alive(trans(priv));
331322

332323
priv->passive_no_rx = false;

0 commit comments

Comments
 (0)