Opened 14 years ago

Closed 13 years ago

#6686 closed enhancement (fixed)

Updating the atheroswifi driver to the FreeBSD HEAD svn rev 211330 (from 204100)

Reported by: jstressman Owned by: nobody
Priority: normal Milestone: R1
Component: Drivers/Network Version: R1/Development
Keywords: atheros Cc: jstressman@…
Blocked By: Blocking:
Platform: All

Description

DISCLAIMER: This absolutely needs review and additional work, but it compiles and works for me at least as well as the previous ath revision (minus the hard-locks so far).

It still has trouble thinking there are almost constant media changes which seem to reset the connection and basically cripple WebPositive after the first partial webpage load so that it won't work any further... but I can leave a running ping on Google.com that will go nonstop (for at least as long as I let it run... 20 minutes maybe?) without dropping any packets. So I'm not sure what the problem is. But that's a problem for another ticket.

Ported over the ath driver as of 211330 from FreeBSD-HEAD http://svn.freebsd.org/viewvc/base/head/sys/dev/ath/

This is svn diff'ed against Haiku hrev38867

This doesn't do anything about porting over the raw 211330 FBSD revision into the haiku/vendor tree either, so someone would need to take care of that as well.

I just wanted to try to alleviate my own hard lock problems and get ball rolling on updating to the latest fixes and thought I'd share. :)

Below are pretty much all the relevant changes between our last port of 204100 and the current 211330.

Please note http://svn.freebsd.org/viewvc/base?view=revision&sortby=date&revision=207472 where 2 other files are changed setting a specific define for certain circumstances that I didn't do anything with.

head/sys/dev/ath/ath_hal/ah_internal.h
head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
Revision 204521
Modified Mon Mar 1 17:04:19 2010 UTC (7 months ago) by rpaulo 
Properly setup the TX FIFO threshold for AR5416 based chipsets,
including the AR9285. This seems to fix some users's problems.




head/sys/dev/ath/ath_hal/ah_internal.h
head/sys/dev/ath/ath_hal/ar5212/ar5212.h
head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
Revision 204579
Modified Tue Mar 2 12:59:42 2010 UTC (7 months ago) by rpaulo 
Couple of suggestions from Sam regarding latest commit:
o rename the new variables to comply with the naming scheme
o move the new variables to an AR5212 specific struct
o use ahp when available
o revert to previous ts_flags check




/head/sys/dev/ath/ath_hal/ah_internal.h
Revision 204645
Modified Wed Mar 3 17:42:39 2010 UTC (6 months, 4 weeks ago) by rpaulo 
Introduce ath_hal_setInterrupts(), a macro for ah_setInterrupts().




/head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
Revision 206420
Modified Fri Apr 9 13:58:54 2010 UTC (5 months, 3 weeks ago) by rpaulo 
Setup the correct RX/TX chainmask when we play with the antenna
settings.




head/sys/dev/ath/ath_hal/ah.h
head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c
head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h
head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c
head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h
head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
Revision 208711
Modified Tue Jun 1 15:33:10 2010 UTC (4 months ago) by rpaulo 
Bring in a couple of fixes from the Linux ath9k related to chip hangs.
While there, try to make the register write pattern look like what's
done by ath9k.




/head/sys/dev/ath/ath_hal/ah_eeprom_v1.c
Revision 208642
Modified Sat May 29 16:10:07 2010 UTC (4 months ago) by rpaulo 
Don't shadow the global variable 'version'.


/head/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c
Revision 208643
Modified Sat May 29 16:11:51 2010 UTC (4 months ago) by rpaulo 
Due to the way HALDEBUG() is defined, we need to add curly brackets when
using it as a sole if clause instruction.


/head/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c
Revision 208644
Modified Sat May 29 16:14:02 2010 UTC (4 months ago) by rpaulo 
Due to the way HALDEBUG() is defined, we need to add curly brackets
when using it as a sole if clause instruction.
While there, fix 'const static' typo.




/head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c
Revision 208703
Modified Tue Jun 1 14:37:11 2010 UTC (4 months ago) by rpaulo 
Fix an off by one in ar9285SetPowerCalTable().


/head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c
Revision 208712
Modified Tue Jun 1 15:47:57 2010 UTC (4 months ago) by rpaulo 
Rewrite ar9285SetBoardValues() to match what ath9k does and fix out of
bounds reads.




/head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
Revision 209548
Modified Sun Jun 27 10:17:11 2010 UTC (3 months ago) by rpaulo 
Fix typo introduced in previous revision.


/head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
Revision 209541
Modified Sat Jun 26 20:59:10 2010 UTC (3 months ago) by rpaulo 
Fix the AR_SREV_MERLIN_20_OR_LATER() check.




/head/sys/dev/ath/ath_hal/ar5416/ar5416_cal_iq.c
Revision 211306
Modified Sat Aug 14 15:28:15 2010 UTC (6 weeks, 6 days ago) by adrian 
Fix the calibration logic to correctly clamp the calculated coefficient.
Obtained from:	OpenWRT r22123, 521-ath9k_iqcal_fix.patch


head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c
Revision 211307
Modified Sat Aug 14 15:29:21 2010 UTC (6 weeks, 6 days ago) by adrian 
Merge in a fix for the power/(gain?) calculation. Apply it to both
the 5416/9160 and 9285 code paths.
Obtained from:	OpenWRT r22123, 522-ath9k_pwrcal_fix.patch









/head/sys/dev/ath/ath_hal/ar5416/ar9160.ini
Revision 211309
Modified Sat Aug 14 15:48:18 2010 UTC (6 weeks, 6 days ago) by adrian 
A local addition, not imported from ath9k.
AR_PHY_CALMODE is explicitly reset on interface reset for other chipsets;
this commit also sets it for the AR9160.


Revision 211308
Modified Sat Aug 14 15:46:18 2010 UTC (6 weeks, 6 days ago) by adrian 
* Merge in AR9160 initval updates from Linux-2.6.34.
* Grab the AR_PHY_CCA and AR_PHY_EXT_CCA initvals from Linux wireless-testing.
Obtained from: Linux-2.6.34


Revision 206496
Modified Mon Apr 12 13:46:20 2010 UTC (5 months, 2 weeks ago) by rpaulo 
Remove svn:executable prop.




/head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
Revision 211330
Modified Sun Aug 15 11:40:53 2010 UTC (6 weeks, 5 days ago) by adrian 
Fix indenting/whitespace issues introduced by me.


Revision 211328
Modified Sun Aug 15 11:32:05 2010 UTC (6 weeks, 5 days ago) by adrian 
The comment is misleading - that register setting seems to kick off the
initial chip NF cal.


Revision 211214
Modified Thu Aug 12 08:39:54 2010 UTC (7 weeks, 1 day ago) by adrian 
* Fix indentation
* Restore comment erroneously deleted from the previous commit


Revision 211211
Modified Thu Aug 12 06:20:54 2010 UTC (7 weeks, 1 day ago) by adrian 
Loading the NF CCA values may take longer than expected to occur.
If it does, don't then try reprogramming the NF "cap" values (ie
what values are the "maximum" value the NF can be) - instead,
just leave the current CCA value as the NF cap.

This was inspired by some similar work from ath9k. It isn't
a 100% complete solution (as there may be some reason where a
high NF CCA/cap is written, causing the baseband to stop thinking it
is able to transmit, leading to stuck beacon and interface reset)
which I'll investigate and look at fixing in a later commit.
Obtained from:	Linux


Revision 211210
Modified Thu Aug 12 06:14:26 2010 UTC (7 weeks, 1 day ago) by adrian 
Use ar5212IsNFCalInProgress() to check for NF calibration progress.


Revision 211209
Modified Thu Aug 12 06:12:39 2010 UTC (7 weeks, 1 day ago) by adrian 
Fix indentation.


Revision 211208
Modified Thu Aug 12 06:11:44 2010 UTC (7 weeks, 1 day ago) by adrian 
Ensure that the correct rxchainmask is used when doing calibration in the
AR5416 and later chipsets.

ath_hal_calibrateN() calls the HAL calibrateN function with rxchainmask=0x1.
This is not necessarily the case for AR5416 and later chipsets.


Revision 211207
Modified Thu Aug 12 06:08:36 2010 UTC (7 weeks, 1 day ago) by adrian 
Internal NF calibration should not occur in parallel with any other
calibration. Ensure that the NF calibration completes before continuing
with the rest of the calibration setup process.





/head/sys/dev/ath/ath_hal/ah_internal.h
/head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
Revision 204645
Modified Wed Mar 3 17:42:39 2010 UTC (6 months, 4 weeks ago) by rpaulo
Introduce ath_hal_setInterrupts(), a macro for ah_setInterrupts().



/head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
Revision 207472
Modified Sat May 1 16:36:14 2010 UTC (5 months ago) by imp
The Atheros AR71xx CPUs, when paired with the AR5212 parts, has a bug
that generates a fatal bus trap.  Normally, the chips are setup to do
128 byte DMA bursts, but when on this CPU, they can only safely due
4-byte DMA bursts due to this bug.  Details of the exact nature of the
bug are sketchy, but some can be found at
https://forum.openwrt.org/viewtopic.php?pid=70060 on pages 4, 5 and 6.
There's a small performance penalty associated with this workaround,
so it is only enabled when needed on the Atheros AR71xx platforms.

Unfortunately, this condition is impossible to detect at runtime
without MIPS specific ifdefs.  Rather than cast an overly-broad net
like Linux/OpenWRT dues (which enables this workaround all the time on
MIPS32 platforms), we put this option in the kernel for just the
affected machines.  Sam didn't like this aspect of the patch when he
reviewed it, and I'd love to hear sane proposals on how to fix it :)

See also http://svn.freebsd.org/viewvc/base?view=revision&sortby=date&revision=207472 as there are other associated changes in:
/head/sys/conf/NOTES
/head/sys/conf/options



head/sys/dev/ath/ath_hal/ar5212/ar5212.h
head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
Revision 211206
Modified Thu Aug 12 06:06:14 2010 UTC (7 weeks, 1 day ago) by adrian
Add a couple of functions to check NF calibration progress / completion.

Attachments (1)

atheros-port-fbsd-r211330-to-haiku-r38867.diff (64.3 KB ) - added by jstressman 14 years ago.
Port of the atheroswifi drivers from FreeBSD-HEAD, revision 211330 (replacing the current 204100) to Haiku hrev38867 -- needs additional work.

Download all attachments as: .zip

Change History (5)

by jstressman, 14 years ago

Port of the atheroswifi drivers from FreeBSD-HEAD, revision 211330 (replacing the current 204100) to Haiku hrev38867 -- needs additional work.

comment:1 by jstressman, 14 years ago

See hrev35676 for what I mean about importing the raw driver source tree from FBSD-HEAD.

That was the initial import of the driver source into the vendor branch, hrev35747 was the actual port of the code into Haiku as a functional driver.

comment:2 by jstressman, 14 years ago

I should also mention, that there was one new change in the 211330 drive that I backed out when porting it...

I reverted the new change from IFQ_MAXLEN to ifqmaxlen (back to the original IFQ_MAXLEN) in order to get it to compile.

Other than that, I just duplicated the relevant changes from the original merge of 204100 for the 211330 drivers. I haven't done anything beyond that, hence the need for review etc. ;)

comment:3 by jstressman, 14 years ago

Looks like I forgot to include some of the changelog...

http://svn.freebsd.org/viewvc/base/head/sys/dev/ath/if_ath.c?view=log

That includes the changes to if_ath.c, which include the IFQ_MAXLEN -> ifqmaxlen change that I was referring to in my previous comment.

From fbsd revision 207554:

Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

The rest of the changes to if_ath.c are as follows:

/head/sys/dev/ath/if_ath.c

Revision 211303
Modified Sat Aug 14 14:18:02 2010 UTC (6 weeks, 6 days ago) by adrian 
Export ath stats via snmp, rather than requiring a debugging interface
and "athstats".


Revision 211136
Modified Tue Aug 10 07:56:56 2010 UTC (7 weeks, 3 days ago) by adrian 
Don't delay updating the longcal timer - instead, update the longcal
flag immediately so it's only set once per longcal interval.

Without this, the current AR5416 code will continuously spam NF
calibrations during a periodic calibration if the longcal flag
is set. The longcal flag wouldn't be cleared until the calibration
method indicates that calibrations are "complete".

This drops the rate of NF calibration updates down from "once every
shortcal" (ie, every 100ms) during a periodic calibration, to only
once per "longcal" interval. Spamming NF calibrations every 100ms
caused some potentially horrific issues in noisy environments as
NF calibrations can take longer than 100ms and this spamming can
cause invalid NF calibration results to be read back - leading to
missed beacons, and thus leading to a stuck beacon situation.

Stuck beacons cause interface resets, which restart calibrations.
This means that the longcal calibration runs every 100ms (shortcal)
until all initial calibrations are completed. This spamming can then
cause the above issues which leads to stuck beacons, leading to
interface resets, etc, etc. Quite annoying.


Revision 209799
Modified Thu Jul 8 14:08:03 2010 UTC (2 months, 3 weeks ago) by adrian 
Extend the ath debugging a little to log the interface name.

Some devices have >1 atheros card and the current debug prints
make it impossible to tell which interface is being unhappy.


Revision 209156
Modified Mon Jun 14 08:24:00 2010 UTC (3 months, 2 weeks ago) by bschmidt 
sc_lastrs is also used in case the sending station is not known, for
example in a split IBSS scenario. Therefore always assign sc_lastrs.
This removes a hack I committed in r206457.


Revision 206457
Modified Sat Apr 10 13:54:00 2010 UTC (5 months, 3 weeks ago) by bschmidt 
Add WPA-None support:
* WPA-None requires ap_scan=2:
  The major difference between ap_scan=1 (default) and 2 is, that no
  IEEE80211_IOC_SCAN* ioctls/functions are called, though, there is a
  dependency on those. For example the call to wpa_driver_bsd_scan()
  sets the interface UP, this never happens, therefore the interface
  must be marked up in wpa_driver_bsd_associate(). IEEE80211_IOC_SSID
  also is not called, which means that the SSID has not been set prior
  to the IEEE80211_MLME_ASSOC call.
* WPA-None has no support for sequence number updates, it doesn't make
  sense to check for replay violations..
* I had some crashes right after the switch to RUN state, issue is
  that sc->sc_lastrs was not yet defined.

Also missed listing the changes for http://svn.freebsd.org/viewvc/base?view=revision&revision=211299 which changed both if_ath.c and if_athioctl.h

/head/sys/dev/ath/if_ath.c
/head/sys/dev/ath/if_athioctl.h
Revision 211299
Modified Sat Aug 14 14:01:12 2010 UTC (6 weeks, 6 days ago) by adrian 
Add a global counter of missed beacons.

The existing missed beacon count is reset once a beacon isn't missed.

All of these changes are included in the patch (minus the "ifqmaxlen" one), I just forgot to include the change logs here. :) I think that's all of it now. ;)

comment:4 by korli, 13 years ago

Resolution: fixed
Status: newclosed

Updated to FreeBSD 9 in hrev43779.

Note: See TracTickets for help on using tickets.