Commit graph

33 commits

Author SHA1 Message Date
cinap_lenrek 67750a093f nusb/ether: use setalt() 2022-02-23 18:01:15 +00:00
cinap_lenrek 9cd55a085d nusb/ether: remove csp check for rndis, already done in nusbrc 2022-02-23 17:59:13 +00:00
cinap_lenrek 065d601916 nusb: Fix handling of interface altsetting.
The altsetting was handled only for a single endpoint
(per interface number), but has to be handled for each
endpoint (per interface *AND* altsetting number).

A multi function device (like a disk) can have
multiple interfaces, all with the same interface number
but varying altsetting numbers and each of these
interfaces would list distict endpoint configurations.

Multiple interfaces can even share some endpoints (they
use the same endpoint addresses), but
we still have to duplicate them for each
interface+altsetting number (as they'r part of
actually distict interfaces with distict endpoint
configurations).

It is also important to *NOT* make endpoints bi-directional
(dir == Eboth) when only one direction is used in a
interface/altsetting and the other direction in another.
This was the case for nusb/disk with some seagate drive
where endpoints where shared between the UAS and
usb storage class interface (but with distict altsettings).

The duplicate endpoints (as in using the same endpoint address)
are chained together by a next pointer and the head
is stored in Usbdev.ep[addr], where addr is the endpoint
address. These Ep structures will have distinct endpoint
numbers Ep.id (when they have conflicting types), but all
will share the endpoint address (lower 4 bits of the
endpoint number).

The consequence is that all of the endpoints configuration
(attributes, interval) is now stored in the Ep struct and
no more Altc struct is present.

A pointer to the Ep struct has to be passed to openep()
for it to configure the endpoint.

For the Iface struct, we will now create multiple of them:
one for each interface *AND* altsetting nunber,
chained together on a next pointer and the head being
stored in conf->iface[ifaceid].

--
cinap
2022-02-21 19:50:16 +00:00
Sigrid f5db3bf0e0 nusb/ether: rndis: add standard class code (tested by jmi2k with OnePlus 8) 2021-04-20 18:08:58 +02:00
Romano a398a09783 [9front] [patch] nusb/ether -t rndis 2021-04-01 12:54:08 +02:00
cinap_lenrek 86a9f92f47 nusb/ether: add support for lan78xx (raspi3) (thanks richard miller) 2018-10-20 19:30:16 +02:00
cinap_lenrek 29865005f9 nusb/ether: tune buffer size parameters for SMSC ethernet (raspi) (thanks richard miller) 2018-10-20 19:29:18 +02:00
cinap_lenrek 45ce4de650 nusb/ether: fix ethertype filtering 2018-08-07 23:46:58 +02:00
cinap_lenrek 986278e04d nusb/ether: mux bridges, bring in line with devether 2018-02-18 19:56:58 +01:00
cinap_lenrek a2e8246ffc nusb: add missing header dependencies to mkfiles 2018-02-18 02:06:55 +01:00
cinap_lenrek 3e22f7ef1d nusb/ether: dont forward loopback packets on bridges, remove read nonblocking hack 2017-12-18 20:50:25 +01:00
cinap_lenrek 9fd8894fec ether: allow spoofing of source mac address for bridges; used by vmx
to implement layer 2 bridges in userspace, we disable to auto filling
of the source mac address when bridge mode is enabled on the
connection.
2017-12-15 22:22:29 +01:00
cinap_lenrek fdc8187038 nusb/ether: support for "bridge" ctl message 2016-11-12 23:11:03 +01:00
cinap_lenrek cb9a5a19b0 nusb/ether: promisc and multicast support for admtek pegasus (aue) 2016-09-17 14:18:40 +02:00
cinap_lenrek 382abccf27 nusb/ether: multicast and promisc support for rtl8150 (url) 2016-09-17 14:06:03 +02:00
cinap_lenrek c937aac59b nusb/ether: experimental pomisc mode and multicast support for smsc and asix 2016-09-16 23:21:54 +02:00
cinap_lenrek 4275c49e72 nusb: implement aijus stable uniqueue device names
instead of naming devices by ther dynamically assigned device address,
we hash device uniqueue fields from the device descriptor and produce
a 5 digit hex string that will identify the device across machines.

when there is a collision (less than 1% chance with 100 devices),
usbd will append the device address to the name to make it uniqueue
for this machine.

the hname is passed to drivers in the devid argument, which now has
the form addr:hname, where the colon and hname can be omited (for backwards
compatibility).

when the new behaviour isnt desired, nousbhname= environment variable
can be defined giving the old behaviour.
2014-06-28 18:09:43 +02:00
ftrvxmtrx 70d7f4c32a nusb/rndis: avoid allocation on each transmission
The slack space for outgoing packets set to 44+16 bytes.
2014-04-23 21:20:11 +02:00
ftrvxmtrx 99c0abc76d nusb/ether: add RNDIS support (tested on Nexus 5) 2014-04-22 23:34:52 +02:00
cinap_lenrek fc78640118 nusb/ether: fix pointer truncation 2014-02-14 14:18:09 +01:00
cinap_lenrek 8ceb100fa4 nusb/ether: new driver interface with kernel inspired Block buffers
introduce kernel inspured Block structure with
read/write pointers to pass packets arround.

the intend is to avoid copying when adding/removing
frame headers and simplifying the drivers.

the driver now calls etheriq() directly allowing it to
queue multiple packets in one pass without having
to keep state.

transmit gets a buffer passed that has room for
frame headers and trailers so no copying is needed.

blocks are refcounted avoiding another copy when
passed to only one receive queue (common case).

receive queues are now limited to 100KB avoiding
buffer bloat.

Dq* a memory leak in destroyfid has been fixed.

lots of minor cleanups.
2013-10-18 18:41:27 +02:00
cinap_lenrek 52fc6d50d4 nusb/ether: fix wrong size check causing odd sized packets to be discarded (thanks mischief!)
ethernet packets with sizes that where not multiples of 4 where
discarded because the check uses the smsc frame size instead of
the payload size. when a usb read returns just one packet, theres
no next frame header and the calculated frame size is bigger than
the usb read which caused the whole packet to be discarded as invalid.

thanks to mischief for testing and debugging!
2013-10-16 16:42:40 +02:00
ppatience0 225cc4af5c nusb/ether: add rtl8150 driver, remove unused includes 2013-10-02 02:25:43 -04:00
ppatience0 334054e0e7 nusb/ether: add aue driver for admtek pegasus usb ethernet adapter 2013-08-24 19:18:15 -04:00
ppatience0 d1b6c02ac9 nusb/ether: fix asixread() invert/shift in wrong order 2013-06-19 21:25:08 -04:00
cinap_lenrek 1a6d523d26 nusb/ether: fix asixwrite()
invert/shift in wrong order causing low 16 bits to be all ffff...
2013-06-18 02:00:05 +02:00
ppatience0 89ed97aaa2 nusb/ether: call sysfatal if dev is nil 2013-06-16 20:37:51 -04:00
cinap_lenrek 6e630a2d1f nusb/ether: remove debug prints, cleanup 2012-12-06 00:31:25 +01:00
cinap_lenrek 29ca49ca38 nusb/ether: remove vid check in smsc driver, cleanup cdc driver 2012-12-06 23:24:42 +01:00
cinap_lenrek 23239adf54 nusb/ether: port drivers for asix and smsc ethernet 2012-12-06 23:05:24 +01:00
cinap_lenrek a064a48e6d nusb: handle 0 csp value on iface, remove unneeded configdev() calls after getdev() 2012-09-06 05:25:23 +02:00
cinap_lenrek aff787ea2a nusb/ether: fix exit status 2011-08-27 07:43:20 +02:00
cinap_lenrek 6074cf1319 nusb: add ethernet 2011-08-26 15:37:47 +02:00