svn commit: r227332 - in head/sys: amd64/conf i386/conf

2011-11-08 Thread Kevin Lo
Author: kevlo
Date: Tue Nov  8 08:29:05 2011
New Revision: 227332
URL: http://svn.freebsd.org/changeset/base/227332

Log:
  Enable PCI MMC/SD support by default on i386 and amd64

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/i386/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Tue Nov  8 04:00:24 2011(r227331)
+++ head/sys/amd64/conf/GENERIC Tue Nov  8 08:29:05 2011(r227332)
@@ -348,3 +348,8 @@ device  snd_hda # Intel High Definition
 device snd_ich # Intel, NVidia and other ICH AC'97 Audio
 device snd_uaudio  # USB Audio
 device snd_via8233 # VIA VT8233x Audio
+
+# MMC/SD
+device mmc # MMC/SD bus
+device mmcsd   # MMC/SD memory card
+device sdhci   # Generic PCI SD Host Controller

Modified: head/sys/i386/conf/GENERIC
==
--- head/sys/i386/conf/GENERIC  Tue Nov  8 04:00:24 2011(r227331)
+++ head/sys/i386/conf/GENERIC  Tue Nov  8 08:29:05 2011(r227332)
@@ -361,3 +361,8 @@ device  snd_hda # Intel High Definition
 device snd_ich # Intel, NVidia and other ICH AC'97 Audio
 device snd_uaudio  # USB Audio
 device snd_via8233 # VIA VT8233x Audio
+
+# MMC/SD
+device mmc # MMC/SD bus
+device mmcsd   # MMC/SD memory card
+device sdhci   # Generic PCI SD Host Controller
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227333 - in head: . sys/amd64/conf sys/arm/conf sys/conf sys/i386/conf sys/ia64/conf sys/kern sys/mips/conf sys/pc98/conf sys/powerpc/conf sys/sparc64/conf

2011-11-08 Thread Attilio Rao
Author: attilio
Date: Tue Nov  8 10:18:07 2011
New Revision: 227333
URL: http://svn.freebsd.org/changeset/base/227333

Log:
  Introduce the option VFS_ALLOW_NONMPSAFE and turn it on by default on
  all the architectures.
  The option allows to mount non-MPSAFE filesystem. Without it, the
  kernel will refuse to mount a non-MPSAFE filesytem.
  
  This patch is part of the effort of killing non-MPSAFE filesystems
  from the tree.
  
  No MFC is expected for this patch.
  
  Tested by:gianni
  Reviewed by:  kib

Modified:
  head/UPDATING
  head/sys/amd64/conf/DEFAULTS
  head/sys/arm/conf/DEFAULTS
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/i386/conf/DEFAULTS
  head/sys/ia64/conf/DEFAULTS
  head/sys/kern/vfs_mount.c
  head/sys/mips/conf/DEFAULTS
  head/sys/pc98/conf/DEFAULTS
  head/sys/powerpc/conf/DEFAULTS
  head/sys/sparc64/conf/DEFAULTS

Modified: head/UPDATING
==
--- head/UPDATING   Tue Nov  8 08:29:05 2011(r227332)
+++ head/UPDATING   Tue Nov  8 10:18:07 2011(r227333)
@@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
machines to maximize performance.  (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
 
+2008:
+   The option VFS_ALLOW_NONMPSAFE option has been added in order to
+   explicitely support non-MPSAFE filesystems.
+   It is on by default for all supported platform at this present
+   time.
+
 2001:
The broken amd(4) driver has been replaced with esp(4) in the amd64,
i386 and pc98 GENERIC kernel configuration files.

Modified: head/sys/amd64/conf/DEFAULTS
==
--- head/sys/amd64/conf/DEFAULTSTue Nov  8 08:29:05 2011
(r227332)
+++ head/sys/amd64/conf/DEFAULTSTue Nov  8 10:18:07 2011
(r227333)
@@ -22,3 +22,6 @@ options   GEOM_PART_EBR_COMPAT
 optionsGEOM_PART_MBR
 
 optionsNEW_PCIB
+
+# Allow mounting non-MPSAFE filesystems
+optionsVFS_ALLOW_NONMPSAFE

Modified: head/sys/arm/conf/DEFAULTS
==
--- head/sys/arm/conf/DEFAULTS  Tue Nov  8 08:29:05 2011(r227332)
+++ head/sys/arm/conf/DEFAULTS  Tue Nov  8 10:18:07 2011(r227333)
@@ -9,3 +9,5 @@ device  mem
 
 optionsGEOM_PART_BSD
 optionsGEOM_PART_MBR
+
+optionsVFS_ALLOW_NONMPSAFE

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Tue Nov  8 08:29:05 2011(r227332)
+++ head/sys/conf/NOTES Tue Nov  8 10:18:07 2011(r227333)
@@ -1104,6 +1104,9 @@ options   XFS
 # unsuitable for inclusion on machines with untrusted local users.
 optionsVFS_AIO
 
+# Enable mounting of non-MPSAFE filesystems.
+optionsVFS_ALLOW_NONMPSAFE
+
 # Cryptographically secure random number generator; /dev/random
 device random
 

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Tue Nov  8 08:29:05 2011(r227332)
+++ head/sys/conf/options   Tue Nov  8 10:18:07 2011(r227333)
@@ -185,6 +185,7 @@ SYSVSHM opt_sysvipc.h
 SW_WATCHDOGopt_watchdog.h
 TURNSTILE_PROFILING
 VFS_AIO
+VFS_ALLOW_NONMPSAFE
 VERBOSE_SYSINITopt_global.h
 WLCACHEopt_wavelan.h
 WLDEBUGopt_wavelan.h

Modified: head/sys/i386/conf/DEFAULTS
==
--- head/sys/i386/conf/DEFAULTS Tue Nov  8 08:29:05 2011(r227332)
+++ head/sys/i386/conf/DEFAULTS Tue Nov  8 10:18:07 2011(r227333)
@@ -30,3 +30,6 @@ options   NATIVE
 device atpic
 
 optionsNEW_PCIB
+
+# Allow mounting non-MPSAFE filesystems
+optionsVFS_ALLOW_NONMPSAFE

Modified: head/sys/ia64/conf/DEFAULTS
==
--- head/sys/ia64/conf/DEFAULTS Tue Nov  8 08:29:05 2011(r227332)
+++ head/sys/ia64/conf/DEFAULTS Tue Nov  8 10:18:07 2011(r227333)
@@ -20,3 +20,6 @@ options   GEOM_PART_GPT
 optionsGEOM_PART_MBR
 
 optionsNEW_PCIB
+
+# Allow mounting non-MPSAFE filesystems
+optionsVFS_ALLOW_NONMPSAFE

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Tue Nov  8 08:29:05 2011(r227332)
+++ head/sys/kern/vfs_mount.c   Tue Nov  8 10:18:07 2011(r227333)
@@ -37,6 +37,8 @@
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
+#include opt_vfs_allow_nonmpsafe.h
+
 #include sys/param.h
 #include sys/conf.h
 #include sys/fcntl.h
@@ -798,6 +800,14 @@ vfs_domount_first(
 * get.  No freeing of cn_pnbuf

Re: svn commit: r227310 - head/sys/fs/tmpfs

2011-11-08 Thread Gennady Proskurin
TMPFS is not usable without swap, it should have better algorithms to adjust
it's size, depending on amount of memory/swap available.

# swapoff -a
# swapinfo 
Device  1K-blocks UsedAvail Capacity

# top
Mem: 253M Active, 282M Inact, 933M Wired, 3972K Cache, 135M Buf, 491M Free
Swap: 

# df -h /tmp
FilesystemSizeUsed   Avail Capacity  Mounted on
tmpfs 436k436k  0B   100%/tmp

no free space on /tmp

# uname -a
FreeBSD gpr.drweb.com 9.0-BETA2 FreeBSD 9.0-BETA2 #0 r225446M: Thu Sep  8 
17:30:46 MSK 2011 
g...@gpr.drweb.com:/usr/obj/usr/src/freebsd-head/sys/DRW_A  amd64



On Mon, Nov 07, 2011 at 04:21:50PM +, Marcel Moolenaar wrote:
 Author: marcel
 Date: Mon Nov  7 16:21:50 2011
 New Revision: 227310
 URL: http://svn.freebsd.org/changeset/base/227310
 
 Log:
   Don astbestos garment and remove the warning about TMPFS being experimental
   -- highly experimental even. So far the closest to a bug in TMPFS that 
 people
   have gotten to relates to how ZFS can take away from the memory that TMPFS
   needs. One can argue that such is not a bug in TMPFS. Irrespective, even if
   there is a bug here and there in TMPFS, it's not in our own advantage to
   scare people away from using TMPFS. I for one have been using it, even with
   ZFS, very successfully.
 
 Modified:
   head/sys/fs/tmpfs/tmpfs_vfsops.c
 
 Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
 ==
 --- head/sys/fs/tmpfs/tmpfs_vfsops.c  Mon Nov  7 15:43:11 2011
 (r227309)
 +++ head/sys/fs/tmpfs/tmpfs_vfsops.c  Mon Nov  7 16:21:50 2011
 (r227310)
 @@ -156,9 +156,6 @@ tmpfs_mount(struct mount *mp)
   return EOPNOTSUPP;
   }
  
 - printf(WARNING: TMPFS is considered to be a highly experimental 
 - feature in FreeBSD.\n);
 -
   vn_lock(mp-mnt_vnodecovered, LK_SHARED | LK_RETRY);
   error = VOP_GETATTR(mp-mnt_vnodecovered, va, mp-mnt_cred);
   VOP_UNLOCK(mp-mnt_vnodecovered, 0);
 ___
 svn-src-head@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-head
 To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r227310 - head/sys/fs/tmpfs

2011-11-08 Thread Gleb Kurtsou
On (07/11/2011 12:01), Xin LI wrote:
 On Mon, Nov 7, 2011 at 8:21 AM, Marcel Moolenaar mar...@freebsd.org wrote:
  Author: marcel
  Date: Mon Nov  7 16:21:50 2011
  New Revision: 227310
  URL: http://svn.freebsd.org/changeset/base/227310
 
  Log:
   Don astbestos garment and remove the warning about TMPFS being experimental
   -- highly experimental even. So far the closest to a bug in TMPFS that 
  people
   have gotten to relates to how ZFS can take away from the memory that TMPFS
   needs. One can argue that such is not a bug in TMPFS. Irrespective, even if
   there is a bug here and there in TMPFS, it's not in our own advantage to
   scare people away from using TMPFS. I for one have been using it, even with
   ZFS, very successfully.
 
 Was the data corruption issue when mixing mmap/sendfile/read/writes
 fixed already?  I haven't used tmpfs in such complicated environment
 in my use (which works well) but I remember some complains about it...
Sendfile was fixed quite a while ago.

Regarding ZFS+TMPFS, there is a patch floating around changing TMPFS
assumptions on free memory. I'm thinking about making it optional,
preserving old behaviour if file system size wasn't specified during
mount.

I'll commit the following fix shortly:
https://github.com/glk/freebsd-head/commit/15186db

A bug on removing parent directory while holding reference to current
one was mentioned at DevSummit. I wasn't able to reproduce it on
CURRENT. I might have fixed it already while correcting similar locking
issue.

And it would be nice to have patch by kib@ removing double caching 
in head.


 
 Cheers,
 -- 
 Xin LI delp...@delphij.net https://www.delphij.net/
 FreeBSD - The Power to Serve! Live free or die
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227335 - head/usr.bin/du

2011-11-08 Thread Ed Schouten
Author: ed
Date: Tue Nov  8 11:36:46 2011
New Revision: 227335
URL: http://svn.freebsd.org/changeset/base/227335

Log:
  Simplify getopt switch parsing.
  
  Only one of these flags can be set. Just add them together and check the
  value. Also, get rid of the listall variable. The code is already filled
  with direct *flag-comparisons.
  
  Obtained from:Alexander Best (though modified)

Modified:
  head/usr.bin/du/du.c

Modified: head/usr.bin/du/du.c
==
--- head/usr.bin/du/du.cTue Nov  8 11:08:40 2011(r227334)
+++ head/usr.bin/du/du.cTue Nov  8 11:36:46 2011(r227335)
@@ -88,7 +88,6 @@ main(int argc, char *argv[])
off_t   savednumber, curblocks;
off_t   threshold, threshold_sign;
int ftsoptions;
-   int listall;
int depth;
int Hflag, Lflag, Pflag, aflag, sflag, dflag, cflag;
int hflag, lflag, ch, notused, rval;
@@ -229,17 +228,10 @@ main(int argc, char *argv[])
if (!Aflag  (cblocksize % DEV_BSIZE) != 0)
cblocksize = howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE;
 
-   listall = 0;
-
-   if (aflag) {
-   if (sflag || dflag)
-   usage();
-   listall = 1;
-   } else if (sflag) {
-   if (dflag)
-   usage();
+   if (aflag + dflag + sflag  1)
+   usage();
+   if (sflag)
depth = 0;
-   }
 
if (!*argv) {
argv = save;
@@ -320,7 +312,7 @@ main(int argc, char *argv[])
howmany(p-fts_statp-st_size, cblocksize) :
howmany(p-fts_statp-st_blocks, cblocksize);
 
-   if (listall || p-fts_level == 0) {
+   if (aflag || p-fts_level == 0) {
if (hflag) {
prthumanval(curblocks);
(void)printf(\t%s\n, p-fts_path);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227338 - head/sys/net80211

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 14:28:33 2011
New Revision: 227338
URL: http://svn.freebsd.org/changeset/base/227338

Log:
  Reject frames in STA mode which are not destined to the local STA address.
  
  Some hardware (eg the AR9160 in STA mode) seems to leak unicast FROMDS
  frames which aren't destined to itself. This angers the net80211 stack -
  the existing code would fail to find an address in the node table and try
  passing the frame up to each vap BSS. It would then be accepted in the
  input routine and its contents would update the local crypto and sequence
  number state.
  
  If the sequence number / crypto IV replay counters from the leaked frame
  were greater than the real state, subsequent real frames would be
  rejected due to out of sequence / IV replay conditions.
  
  This is also likely helpful if/when multi-STA modes are added to net80211.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/net80211/ieee80211_sta.c

Modified: head/sys/net80211/ieee80211_sta.c
==
--- head/sys/net80211/ieee80211_sta.c   Tue Nov  8 14:24:33 2011
(r227337)
+++ head/sys/net80211/ieee80211_sta.c   Tue Nov  8 14:28:33 2011
(r227338)
@@ -584,6 +584,30 @@ sta_input(struct ieee80211_node *ni, str
vap-iv_stats.is_rx_wrongbss++;
goto out;
}
+
+   /*
+* Some devices may be in a promiscuous mode
+* where they receive frames for multiple station
+* addresses.
+*
+* If we receive a data frame that isn't
+* destined to our VAP MAC, drop it.
+*
+* XXX TODO: This is only enforced when not scanning;
+* XXX it assumes a software-driven scan will put the NIC
+* XXX into a no data frames mode before setting this
+* XXX flag. Otherwise it may be possible that we'll still
+* XXX process data frames whilst scanning.
+*/
+   if ((! IEEE80211_IS_MULTICAST(wh-i_addr1))
+(! IEEE80211_ADDR_EQ(wh-i_addr1, IF_LLADDR(ifp {
+   IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
+   bssid, NULL, not to cur sta: lladdr=%6D, 
addr1=%6D,
+   IF_LLADDR(ifp), :, wh-i_addr1, :);
+   vap-iv_stats.is_rx_wrongbss++;
+   goto out;
+   }
+
IEEE80211_RSSI_LPF(ni-ni_avgrssi, rssi);
ni-ni_noise = nf;
if (HAS_SEQ(type)  !IEEE80211_IS_MULTICAST(wh-i_addr1)) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227339 - head/sys/net80211

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 14:34:01 2011
New Revision: 227339
URL: http://svn.freebsd.org/changeset/base/227339

Log:
  .. add missing include from an incorrect merge.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/net80211/ieee80211_sta.c

Modified: head/sys/net80211/ieee80211_sta.c
==
--- head/sys/net80211/ieee80211_sta.c   Tue Nov  8 14:28:33 2011
(r227338)
+++ head/sys/net80211/ieee80211_sta.c   Tue Nov  8 14:34:01 2011
(r227339)
@@ -50,6 +50,8 @@ __FBSDID($FreeBSD$);
 #include net/if.h
 #include net/if_media.h
 #include net/if_llc.h
+#include net/if_dl.h
+#include net/if_var.h
 #include net/ethernet.h
 
 #include net/bpf.h
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227340 - head/sys/dev/ath/ath_rate/sample

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 14:46:03 2011
New Revision: 227340
URL: http://svn.freebsd.org/changeset/base/227340

Log:
  Some cosmetic fixes to ath_rate_sample.
  
  * Use 64 bit integer types for the sample rate statistics.
When TX'ing 11n aggregates, a 32 bit counter will overflow in a few
hours due to the high packet throughput.
  
  * Create a default label of  rather than defaulting to Mb - that way
if a rate hasn't yet been selected, it won't say -1 Mb.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c
  head/sys/dev/ath/ath_rate/sample/sample.h

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Tue Nov  8 14:34:01 2011
(r227339)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Tue Nov  8 14:46:03 2011
(r227340)
@@ -43,6 +43,7 @@ __FBSDID($FreeBSD$);
  */
 #include opt_inet.h
 #include opt_wlan.h
+#include opt_ah.h
 
 #include sys/param.h
 #include sys/systm.h 
@@ -146,6 +147,8 @@ ath_rate_node_cleanup(struct ath_softc *
 static int
 dot11rate(const HAL_RATE_TABLE *rt, int rix)
 {
+   if (rix  0)
+   return -1;
return rt-info[rix].phy == IEEE80211_T_HT ?
rt-info[rix].dot11Rate : (rt-info[rix].dot11Rate  
IEEE80211_RATE_VAL) / 2;
 }
@@ -153,6 +156,8 @@ dot11rate(const HAL_RATE_TABLE *rt, int 
 static const char *
 dot11rate_label(const HAL_RATE_TABLE *rt, int rix)
 {
+   if (rix  0)
+   return ;
return rt-info[rix].phy == IEEE80211_T_HT ? MCS : Mb ;
 }
 
@@ -903,13 +908,14 @@ sample_stats(void *arg, struct ieee80211
for (y = 0; y  NUM_PACKET_SIZE_BINS; y++) {
if (sn-stats[y][rix].total_packets == 0)
continue;
-   printf([%2u %s:%4u] %8d:%-8d (%3d%%) T %8d F %4d avg 
%5u last %u\n,
+   printf([%2u %s:%4u] %8ju:%-8ju (%3d%%) T %8ju F %4d 
avg %5u last %u\n,
dot11rate(rt, rix), dot11rate_label(rt, rix),
bin_to_size(y),
-   sn-stats[y][rix].total_packets,
-   sn-stats[y][rix].packets_acked,
-   
(100*sn-stats[y][rix].packets_acked)/sn-stats[y][rix].total_packets,
-   sn-stats[y][rix].tries,
+   (uintmax_t) sn-stats[y][rix].total_packets,
+   (uintmax_t) sn-stats[y][rix].packets_acked,
+   (int) ((sn-stats[y][rix].packets_acked * 100ULL) /
+sn-stats[y][rix].total_packets),
+   (uintmax_t) sn-stats[y][rix].tries,
sn-stats[y][rix].successive_failures,
sn-stats[y][rix].average_tx_time,
ticks - sn-stats[y][rix].last_tx);

Modified: head/sys/dev/ath/ath_rate/sample/sample.h
==
--- head/sys/dev/ath/ath_rate/sample/sample.h   Tue Nov  8 14:34:01 2011
(r227339)
+++ head/sys/dev/ath/ath_rate/sample/sample.h   Tue Nov  8 14:46:03 2011
(r227340)
@@ -57,9 +57,9 @@ struct sample_softc {
 struct rate_stats {
unsigned average_tx_time;
int successive_failures;
-   int tries;
-   int total_packets;
-   int packets_acked;
+   uint64_t tries;
+   uint64_t total_packets; /* pkts total since assoc */
+   uint64_t packets_acked; /* pkts acked since assoc */
unsigned perfect_tx_time; /* transmit time for 0 retries */
int last_tx;
 };
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227341 - head/sys/sys

2011-11-08 Thread John Baldwin
Author: jhb
Date: Tue Nov  8 14:47:28 2011
New Revision: 227341
URL: http://svn.freebsd.org/changeset/base/227341

Log:
  Claim that _POSIX_ADVISORY_INFO is fully supported since posix_fadvise()
  was added.
  
  Submitted by: avilla
  Discussed with:   wollman

Modified:
  head/sys/sys/unistd.h

Modified: head/sys/sys/unistd.h
==
--- head/sys/sys/unistd.h   Tue Nov  8 14:46:03 2011(r227340)
+++ head/sys/sys/unistd.h   Tue Nov  8 14:47:28 2011(r227341)
@@ -49,7 +49,7 @@
  * the POSIX standard; however, if the relevant sysconf() function
  * returns -1, the functions may be stubbed out.
  */
-#define_POSIX_ADVISORY_INFO-1
+#define_POSIX_ADVISORY_INFO200112L
 #define_POSIX_ASYNCHRONOUS_IO  0
 #define_POSIX_CHOWN_RESTRICTED 1
 #define_POSIX_CLOCK_SELECTION  -1
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227342 - head/sys/kern

2011-11-08 Thread Ryan Stone
Author: rstone
Date: Tue Nov  8 15:17:54 2011
New Revision: 227342
URL: http://svn.freebsd.org/changeset/base/227342

Log:
  The in-kernel CTF parser caches the result of its first attempt to parse
  CTF data from a module.  On subsequent attempts to retrieve CTF data for
  a module, return an error if there no CTF data.
  
  This fixes a panic if you try to enable fbt probes on a module with CTF
  data twice.
  
  Submitted by: Paul Ambrose (ambrosehua AT gmail DOT com)
  MFC after:3 days

Modified:
  head/sys/kern/kern_ctf.c

Modified: head/sys/kern/kern_ctf.c
==
--- head/sys/kern/kern_ctf.cTue Nov  8 14:47:28 2011(r227341)
+++ head/sys/kern/kern_ctf.cTue Nov  8 15:17:54 2011(r227342)
@@ -90,7 +90,7 @@ link_elf_ctf_get(linker_file_t lf, linke
 * ctfcnt to -1. See below.
 */
if (ef-ctfcnt  0)
-   return (0);
+   return (EFTYPE);
 
/* Now check if we've already loaded the CTF data.. */
if (ef-ctfcnt  0) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227343 - in head/sys: kern sys tools

2011-11-08 Thread Ed Schouten
Author: ed
Date: Tue Nov  8 15:38:21 2011
New Revision: 227343
URL: http://svn.freebsd.org/changeset/base/227343

Log:
  Make kobj_methods constant.
  
  These structures hold no information that is modified during runtime. By
  marking this constant, we see approximately 600 symbols become
  read-only (amd64 GENERIC). While there, also mark the kobj_method
  structures generated by makeobjops.awk static. They are only referenced
  by the kobjop_desc structures within the same file.
  
  Before:
  
$ ls -l kernel
-rwxr-xr-x  1 ed  wheel  15937309 Nov  8 16:29 kernel*
$ size kernel
textdata bss  dechex filename
12260854 1358468 2848832 16468154 fb48ba kernel
$ nm kernel | fgrep -c ' r '
8240
  
  After:
  
$ ls -l kernel
-rwxr-xr-x  1 ed  wheel  15922469 Nov  8 16:25 kernel*
$ size kernel
textdata bss  dechex filename
12302869 1302660 2848704 16454233 fb1259 kernel
$ nm kernel | fgrep -c ' r '
8838

Modified:
  head/sys/kern/subr_kobj.c
  head/sys/sys/kobj.h
  head/sys/tools/makeobjops.awk

Modified: head/sys/kern/subr_kobj.c
==
--- head/sys/kern/subr_kobj.c   Tue Nov  8 15:17:54 2011(r227342)
+++ head/sys/kern/subr_kobj.c   Tue Nov  8 15:38:21 2011(r227343)
@@ -92,7 +92,7 @@ SYSINIT(kobj, SI_SUB_LOCK, SI_ORDER_ANY,
  * desc pointer is NULL, it is guaranteed never to match any read
  * descriptors.
  */
-static struct kobj_method null_method = {
+static const struct kobj_method null_method = {
0, 0,
 };
 

Modified: head/sys/sys/kobj.h
==
--- head/sys/sys/kobj.h Tue Nov  8 15:17:54 2011(r227342)
+++ head/sys/sys/kobj.h Tue Nov  8 15:38:21 2011(r227343)
@@ -34,7 +34,7 @@
  */
 typedef struct kobj*kobj_t;
 typedef struct kobj_class  *kobj_class_t;
-typedef struct kobj_method kobj_method_t;
+typedef const struct kobj_method kobj_method_t;
 typedef int(*kobjop_t)(void);
 typedef struct kobj_ops*kobj_ops_t;
 typedef struct kobjop_desc *kobjop_desc_t;

Modified: head/sys/tools/makeobjops.awk
==
--- head/sys/tools/makeobjops.awk   Tue Nov  8 15:17:54 2011
(r227342)
+++ head/sys/tools/makeobjops.awk   Tue Nov  8 15:38:21 2011
(r227343)
@@ -307,7 +307,7 @@ function handle_method (static, doc)
line_width, length(prototype)));
 
# Print out the method desc
-   printc(struct kobj_method  mname _method_default = {);
+   printc(static const struct kobj_method  mname _method_default = {);
printc(\t mname _desc, (kobjop_t)  default_function);
printc(};\n);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r227310 - head/sys/fs/tmpfs

2011-11-08 Thread Marcel Moolenaar

On Nov 8, 2011, at 2:26 AM, Gennady Proskurin wrote:

 TMPFS is not usable without swap, it should have better algorithms to adjust
 it's size, depending on amount of memory/swap available.
 
 # swapoff -a
 # swapinfo 
 Device  1K-blocks UsedAvail Capacity
 
 # top
 Mem: 253M Active, 282M Inact, 933M Wired, 3972K Cache, 135M Buf, 491M Free
 Swap: 
 
 # df -h /tmp
 FilesystemSizeUsed   Avail Capacity  Mounted on
 tmpfs 436k436k  0B   100%/tmp
 
 no free space on /tmp
 
 # uname -a
 FreeBSD gpr.drweb.com 9.0-BETA2 FreeBSD 9.0-BETA2 #0 r225446M: Thu Sep  8 
 17:30:46 MSK 2011 
 g...@gpr.drweb.com:/usr/obj/usr/src/freebsd-head/sys/DRW_A  amd64


Thanks, for the report. Can you file a PR so that we can
track this.

Thanks!

-- 
Marcel Moolenaar
mar...@xcllnt.net


___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227344 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 17:08:12 2011
New Revision: 227344
URL: http://svn.freebsd.org/changeset/base/227344

Log:
  Migrate the STAILQ lists to TAILQs.
  
  A bunch of the 11n TX aggregation logic wants to traverse lists of buffers
  in various ways. In order to provide O(1) behaviour in this instance,
  use TAILQs.
  
  This does blow out the memory footprint and CPU cycles slightly for some
  of these operations. I may convert some of these back to STAILQs once
  the rest of the software transmit queue handling has been stabilised.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_sysctl.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 15:38:21 2011(r227343)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 17:08:12 2011(r227344)
@@ -263,7 +263,7 @@ static  int ath_bstuck_threshold = 4;   /*
 SYSCTL_INT(_hw_ath, OID_AUTO, bstuck, CTLFLAG_RW, ath_bstuck_threshold,
0, max missed beacon xmits before chip reset);
 
-static MALLOC_DEFINE(M_ATHDEV, athdev, ath driver dma buffers);
+MALLOC_DEFINE(M_ATHDEV, athdev, ath driver dma buffers);
 
 #defineHAL_MODE_HT20 (HAL_MODE_11NG_HT20 | HAL_MODE_11NA_HT20)
 #defineHAL_MODE_HT40 \
@@ -952,7 +952,7 @@ ath_vap_create(struct ieee80211com *ic,
/*
 * Check that a beacon buffer is available; the code below assumes it.
 */
-   if (needbeacon  STAILQ_EMPTY(sc-sc_bbuf)) {
+   if (needbeacon  TAILQ_EMPTY(sc-sc_bbuf)) {
device_printf(sc-sc_dev, no beacon buffer available\n);
goto bad;
}
@@ -1014,8 +1014,8 @@ ath_vap_create(struct ieee80211com *ic,
 * multicast frames.  We know a beacon buffer is
 * available because we checked above.
 */
-   avp-av_bcbuf = STAILQ_FIRST(sc-sc_bbuf);
-   STAILQ_REMOVE_HEAD(sc-sc_bbuf, bf_list);
+   avp-av_bcbuf = TAILQ_FIRST(sc-sc_bbuf);
+   TAILQ_REMOVE(sc-sc_bbuf, avp-av_bcbuf, bf_list);
if (opmode != IEEE80211_M_IBSS || !sc-sc_hasveol) {
/*
 * Assign the vap to a beacon xmit slot.  As above
@@ -1796,14 +1796,14 @@ _ath_getbuf_locked(struct ath_softc *sc)
 
ATH_TXBUF_LOCK_ASSERT(sc);
 
-   bf = STAILQ_FIRST(sc-sc_txbuf);
+   bf = TAILQ_FIRST(sc-sc_txbuf);
if (bf != NULL  (bf-bf_flags  ATH_BUF_BUSY) == 0)
-   STAILQ_REMOVE_HEAD(sc-sc_txbuf, bf_list);
+   TAILQ_REMOVE(sc-sc_txbuf, bf, bf_list);
else
bf = NULL;
if (bf == NULL) {
DPRINTF(sc, ATH_DEBUG_XMIT, %s: %s\n, __func__,
-   STAILQ_FIRST(sc-sc_txbuf) == NULL ?
+   TAILQ_FIRST(sc-sc_txbuf) == NULL ?
out of xmit buffers : xmit buffer busy);
}
return bf;
@@ -1849,7 +1849,7 @@ ath_start(struct ifnet *ifp)
IFQ_DEQUEUE(ifp-if_snd, m);
if (m == NULL) {
ATH_TXBUF_LOCK(sc);
-   STAILQ_INSERT_HEAD(sc-sc_txbuf, bf, bf_list);
+   TAILQ_INSERT_HEAD(sc-sc_txbuf, bf, bf_list);
ATH_TXBUF_UNLOCK(sc);
break;
}
@@ -1860,7 +1860,7 @@ ath_start(struct ifnet *ifp)
 * buffers to send all the fragments so all
 * go out or none...
 */
-   STAILQ_INIT(frags);
+   TAILQ_INIT(frags);
if ((m-m_flags  M_FRAG) 
!ath_txfrag_setup(sc, frags, m, ni)) {
DPRINTF(sc, ATH_DEBUG_XMIT,
@@ -1892,7 +1892,7 @@ ath_start(struct ifnet *ifp)
bf-bf_m = NULL;
bf-bf_node = NULL;
ATH_TXBUF_LOCK(sc);
-   STAILQ_INSERT_HEAD(sc-sc_txbuf, bf, bf_list);
+   TAILQ_INSERT_HEAD(sc-sc_txbuf, bf, bf_list);
ath_txfrag_cleanup(sc, frags, ni);
ATH_TXBUF_UNLOCK(sc);
if (ni != NULL)
@@ -1913,9 +1913,9 @@ ath_start(struct ifnet *ifp)
goto reclaim;
}
m = next;
-   bf = STAILQ_FIRST(frags);
+   bf = TAILQ_FIRST(frags);
KASSERT(bf != NULL, (no buf for txfrag));
-   STAILQ_REMOVE_HEAD(frags, bf_list);
+   TAILQ_REMOVE(frags, bf, bf_list);
goto nextfrag;
}
 
@@ -2414,7 +2414,7 @@ ath_beacon_update(struct ieee80211vap *v
 static void
 ath_txqmove(struct ath_txq *dst, struct ath_txq *src)
 {
-   

svn commit: r227345 - in head/tools/tools/netrate: netblast netreceive netsend

2011-11-08 Thread Olivier Houchard
Author: cognet
Date: Tue Nov  8 17:23:43 2011
New Revision: 227345
URL: http://svn.freebsd.org/changeset/base/227345

Log:
  Add IPv6 support to netblast/netsend/netreceive
  
  PR:   bin/161368
  Submitted by: Olivier Cochard-Labbe olivier AT cochard doT me

Modified:
  head/tools/tools/netrate/netblast/netblast.c
  head/tools/tools/netrate/netreceive/netreceive.c
  head/tools/tools/netrate/netsend/netsend.c

Modified: head/tools/tools/netrate/netblast/netblast.c
==
--- head/tools/tools/netrate/netblast/netblast.cTue Nov  8 17:08:12 
2011(r227344)
+++ head/tools/tools/netrate/netblast/netblast.cTue Nov  8 17:23:43 
2011(r227345)
@@ -32,13 +32,13 @@
 #include sys/time.h
 
 #include netinet/in.h
-
-#include arpa/inet.h
+#include netdb.h /* getaddrinfo */
 
 #include signal.h
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include unistd.h/* close */
 
 static void
 usage(void)
@@ -141,26 +141,25 @@ blast_loop(int s, long duration, u_char 
 int
 main(int argc, char *argv[])
 {
-   long payloadsize, port, duration;
-   struct sockaddr_in sin;
+   long payloadsize, duration;
+   struct addrinfo hints, *res, *res0;
char *dummy, *packet;
-   int s;
+   int port, s, error;
+   const char *cause = NULL;
 
if (argc != 5)
usage();
 
-   bzero(sin, sizeof(sin));
-   sin.sin_len = sizeof(sin);
-   sin.sin_family = AF_INET;
-   if (inet_aton(argv[1], sin.sin_addr) == 0) {
-   perror(argv[1]);
-   return (-1);
-   }
+   memset(hints, 0, sizeof(hints));
+   hints.ai_family = PF_UNSPEC;
+   hints.ai_socktype = SOCK_DGRAM;
 
port = strtoul(argv[2], dummy, 10);
-   if (port  1 || port  65535 || *dummy != '\0')
+   if (port  1 || port  65535 || *dummy != '\0') {
+   fprintf(stderr, Invalid port number: %s\n, argv[2]);
usage();
-   sin.sin_port = htons(port);
+   /*NOTREACHED*/
+   }
 
payloadsize = strtoul(argv[3], dummy, 10);
if (payloadsize  0 || *dummy != '\0')
@@ -168,29 +167,55 @@ main(int argc, char *argv[])
if (payloadsize  32768) {
fprintf(stderr, payloadsize  32768\n);
return (-1);
+   /*NOTREACHED*/
}
 
duration = strtoul(argv[4], dummy, 10);
-   if (duration  0 || *dummy != '\0')
+   if (duration  0 || *dummy != '\0') {
+   fprintf(stderr, Invalid duration time: %s\n, argv[4]);
usage();
+   /*NOTREACHED*/
+   }
 
packet = malloc(payloadsize);
if (packet == NULL) {
perror(malloc);
return (-1);
+   /*NOTREACHED*/
}
+
bzero(packet, payloadsize);
+   error = getaddrinfo(argv[1],argv[2], hints, res0);
+   if (error) {
+   perror(gai_strerror(error));
+   return (-1);
+   /*NOTREACHED*/
+   }
+   s = -1;
+   for (res = res0; res; res = res-ai_next) {
+   s = socket(res-ai_family, res-ai_socktype, 0);
+   if (s  0) {
+   cause = socket;
+   continue;
+   }
 
-   s = socket(PF_INET, SOCK_DGRAM, 0);
-   if (s == -1) {
-   perror(socket);
-   return (-1);
-   }
+   if (connect(s, res-ai_addr, res-ai_addrlen)  0) {
+   cause = connect;
+   close(s);
+   s = -1;
+   continue;
+   }
 
-   if (connect(s, (struct sockaddr *)sin, sizeof(sin))  0) {
-   perror(connect);
+   break;  /* okay we got one */
+   }
+   if (s  0) {
+   perror(cause);
return (-1);
+   /*NOTREACHED*/
}
 
+   freeaddrinfo(res0);
+
return (blast_loop(s, duration, packet, payloadsize));
+
 }

Modified: head/tools/tools/netrate/netreceive/netreceive.c
==
--- head/tools/tools/netrate/netreceive/netreceive.cTue Nov  8 17:08:12 
2011(r227344)
+++ head/tools/tools/netrate/netreceive/netreceive.cTue Nov  8 17:23:43 
2011(r227345)
@@ -29,14 +29,19 @@
 #include sys/types.h
 #include sys/socket.h
 #include sys/time.h
+#include sys/poll.h
 
 #include netinet/in.h
+#include netdb.h  /* getaddrinfo */
 
 #include arpa/inet.h
 
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include unistd.h /* close */
+
+#define MAXSOCK 20
 
 static void
 usage(void)
@@ -49,23 +54,26 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
-   struct sockaddr_in sin;
+   struct addrinfo hints, *res, *res0;
char *dummy, *packet;
-   long 

svn commit: r227346 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 18:10:04 2011
New Revision: 227346
URL: http://svn.freebsd.org/changeset/base/227346

Log:
  Merge in some fixes from the if_ath_tx branch.
  
  * Close down some of the kickpcu races, where the interrupt handler
can and will run concurrently with the taskqueue.
  * Close down the TXQ active/completed race between the interrupt
handler and the concurrently running tx completion taskqueue
function.
  * Add some tx and rx interrupt count tracking, for debugging.
  * Fix the kickpcu logic in ath_rx_proc() to not simply drain and
restart the TX queue - instead, assume the hardware isn't
(too) confused and just restart RX DMA. This may break on
previous chipsets, so if it does I'll add a HAL flag and
conditionally handle this (ie, for broken chipsets, I'll
just restore the stop PCU / flush things / restart PCU
logic.)
  * Misc stuff
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_tx.h
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 17:23:43 2011(r227345)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 18:10:04 2011(r227346)
@@ -1304,6 +1304,7 @@ ath_intr(void *arg)
struct ifnet *ifp = sc-sc_ifp;
struct ath_hal *ah = sc-sc_ah;
HAL_INT status = 0;
+   uint32_t txqs;
 
if (sc-sc_invalid) {
/*
@@ -1377,7 +1378,7 @@ ath_intr(void *arg)
}
}
if (status  HAL_INT_RXEOL) {
-   int imask = sc-sc_imask;
+   int imask;
/*
 * NB: the hardware should re-read the link when
 * RXE bit is written, but it doesn't work at
@@ -1393,26 +1394,55 @@ ath_intr(void *arg)
 * by a call to ath_reset() somehow, the
 * interrupt mask will be correctly reprogrammed.
 */
+   ATH_LOCK(sc);
+   imask = sc-sc_imask;
imask = ~(HAL_INT_RXEOL | HAL_INT_RXORN);
ath_hal_intrset(ah, imask);
/*
+* Only blank sc_rxlink if we've not yet kicked
+* the PCU.
+*
+* This isn't entirely correct - the correct solution
+* would be to have a PCU lock and engage that for
+* the duration of the PCU fiddling; which would include
+* running the RX process. Otherwise we could end up
+* messing up the RX descriptor chain and making the
+* RX desc list much shorter.
+*/
+   if (! sc-sc_kickpcu)
+   sc-sc_rxlink = NULL;
+   sc-sc_kickpcu = 1;
+   ATH_UNLOCK(sc);
+   /*
 * Enqueue an RX proc, to handled whatever
 * is in the RX queue.
 * This will then kick the PCU.
 */
taskqueue_enqueue(sc-sc_tq, sc-sc_rxtask);
-   sc-sc_rxlink = NULL;
-   sc-sc_kickpcu = 1;
}
if (status  HAL_INT_TXURN) {
sc-sc_stats.ast_txurn++;
/* bump tx trigger level */
ath_hal_updatetxtriglevel(ah, AH_TRUE);
}
-   if (status  HAL_INT_RX)
+   if (status  HAL_INT_RX) {
+   sc-sc_stats.ast_rx_intr++;
taskqueue_enqueue(sc-sc_tq, sc-sc_rxtask);
-   if (status  HAL_INT_TX)
+   }
+   if (status  HAL_INT_TX) {
+   sc-sc_stats.ast_tx_intr++;
+   /*
+* Grab all the currently set bits in the HAL txq bitmap
+* and blank them. This is the only place we should be
+* doing this.
+*/
+   ATH_LOCK(sc);
+   txqs = 0x;
+   ath_hal_gettxintrtxqs(sc-sc_ah, txqs);
+   sc-sc_txq_active |= txqs;
+   ATH_UNLOCK(sc);
taskqueue_enqueue(sc-sc_tq, sc-sc_txtask);
+   }
if (status  HAL_INT_BMISS) {
sc-sc_stats.ast_bmiss++;
taskqueue_enqueue(sc-sc_tq, sc-sc_bmisstask);
@@ -1433,7 +1463,16 @@ ath_intr(void *arg)
 * clear whatever condition caused the interrupt.
 */

svn commit: r227347 - in head/sys: conf dev/ti

2011-11-08 Thread Pyun YongHyeon
Author: yongari
Date: Tue Nov  8 18:23:02 2011
New Revision: 227347
URL: http://svn.freebsd.org/changeset/base/227347

Log:
  Retire 'options TI_PRIVATE_JUMBOS' and replace local jumbo
  allocator with UMA backed jumbo allocator by default. Previously
  ti(4) used sf_buf(9) interface for jumbo buffers but it was broken
  at this moment such that enabling jumbo frame caused instant panic.
  Due to the nature of sf_buf(9) it heavily relies on VM changes but
  it seems ti(4) was not received much blessing from VM gurus.  I
  don't understand VM magic and implications used in driver either.
  Switching to UMA backed jumbo allocator like other network drivers
  will make jumbo frame work on ti(4).
  While I'm here, fully allocate all RX buffers. This means ti(4) now
  uses 512 RX buffer and 1024 mini RX buffers.
  
  To use sf_buf(9) interface for jumbo buffers, introduce a new
  'options TI_SF_BUF_JUMBO'. If it is proven that sf_buf(9) is better
  for jumbo buffers, interesting developers can fix the issue in
  future.
  
  ti(4) still needs more bus_dma(9) cleanups and should use separate
  DMA tag/map for each ring(standard, jumbo, mini, command, event
  etc) but it should work on all platforms except PAE.
  
  Special thanks to Jay[1] who provided complete remote debugging
  access.
  
  Tested by:Jay Borkenhagen jayb  braeburn dot org  [1]

Modified:
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/dev/ti/if_ti.c
  head/sys/dev/ti/if_tireg.h

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Tue Nov  8 18:10:04 2011(r227346)
+++ head/sys/conf/NOTES Tue Nov  8 18:23:02 2011(r227347)
@@ -2142,11 +2142,11 @@ device  malo# Marvell Libertas 
wireles
 device mwl # Marvell 88W8363 802.11n wireless NICs.
 device ral # Ralink Technology RT2500 wireless NICs.
 
-# Use private jumbo buffers allocated exclusively for the ti(4) driver.
-# This option is incompatible with the TI_JUMBO_HDRSPLIT option below.
-#options   TI_PRIVATE_JUMBOS
+# Use sf_buf(9) interface for jumbo buffers on ti(4) controllers.
+#options   TI_SF_BUF_JUMBO
 # Turn on the header splitting option for the ti(4) driver firmware.  This
 # only works for Tigon II chips, and has no effect for Tigon I chips.
+# This option requires the TI_SF_BUF_JUMBO option above.
 optionsTI_JUMBO_HDRSPLIT
 
 #

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Tue Nov  8 18:10:04 2011(r227346)
+++ head/sys/conf/options   Tue Nov  8 18:23:02 2011(r227347)
@@ -526,7 +526,7 @@ NGATM_CCATM opt_netgraph.h
 DRM_DEBUG  opt_drm.h
 
 ZERO_COPY_SOCKETS  opt_zero.h
-TI_PRIVATE_JUMBOS  opt_ti.h
+TI_SF_BUF_JUMBOopt_ti.h
 TI_JUMBO_HDRSPLIT  opt_ti.h
 BCE_JUMBO_HDRSPLIT opt_bce.h
 

Modified: head/sys/dev/ti/if_ti.c
==
--- head/sys/dev/ti/if_ti.c Tue Nov  8 18:10:04 2011(r227346)
+++ head/sys/dev/ti/if_ti.c Tue Nov  8 18:23:02 2011(r227347)
@@ -112,8 +112,7 @@ __FBSDID($FreeBSD$);
 #include sys/bus.h
 #include sys/rman.h
 
-/* #define TI_PRIVATE_JUMBOS */
-#ifndef TI_PRIVATE_JUMBOS
+#ifdef TI_SF_BUF_JUMBO
 #include vm/vm.h
 #include vm/vm_page.h
 #endif
@@ -131,9 +130,9 @@ __FBSDID($FreeBSD$);
  * We can only turn on header splitting if we're using extended receive
  * BDs.
  */
-#if defined(TI_JUMBO_HDRSPLIT)  defined(TI_PRIVATE_JUMBOS)
-#error options TI_JUMBO_HDRSPLIT and TI_PRIVATE_JUMBOS are mutually exclusive
-#endif /* TI_JUMBO_HDRSPLIT  TI_JUMBO_HDRSPLIT */
+#if defined(TI_JUMBO_HDRSPLIT)  !defined(TI_SF_BUF_JUMBO)
+#error options TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO
+#endif /* TI_JUMBO_HDRSPLIT  !TI_SF_BUF_JUMBO */
 
 typedef enum {
TI_SWAP_HTON,
@@ -222,12 +221,8 @@ static void ti_handle_events(struct ti_s
 static int ti_alloc_dmamaps(struct ti_softc *);
 static void ti_free_dmamaps(struct ti_softc *);
 static int ti_alloc_jumbo_mem(struct ti_softc *);
-#ifdef TI_PRIVATE_JUMBOS
-static void *ti_jalloc(struct ti_softc *);
-static void ti_jfree(void *, void *);
-#endif /* TI_PRIVATE_JUMBOS */
-static int ti_newbuf_std(struct ti_softc *, int, struct mbuf *);
-static int ti_newbuf_mini(struct ti_softc *, int, struct mbuf *);
+static int ti_newbuf_std(struct ti_softc *, int);
+static int ti_newbuf_mini(struct ti_softc *, int);
 static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *);
 static int ti_init_rx_ring_std(struct ti_softc *);
 static void ti_free_rx_ring_std(struct ti_softc *);
@@ -237,6 +232,11 @@ static int ti_init_rx_ring_mini(struct t
 static void ti_free_rx_ring_mini(struct ti_softc *);
 static void ti_free_tx_ring(struct ti_softc *);
 static int ti_init_tx_ring(struct ti_softc *);
+static void 

svn commit: r227348 - head/share/man/man4

2011-11-08 Thread Pyun YongHyeon
Author: yongari
Date: Tue Nov  8 18:35:11 2011
New Revision: 227348
URL: http://svn.freebsd.org/changeset/base/227348

Log:
  ti(4) supports altq(4).

Modified:
  head/share/man/man4/altq.4

Modified: head/share/man/man4/altq.4
==
--- head/share/man/man4/altq.4  Tue Nov  8 18:23:02 2011(r227347)
+++ head/share/man/man4/altq.4  Tue Nov  8 18:35:11 2011(r227348)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd November 6, 2011
+.Dd November 8, 2011
 .Dt ALTQ 4
 .Os
 .Sh NAME
@@ -161,6 +161,7 @@ They have been applied to the following 
 .Xr sk 4 ,
 .Xr ste 4 ,
 .Xr stge 4 ,
+.Xr ti 4 ,
 .Xr txp 4 ,
 .Xr udav 4 ,
 .Xr ural 4 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227349 - head/share/man/man4

2011-11-08 Thread Pyun YongHyeon
Author: yongari
Date: Tue Nov  8 18:36:59 2011
New Revision: 227349
URL: http://svn.freebsd.org/changeset/base/227349

Log:
  Document TI_SF_BUF_JUMBO and Xr altq.

Modified:
  head/share/man/man4/ti.4

Modified: head/share/man/man4/ti.4
==
--- head/share/man/man4/ti.4Tue Nov  8 18:35:11 2011(r227348)
+++ head/share/man/man4/ti.4Tue Nov  8 18:36:59 2011(r227349)
@@ -30,7 +30,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd July 16, 2005
+.Dd November 8, 2011
 .Dt TI 4
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@ place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd device ti
-.Cd options TI_PRIVATE_JUMBOS
+.Cd options TI_SF_BUF_JUMBO
 .Cd options TI_JUMBO_HDRSPLIT
 .Ed
 .Pp
@@ -97,13 +97,14 @@ for more discussion on zero copy receive
 .Pp
 The
 .Nm
-driver normally uses jumbo receive buffers allocated by the
+driver uses UMA backed jumbo receive buffers, but can be configured
+to use
 .Xr sendfile 2
-buffer allocator, but can be configured to use its own private pool of
-jumbo buffers that are contiguous instead of buffers from the jumbo
-allocator, which are made up of multiple page sized chunks.
-To turn on private jumbos, use the
-.Dv TI_PRIVATE_JUMBOS
+buffer allocator.
+To turn on
+.Xr sendfile 2
+buffer allocator, use the
+.Dv TI_SF_BUF_JUMBO
 option.
 .Pp
 Support for vlans is also available using the
@@ -311,6 +312,7 @@ the network connection (cable).
 .El
 .Sh SEE ALSO
 .Xr sendfile 2 ,
+.Xr altq 4 ,
 .Xr arp 4 ,
 .Xr netintro 4 ,
 .Xr ng_ether 4 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227350 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 18:37:52 2011
New Revision: 227350
URL: http://svn.freebsd.org/changeset/base/227350

Log:
  Conditionally compile the PCI latency workaround; I think it's
  only required for some earlier NICs.

Modified:
  head/sys/dev/ath/if_ath_pci.c

Modified: head/sys/dev/ath/if_ath_pci.c
==
--- head/sys/dev/ath/if_ath_pci.c   Tue Nov  8 18:36:59 2011
(r227349)
+++ head/sys/dev/ath/if_ath_pci.c   Tue Nov  8 18:37:52 2011
(r227350)
@@ -78,8 +78,10 @@ struct ath_pci_softc {
 static void
 ath_pci_setup(device_t dev)
 {
+#ifdef ATH_PCI_LATENCY_WAR
/* Override the system latency timer */
pci_write_config(dev, PCIR_LATTIMER, 0x80, 1);
+#endif
 
/* If a PCI NIC, force wakeup */
 #ifdef ATH_PCI_WAKEUP_WAR
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227351 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 18:45:15 2011
New Revision: 227351
URL: http://svn.freebsd.org/changeset/base/227351

Log:
  Preparation for correct 802.11n tx/rx handling.
  
  * Change ath_rx_proc() to ath_rx_tasklet(); make that the taskqueue function.
This way (eventually) ath_rx_proc() can be called from elsewhere in the
packet reset/processing queue so frames aren't just flushed during
interface resets/reconfigure. This breaks 802.11n RX aggregation tracking.
  * Extend ath_tx_proc() to take a 'resched' flag, which marks whether to
reschedule further RX PCU reads or not.
  * Change ath_tx_processq() to take a dosched flag, which will eventually
be used to indicate whether to reschedule the software TX scheduler.
  
  Sponsored by: Hobnob, Inc.

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 18:37:52 2011(r227350)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 18:45:15 2011(r227351)
@@ -170,7 +170,8 @@ static int  ath_rxbuf_init(struct ath_sof
 static voidath_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m,
int subtype, int rssi, int nf);
 static voidath_setdefantenna(struct ath_softc *, u_int);
-static voidath_rx_proc(void *, int);
+static voidath_rx_proc(struct ath_softc *sc, int);
+static voidath_rx_tasklet(void *, int);
 static voidath_txq_init(struct ath_softc *sc, struct ath_txq *, int);
 static struct ath_txq *ath_txq_setup(struct ath_softc*, int qtype, int 
subtype);
 static int ath_tx_setup(struct ath_softc *, int, int);
@@ -382,7 +383,7 @@ ath_attach(u_int16_t devid, struct ath_s
taskqueue_start_threads(sc-sc_tq, 1, PI_NET,
%s taskq, ifp-if_xname);
 
-   TASK_INIT(sc-sc_rxtask, 0, ath_rx_proc, sc);
+   TASK_INIT(sc-sc_rxtask, 0, ath_rx_tasklet, sc);
TASK_INIT(sc-sc_bmisstask, 0, ath_bmiss_proc, sc);
TASK_INIT(sc-sc_bstucktask,0, ath_bstuck_proc, sc);
 
@@ -3505,13 +3506,27 @@ ath_handle_micerror(struct ieee80211com 
}
 }
 
+/*
+ * Only run the RX proc if it's not already running.
+ * Since this may get run as part of the reset/flush path,
+ * the task can't clash with an existing, running tasklet.
+ */
 static void
-ath_rx_proc(void *arg, int npending)
+ath_rx_tasklet(void *arg, int npending)
+{
+   struct ath_softc *sc = arg;
+
+   CTR1(ATH_KTR_INTR, ath_rx_proc: pending=%d, npending);
+   DPRINTF(sc, ATH_DEBUG_RX_PROC, %s: pending %u\n, __func__, npending);
+   ath_rx_proc(sc, 1);
+}
+
+static void
+ath_rx_proc(struct ath_softc *sc, int resched)
 {
 #definePA2DESC(_sc, _pa) \
((struct ath_desc *)((caddr_t)(_sc)-sc_rxdma.dd_desc + \
((_pa) - (_sc)-sc_rxdma.dd_desc_paddr)))
-   struct ath_softc *sc = arg;
struct ath_buf *bf;
struct ifnet *ifp = sc-sc_ifp;
struct ieee80211com *ic = ifp-if_l2com;
@@ -3526,7 +3541,7 @@ ath_rx_proc(void *arg, int npending)
u_int64_t tsf;
int npkts = 0;
 
-   DPRINTF(sc, ATH_DEBUG_RX_PROC, %s: pending %u\n, __func__, npending);
+   DPRINTF(sc, ATH_DEBUG_RX_PROC, %s: called\n, __func__);
ngood = 0;
nf = ath_hal_getchannoise(ah, sc-sc_curchan);
sc-sc_stats.ast_rx_noise = nf;
@@ -3862,7 +3877,7 @@ rx_next:
sc-sc_lastrx = tsf;
 
/* Queue DFS tasklet if needed */
-   if (ath_dfs_tasklet_needed(sc, sc-sc_curchan))
+   if (resched  ath_dfs_tasklet_needed(sc, sc-sc_curchan))
taskqueue_enqueue(sc-sc_tq, sc-sc_dfstask);
 
/*
@@ -3870,7 +3885,7 @@ rx_next:
 * need to be handled, kick the PCU if there's
 * been an RXEOL condition.
 */
-   if (sc-sc_kickpcu) {
+   if (resched  sc-sc_kickpcu) {
device_printf(sc-sc_dev, %s: kickpcu; handled %d packets\n,
__func__, npkts);
 
@@ -3887,7 +3902,7 @@ rx_next:
ATH_UNLOCK(sc);
}
 
-   if ((ifp-if_drv_flags  IFF_DRV_OACTIVE) == 0) {
+   if (resched  (ifp-if_drv_flags  IFF_DRV_OACTIVE) == 0) {
 #ifdef IEEE80211_SUPPORT_SUPERG
ieee80211_ff_age_all(ic, 100);
 #endif
@@ -4121,7 +4136,7 @@ ath_tx_findrix(const struct ath_softc *s
  * Process completed xmit descriptors from the specified queue.
  */
 static int
-ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
+ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched)
 {
struct ath_hal *ah = sc-sc_ah;
struct ifnet *ifp = sc-sc_ifp;
@@ -4287,11 +4302,11 @@ ath_tx_proc_q0(void *arg, int npending)
sc-sc_txq_active = ~txqs;
ATH_UNLOCK(sc);
 
-   if (TXQACTIVE(txqs, 0)  ath_tx_processq(sc, sc-sc_txq[0]))
+   if (TXQACTIVE(txqs, 0)  ath_tx_processq(sc, sc-sc_txq[0], 1))
/* XXX why is lastrx updated in tx code? */

svn commit: r227352 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 18:48:26 2011
New Revision: 227352
URL: http://svn.freebsd.org/changeset/base/227352

Log:
  Break out the node cleanup and node free path, in preparation for
  doing software TX queue management.
  
  The software queued TX frames will be freed by the new cleanup
  function.
  
  Sponsored by: Hobnob, Inc.

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 18:45:15 2011(r227351)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 18:48:26 2011(r227352)
@@ -163,6 +163,7 @@ static int  ath_desc_alloc(struct ath_sof
 static voidath_desc_free(struct ath_softc *);
 static struct ieee80211_node *ath_node_alloc(struct ieee80211vap *,
const uint8_t [IEEE80211_ADDR_LEN]);
+static voidath_node_cleanup(struct ieee80211_node *);
 static voidath_node_free(struct ieee80211_node *);
 static voidath_node_getsignal(const struct ieee80211_node *,
int8_t *, int8_t *);
@@ -713,6 +714,8 @@ ath_attach(u_int16_t devid, struct ath_s
ic-ic_node_alloc = ath_node_alloc;
sc-sc_node_free = ic-ic_node_free;
ic-ic_node_free = ath_node_free;
+   sc-sc_node_cleanup = ic-ic_node_cleanup;
+   ic-ic_node_cleanup = ath_node_cleanup;
ic-ic_node_getsignal = ath_node_getsignal;
ic-ic_scan_start = ath_scan_start;
ic-ic_scan_end = ath_scan_end;
@@ -3219,14 +3222,24 @@ ath_node_alloc(struct ieee80211vap *vap,
 }
 
 static void
+ath_node_cleanup(struct ieee80211_node *ni)
+{
+   struct ieee80211com *ic = ni-ni_ic;
+   struct ath_softc *sc = ic-ic_ifp-if_softc;
+
+   /* Cleanup ath_tid, free unused bufs, unlink bufs in TXQ */
+   ath_rate_node_cleanup(sc, ATH_NODE(ni));
+   sc-sc_node_cleanup(ni);
+}
+
+static void
 ath_node_free(struct ieee80211_node *ni)
 {
struct ieee80211com *ic = ni-ni_ic;
-struct ath_softc *sc = ic-ic_ifp-if_softc;
+   struct ath_softc *sc = ic-ic_ifp-if_softc;
 
DPRINTF(sc, ATH_DEBUG_NODE, %s: ni %p\n, __func__, ni);
mtx_destroy(ATH_NODE(ni)-an_mtx);
-   ath_rate_node_cleanup(sc, ATH_NODE(ni));
sc-sc_node_free(ni);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227353 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 18:56:52 2011
New Revision: 227353
URL: http://svn.freebsd.org/changeset/base/227353

Log:
  In preparation for supporting 11n TX/RX properly, allow for TX queue draining
  and interface resets to be marked as ATH_RESET_DEFAULT, ATH_RESET_FULL,
  ATH_RESET_NOLOSS.
  
  Currently a reset is still a reset - ie, all tx/rx frames in the hardware
  queues are purged. This means that those frames will be lost to the 11n TX
  and RX aggregation state tracking, breaking AMPDU sessions.
  
  The (eventual) new semantics:
  
  * ATH_RESET_DEFAULT:
full reset, this is the default for reset situations
which I haven't yet figured out what they should be.
  * ATH_RESET_FULL:
A full reset - for things such as channel changes.
  * ATH_RESET_NOLOSS:
Don't flush TX/RX queues - handle pending RX frames and leave TX
frames where they are; restart TX DMA from where it was.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_misc.h
  head/sys/dev/ath/if_ath_sysctl.c

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 18:48:26 2011(r227352)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 18:56:52 2011(r227353)
@@ -184,7 +184,7 @@ static void ath_tx_proc_q0123(void *, in
 static voidath_tx_proc(void *, int);
 static voidath_tx_draintxq(struct ath_softc *, struct ath_txq *);
 static int ath_chan_set(struct ath_softc *, struct ieee80211_channel *);
-static voidath_draintxq(struct ath_softc *);
+static voidath_draintxq(struct ath_softc *, ATH_RESET_TYPE reset_type);
 static voidath_stoprecv(struct ath_softc *);
 static int ath_startrecv(struct ath_softc *);
 static voidath_chan_change(struct ath_softc *, struct ieee80211_channel *);
@@ -1123,7 +1123,8 @@ ath_vap_delete(struct ieee80211vap *vap)
 * the vap state by any frames pending on the tx queues.
 */
ath_hal_intrset(ah, 0); /* disable interrupts */
-   ath_draintxq(sc);   /* stop xmit side */
+   ath_draintxq(sc, ATH_RESET_DEFAULT);/* stop hw xmit 
side */
+   /* XXX Do all frames from all vaps/nodes need draining here? */
ath_stoprecv(sc);   /* stop recv side */
}
 
@@ -1507,7 +1508,7 @@ ath_fatal_proc(void *arg, int pending)
state[0], state[1] , state[2], state[3],
state[4], state[5]);
}
-   ath_reset(ifp);
+   ath_reset(ifp, ATH_RESET_NOLOSS);
 }
 
 static void
@@ -1567,7 +1568,7 @@ ath_bmiss_proc(void *arg, int pending)
 
if (ath_hal_gethangstate(sc-sc_ah, 0xff, hangs)  hangs != 0) {
if_printf(ifp, bb hang detected (0x%x), resetting\n, hangs);
-   ath_reset(ifp);
+   ath_reset(ifp, ATH_RESET_NOLOSS);
} else
ieee80211_beacon_miss(ifp-if_l2com);
 }
@@ -1747,7 +1748,7 @@ ath_stop_locked(struct ifnet *ifp)
}
ath_hal_intrset(ah, 0);
}
-   ath_draintxq(sc);
+   ath_draintxq(sc, ATH_RESET_DEFAULT);
if (!sc-sc_invalid) {
ath_stoprecv(sc);
ath_hal_phydisable(ah);
@@ -1775,7 +1776,7 @@ ath_stop(struct ifnet *ifp)
  * to reset or reload hardware state.
  */
 int
-ath_reset(struct ifnet *ifp)
+ath_reset(struct ifnet *ifp, ATH_RESET_TYPE reset_type)
 {
struct ath_softc *sc = ifp-if_softc;
struct ieee80211com *ic = ifp-if_l2com;
@@ -1783,7 +1784,7 @@ ath_reset(struct ifnet *ifp)
HAL_STATUS status;
 
ath_hal_intrset(ah, 0); /* disable interrupts */
-   ath_draintxq(sc);   /* stop xmit side */
+   ath_draintxq(sc, reset_type);   /* stop xmit side */
ath_stoprecv(sc);   /* stop recv side */
ath_settkipmic(sc); /* configure TKIP MIC handling */
/* NB: indicate channel change so we do a full reset */
@@ -1836,7 +1837,8 @@ ath_reset_vap(struct ieee80211vap *vap, 
ath_hal_settxpowlimit(ah, ic-ic_txpowlimit);
return 0;
}
-   return ath_reset(ifp);
+   /* XXX? Full or NOLOSS? */
+   return ath_reset(ifp, ATH_RESET_FULL);
 }
 
 struct ath_buf *
@@ -2730,7 +2732,7 @@ ath_bstuck_proc(void *arg, int pending)
if_printf(ifp, stuck beacon; resetting (bmiss count %u)\n,
sc-sc_bmisscount);
sc-sc_stats.ast_bstuck++;
-   ath_reset(ifp);
+   ath_reset(ifp, ATH_RESET_NOLOSS);
 }
 
 /*
@@ -4484,7 +4486,7 @@ ath_tx_stopdma(struct ath_softc *sc, str
  * Drain the transmit queues and reclaim resources.
  */
 static void
-ath_draintxq(struct ath_softc *sc)
+ath_draintxq(struct ath_softc *sc, ATH_RESET_TYPE reset_type)
 {
struct ath_hal *ah = 

svn commit: r227354 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 19:02:59 2011
New Revision: 227354
URL: http://svn.freebsd.org/changeset/base/227354

Log:
  Add KTR tracepoints to the ath driver, in order to debug TX, RX
  and interrupt handling.
  
  Sponsored by: Hobnob, Inc.

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 18:56:52 2011(r227353)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 19:02:59 2011(r227354)
@@ -64,6 +64,7 @@ __FBSDID($FreeBSD$);
 #include sys/taskqueue.h
 #include sys/priv.h
 #include sys/module.h
+#include sys/ktr.h
 
 #include machine/bus.h
 
@@ -106,6 +107,8 @@ __FBSDID($FreeBSD$);
 #include dev/ath/ath_tx99/ath_tx99.h
 #endif
 
+#defineATH_KTR_INTRKTR_SPARE4
+#defineATH_KTR_ERR KTR_SPARE3
 
 /*
  * ATH_BCBUF determines the number of vap's that can transmit
@@ -1116,6 +1119,7 @@ ath_vap_delete(struct ieee80211vap *vap)
struct ath_hal *ah = sc-sc_ah;
struct ath_vap *avp = ATH_VAP(vap);
 
+   DPRINTF(sc, ATH_DEBUG_RESET, %s: called\n, __func__);
if (ifp-if_drv_flags  IFF_DRV_RUNNING) {
/*
 * Quiesce the hardware while we remove the vap.  In
@@ -1339,6 +1343,14 @@ ath_intr(void *arg)
 */
ath_hal_getisr(ah, status);/* NB: clears ISR too */
DPRINTF(sc, ATH_DEBUG_INTR, %s: status 0x%x\n, __func__, status);
+   CTR1(ATH_KTR_INTR, ath_intr: mask=0x%.8x, status);
+   CTR5(ATH_KTR_INTR,
+   ath_intr: ISR=0x%.8x, ISR_S0=0x%.8x, ISR_S1=0x%.8x, ISR_S2=0x%.8x, 
ISR_S5=0x%.8x,
+   ah-ah_intrstate[0],
+   ah-ah_intrstate[1],
+   ah-ah_intrstate[2],
+   ah-ah_intrstate[3],
+   ah-ah_intrstate[6]);
status = sc-sc_imask; /* discard unasked for bits */
 
/* Short-circuit un-handled interrupts */
@@ -1384,6 +1396,7 @@ ath_intr(void *arg)
}
if (status  HAL_INT_RXEOL) {
int imask;
+   CTR0(ATH_KTR_ERR, ath_intr: RXEOL);
/*
 * NB: the hardware should re-read the link when
 * RXE bit is written, but it doesn't work at
@@ -1481,6 +1494,7 @@ ath_intr(void *arg)
}
if (status  HAL_INT_RXORN) {
/* NB: hal marks HAL_INT_FATAL when RXORN is fatal */
+   CTR0(ATH_KTR_ERR, ath_intr: RXORN);
sc-sc_stats.ast_rxorn++;
}
}
@@ -1783,8 +1797,14 @@ ath_reset(struct ifnet *ifp, ATH_RESET_T
struct ath_hal *ah = sc-sc_ah;
HAL_STATUS status;
 
+   DPRINTF(sc, ATH_DEBUG_RESET, %s: called\n, __func__);
ath_hal_intrset(ah, 0); /* disable interrupts */
ath_draintxq(sc, reset_type);   /* stop xmit side */
+   /*
+* XXX Don't flush if ATH_RESET_NOLOSS;but we have to first
+* XXX need to ensure this doesn't race with an outstanding
+* XXX taskqueue call.
+*/
ath_stoprecv(sc);   /* stop recv side */
ath_settkipmic(sc); /* configure TKIP MIC handling */
/* NB: indicate channel change so we do a full reset */
@@ -3891,6 +3911,7 @@ rx_next:
if (ngood)
sc-sc_lastrx = tsf;
 
+   CTR2(ATH_KTR_INTR, ath_rx_proc: npkts=%d, ngood=%d, npkts, ngood);
/* Queue DFS tasklet if needed */
if (resched  ath_dfs_tasklet_needed(sc, sc-sc_curchan))
taskqueue_enqueue(sc-sc_tq, sc-sc_dfstask);
@@ -3901,6 +3922,7 @@ rx_next:
 * been an RXEOL condition.
 */
if (resched  sc-sc_kickpcu) {
+   CTR0(ATH_KTR_ERR, ath_rx_proc: kickpcu);
device_printf(sc-sc_dev, %s: kickpcu; handled %d packets\n,
__func__, npkts);
 
@@ -4638,7 +4660,7 @@ ath_chan_set(struct ath_softc *sc, struc
 * the relevant bits of the h/w.
 */
ath_hal_intrset(ah, 0); /* disable interrupts */
-   ath_draintxq(sc, ATH_RESET_FULL);   /* clear 
pending tx frames */
+   ath_draintxq(sc, ATH_RESET_FULL);   /* clear pending tx 
frames */
ath_stoprecv(sc);   /* turn off frame recv */
if (!ath_hal_reset(ah, sc-sc_opmode, chan, AH_TRUE, status)) {
if_printf(ifp, %s: unable to reset 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227355 - head/usr.bin/procstat

2011-11-08 Thread Mikolaj Golub
Author: trociny
Date: Tue Nov  8 19:14:15 2011
New Revision: 227355
URL: http://svn.freebsd.org/changeset/base/227355

Log:
  Bumb date after r227317.
  
  Reminded by:  pluknet

Modified:
  head/usr.bin/procstat/procstat.1

Modified: head/usr.bin/procstat/procstat.1
==
--- head/usr.bin/procstat/procstat.1Tue Nov  8 19:02:59 2011
(r227354)
+++ head/usr.bin/procstat/procstat.1Tue Nov  8 19:14:15 2011
(r227355)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd August 14, 2011
+.Dd November 7, 2011
 .Dt PROCSTAT 1
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227356 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 19:18:34 2011
New Revision: 227356
URL: http://svn.freebsd.org/changeset/base/227356

Log:
  Some more various fixes, etc from my 11n branch.
  
  * When doing software TX queue handling and flush, it's possible
that the deletion of a VAP (eg a STA shutdown) will queue a
STA Disassociate frame whilst the interface is being deleted.
The VAP is then deleted, and the frame ends up being queued
to a node that is freed before it can be TX'ed. Things go awry
at this point.
  
There's no way at the present to avoid freeing the underlying node
when the vap is being deleted. It's too late in the game.
  
I suspect the real fix is to make sure the frame is software
queued with no completion information somehow, so it doesn't
link back to a node whose underlying VAP has been freed.
For now, we'll just have to do this.
  
  * Add some comments showing what's going on.
  
  * Move an instance of the ATH_LOCK() around to protect the interrupt
set. I'll worry about changing that to a PCU lock later on once
the 11n code is in the tree.
  
  Sponsored by: Hobnob, Inc.

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 19:14:15 2011(r227355)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 19:18:34 2011(r227356)
@@ -1133,6 +1133,26 @@ ath_vap_delete(struct ieee80211vap *vap)
}
 
ieee80211_vap_detach(vap);
+
+   /*
+* XXX Danger Will Robinson! Danger!
+*
+* Because ieee80211_vap_detach() can queue a frame (the station
+* diassociate message?) after we've drained the TXQ and
+* flushed the software TXQ, we will end up with a frame queued
+* to a node whose vap is about to be freed.
+*
+* To work around this, flush the hardware/software again.
+* This may be racy - the ath task may be running and the packet
+* may be being scheduled between sw-hw txq. Tsk.
+*
+* TODO: figure out why a new node gets allocated somewhere around
+* here (after the ath_tx_swq() call; and after an ath_stop_locked()
+* call!)
+*/
+
+   ath_draintxq(sc, ATH_RESET_DEFAULT);
+
ATH_LOCK(sc);
/*
 * Reclaim beacon state.  Note this must be done before
@@ -1180,7 +1200,6 @@ ath_vap_delete(struct ieee80211vap *vap)
sc-sc_swbmiss = 0;
}
 #endif
-   ATH_UNLOCK(sc);
free(avp, M_80211_VAP);
 
if (ifp-if_drv_flags  IFF_DRV_RUNNING) {
@@ -1201,6 +1220,7 @@ ath_vap_delete(struct ieee80211vap *vap)
}
ath_hal_intrset(ah, sc-sc_imask);
}
+   ATH_UNLOCK(sc);
 }
 
 void
@@ -1798,6 +1818,7 @@ ath_reset(struct ifnet *ifp, ATH_RESET_T
HAL_STATUS status;
 
DPRINTF(sc, ATH_DEBUG_RESET, %s: called\n, __func__);
+
ath_hal_intrset(ah, 0); /* disable interrupts */
ath_draintxq(sc, reset_type);   /* stop xmit side */
/*
@@ -2748,10 +2769,18 @@ ath_bstuck_proc(void *arg, int pending)
 {
struct ath_softc *sc = arg;
struct ifnet *ifp = sc-sc_ifp;
+   uint32_t hangs = 0;
+
+   if (ath_hal_gethangstate(sc-sc_ah, 0xff, hangs)  hangs != 0)
+   if_printf(ifp, bb hang detected (0x%x)\n, hangs);
 
if_printf(ifp, stuck beacon; resetting (bmiss count %u)\n,
sc-sc_bmisscount);
sc-sc_stats.ast_bstuck++;
+   /*
+* This assumes that there's no simultaneous channel mode change
+* occuring.
+*/
ath_reset(ifp, ATH_RESET_NOLOSS);
 }
 
@@ -3955,6 +3984,7 @@ ath_txq_init(struct ath_softc *sc, struc
txq-axq_qnum = qnum;
txq-axq_ac = 0;
txq-axq_depth = 0;
+   txq-axq_aggr_depth = 0;
txq-axq_intrcnt = 0;
txq-axq_link = NULL;
txq-axq_softc = sc;
@@ -4085,6 +4115,10 @@ ath_txq_update(struct ath_softc *sc, int
qi.tqi_burstTime = qi.tqi_readyTime;
} else {
 #endif
+   /*
+* XXX shouldn't this just use the default flags
+* used in the previous queue setup?
+*/
qi.tqi_qflags = HAL_TXQ_TXOKINT_ENABLE
  | HAL_TXQ_TXERRINT_ENABLE
  | HAL_TXQ_TXDESCINT_ENABLE
@@ -4430,6 +4464,7 @@ ath_tx_proc(void *arg, int npending)
 
ath_start(ifp);
 }
+#undef TXQACTIVE
 
 static void
 ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227357 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 19:25:52 2011
New Revision: 227357
URL: http://svn.freebsd.org/changeset/base/227357

Log:
  Add a 'vap' to ath_keyset().
  
  Add some code (which is currently disabled) which modifies the group
  multicast key cache behaviour. I haven't yet figured out what the
  exact/correct behaviour is so I'm leaving it disabled. It's worth
  investigating and correcting, especially for future work with
  mesh/ibss and encryption.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_keycache.c
  head/sys/dev/ath/if_ath_keycache.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 19:18:34 2011(r227356)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 19:25:52 2011(r227357)
@@ -5165,7 +5165,7 @@ ath_setup_stationkey(struct ieee80211_no
ni-ni_ucastkey.wk_flags |= IEEE80211_KEY_DEVKEY;
IEEE80211_ADDR_COPY(ni-ni_ucastkey.wk_macaddr, ni-ni_macaddr);
/* NB: this will create a pass-thru key entry */
-   ath_keyset(sc, ni-ni_ucastkey, vap-iv_bss);
+   ath_keyset(sc, vap, ni-ni_ucastkey, vap-iv_bss);
}
 }
 

Modified: head/sys/dev/ath/if_ath_keycache.c
==
--- head/sys/dev/ath/if_ath_keycache.c  Tue Nov  8 19:18:34 2011
(r227356)
+++ head/sys/dev/ath/if_ath_keycache.c  Tue Nov  8 19:25:52 2011
(r227357)
@@ -178,7 +178,8 @@ ath_keyset_tkip(struct ath_softc *sc, co
  * cache slots for TKIP with hardware MIC support.
  */
 int
-ath_keyset(struct ath_softc *sc, const struct ieee80211_key *k,
+ath_keyset(struct ath_softc *sc, struct ieee80211vap *vap,
+   const struct ieee80211_key *k,
struct ieee80211_node *bss)
 {
 #defineN(a)(sizeof(a)/sizeof(a[0]))
@@ -212,7 +213,23 @@ ath_keyset(struct ath_softc *sc, const s
} else
hk.kv_type = HAL_CIPHER_CLR;
 
-   if ((k-wk_flags  IEEE80211_KEY_GROUP)  sc-sc_mcastkey) {
+   /*
+* XXX TODO: check this:
+* 
+* Group keys on hardware that supports multicast frame
+* key search should only be done in adhoc/hostap mode,
+* not STA mode.
+*
+* XXX TODO: what about mesh, tdma?
+*/
+#if 0
+   if ((vap-iv_opmode == IEEE80211_M_HOSTAP ||
+vap-iv_opmode == IEEE80211_M_IBSS) 
+#else
+   if (
+#endif
+   (k-wk_flags  IEEE80211_KEY_GROUP) 
+   sc-sc_mcastkey) {
/*
 * Group keys on hardware that supports multicast frame
 * key search use a MAC that is the sender's address with
@@ -493,5 +510,5 @@ ath_key_set(struct ieee80211vap *vap, co
 {
struct ath_softc *sc = vap-iv_ic-ic_ifp-if_softc;
 
-   return ath_keyset(sc, k, vap-iv_bss);
+   return ath_keyset(sc, vap, k, vap-iv_bss);
 }

Modified: head/sys/dev/ath/if_ath_keycache.h
==
--- head/sys/dev/ath/if_ath_keycache.h  Tue Nov  8 19:18:34 2011
(r227356)
+++ head/sys/dev/ath/if_ath_keycache.h  Tue Nov  8 19:25:52 2011
(r227357)
@@ -37,7 +37,7 @@ extern int ath_key_alloc(struct ieee8021
 extern int ath_key_delete(struct ieee80211vap *, const struct ieee80211_key *);
 extern int ath_key_set(struct ieee80211vap *, const struct ieee80211_key *,
 const u_int8_t mac[IEEE80211_ADDR_LEN]);
-extern int ath_keyset(struct ath_softc *sc, const struct ieee80211_key *k,
-struct ieee80211_node *bss);
+extern int ath_keyset(struct ath_softc *sc, struct ieee80211vap *vap,
+const struct ieee80211_key *k, struct ieee80211_node *bss);
 
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227359 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 21:13:05 2011
New Revision: 227359
URL: http://svn.freebsd.org/changeset/base/227359

Log:
  Change ath_buf allocation to:
  
  * Immediately return NULL if a buffer isn't available;
  * Track the buffers not available count;
  * Clear some fields used for tx aggregation;
  * Add ath_buf_clone() which clones the majority of buffer state.
This is needed when retransmission of a busy buffer is required.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_misc.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 21:06:36 2011(r227358)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 21:13:05 2011(r227359)
@@ -1890,18 +1890,89 @@ _ath_getbuf_locked(struct ath_softc *sc)
ATH_TXBUF_LOCK_ASSERT(sc);
 
bf = TAILQ_FIRST(sc-sc_txbuf);
+   if (bf == NULL) {
+   sc-sc_stats.ast_tx_getnobuf++;
+   } else {
+   if (bf-bf_flags  ATH_BUF_BUSY) {
+   sc-sc_stats.ast_tx_getbusybuf++;
+   bf = NULL;
+   }
+   }
+
if (bf != NULL  (bf-bf_flags  ATH_BUF_BUSY) == 0)
TAILQ_REMOVE(sc-sc_txbuf, bf, bf_list);
else
bf = NULL;
+
if (bf == NULL) {
DPRINTF(sc, ATH_DEBUG_XMIT, %s: %s\n, __func__,
TAILQ_FIRST(sc-sc_txbuf) == NULL ?
out of xmit buffers : xmit buffer busy);
+   return NULL;
}
+
+   /* Valid bf here; clear some basic fields */
+   bf-bf_next = NULL; /* XXX just to be sure */
+   bf-bf_last = NULL; /* XXX again, just to be sure */
+   bf-bf_comp = NULL; /* XXX again, just to be sure */
+   bzero(bf-bf_state, sizeof(bf-bf_state));
+
return bf;
 }
 
+/*
+ * When retrying a software frame, buffers marked ATH_BUF_BUSY
+ * can't be thrown back on the queue as they could still be
+ * in use by the hardware.
+ *
+ * This duplicates the buffer, or returns NULL.
+ *
+ * The descriptor is also copied but the link pointers and
+ * the DMA segments aren't copied; this frame should thus
+ * be again passed through the descriptor setup/chain routines
+ * so the link is correct.
+ *
+ * The caller must free the buffer using ath_freebuf().
+ *
+ * XXX TODO: this call shouldn't fail as it'll cause packet loss
+ * XXX in the TX pathway when retries are needed.
+ * XXX Figure out how to keep some buffers free, or factor the
+ * XXX number of busy buffers into the xmit path (ath_start())
+ * XXX so we don't over-commit.
+ */
+struct ath_buf *
+ath_buf_clone(struct ath_softc *sc, const struct ath_buf *bf)
+{
+   struct ath_buf *tbf;
+
+   tbf = ath_getbuf(sc);
+   if (tbf == NULL)
+   return NULL;/* XXX failure? Why? */
+
+   /* Copy basics */
+   tbf-bf_next = NULL;
+   tbf-bf_nseg = bf-bf_nseg;
+   tbf-bf_txflags = bf-bf_txflags;
+   tbf-bf_flags = bf-bf_flags  ~ATH_BUF_BUSY;
+   tbf-bf_status = bf-bf_status;
+   tbf-bf_m = bf-bf_m;
+   tbf-bf_node = bf-bf_node;
+   /* will be setup by the chain/setup function */
+   tbf-bf_lastds = NULL;
+   /* for now, last == self */
+   tbf-bf_last = tbf;
+   tbf-bf_comp = bf-bf_comp;
+
+   /* NOTE: DMA segments will be setup by the setup/chain functions */
+
+   /* The caller has to re-init the descriptor + links */
+
+   /* Copy state */
+   memcpy(tbf-bf_state, bf-bf_state, sizeof(bf-bf_state));
+
+   return tbf;
+}
+
 struct ath_buf *
 ath_getbuf(struct ath_softc *sc)
 {

Modified: head/sys/dev/ath/if_ath_misc.h
==
--- head/sys/dev/ath/if_ath_misc.h  Tue Nov  8 21:06:36 2011
(r227358)
+++ head/sys/dev/ath/if_ath_misc.h  Tue Nov  8 21:13:05 2011
(r227359)
@@ -52,6 +52,8 @@ extern int ath_tx_findrix(const struct a
 
 extern struct ath_buf * ath_getbuf(struct ath_softc *sc);
 extern struct ath_buf * _ath_getbuf_locked(struct ath_softc *sc);
+extern struct ath_buf * ath_buf_clone(struct ath_softc *sc,
+   const struct ath_buf *bf);
 
 extern int ath_reset(struct ifnet *, ATH_RESET_TYPE);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227360 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 21:25:36 2011
New Revision: 227360
URL: http://svn.freebsd.org/changeset/base/227360

Log:
  Change the descriptor logic to use bf_lastds to point to the last
  descriptor, rather than using the maths involving bf_desc[bf_nseg - 1].
  
  When doing TX aggregation, the status will be updated in the -final-
  descriptor of the -final- subframe in an aggregate. Thus bf_lastds
  may point to the last descriptor in a completely different ath_buf.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 21:13:05 2011(r227359)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 21:25:36 2011(r227360)
@@ -2503,6 +2503,8 @@ ath_beacon_setup(struct ath_softc *sc, s
 
/* setup descriptors */
ds = bf-bf_desc;
+   bf-bf_last = bf;
+   bf-bf_lastds = ds;
 
flags = HAL_TXDESC_NOACK;
if (ic-ic_opmode == IEEE80211_M_IBSS  sc-sc_hasveol) {
@@ -2582,7 +2584,9 @@ ath_txqmove(struct ath_txq *dst, struct 
dst-axq_link = src-axq_link;
src-axq_link = NULL;
dst-axq_depth += src-axq_depth;
+   dst-axq_aggr_depth += src-axq_aggr_depth;
src-axq_depth = 0;
+   src-axq_aggr_depth = 0;
 }
 
 /*
@@ -3227,6 +3231,7 @@ ath_descdma_setup(struct ath_softc *sc,
ath_descdma_cleanup(sc, dd, head);
return error;
}
+   bf-bf_lastds = bf-bf_desc;/* Just an initial value */
TAILQ_INSERT_TAIL(head, bf, bf_list);
}
return 0;
@@ -4284,7 +4289,7 @@ ath_tx_processq(struct ath_softc *sc, st
struct ifnet *ifp = sc-sc_ifp;
struct ieee80211com *ic = ifp-if_l2com;
struct ath_buf *bf, *last;
-   struct ath_desc *ds, *ds0;
+   struct ath_desc *ds;
struct ath_tx_status *ts;
struct ieee80211_node *ni;
struct ath_node *an;
@@ -4304,8 +4309,7 @@ ath_tx_processq(struct ath_softc *sc, st
ATH_TXQ_UNLOCK(txq);
break;
}
-   ds0 = bf-bf_desc[0];
-   ds = bf-bf_desc[bf-bf_nseg - 1];
+   ds = bf-bf_lastds; /* XXX must be setup correctly! */
ts = bf-bf_status.ds_txstat;
status = ath_hal_txprocdesc(ah, ds, ts);
 #ifdef ATH_DEBUG
@@ -4324,13 +4328,19 @@ ath_tx_processq(struct ath_softc *sc, st
 * More frames follow.  Mark the buffer busy
 * so it's not re-used while the hardware may
 * still re-read the link field in the descriptor.
+*
+* Use the last buffer in an aggregate as that
+* is where the hardware may be - intermediate
+* descriptors won't be busy.
 */
-   bf-bf_flags |= ATH_BUF_BUSY;
+   bf-bf_last-bf_flags |= ATH_BUF_BUSY;
} else
 #else
if (txq-axq_depth == 0)
 #endif
txq-axq_link = NULL;
+   if (bf-bf_state.bfs_aggr)
+   txq-axq_aggr_depth--;
ATH_TXQ_UNLOCK(txq);
 
ni = bf-bf_node;
@@ -4565,13 +4575,15 @@ ath_tx_draintxq(struct ath_softc *sc, st
break;
}
ATH_TXQ_REMOVE(txq, bf, bf_list);
+   if (bf-bf_state.bfs_aggr)
+   txq-axq_aggr_depth--;
ATH_TXQ_UNLOCK(txq);
 #ifdef ATH_DEBUG
if (sc-sc_debug  ATH_DEBUG_RESET) {
struct ieee80211com *ic = sc-sc_ifp-if_l2com;
 
ath_printtxbuf(sc, bf, txq-axq_qnum, ix,
-   ath_hal_txprocdesc(ah, bf-bf_desc,
+   ath_hal_txprocdesc(ah, bf-bf_lastds,
bf-bf_status.ds_txstat) == HAL_OK);
ieee80211_dump_pkt(ic, mtod(bf-bf_m, const uint8_t *),
bf-bf_m-m_len, 0, -1);
@@ -4657,7 +4669,7 @@ ath_draintxq(struct ath_softc *sc, ATH_R
struct ath_buf *bf = TAILQ_FIRST(sc-sc_bbuf);
if (bf != NULL  bf-bf_m != NULL) {
ath_printtxbuf(sc, bf, sc-sc_bhalq, 0,
-   ath_hal_txprocdesc(ah, bf-bf_desc,
+   ath_hal_txprocdesc(ah, bf-bf_lastds,
bf-bf_status.ds_txstat) == HAL_OK);
ieee80211_dump_pkt(ifp-if_l2com,
mtod(bf-bf_m, const uint8_t *), bf-bf_m-m_len,

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- 

svn commit: r227361 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 21:49:33 2011
New Revision: 227361
URL: http://svn.freebsd.org/changeset/base/227361

Log:
  Refactor out the TX buffer management and completion code in
  preparation for TX aggregation.
  
  * Add in logic which calls ath_buf bf-bf_comp if it's set.
This allows for AMPDU (and RIFS, and FF, if someone desires) code
to handle completion - which includes freeing subframes, retransmitting
subframes, etc.
  
  * Break out the buffer free, buffer busy/unbusy default completion handler
code into separate functions. This allows bf_comp methods to free and
unbusy each subframe ath_buf as required.
  
  * Break out the statistics update code into a separate function, just
to clean up the TX completion path a little.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_misc.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 21:25:36 2011(r227360)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 21:49:33 2011(r227361)
@@ -185,7 +185,6 @@ static void ath_tx_cleanup(struct ath_so
 static voidath_tx_proc_q0(void *, int);
 static voidath_tx_proc_q0123(void *, int);
 static voidath_tx_proc(void *, int);
-static voidath_tx_draintxq(struct ath_softc *, struct ath_txq *);
 static int ath_chan_set(struct ath_softc *, struct ieee80211_channel *);
 static voidath_draintxq(struct ath_softc *, ATH_RESET_TYPE reset_type);
 static voidath_stoprecv(struct ath_softc *);
@@ -4279,6 +4278,121 @@ ath_tx_findrix(const struct ath_softc *s
return (rix == 0xff ? 0 : rix);
 }
 
+static void
+ath_tx_update_stats(struct ath_softc *sc, struct ath_tx_status *ts,
+struct ath_buf *bf)
+{
+   struct ieee80211_node *ni = bf-bf_node;
+   struct ifnet *ifp = sc-sc_ifp;
+   struct ieee80211com *ic = ifp-if_l2com;
+   int sr, lr, pri;
+
+   if (ts-ts_status == 0) {
+   u_int8_t txant = ts-ts_antenna;
+   sc-sc_stats.ast_ant_tx[txant]++;
+   sc-sc_ant_tx[txant]++;
+   if (ts-ts_finaltsi != 0)
+   sc-sc_stats.ast_tx_altrate++;
+   pri = M_WME_GETAC(bf-bf_m);
+   if (pri = WME_AC_VO)
+   ic-ic_wme.wme_hipri_traffic++;
+   if ((bf-bf_txflags  HAL_TXDESC_NOACK) == 0)
+   ni-ni_inact = ni-ni_inact_reload;
+   } else {
+   if (ts-ts_status  HAL_TXERR_XRETRY)
+   sc-sc_stats.ast_tx_xretries++;
+   if (ts-ts_status  HAL_TXERR_FIFO)
+   sc-sc_stats.ast_tx_fifoerr++;
+   if (ts-ts_status  HAL_TXERR_FILT)
+   sc-sc_stats.ast_tx_filtered++;
+   if (ts-ts_status  HAL_TXERR_XTXOP)
+   sc-sc_stats.ast_tx_xtxop++;
+   if (ts-ts_status  HAL_TXERR_TIMER_EXPIRED)
+   sc-sc_stats.ast_tx_timerexpired++;
+
+   if (ts-ts_status  HAL_TX_DATA_UNDERRUN)
+   sc-sc_stats.ast_tx_data_underrun++;
+   if (ts-ts_status  HAL_TX_DELIM_UNDERRUN)
+   sc-sc_stats.ast_tx_delim_underrun++;
+
+   if (bf-bf_m-m_flags  M_FF)
+   sc-sc_stats.ast_ff_txerr++;
+   }
+   /* XXX when is this valid? */
+   if (ts-ts_status  HAL_TX_DESC_CFG_ERR)
+   sc-sc_stats.ast_tx_desccfgerr++;
+
+   sr = ts-ts_shortretry;
+   lr = ts-ts_longretry;
+   sc-sc_stats.ast_tx_shortretry += sr;
+   sc-sc_stats.ast_tx_longretry += lr;
+
+}
+
+/*
+ * The default completion. If fail is 1, this means
+ * please don't retry the frame, and just return -1 status
+ * to the net80211 stack.
+ */
+void
+ath_tx_default_comp(struct ath_softc *sc, struct ath_buf *bf, int fail)
+{
+   struct ath_tx_status *ts = bf-bf_status.ds_txstat;
+   int st;
+
+   if (fail == 1)
+   st = -1;
+   else
+   st = ((bf-bf_txflags  HAL_TXDESC_NOACK) == 0) ?
+   ts-ts_status : HAL_TXERR_XRETRY;
+
+   if (bf-bf_state.bfs_dobaw)
+   device_printf(sc-sc_dev,
+   %s: dobaw should've been cleared!\n, __func__);
+   if (bf-bf_next != NULL)
+   device_printf(sc-sc_dev,
+   %s: bf_next not NULL!\n, __func__);
+
+   /*
+* Do any tx complete callback.  Note this must
+* be done before releasing the node reference.
+* This will free the mbuf, release the net80211
+* node and recycle the ath_buf.
+*/
+   ath_tx_freebuf(sc, bf, st);
+}
+
+/*
+ * Update the busy status of the last frame on the free list.
+ * When doing TDMA, the busy flag tracks whether the hardware
+ * currently points to this buffer or not, and thus gated DMA
+ * may restart by re-reading the last descriptor in this
+ * 

svn commit: r227362 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 21:55:40 2011
New Revision: 227362
URL: http://svn.freebsd.org/changeset/base/227362

Log:
  Make sure TXEOL is set on default queues. Otherwise we don't get an
  interrupt on the completion of a TX queue and this can cause TX
  hangs / timeout.
  
  Sponsored by: Hobnob, Inc.

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 21:49:33 2011(r227361)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 21:55:40 2011(r227362)
@@ -4198,6 +4198,7 @@ ath_txq_update(struct ath_softc *sc, int
  | HAL_TXQ_TXERRINT_ENABLE
  | HAL_TXQ_TXDESCINT_ENABLE
  | HAL_TXQ_TXURNINT_ENABLE
+ | HAL_TXQ_TXEOLINT_ENABLE
  ;
qi.tqi_aifs = wmep-wmep_aifsn;
qi.tqi_cwmin = ATH_EXPONENT_TO_VALUE(wmep-wmep_logcwmin);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227363 - head/sys/dev/ath

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 22:01:03 2011
New Revision: 227363
URL: http://svn.freebsd.org/changeset/base/227363

Log:
  Add support to the TX descriptor printing code to follow ath_buf
  chains. This allows for debugging of aggregate frames.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/if_ath_debug.c

Modified: head/sys/dev/ath/if_ath_debug.c
==
--- head/sys/dev/ath/if_ath_debug.c Tue Nov  8 21:55:40 2011
(r227362)
+++ head/sys/dev/ath/if_ath_debug.c Tue Nov  8 22:01:03 2011
(r227363)
@@ -123,33 +123,44 @@ ath_printrxbuf(struct ath_softc *sc, con
 }
 
 void
-ath_printtxbuf(struct ath_softc *sc, const struct ath_buf *bf,
+ath_printtxbuf(struct ath_softc *sc, const struct ath_buf *first_bf,
u_int qnum, u_int ix, int done)
 {
-   const struct ath_tx_status *ts = bf-bf_status.ds_txstat;
+   const struct ath_tx_status *ts = 
first_bf-bf_last-bf_status.ds_txstat;
+   const struct ath_buf *bf = first_bf;
struct ath_hal *ah = sc-sc_ah;
const struct ath_desc *ds;
int i;
 
printf(Q%u[%3u], qnum, ix);
-   for (i = 0, ds = bf-bf_desc; i  bf-bf_nseg; i++, ds++) {
-   printf( (DS.V:%p DS.P:%p) L:%08x D:%08x F:04%x%s\n
-  %08x %08x %08x %08x %08x %08x\n,
-   ds, (const struct ath_desc *)bf-bf_daddr + i,
-   ds-ds_link, ds-ds_data, bf-bf_txflags,
-   !done ?  : (ts-ts_status == 0) ?  * :  !,
-   ds-ds_ctl0, ds-ds_ctl1,
-   ds-ds_hw[0], ds-ds_hw[1], ds-ds_hw[2], ds-ds_hw[3]);
-   if (ah-ah_magic == 0x20065416) {
-   printf(%08x %08x %08x %08x %08x %08x %08x 
%08x\n,
-   ds-ds_hw[4], ds-ds_hw[5], ds-ds_hw[6],
-   ds-ds_hw[7], ds-ds_hw[8], ds-ds_hw[9],
-   ds-ds_hw[10],ds-ds_hw[11]);
-   printf(%08x %08x %08x %08x %08x %08x %08x 
%08x\n,
-   ds-ds_hw[12],ds-ds_hw[13],ds-ds_hw[14],
-   ds-ds_hw[15],ds-ds_hw[16],ds-ds_hw[17],
-   ds-ds_hw[18], ds-ds_hw[19]);
+   while (bf != NULL) {
+   for (i = 0, ds = bf-bf_desc; i  bf-bf_nseg; i++, ds++) {
+   printf( (DS.V:%p DS.P:%p) L:%08x D:%08x F:%04x%s\n
+  TXF: %04x Seq: %d swtry: %d ADDBAW?: %d 
DOBAW?: %d\n
+  %08x %08x %08x %08x %08x %08x\n,
+   ds, (const struct ath_desc *)bf-bf_daddr + i,
+   ds-ds_link, ds-ds_data, bf-bf_txflags,
+   !done ?  : (ts-ts_status == 0) ?  * :  !,
+   bf-bf_state.bfs_flags,
+   bf-bf_state.bfs_seqno,
+   bf-bf_state.bfs_retries,
+   bf-bf_state.bfs_addedbaw,
+   bf-bf_state.bfs_dobaw,
+   ds-ds_ctl0, ds-ds_ctl1,
+   ds-ds_hw[0], ds-ds_hw[1], ds-ds_hw[2], 
ds-ds_hw[3]);
+   if (ah-ah_magic == 0x20065416) {
+   printf(%08x %08x %08x %08x %08x %08x 
%08x %08x\n,
+   ds-ds_hw[4], ds-ds_hw[5], ds-ds_hw[6],
+   ds-ds_hw[7], ds-ds_hw[8], ds-ds_hw[9],
+   ds-ds_hw[10],ds-ds_hw[11]);
+   printf(%08x %08x %08x %08x %08x %08x 
%08x %08x\n,
+   ds-ds_hw[12],ds-ds_hw[13],ds-ds_hw[14],
+   ds-ds_hw[15],ds-ds_hw[16],ds-ds_hw[17],
+   ds-ds_hw[18], ds-ds_hw[19]);
+   }
}
+   printf(  [end]\n);
+   bf = bf-bf_next;
}
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227364 - in head/sys/dev/ath: . ath_rate/amrr ath_rate/onoe ath_rate/sample

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 22:43:13 2011
New Revision: 227364
URL: http://svn.freebsd.org/changeset/base/227364

Log:
  Introduce TX aggregation and software TX queue management
  for Atheros AR5416 and later wireless devices.
  
  This is a very large commit - the complete history can be
  found in the user/adrian/if_ath_tx branch.
  
  Legacy (ie, pre-AR5416) devices also use the per-software
  TXQ support and (in theory) can support non-aggregation
  ADDBA sessions. However, the net80211 stack doesn't currently
  support this.
  
  In summary:
  
  TX path:
  
  * queued frames normally go onto a per-TID, per-node queue
  * some special frames (eg ADDBA control frames) are thrown
directly onto the relevant hardware queue so they can
go out before any software queued frames are queued.
  * Add methods to create, suspend, resume and tear down an
aggregation session.
  * Add in software retransmission of both normal and aggregate
frames.
  * Add in completion handling of aggregate frames, including
parsing the block ack bitmap provided by the hardware.
  * Write an aggregation function which can assemble frames into
an aggregate based on the selected rate control and channel
configuration.
  * The per-TID queues are locked based on their target hardware
TX queue. This matches what ath9k/atheros does, and thus
simplified porting over some of the aggregation logic.
  * When doing TX aggregation, stick the sequence number allocation
in the TX path rather than net80211 TX path, and protect it
by the TXQ lock.
  
  Rate control:
  
  * Delay rate control selection until the frame is about to
be queued to the hardware, so retried frames can have their
rate control choices changed. Frames with a static rate
control selection have that applied before each TX, just
to simplify the TX path (ie, not have static and dynamic
rate control special cased.)
  * Teach ath_rate_sample about aggregates - both completion and
errors.
  * Add an EWMA for tracking what the current good MCS rate is
based on failure rates.
  
  Misc:
  
  * Introduce a bunch of dirty hacks and workarounds so TID mapping
and net80211 frame inspection can be kept out of the net80211
layer. Because of the way this code works (and it's from Atheros
and Linux ath9k), there is a consistent, 1:1 mapping between
TID and AC. So we need to ensure that frames going to a specific
TID will _always_ end up on the right AC, and vice versa, or the
completion/locking will simply get very confused. I plan on
addressing this mess in the future.
  
  Known issues:
  
  * There is no BAR frame transmission just yet. A whole lot of
tidying up needs to occur before BAR frame TX can occur in the
correct place - ie, once the TID TX queue has been drained.
  
  * Interface reset/purge/etc results in frames in the TX and RX
queues being removed. This creates holes in the sequence numbers
being assigned and the TX/RX AMPDU code (on either side) just
hangs.
  
  * There's no filtered frame support at the present moment, so
stations going into power saving mode will simply have a number
of frames dropped - likely resulting in a traffic hang.
  
  * Raw frame TX is going to just not function with 11n aggregation.
Likely this needs to be modified to always override the sequence
number if the frame is going into an aggregation session.
However, general raw frame injection currently doesn't work in
general in net80211, so let's just ignore this for now until
this is sorted out.
  
  * HT protection is just not implemented and won't be until the above
is sorted out. In addition, the AR5416 has issues RTS protecting
large aggregates (anything 8k), so the work around needs to be
ported and tested. Thus, this will be put on hold until the above
work is complete.
  
  * The rate control module 'sample' is the only currently supported
module; onoe/amrr haven't been tested and have likely bit rotted
a little. I'll follow up with some commits to make them work again
for non-11n rates, but they won't be updated to handle 11n and
aggregation. If someone wishes to do so then they're welcome to
send along patches.
  
  * .. and sample doesn't really do a good job of 11n TX. Specifically,
the metrics used (packet TX time and failure/success rates) isn't as
useful for 11n. It's likely that it should be extended to take into
account the aggregate throughput possible and then choose a rate
which maximises that. Ie, it may be acceptable for a higher MCS rate
with a higher failure to be used if it gives a more acceptable
throughput/latency then a lower MCS rate @ a lower error rate.
Again, patches will be gratefully accepted.
  
  Because of this, ATH_ENABLE_11N is still not enabled by default.
  
  Sponsored by: Hobnob, Inc.
  Obtained from:Linux, Atheros

Modified:
  

svn commit: r227365 - in head/sys/dev/ath: . ath_hal ath_hal/ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Tue Nov  8 22:50:28 2011
New Revision: 227365
URL: http://svn.freebsd.org/changeset/base/227365

Log:
  Fix the KTR option to compile by default - it was referencing
  some unmerged interrupt status debugging code from my branch.
  
  * Add ah_intrstate[8] which will have the record of the last
call to ath_hal_getintr().
  * Wrap the KTR code behind ATH_KTR_INTR_DEBUG.
  * Add the HAL interrupt debugging behind AH_INTERRUPT_DEBUGGING.
  
  This is only done for the AR5416 and later NICs but it will be
  trivial to add to the earlier NICs if required.
  
  Neither are enabled by default, although to minimise HAL binary
  API differences, the ah_intrstate[] array is always compiled into
  the ath_hal struct.

Modified:
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/ath_hal/ah.h
==
--- head/sys/dev/ath/ath_hal/ah.h   Tue Nov  8 22:43:13 2011
(r227364)
+++ head/sys/dev/ath/ath_hal/ah.h   Tue Nov  8 22:50:28 2011
(r227365)
@@ -810,6 +810,8 @@ struct ath_hal {
 
uint16_t*ah_eepromdata; /* eeprom buffer, if needed */
 
+   uint32_tah_intrstate[8];/* last int state */
+
HAL_OPS_CONFIG ah_config;
const HAL_RATE_TABLE *__ahdecl(*ah_getRateTable)(struct ath_hal *,
u_int mode);

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Tue Nov  8 22:43:13 
2011(r227364)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Tue Nov  8 22:50:28 
2011(r227365)
@@ -70,6 +70,13 @@ ar5416GetPendingInterrupts(struct ath_ha
uint32_t isr, isr0, isr1, sync_cause = 0;
HAL_CAPABILITIES *pCap = AH_PRIVATE(ah)-ah_caps;
 
+#ifdef AH_INTERRUPT_DEBUGGING
+   /*
+* Blank the interrupt debugging area regardless.
+*/
+   bzero(ah-ah_intrstate, sizeof(ah-ah_intrstate));
+#endif
+
/*
 * Verify there's a mac interrupt and the RTC is on.
 */
@@ -90,6 +97,16 @@ ar5416GetPendingInterrupts(struct ath_ha
return AH_FALSE;
}
 
+#ifdef AH_INTERRUPT_DEBUGGING
+   ah-ah_intrstate[0] = isr;
+   ah-ah_intrstate[1] = OS_REG_READ(ah, AR_ISR_S0);
+   ah-ah_intrstate[2] = OS_REG_READ(ah, AR_ISR_S1);
+   ah-ah_intrstate[3] = OS_REG_READ(ah, AR_ISR_S2);
+   ah-ah_intrstate[4] = OS_REG_READ(ah, AR_ISR_S3);
+   ah-ah_intrstate[5] = OS_REG_READ(ah, AR_ISR_S4);
+   ah-ah_intrstate[6] = OS_REG_READ(ah, AR_ISR_S5);
+#endif
+
if (isr != 0) {
struct ath_hal_5212 *ahp = AH5212(ah);
uint32_t mask2;

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 22:43:13 2011(r227364)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 22:50:28 2011(r227365)
@@ -1376,6 +1376,7 @@ ath_intr(void *arg)
ath_hal_getisr(ah, status);/* NB: clears ISR too */
DPRINTF(sc, ATH_DEBUG_INTR, %s: status 0x%x\n, __func__, status);
CTR1(ATH_KTR_INTR, ath_intr: mask=0x%.8x, status);
+#ifdef ATH_KTR_INTR_DEBUG
CTR5(ATH_KTR_INTR,
ath_intr: ISR=0x%.8x, ISR_S0=0x%.8x, ISR_S1=0x%.8x, ISR_S2=0x%.8x, 
ISR_S5=0x%.8x,
ah-ah_intrstate[0],
@@ -1383,6 +1384,7 @@ ath_intr(void *arg)
ah-ah_intrstate[2],
ah-ah_intrstate[3],
ah-ah_intrstate[6]);
+#endif
status = sc-sc_imask; /* discard unasked for bits */
 
/* Short-circuit un-handled interrupts */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227367 - head/sys/conf

2011-11-08 Thread Pyun YongHyeon
Author: yongari
Date: Tue Nov  8 23:19:22 2011
New Revision: 227367
URL: http://svn.freebsd.org/changeset/base/227367

Log:
  Comment out TI_JUMBO_HDRSPLIT. TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO.

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Tue Nov  8 23:02:32 2011(r227366)
+++ head/sys/conf/NOTES Tue Nov  8 23:19:22 2011(r227367)
@@ -2147,7 +2147,7 @@ deviceral # Ralink Technology 
RT2500 
 # Turn on the header splitting option for the ti(4) driver firmware.  This
 # only works for Tigon II chips, and has no effect for Tigon I chips.
 # This option requires the TI_SF_BUF_JUMBO option above.
-optionsTI_JUMBO_HDRSPLIT
+#options   TI_JUMBO_HDRSPLIT
 
 #
 # Use header splitting feature on bce(4) adapters.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227368 - head/usr.sbin/pc-sysinstall/backend

2011-11-08 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Nov  8 23:44:26 2011
New Revision: 227368
URL: http://svn.freebsd.org/changeset/base/227368

Log:
  Welcome the initial patches for OSX bootcamp support!!!
  This should let you select the ada0p3 hybrid MBR/GPT partition, and do an 
installation to it.
  
  Approved by:  kib (mentor)
  Obtained from:k...@pcbsd.org
  MFC after:3 days

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  head/usr.sbin/pc-sysinstall/backend/parseconfig.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Tue Nov  8 
23:19:22 2011(r227367)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Tue Nov  8 
23:44:26 2011(r227368)
@@ -179,7 +179,9 @@ setup_gpart_partitions()
   else
 PARTLETTER=a
 CURPART=1
-rc_halt gpart create -s BSD ${_wSlice}
+if [ ${_pType} = mbr ] ; then
+  rc_halt gpart create -s BSD ${_wSlice}
+fi
   fi
 
   while read line
@@ -255,6 +257,9 @@ setup_gpart_partitions()
 if [ ${CURPART} = 1 -a $_pType = mbr ] ; then
   export FOUNDROOT=0
 fi
+if [ ${CURPART} = 1 -a $_pType = gptslice ] ; then
+  export FOUNDROOT=0
+fi
   fi
 
   check_for_mount ${MNT} /boot
@@ -266,6 +271,9 @@ setup_gpart_partitions()
 if [ ${CURPART} != 1 -a ${_pType} = mbr ] ; then
 exit_err /boot partition must be first partition
 fi
+if [ ${CURPART} != 1 -a ${_pType} = gptslice ] ; then
+exit_err /boot partition must be first partition
+fi
 
 if [ ${FS} != UFS -a ${FS} != UFS+S -a ${FS} != UFS+J -a 
${FS} != UFS+SUJ ] ; then
   exit_err /boot partition must be formatted with UFS
@@ -287,7 +295,7 @@ setup_gpart_partitions()
   # Check if using zfs mirror
   echo ${XTRAOPTS} | grep -q mirror 2/dev/null
   if [ $? -eq 0 -a $FS = ZFS ] ; then
-if [ ${_pType} = gpt ] ; then
+if [ ${_pType} = gpt -o ${_pType} = gptslice ] ; then
  XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS 
${_pDisk}p${CURPART})
 else
  XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS ${_wSlice})
@@ -305,11 +313,17 @@ setup_gpart_partitions()
   if [ ${_pType} = gpt ] ; then
if [ $CURPART = 2 ] ; then
  # If this is GPT, make sure first partition is aligned to 4k
+  sleep 2
   rc_halt gpart add -b 2016 ${SOUT} -t ${PARTYPE} ${_pDisk}
else
+  sleep 2
   rc_halt gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}
fi
+  elif [ ${_pType} = gptslice ]; then
+sleep 2
+rc_halt gpart add ${SOUT} -t ${PARTYPE} ${_wSlice}
   else
+sleep 2
 rc_halt gpart add ${SOUT} -t ${PARTYPE} -i ${CURPART} ${_wSlice}
   fi
 
@@ -338,7 +352,7 @@ setup_gpart_partitions()
   echo ${ENCPASS} ${PARTDIR}-enc/${_dFile}p${CURPART}-encpass
 fi
   else
-   # MBR Partition
+   # MBR Partition or GPT slice
_dFile=`echo $_wSlice | sed 's|/|-|g'`
 echo ${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE} 
${PARTDIR}/${_dFile}${PARTLETTER}
 # Clear out any headers
@@ -422,7 +436,7 @@ populate_disk_label()
   if [ $type = mbr ] ; then
 wrkslice=${diskid}s${slicenum}
   fi
-  if [ $type = gpt ] ; then
+  if [ $type = gpt -o $type = gptslice ] ; then
 wrkslice=${diskid}p${slicenum}
   fi
 
@@ -459,6 +473,9 @@ setup_disk_label()
 if [ $type = gpt -a ! -e ${disk}p${pnum} ] ; then
   exit_err ERROR: The partition ${i} doesn't exist! gpart failure!
 fi
+if [ $type = gptslice -a ! -e ${disk}p${pnum} ] ; then
+  exit_err ERROR: The partition ${i} doesn't exist! gpart failure!
+fi
   done
 
   # Setup some files which we'll be referring to

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Tue Nov  8 
23:19:22 2011(r227367)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Tue Nov  8 
23:44:26 2011(r227368)
@@ -496,6 +496,13 @@ setup_disk_slice()
 run_gpart_slice ${DISK} ${BMANAGER} ${s}
 ;;
 
+  
p1|p2|p3|p4|p5|p6|p7|p8|p9|p10|p11|p12|p13|p14|p15|p16|p17|p18|p19|p20)
+tmpSLICE=${DISK}${PTYPE} 
+# Get the number of the gpt partition we are working on
+s=`echo ${PTYPE} | awk '{print substr($0,length,1)}'` 
+run_gpart_gpt_part ${DISK} ${BMANAGER} ${s}
+;;
+
   free)
 tmpSLICE=${DISK}s${LASTSLICE}
 run_gpart_free ${DISK} ${LASTSLICE} ${BMANAGER}
@@ -704,6 +711,58 @@ run_gpart_full()
   fi
 };
 
+# Function which runs gpart on a 

svn commit: r227369 - head/bin/sh

2011-11-08 Thread Jilles Tjoelker
Author: jilles
Date: Tue Nov  8 23:54:39 2011
New Revision: 227369
URL: http://svn.freebsd.org/changeset/base/227369

Log:
  sh: Remove undefined behaviour due to overflow in +/-/* in arithmetic.
  
  With i386 base gcc and i386 base clang, arith_yacc.o remains unchanged.

Modified:
  head/bin/sh/arith_yacc.c

Modified: head/bin/sh/arith_yacc.c
==
--- head/bin/sh/arith_yacc.cTue Nov  8 23:44:26 2011(r227368)
+++ head/bin/sh/arith_yacc.cTue Nov  8 23:54:39 2011(r227369)
@@ -131,11 +131,11 @@ static arith_t do_binop(int op, arith_t 
yyerror(divide error);
return op == ARITH_REM ? a % b : a / b;
case ARITH_MUL:
-   return a * b;
+   return (uintmax_t)a * (uintmax_t)b;
case ARITH_ADD:
-   return a + b;
+   return (uintmax_t)a + (uintmax_t)b;
case ARITH_SUB:
-   return a - b;
+   return (uintmax_t)a - (uintmax_t)b;
case ARITH_LSHIFT:
return a  b;
case ARITH_RSHIFT:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227370 - head/usr.bin/calendar

2011-11-08 Thread Greg Lehey
Author: grog
Date: Wed Nov  9 01:40:46 2011
New Revision: 227370
URL: http://svn.freebsd.org/changeset/base/227370

Log:
  Tidy up command line processing:
- Add ? option to optstring.
- Sort options alphabetically.
- Vertical space.
  
  Tidy up usage() function.
  
  Bring man page in sync with source.
  
  Ensure that debug code is only executed with the -d option.
  
  Submitted by: Christiane Yeardley

Modified:
  head/usr.bin/calendar/calendar.1
  head/usr.bin/calendar/calendar.c
  head/usr.bin/calendar/io.c
  head/usr.bin/calendar/parsedata.c

Modified: head/usr.bin/calendar/calendar.1
==
--- head/usr.bin/calendar/calendar.1Tue Nov  8 23:54:39 2011
(r227369)
+++ head/usr.bin/calendar/calendar.1Wed Nov  9 01:40:46 2011
(r227370)
@@ -36,11 +36,14 @@
 .Nd reminder service
 .Sh SYNOPSIS
 .Nm
-.Op Fl a
 .Op Fl A Ar num
+.Op Fl a
 .Op Fl B Ar num
+.Op Fl D Ar moon|sun
+.Op Fl d
 .Op Fl F Ar friday
 .Op Fl f Ar calendarfile
+.Op Fl l Ar longitude
 .Oo
 .Bk -words
 .Fl t Ar dd Ns
@@ -49,16 +52,14 @@
 .Sm on
 .Ek
 .Oc
-.Op Fl W Ar num
 .Op Fl U Ar UTC-offset
-.Op Fl l Ar longitude
+.Op Fl W Ar num
 .Sh DESCRIPTION
 The
 .Nm
 utility checks the current directory for a file named
 .Pa calendar
-and displays lines that begin with either today's date
-or tomorrow's.
+and displays lines that fall into the specified date range.
 On the day before a weekend (normally Friday), events for the next
 three days are displayed.
 .Pp
@@ -76,6 +77,10 @@ This requires super-user privileges.
 Print lines from today and the previous
 .Ar num
 days (backward, past).
+.It Fl D Ar moon|sun
+Print UTC offset, longitude and moon or sun information.
+.It Fl d
+Debug option: print current date information.
 .It Fl F Ar friday
 Specify which day of the week is ``Friday'' (the day before the
 weekend begins).
@@ -84,6 +89,11 @@ Default is 5.
 Use
 .Pa calendarfile
 as the default calendar file.
+.It Fl l Ar longitude
+Perform lunar and solar calculations from this longitude.
+If neither longitude nor UTC offset is specified, the calculations will 
+be based on the difference between UTC time and localtime.
+If both are specified, UTC offset overrides longitude.
 .It Xo Fl t
 .Sm off
 .Ar dd
@@ -91,12 +101,11 @@ as the default calendar file.
 .Sm on
 .Xc
 For test purposes only: set date directly to argument values.
-.It Fl l Ar longitude , Fl U Ar UTC-offset
-Only one is needed:
-Perform lunar and solar calculations from this longitude or from
-this UTC offset.
-If neither is specified, the calculations will be based on the
-difference between UTC time and localtime.
+.It Fl U Ar UTC-offset
+Perform lunar and solar calculations from this UTC offset.
+If neither UTC offset nor longitude is specified, the calculations
+will be based on the difference between UTC time and localtime.
+If both are specified, UTC offset overrides longitude. 
 .It Fl W Ar num
 Print lines from today and the next
 .Ar num

Modified: head/usr.bin/calendar/calendar.c
==
--- head/usr.bin/calendar/calendar.cTue Nov  8 23:54:39 2011
(r227369)
+++ head/usr.bin/calendar/calendar.cWed Nov  9 01:40:46 2011
(r227370)
@@ -35,7 +35,7 @@ static const char copyright[] =
 
 #if 0
 #ifndef lint
-static char sccsid[] = @(#)calendar.c  8.3 (Berkeley) 3/25/94;
+static char sccsid[] = @(#)calendar.c 8.3 (Berkeley) 3/25/94;
 #endif
 #endif
 
@@ -79,7 +79,7 @@ main(int argc, char *argv[])
 
(void)setlocale(LC_ALL, );
 
-   while ((ch = getopt(argc, argv, -A:aB:dD:F:f:l:t:U:W:)) != -1)
+   while ((ch = getopt(argc, argv, -A:aB:D:dF:f:l:t:U:W:?)) != -1)
switch (ch) {
case '-':   /* backward contemptible */
case 'a':
@@ -90,10 +90,6 @@ main(int argc, char *argv[])
doall = 1;
break;
 
-   case 'f': /* other calendar file */
-   calendarFile = optarg;
-   break;
-
case 'W': /* we don't need no steenking Fridays */
Friday = -1;
/* FALLTHROUGH */
@@ -106,26 +102,34 @@ main(int argc, char *argv[])
f_dayBefore = atoi(optarg);
break;
 
+   case 'D': /* debug output of sun and moon info */
+   DEBUG = optarg;
+   break;
+
+   case 'd': /* debug output of current date */
+   debug = 1;
+   break;
+
case 'F': /* Change the time: When does weekend start? */
Friday = atoi(optarg);
break;
+
+   case 'f': /* other calendar file */
+   calendarFile = optarg;
+   break;
+
case 

Re: svn commit: r227366 - in head/etc: . rc.d

2011-11-08 Thread Alexey Dokuchaev
On Tue, Nov 08, 2011 at 11:02:32PM +, Jilles Tjoelker wrote:
 Author: jilles
 Date: Tue Nov  8 23:02:32 2011
 New Revision: 227366
 URL: http://svn.freebsd.org/changeset/base/227366
 
 Log:
   rc.d: Eliminate some unnecessary non-POSIX constructs:
   
* ^ in character class
 
 - for file in ${dir}/[^0-9]*.sh; do
 + for file in ${dir}/[!0-9]*.sh; do

I don't have my copy of POSIX handy, but looking at SUSv2, circumflex `^' is
documented as non-matching list expression specifier, while `!' is not.

I am reading it wrong?

./danfe
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227371 - head/sys/dev/ath/ath_rate/sample

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 04:08:01 2011
New Revision: 227371
URL: http://svn.freebsd.org/changeset/base/227371

Log:
  Fix the compile to work when IEEE80211_DEBUG isn't defined.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Wed Nov  9 01:40:46 2011
(r227370)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Wed Nov  9 04:08:01 2011
(r227371)
@@ -760,7 +760,9 @@ update_stats(struct ath_softc *sc, struc
 {
struct sample_node *sn = ATH_NODE_SAMPLE(an);
struct sample_softc *ssc = ATH_SOFTC_SAMPLE(sc);
+#ifdef IEEE80211_DEBUG
const HAL_RATE_TABLE *rt = sc-sc_currates;
+#endif
const int size_bin = size_to_bin(frame_size);
const int size = bin_to_size(size_bin);
int tt, tries_so_far;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227372 - in head/sys/dev/ath/ath_hal: . ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 04:35:33 2011
New Revision: 227372
URL: http://svn.freebsd.org/changeset/base/227372

Log:
  Try to make it more obvious when users are using the PCI or PCIe versions of
  the 11n chips.

Modified:
  head/sys/dev/ath/ath_hal/ah.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c

Modified: head/sys/dev/ath/ath_hal/ah.c
==
--- head/sys/dev/ath/ath_hal/ah.c   Wed Nov  9 04:08:01 2011
(r227371)
+++ head/sys/dev/ath/ath_hal/ah.c   Wed Nov  9 04:35:33 2011
(r227372)
@@ -114,11 +114,15 @@ ath_hal_mac_name(struct ath_hal *ah)
case AR_XSREV_VERSION_SOWL:
return 9160;
case AR_XSREV_VERSION_MERLIN:
-   return 9280;
+   if (AH_PRIVATE(ah)-ah_ispcie)
+   return 9280;
+   return 9220;
case AR_XSREV_VERSION_KITE:
return 9285;
case AR_XSREV_VERSION_KIWI:
-   return 9287;
+   if (AH_PRIVATE(ah)-ah_ispcie)
+   return 9287;
+   return 9227;
}
return ;
 }

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Wed Nov  9 04:08:01 
2011(r227371)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Wed Nov  9 04:35:33 
2011(r227372)
@@ -916,9 +916,12 @@ ar5416FillCapabilityInfo(struct ath_hal 
 static const char*
 ar5416Probe(uint16_t vendorid, uint16_t devid)
 {
-   if (vendorid == ATHEROS_VENDOR_ID 
-   (devid == AR5416_DEVID_PCI || devid == AR5416_DEVID_PCIE))
-   return Atheros 5416;
+   if (vendorid == ATHEROS_VENDOR_ID) {
+   if (devid == AR5416_DEVID_PCI)
+   return Atheros 5416;
+   if (devid == AR5416_DEVID_PCIE)
+   return Atheros 5418;
+   }
return AH_NULL;
 }
 AH_CHIP(AR5416, ar5416Probe, ar5416Attach);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227373 - head/sys/dev/ath/ath_hal/ar9002

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 04:38:27 2011
New Revision: 227373
URL: http://svn.freebsd.org/changeset/base/227373

Log:
  Add in some more PCI/PCIe differentiation.

Modified:
  head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
==
--- head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Wed Nov  9 04:35:33 
2011(r227372)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Wed Nov  9 04:38:27 
2011(r227373)
@@ -892,9 +892,12 @@ ar9280SetAntennaSwitch(struct ath_hal *a
 static const char*
 ar9280Probe(uint16_t vendorid, uint16_t devid)
 {
-   if (vendorid == ATHEROS_VENDOR_ID 
-   (devid == AR9280_DEVID_PCI || devid == AR9280_DEVID_PCIE))
-   return Atheros 9280;
+   if (vendorid == ATHEROS_VENDOR_ID) {
+   if (devid == AR9280_DEVID_PCI)
+   return Atheros 9220;
+   if (devid == AR9280_DEVID_PCIE)
+   return Atheros 9280;
+   }
return AH_NULL;
 }
 AH_CHIP(AR9280, ar9280Probe, ar9280Attach);

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
==
--- head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c Wed Nov  9 04:35:33 
2011(r227372)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c Wed Nov  9 04:38:27 
2011(r227373)
@@ -471,9 +471,12 @@ ar9287SetAntennaSwitch(struct ath_hal *a
 static const char*
 ar9287Probe(uint16_t vendorid, uint16_t devid)
 {
-   if (vendorid == ATHEROS_VENDOR_ID 
-   (devid == AR9287_DEVID_PCI || devid == AR9287_DEVID_PCIE))
-   return Atheros 9287;
+   if (vendorid == ATHEROS_VENDOR_ID) {
+   if (devid == AR9287_DEVID_PCI)
+   return Atheros 9227;
+   if (devid == AR9287_DEVID_PCIE)
+   return Atheros 9287;
+   }
return AH_NULL;
 }
 AH_CHIP(AR9287, ar9287Probe, ar9287Attach);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227374 - in head/sys/dev/ath/ath_hal: . ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 05:25:30 2011
New Revision: 227374
URL: http://svn.freebsd.org/changeset/base/227374

Log:
  Port over a new routine which grabs the percentage of time spent in TX frame, 
RX frame,
  RX clear, RX extension clear.
  
  This is useful for estimating channel business.
  
  The same routines should be written for AR5210-AR5212 where appopriate.
  
  Obtained from:Atheros

Modified:
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c

Modified: head/sys/dev/ath/ath_hal/ah.h
==
--- head/sys/dev/ath/ath_hal/ah.h   Wed Nov  9 04:38:27 2011
(r227373)
+++ head/sys/dev/ath/ath_hal/ah.h   Wed Nov  9 05:25:30 2011
(r227374)
@@ -1025,6 +1025,9 @@ struct ath_hal {
struct ath_desc *);
void  __ahdecl(*ah_set11nBurstDuration)(struct ath_hal *,
struct ath_desc *, u_int);
+   uint32_t  __ahdecl(*ah_get_mib_cycle_counts_pct) (struct ath_hal *,
+   uint32_t *, uint32_t *, uint32_t *, uint32_t *);
+
uint32_t  __ahdecl(*ah_get11nExtBusy)(struct ath_hal *);
void  __ahdecl(*ah_set11nMac2040)(struct ath_hal *,
HAL_HT_MACMODE);

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.hWed Nov  9 04:38:27 2011
(r227373)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.hWed Nov  9 05:25:30 2011
(r227374)
@@ -112,11 +112,13 @@ struct ath_hal_5416 {
int ah_hangs;   /* h/w hangs state */
uint8_t ah_keytype[AR5416_KEYTABLE_SIZE];
/*
-* Extension Channel Rx Clear State
+* Primary/Extension Channel Tx, Rx, Rx Clear State
 */
uint32_tah_cycleCount;
uint32_tah_ctlBusy;
uint32_tah_extBusy;
+   uint32_tah_rxBusy;
+   uint32_tah_txBusy;
uint32_tah_rx_chainmask;
uint32_tah_tx_chainmask;
 
@@ -194,6 +196,9 @@ extern  uint32_t ar5416GetCurRssi(struct 
 extern HAL_BOOL ar5416SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING);
 extern HAL_BOOL ar5416SetDecompMask(struct ath_hal *, uint16_t, int);
 extern void ar5416SetCoverageClass(struct ath_hal *, uint8_t, int);
+extern uint32_t ar5416GetMibCycleCountsPct(struct ath_hal *ah,
+uint32_t *rxc_pcnt, uint32_t *rxextc_pcnt, uint32_t *rxf_pcnt,
+uint32_t *txf_pcnt);
 extern uint32_t ar5416Get11nExtBusy(struct ath_hal *ah);
 extern void ar5416Set11nMac2040(struct ath_hal *ah, HAL_HT_MACMODE mode);
 extern HAL_HT_RXCLEAR ar5416Get11nRxClear(struct ath_hal *ah);

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c   Wed Nov  9 04:38:27 
2011(r227373)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c   Wed Nov  9 05:25:30 
2011(r227374)
@@ -172,6 +172,57 @@ ar5416SetCoverageClass(struct ath_hal *a
 }
 
 /*
+ * Return the busy for rx_frame, rx_clear, and tx_frame
+ */
+uint32_t
+ar5416GetMibCycleCountsPct(struct ath_hal *ah, uint32_t *rxc_pcnt,
+uint32_t *extc_pcnt, uint32_t *rxf_pcnt, uint32_t *txf_pcnt)
+{
+   struct ath_hal_5416 *ahp = AH5416(ah);
+   u_int32_t good = 1;
+
+   /* XXX freeze/unfreeze mib counters */
+   uint32_t rc = OS_REG_READ(ah, AR_RCCNT);
+   uint32_t ec = OS_REG_READ(ah, AR_EXTRCCNT);
+   uint32_t rf = OS_REG_READ(ah, AR_RFCNT);
+   uint32_t tf = OS_REG_READ(ah, AR_TFCNT);
+   uint32_t cc = OS_REG_READ(ah, AR_CCCNT); /* read cycles last */
+
+   if (ahp-ah_cycleCount == 0 || ahp-ah_cycleCount  cc) {
+   /*
+* Cycle counter wrap (or initial call); it's not possible
+* to accurately calculate a value because the registers
+* right shift rather than wrap--so punt and return 0.
+*/
+   HALDEBUG(ah, HAL_DEBUG_ANY,
+   %s: cycle counter wrap. ExtBusy = 0\n, __func__);
+   good = 0;
+   } else {
+   uint32_t cc_d = cc - ahp-ah_cycleCount;
+   uint32_t rc_d = rc - ahp-ah_ctlBusy;
+   uint32_t ec_d = ec - ahp-ah_extBusy;
+   uint32_t rf_d = rf - ahp-ah_rxBusy;
+   uint32_t tf_d = tf - ahp-ah_txBusy;
+
+   if (cc_d != 0) {
+   *rxc_pcnt = rc_d * 100 / cc_d;
+   *rxf_pcnt = rf_d * 100 / cc_d;
+   *txf_pcnt = tf_d * 100 / cc_d;
+   *extc_pcnt = ec_d * 100 / cc_d;
+   } else {
+   good = 0;
+  

svn commit: r227375 - in head/sys/dev/ath: . ath_hal ath_hal/ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 05:30:24 2011
New Revision: 227375
URL: http://svn.freebsd.org/changeset/base/227375

Log:
  Add a new HAL parameter which forces a full reset rather than warm reset.
  This forces a full reset of the baseband/radio and seems needed to clear
  some issues (with Merlin at least) when the baseband gets confused in a
  very noisy environment.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
  head/sys/dev/ath/if_ath_sysctl.c

Modified: head/sys/dev/ath/ath_hal/ah.h
==
--- head/sys/dev/ath/ath_hal/ah.h   Wed Nov  9 05:25:30 2011
(r227374)
+++ head/sys/dev/ath/ath_hal/ah.h   Wed Nov  9 05:30:24 2011
(r227375)
@@ -780,6 +780,7 @@ typedef struct
int ah_dma_beacon_response_time;/* in TU's */
int ah_sw_beacon_response_time; /* in TU's */
int ah_additional_swba_backoff; /* in TU's */
+   int ah_force_full_reset;/* force full chip reset rather then 
warm reset */
 } HAL_OPS_CONFIG;
 
 /*

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c  Wed Nov  9 05:25:30 
2011(r227374)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c  Wed Nov  9 05:30:24 
2011(r227375)
@@ -146,7 +146,9 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO
 
/* For chips on which the RTC reset is done, save TSF before it gets 
cleared */
if (AR_SREV_HOWL(ah) ||
-   (AR_SREV_MERLIN(ah)  ath_hal_eepromGetFlag(ah, 
AR_EEP_OL_PWRCTRL)))
+   (AR_SREV_MERLIN(ah) 
+ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) ||
+   (ah-ah_config.ah_force_full_reset))
tsf = ar5416GetTsf64(ah);
 
/* Mark PHY as inactive; marked active in ar5416InitBB() */
@@ -733,12 +735,15 @@ ar5416ChipReset(struct ath_hal *ah, cons
 {
OS_MARK(ah, AH_MARK_CHIPRESET, chan ? chan-ic_freq : 0);
/*
-* Warm reset is optimistic.
+* Warm reset is optimistic for open-loop TX power control.
 */
if (AR_SREV_MERLIN(ah) 
ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) {
if (!ar5416SetResetReg(ah, HAL_RESET_POWER_ON))
return AH_FALSE;
+   } else if (ah-ah_config.ah_force_full_reset) {
+   if (!ar5416SetResetReg(ah, HAL_RESET_POWER_ON))
+   return AH_FALSE;
} else {
if (!ar5416SetResetReg(ah, HAL_RESET_WARM))
return AH_FALSE;

Modified: head/sys/dev/ath/if_ath_sysctl.c
==
--- head/sys/dev/ath/if_ath_sysctl.cWed Nov  9 05:25:30 2011
(r227374)
+++ head/sys/dev/ath/if_ath_sysctl.cWed Nov  9 05:30:24 2011
(r227375)
@@ -893,4 +893,9 @@ ath_sysctl_hal_attach(struct ath_softc *
SYSCTL_ADD_INT(ctx, child, OID_AUTO, swba_backoff, CTLFLAG_RW,
sc-sc_ah-ah_config.ah_additional_swba_backoff, 0,
Atheros HAL additional SWBA backoff time);
+
+   sc-sc_ah-ah_config.ah_force_full_reset = 0;
+   SYSCTL_ADD_INT(ctx, child, OID_AUTO, force_full_reset, CTLFLAG_RW,
+   sc-sc_ah-ah_config.ah_force_full_reset, 0,
+   Force full chip reset rather than a warm reset);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227376 - head/sys/dev/ath/ath_hal/ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 05:37:11 2011
New Revision: 227376
URL: http://svn.freebsd.org/changeset/base/227376

Log:
  Include some ANI fixes for the AR5416.
  
  * If we fall through from an ANI command (eg because it's out of range,
or it's disabled) then fall through to the next ANI command rather then
being stuck there.
  
  * Fix some off-by-one comparisons, meaning the final level in some parameters
were never tweaked.
  
  Obtained from:Atheros
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:30:24 
2011(r227375)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:37:11 
2011(r227376)
@@ -227,7 +227,7 @@ ar5416AniControl(struct ath_hal *ah, HAL
u_int level = param;
 
HALDEBUG(ah, HAL_DEBUG_ANI, %s: HAL_ANI_NOISE_IMMUNITY_LEVEL: 
set level = %d\n, __func__, level);
-   if (level = params-maxNoiseImmunityLevel) {
+   if (level  params-maxNoiseImmunityLevel) {
HALDEBUG(ah, HAL_DEBUG_ANI,
%s: immunity level out of range (%u  %u)\n,
__func__, level, params-maxNoiseImmunityLevel);
@@ -314,7 +314,7 @@ ar5416AniControl(struct ath_hal *ah, HAL
u_int level = param;
 
HALDEBUG(ah, HAL_DEBUG_ANI, %s: HAL_ANI_FIRSTEP_LEVEL: level = 
%d\n, __func__, level);
-   if (level = params-maxFirstepLevel) {
+   if (level  params-maxFirstepLevel) {
HALDEBUG(ah, HAL_DEBUG_ANI,
%s: firstep level out of range (%u  %u)\n,
__func__, level, params-maxFirstepLevel);
@@ -333,7 +333,7 @@ ar5416AniControl(struct ath_hal *ah, HAL
u_int level = param;
 
HALDEBUG(ah, HAL_DEBUG_ANI, %s: HAL_ANI_SPUR_IMMUNITY_LEVEL: 
level = %d\n, __func__, level);
-   if (level = params-maxSpurImmunityLevel) {
+   if (level  params-maxSpurImmunityLevel) {
HALDEBUG(ah, HAL_DEBUG_ANI,
%s: spur immunity level out of range (%u  %u)\n,
__func__, level, params-maxSpurImmunityLevel);
@@ -418,9 +418,9 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
 * raise firstep level 
 */
if (aniState-firstepLevel+1  params-maxFirstepLevel) 
{
-   ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
-aniState-firstepLevel + 1);
-   return;
+   if (ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
+aniState-firstepLevel + 1))
+   return;
}
} else if (rssi  params-rssiThrLow) {
/* 
@@ -432,9 +432,9 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION,
AH_TRUE);
if (aniState-firstepLevel+1  params-maxFirstepLevel)
-   ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
-aniState-firstepLevel + 1);
-   return;
+   if (ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
+aniState-firstepLevel + 1))
+   return;
} else {
/* 
 * Beacon rssi is low, if in 11b/g mode, turn off ofdm
@@ -447,9 +447,9 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION,
AH_FALSE);
if (aniState-firstepLevel  0)
-   ar5416AniControl(ah,
-HAL_ANI_FIRSTEP_LEVEL, 0);
-   return;
+   if (ar5416AniControl(ah,
+HAL_ANI_FIRSTEP_LEVEL, 0))
+   return;
}
}
}
@@ -729,41 +729,41 @@ ar5416AniLowerImmunity(struct ath_hal *a
 * detection or lower firstep level.
 */
if (aniState-ofdmWeakSigDetectOff) {
-   ar5416AniControl(ah,
+   if (ar5416AniControl(ah,

svn commit: r227377 - head/sys/dev/ath/ath_hal/ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 05:39:17 2011
New Revision: 227377
URL: http://svn.freebsd.org/changeset/base/227377

Log:
  .. and add some ANI fixes missing from the last ANI commit.
  
  Obtained from:Atheros
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:37:11 
2011(r227376)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:39:17 
2011(r227377)
@@ -384,18 +384,16 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
aniState = ahp-ah_curani;
params = aniState-params;
/* First, raise noise immunity level, up to max */
-   if ((AH5416(ah)-ah_ani_function  (1  HAL_ANI_NOISE_IMMUNITY_LEVEL)) 

-   (aniState-noiseImmunityLevel+1  params-maxNoiseImmunityLevel)) {
-   ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL, 
-aniState-noiseImmunityLevel + 1);
-   return;
+   if (aniState-noiseImmunityLevel+1  params-maxNoiseImmunityLevel) {
+   if (ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL, 
+aniState-noiseImmunityLevel + 1))
+   return;
}
/* then, raise spur immunity level, up to max */
-   if ((AH5416(ah)-ah_ani_function  (1  HAL_ANI_SPUR_IMMUNITY_LEVEL)) 

-   (aniState-spurImmunityLevel+1  params-maxSpurImmunityLevel)) {
-   ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL,
-aniState-spurImmunityLevel + 1);
-   return;
+   if (aniState-spurImmunityLevel+1  params-maxSpurImmunityLevel) {
+   if (ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL,
+aniState-spurImmunityLevel + 1))
+   return;
}
 
if (ANI_ENA_RSSI(ah)) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227378 - head/sys/dev/ath/ath_hal/ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 05:41:40 2011
New Revision: 227378
URL: http://svn.freebsd.org/changeset/base/227378

Log:
  Add logic to ANI to tweak the firstep parameter when in hostap mode.
  This is normally done based on the beacon RSSI but this isn't available
  in hostap mode.
  
  Obtained from:Atheros
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:39:17 
2011(r227377)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:41:40 
2011(r227378)
@@ -396,6 +396,18 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
return;
}
 
+   /*
+* In the case of AP mode operation, we cannot bucketize beacons
+* according to RSSI.  Instead, raise Firstep level, up to max, and
+* simply return.
+*/
+   if (AH_PRIVATE(ah)-ah_opmode == HAL_M_HOSTAP) {
+   if (aniState-firstepLevel  params-maxFirstepLevel) {
+   if (ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
+   aniState-firstepLevel + 1))
+   return;
+   }
+   }
if (ANI_ENA_RSSI(ah)) {
int32_t rssi = BEACON_RSSI(ahp);
if (rssi  params-rssiThrHigh) {
@@ -713,6 +725,19 @@ ar5416AniLowerImmunity(struct ath_hal *a
 
aniState = ahp-ah_curani;
params = aniState-params;
+
+   /*
+* In the case of AP mode operation, we cannot bucketize beacons
+* according to RSSI.  Instead, lower Firstep level, down to min, and
+* simply return.
+*/
+   if (AH_PRIVATE(ah)-ah_opmode == HAL_M_HOSTAP) {
+   if (aniState-firstepLevel  0) {
+   if (ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
+   aniState-firstepLevel - 1))
+   return;
+   }
+   }
if (ANI_ENA_RSSI(ah)) {
int32_t rssi = BEACON_RSSI(ahp);
if (rssi  params-rssiThrHigh) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227379 - head/sys/dev/ath/ath_hal/ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 05:43:48 2011
New Revision: 227379
URL: http://svn.freebsd.org/changeset/base/227379

Log:
  Use a restricted set of parameters when operating in hostap mode.
  
  The 5ghz hostap mode (where DFS is being done) requires ANI to be disabled
  or the radar detection parameters don't work as advertised (as they're based
  on signal strength level, and tweaking ANI affects the signal strangth,
  dynamic range and power increase the baseband is looking for in order to
  detect it as a signal.)
  
  Obtained from:Linux, Atheros
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:41:40 
2011(r227378)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:43:48 
2011(r227379)
@@ -592,6 +592,16 @@ ar5416AniReset(struct ath_hal *ah, const
goto finish;
}
 
+   /*
+* Use a restrictive set of ANI parameters for hostap mode.
+*/
+   if (opmode == HAL_M_HOSTAP) {
+   if (IEEE80211_IS_CHAN_2GHZ(chan))
+   AH5416(ah)-ah_ani_function =
+   HAL_ANI_SPUR_IMMUNITY_LEVEL | HAL_ANI_FIRSTEP_LEVEL;
+   else
+   AH5416(ah)-ah_ani_function = 0;
+   }
 
/*
 * Automatic processing is done only in station mode right now.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227380 - head/sys/dev/ath/ath_hal/ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 05:45:30 2011
New Revision: 227380
URL: http://svn.freebsd.org/changeset/base/227380

Log:
  Disable OFDM weak signal detection by default. Leave this to be
  enabled if required by STA operation.
  
  This quietens a lot of OFDM errors seen in hostap mode, where
  there are no beacon RSSI levels to tune the dynamic range of the
  baseband.
  
  This may reduce reception range at the fringes, but does increase
  stability.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:43:48 
2011(r227379)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:45:30 
2011(r227380)
@@ -631,7 +631,7 @@ ar5416AniReset(struct ath_hal *ah, const
ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL, 0);
ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL, 0);
ar5416AniControl(ah, HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION,
-   AH_TRUE);
+   AH_FALSE);
ar5416AniControl(ah, HAL_ANI_CCK_WEAK_SIGNAL_THR, AH_FALSE);
ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL, 0);
ichan-privFlags |= CHANNEL_ANI_SETUP;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227381 - head/sys/dev/ath/ath_hal/ar5416

2011-11-08 Thread Adrian Chadd
Author: adrian
Date: Wed Nov  9 05:48:20 2011
New Revision: 227381
URL: http://svn.freebsd.org/changeset/base/227381

Log:
  Migrate the AR5416 ANI code to use the previously introduced method
  to fetch the current channel busy statistics, rather than duplicating
  it here.
  
  This forms the (very crude) basis for doing basic channel surveying.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:45:30 
2011(r227380)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cWed Nov  9 05:48:20 
2011(r227381)
@@ -815,15 +815,15 @@ ar5416AniGetListenTime(struct ath_hal *a
 {
struct ath_hal_5212 *ahp = AH5212(ah);
struct ar5212AniState *aniState;
-   uint32_t txFrameCount, rxFrameCount, cycleCount;
+   uint32_t rxc_pct, extc_pct, rxf_pct, txf_pct;
int32_t listenTime;
+   int good;
 
-   txFrameCount = OS_REG_READ(ah, AR_TFCNT);
-   rxFrameCount = OS_REG_READ(ah, AR_RFCNT);
-   cycleCount = OS_REG_READ(ah, AR_CCCNT);
+   good = ar5416GetMibCycleCountsPct(ah,
+   rxc_pct, extc_pct, rxf_pct, txf_pct);
 
aniState = ahp-ah_curani;
-   if (aniState-cycleCount == 0 || aniState-cycleCount  cycleCount) {
+   if (good == 0) {
/*
 * Cycle counter wrap (or initial call); it's not possible
 * to accurately calculate a value because the registers
@@ -832,14 +832,18 @@ ar5416AniGetListenTime(struct ath_hal *a
listenTime = 0;
ahp-ah_stats.ast_ani_lzero++;
} else {
-   int32_t ccdelta = cycleCount - aniState-cycleCount;
-   int32_t rfdelta = rxFrameCount - aniState-rxFrameCount;
-   int32_t tfdelta = txFrameCount - aniState-txFrameCount;
+   int32_t ccdelta = AH5416(ah)-ah_cycleCount - 
aniState-cycleCount;
+   int32_t rfdelta = AH5416(ah)-ah_rxBusy - 
aniState-rxFrameCount;
+   int32_t tfdelta = AH5416(ah)-ah_txBusy - 
aniState-txFrameCount;
listenTime = (ccdelta - rfdelta - tfdelta) / CLOCK_RATE;
}
-   aniState-cycleCount = cycleCount;
-   aniState-txFrameCount = txFrameCount;
-   aniState-rxFrameCount = rxFrameCount;
+   aniState-cycleCount = AH5416(ah)-ah_cycleCount;
+   aniState-txFrameCount = AH5416(ah)-ah_rxBusy;
+   aniState-rxFrameCount = AH5416(ah)-ah_txBusy;
+
+   HALDEBUG(ah, HAL_DEBUG_ANI, rxc=%d, extc=%d, rxf=%d, txf=%d\n,
+   rxc_pct, extc_pct, rxf_pct, txf_pct);
+
return listenTime;
 }
 
@@ -906,10 +910,13 @@ ar5416AniPoll(struct ath_hal *ah, const 
/* XXX can aniState be null? */
if (aniState == AH_NULL)
return;
+
+   /* Always update from the MIB, for statistics gathering */
+   listenTime = ar5416AniGetListenTime(ah);
+
if (!ANI_ENA(ah))
return;
 
-   listenTime = ar5416AniGetListenTime(ah);
if (listenTime  0) {
ahp-ah_stats.ast_ani_lneg++;
/* restart ANI period if listenTime is invalid */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r227366 - in head/etc: . rc.d

2011-11-08 Thread Valentin Nechayev
 Wed, Nov 09, 2011 at 01:49:16, danfe wrote about Re: svn commit: r227366 - in 
head/etc: . rc.d: 

rc.d: Eliminate some unnecessary non-POSIX constructs:

 * ^ in character class
  
  -   for file in ${dir}/[^0-9]*.sh; do
  +   for file in ${dir}/[!0-9]*.sh; do
 
 I don't have my copy of POSIX handy, but looking at SUSv2, circumflex `^' is
 documented as non-matching list expression specifier, while `!' is not.
 
 I am reading it wrong?

You are right - Posix.1-2008 says the same - '^' as matching reverse and
nothing for '!'

cite
A non-matching list expression begins with a circumflex ( '^' ),   
and specifies a list that shall match any single-character   
collating element except for the expressions represented in the  
list after the leading circumflex.
/cite


-netch-
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227382 - in head/sys/ufs: ffs ufs

2011-11-08 Thread Gleb Kurtsou
Author: gleb
Date: Wed Nov  9 07:48:48 2011
New Revision: 227382
URL: http://svn.freebsd.org/changeset/base/227382

Log:
  Use implementation independent inoNN_t scalars for on-disk UFS structures
  
  Approved by:  mdf (mentor)

Modified:
  head/sys/ufs/ffs/fs.h
  head/sys/ufs/ufs/dinode.h

Modified: head/sys/ufs/ffs/fs.h
==
--- head/sys/ufs/ffs/fs.h   Wed Nov  9 05:48:20 2011(r227381)
+++ head/sys/ufs/ffs/fs.h   Wed Nov  9 07:48:48 2011(r227382)
@@ -338,7 +338,7 @@ struct fs {
ufs2_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */
int64_t  fs_pendingblocks;  /* (u) blocks being freed */
u_int32_t fs_pendinginodes; /* (u) inodes being freed */
-   ino_tfs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */
+   uint32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */
u_int32_t fs_avgfilesize;   /* expected average file size */
u_int32_t fs_avgfpdir;  /* expected # of files per directory */
int32_t  fs_save_cgsize;/* save real cg size to use fs_bsize */
@@ -695,11 +695,11 @@ struct jsegrec {
  */
 struct jrefrec {
uint32_tjr_op;
-   ino_t   jr_ino;
-   ino_t   jr_parent;
+   uint32_tjr_ino;
+   uint32_tjr_parent;
uint16_tjr_nlink;
uint16_tjr_mode;
-   off_t   jr_diroff;
+   int64_t jr_diroff;
uint64_tjr_unused;
 };
 
@@ -709,11 +709,11 @@ struct jrefrec {
  */
 struct jmvrec {
uint32_tjm_op;
-   ino_t   jm_ino;
-   ino_t   jm_parent;
+   uint32_tjm_ino;
+   uint32_tjm_parent;
uint16_tjm_unused;
-   off_t   jm_oldoff;
-   off_t   jm_newoff;
+   int64_t jm_oldoff;
+   int64_t jm_newoff;
 };
 
 /*
@@ -737,7 +737,7 @@ struct jblkrec {
 struct jtrncrec {
uint32_tjt_op;
uint32_tjt_ino;
-   off_t   jt_size;
+   int64_t jt_size;
uint32_tjt_extsize;
uint32_tjt_pad[3];
 };

Modified: head/sys/ufs/ufs/dinode.h
==
--- head/sys/ufs/ufs/dinode.h   Wed Nov  9 05:48:20 2011(r227381)
+++ head/sys/ufs/ufs/dinode.h   Wed Nov  9 07:48:48 2011(r227382)
@@ -146,7 +146,7 @@ struct ufs2_dinode {
ufs2_daddr_tdi_db[NDADDR];  /* 112: Direct disk blocks. */
ufs2_daddr_tdi_ib[NIADDR];  /* 208: Indirect disk blocks. */
u_int64_t   di_modrev;  /* 232: i_modrev for NFSv4 */
-   ino_t   di_freelink;/* 240: SUJ: Next unlinked inode. */
+   uint32_tdi_freelink;/* 240: SUJ: Next unlinked inode. */
uint32_tdi_spare[3];/* 244: Reserved; currently unused */
 };
 
@@ -168,7 +168,7 @@ struct ufs2_dinode {
 struct ufs1_dinode {
u_int16_t   di_mode;/*   0: IFMT, permissions; see below. */
int16_t di_nlink;   /*   2: File link count. */
-   ino_t   di_freelink;/*   4: SUJ: Next unlinked inode. */
+   uint32_tdi_freelink;/*   4: SUJ: Next unlinked inode. */
u_int64_t   di_size;/*   8: File byte count. */
int32_t di_atime;   /*  16: Last access time. */
int32_t di_atimensec;   /*  20: Last access time. */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org