Skip to contentSkip to conversation

ath5k: Fixes for PCI-E cards

PATCH In review Nick Kossifidis 6 participants 20 messages Feb 24, 2008 – Feb 28, 2008 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 6/8 ath5k: Fixes for PCI-E cards

* Fix nic_wakeup for PCI-E chips (don't set AR5K_RESET_CTL_PCI bit)

* Fix dma size setting for PCI-E chips (thanx to Bob Copeland).

Changes-licensed-under: ISC

---

drivers/net/wireless/ath5k/ath5k.h +1 -0
index c0b6596..d8ec373 100644
@@ -971,6 +971,7 @@ struct ath5k_hw {
 	enum ath5k_version	ah_version;
 	enum ath5k_radio	ah_radio;
 	u32			ah_phy;
+	bool			ah_pcie;
 
 	bool			ah_5ghz;
 	bool			ah_2ghz;
drivers/net/wireless/ath5k/hw.c +29 -6
index 3ae5522..cd640ed 100644
@@ -214,6 +214,14 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 		ah->ah_single_chip = false;
 	}
 
+	/* Identify PCI-E cards */
+	if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
+	srev >= AR5K_SREV_VER_AR5416) {
+		ah->ah_pcie = true;
+	} else {
+		ah->ah_pcie = false;
+	}
+
 	/* Single chip radio */
 	if (ah->ah_radio_2ghz_revision == ah->ah_radio_5ghz_revision)
 		ah->ah_radio_2ghz_revision = 0;
@@ -377,9 +385,12 @@ static int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
 					AR5K_PHY_TURBO);
 	}
 
-	/* ...reset chipset and PCI device */
-	if (ah->ah_single_chip == false && ath5k_hw_nic_reset(ah,
-				AR5K_RESET_CTL_CHIP | AR5K_RESET_CTL_PCI)) {
+	/* ...reset chipset
+	 * Warning: reseting PCI on PCI-E cards results card to hang
+	 * and always return 0xffff...
+	 */
+	if (ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | AR5K_RESET_CTL_BASEBAND |
+				(ah->ah_pcie == false ? AR5K_RESET_CTL_PCI : 0) )) {
 		ATH5K_ERR(ah->ah_sc, "failed to reset the MAC Chip + PCI\n");
 		return -EIO;
 	}
@@ -900,13 +911,25 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
 
 	/*
 	 * Set Rx/Tx DMA Configuration
-	 *(passing dma size not available on 5210)
+	 * 
+	 * Set maximum DMA size (512) except for PCI-E cards since
+	 * it causes rx overruns and tx errors (tested on 5424 but since
+	 * rx overruns also occur on 5416/5418 with madwifi we set 128
+	 * for all PCI-E cards to be safe).
+	 *
+	 * In dumps this is 128 for allchips.
+	 *
+	 * XXX: need to check 5210 for this
+	 * TODO: Check out tx triger level, it's always 64 on dumps but i 
+	 * guess we can tweak it and see how it goes ;-)
 	 */
 	if (ah->ah_version != AR5K_AR5210) {
 		AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, AR5K_TXCFG_SDMAMR,
-				AR5K_DMASIZE_512B | AR5K_TXCFG_DMASIZE);
+				(ah->ah_pcie == true ?
+				AR5K_DMASIZE_128B : AR5K_DMASIZE_512B));
 		AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG, AR5K_RXCFG_SDMAMW,
-				AR5K_DMASIZE_512B);
+				(ah->ah_pcie == true ?
+				AR5K_DMASIZE_128B : AR5K_DMASIZE_512B));
 	}
 
 	/*
#1 lore raw

2008/2/24, Nick Kossifidis <[email protected]>:

Quoted 76 lines

* Fix nic_wakeup for PCI-E chips (don't set AR5K_RESET_CTL_PCI bit)

* Fix dma size setting for PCI-E chips (thanx to Bob Copeland).

Changes-licensed-under: ISC

---
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h index c0b6596..d8ec373 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h

 @@ -971,6 +971,7 @@ struct ath5k_hw {
        enum ath5k_version      ah_version;
        enum ath5k_radio        ah_radio;
        u32                     ah_phy;

+ bool ah_pcie;

        bool                    ah_5ghz;
        bool                    ah_2ghz;
 diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
 index 3ae5522..cd640ed 100644
 --- a/drivers/net/wireless/ath5k/hw.c
 +++ b/drivers/net/wireless/ath5k/hw.c
 @@ -214,6 +214,14 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
                ah->ah_single_chip = false;
        }
 +       /* Identify PCI-E cards */
 +       if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
 +       srev >= AR5K_SREV_VER_AR5416) {
 +               ah->ah_pcie = true;
 +       } else {
 +               ah->ah_pcie = false;
 +       }
 +
        /* Single chip radio */
        if (ah->ah_radio_2ghz_revision == ah->ah_radio_5ghz_revision)
                ah->ah_radio_2ghz_revision = 0;
 @@ -377,9 +385,12 @@ static int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
                                        AR5K_PHY_TURBO);
        }

- /* ...reset chipset and PCI device */
- if (ah->ah_single_chip == false && ath5k_hw_nic_reset(ah,
- AR5K_RESET_CTL_CHIP | AR5K_RESET_CTL_PCI)) {
+ /* ...reset chipset

 +        * Warning: reseting PCI on PCI-E cards results card to hang
 +        * and always return 0xffff...
 +        */
 +       if (ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | AR5K_RESET_CTL_BASEBAND |
 +                               (ah->ah_pcie == false ? AR5K_RESET_CTL_PCI : 0) )) {
                ATH5K_ERR(ah->ah_sc, "failed to reset the MAC Chip + PCI\n");
                return -EIO;
        }

@@ -900,13 +911,25 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,

/*
* Set Rx/Tx DMA Configuration

 -        *(passing dma size not available on 5210)
 +        *
 +        * Set maximum DMA size (512) except for PCI-E cards since
 +        * it causes rx overruns and tx errors (tested on 5424 but since
 +        * rx overruns also occur on 5416/5418 with madwifi we set 128
 +        * for all PCI-E cards to be safe).
 +        *
 +        * In dumps this is 128 for allchips.
 +        *
 +        * XXX: need to check 5210 for this
 +        * TODO: Check out tx triger level, it's always 64 on dumps but i
 +        * guess we can tweak it and see how it goes ;-)
         */
        if (ah->ah_version != AR5K_AR5210) {
                AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, AR5K_TXCFG_SDMAMR,
 -                               AR5K_DMASIZE_512B | AR5K_TXCFG_DMASIZE);
 +                               (ah->ah_pcie == true ?
Quoted 9 lines
 +                               AR5K_DMASIZE_128B : AR5K_DMASIZE_512B));
                AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG, AR5K_RXCFG_SDMAMW,
 -                               AR5K_DMASIZE_512B);
 +                               (ah->ah_pcie == true ?
 +                               AR5K_DMASIZE_128B : AR5K_DMASIZE_512B));
        }

        /*

Sorry, forgot to CC Bob...

Bob can you test this on your 5242 (together with the next patch) and see what happens ?

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#2 lore raw

2008/2/24, Nick Kossifidis <[email protected]>:

Quoted 85 lines

2008/2/24, Nick Kossifidis <[email protected]>:

Quoted 83 lines

* Fix nic_wakeup for PCI-E chips (don't set AR5K_RESET_CTL_PCI bit)

* Fix dma size setting for PCI-E chips (thanx to Bob Copeland).

Changes-licensed-under: ISC

---
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h index c0b6596..d8ec373 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h

 @@ -971,6 +971,7 @@ struct ath5k_hw {
        enum ath5k_version      ah_version;
        enum ath5k_radio        ah_radio;
        u32                     ah_phy;

+ bool ah_pcie;

        bool                    ah_5ghz;
        bool                    ah_2ghz;
 diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
 index 3ae5522..cd640ed 100644
 --- a/drivers/net/wireless/ath5k/hw.c
 +++ b/drivers/net/wireless/ath5k/hw.c
 @@ -214,6 +214,14 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
                ah->ah_single_chip = false;
        }
 +       /* Identify PCI-E cards */
 +       if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
 +       srev >= AR5K_SREV_VER_AR5416) {
 +               ah->ah_pcie = true;
 +       } else {
 +               ah->ah_pcie = false;
 +       }
 +
        /* Single chip radio */
        if (ah->ah_radio_2ghz_revision == ah->ah_radio_5ghz_revision)
                ah->ah_radio_2ghz_revision = 0;
 @@ -377,9 +385,12 @@ static int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
                                        AR5K_PHY_TURBO);
        }

- /* ...reset chipset and PCI device */
- if (ah->ah_single_chip == false && ath5k_hw_nic_reset(ah,
- AR5K_RESET_CTL_CHIP | AR5K_RESET_CTL_PCI)) {
+ /* ...reset chipset

 +        * Warning: reseting PCI on PCI-E cards results card to hang
 +        * and always return 0xffff...
 +        */
 +       if (ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | AR5K_RESET_CTL_BASEBAND |
 +                               (ah->ah_pcie == false ? AR5K_RESET_CTL_PCI : 0) )) {
                ATH5K_ERR(ah->ah_sc, "failed to reset the MAC Chip + PCI\n");
                return -EIO;
        }

@@ -900,13 +911,25 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,

/*
* Set Rx/Tx DMA Configuration

 -        *(passing dma size not available on 5210)
 +        *
 +        * Set maximum DMA size (512) except for PCI-E cards since
 +        * it causes rx overruns and tx errors (tested on 5424 but since
 +        * rx overruns also occur on 5416/5418 with madwifi we set 128
 +        * for all PCI-E cards to be safe).
 +        *
 +        * In dumps this is 128 for allchips.
 +        *
 +        * XXX: need to check 5210 for this
 +        * TODO: Check out tx triger level, it's always 64 on dumps but i
 +        * guess we can tweak it and see how it goes ;-)
         */
        if (ah->ah_version != AR5K_AR5210) {
                AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, AR5K_TXCFG_SDMAMR,
 -                               AR5K_DMASIZE_512B | AR5K_TXCFG_DMASIZE);
 +                               (ah->ah_pcie == true ?
 +                               AR5K_DMASIZE_128B : AR5K_DMASIZE_512B));
                AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG, AR5K_RXCFG_SDMAMW,
 -                               AR5K_DMASIZE_512B);
 +                               (ah->ah_pcie == true ?
 +                               AR5K_DMASIZE_128B : AR5K_DMASIZE_512B));
        }
Quoted 9 lines
Quoted 2 lines
        /*

Sorry, forgot to CC Bob...

Bob can you test this on your 5242 (together with the next patch) and see what happens ?

hmm i mean 5424, time for sleep :P

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#3 lore raw
In reply to Nick Kossifidis
Quoted 4 lines

Sorry, forgot to CC Bob...

Bob can you test this on your 5242 (together with the next patch) and see what happens ?

Yep, I'll give the patchset a spin today...

Signature · 1 line
Bob Copeland %% www.bobcopeland.com 
#4 lore raw
In reply to Nick Kossifidis
Quoted 7 lines · Nick Kossifidis
Quoted 7 lines
 +       /* Identify PCI-E cards */
 +       if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
 +       srev >= AR5K_SREV_VER_AR5416) {

+ ah->ah_pcie = true;
+ } else {
+ ah->ah_pcie = false;
+ }

This won't work, because reset is called before we ever set ah_pcie. Moving the set before the first call to wakeup (patch below) does the trick. Then it works at least as well as I had it working (still with random calibration failures, but I am again sending this mail using the driver).

Thanks!

Quoted 1 line

From f59b2bc93059e7f1bd504714ca22654f4242d78d Mon Sep 17 00:00:00 2001

From: Bob Copeland <[email protected]>
Date: Sun, 24 Feb 2008 10:30:50 -0500
Subject: [PATCH] Grab srev before resetting card.

Setting ah_pcie variable must be done before the first call to ath5k_hw_nic_wakeup.

---
 drivers/net/wireless/ath5k/hw.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/wireless/ath5k/hw.c +10 -10
index adcce6f..71cdbd9 100644
@@ -178,13 +178,21 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 	else if (ah->ah_version <= AR5K_AR5211)
 		ah->ah_proc_rx_desc = ath5k_hw_proc_old_rx_status;
 
+	/* Get MAC, PHY and RADIO revisions */
+	srev = ath5k_hw_reg_read(ah, AR5K_SREV);
+	/* Identify PCI-E cards */
+	if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
+	srev >= AR5K_SREV_VER_AR5416) {
+		ah->ah_pcie = true;
+	} else {
+		ah->ah_pcie = false;
+	}
+
 	/* Bring device out of sleep and reset it's units */
 	ret = ath5k_hw_nic_wakeup(ah, AR5K_INIT_MODE, true);
 	if (ret)
 		goto err_free;
 
-	/* Get MAC, PHY and RADIO revisions */
-	srev = ath5k_hw_reg_read(ah, AR5K_SREV);
 	ah->ah_mac_srev = srev;
 	ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
 	ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV);
@@ -214,14 +222,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 		ah->ah_single_chip = false;
 	}
 
-	/* Identify PCI-E cards */
-	if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
-	srev >= AR5K_SREV_VER_AR5416) {
-		ah->ah_pcie = true;
-	} else {
-		ah->ah_pcie = false;
-	}
-
 	/* Single chip radio */
 	if (ah->ah_radio_2ghz_revision == ah->ah_radio_5ghz_revision)
 		ah->ah_radio_2ghz_revision = 0;
Signature · 4 lines
1.5.4.2.182.gb3092

-- 
Bob Copeland %% www.bobcopeland.com 
#5 lore raw

2008/2/24, Bob Copeland <[email protected]>:

Quoted 70 lines · Nick Kossifidis
Quoted 7 lines
Quoted 7 lines
 +       /* Identify PCI-E cards */
 +       if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
 +       srev >= AR5K_SREV_VER_AR5416) {

+ ah->ah_pcie = true;
+ } else {
+ ah->ah_pcie = false;
+ }

This won't work, because reset is called before we ever set ah_pcie.
Moving the set before the first call to wakeup (patch below) does the trick. Then it works at least as well as I had it working (still with random calibration failures, but I am again sending this mail using the driver).

Thanks!

From f59b2bc93059e7f1bd504714ca22654f4242d78d Mon Sep 17 00:00:00 2001
From: Bob Copeland <[email protected]>
Date: Sun, 24 Feb 2008 10:30:50 -0500
Subject: [PATCH] Grab srev before resetting card.

Setting ah_pcie variable must be done before the first call to ath5k_hw_nic_wakeup.
---

  drivers/net/wireless/ath5k/hw.c |   20 ++++++++++----------
  1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c

index adcce6f..71cdbd9 100644

--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c

(quoted diff) +1 -0
@@ -178,13 +178,21 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
        else if (ah->ah_version <= AR5K_AR5211)
                ah->ah_proc_rx_desc = ath5k_hw_proc_old_rx_status;
 
 +       /* Get MAC, PHY and RADIO revisions */
 +       srev = ath5k_hw_reg_read(ah, AR5K_SREV);
 +       /* Identify PCI-E cards */
 
+       if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
 +       srev >= AR5K_SREV_VER_AR5416) {
 +               ah->ah_pcie = true;
 +       } else {
 +               ah->ah_pcie = false;
 +       }
 +
 
        /* Bring device out of sleep and reset it's units */
        ret = ath5k_hw_nic_wakeup(ah, AR5K_INIT_MODE, true);
        if (ret)
                goto err_free;
 
 -       /* Get MAC, PHY and RADIO revisions */
 -       srev = ath5k_hw_reg_read(ah, AR5K_SREV);
        ah->ah_mac_srev = srev;
        ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
        ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV);
 @@ -214,14 +222,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 
                ah->ah_single_chip = false;
        }
 
 -       /* Identify PCI-E cards */

Review struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)

Quoted 10 lines
(quoted diff) +0 -0
 -       if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
 -       srev >= AR5K_SREV_VER_AR5416) {
 -               ah->ah_pcie = true;
 -       } else {
 -               ah->ah_pcie = false;
 -       }
 -
        /* Single chip radio */
        if (ah->ah_radio_2ghz_revision == ah->ah_radio_5ghz_revision)
                ah->ah_radio_2ghz_revision = 0;

Thanx, just plz put a new line here ->

+ /* Get MAC, PHY and RADIO revisions */
+ srev = ath5k_hw_reg_read(ah, AR5K_SREV);
+
+ /* Identify PCI-E cards */
+ if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
+ srev >= AR5K_SREV_VER_AR5416) {
+ ah->ah_pcie = true;
+ } else {
+ ah->ah_pcie = false;
+ }
+

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
Tested-by
#6 lore raw
Quoted 8 lines · Nick Kossifidis

Thanx, just plz put a new line here ->

drivers/net/wireless/ath5k/hw.c +4 -0
+	/* Get MAC, PHY and RADIO revisions */
+	srev = ath5k_hw_reg_read(ah, AR5K_SREV);
+
+	/* Identify PCI-E cards */

Do you want me to respin and post the patch with the newline, or are you just going to roll it into your changes? I don't mind either way, but if you pick it up, feel free to add my:

Signature · 1 line
Bob Copeland %% www.bobcopeland.com 
#7 lore raw

2008/2/24, Bob Copeland <[email protected]>:

Quoted 9 lines · Nick Kossifidis
Quoted 6 lines

Thanx, just plz put a new line here ->

drivers/net/wireless/ath5k/hw.c +4 -0
+     /* Get MAC, PHY and RADIO revisions */
+     srev = ath5k_hw_reg_read(ah, AR5K_SREV);
+
+     /* Identify PCI-E cards */
Quoted 10 lines
Quoted 1 line

Do you want me to respin and post the patch with the newline, or
are you just going to roll it into your changes? I don't mind either way, but if you pick it up, feel free to add my:

Yup, can you post a patch on top of the series ? Also remove braces etc as Christoph said if you like (i prefer to keep the "else" there).

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#8 lore raw
In reply to Nick Kossifidis
Quoted 8 lines · Nick Kossifidis

2008/2/24, Bob Copeland <[email protected]>:

Quoted 5 lines · Nick Kossifidis
Quoted 4 lines
Quoted 4 lines
 +       /* Identify PCI-E cards */
 +       if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
 +       srev >= AR5K_SREV_VER_AR5416) {

+ ah->ah_pcie = true;

struct pci_dev now has member, "is_pcie" which could be used here I think instead. No need to add to ath5k_hw the ah_pcie then.

Luis

#9 lore raw

2008/2/27, Luis R. Rodriguez <[email protected]>:

Quoted 11 lines · Nick Kossifidis
Quoted 8 lines

2008/2/24, Bob Copeland <[email protected]>:

Quoted 5 lines · Nick Kossifidis
Quoted 4 lines
Quoted 4 lines
 +       /* Identify PCI-E cards */
 +       if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
 +       srev >= AR5K_SREV_VER_AR5416) {

+ ah->ah_pcie = true;

Quoted 6 lines

struct pci_dev now has member, "is_pcie" which could be used here I
think instead. No need to add to ath5k_hw the ah_pcie then.

Luis

What if there is a pci-e card in the future that needs _PCI bit ? I guess for now we can work on with srevs to be safe but it's good to know of that feature, thanx ;-)

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#10 lore raw
Quoted 14 lines · Nick Kossifidis

2008/2/27, Luis R. Rodriguez <[email protected]>:

Quoted 11 lines · Nick Kossifidis
Quoted 8 lines

2008/2/24, Bob Copeland <[email protected]>:

Quoted 5 lines · Nick Kossifidis
Quoted 4 lines
Quoted 4 lines
 +       /* Identify PCI-E cards */
 +       if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
 +       srev >= AR5K_SREV_VER_AR5416) {

+ ah->ah_pcie = true;

Quoted 8 lines
Quoted 6 lines

struct pci_dev now has member, "is_pcie" which could be used here I
think instead. No need to add to ath5k_hw the ah_pcie then.

Luis

What if there is a pci-e card in the future that needs _PCI bit ?

I don't follow, the member is for struct pci_dev so its either a pci or pci-express device. If you mean what if we later have some srev in the range that is not pci-e, well then we'd use srevs wouldn't we?

Quoted 2 lines

I guess for now we can work on with srevs to be safe but it's good to
know of that feature, thanx ;-)

The point is that if there is already a variable we can use to detect if a device is pci-e then we shouldn't introduce any other new ones.

Luis

#11 lore raw
Quoted 8 lines · Luis R. Rodriguez
Quoted 1 line · Nick Kossifidis

What if there is a pci-e card in the future that needs _PCI bit ?

I don't follow, the member is for struct pci_dev so its either a pci or pci-express device. If you mean what if we later have some srev in the range that is not pci-e, well then we'd use srevs wouldn't we?

Quoted 5 lines
Quoted 2 lines

I guess for now we can work on with srevs to be safe but it's good to
know of that feature, thanx ;-)

The point is that if there is already a variable we can use to detect if a device is pci-e then we shouldn't introduce any other new ones.

ACK for Luis's point.

Signature · 2 lines
John W. Linville
[email protected]
#12 lore raw

2008/2/27, John W. Linville <[email protected]>:

Quoted 10 lines · Luis R. Rodriguez
Quoted 9 lines · Nick Kossifidis
Quoted 3 lines

What if there is a pci-e card in the future that needs _PCI bit ?

I don't follow, the member is for struct pci_dev so its either a pci or pci-express device. If you mean what if we later have some srev in the range that is not pci-e, well then we'd use srevs wouldn't we?

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

I guess for now we can work on with srevs to be safe but it's good to
know of that feature, thanx ;-)

The point is that if there is already a variable we can use to detect if a device is pci-e then we shouldn't introduce any other new ones.

ACK for Luis's point.

Sorry for not being clear on my previous post...

We don't have access to pci_dev on nic_wakeup and other functions that is possible to need that info in the future, so having a local ah_pcie variable is more flexible. I don't think it's usefull to rewrite the whole thing so that these functions take pci_dev for argument. So "introducing a new variable" is not that bad IMHO.

Have in mind that there are also ar5k devices that are not attached an a pci or pci-e bus at all (ahb) that we want to support in the future. Right now hw_attach does not make use of any pci-related stuff, it only takes ath5k_softc for argument and mac_version and i intend to keep it that way to be abstract (when we start supporting WiSOC, we 'll only have to tweak base.c/base.h as in MadWiFi, not hw-related code and our code will be less noisy and easier to maintain).

The way i see it, if we make use of is_pcie we'll do it during pci_probe and pass a bool to hw_attach if it's pcie. This will save us from passing pci_dev directly to hw_attach that 'll create noise during ahb implementation (we 'll need to make an abstract dev structure for both pci/ahb to pass to hw_attach etc).

So all i'm saying is that i want to think about it a little more and i'll come up with a patch for it. What i also want to see is check traces from my 5418 card which is also pci-e and see if it sets _PCI bit, if it does current flag will have no meaning (eg. not setting _PCI bit wont be a property of pci-e cards but only of a specific srev-range) so i'll submit a patch that eg. renames ah_pcie to "ah_no_pcibit_durring_reset" or something like that.

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#13 lore raw
Quoted 20 lines · Nick Kossifidis

2008/2/27, John W. Linville <[email protected]>:

Quoted 17 lines · Luis R. Rodriguez
Quoted 14 lines · Nick Kossifidis
Quoted 3 lines

What if there is a pci-e card in the future that needs _PCI bit ?

I don't follow, the member is for struct pci_dev so its either a pci or pci-express device. If you mean what if we later have some srev in the range that is not pci-e, well then we'd use srevs wouldn't we?

Quoted 2 lines

I guess for now we can work on with srevs to be safe but it's good to
know of that feature, thanx ;-)

The point is that if there is already a variable we can use to detect if a device is pci-e then we shouldn't introduce any other new ones.

Quoted 8 lines
Quoted 3 lines

ACK for Luis's point.

Sorry for not being clear on my previous post...

We don't have access to pci_dev on nic_wakeup and other functions that is possible to need that info in the future,

Yes we do, I'll post a patch based on yours, it needs testing on PCI-E. Also noticed what may have been a typo on another patch, will comment on that one next. I'll just post my series based on yours.

Quoted 7 lines

Have in mind that there are also ar5k devices that are not attached an a pci or pci-e bus at all (ahb) that we want to support in the future. Right now hw_attach does not make use of any pci-related stuff, it only takes ath5k_softc for argument and mac_version and i intend to keep it that way to be abstract (when we start supporting WiSOC, we 'll only have to tweak base.c/base.h as in MadWiFi, not hw-related code and our code will be less noisy and easier to maintain).

We can take care of ahb when we get there.

Quoted 5 lines

The way i see it, if we make use of is_pcie we'll do it during pci_probe and pass a bool to hw_attach if it's pcie. This will save us from passing pci_dev directly to hw_attach that 'll create noise during ahb implementation (we 'll need to make an abstract dev structure for both pci/ahb to pass to hw_attach etc).

Its not that complicated, you'll see.

Quoted 7 lines

So all i'm saying is that i want to think about it a little more and i'll come up with a patch for it. What i also want to see is check traces from my 5418 card which is also pci-e and see if it sets _PCI bit, if it does current flag will have no meaning (eg. not setting _PCI bit wont be a property of pci-e cards but only of a specific srev-range) so i'll submit a patch that eg. renames ah_pcie to "ah_no_pcibit_durring_reset" or something like that.

Point taken, we can fix this if you find that.

Luis

#14 lore raw
In reply to Bob Copeland

2008/2/24, Bob Copeland <[email protected]>:

Quoted 3 lines

Then it works at least as well as I had it working (still with random calibration failures, but I am again sending this mail using the driver).

Some thoughts...

It seems we are doing calibration wrong, i'll check out the other chips as well to come up with something, until then can you check out how does your card perform on b rates (eg. 11Mbits). Do an iperf test and see what you get eg. for 5.5M and 11M, we might force b-only mode for these cards until we fix these issues (this would probably also make rate control work).

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#15 lore raw
Quoted 5 lines

Some thoughts...

It seems we are doing calibration wrong, i'll check out the other chips as well to come up with something, until then can you check out how does your card perform on b rates (eg. 11Mbits). Do an iperf test

Hey, that's a good clue... I just switched over to b-only and it seems to be much more stable. It may be a few days before I can do the iperf tests, gotta reconfigure my LAN somewhat.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com 
#16 lore raw

2008/2/25, Bob Copeland <[email protected]>:

Quoted 12 lines
Quoted 5 lines

Some thoughts...

It seems we are doing calibration wrong, i'll check out the other chips as well to come up with something, until then can you check out how does your card perform on b rates (eg. 11Mbits). Do an iperf test

Hey, that's a good clue... I just switched over to b-only and it seems to
be much more stable. It may be a few days before I can do the iperf tests, gotta reconfigure my LAN somewhat.

If i'm correct you should get 4-7Mbit/sec @ 11Mbit. Plz let me know if you have some results, meanwhile i'll try to figure out the i/q calibration algo (we are ok for noise floor calibration i believe).

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#17 lore raw
In reply to Nick Kossifidis
Quoted 4 lines · Nick Kossifidis

Sorry, forgot to CC Bob...

Bob can you test this on your 5242 (together with the next patch) and see what happens ?

Talking about unsupported chips. My MacBook Pro has a AR5418, do you guys need any kind of help for this chip, e.g. mmio traces?

#18 lore raw

2008/2/24, Christoph Hellwig <[email protected]>:

Quoted 11 lines · Nick Kossifidis
Quoted 5 lines

Sorry, forgot to CC Bob...

Bob can you test this on your 5242 (together with the next patch) and see what happens ?

Talking about unsupported chips. My MacBook Pro has a AR5418, do you
guys need any kind of help for this chip, e.g. mmio traces?

I've got a MacBook pro myself, we'll work on AR5416/8 sometime in the future but we have other things to fix first (e.g. AR5212/5213 + RF5111/5112/2112 can reach up to 27Mbit/s while 5413/2413 only go as far as 13Mbit/s with ath5k). Thanx for the offer, i'll keep you posted if we need anything ;-)

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#19 lore raw
In reply to Nick Kossifidis

drivers/net/wireless/ath5k/hw.c struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) · line 223

Quoted 6 lines · Nick Kossifidis
drivers/net/wireless/ath5k/hw.c +6 -0
+	if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
+	srev >= AR5K_SREV_VER_AR5416) {
+		ah->ah_pcie = true;
+	} else {
+		ah->ah_pcie = false;
+	}

Sorry for beeing nitpicky. but the indentation/spacing bracing here seems just too odd :)

This should be something like:

	if ((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
	    srev >= AR5K_SREV_VER_AR5416)
		ah->ah_pcie = true;
	else
		ah->ah_pcie = false;

or even better just leave the else clause out because ah has presumably been zeroed before.