Commit Graph

1336 Commits

Author SHA1 Message Date
Adrian Chadd
92b9076a70 If EEPROM data is provided by the AHB layer, copy it in.
This is required for the flash layer code to correctly work.

Tested:

* AR9330 SoC (carambola 2)
2013-06-26 04:53:33 +00:00
Adrian Chadd
860487123c Re-enable the channel set code for the AR933x.
This required a HAL change to map the 2GHz frequency back to an IEEE
channel number in order to fetch some value(s) to program in.
2013-06-26 04:46:43 +00:00
Adrian Chadd
9855e2aff2 In preparation to support AR933x SoC builds, allow the AH_SUPPORT_AR93(xx)
options to set the AR9300 HAL defines.

This enables the Wasp, Hornet (and later Scorpion) SoC code.
2013-06-26 04:34:45 +00:00
Adrian Chadd
a778f8a19a Add a stub AR93xx RF module just to keep the linker happy.
When building AR933x test images, I'd like to only build only the ar9300
HAL.  To do this, it needs to supply an RF linker entry or it won't compile.

Tested:

* AR933x test builds
2013-06-26 04:33:57 +00:00
Adrian Chadd
8ccb8e813f The AR9300 HAL uses this config to program AR_PHY_SWITCH_COM_2 on AR9485
NICs which have bluetooth coexistence enabled.

The WB225 NIC has the common antenna switch configuration set to 0x0 which
disables all external switch bit setting. This obviously won't work when
doing coexistence.

This value is a magic value from the windows .inf files. It _looks_ right
but I haven't yet verified it - unfortunately my AR9285+AR3012 BT combo
has an earlier BT device which doesn't actually _have_ firmware on it.
So I have to fix ath3kfw to handle loading in firmware into the newer
NICs before I can finish testing this.

This may not hold true for CUS198, which is another custom AR9485 board.
2013-06-14 08:15:28 +00:00
Adrian Chadd
429eba61c2 Flip on AH_PRIVATE_DIAG by default; this will include the AR9300 EEPROM
dump code that is worth having around.
2013-06-14 08:13:21 +00:00
Adrian Chadd
b5ddd8005c Add bluetooth setup method functions to the HAL. 2013-06-14 06:15:23 +00:00
Adrian Chadd
94d5d4ada1 If chan is NULL, don't derefrence it.
The bluetooth setup code actually does a channel lookup during setup,
even though we haven't yet programmed in a channel. Sigh.

Tested:

* WB225 (AR9485) + bluetooth
2013-06-14 06:14:49 +00:00
Adrian Chadd
d9006e5951 Set the FreeBSD capability bit to indicate that LNA diversity is enabled.
This is true for the AR9485 and AR933x SoC.
2013-06-13 02:20:45 +00:00
Adrian Chadd
f4af8a6a62 Return HAL_ANT_VARIABLE for now, until it's unstubbed.
This is needed by the slow antenna diversity logic for the AR9485/AR9462
as it's only engaged if the TX diveristy is set to VARIABLE.
2013-06-13 02:19:53 +00:00
Adrian Chadd
a987ae075f Tie in the LNA diversity configuration functions into the HAL. 2013-06-12 15:23:17 +00:00
Adrian Chadd
6ba04f0d20 Fix a false -> AH_FALSE.
Now, why this hasn't tripped _any_ tinderbox builds yet, I dunno.
It's been like this for a while.
2013-05-29 04:21:42 +00:00
Jung-uk Kim
a9d8d09c46 Merge ACPICA 20130517. 2013-05-20 23:52:49 +00:00
Warner Losh
7adaa27093 Turns out that there really isn't an RTC chip on this board, at all. 2013-05-12 01:29:18 +00:00
Warner Losh
474d77509e Make the read/write routines default to the newer DS1337 part, but keep
the supported bits board specific.
2013-05-10 06:28:01 +00:00
Warner Losh
3bec6ae787 As requested, move this back to opt-in and list my boards. 2013-05-10 04:49:40 +00:00
Warner Losh
6346a0d0f6 Remove the commented out code I just committed. If we need it, I'll
bring it back uncommented our, or rewrite it.
2013-05-10 04:30:14 +00:00
Warner Losh
856099a320 Add support from GE Intelligent Platform Cavium Octeon boards. Add
options OCTEON_VENDOR_GEFES to enable support for these boards, to
match changes that GE publishes to the Octeon Simple Executive. Since
board types overlap with other boards, it is unlikely that we will
properly boot on other Octeon boards with OCTEON_VENDOR_GEFES enabled.
Tested extensively on the WANIC 6354, but I retained support for all
the other models. Some features need changes in the base kernel, and
those are in progress.
2013-05-10 03:04:45 +00:00
Warner Losh
751d46b795 Both my EBH5200 and GE WANIC 6354 have a RTC as well. It looks from
the Linux tree that they always include this chip in their FDT, so
make support for the ds1337 opt-out rather than opt-in. Now my boards
boot with the correct time.
2013-05-10 02:57:46 +00:00
Jung-uk Kim
be4147dd7c MFV: r250336
Fix for _INI regression introduced in version 20130328.
2013-05-08 00:20:35 +00:00
Warner Losh
086e2ac533 Expose cvmx_mgmt_port_num_ports() as a wrapper to the static
__cvmx_mgmt_port_num_ports() mostly to avoid exporting a function
starting with __.
2013-05-02 19:45:53 +00:00
Adrian Chadd
0efc449468 Fix this code to compile without warnings - AH_DEBUG was pulling in
ichan, but OS_MARK was not using it.  It only uses it when
AH_DEBUG_ALQ is also defined.
2013-05-02 07:02:23 +00:00
Adrian Chadd
2f544eedb3 Add device identification and probe/attach support for the QCA9565.
The QCA9565 is a 1x1 2.4GHz 11n chip with integrated on-chip bluetooth.
The AR9300 HAL already has support for this chip; it just wasn't
included in the probe/attach path.

Tested:

* This commit brought to you over a QCA9565 wifi connection from
  FreeBSD.
* .. ie, basic STA, pings, no iperf or antenna diversity checking just yet.
2013-05-02 00:59:39 +00:00
Eitan Adler
7a48925d12 Fix incorrect sizeof() in bzero()
Submitted by:	swildner@DragonFlyBSD.org
Reviewed by:	alfred, jmallett
2013-05-01 04:37:45 +00:00
Adrian Chadd
a371ba805e Disable TXCONT, it's not here in FreeBSD. 2013-05-01 01:50:33 +00:00
Adrian Chadd
fffa0eea61 There's no HAL_EEPROM in FreeBSD - use ar9300_eeprom_t instead. 2013-05-01 01:49:00 +00:00
Adrian Chadd
d82f130e70 Sync from git - ah_config is in 'ath_hal', not 'ath_hal_private' on
FreeBSD.
2013-04-29 23:57:41 +00:00
Adrian Chadd
e113789bdc Bring over my FreeBSD modifications for the AR9300 HAL to make it
work in FreeBSD.

This is still heavily a work in progress but I'd rather it start
shipping in -HEAD sooner rather than later.

This doesn't (yet) link it into the build system either for a static
kernel or as a module; that will come later (after many, many make universe
tests.)
2013-04-28 00:57:47 +00:00
Adrian Chadd
76bd547b9c Copy the vendor branch ar9300 code from qcamain_open_hal into this
directory.

Only copy the ar9300 HAL, we don't want to grab everything.
2013-04-28 00:53:31 +00:00
Jung-uk Kim
895f26a936 Merge ACPICA 20130418. 2013-04-19 23:49:34 +00:00
Gleb Smirnoff
22e71d1cc4 Forcibly defining _KERNEL is bad idea. Toss some code so that ip_var.h
isn't included with forced _KERNEL define.
2013-04-08 19:20:27 +00:00
Jung-uk Kim
9c7c683c56 Merge ACPICA 20130328. 2013-04-04 22:11:30 +00:00
Gleb Smirnoff
fa0fbaece3 Simplify TAILQ usage and avoid additional memory allocations.
Tested by:	Eugene M. Zheganin <emz norma.perm.ru>
Sponsored by:	Nginx, Inc
2013-03-05 08:08:16 +00:00
Jung-uk Kim
9c48c75ed6 Merge ACPICA 20130214. 2013-02-15 20:36:28 +00:00
Jung-uk Kim
6f4860fc7d Merge two bug fixes from the vendor branch.
Reported by:	pjd
2013-01-28 20:37:32 +00:00
Jung-uk Kim
255334d108 Fix another build breakage for ia64. 2013-01-21 21:26:42 +00:00
Juli Mallett
a9e4eb6929 Fix packet reception and other issues arising from incorrect ASX clock
configuration on the physical ports of the Ubiquiti EdgeRouter Lite.
2013-01-21 06:47:06 +00:00
Jung-uk Kim
10c281ab92 Work around build breakage with GCC 4.2. 2013-01-19 00:37:17 +00:00
Jung-uk Kim
efcc2a3054 Merge ACPICA 20130117. 2013-01-17 23:56:43 +00:00
Juli Mallett
161aae1a7a Use the right USB clock type on the EdgeRouter Lite. This fixes USB. 2013-01-02 23:29:54 +00:00
Juli Mallett
b29648facd Add basic support for the Ubiquiti EdgeRouter Lite.
Note that USB does not currently work, and the flash is connected via USB, so
local storage is not working.
2013-01-02 23:17:50 +00:00
Juli Mallett
527ca1d99c Allow this file to build on FreeBSD. 2012-11-27 02:03:41 +00:00
Juli Mallett
ea716a4f24 o) Have the FreeBSD kernel option "INVARIANTS" trickle down into the Simple
Executive code where similar invariant knobs exist.
o) Make the Simple Executive's warning function print "WARNING: " on the same
   line as the warning it is displaying, rather than on a separate line.
2012-11-24 02:55:05 +00:00
Juli Mallett
85129b4bd4 Use bootverbose to control debug printfs from the Cavium Simple Executive
code.  Also remove an unnecessary CVMX_ENABLE_DEBUG_PRINTS conditional around
what is already a cvmx_dprintf.
2012-11-24 02:12:24 +00:00
Juli Mallett
01a310bd57 o) Add support for specifying a model of Octeon to target at compile-time,
reducing the number of runtime checks done by the SDK code.
o) Group board/CPU information at early startup by subject matter, so that e.g.
   CPU information is adjacent to CPU information and board information is
   adjacent to board information.
2012-11-24 02:00:29 +00:00
Jung-uk Kim
ed17e06e2c Merge ACPICA 20121114. 2012-11-20 21:01:59 +00:00
Juli Mallett
b3a6fcb3b7 Return port numbers for ATCA-7220 SPI interfaces in a different place for
consistency reasons, and to ensure that CRC addition is disabled on output.
With this, transmit seems to be working properly on the ATCA-7220.
2012-11-19 08:35:58 +00:00
Juli Mallett
72d324fab6 Fix packet receive on the ATCA-7220 by disabling FCS-related checks, since the
FCS is stripped by the underlying hardware before it reaches the Octeon.
2012-11-19 05:24:33 +00:00
Juli Mallett
9dea12b4a2 Fix build for FreeBSD kernel. 2012-11-13 07:33:45 +00:00
Dimitry Andric
31edd45d7b In sys/contrib/ngatm/netnatm/msg/uni_ie.c, fix a few warnings from newer
versions of clang 3.2, about comparing enum uni_cause values against
integer constants which fall outside the enum range.  No functional
change.

MFC after:	3 days
2012-11-05 19:00:25 +00:00
Juli Mallett
72a4047ca7 Handle the management port on the EBT5600 and disable loopback. The XAUI
port connected to the Broadcom switch does not seem operable, but it's unclear
if that's simply due to a lack of configuration information for the switch.
The switch does not seem to present any identifying information via MDIO,
and is a BCM56512.
2012-11-01 03:45:33 +00:00
Juli Mallett
684ba62e3f Speed feature tests and initialize helper configuration that some CPUs require. 2012-10-30 06:07:30 +00:00
Juli Mallett
1f51baaa92 Use Simple Executive LED display routines, which correctly use the LED base
address passed from the bootloader, rather than using a hard-coded value.

Make FreeBSD announce itself on the LED display similar to other kernels.

Remove uses of the previous LED routines, which were under-used and only used
in drivers for what seem like debugging purposes, despite those drivers being
widely-tested.

Remove several inlines for accessing memory that duplicate other functions
which are now used instead, as they are now entirely unused.
2012-10-29 00:51:53 +00:00
Juli Mallett
cb5add636f No MII on the RSYS4GBE (AMC-7211/ATCA-7220). 2012-10-26 02:09:55 +00:00
Juli Mallett
320a9376e9 Add support for Radisys as a vendor of Octeon hardware. Add some preliminary
support for what their boot loader refers to as the "RSYS4GBE", of which there
are two instances ("Data Processing Blocks") on the Radisys ATCA-7220.
2012-10-26 00:08:50 +00:00
Jung-uk Kim
8ef1a33100 Merge ACPICA 20121018. 2012-10-23 23:49:17 +00:00
Gleb Smirnoff
40dd089521 Fix defines in r241245. We actually don't define FreeBSD.
Reported & tested by:	Oleg Ginzburg
2012-10-14 15:03:06 +00:00
Kevin Lo
9823d52705 Revert previous commit...
Pointyhat to:	kevlo (myself)
2012-10-10 08:36:38 +00:00
Kevin Lo
a10cee30c9 Prefer NULL over 0 for pointers 2012-10-09 08:27:40 +00:00
Gleb Smirnoff
21d172a3f1 A step in resolving mess with byte ordering for AF_INET. After this change:
- All packets in NETISR_IP queue are in net byte order.
  - ip_input() is entered in net byte order and converts packet
    to host byte order right _after_ processing pfil(9) hooks.
  - ip_output() is entered in host byte order and converts packet
    to net byte order right _before_ processing pfil(9) hooks.
  - ip_fragment() accepts and emits packet in net byte order.
  - ip_forward(), ip_mloopback() use host byte order (untouched actually).
  - ip_fastforward() no longer modifies packet at all (except ip_ttl).
  - Swapping of byte order there and back removed from the following modules:
    pf(4), ipfw(4), enc(4), if_bridge(4).
  - Swapping of byte order added to ipfilter(4), based on __FreeBSD_version
  - __FreeBSD_version bumped.
  - pfil(9) manual page updated.

Reviewed by:	ray, luigi, eri, melifaro
Tested by:	glebius (LE), ray (BE)
2012-10-06 10:02:11 +00:00
Max Khon
617643aaa6 Fix pseudo checksum calculation.
This fixes ipfilter w/ network controllers that implement only
partial rx csum offloading.

PR:			106438
Obtained from:		upstream
MFC after:		1 week
2012-09-27 18:15:01 +00:00
Gleb Smirnoff
486e090204 Fix panic introduced by me in r240835, when zero weight
was passed to wtab_alloc().

Reported by:	Kim Culhan <w8hdkim gmail.com>
2012-09-25 12:45:41 +00:00
Gleb Smirnoff
e9e4cb7345 Use M_NOWAIT in wtab_alloc(), too. Convert panic() to
a soft failure here. wtab_alloc() is used by red_alloc(),
which can fail.

Reported by:	Kim Culhan <w8hdkim gmail.com>
2012-09-22 18:47:14 +00:00
Pawel Jakub Dawidek
a6512306ce Fix an obvious typo. 2012-09-22 17:41:56 +00:00
Gleb Smirnoff
03fb709e1f Convert more M_WAITOK malloc() to M_NOWAIT.
Reported by:	Kim Culhan <w8hdkim gmail.com>
2012-09-22 12:49:36 +00:00
Rui Paulo
b0bf1a1836 Remove #ident macro. 2012-09-21 19:18:39 +00:00
Kevin Lo
b7e1113e8f Fix typo: s/pakcet/packet 2012-09-20 03:29:43 +00:00
Jung-uk Kim
042ff955b5 Merge ACPICA 20120913. 2012-09-19 23:25:24 +00:00
Gleb Smirnoff
32726fe911 Do more than r236298 did in the projects/pf branch: use M_NOWAIT in
altq_add() and its descendants. Currently altq(4) in FreeBSD is configured
via pf(4) ioctls, which can't configure altq(4) w/o holding locks.
Fortunately, altq(4) code in spife of using M_WAITOK is ready to receive
NULL from malloc(9), so change is mostly mechanical. While here, utilize
M_ZERO instead of bzero().

A large redesign needed to achieve M_WAITOK usage when configuring altq(4).
Or an alternative (not pf(4)) configuration interface should be implemented.

Reported by:	pluknet
2012-09-18 12:34:35 +00:00
Gleb Smirnoff
3b3a8eb937 o Create directory sys/netpfil, where all packet filters should
reside, and move there ipfw(4) and pf(4).

o Move most modified parts of pf out of contrib.

Actual movements:

sys/contrib/pf/net/*.c		-> sys/netpfil/pf/
sys/contrib/pf/net/*.h		-> sys/net/
contrib/pf/pfctl/*.c		-> sbin/pfctl
contrib/pf/pfctl/*.h		-> sbin/pfctl
contrib/pf/pfctl/pfctl.8	-> sbin/pfctl
contrib/pf/pfctl/*.4		-> share/man/man4
contrib/pf/pfctl/*.5		-> share/man/man5

sys/netinet/ipfw		-> sys/netpfil/ipfw

The arguable movement is pf/net/*.h -> sys/net. There are
future plans to refactor pf includes, so I decided not to
break things twice.

Not modified bits of pf left in contrib: authpf, ftp-proxy,
tftp-proxy, pflogd.

The ipfw(4) movement is planned to be merged to stable/9,
to make head and stable match.

Discussed with:		bz, luigi
2012-09-14 11:51:49 +00:00
Gleb Smirnoff
d6d3f01e0a Merge the projects/pf/head branch, that was worked on for last six months,
into head. The most significant achievements in the new code:

 o Fine grained locking, thus much better performance.
 o Fixes to many problems in pf, that were specific to FreeBSD port.

New code doesn't have that many ifdefs and much less OpenBSDisms, thus
is more attractive to our developers.

  Those interested in details, can browse through SVN log of the
projects/pf/head branch. And for reference, here is exact list of
revisions merged:

r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330,
r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656,
r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782,
r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868,
r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223,
r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456,
r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505,
r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168,
r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230,
r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398,
r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548,
r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672,
r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169,
r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442,
r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522,
r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661,
r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.

I'd like to thank people who participated in early testing:

Tested by:	Florian Smeets <flo freebsd.org>
Tested by:	Chekaluk Vitaly <artemrts ukr.net>
Tested by:	Ben Wilber <ben desync.com>
Tested by:	Ian FREISLICH <ianf cloudseed.co.za>
2012-09-08 06:41:54 +00:00
Jung-uk Kim
1df130f1d4 Merge ACPICA 20120816. 2012-08-16 20:54:52 +00:00
Warner Losh
52baf267be Update to latest git version of dtc to get new dtsv2 support,
including the include directive.

Fix minor build issue corrected by converting yypush_buffer_state and
yypop_buffer_state to yy_set_buffer_state and a hard-coded 100-deep
stack.  It was easier to fix it here than to import that support into
our flex.

The new tools and test hardness remain unsupported at the moment.
2012-07-24 16:29:33 +00:00
Gleb Smirnoff
6aef0416fb Use M_NOWAIT while holding the pf giant lock. 2012-07-15 19:10:00 +00:00
Jung-uk Kim
e8241eabbb Merge ACPICA 20120711. 2012-07-11 23:18:35 +00:00
Jung-uk Kim
3e2c973410 MFV: r237650
Do not malloc(9) while holding a spin lock, to avoid panic.

Reported by:	kib (and many others)
Tested by:	kib (and many others)
2012-06-27 16:15:13 +00:00
Bernhard Schmidt
2289f9b47e Add new firmware for the g2a (6205) and g2b (623x) devices.
MFC after:	3 days
2012-06-27 16:14:28 +00:00
Jung-uk Kim
f38b0f210c Merge ACPICA 20120620. 2012-06-22 00:40:44 +00:00
Navdeep Parhar
09fe63205c - Updated TOE support in the kernel.
- Stateful TCP offload drivers for Terminator 3 and 4 (T3 and T4) ASICs.
  These are available as t3_tom and t4_tom modules that augment cxgb(4)
  and cxgbe(4) respectively.  The cxgb/cxgbe drivers continue to work as
  usual with or without these extra features.

- iWARP driver for Terminator 3 ASIC (kernel verbs).  T4 iWARP in the
  works and will follow soon.

Build-tested with make universe.

30s overview
============
What interfaces support TCP offload?  Look for TOE4 and/or TOE6 in the
capabilities of an interface:
# ifconfig -m | grep TOE

Enable/disable TCP offload on an interface (just like any other ifnet
capability):
# ifconfig cxgbe0 toe
# ifconfig cxgbe0 -toe

Which connections are offloaded?  Look for toe4 and/or toe6 in the
output of netstat and sockstat:
# netstat -np tcp | grep toe
# sockstat -46c | grep toe

Reviewed by:	bz, gnn
Sponsored by:	Chelsio communications.
MFC after:	~3 months (after 9.1, and after ensuring MFC is feasible)
2012-06-19 07:34:13 +00:00
Gleb Smirnoff
40874f18de Merge revision 1.715 from OpenBSD:
date: 2010/12/24 20:12:56;  author: henning;  state: Exp;  lines: +3 -3
  in pf_src_connlimit, the indices to sk->addr were swapped.
  tracked down and diff sent by Robert B Mills <rbmills at sdf.lonestar.org>
  thanks, very good work! ok claudio

Impact is that the "flush" keyword didn't work.

Obtained from:	OpenBSD
MFC after:	1 week
2012-06-06 09:36:52 +00:00
Ermal Luçi
0ad5ef9c8f Correct table counter functionality to not panic.
This was caused by not proper initialization of necessary parameters.

PR: 168200
Reviewed by:	bz@, glebius@
MFC after:	1 week
2012-05-31 20:10:05 +00:00
Jung-uk Kim
a7a3b383f2 Merge ACPICA 20120518. 2012-05-24 23:12:30 +00:00
Alexander V. Chernikov
bdf942c3f0 Revert r234834 per luigi@ request.
Cleaner solution (e.g. adding another header) should be done here.

Original log:
  Move several enums and structures required for L2 filtering from ip_fw_private.h to ip_fw.h.
  Remove ipfw/ip_fw_private.h header from non-ipfw code.

Requested by:      luigi
Approved by:       kib(mentor)
2012-05-03 08:56:43 +00:00
Alexander V. Chernikov
7bd5e9b143 Move several enums and structures required for L2 filtering from ip_fw_private.h to ip_fw.h.
Remove ipfw/ip_fw_private.h header from non-ipfw code.

Approved by:        ae(mentor)
MFC after:          2 weeks
2012-04-30 10:22:23 +00:00
Jung-uk Kim
eef1b955be Merge ACPICA 20120420. 2012-04-23 23:05:14 +00:00
Dimitry Andric
a511762672 Fix the following compilation warnings in sys/contrib/rdma/rdma_cma.c:
sys/contrib/rdma/rdma_cma.c:1259:8: error: case value not in enumerated type 'enum iw_cm_event_status' [-Werror,-Wswitch]
	      case ECONNRESET:
		   ^
  @/sys/errno.h:118:20: note: expanded from macro 'ECONNRESET'
  #define ECONNRESET      54              /* Connection reset by peer */
		      ^
  sys/contrib/rdma/rdma_cma.c:1263:8: error: case value not in enumerated type 'enum iw_cm_event_status' [-Werror,-Wswitch]
	      case ETIMEDOUT:
		   ^
  @/sys/errno.h:124:19: note: expanded from macro 'ETIMEDOUT'
  #define ETIMEDOUT       60              /* Operation timed out */
		      ^
  sys/contrib/rdma/rdma_cma.c:1260:8: error: case value not in enumerated type 'enum iw_cm_event_status' [-Werror,-Wswitch]
	      case ECONNREFUSED:
		   ^
  @/sys/errno.h:125:22: note: expanded from macro 'ECONNREFUSED'
  #define ECONNREFUSED    61              /* Connection refused */
		      ^

This is because the switch uses iw_cm_event::status, which is an enum
iw_cm_event_status, while ECONNRESET, ETIMEDOUT and ECONNREFUSED are
just plain defines from errno.h.

It looks like there is only one use of any of the enumeration values of
iw_cm_event_status, in:

  sys/contrib/rdma/rdma_iwcm.c: 	if (iw_event->status == IW_CM_EVENT_STATUS_ACCEPTED) {

So messing around with the enum definitions to fix the warning seems too
disruptive; the simplest fix is to cast the argument of the switch to
int.

Reviewed by:	kmacy
MFC after:	1 week
2012-04-20 21:52:57 +00:00
Andrey V. Elsukov
59894e4a44 Fix VIMAGE build. 2012-04-05 04:41:06 +00:00
Gleb Smirnoff
07b6b55dce Merge from OpenBSD:
revision 1.173
  date: 2011/11/09 12:36:03;  author: camield;  state: Exp;  lines: +11 -12
  State expire time is a baseline time ("last active") for expiry
  calculations, and does _not_ denote the time when to expire.  So
  it should never be added to (set into the future).

  Try to reconstruct it with an educated guess on state import and
  just set it to the current time on state updates.

  This fixes a problem on pfsync listeners where the expiry time
  could be double the expected value and cause a lot more states
  to linger.
2012-04-04 14:47:59 +00:00
Gleb Smirnoff
64484cf630 Since pf 4.5 import pf(4) has a mechanism to defer
forwarding a packet, that creates state, until
pfsync(4) peer acks state addition (or 10 msec
timeout passes).

This is needed for active-active CARP configurations,
which are poorly supported in FreeBSD and arguably
a good idea at all.

Unfortunately by the time of import this feature in
OpenBSD was turned on, and did not have a switch to
turn it off. This leaked to FreeBSD.

This change make it possible to turn this feature
off via ioctl() and turns it off by default.

Obtained from:	OpenBSD
2012-04-03 18:09:20 +00:00
Jung-uk Kim
3f8d720f87 MFV: r233615
Revert r233555 and apply a fix for the reference counting regressions.

Tested by:	andreast, lme, nwhitehorn,
		Sevan / Venture37 (venture37 at gmail dot com)
Submitted by:	Robert Moore (robert dot moore at intel dot com)
2012-03-28 17:21:59 +00:00
Jung-uk Kim
c708f80e7d MFV: r233551
Fix two possible memory leaks in error path.

Obtained from:	ACPICA
2012-03-27 15:27:20 +00:00
Jung-uk Kim
f19ebc89a3 MFV: r233550
Temporarily revert an upstream commit.  This change caused regressions for
too many laptop users.  Especially, automatic repair for broken _BIF caused
strange reference counting issues and kernal panics.  This reverts:

c995fed15a
2012-03-27 15:15:30 +00:00
Bernhard Schmidt
74ebfba7ca Update the firmware to version 0.236
Submitted by:	PseudoCylon
MFC after:	2 weeks
2012-03-21 19:09:52 +00:00
Jung-uk Kim
4c52cad2f9 Merge ACPICA 20120320. 2012-03-20 21:37:52 +00:00
Bernhard Schmidt
fd5c6edb78 Import the latest microcode.h which was used to generate the current
firmware files and adjust the Makefile.

Obtained from:	OpenBSD
2012-03-14 08:00:33 +00:00
Bernhard Schmidt
b1866dfea3 Update the rt2860's firmware and add a Makefile for the module. While
here remove the ucode header file which was used to generate the fw files
but by now is outdated.

Reviewed by:	ray
Obtained from:	OpenBSD
2012-03-13 21:25:25 +00:00
Juli Mallett
964fdce070 Remove some files not used by the FreeBSD kernel which have been adding quite
a bit of bloat to the kernel source tree's size.
2012-03-13 06:48:26 +00:00
Juli Mallett
b5acc0d618 Disable the Simple Executive's error decoding/reporting code. 2012-03-11 06:55:17 +00:00
Juli Mallett
9261550cf3 Do not try to use libfdt in FreeBSD. 2012-03-11 06:49:31 +00:00
Juli Mallett
57a8a8ff31 Remove files not needed by FreeBSD. 2012-03-11 06:18:38 +00:00
Juli Mallett
dc4ee6ca91 Merge the Cavium Octeon SDK 2.3.0 Simple Executive code and update FreeBSD to
make use of it where possible.

This primarily brings in support for newer hardware, and FreeBSD is not yet
able to support the abundance of IRQs on new hardware and many features in the
Ethernet driver.

Because of the changes to IRQs in the Simple Executive, we have to maintain our
own list of Octeon IRQs now, which probably can be pared-down and be specific
to the CIU interrupt unit soon, and when other interrupt mechanisms are added
they can maintain their own definitions.

Remove unmasking of interrupts from within the UART device now that the
function used is no longer present in the Simple Executive.  The unmasking
seems to have been gratuitous as this is more properly handled by the buses
above the UART device, and seems to work on that basis.
2012-03-11 06:17:49 +00:00
Gleb Smirnoff
0e2fe5f990 Merge from OpenBSD:
revision 1.146
  date: 2010/05/12 08:11:11;  author: claudio;  state: Exp;  lines: +2 -3
  bzero() the full compressed update struct before setting the values.
  This is needed because pf_state_peer_hton() skips some fields in certain
  situations which could result in garbage beeing sent to the other peer.
  This seems to fix the pfsync storms seen by stephan@ and so dlg owes me
  a whiskey.

I didn't see any storms, but this definitely fixes a useless memory
allocation on the receiving side, due to non zero scrub_flags field
in a pfsync_state_peer structure.
2012-03-08 09:20:00 +00:00
Bjoern A. Zeeb
9dba179d5e IFC @231845
Sponsored by:	Cisco Systems, Inc.
2012-02-17 00:27:48 +00:00
Jung-uk Kim
a159c266a9 Merge ACPICA 20120215. 2012-02-16 22:59:29 +00:00
Bjoern A. Zeeb
0e2181f578 Extend IPv6 routing lookups in pf(4) to use the new multi-FIB KPI.
Try to make the "rtable" handling work but the current version of
pf(4) does not fully support it yet as especially callers of
PF_MISMATCHAW() are not fully FIB-aware.  OpenBSD seems to have
fixed this in a later version.  Prepare as much as possible.

Sponsored by:	Cisco Systems, Inc.
2012-02-03 13:20:48 +00:00
Gleb Smirnoff
3a8c7fa008 Allocate our mbuf with m_get2(). 2012-01-17 12:14:26 +00:00
Ulrich Spörlein
1eb6fc2b27 Remove spurious 8bit chars, turning files into plain ASCII. 2012-01-15 13:23:54 +00:00
Christian S.J. Peron
5646ad6d27 Revert to the old behavior of allocating table/table entries using
M_NOWAIT.  Currently, the code allows for sleeping in the ioctl path
to guarantee allocation.  However code also handles ENOMEM gracefully, so
propagate this error back to user-space, rather than sleeping while
holding the global pf mutex.

Reviewed by:	glebius
Discussed with:	bz
2012-01-14 22:51:34 +00:00
Oleksandr Tymoshenko
234f7fd5a3 - Do not enumerate PCIe bus on CN56XX Pass 1 devices to avoid hard hang.
There is known issue with this hardware.

Submitted by:	Andrew Duane <aduane@juniper.net>
2012-01-13 02:33:55 +00:00
Jung-uk Kim
ec3fc72f94 Merge ACPICA 20120111. 2012-01-11 23:06:37 +00:00
Gleb Smirnoff
b4f66a1781 Redo r226660:
- Define schednetisr() to swi_sched.
 - In the swi handler check if there is some data prepared,
   and if true, then call pfsync_sendout(), however tell it
   not to schedule swi again.
 - Since now we don't obtain the pfsync lock in the swi handler,
   don't use ifqueue mutex to synchronize queue access.
2012-01-11 18:34:57 +00:00
Gleb Smirnoff
122d395f85 Fix some spacing in code under __FreeBSD__. 2012-01-11 14:24:03 +00:00
Gleb Smirnoff
c4f01d2d34 Add necessary locking in pfsync_in_ureq(). 2012-01-11 14:19:04 +00:00
Gleb Smirnoff
0744a28a79 Move PF_LOCK_ASSERT() under __FreeBSD__. 2012-01-11 14:13:42 +00:00
Gleb Smirnoff
3488c2786e Merge from OpenBSD:
revision 1.128
  date: 2009/08/16 13:01:57;  author: jsg;  state: Exp;  lines: +1 -5
  remove prototypes of a bunch of functions that had their implementations
  removed in pfsync v5.
2012-01-11 14:11:10 +00:00
Gleb Smirnoff
686cb93667 When running with INVARIANTS the mutex(9) code does all necessary
asserts for non-recursive mutexes.
2012-01-11 13:57:48 +00:00
Gleb Smirnoff
1d89f286c4 Can't pass MSIZE to m_cljget(), an mbuf can't be attached as external storage
to another mbuf.
2012-01-09 14:35:05 +00:00
Gleb Smirnoff
317ebc3d0d Backout of backout: we need SI_SUB_PROTO_DOMAIN for pfsync, since
it needs existing inetdomain on startup.
2012-01-09 12:06:02 +00:00
Gleb Smirnoff
101881ef42 Revert sub argument of MODULE_DECLARE back to r226532.
Noticed by:	bz
2012-01-09 09:19:00 +00:00
Gleb Smirnoff
151ceaa22c In FreeBSD we determine presence of pfsync(4) at run-time, not
at compile time, so define NPFSYNC to 1 always. While here, remove
unused defines.
2012-01-09 08:55:23 +00:00
Gleb Smirnoff
5c39f7bdeb Bunch of fixes to pfsync(4) module load/unload:
o Make the pfsync.ko actually usable. Before this change loading it
  didn't register protosw, so was a nop. However, a module /boot/kernel
  did confused users.
o Rewrite the way we are joining multicast group:
  - Move multicast initialization/destruction to separate functions.
  - Don't allocate memory if we aren't going to join a multicast group.
  - Use modern API for joining/leaving multicast group.
  - Now the utterly wrong pfsync_ifdetach() isn't needed.
o Move module initialization from SYSINIT(9) to moduledata_t method.
o Refuse to unload module, unless asked forcibly.
o Improve a bit some FreeBSD porting code:
  - Use separate malloc type.
  - Simplify swi sheduling.

This change is probably wrong from VIMAGE viewpoint, however pfsync
wasn't VIMAGE-correct before this change, too.

Glanced at by:	bz
2012-01-09 08:50:22 +00:00
Gleb Smirnoff
98a38f5b1d o Fix panic on module unload, that happened due to mutex being
destroyed prior to pfsync_uninit(). To do this, move all the
  initialization to the module_t method, instead of SYSINIT(9).
o Fix another panic after module unload, due to not clearing the
  m_addr_chg_pf_p pointer.
o Refuse to unload module, unless being unloaded forcibly.
o Revert the sub argument to MODULE_DECLARE, to the stable/8 value.

This change probably isn't correct from viewpoint of VIMAGE, but
the module wasn't VIMAGE-correct before the change, as well.

Glanced at by:	bz
2012-01-09 08:36:12 +00:00
Gleb Smirnoff
dabfce9a5a Merge from OpenBSD:
revision 1.170
  date: 2011/10/30 23:04:38;  author: mikeb;  state: Exp;  lines: +6 -7
  Allow setting big MTU values on the pfsync interface but not larger
  than the syncdev MTU.  Prompted by the discussion with and tested
  by Maxim Bourmistrov;  ok dlg, mpf

Consistently use sc_ifp->if_mtu in the MTU check throughout the
module. This backs out r228813.
2012-01-07 14:39:45 +00:00
Gleb Smirnoff
e883df1d1b Fix indentation. 2012-01-07 12:40:45 +00:00
Dimitry Andric
6d417c1c70 In sys/contrib/rdma/ib_addr.h, bump MAX_ADDR_LEN to 20 bytes (the same
value used in sys/ofed/include/linux/netdevice.h), so there will be no
buffer overruns in the rest of the inline functions in this file.

Reviewed by:	kmacy
MFC after:	1 week
2012-01-07 00:47:27 +00:00
Aleksandr Rybalko
e11f2b8243 Update contrib/xz-embedded to build with new GEOM_UNCOMPRESS module.
Approved by:	adrian (mentor)
2012-01-04 23:26:22 +00:00
Adrian Chadd
63dab8eed9 Initial copy of xz-embedded to sys/contrib/.
The upcoming geom_compress module (a read-only gzip/ulzma translation layer,
similar to what geom_uzip does) will leverage parts of this.
2012-01-01 21:32:25 +00:00
Oleksandr Tymoshenko
d77d1b1a17 - Properly clean state structure in cvmx_usb_initialize 2011-12-31 05:25:42 +00:00
Oleksandr Tymoshenko
67c1180199 - CAPK-0100 board's USB timer is 12MHz 2011-12-31 05:24:21 +00:00
Sergey Kandaurov
da914858e1 Fix LINT-VIMAGE build after r228814: use virtualized pf_pool_limits. 2011-12-24 00:23:27 +00:00
Gleb Smirnoff
6bc752e028 Merge from OpenBSD:
revision 1.122
  date: 2009/05/13 01:01:34;  author: dlg;  state: Exp;  lines: +6 -4
  only keep track of the number of updates on tcp connections. state sync on
  all the other protocols is simply pushing the timeouts along which has a
  resolution of 1 second, so it isnt going to be hurt by pfsync taking up
  to a second to send it over.

  keep track of updates on tcp still though, their windows need constant
  attention.
2011-12-22 19:09:55 +00:00
Gleb Smirnoff
2662e31fc3 Merge from OpenBSD:
revision 1.120
  date: 2009/04/04 13:09:29;  author: dlg;  state: Exp;  lines: +5 -5
  use time_uptime instead of time_second internally. time_uptime isnt
  affected by adjusting the clock.

  revision 1.175
  date: 2011/11/25 12:52:10;  author: dlg;  state: Exp;  lines: +3 -3
  use time_uptime to set state creation values as time_second can be
  skewed at runtime by things like date(1) and ntpd. time_uptime is
  monotonic and therefore more useful to compare against.
2011-12-22 19:05:58 +00:00
Gleb Smirnoff
e3b670692a Merge couple more fixes from OpenBSD to bulk processing:
revision 1.118
  date: 2009/03/23 06:19:59;  author: dlg;  state: Exp;  lines: +8 -6
  wait an appropriate amount of time before giving up on a bulk update,
  rather than giving up after a hardcoded 5 seconds (which is generally much
  too short an interval for a bulk update).
  pointed out by david@, eyeballed by mcbride@

  revision 1.171
  date: 2011/10/31 22:02:52;  author: mikeb;  state: Exp;  lines: +2 -1
  Don't forget to cancel bulk update failure timeout when destroying an
  interface.  Problem report and fix from Erik Lax, thanks!

Start a brief note of revisions merged from OpenBSD.
2011-12-22 18:56:27 +00:00
Gleb Smirnoff
c5360c2998 We really mean MTU of the real interface here, not of our pseudo. 2011-12-22 18:51:35 +00:00
Gleb Smirnoff
538c3a7cd0 In FreeBSD we always have bpf(4) API, either real or stub. No need
in detecting presense of 'device bpf'.
2011-12-22 18:31:47 +00:00
Gleb Smirnoff
f08535f872 Restore a feature that was present in 5.x and 6.x, and was cleared in
7.x, 8.x and 9.x with pf(4) imports: pfsync(4) should suppress CARP
preemption, while it is running its bulk update.

However, reimplement the feature in more elegant manner, that is
partially inspired by newer OpenBSD:

- Rename term "suppression" to "demotion", to match with OpenBSD.
- Keep a global demotion factor, that can be raised by several
  conditions, for now these are:
  - interface goes down
  - carp(4) has problems with ip_output() or ip6_output()
  - pfsync performs bulk update
- Unlike in OpenBSD the demotion factor isn't a counter, but
  is actual value added to advskew. The adjustment values for
  particular error conditions are also configurable, and their
  defaults are maximum advskew value, so a single failure bumps
  demotion to maximum. This is for POLA compatibility, and should
  satisfy most users.
- Demotion factor is a writable sysctl, so user can do
  foot shooting, if he desires to.
2011-12-20 13:53:31 +00:00
Gleb Smirnoff
352e70652f - Cover pfsync callouts deletion with PF_LOCK().
- Cover setting up interface between pf and pfsync with PF_LOCK().
2011-12-20 12:34:16 +00:00
Dimitry Andric
c5e2b668eb In sys/contrib/ngatm/netnatm/msg/uni_ie.c, use a more appropriate way to
tell the compiler some parameters are purposefully unused.

MFC after:	1 week
2011-12-15 23:47:36 +00:00
Gleb Smirnoff
c53680a8ec Return value should be conditional on return value of pfsync_defer_ptr()
PR:		kern/162947
Submitted by:	Matthieu Kraus <matthieu.kraus s2008.tu-chemnitz.de>
2011-11-30 08:47:17 +00:00
Jung-uk Kim
3f0275a033 Merge ACPICA 20111123. 2011-11-28 23:36:48 +00:00
Robert Millan
bec54dbdc4 Adjust a few old checks to use __FreeBSD_version macro to
determine which version of FreeBSD kernel we're compiling.

Approved by:	kib (mentor)
2011-11-24 21:23:58 +00:00
Kevin Lo
8d5eb1c4c8 Add missing PF_UNLOCK in pf_test
Reviewed by:	bz
2011-10-30 14:55:00 +00:00
Gleb Smirnoff
3e850a12ef Utilize new IF_DEQUEUE_ALL(ifq, m) macro in pfsyncintr() to reduce
contention on ifqueue lock.
2011-10-27 09:47:00 +00:00
Gleb Smirnoff
9932deae93 Merge several fixes to bulk update processing from OpenBSD. Merged
revisions: 1.148, 1.149, 1.150. This makes number of states on
master/slave to be of a sane value.
2011-10-23 15:15:17 +00:00
Gleb Smirnoff
8ecd40b6b2 Fix indentation, no code changed. 2011-10-23 15:10:15 +00:00
Gleb Smirnoff
2f2086d57e - Fix a bad typo (FreeBSD specific) in pfsync_bulk_update(). Instead
of scheduling next run pfsync_bulk_update(), pfsync_bulk_fail()
  was scheduled.
  This lead to instant 100% state leak after first bulk update
  request.
- After above fix, it appeared that pfsync_bulk_update() lacks
  locking. To fix this, sc_bulk_tmo callout was converted to an
  mtx one. Eventually, all pf/pfsync callouts should be converted
  to mtx version, since it isn't possible to stop or drain a
  non-mtx callout without risk of race.
- Add comment that callout_stop() in pfsync_clone_destroy() lacks
  locking. Since pfsync0 can't be destroyed (yet), let it be here.
2011-10-23 15:08:18 +00:00
Gleb Smirnoff
35ad95774e Fix from r226623 is not sufficient to close all races in pfsync(4).
The root of problem is re-locking at the end of pfsync_sendout().
Several functions are calling pfsync_sendout() holding pointers
to pf data on stack, and these functions expect this data to be
consistent.

To fix this, the following approach was taken:

- The pfsync_sendout() doesn't call ip_output() directly, but
  enqueues the mbuf on sc->sc_ifp's interfaces queue, that
  is currently unused. Then pfsync netisr is scheduled. PF_LOCK
  isn't dropped in pfsync_sendout().
- The netisr runs through queue and ip_output()s packets
  on it.

Apart from fixing race, this also decouples stack, fixing
potential issues, that may happen, when sending pfsync(4)
packets on input path.

Reviewed by:	eri (a quick review)
2011-10-23 14:59:54 +00:00
Gleb Smirnoff
68270a37c8 Absense of M_WAITOK in malloc flags for UMA doesn't
equals presense of M_NOWAIT. Specify M_NOWAIT explicitly.

This fixes sleeping with PF_LOCK().
2011-10-23 10:13:20 +00:00
Gleb Smirnoff
f54a3a046e Correct flag for uma_zalloc() is M_WAITOK. M_WAIT is an old and
deprecated flag from historical mbuf(9) allocator.

This is style only change.
2011-10-23 10:05:25 +00:00
Gleb Smirnoff
8dc59178a8 Fix a race: we should update sc_len before dropping the pf lock, otherwise a
number of packets can be queued on sc, while we are in ip_output(), and then
we wipe the accumulated sc_len. On next pfsync_sendout() that would lead to
writing beyond our mbuf cluster.
2011-10-21 22:28:15 +00:00
Gleb Smirnoff
b6b8562bfc In FreeBSD ip_output() expects ip_len and ip_off in host byte order
PR:		kern/159029
2011-10-21 11:11:18 +00:00
Bjoern A. Zeeb
e999988442 Fix recursive pf locking leading to panics. Splatter PF_LOCK_ASSERT()s
to document where we are expecting to be called with a lock held to
more easily catch unnoticed code paths.
This does not neccessarily improve locking in pfsync, it just tries
to avoid the panics reported.

PR:		kern/159390, kern/158873
Submitted by:	pluknet (at least something that partly resembles
		my patch ignoring other cleanup, which I only saw
		too late on the 2nd PR)
MFC After:	3 days
2011-10-19 13:13:56 +00:00
Bjoern A. Zeeb
c902d29994 De-virtualize the pf_task_mtx lock. At the current state of pf locking
and virtualization it is not helpful but complicates things.

Current state of art is to not virtualize these kinds of locks -
inp_group/hash/info/.. are all not virtualized either.

MFC after:	3 days
2011-10-19 11:04:49 +00:00
Bjoern A. Zeeb
232ec0c97d Adjust the PF_ASSERT() macro to what we usually use in the network stack:
PF_LOCK_ASSERT() and PF_UNLOCK_ASSERT().

MFC after:	3 days
2011-10-19 10:16:42 +00:00
Bjoern A. Zeeb
72aed41bed In the non-FreeBSD case we do not expect PF_LOCK and friends to do anything.
MFC after:	3 days
2011-10-19 10:08:58 +00:00
Bjoern A. Zeeb
5b63183446 Pseudo interfaces should go at SI_SUB_PSEUDO. However at least
pfsync also depends on pf to be initialized already so pf goes at
FIRST and the interfaces go at ANY.
Then the (VNET_)SYSINIT startups for pf stays at SI_SUB_PROTO_BEGIN
and for pfsync we move to the later SI_SUB_PROTO_IF.

This is not ideal either but at least an order that should work for
the moment and can be re-fined with the VIMAGE merge, once this will
actually work with more than one network stack.

MFC after:	3 days
2011-10-19 10:04:24 +00:00
Bjoern A. Zeeb
c29a7fb305 Fix an obvious locking bug where we would lock again rather than unlock.
MFC after:	3 days
2011-10-19 09:34:40 +00:00
Bjoern A. Zeeb
18d97aa11c Fix a bug when NPFSYNC > 0 that on FreeBSD we would always return
and never remove state.

This fixes the problem some people are seeing that state is removed when pf
is loaded as a module but not in situations when compiled into the kernel.

Reported by:	many on freebsd-pf
Tested by:	flo
MFC after:	3 days
2011-10-19 08:57:17 +00:00
Bjoern A. Zeeb
8552ee4b89 Fix indentation in a loop and a tiny maze of #ifdefs for just the
__FreeBSD__ parts that had it wrong.

MFC after:	3 days
2011-10-19 08:37:48 +00:00
Bjoern A. Zeeb
c5378361a3 Use the correct byte order for the ip_divert(4) mbuf tag port meta
information in pf(4).

Submitted by:	Yaocl (chunlinyao gmail.com), forum post 145106
Approved by:	re (kib)
2011-08-25 09:38:33 +00:00
Sergey Kandaurov
a6bab2362e Fix build failure without BPF.
Reported by:	deeptech71 at gmail dot com
Approved by:	re (kib)
2011-08-17 13:02:50 +00:00
Bjoern A. Zeeb
e0bfbfce79 Update packet filter (pf) code to OpenBSD 4.5.
You need to update userland (world and ports) tools
to be in sync with the kernel.

Submitted by:	mlaier
Submitted by:	eri
2011-06-28 11:57:25 +00:00
Robert Watson
d3c1f00350 Add _mbuf() variants of various inpcb-related interfaces, including lookup,
hash install, etc.  For now, these are arguments are unused, but as we add
RSS support, we will want to use hashes extracted from mbufs, rather than
manually calculated hashes of header fields, due to the expensive of the
software version of Toeplitz (and similar hashes).

Add notes that it would be nice to be able to pass mbufs into lookup
routines in pf(4), optimising firewall lookup in the same way, but the
code structure there doesn't facilitate that currently.

(In principle there is no reason this couldn't be MFCed -- the change
extends rather than modifies the KBI.  However, it won't be useful without
other previous possibly less MFCable changes.)

Reviewed by:    bz
Sponsored by:   Juniper Networks, Inc.
2011-06-04 16:33:06 +00:00
Jung-uk Kim
42e58c0372 Merge ACPICA 20110527. 2011-05-31 19:45:58 +00:00
Bjoern A. Zeeb
06034940f5 Remove some further INET related symbols from pf to allow the module
to not only compile bu load as well for testing with IPv6-only kernels.
For the moment we ignore the csum change in pf_ioctl.c given the
pending update to pf45.

Reported by:	dru
Sponsored by:	The FreeBSD Foundation
Sponsored by:	iXsystems
MFC after:	20 days
2011-05-31 15:05:29 +00:00
Robert Watson
fa046d8774 Decompose the current single inpcbinfo lock into two locks:
- The existing ipi_lock continues to protect the global inpcb list and
  inpcb counter.  This lock is now relegated to a small number of
  allocation and free operations, and occasional operations that walk
  all connections (including, awkwardly, certain UDP multicast receive
  operations -- something to revisit).

- A new ipi_hash_lock protects the two inpcbinfo hash tables for
  looking up connections and bound sockets, manipulated using new
  INP_HASH_*() macros.  This lock, combined with inpcb locks, protects
  the 4-tuple address space.

Unlike the current ipi_lock, ipi_hash_lock follows the individual inpcb
connection locks, so may be acquired while manipulating a connection on
which a lock is already held, avoiding the need to acquire the inpcbinfo
lock preemptively when a binding change might later be required.  As a
result, however, lookup operations necessarily go through a reference
acquire while holding the lookup lock, later acquiring an inpcb lock --
if required.

A new function in_pcblookup() looks up connections, and accepts flags
indicating how to return the inpcb.  Due to lock order changes, callers
no longer need acquire locks before performing a lookup: the lookup
routine will acquire the ipi_hash_lock as needed.  In the future, it will
also be able to use alternative lookup and locking strategies
transparently to callers, such as pcbgroup lookup.  New lookup flags are,
supplementing the existing INPLOOKUP_WILDCARD flag:

  INPLOOKUP_RLOCKPCB - Acquire a read lock on the returned inpcb
  INPLOOKUP_WLOCKPCB - Acquire a write lock on the returned inpcb

Callers must pass exactly one of these flags (for the time being).

Some notes:

- All protocols are updated to work within the new regime; especially,
  TCP, UDPv4, and UDPv6.  pcbinfo ipi_lock acquisitions are largely
  eliminated, and global hash lock hold times are dramatically reduced
  compared to previous locking.
- The TCP syncache still relies on the pcbinfo lock, something that we
  may want to revisit.
- Support for reverting to the FreeBSD 7.x locking strategy in TCP input
  is no longer available -- hash lookup locks are now held only very
  briefly during inpcb lookup, rather than for potentially extended
  periods.  However, the pcbinfo ipi_lock will still be acquired if a
  connection state might change such that a connection is added or
  removed.
- Raw IP sockets continue to use the pcbinfo ipi_lock for protection,
  due to maintaining their own hash tables.
- The interface in6_pcblookup_hash_locked() is maintained, which allows
  callers to acquire hash locks and perform one or more lookups atomically
  with 4-tuple allocation: this is required only for TCPv6, as there is no
  in6_pcbconnect_setup(), which there should be.
- UDPv6 locking remains significantly more conservative than UDPv4
  locking, which relates to source address selection.  This needs
  attention, as it likely significantly reduces parallelism in this code
  for multithreaded socket use (such as in BIND).
- In the UDPv4 and UDPv6 multicast cases, we need to revisit locking
  somewhat, as they relied on ipi_lock to stablise 4-tuple matches, which
  is no longer sufficient.  A second check once the inpcb lock is held
  should do the trick, keeping the general case from requiring the inpcb
  lock for every inpcb visited.
- This work reminds us that we need to revisit locking of the v4/v6 flags,
  which may be accessed lock-free both before and after this change.
- Right now, a single lock name is used for the pcbhash lock -- this is
  undesirable, and probably another argument is required to take care of
  this (or a char array name field in the pcbinfo?).

This is not an MFC candidate for 8.x due to its impact on lookup and
locking semantics.  It's possible some of these issues could be worked
around with compatibility wrappers, if necessary.

Reviewed by:    bz
Sponsored by:   Juniper Networks, Inc.
2011-05-30 09:43:55 +00:00
Bjoern A. Zeeb
5084821ac2 Make pf compile without INET support by adding #ifdef INETs and
correcting few #includes.

Reviewed by:	gnn
Sponsored by:	The FreeBSD Foundation
Sponsored by:	iXsystems
MFC after:	4 days
2011-04-27 19:34:01 +00:00
Bernhard Schmidt
d51f8d2024 Add firmware images for the 6000 series g2a and g2b adapters. 2011-04-20 17:34:09 +00:00
Bernhard Schmidt
c2bce4a2fc Update iwn(4) firmware blobs:
- bump iwn1000fw to 39.31.5.1
- bump iwn5000fw to 8.83.5.1
- bump iwn6050fw to 41.28.5.1
2011-04-20 17:32:20 +00:00
Jung-uk Kim
33a7ed1f45 Re-merge with ACPICA vendor source. 2011-04-15 21:38:24 +00:00
Jung-uk Kim
d052a1cc33 Merge ACPICA 20110413. 2011-04-15 18:34:27 +00:00
Jung-uk Kim
3453537fa5 Use atomic load & store for TSC frequency. It may be overkill for amd64 but
safer for i386 because it can be easily over 4 GHz now.  More worse, it can
be easily changed by user with 'machdep.tsc_freq' tunable (directly) or
cpufreq(4) (indirectly).  Note it is intentionally not used in performance
critical paths to avoid performance regression (but we should, in theory).
Alternatively, we may add "virtual TSC" with lower frequency if maximum
frequency overflows 32 bits (and ignore possible incoherency as we do now).
2011-04-07 23:28:28 +00:00
Jung-uk Kim
dcbce41eb0 Merge ACPICA 20110316. 2011-03-17 00:29:53 +00:00
Juli Mallett
64974004ec o) Clean up FPA pools on module unload.
o) Allocate output buffer pool based on available output queues.

Submitted by:	Bhanu Prakash (with modifications)
2011-03-16 08:51:36 +00:00
Jung-uk Kim
38b8542ca9 Deprecate tsc_present as the last of its real consumers finally disappeared. 2011-03-15 17:19:52 +00:00
Jung-uk Kim
79422085d4 Add a tunable "machdep.disable_tsc" to turn off TSC. Specifically, it turns
off boot-time CPU frequency calibration, DELAY(9) with TSC, and using TSC as
a CPU ticker.  Note tsc_present does not change by this tunable.
2011-03-11 00:44:32 +00:00
Jung-uk Kim
bc34c87e81 Deprecate rarely used tsc_is_broken. Instead, we zero out tsc_freq because
it is almost always used with tsc_freq any way.
2011-03-10 20:02:58 +00:00
Jung-uk Kim
c90d5f1c37 Remove alpha reminiscence from altq. 2011-03-10 19:04:18 +00:00
Jung-uk Kim
f7942cae7a Consistently add TSC support for amd64. 2011-03-10 18:58:40 +00:00
Jung-uk Kim
daaad5a9be Remove support for FreeBSD 4.x and below. 2011-03-10 18:49:15 +00:00
Jung-uk Kim
0b94ba42b0 Merge ACPICA 20110211. 2011-02-12 01:03:15 +00:00
Christian S.J. Peron
6627ad29b4 Correct bogus initialization. It should be noted that this change
has been corrected in the vendor branch, but for now, silence clang
warnings.

Found by:	clang
Discussed with:	mlaier
MFC after:	1 week
2011-01-14 04:24:53 +00:00
Jung-uk Kim
d244b2279c Merge ACPICA 20110112. Switch to BSD/GPLv2 dual license[1].
Discussed with:	core [1]
2011-01-13 17:32:32 +00:00
Juli Mallett
15fe2454ae o) Expand the CIU driver to be aware of newly-allocated parts of the IRQ range.
o) Add 'octm', a trivial driver for the 10/100 management ports found on some
   Octeon systems.
o) Make the Simple Executive's management port helper routines compile on
   FreeBSD (namely by not doing math on void pointers.)
o) Add a cvmx_mgmt_port_sendm routine to the Simple Executive to send an mbuf
   so there is only one copy in the transmit path, rather than having to first
   copy the mbuf to an intermediate buffer and then copy that to the Simple
   Executive's transmit ring.
o) Properly work out MII addresses of management ports on the Lanner MR-730.
   XXX The MR-730 also needs some patches to the MII read/write routines, but
       this is sufficient for now.  Media detection will be fixed in the future
       when I can spend more time reading the vendor-supplied patches.
2011-01-10 03:48:41 +00:00
Bernhard Schmidt
0e1497aefd Update firmware for wpi(4) from version 2.14.4 to 15.32.2.9.
PR:		kern/142907
Submitted by:	Craig Butler <craig001 at lerwick.hopto.org>
MFC after:	2 weeks
2010-12-19 11:37:44 +00:00
Juli Mallett
4a7b75273b o) Add support for the Lanner MR-321X/MR-325, which is just a modified MR-320.
o) On the Lanner MR-730, disable PCIe lane swap, per vendor.
2010-12-16 07:20:38 +00:00
Jung-uk Kim
5a77b11bd3 Merge ACPICA 20101209. 2010-12-15 23:48:45 +00:00
Juli Mallett
04b6fa8330 Merge Cavium Octeon SDK 2.0 Simple Executive; this brings some fixes and new
facilities as well as support for the Octeon 2 family of SoCs.

XXX Note that with our antediluvian assembler, we can't support some Octeon 2
    instructions and fall back to using the old ones instead.
2010-11-28 08:18:16 +00:00
Juli Mallett
0867cb9511 o) Recognize the Lanner MR-730.
o) Fix enumeration of PHY addresses on the MR-955.
o) Parse link state for the MR-730 using the Broadcom PHY support in the SDK.
   It's not clear that this is entirely-correct, but it seems to work.  Since
   this board uses a BCM5482S, this may mean that we work correctly for copper
   but not SFI, which is untested.
2010-11-08 21:22:55 +00:00
Jung-uk Kim
3c1812acc6 Merge ACPICA 20101013. 2010-10-13 21:37:02 +00:00
Rui Paulo
653bfa0ba3 Ignore the return value of ADDCARRY(). 2010-10-13 17:16:08 +00:00
Rui Paulo
8e5fffdfb5 Properly tell the compiler that we want to ignore the return value of
certain macros.
2010-10-13 17:09:53 +00:00
Rui Paulo
f3e830e9b0 Fix several cases were a conditional operator was used instead of a
bitwise operator.

Found with:	clang
2010-10-13 17:09:16 +00:00
Rui Paulo
62e9a33814 Pass a format string to make_dev().
Found by:	clang
2010-10-13 14:57:13 +00:00
Juli Mallett
a22b69b772 o) Allow devices to override the MDIO read and write functions presented to
the miibus attached to octe interfaces.
o) Add an SMI/MDIO interface to the MV88E61XX and use it for the switch PHY on
   the Lanner MR-320.  An actual driver for the switch PHY will come later.
   Note that for now it intercepts and fakes MII_BMSR reads to prevent the
   miibus from talking to anything but the switch itself.
2010-10-02 05:43:17 +00:00
Juli Mallett
77c2091086 Add preliminary support for the Lanner MR-955. It boots multi-user but there
seem to be problems both with the on-board Ethernet interfaces and the em(4)
interfaces on PCI under FreeBSD.

Thanks to Lanner for providing access to hardware.
2010-09-19 09:19:38 +00:00
Jung-uk Kim
42fecd1294 Merge ACPICA 20100915. 2010-09-16 20:08:00 +00:00
Bjoern A. Zeeb
dd5f5f2b1b When using pf routing options, properly handle IP fragmentation
for interfaces with TSO enabled, otherwise one would see an extra
ICMP unreach, frag needed pre matching packet on lo0.
This syncs pf code to ip_output.c r162084.

PR:		kern/144311
Submitted by:	yongari via mlaier
Reviewed by:	eri
Tested by:	kib
MFC after:	8 days
2010-09-10 00:00:06 +00:00
Jung-uk Kim
709fac0616 Merge ACPICA 20100806. 2010-08-06 23:11:19 +00:00
Juli Mallett
cea2b8b915 Update the port of FreeBSD to Cavium Octeon to use the Cavium Simple Executive
library:
o) Increase inline unit / large function growth limits for MIPS to accommodate
   the needs of the Simple Executive, which uses a shocking amount of inlining.
o) Remove TARGET_OCTEON and use CPU_CNMIPS to do things required by cnMIPS and
   the Octeon SoC.
o) Add OCTEON_VENDOR_LANNER to use Lanner's allocation of vendor-specific
   board numbers, specifically to support the MR320.
o) Add OCTEON_BOARD_CAPK_0100ND to hard-wire configuration for the CAPK-0100nd,
   which improperly uses an evaluation board's board number and breaks board
   detection at runtime.  This board is sold by Portwell as the CAM-0100.
o) Add support for the RTC available on some Octeon boards.
o) Add support for the Octeon PCI bus.  Note that rman_[sg]et_virtual for IO
   ports can not work unless building for n64.
o) Clean up the CompactFlash driver to use Simple Executive macros and
   structures where possible (it would be advisable to use the Simple Executive
   API to set the PIO mode, too, but that is not done presently.)  Also use
   structures from FreeBSD's ATA layer rather than structures copied from
   Linux.
o) Print available Octeon SoC features on boot.
o) Add support for the Octeon timecounter.
o) Use the Simple Executive's routines rather than local copies for doing reads
   and writes to 64-bit addresses and use its macros for various device
   addresses rather than using local copies.
o) Rename octeon_board_real to octeon_is_simulation to reduce differences with
   Cavium-provided code originally written for Linux.  Also make it use the
   same simplified test that the Simple Executive and Linux both use rather
   than our complex one.
o) Add support for the Octeon CIU, which is the main interrupt unit, as a bus
   to use normal interrupt allocation and setup routines.
o) Use the Simple Executive's bootmem facility to allocate physical memory for
   the kernel, rather than assuming we know which addresses we can steal.
   NB: This may reduce the amount of RAM the kernel reports you as having if
       you are leaving large temporary allocations made by U-Boot allocated
       when starting FreeBSD.
o) Add a port of the Cavium-provided Ethernet driver for Linux.  This changes
   Ethernet interface naming from rgmxN to octeN.  The new driver has vast
   improvements over the old one, both in performance and functionality, but
   does still have some features which have not been ported entirely and there
   may be unimplemented code that can be hit in everyday use.  I will make
   every effort to correct those as they are reported.
o) Support loading the kernel on non-contiguous cores.
o) Add very conservative support for harvesting randomness from the Octeon
   random number device.
o) Turn SMP on by default.
o) Clean up the style of the Octeon kernel configurations a little and make
   them compile with -march=octeon.
o) Add support for the Lanner MR320 and the CAPK-0100nd to the Simple
   Executive.
o) Modify the Simple Executive to build on FreeBSD and to build without
   executive-config.h or cvmx-config.h.  In the future we may want to
   revert part of these changes and supply executive-config.h and
   cvmx-config.h and access to the options contained in those files via
   kernel configuration files.
o) Modify the Simple Executive USB routines to support getting and setting
   of the USB PID.
2010-07-20 19:25:11 +00:00