Commit Graph

4126 Commits

Author SHA1 Message Date
Gleb Smirnoff
17c328b6ae Enter the network epoch in USB WiFi drivers when processing input
mbuf queues.

Submitted by:	Idwer Vollering <vidwer gmail.com>
2020-01-24 21:04:33 +00:00
Hans Petter Selasky
540f67be4e Add new USB ID to uslcom(4).
Submitted by:	Oleg Sharoyko <osharoiko@gmail.com>
PR:		243494
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-01-21 22:28:16 +00:00
Hans Petter Selasky
5bc41c932f Revert r356598 for now because it breaks some AMD based XHCI controllers.
Reported by:	jkim @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-01-11 11:38:02 +00:00
Hans Petter Selasky
92dfc0fc1d Check the XHCI endpoint state before stopping any endpoint.
This avoids getting the XHCI_TRB_ERROR_CONTEXT_STATE error code from the XHCI
controller when the endpoint is disabled or already stopped.

Suggested by:	Shichun.Ma@dell.com
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-01-10 09:32:44 +00:00
Hans Petter Selasky
b8ffd2d5d6 Define the XHCI endpoint states.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-01-10 09:07:43 +00:00
Kyle Evans
acf411aafe dwc_otg: fix fdt attachment for newer bcm2708-usb nodes
The newer versions of RPi FDT flipped the order of the interrupts
specification and added an 'interrupt-names' property for driver aide in
finding the correct interrupt, rather than assuming the positions. Use it if
it's available, or fallback to the old method if there is no interrupt-names
property with a usb value.

This has been tested with both old RPi3B FDT and new RPi3B FDT, USB again
works on the latter.

Reported by:	Tom Yan <tom.ty89 gmail com>
MFC after:	3 days
2020-01-09 19:22:11 +00:00
Hans Petter Selasky
7ba6c62fa0 Fix a XHCI driver issue with Intel's Gemini Lake SOC.
Do not configure any endpoint twice, but instead keep track of which
endpoints are configured on a per device basis, and use an evaluate
endpoint context command instead. When changing the configuration make
sure all endpoints get deconfigured and the configured endpoint mask
is reset.

This fixes an issue where an endpoint might stop working if there is
an error and the endpoint needs to be reconfigured as a part of the
error recovery mechanism in the FreeBSD USB stack.

Tested by:	Shichun.Ma@dell.com
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-01-09 09:29:24 +00:00
Hans Petter Selasky
6c110e8611 Add own counter for cancelled USB transfers.
Do not count these as errors.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-01-06 09:49:20 +00:00
Hans Petter Selasky
7082625d97 Make USB statistics per device instead of per bus.
Bump the FreeBSD version due to structure change to
force recompilation of external USB modules.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-12-27 20:29:13 +00:00
Kyle Evans
2899979df9 Revert r355806: kbd drivers: don't double register keyboard drivers
r356087 made it rather innocuous to double-register built-in keyboard
drivers; we now set a flag to indicate that it's been registered and only
act once on a registration anyways. There is no misleading here, as the
follow-up kbd_delete_driver will actually remove the driver as needed now
that the linker set isn't also consulted after kbdinit.
2019-12-26 17:09:36 +00:00
Kyle Evans
5a7a578be9 kbd drivers: don't double register keyboard drivers
Keyboard drivers are generally registered via linker set. In these cases,
they're also available as kmods which use KPI for registering/unregistering
keyboard drivers outside of the linker set.

For built-in modules, we still fire off MOD_LOAD and maybe even MOD_UNLOAD
if an error occurs, leading to registration via linker set and at MOD_LOAD
time.

This is a minor optimization at best, but it keeps the internal kbd driver
tidy as a future change will merge the linker set driver list into its
internal keyboard_drivers list via SYSINIT and simplify driver lookup by
removing the need to consult the linker set.
2019-12-16 16:41:24 +00:00
Kyle Evans
eefc662f0b kbd: provide default implementations of get_fkeystr/diag
Most keyboard drivers are using the genkbd implementations as it is;
formally use them for any that aren't set and make
genkbd_get_fkeystr/genkbd_diag private.
2019-12-16 02:44:56 +00:00
Kyle Evans
4434de9643 kbd drivers: use kbdd_* indirection for diag invocation
These invocations were directly calling enkbd_diag(), rather than
indirection back through kbdd_diag/kbdsw. While they're functionally
equivent, invoking kbdd_diag where feasible (i.e. not in a diag
implementation) makes it easier to visually identify locking needs in these
other drivers.
2019-12-16 01:37:03 +00:00
Ian Lepore
24fa2fba9d Allow baud rates of 1,228,800 and 1,843,200 on CP2101/2/3 usb-serial adapters.
The datasheets for these chips claim the maximum is 921,600, but testing
shows these two higher rates also work (but no rates above 921,600 other
than these two work; these represent dividing the base buad clock by 3 and 2
respectively).
2019-12-09 21:55:44 +00:00
Warner Losh
f86e60008b Regularize my copyright notice
o Remove All Rights Reserved from my notices
o imp@FreeBSD.org everywhere
o regularize punctiation, eliminate date ranges
o Make sure that it's clear that I don't claim All Rights reserved by listing
  All Rights Reserved on same line as other copyright holders (but not
  me). Other such holders are also listed last where it's clear.
2019-12-04 16:56:11 +00:00
Emmanuel Vadot
e213223c9b Remove "all rights reserved" from copyright for the file I own.
Some of the files have both me and Jared McNeill and he gave me
permission to remove it from his files too.
2019-12-03 21:00:45 +00:00
Kyle Evans
ac3f30a429 usb: remove some extraneous tty.h includes 2019-12-01 03:56:18 +00:00
Alexander Motin
d93f6d3af3 Add some IDs of Intel Wildcat Point-LP.
MFC after:	1 week
2019-11-26 15:52:19 +00:00
Hans Petter Selasky
c4e11f2231 Add USB ID for Diamond Multimedia BVU195 Display Link device.
Submitted by:	darius@dons.net.au
PR:		242128
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-11-21 16:42:25 +00:00
Emmanuel Vadot
306e46eb1e generic_ehci_fdt: Fix compile when EXT_RESOURCES isn't present 2019-11-09 22:25:45 +00:00
Eric Joyner
74954211d6 net: add ETHER_IS_ZERO macro similar to ETHER_IS_BROADCAST
Some places in network code may need to verify that an ethernet address
is not the 'zero' address. Provide a standard macro ETHER_IS_ZERO for
this purpose, similar to the ETHER_IS_BROADCAST macro already available.

This patch also removes previous ETHER_IS_ZERO definitions in several
USB ethernet drivers, in favor of this centrally-located macro.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>

Submitted by:	Jacob Keller <jacob.e.keller@intel.com>
Reviewed by:	erj@
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D21240
2019-11-05 00:12:21 +00:00
Emmanuel Vadot
3635891a92 dwc3: Use a pair of ()'s around arguments for some macros
Reported by:	hselasky
MFC after:	1 week
X-MFC-With:	r353533
2019-10-16 13:53:53 +00:00
Emmanuel Vadot
ce607eeb9d arm64: Add Synopsys DWC3 driver
This add a driver for the Synopsys DWC3 driver found on multiple SoCs.
It only supports host mode for now.

MFC after:	1 month
2019-10-14 22:27:33 +00:00
Gleb Smirnoff
9b64a6db64 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:32:28 +00:00
Gleb Smirnoff
8fd18ef9b6 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:32:08 +00:00
Gleb Smirnoff
19a1980e10 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:31:57 +00:00
Gleb Smirnoff
c55e6e415c Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:31:43 +00:00
Gleb Smirnoff
2a5f613188 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:31:28 +00:00
Gleb Smirnoff
f8ef073e22 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:30:44 +00:00
Gleb Smirnoff
41840e2dab Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:30:30 +00:00
Gleb Smirnoff
100ad729c5 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:30:06 +00:00
Gleb Smirnoff
0a738e4d65 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:29:50 +00:00
Gleb Smirnoff
ae928424f1 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:29:32 +00:00
Gleb Smirnoff
a433f711bb Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:29:14 +00:00
Gleb Smirnoff
9c601934f6 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:26:53 +00:00
Gleb Smirnoff
3e7e87441c Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:26:17 +00:00
Gleb Smirnoff
b8a6e03fac Widen NET_EPOCH coverage.
When epoch(9) was introduced to network stack, it was basically
dropped in place of existing locking, which was mutexes and
rwlocks. For the sake of performance mutex covered areas were
as small as possible, so became epoch covered areas.

However, epoch doesn't introduce any contention, it just delays
memory reclaim. So, there is no point to minimise epoch covered
areas in sense of performance. Meanwhile entering/exiting epoch
also has non-zero CPU usage, so doing this less often is a win.

Not the least is also code maintainability. In the new paradigm
we can assume that at any stage of processing a packet, we are
inside network epoch. This makes coding both input and output
path way easier.

On output path we already enter epoch quite early - in the
ip_output(), in the ip6_output().

This patch does the same for the input path. All ISR processing,
network related callouts, other ways of packet injection to the
network stack shall be performed in net_epoch. Any leaf function
that walks network configuration now asserts epoch.

Tricky part is configuration code paths - ioctls, sysctls. They
also call into leaf functions, so some need to be changed.

This patch would introduce more epoch recursions (see EPOCH_TRACE)
than we had before. They will be cleaned up separately, as several
of them aren't trivial. Note, that unlike a lock recursion the
epoch recursion is safe and just wastes a bit of resources.

Reviewed by:	gallatin, hselasky, cy, adrian, kristof
Differential Revision:	https://reviews.freebsd.org/D19111
2019-10-07 22:40:05 +00:00
Hans Petter Selasky
ac66be4122 Make control endpoint quirk for xhci(4) configurable.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-10-07 13:40:29 +00:00
Emmanuel Vadot
7a58744fd0 Split out the attachment from the generic-ehci driver
Create an attachment file for the existing ACPI attachment, and create a
new FDT attachment for the generic-ehci driver.

Submitted by:	andrew (Original version)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D19389
2019-10-03 18:53:03 +00:00
Emmanuel Vadot
150c95edfe generic_ehci: Enable all phys and resets
The number of phys and resets is not defined and it controller dependent
so enable/disable every one of them.
2019-10-01 22:20:03 +00:00
Emmanuel Vadot
4dbb3f478b generic_ohci: Look for the phy based on the id
phy-names was never in the bindings schema even if it was present
in some DTS. Get the optional phy based on its ID.
2019-10-01 20:21:49 +00:00
Hans Petter Selasky
7fca0e69f6 Add quirk for XHCI(4) controllers to support USB control transfers
above 1Kbyte.  It might look like some XHCI(4) controllers do not
support when the USB control transfer is split using a link TRB. The
next NORMAL TRB after the link TRB is simply failing with XHCI error
code 4. The quirk ensures we allocate a 64Kbyte buffer so that the
data stage TRB is not broken with a link TRB.

Found at:	EuroBSDcon 2019
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-09-20 11:28:45 +00:00
Hans Petter Selasky
4631d7f717 Increase the maximum user-space buffer size from 256kBytes to 32MBytes for
libusb. This is useful for speeding up large data transfers while reducing
the interrupt rate.

Found at:	EuroBSDcon 2019
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-09-20 11:00:02 +00:00
Hans Petter Selasky
4e792e431a The maximum TD size is 31 and not 15.
Found at:	EuroBSDcon 2019
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-09-20 10:56:13 +00:00
Warner Losh
1af51473bc Some newer HID devices have descriptors that are larger than 1k. Bump
this to 2k to prevent them from being truncated and ignored. It
appears to be a sanity check only, but bumping it to 2k allows both of
my iic hid devices to be parsed and the second one to work...
2019-09-07 03:51:26 +00:00
Hans Petter Selasky
f6549df685 Fix regression issue after r351616. Make sure the mbuf queue gets initialized.
Found by:	gonzo@
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-09-02 08:31:18 +00:00
Jung-uk Kim
1c9c1f5903 Add support for TP-Link Archer T2U Nano.
MFC after:	2 weeks
2019-09-01 06:40:58 +00:00
Gleb Smirnoff
35d3dd8b12 Use mbuf queue instead of ifqueue in USB network drivers.
Reviewed by:	stevek
2019-08-30 00:05:04 +00:00
Bjoern A. Zeeb
c982e56f4b usb: fix usb_fdt_support.c when altq enabled (usb_ehernet.h changes)
After r351243 when ALTQ was enabled in the kernel, the inline functions
in ifq.h would not have full type information as if_var.h was not
included.

Given usb_ethernet.h already includes all the various headers (which)
is the cause of the problem here, add if_var.h to it.  This fixes the
builds again.

Reported by:	CI system, e.g. FreeBSD-head-aarch64-LINT
2019-08-22 09:24:43 +00:00
Justin Hibbits
31c484ad31 Unbreak USB ethernet module builds
Sponsored by:	Juniper Networks, Inc.
2019-08-20 15:14:32 +00:00