2010-10-19 07:56:53

by Bruno Randolf

[permalink] [raw]
Subject: [PATCH 1/2] ath5k: Optimize descriptor alignment

Similar to Felix Fietkau <[email protected]> "ath9k_hw: optimize all descriptor
access functions" (13db2a80244908833502189a24de82a856668b8a).

Signed-off-by: Bruno Randolf <[email protected]>
---
drivers/net/wireless/ath/ath5k/desc.h | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/desc.h b/drivers/net/wireless/ath/ath5k/desc.h
index b2adb2a..2509d0b 100644
--- a/drivers/net/wireless/ath/ath5k/desc.h
+++ b/drivers/net/wireless/ath/ath5k/desc.h
@@ -26,7 +26,7 @@
struct ath5k_hw_rx_ctl {
u32 rx_control_0; /* RX control word 0 */
u32 rx_control_1; /* RX control word 1 */
-} __packed;
+} __packed __aligned(4);

/* RX control word 1 fields/flags */
#define AR5K_DESC_RX_CTL1_BUF_LEN 0x00000fff /* data buffer length */
@@ -39,7 +39,7 @@ struct ath5k_hw_rx_ctl {
struct ath5k_hw_rx_status {
u32 rx_status_0; /* RX status word 0 */
u32 rx_status_1; /* RX status word 1 */
-} __packed;
+} __packed __aligned(4);

/* 5210/5211 */
/* RX status word 0 fields/flags */
@@ -129,7 +129,7 @@ enum ath5k_phy_error_code {
struct ath5k_hw_2w_tx_ctl {
u32 tx_control_0; /* TX control word 0 */
u32 tx_control_1; /* TX control word 1 */
-} __packed;
+} __packed __aligned(4);

/* TX control word 0 fields/flags */
#define AR5K_2W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */
@@ -185,7 +185,7 @@ struct ath5k_hw_4w_tx_ctl {
u32 tx_control_1; /* TX control word 1 */
u32 tx_control_2; /* TX control word 2 */
u32 tx_control_3; /* TX control word 3 */
-} __packed;
+} __packed __aligned(4);

/* TX control word 0 fields/flags */
#define AR5K_4W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */
@@ -244,7 +244,7 @@ struct ath5k_hw_4w_tx_ctl {
struct ath5k_hw_tx_status {
u32 tx_status_0; /* TX status word 0 */
u32 tx_status_1; /* TX status word 1 */
-} __packed;
+} __packed __aligned(4);

/* TX status word 0 fields/flags */
#define AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK 0x00000001 /* TX success */
@@ -282,7 +282,7 @@ struct ath5k_hw_tx_status {
struct ath5k_hw_5210_tx_desc {
struct ath5k_hw_2w_tx_ctl tx_ctl;
struct ath5k_hw_tx_status tx_stat;
-} __packed;
+} __packed __aligned(4);

/*
* 5212 hardware TX descriptor
@@ -290,7 +290,7 @@ struct ath5k_hw_5210_tx_desc {
struct ath5k_hw_5212_tx_desc {
struct ath5k_hw_4w_tx_ctl tx_ctl;
struct ath5k_hw_tx_status tx_stat;
-} __packed;
+} __packed __aligned(4);

/*
* Common hardware RX descriptor
@@ -298,7 +298,7 @@ struct ath5k_hw_5212_tx_desc {
struct ath5k_hw_all_rx_desc {
struct ath5k_hw_rx_ctl rx_ctl;
struct ath5k_hw_rx_status rx_stat;
-} __packed;
+} __packed __aligned(4);

/*
* Atheros hardware DMA descriptor
@@ -313,7 +313,7 @@ struct ath5k_desc {
struct ath5k_hw_5212_tx_desc ds_tx5212;
struct ath5k_hw_all_rx_desc ds_rx;
} ud;
-} __packed;
+} __packed __aligned(4);

#define AR5K_RXDESC_INTREQ 0x0020




2010-10-19 07:56:59

by Bruno Randolf

[permalink] [raw]
Subject: [PATCH 2/2] ath5k: Add channel time to survey data

Include the channel utilization (busy, rx, tx) in the survey results.

Signed-off-by: Bruno Randolf <[email protected]>
---
drivers/net/wireless/ath/ath5k/base.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 8251946..484aad5 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -3206,14 +3206,32 @@ static int ath5k_get_survey(struct ieee80211_hw *hw, int idx,
{
struct ath5k_softc *sc = hw->priv;
struct ieee80211_conf *conf = &hw->conf;
+ struct ath_common *common = ath5k_hw_common(sc->ah);
+ struct ath_cycle_counters *cc = &common->cc_survey;
+ unsigned int div = common->clockrate * 1000;

- if (idx != 0)
+ if (idx != 0)
return -ENOENT;

survey->channel = conf->channel;
survey->filled = SURVEY_INFO_NOISE_DBM;
survey->noise = sc->ah->ah_noise_floor;

+ spin_lock_bh(&common->cc_lock);
+ ath_hw_cycle_counters_update(common);
+ if (cc->cycles > 0) {
+ survey->filled |= SURVEY_INFO_CHANNEL_TIME |
+ SURVEY_INFO_CHANNEL_TIME_BUSY |
+ SURVEY_INFO_CHANNEL_TIME_RX |
+ SURVEY_INFO_CHANNEL_TIME_TX;
+ survey->channel_time += cc->cycles / div;
+ survey->channel_time_busy += cc->rx_busy / div;
+ survey->channel_time_rx += cc->rx_frame / div;
+ survey->channel_time_tx += cc->tx_frame / div;
+ }
+ memset(cc, 0, sizeof(*cc));
+ spin_unlock_bh(&common->cc_lock);
+
return 0;
}



2010-11-19 12:29:09

by Jonathan Guerin

[permalink] [raw]
Subject: Re: [PATCH 2/2] ath5k: Add channel time to survey data

I'm not sure if I'm understanding the way the data is represented. I'm
pulling it via nl80211 (or even if just using iw to poll the values
regularly). They just appear to go back and forwards in time, as well
as being very large values. Am I missing something? Is the count not
supposed to be the amount of time for the measure since the card was
brought up?

Also, what does the 'channel time' value actually mean by 'time the
station spent on this channel'? How is this different to the 'Channel
busy time'? If it's not just busy time, but time the station was
locked on this channel, why is the value FAR smaller than the channel
busy time...?

Thanks,

--
Jonathan Guerin



On Tue, Oct 19, 2010 at 5:56 PM, Bruno Randolf <[email protected]> wrote:
> Include the channel utilization (busy, rx, tx) in the survey results.
>
> Signed-off-by: Bruno Randolf <[email protected]>
> ---
> ?drivers/net/wireless/ath/ath5k/base.c | ? 20 +++++++++++++++++++-
> ?1 files changed, 19 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 8251946..484aad5 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -3206,14 +3206,32 @@ static int ath5k_get_survey(struct ieee80211_hw *hw, int idx,
> ?{
> ? ? ? ?struct ath5k_softc *sc = hw->priv;
> ? ? ? ?struct ieee80211_conf *conf = &hw->conf;
> + ? ? ? struct ath_common *common = ath5k_hw_common(sc->ah);
> + ? ? ? struct ath_cycle_counters *cc = &common->cc_survey;
> + ? ? ? unsigned int div = common->clockrate * 1000;
>
> - ? ? ? ?if (idx != 0)
> + ? ? ? if (idx != 0)
> ? ? ? ? ? ? ? ?return -ENOENT;
>
> ? ? ? ?survey->channel = conf->channel;
> ? ? ? ?survey->filled = SURVEY_INFO_NOISE_DBM;
> ? ? ? ?survey->noise = sc->ah->ah_noise_floor;
>
> + ? ? ? spin_lock_bh(&common->cc_lock);
> + ? ? ? ath_hw_cycle_counters_update(common);
> + ? ? ? if (cc->cycles > 0) {
> + ? ? ? ? ? ? ? survey->filled |= SURVEY_INFO_CHANNEL_TIME |
> + ? ? ? ? ? ? ? ? ? ? ? SURVEY_INFO_CHANNEL_TIME_BUSY |
> + ? ? ? ? ? ? ? ? ? ? ? SURVEY_INFO_CHANNEL_TIME_RX |
> + ? ? ? ? ? ? ? ? ? ? ? SURVEY_INFO_CHANNEL_TIME_TX;
> + ? ? ? ? ? ? ? survey->channel_time += cc->cycles / div;
> + ? ? ? ? ? ? ? survey->channel_time_busy += cc->rx_busy / div;
> + ? ? ? ? ? ? ? survey->channel_time_rx += cc->rx_frame / div;
> + ? ? ? ? ? ? ? survey->channel_time_tx += cc->tx_frame / div;
> + ? ? ? }
> + ? ? ? memset(cc, 0, sizeof(*cc));
> + ? ? ? spin_unlock_bh(&common->cc_lock);
> +
> ? ? ? ?return 0;
> ?}
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

2010-12-16 07:22:36

by Bruno Randolf

[permalink] [raw]
Subject: Re: [PATCH 2/2] ath5k: Add channel time to survey data

On Fri November 19 2010 21:28:52 Jonathan Guerin wrote:
> I'm not sure if I'm understanding the way the data is represented. I'm
> pulling it via nl80211 (or even if just using iw to poll the values
> regularly). They just appear to go back and forwards in time, as well
> as being very large values. Am I missing something? Is the count not
> supposed to be the amount of time for the measure since the card was
> brought up?
>
> Also, what does the 'channel time' value actually mean by 'time the
> station spent on this channel'? How is this different to the 'Channel
> busy time'? If it's not just busy time, but time the station was
> locked on this channel, why is the value FAR smaller than the channel
> busy time...?

Jonathan,

Yeah, the old implementation was all broken. Please check my patch from today
- I verified it works now.

bruno

> --
> Jonathan Guerin
>
> On Tue, Oct 19, 2010 at 5:56 PM, Bruno Randolf <[email protected]> wrote:
> > Include the channel utilization (busy, rx, tx) in the survey results.
> >
> > Signed-off-by: Bruno Randolf <[email protected]>
> > ---
> > drivers/net/wireless/ath/ath5k/base.c | 20 +++++++++++++++++++-
> > 1 files changed, 19 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/net/wireless/ath/ath5k/base.c
> > b/drivers/net/wireless/ath/ath5k/base.c index 8251946..484aad5 100644
> > --- a/drivers/net/wireless/ath/ath5k/base.c
> > +++ b/drivers/net/wireless/ath/ath5k/base.c
> > @@ -3206,14 +3206,32 @@ static int ath5k_get_survey(struct ieee80211_hw
> > *hw, int idx, {
> > struct ath5k_softc *sc = hw->priv;
> > struct ieee80211_conf *conf = &hw->conf;
> > + struct ath_common *common = ath5k_hw_common(sc->ah);
> > + struct ath_cycle_counters *cc = &common->cc_survey;
> > + unsigned int div = common->clockrate * 1000;
> >
> > - if (idx != 0)
> > + if (idx != 0)
> > return -ENOENT;
> >
> > survey->channel = conf->channel;
> > survey->filled = SURVEY_INFO_NOISE_DBM;
> > survey->noise = sc->ah->ah_noise_floor;
> >
> > + spin_lock_bh(&common->cc_lock);
> > + ath_hw_cycle_counters_update(common);
> > + if (cc->cycles > 0) {
> > + survey->filled |= SURVEY_INFO_CHANNEL_TIME |
> > + SURVEY_INFO_CHANNEL_TIME_BUSY |
> > + SURVEY_INFO_CHANNEL_TIME_RX |
> > + SURVEY_INFO_CHANNEL_TIME_TX;
> > + survey->channel_time += cc->cycles / div;
> > + survey->channel_time_busy += cc->rx_busy / div;
> > + survey->channel_time_rx += cc->rx_frame / div;
> > + survey->channel_time_tx += cc->tx_frame / div;
> > + }
> > + memset(cc, 0, sizeof(*cc));
> > + spin_unlock_bh(&common->cc_lock);
> > +
> > return 0;
> > }
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-wireless"
> > in the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html