From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
To: ipwpatch@vger.kernel.org
Cc: linux-wireless@vger.kernel.org, Zhu Yi <yi.zhu@intel.com>,
Tomas Winkler <tomas.winkler@intel.com>
Subject: [PATCH 04/17] iwlwifi: cleanup tx queue allocation
Date: Fri, 27 Jul 2007 17:26:28 +0800 [thread overview]
Message-ID: <1185528408776-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <11855284072074-git-send-email-yi.zhu@intel.com>
The following patch cleans up tx queue allocation. Change txq bd
from u8* to struct iwl_tdf_frame. This allows kill
txq->q.element_size and do strong type changing. Most importantly
in increasing number of slots from 64 to 256 for TX queues. This is
crucial for good TX performance in HT aggregation.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
drivers/net/wireless/iwl-3945.c | 15 +++++++--------
drivers/net/wireless/iwl-4965.c | 6 +++---
drivers/net/wireless/iwl-base.c | 31 +++++++++++++++----------------
drivers/net/wireless/iwl-hw.h | 2 +-
drivers/net/wireless/iwlwifi.h | 3 +--
5 files changed, 27 insertions(+), 30 deletions(-)
diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c
index 6683778..eb8226a 100644
--- a/drivers/net/wireless/iwl-3945.c
+++ b/drivers/net/wireless/iwl-3945.c
@@ -842,7 +842,7 @@ static int iwl3945_tx_reset(struct iwl_priv *priv)
static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
{
int rc;
- int i, num_slots;
+ int txq_id, slots_num;
iwl_hw_txq_ctx_free(priv);
@@ -852,13 +852,14 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
goto error;
/* Tx queue(s) */
- for (i = 0; i < TFD_QUEUE_MAX; i++) {
- num_slots =
- (i == IWL_CMD_QUEUE_NUM) ? TFD_CMD_SLOTS :
+ for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) {
+ slots_num =
+ (txq_id == IWL_CMD_QUEUE_NUM) ? TFD_CMD_SLOTS :
TFD_TX_CMD_SLOTS;
- rc = iwl_tx_queue_init(priv, &priv->txq[i], num_slots, i);
+ rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
+ txq_id);
if (rc) {
- IWL_ERROR("Tx %d queue init failed\n", i);
+ IWL_ERROR("Tx %d queue init failed\n", txq_id);
goto error;
}
}
@@ -2109,8 +2110,6 @@ int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
shared_data->tx_base_ptr[txq_id] = (u32) txq->q.dma_addr;
- txq->q.element_size = sizeof(struct iwl_tfd_frame);
-
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_restricted_access(priv);
if (rc) {
diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index 3f1a339..03e3708 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -366,7 +366,7 @@ static void iwl4965_kw_free(struct iwl_priv *priv)
static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
{
int rc = 0;
- int txq_id, num_slots;
+ int txq_id, slots_num;
unsigned long flags;
iwl4965_kw_free(priv);
@@ -401,9 +401,9 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
/* Tx queue(s) */
for (txq_id = 0; txq_id < priv->hw_setting.max_queue_number; txq_id++) {
- num_slots = (txq_id == IWL_CMD_QUEUE_NUM) ?
+ slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
- rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], num_slots,
+ rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
txq_id);
if (rc) {
IWL_ERROR("Tx %d queue init failed\n", txq_id);
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 1437f66..82470f1 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -179,10 +179,10 @@ static inline u8 get_next_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
}
static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
- int count, int size, u32 id)
+ int count, int slots_num, u32 id)
{
q->n_bd = count;
- q->n_window = size;
+ q->n_window = slots_num;
q->id = id;
q->low_mark = q->n_window / 4;
@@ -199,7 +199,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
}
static int iwl_tx_queue_alloc(struct iwl_priv *priv,
- struct iwl_tx_queue *txq, int count, u32 id)
+ struct iwl_tx_queue *txq, u32 id)
{
struct pci_dev *dev = priv->pci_dev;
@@ -215,13 +215,12 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
txq->txb = NULL;
txq->bd = pci_alloc_consistent(dev,
- sizeof(struct iwl_tfd_frame) * TFD_QUEUE_SIZE_MAX,
+ sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX,
&txq->q.dma_addr);
- txq->q.element_size = sizeof(struct iwl_tfd_frame);
if (!txq->bd) {
IWL_ERROR("pci_alloc_consistent(%zd) failed\n",
- sizeof(txq->bd[0]) * count);
+ sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX);
goto error;
}
txq->q.id = id;
@@ -238,7 +237,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
}
int iwl_tx_queue_init(struct iwl_priv *priv,
- struct iwl_tx_queue *txq, int count, u32 txq_id)
+ struct iwl_tx_queue *txq, int slots_num, u32 txq_id)
{
struct pci_dev *dev = priv->pci_dev;
int len;
@@ -247,14 +246,14 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
/* alocate command space + one big command for scan since scan
* command is very huge the system will not have two scan at the
* same time */
- len = sizeof(struct iwl_cmd) * count;
+ len = sizeof(struct iwl_cmd) * slots_num;
if (txq_id == IWL_CMD_QUEUE_NUM);
len += IWL_MAX_SCAN_SIZE;
txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd);
if (!txq->cmd)
return -ENOMEM;
- rc = iwl_tx_queue_alloc(priv, txq, count, txq_id);
+ rc = iwl_tx_queue_alloc(priv, txq, txq_id);
if (rc) {
pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
@@ -262,7 +261,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
}
txq->need_update = 0;
- iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, count, txq_id);
+ iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
iwl_hw_tx_queue_init(priv, txq);
return 0;
@@ -551,7 +550,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
{
struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
struct iwl_queue *q = &txq->q;
- u8 *tfd;
+ struct iwl_tfd_frame *tfd;
u32 *control_flags;
struct iwl_cmd *out_cmd;
u32 idx = 0;
@@ -573,8 +572,8 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
IWL_ERROR("No space for Tx\n");
return -ENOSPC;
}
- tfd = &txq->bd[q->first_empty * q->element_size];
- memset(tfd, 0, q->element_size);
+ tfd = &txq->bd[q->first_empty];
+ memset(tfd, 0, sizeof(*tfd));
control_flags = (u32 *) tfd;
@@ -2754,7 +2753,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
struct sk_buff *skb, struct ieee80211_tx_control *ctl)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u8 *tfd;
+ struct iwl_tfd_frame *tfd;
u32 *control_flags;
int txq_id = ctl->queue;
struct iwl_tx_queue *txq = NULL;
@@ -2845,8 +2844,8 @@ static int iwl_tx_skb(struct iwl_priv *priv,
q = &txq->q;
spin_lock_irqsave(&priv->lock, flags);
- tfd = (u8 *) (&txq->bd[q->first_empty * q->element_size]);
- memset(tfd, 0, q->element_size);
+ tfd = &txq->bd[q->first_empty];
+ memset(tfd, 0, sizeof(*tfd));
control_flags = (u32 *) tfd;
idx = get_next_cmd_index(q, q->first_empty, 0);
diff --git a/drivers/net/wireless/iwl-hw.h b/drivers/net/wireless/iwl-hw.h
index 4b3cd37..3f7e5bd 100644
--- a/drivers/net/wireless/iwl-hw.h
+++ b/drivers/net/wireless/iwl-hw.h
@@ -1231,7 +1231,7 @@ struct statistics {
#define TFD_CTL_PAD_SET(n) (n<<28)
#define TFD_CTL_PAD_GET(ctl) (ctl>>28)
-#define TFD_TX_CMD_SLOTS 64
+#define TFD_TX_CMD_SLOTS 256
#define TFD_CMD_SLOTS 32
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h
index 58e3ea6..d0403d0 100644
--- a/drivers/net/wireless/iwlwifi.h
+++ b/drivers/net/wireless/iwlwifi.h
@@ -134,7 +134,6 @@ struct iwl_queue {
dma_addr_t dma_addr; /* physical addr for BD's */
int n_window; /* safe queue window */
u32 id;
- u32 element_size;
int low_mark; /* low watermark, resume queue if free
* space more than this */
int high_mark; /* high watermark, stop queue if free
@@ -157,7 +156,7 @@ struct iwl_tx_info {
*/
struct iwl_tx_queue {
struct iwl_queue q;
- u8 *bd;
+ struct iwl_tfd_frame *bd;
struct iwl_cmd *cmd;
dma_addr_t dma_addr_cmd;
struct iwl_tx_info *txb;
--
1.5.2
next prev parent reply other threads:[~2007-07-27 9:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <11855284012123-git-send-email-yi.zhu@intel.com>
2007-07-27 9:26 ` [PATCH 01/17] iwlwifi: provide frequency to radiotap monitor not channel index Zhu Yi
2007-07-27 9:26 ` [PATCH 02/17] iwlwifi: Calculate and report noise level while associated Zhu Yi
2007-07-27 9:26 ` [PATCH 03/17] iwlwifi: modify station fix Zhu Yi
2007-07-27 9:26 ` Zhu Yi [this message]
2007-07-27 9:26 ` [PATCH 05/17] iwlwifi: rxon filter_flags endianity fix Zhu Yi
2007-07-27 9:26 ` [PATCH 06/17] iwlwifi: rename base.c to iwl-base.c Zhu Yi
2007-07-27 9:26 ` [PATCH 07/17] iwilwifi: removed unused constant Zhu Yi
2007-07-27 9:26 ` [PATCH 08/17] iwlwifi: QoS control endianity fixes Zhu Yi
2007-07-27 9:26 ` [PATCH 09/17] iwlwifi: EEPROM reading fix Zhu Yi
2007-07-27 9:26 ` [PATCH 10/17] iwlwifi: endianity cleaning of iwl_print_rx_config_cmd Zhu Yi
2007-07-27 9:26 ` [PATCH 11/17] iwlwifi: endianity cleanup for QoS host command Zhu Yi
2007-07-27 9:26 ` [PATCH 12/17] iwlwifi: endianity cleanup for power table " Zhu Yi
2007-07-27 9:26 ` [PATCH 13/17] iwlwifi: fix 11n on 2.4 channel Zhu Yi
2007-07-27 9:26 ` [PATCH 14/17] iwlwifi: fix channel switch assert Zhu Yi
2007-07-27 9:26 ` [PATCH 15/17] iwlwifi: fix scaing watchdog time out Zhu Yi
2007-07-27 9:26 ` [PATCH 16/17] iwlwifi: Add uCode/driver compatibility version number Zhu Yi
2007-07-27 9:26 ` [PATCH 17/17] iwlwifi: update version stamp to 0.1.5 Zhu Yi
2007-07-27 11:22 ` [PATCH 09/17] iwlwifi: EEPROM reading fix Michael Buesch
2007-07-27 22:24 ` Tomas Winkler
2007-07-27 22:32 ` Michael Buesch
2007-07-27 9:30 ` [PATCH 00/17] iwlwifi driver updated to version 0.1.5 Zhu Yi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1185528408776-git-send-email-yi.zhu@intel.com \
--to=yi.zhu@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=tomas.winkler@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).