From: Nick Kossifidis <mick@madwifi.org>
To: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org
Cc: linville@tuxdriver.com, jirislaby@gmail.com, mcgrof@gmail.com
Subject: [PATCH] ath5k: Remove fill_tx_desc
Date: Sun, 28 Oct 2007 02:58:27 +0300 [thread overview]
Message-ID: <20071027235827.GH5973@localhost.domain.invalid> (raw)
fill_tx_desc is used for fast frames operation, since
we don't support fast frames (and since fill_tx_desc
had a bug -thanx to Ulrich Meis for finding that out-)
these functions are not needed (+ they are misleading
because they don't "fill" any tx descriptor).
I couldn't test this patch much so plz someone ACK it...
It applies on top of my previous patches (i just thought
that [PATCH 8/7] won't look nice ;-) ).
Changes-licensed-under: ISC
Signed-off-by: Ulrich Meis <meis@nets.rwth-aachen.de>
Signed-Off-by: Nick Kossifidis <mickflemm@gmail.com>
---
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index ef76f1c..4122466 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h
@@ -1031,8 +1031,6 @@ struct ath5k_hw {
bool (*ah_setup_xtx_desc)(struct ath5k_hw *, struct ath5k_desc *,
unsigned int, unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int);
- int (*ah_fill_tx_desc)(struct ath5k_hw *, struct ath5k_desc *,
- unsigned int, bool, bool);
int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *);
int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *);
};
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index e6a3155..4b4ddf4 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1390,10 +1390,6 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
ds->ds_link = 0;
ds->ds_data = bf->skbaddr;
- ret = ah->ah_fill_tx_desc(ah, ds, skb->len, true, true);
- if (ret)
- goto err_unmap;
-
spin_lock_bh(&txq->lock);
list_add_tail(&bf->list, &txq->q);
sc->tx_stats.data[txq->qnum].len++;
@@ -1966,10 +1962,6 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
AR5K_TXKEYIX_INVALID, antenna, flags, 0, 0);
if (ret)
goto err_unmap;
- /* NB: beacon's BufLen must be a multiple of 4 bytes */
- ret = ah->ah_fill_tx_desc(ah, ds, roundup(skb->len, 4), true, true);
- if (ret)
- goto err_unmap;
return 0;
err_unmap:
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index ac105c6..7b9920c 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -47,15 +47,11 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *, struct ath5k_desc *,
static bool ath5k_hw_setup_xr_tx_desc(struct ath5k_hw *, struct ath5k_desc *,
unsigned int, unsigned int, unsigned int, unsigned int, unsigned int,
unsigned int);
-static int ath5k_hw_fill_4word_tx_desc(struct ath5k_hw *, struct ath5k_desc *,
- unsigned int, bool, bool);
static int ath5k_hw_proc_4word_tx_status(struct ath5k_hw *, struct ath5k_desc *);
static int ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *, struct ath5k_desc *,
unsigned int, unsigned int, enum ath5k_pkt_type, unsigned int,
unsigned int, unsigned int, unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int);
-static int ath5k_hw_fill_2word_tx_desc(struct ath5k_hw *, struct ath5k_desc *,
- unsigned int, bool, bool);
static int ath5k_hw_proc_2word_tx_status(struct ath5k_hw *, struct ath5k_desc *);
static int ath5k_hw_proc_new_rx_status(struct ath5k_hw *, struct ath5k_desc *);
static int ath5k_hw_proc_old_rx_status(struct ath5k_hw *, struct ath5k_desc *);
@@ -243,12 +239,10 @@ struct ath5k_hw *ath5k_hw_attach(u16 device, u8 mac_version, void *sc,
if (ah->ah_version == AR5K_AR5212) {
ah->ah_setup_tx_desc = ath5k_hw_setup_4word_tx_desc;
ah->ah_setup_xtx_desc = ath5k_hw_setup_xr_tx_desc;
- ah->ah_fill_tx_desc = ath5k_hw_fill_4word_tx_desc;
ah->ah_proc_tx_desc = ath5k_hw_proc_4word_tx_status;
} else {
ah->ah_setup_tx_desc = ath5k_hw_setup_2word_tx_desc;
ah->ah_setup_xtx_desc = ath5k_hw_setup_xr_tx_desc;
- ah->ah_fill_tx_desc = ath5k_hw_fill_2word_tx_desc;
ah->ah_proc_tx_desc = ath5k_hw_proc_2word_tx_status;
}
@@ -287,7 +281,7 @@ struct ath5k_hw *ath5k_hw_attach(u16 device, u8 mac_version, void *sc,
/* Warn for partially supported chips (unsupported phy etc) */
if(srev >= AR5K_SREV_VER_AR2424){
- printk(KERN_WARN "ath5k: Device partially supported.\n");
+ printk(KERN_DEBUG "ath5k: Device partially supported.\n");
}
/* Identify single chip solutions */
@@ -3491,31 +3485,52 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
{
u32 frame_type;
struct ath5k_hw_2w_tx_desc *tx_desc;
+ unsigned int buff_len;
tx_desc = (struct ath5k_hw_2w_tx_desc *)&desc->ds_ctl0;
+ /*
+ * Validate input
+ */
if (tx_tries0 == 0)
return -EINVAL;
+ /* Clear status descriptor */
+ memset(desc->ds_hw, 0, sizeof(struct ath5k_hw_tx_status));
+
/* Initialize control descriptor */
tx_desc->tx_control_0 = 0;
tx_desc->tx_control_1 = 0;
/* Setup control descriptor */
- /*Verify packet length*/
+ /* Verify and set frame length */
+ if (pkt_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN)
+ return -EINVAL;
+
tx_desc->tx_control_0 = pkt_len & AR5K_2W_TX_DESC_CTL0_FRAME_LEN;
- if (tx_desc->tx_control_0 != pkt_len)
+
+ /* Verify and set buffer length */
+ buff_len = pkt_len - FCS_LEN;
+
+ /* NB: beacon's BufLen must be a multiple of 4 bytes */
+ if(type == AR5K_PKT_TYPE_BEACON)
+ buff_len = roundup(buff_len, 4);
+
+ if (buff_len & ~AR5K_2W_TX_DESC_CTL1_BUF_LEN)
return -EINVAL;
+
+ tx_desc->tx_control_1 = buff_len & AR5K_2W_TX_DESC_CTL1_BUF_LEN;
+
/*
- * Verify header length
+ * Verify and set header length
* XXX: I only found that on 5210 code, does it work on 5211 ?
*/
if (ah->ah_version == AR5K_AR5210) {
- tx_desc->tx_control_0 = hdr_len &
- AR5K_2W_TX_DESC_CTL0_HEADER_LEN;
- if (tx_desc->tx_control_0 != hdr_len)
+ if (hdr_len & ~AR5K_2W_TX_DESC_CTL0_HEADER_LEN)
return -EINVAL;
+ tx_desc->tx_control_0 |=
+ AR5K_REG_SM(hdr_len, AR5K_2W_TX_DESC_CTL0_HEADER_LEN);
}
/*Diferences between 5210-5211*/
@@ -3530,14 +3545,14 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
frame_type = type /*<< 2 ?*/;
}
- tx_desc->tx_control_0 =
+ tx_desc->tx_control_0 |=
AR5K_REG_SM(frame_type, AR5K_2W_TX_DESC_CTL0_FRAME_TYPE) |
AR5K_REG_SM(tx_rate0, AR5K_2W_TX_DESC_CTL0_XMIT_RATE);
} else {
tx_desc->tx_control_0 |=
AR5K_REG_SM(tx_rate0, AR5K_2W_TX_DESC_CTL0_XMIT_RATE) |
AR5K_REG_SM(antenna_mode, AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT);
- tx_desc->tx_control_1 =
+ tx_desc->tx_control_1 |=
AR5K_REG_SM(type, AR5K_2W_TX_DESC_CTL1_FRAME_TYPE);
}
#define _TX_FLAGS(_c, _flag) \
@@ -3586,10 +3601,12 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
unsigned int rtscts_duration)
{
struct ath5k_hw_4w_tx_desc *tx_desc;
+ struct ath5k_hw_tx_status *tx_status;
+ unsigned int buff_len;
AR5K_TRACE;
-
tx_desc = (struct ath5k_hw_4w_tx_desc *)&desc->ds_ctl0;
+ tx_status = (struct ath5k_hw_tx_status *)&desc->ds_hw[2];
/*
* Validate input
@@ -3597,21 +3614,37 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
if (tx_tries0 == 0)
return -EINVAL;
- /* Initialize status descriptor */
+ /* Clear status descriptor */
+ memset(tx_status, 0, sizeof(struct ath5k_hw_tx_status));
+
+ /* Initialize control descriptor */
tx_desc->tx_control_0 = 0;
tx_desc->tx_control_1 = 0;
tx_desc->tx_control_2 = 0;
tx_desc->tx_control_3 = 0;
- /* Setup status descriptor */
+ /* Setup control descriptor */
+
+ /* Verify and set frame length */
+ if (pkt_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN)
+ return -EINVAL;
+
tx_desc->tx_control_0 = pkt_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN;
- if (tx_desc->tx_control_0 != pkt_len)
+
+ /* Verify and set buffer length */
+ buff_len = pkt_len - FCS_LEN;
+
+ /* NB: beacon's BufLen must be a multiple of 4 bytes */
+ if(type == AR5K_PKT_TYPE_BEACON)
+ buff_len = roundup(buff_len, 4);
+
+ if (buff_len & ~AR5K_4W_TX_DESC_CTL1_BUF_LEN)
return -EINVAL;
tx_desc->tx_control_0 |=
AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) |
AR5K_REG_SM(antenna_mode, AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT);
- tx_desc->tx_control_1 = AR5K_REG_SM(type,
+ tx_desc->tx_control_1 |= AR5K_REG_SM(type,
AR5K_4W_TX_DESC_CTL1_FRAME_TYPE);
tx_desc->tx_control_2 = AR5K_REG_SM(tx_tries0 + AR5K_TUNE_HWTXTRIES,
AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0);
@@ -3657,7 +3690,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
}
/*
- * Initialize a 4-word XR tx descriptor on 5212
+ * Initialize a 4-word multirate tx descriptor on 5212
*/
static bool
ath5k_hw_setup_xr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
@@ -3692,66 +3725,6 @@ ath5k_hw_setup_xr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
}
/*
- * Fill the 2-word tx descriptor on 5210/5211
- */
-static int ath5k_hw_fill_2word_tx_desc(struct ath5k_hw *ah,
- struct ath5k_desc *desc, unsigned int segment_length,
- bool first_segment, bool last_segment)
-{
- struct ath5k_hw_2w_tx_desc *tx_desc;
-
- tx_desc = (struct ath5k_hw_2w_tx_desc *)&desc->ds_ctl0;
-
- /* Clear status descriptor */
- memset(desc->ds_hw, 0, sizeof(desc->ds_hw));
-
- /* Validate segment length and initialize the descriptor */
- tx_desc->tx_control_1 = segment_length & AR5K_2W_TX_DESC_CTL1_BUF_LEN;
- if (tx_desc->tx_control_1 != segment_length)
- return -EINVAL;
-
- if (first_segment != true)
- tx_desc->tx_control_0 &= ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN;
-
- if (last_segment != true)
- tx_desc->tx_control_1 |= AR5K_2W_TX_DESC_CTL1_MORE;
-
- return 0;
-}
-
-/*
- * Fill the 4-word tx descriptor on 5212
- * XXX: Added an argument *last_desc -need revision
- */
-static int ath5k_hw_fill_4word_tx_desc(struct ath5k_hw *ah,
- struct ath5k_desc *desc, unsigned int segment_length,
- bool first_segment, bool last_segment)
-{
- struct ath5k_hw_4w_tx_desc *tx_desc;
- struct ath5k_hw_tx_status *tx_status;
-
- AR5K_TRACE;
- tx_desc = (struct ath5k_hw_4w_tx_desc *)&desc->ds_ctl0;
- tx_status = (struct ath5k_hw_tx_status *)&desc->ds_hw[2];
-
- /* Clear status descriptor */
- memset(tx_status, 0, sizeof(struct ath5k_hw_tx_status));
-
- /* Validate segment length and initialize the descriptor */
- tx_desc->tx_control_1 = segment_length & AR5K_4W_TX_DESC_CTL1_BUF_LEN;
- if (tx_desc->tx_control_1 != segment_length)
- return -EINVAL;
-
- if (first_segment != true)
- tx_desc->tx_control_0 &= ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN;
-
- if (last_segment != true)
- tx_desc->tx_control_1 |= AR5K_4W_TX_DESC_CTL1_MORE;
-
- return 0;
-}
-
-/*
* Proccess the tx status descriptor on 5210/5211
*/
static int ath5k_hw_proc_2word_tx_status(struct ath5k_hw *ah,
next reply other threads:[~2007-10-27 23:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-27 23:58 Nick Kossifidis [this message]
2007-10-30 16:45 ` [PATCH] ath5k: Remove fill_tx_desc Luis R. Rodriguez
2007-10-30 19:27 ` [ath5k-devel] " Ulrich Meis
2007-10-30 20:34 ` Nick Kossifidis
2007-10-31 17:12 ` Luis R. Rodriguez
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=20071027235827.GH5973@localhost.domain.invalid \
--to=mick@madwifi.org \
--cc=ath5k-devel@lists.ath5k.org \
--cc=jirislaby@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mcgrof@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.