limits: 256 PCI functions, 128 sockets and devices, 64 USB interfaces
The fixed tables that a bigger machine than the one they were written
on reaches first, each raised to where it costs little:
NPCI 64 -> 256 a desktop with cards and Thunderbolt passes 64,
and the devices past it -- often the disk or
NIC last in bus order -- were ignored; 44 KB
NSOCK 32 -> 128 Unix sockets, which a desktop session uses by
the dozen; 4.9 KB each, 470 KB in all
NDEVICE 32 -> 128 120 bytes each
NIFDEV 16 -> 64 one dock is a hub, Ethernet, audio and a card
reader at two or three interfaces apiece
NETIF_MAX 4 -> 8
Device names took one digit and clamped there, so the tenth device of
a kind and every one after it was named "...9". Two digits now.
Checked under QEMU with two bridges of test devices: 68 functions,
all in lspci, /proc/pci and /sys/bus/pci.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
c1af31f75a
commit
4805dbd892
6 changed files with 19 additions and 12 deletions
|
|
@ -93,11 +93,13 @@ device_add(const char *base, enum dev_bus bus, enum dev_class class,
|
|||
d->name[n] = base[n];
|
||||
n++;
|
||||
}
|
||||
// Single digit is enough for NDEVICE of 32 per base name, and a two-digit
|
||||
// path that is never taken is a two-digit path that is never tested.
|
||||
// Two digits once there are ten of a kind. This clamped at 9, so the tenth
|
||||
// and every later disk or interface of one kind were all called "...9".
|
||||
if (idx > 99)
|
||||
idx = 99;
|
||||
if (idx > 9)
|
||||
idx = 9;
|
||||
d->name[n++] = (char)('0' + idx);
|
||||
d->name[n++] = (char)('0' + idx / 10);
|
||||
d->name[n++] = (char)('0' + idx % 10);
|
||||
d->name[n] = '\0';
|
||||
|
||||
return d;
|
||||
|
|
|
|||
|
|
@ -130,9 +130,10 @@ parse_config(struct usb_dev *dev, int nth)
|
|||
}
|
||||
|
||||
// One usb_dev for every interface after the first. See `base` in
|
||||
// include/usb.h. A fixed pool, like everything else here: sixteen is more
|
||||
// interfaces than a desk of keyboards, mice and receivers adds up to.
|
||||
#define NIFDEV 16
|
||||
// include/usb.h. A fixed pool, like everything else here. It was sixteen,
|
||||
// which a dock -- hub, Ethernet, audio, card reader, each two or three
|
||||
// interfaces -- and a couple of receivers already reach. 672 bytes each.
|
||||
#define NIFDEV 64
|
||||
static struct usb_dev ifdevs[NIFDEV];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue