Not all mbufs passed up from device drivers are M_WRITABLE(). In
particular, the Chelsio T4/T5 driver uses a feature called "buffer packing"
to receive multiple frames in a single receive buffer. The mbufs for
these frames all share the same external storage so are treated as
read-only by the rest of the stack when multiple frames are in flight.
Previously tcp_respond() would blindly overwrite read-only mbufs when
INVARIANTS was disabled or panic with an assertion failure if INVARIANTS
was enabled. Note that the new case is a bit of a mix of the two other
cases in tcp_respond(). The TCP and IP headers must be copied explicitly
into the new mbuf instead of being inherited (similar to the m == NULL
case), but the addresses and ports must be swapped in the reply (similar
to the m != NULL case).
Reviewed by: glebius
swap_pager_copy() might unlock the object, which allows the parallel
collapse to execute. Besides destroying the object, it also might
move the reference from parent to the backing object, firing the
assertion ref_count == 1.
Collapses are prevented by bumping paging_in_progress counters on both
the object and its backing object.
Reported by: cem
Tested by: pho (previous version)
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D6085
- Use device's channel list instead of default one (adds 12, 13 and 14
2GHz channels).
- Add ic_getradiocaps() method.
Differential Revision: https://reviews.freebsd.org/D6171
- Use device's channel list instead of default one (+ 12, 13 and 14
2GHz channels).
- Add ic_getradiocaps() method.
Differential Revision: https://reviews.freebsd.org/D6170
- Use device's channel list instead of default one (from
ieee80211_init_channels()).
- Add ic_getradiocaps() method.
Differential Revision: https://reviews.freebsd.org/D6144
- Use macros to define rate indices; don't hardcode them in code.
- Add method for 'rate' -> 'rate index' conversion
(and array for the opposite).
- Determine if rate is CCK / OFDM via appropriate macro.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D4837
Change default regulatory domain from DEBUG (no limitations;
exposes all device channels) to FCC; as a result, newly created wireless
interface with default settings will have less chances to violate
country-specific regulations.
This change will not affect drivers with pre-initialized regdomain
structure (currentry ath(4) and mwl(4)); in that case, the default
channel list must correspond to the default regdomain / country setting.
You can switch to another regdomain / country via corresponding
ifconfig(8) options; the driver must implement ic_getradiocaps()
method to restore full channel list.
Full country / regdomain list may be obtained via
'ifconfig <iface> list countries' command.
Example: change country to Germany:
ifconfig wlan0 down # all wlans on the device must be down
ifconfig wlan0 country DE
ifconfig wlan0 up
# wpa_supplicant(8), dhclient(8) etc
At the creation time:
ifconfig wlan0 create wlandev wpi0 country DE
To make changes permanent add the following line to the rc.conf(5):
create_args_wlan0="country DE"
Tested with
- Intel 3945BG (wpi(4)).
- WUSB54GC (rum(4)).
Reviewed by: adrian
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D6228
"qsort()".
The kernel's "qsort()" routine can in worst case spend O(N*N) amount of
comparisons before the input array is sorted. It can also recurse a
significant amount of times using up the kernel's interrupt thread
stack.
The custom sorting routine takes advantage of that the sorting key is
only 64 bits. Based on set and cleared bits in the sorting key it
partitions the array until it is sorted. This process has a recursion
limit of 64 times, due to the number of set and cleared bits which can
occur. Compiled with -O2 the sorting routine was measured to use
64-bytes of stack. Multiplying this by 64 gives a maximum stack
consumption of 4096 bytes for AMD64. The same applies to the execution
time, that the array to be sorted will not be traversed more than 64
times.
When serving roughly 80Gb/s with 80K TCP connections, the old method
consisting of "qsort()" and "tcp_lro_mbuf_compare_header()" used 1.4%
CPU, while the new "tcp_lro_sort()" used 1.1% for LRO related sorting
as measured by Intel Vtune. The testing was done using a sysctl to
toggle between "qsort()" and "tcp_lro_sort()".
Differential Revision: https://reviews.freebsd.org/D6472
Sponsored by: Mellanox Technologies
Tested by: Netflix
Reviewed by: gallatin, rrs, sephe, transport
Previously the USB PHY driver would enable all regulators at attach time.
This prevented boards from booting when powered by the USB OTG port, as
it didn't take VBUS presence into consideration.
in ICL interface.
- the ordering of parameters to icl_conn_task_setup is different, so that
the "cookie" is last.
- the icl_conn_connected() method is gone, replaced by much simpler mechanism.
I'd rather keep the ICL interface as small as possible.
- I don't really like the s/offload/driver/g. The "tcp" is not a driver;
"iser" is not really a driver either. I'd prefer to leave it as it is.
- the check for ic_session_type_discovery() in iser_conn_handoff() is gone,
as handoff cannot happen for discovery sessions.
- ic_session_login_phase() and ic_session_type_discovery() are gone. If you
had your handoff method called - you're no longer in either of those.
- the way maxtags is passed is different; now it's simply ic->ic_maxtags.
It's cleaner, and the old way would cause weird things to happen if
fail_on_disconnection=1 and the user changed the maxtags sysctl before
reconnecting (basically the CAM idea of maxtags would be different from
iSER one).
- icl_hba_misc() is gone; declare support for PIM_UNMAPPED by setting
ic->ic_unmapped flag.
- the way we find the "iser" ICL module is rewritten - we have a flag
for icl_register() that says if the module is iSER-capable or not.
- icl_conn_release() is gone; iser_conn_release() is called from
iser_conn_free() (no functional change in this case) and at the beginning
of icl_conn_connect(), to handle reconnection.
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
written by Sagi Grimberg <sagig at mellanox.com> and Max Gurtovoy
<maxg at mellanox.com>.
This code comes from https://github.com/sagigrimberg/iser-freebsd, branch
iser-rebase-11-current-r291993. It's not connected to the build just yet;
it still needs some tweaks to adapt to my changes to iSCSI infrastructure.
Big thanks to Mellanox for their support for FreeBSD!
Obtained from: Mellanox Technologies
MFC after: 1 month
Relnotes: yes
switching between LAPIC modes is not supported, and there is no need
to wait for IPI ack in x2APIC mode. So the calibrated delay is only
needed for !x2APIC.
This saves around a second of boot time on the real hardware for
x2APIC.
Sponsored by: The FreeBSD Foundation
Linux module parameters have a permissions value. If any write bits
are set we are allowed to modify the module parameter runtime. Reflect
this when creating the static SYSCTL nodes.
Sponsored by: Mellanox Technologies
MFC after: 1 week
Because the size of bool can be implementation defined, make a bool
sysctl handler which handle bools. Userspace sees the bools like
unsigned 8-bit integers. Values are filtered to either 1 or 0 upon
read and write, similar to what a compiler would do.
Requested by: kmacy @
Sponsored by: Mellanox Technologies
This is a simple ioctl and mmap API to issue SPI transactions from
userland. It's useful for simple devices (eg spi temperature sensors,
etc) for experimentation.
TODO:
* Write some documentation!
Submitted by: green
of hardware. Mostly this focuses on the big changes needed for setting the
bus clock, because ESDHC is SDHCI v2.0 and USDHC is 3.0, and the number,
location, and interpretation of clock divisor bits is vastly different
between the two. This doesn't get the device all the way to functioning
on ESDHC hardware yet, but it's much closer, now getting through all the
card detection and negotiation of capabilties and speed (but it eventually
hangs on what appears to be a missing interrupt).
Another missing chunk of code for handling ESDHC's 32 bit command-and-mode
register using sdhci's pair of 16 bit writes is added.
This also does some leading whitespace cleanups and sorts some softc
struct members by size, and adds some comments (because when do I ever
touch code without adding comments?).
This was triggering a panic on detach; the SPROM shadow is now
maintained by the bhnd_sprom_chipc driver, and should be removed
from chipc.
Submitted by: Landon Fuller <landonf@landonf.org>
Differential Revision: https://reviews.freebsd.org/D6548
This adds support for automatically configuring bhnd_chipc bus children
with associated resources, using an internal 'hints' table based directly
on Michael Zhilin's chipc resource mapping work.
The bhnd_sprom_chipc driver has been converted to use DEVICE_IDENTIFY()
with the new resource table.
This should be nearly drop-in compatible with the child device drivers
in D6250.
Submitted by: Landon Fuller <landonf@landonf.org>
Reviewed by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6525
to match the new state of affairs. The hardware we support has always been
able to do unaligned accesses, we've just never enabled it until now.
This brings FreeBSD into line with all the other major OSes, and should help
with the growing volume of 3rd-party software that assumes unaligned access
will just work on armv6 and armv7.
* include the SCTP common header, if possible
* include the first 8 bytes of the INIT chunk, if possible
This provides the necesary information for the receiver of the ICMP
packet to process it.
MFC after: 1 week
have ACLE support built in. The ACLE (ARM C Language Extensions) defines
a set of standardized symbols which indicate the architecture version and
features available. ACLE support is built in to modern compilers (both
clang and gcc), but absent from gcc prior to 4.4.
ARM (the company) provides the acle-compat.h header file to define the
right symbols for older versions of gcc. Basically, acle-compat.h does
for arm about the same thing cdefs.h does for freebsd: defines
standardized macros that work no matter which compiler you use. If ARM
hadn't provided this file we would have ended up with a big #ifdef __arm__
section in cdefs.h with our own compatibility shims.
Remove #include <machine/acle-compat.h> from the zillion other places (an
ever-growing list) that it appears. Since style(9) requires sys/types.h
or sys/param.h early in the include list, and both of those lead to
including cdefs.h, only a couple special cases still need to include
acle-compat.h directly.
Loves it: imp