Home | History | Annotate | Download | only in libshmif
History log of /src/sys/rump/net/lib/libshmif/if_shmem.c
RevisionDateAuthorComments
 1.89  01-Oct-2024  rin shmif: Fix logics for media change and status

- shmif_mediachange: Drop check for if_link_state. Otherwise,
there can be race b/w events in if_link_queue.

- shmif_mediastatus: Set ifm_status appropriately, by which
link state appears in ifconfig(8) "status:" line.

Pointed out by roy@, and taken from his codes in vether(4). Thanks!!
 1.88  02-Sep-2024  ozaki-r shmif: export LOCK_* definitions

They will be used by upcoming shmif_pcapin.
 1.87  20-Aug-2024  riastradh shmem(4): Fix typo in comment: AFT -> ATF.

Also fix grammar (if I understood correctly what this meant: rump
servers written in C, rather than set up via shell scripts around
rump_server invoking ifconfig).

No functional change intended.
 1.86  20-Aug-2024  ozaki-r shmif: support media

It enables to link-down shmif by ifconfig media none and link-up
again by media auto.
 1.85  20-Aug-2024  ozaki-r shmif: change behaviors about link states

- Change the link state to UP on ifconfig linkstr
- This behavior emulates physical devices
- Change the link state to UNKNOWN on ifconfig -linkstr just in case
- Reject sending/receiving packets if the link state is DOWN
- Permit to send/receive packets on UNKNOWN, which is required
to unbreak some ATF tests written in C
 1.84  09-Apr-2022  riastradh branches: 1.84.4;
if_shmem(4): Use membar_acquire/release for lock acquire/release.
 1.83  14-Jul-2021  ozaki-r shmif: support ALTQ
 1.82  16-Jun-2021  riastradh if_attach and if_initialize cannot fail, don't test return value

These were originally made failable back in 2017 when if_initialize
allocated a softint in every interface for link state changes, so
that it could fail gracefully instead of panicking:

https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html

However, this spawned many seldom- or never-tested error branches,
which are risky to have around. And that softint in every interface
has since been replaced by a single global workqueue, because link
state changes require thread context but not low latency or high
throughput:

https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html

So there is no longer any reason for if_initialize to fail. (The
subroutine if_stats_init can't fail because percpu_alloc can't fail
either.)

There is a snag: the softint_establish in if_percpuq_create could
fail, potentially leading to bad consequences later on trying to use
the softint. This change doesn't introduce any new bugs because of
the snag -- if_percpuq_attach was already broken. However, the snag
can be better addressed without spawning error branches, either by
using a single softint or making softints less scarce.

(Separate commit will change the signatures of if_attach and
if_initialize to return void, scheduled to ride whatever is the next
convenient kernel bump.)

Patch and testing on amd64 and evbmips64-eb by maya@; commit message
soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.
 1.81  25-Feb-2020  ozaki-r branches: 1.81.10;
shmif: reduce the number of calls of cprng(9)
 1.80  25-Feb-2020  ozaki-r shmif: s/sc_uuid/sc_uid/

It's not UUID :-/
 1.79  25-Feb-2020  ozaki-r shmif: use cprng_strong64 instead of cprng_fast64 to generate a unique ID

shmif uses random bytes generated by cprng(9) as a unique device ID
between rump kernels to identify packets fed by itself and not receive
them. So if generated bytes are identical between shmif interfaces on
different rump kernels, shmif may drop incoming packets unintentionally.
This is one cause of recent ATF test failures of IPsec.

Fix it by using cprng_strong64 instead of cprng_fast64. This is a
workaround and we should also investigate why cprng_fast64 starts
failing on rump kernels, although using cprng_strong64 in initialization
itself is feasible.

Fix PR kern/54897
 1.78  20-Feb-2020  ozaki-r shmif: use cprng_strong32 to generate random bytes for a MAC address

cprng_fast32 sometimes returns indentical bytes, which look
"20:0e:11:33" in a MAC address, on different rump_server instances.
That leads MAC address duplications resulting in a test failure.

Fix it by using cprng_strong32 instead of cprng_fast32. However
we should rather fix cprng_fast32 (or rump itself) somehow.

The fix mitigates PR kern/54897 but test failures due to other
causes still remain.
 1.77  01-Feb-2020  thorpej Adopt <net/if_stats.h>.
 1.76  12-Dec-2018  rin branches: 1.76.6;
Add TX/RX offload capabilities to shmif(4). They are emulated in
software by ether_sw_offload_[tr]x().

For rump kernels, if_capabilities for shmemif(4) can be specified
by environmental variable RUMP_SHMIF_CAPENABLE:

setenv RUMP_SHMIF_CAPENABLE 0x7ff80 (all offload)
setenv RUMP_SHMIF_CAPENABLE 0x6aa80 (all TX)
setenv RUMP_SHMIF_CAPENABLE 0x15500 (all RX)

part of PR kern/53562
OK msaitoh
 1.75  26-Jun-2018  msaitoh branches: 1.75.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.74  23-Oct-2017  msaitoh branches: 1.74.2;
Fix compile error.
 1.73  23-Oct-2017  msaitoh If if_initialize() failed in the attach function, free resources and return.
 1.72  22-Dec-2016  ozaki-r branches: 1.72.8;
Fix that rump.ifconfig shmifN destroy hangs up

rump.ifconfig shmifN destroy sometimes hangs up on closing a file
descriptor of kqueue under heavy load. It seems it happens because of
a race condition between closing a fd and kevent to the same fd on
another kthread for packet Rx. Fix it by executing the close operation
after the kthread left.
 1.71  22-Dec-2016  ozaki-r Fix handling return value of rumpcomp_shmif_watchwait
 1.70  15-Dec-2016  ozaki-r Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.69  07-Jul-2016  msaitoh branches: 1.69.2;
KNF. Remove extra spaces. No functional change.
 1.68  16-Jun-2016  ozaki-r Use curlwp_bind and curlwp_bindx instead of open-coding LP_BOUND
 1.67  10-Jun-2016  ozaki-r Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.66  19-Apr-2016  ozaki-r Prevent LWP migrations between CPUs during upper layer processing

This is a contract of psref(9) that is used by upper layer componenets,
e.g., bridge(4).
 1.65  09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.64  26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.63  15-Aug-2014  ozaki-r branches: 1.63.2;
Make shmif SIMPLEX

Add a sender field to a packet header on a shmif bus to identify
and ignore packets sent by itself.

This makes shmif work with bridges.

ok pooka@
 1.62  09-Aug-2014  ozaki-r branches: 1.62.2;
Count packets in if_shmem

ok @pooka
 1.61  28-May-2014  justin Add missing __diagused in rump code
 1.60  20-Mar-2014  christos branches: 1.60.2;
kill sprintf
 1.59  13-Mar-2014  pooka rename rumpcomp_user.* -> shmif_user.*
 1.58  13-Sep-2013  joerg Remove busversion.
 1.57  22-Jul-2013  pooka In recv, align data after ether_header at _ALIGN_BYTES.
 1.56  14-Jun-2013  pooka branches: 1.56.2; 1.56.4;
sauce previous with a comment
 1.55  14-Jun-2013  pooka Ignore too short packets. This condition is true especially for the
first packet on a new bus (len == 0). Everything else in the stack
besides bpf seemed to be able to deal with one, though.
 1.54  01-May-2013  pooka Three cheers for the mighty C type system that doesn't recognize the
difference between an enum and an integer. Due to wrong parameter order,
the lock backoff routine ended up sleeping 1 million seconds instead
of 1ms. On the plus side, we got some sort of idea how often the shmif
spinlock backoff routine is hit during a standard test run.
 1.53  30-Apr-2013  pooka Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.52  29-Apr-2013  pooka Reduce hypercalls related to reading to essentially an amalgamation
of readv and preadv. ditto for writing. Hypercalls are so seldomly
used that it doesn't justify 3x the calls for syntactic sugar.
 1.51  29-Apr-2013  pooka add a private hypercall to map the bus into memory
 1.50  28-Apr-2013  pooka Improve the time-related hypercalls so that's it's possible to
sleep until an absolute time on the host's monotonic clock (should
something like that be supported).
 1.49  28-Apr-2013  pooka * remove the unused "opaque" parameter
* fix some typos in the previous
 1.48  28-Apr-2013  pooka make the file monitoring hypercalls private to shmif
 1.47  14-Jan-2013  pooka fix debug printf formats
 1.46  11-Oct-2012  pooka Pass up all multicast addresses, not just broadcast. Among other
things, makes IPv6 work over this interface.
 1.45  14-Sep-2012  pooka Do not assume that O_FOO flags have matching values in the rump kernel
and hypervisor.
 1.44  19-Nov-2011  tls branches: 1.44.4; 1.44.8;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.43  02-Sep-2011  dyoung branches: 1.43.2;
Report vmem(9) errors out-of-band so that we can use vmem(9) to manage
ranges that include the least and the greatest vmem_addr_t. Update
vmem(9) uses throughout the kernel. Slightly expand on the tests in
subr_vmem.c, which still pass. I've been running a kernel with this
patch without any trouble.
 1.42  25-Aug-2011  dyoung Use VMEM_ADDR_MIN and VMEM_ADDR_MAX.
 1.41  23-Aug-2011  dyoung Introduce a couple of new constants, VMEM_ADDR_MIN (the least possible
address in a vmem(9) arena, 0) and VMEM_ADDR_MAX (the maximum possible
address, currently 0xFFFFFFFF). Modify several boundary conditions so
that a vmem(9) arena can allocate ranges including VMEM_ADDR_MAX.
Update documentation and tests.

These changes pass the tests in sys/kern/subr_vmem.c. To compile the
and run the test program, run "cd sys/kern/ && gcc -DVMEM_SANITY -o
subr_vmem ./subr_vmem.c && ./subr_vmem".
 1.40  07-Aug-2011  rmind Rename slightly misleading KTHREAD_JOINABLE to KTHREAD_MUSTJOIN.
 1.39  21-Mar-2011  pooka Update copyright statements.

no functional change.
 1.38  11-Mar-2011  pooka make the if-else logic more obvious
 1.37  11-Mar-2011  pooka After my change to the "interface accepts this packet" logic
yesterday the CARP test stopped working, since CARP depends on
IFF_PROMISC (which was previously always accidentally enabled).
While making the interface honor IFF_PROMISC, also make it compare
the received frame's address against ifp->if_sadl instead of a
local enaddr value we cached when the interface was created.
 1.36  11-Mar-2011  pooka Don't assume rump kernel PAGE_SIZE and host page size are the same.
 1.35  10-Mar-2011  pooka Support bpf. shmif_dumpbus(1) can be used for much the same effect,
but sometimes it's just more convenient to run tcpdump live.
 1.34  10-Mar-2011  pooka Pass packet up if it's *for* us, not if it's from someone else.
This fixes a rather curious forwarding/redirect/etc. storm which
happened when there were >2 shmif kernels on the same shmbus with
ip forwarding set on. (at least it stress-tested other code ;)
 1.33  06-Dec-2010  pooka branches: 1.33.2;
Allow creation with NULL busname (to be later set with SIOCSLINKSTR).
 1.32  17-Nov-2010  pooka Support destroy in shmif.
 1.31  16-Nov-2010  pooka Use vmem for keeping track of unit numbers so that wildcard allocation
works correctly.
 1.30  15-Nov-2010  pooka "fix" completely crackheaded code w/ uninitialized use,
missed as usual by the wonderful -g -O0
 1.29  15-Nov-2010  pooka * make interface a cloner
* use SIOCSLINKSTR for supplying bus filename in case of cloned if

TODO: downing interface, unclone, and some tweaks for robustness
 1.28  17-Aug-2010  pooka Prefault bus pages in driver attachment. This seems to work around
weird corruption I've been seeing (most likely a host kernel bug).

For more details, see thread at:
http://mail-index.netbsd.org/tech-kern/2010/08/17/msg008749.html
 1.27  17-Aug-2010  pooka * fix off-by-wrap case where current datagram aligns exactly with
the end of the bus
* clarify the "can we still use the device's next pointer" calculation
and move it to its own routine
* sprinkle dprintf
 1.26  16-Aug-2010  pooka simplify, improve, etc.
 1.25  15-Aug-2010  pooka reset pktsize each loop
 1.24  15-Aug-2010  pooka reset wrap where necessary
 1.23  15-Aug-2010  pooka Move the lockops together with the interface -- they are needed
only at runtime.
 1.22  15-Aug-2010  pooka Take kernel lock before passing data to if_input. This is in line
with IPL_NET interrupts generally not being MPSAFE.
 1.21  15-Aug-2010  pooka Don't do timestamping with buslock held. it's the little things ...
 1.20  13-Aug-2010  pooka Include a timestamp in the frame header. When converting to pcap,
it can give some idea of when packets were sent.

nb. it's the sending host's timestamp, not an observer timestamp
like in the typical pcap case.
 1.19  12-Aug-2010  pooka Include a pointer to the beginning of the buffer and add support
to the packet dumper. This helps in situations where the juicy
details are in a bus multiple generations old.
 1.18  12-Aug-2010  pooka further simplify & fix calculations
 1.17  12-Aug-2010  pooka * include a magic number in the bus format
* simplify offset calculations by making them start from beginning of data
 1.16  12-Aug-2010  pooka Make shmif memory access slightly more sane. Create a header which
is shared by the interface and the bus analyzer.
 1.15  11-Aug-2010  pooka * remove some magic numbers from the code
* include bus version number in header just in case we want to examine
bus traffic at some point in the future
 1.14  11-Aug-2010  pooka Change bus header a little: reserve only 32bits for the lock and
use 32bit atomic ops to handle it. Begin data from 0x10 instead
of 0x14.
 1.13  10-Aug-2010  pooka * use atomic ops instead of __cpu_simple_luck
* this interface is un-IFF_SIMPLEX
 1.12  29-Jul-2010  pooka * print interface number, backend path and ethernet address for dmesg
* make kassert more demanding
 1.11  29-Jul-2010  pooka * increase bus size so that we don't wrap so quickly when NFS
flushes writes
* verbosize debug print a bit
 1.10  30-Nov-2009  pooka branches: 1.10.2; 1.10.4;
fix comment
 1.9  20-Oct-2009  pooka use autogenerated prototype
 1.8  20-Oct-2009  pooka printf -> rumpuser_dprintf
(can't use printf while holding spinlock)
 1.7  26-May-2009  pooka Filter out ENETRESET from ether_ioctl() since we aren't interested
in multicast hugging.
 1.6  06-Apr-2009  pooka branches: 1.6.2; 1.6.4;
let drivers define DPRINTF
 1.5  18-Mar-2009  pooka * allow to specify PROT_READ/PROT_WRITE when mmapping a file
* add msync
 1.4  01-Mar-2009  pooka branches: 1.4.2;
Create receive thread only in if_start() to make sure it happens
after the we have been attached to the ethernet framework.
XXX: if_stop is still unimplemented
 1.3  01-Mar-2009  martin add missing atomic.h include
 1.2  28-Feb-2009  pooka don't require the ifnum return pointer.
 1.1  28-Feb-2009  pooka Add a virtual ethernet interface which uses shared memory as the
bus instead of relying on the host kernel's tap and bridge. This
is much lighterweight approach which does not consume non-pageable
kernel resources.
 1.4.2.3  28-Apr-2009  skrll Sync with HEAD.
 1.4.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.4.2.1  01-Mar-2009  skrll file if_shmem.c was added on branch nick-hppapmap on 2009-03-03 18:34:31 +0000
 1.6.4.3  23-Jul-2009  jym Sync with HEAD.
 1.6.4.2  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.4.1  06-Apr-2009  jym file if_shmem.c was added on branch jym-xensuspend on 2009-05-13 17:23:02 +0000
 1.6.2.6  09-Oct-2010  yamt sync with head
 1.6.2.5  11-Aug-2010  yamt sync with head.
 1.6.2.4  11-Mar-2010  yamt sync with head
 1.6.2.3  20-Jun-2009  yamt sync with head
 1.6.2.2  04-May-2009  yamt sync with head.
 1.6.2.1  06-Apr-2009  yamt file if_shmem.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:33 +0000
 1.10.4.2  21-Apr-2011  rmind sync with head
 1.10.4.1  05-Mar-2011  rmind sync with head
 1.10.2.2  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.10.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.33.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.43.2.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.43.2.3  23-Jan-2013  yamt sync with head
 1.43.2.2  30-Oct-2012  yamt sync with head
 1.43.2.1  17-Apr-2012  yamt sync with head
 1.44.8.5  03-Dec-2017  jdolecek update from HEAD
 1.44.8.4  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.44.8.3  23-Jun-2013  tls resync from head
 1.44.8.2  25-Feb-2013  tls resync with head
 1.44.8.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.44.4.1  08-Feb-2013  riz Pull up following revision(s) (requested by gdt in ticket #796):
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.46
Pass up all multicast addresses, not just broadcast. Among other
things, makes IPv6 work over this interface.
 1.56.4.1  23-Jul-2013  riastradh sync with HEAD
 1.56.2.2  18-May-2014  rmind sync with head
 1.56.2.1  28-Aug-2013  rmind sync with head
 1.60.2.1  10-Aug-2014  tls Rebase.
 1.62.2.1  17-Aug-2014  riz Pull up following revision(s) (requested by ozaki-r in ticket #28):
sys/rump/net/lib/libshmif/shmifvar.h: revision 1.8
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.63
sys/rump/net/lib/libshmif/shmifvar.h: revision 1.9
Make shmif SIMPLEX
Add a sender field to a packet header on a shmif bus to identify
and ignore packets sent by itself.
This makes shmif work with bridges.
ok pooka@
Bump SHMIF_VERSION
 1.63.2.4  05-Feb-2017  skrll Sync with HEAD
 1.63.2.3  09-Jul-2016  skrll Sync with HEAD
 1.63.2.2  22-Apr-2016  skrll Sync with HEAD
 1.63.2.1  19-Mar-2016  skrll Sync with HEAD
 1.69.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.72.8.1  10-Dec-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #427):
sys/arch/amiga/dev/if_bah_zbus.c: 1.17
sys/arch/arm/broadcom/bcm53xx_eth.c: 1.30
sys/arch/powerpc/booke/dev/pq3etsec.c: 1.32
sys/arch/usermode/dev/if_veth.c: 1.9
sys/dev/ic/an.c: 1.66
sys/dev/ic/athn.c: 1.17
sys/dev/ic/atw.c: 1.162
sys/dev/ic/bwi.c: 1.33
sys/dev/ic/dwc_gmac.c: 1.41-1.42
sys/dev/ic/malo.c: 1.10
sys/dev/ic/rt2560.c: 1.31
sys/dev/ic/rt2661.c: 1.36
sys/dev/ic/rt2860.c: 1.29
sys/dev/ic/rtw.c: 1.127
sys/dev/ic/rtwvar.h: 1.46
sys/dev/ic/smc90cx6.c: 1.71
sys/dev/ic/smc90cx6var.h: 1.12
sys/dev/ic/wi.c: 1.244
sys/dev/pci/if_ipw.c: 1.66
sys/dev/pci/if_iwi.c: 1.104
sys/dev/pci/if_iwm.c: 1.76
sys/dev/pci/if_iwn.c: 1.86
sys/dev/pci/if_rtwn.c: 1.13
sys/dev/pci/if_wm.c: 1.541
sys/dev/pci/if_wpi.c: 1.79
sys/dev/pci/ixgbe/ixgbe.c: 1.106
sys/dev/pci/ixgbe/ixv.c: 1.73 via patch
sys/dev/pcmcia/if_malo_pcmcia.c: 1.15
sys/dev/scsipi/if_se.c: 1.95
sys/dev/usb/if_upl.c: 1.60
sys/net/if.c: 1.396
sys/net/if.h: 1.241
sys/net/if_arc.h: 1.23
sys/net/if_arcsubr.c: 1.78
sys/net/if_bridge.c: 1.136-1.137
sys/net/if_etherip.c: 1.39
sys/net/if_faith.c: 1.56
sys/net/if_gif.c: 1.131
sys/net/if_loop.c: 1.96
sys/net/if_mpls.c: 1.30
sys/net/if_pppoe.c: 1.129
sys/net/if_srt.c: 1.27
sys/net/if_stf.c: 1.102
sys/net/if_tap.c: 1.100
sys/net/if_vlan.c: 1.105
sys/netinet/ip_carp.c: 1.91
sys/rump/net/lib/libshmif/if_shmem.c: 1.73-1.74
sys/rump/net/lib/libvirtif/if_virt.c: 1.55-1.56
if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.
Return if bah_attach_subr() failed.
If if_attach() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add some missing frees in bridge_clone_destroy().
- KNF
If error occured in bcmeth_ccb_attach(), free resources and return.
If error occured in pq3etsec_attach(), free resources and return.
If error occured in the attach function, free resources and return.
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
- Free resources correctly on some errors in atw_attach().
- Use apint*() insread of printf() in the attach function.
If if_initialize() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach
failed.
- If if_initialize() failed in the attach function, free resources and return.
- ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc.
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.
If if_initialize() failed in the attach function, free resources and return.
If if_attach() failed in the attach function, free resources and return.
- If if_initialize() failed in the attach function, free resources and return.
- KNF
- If if_attach() failed in the attach function, free resources and return.
- KNF
Fix compile error.
Fix compile error.
We don't need '&mii', but just 'mii' for mii_detach().
Don't free sc_rthash twice
 1.74.2.2  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.74.2.1  28-Jul-2018  pgoyette Sync with HEAD
 1.75.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.75.2.1  10-Jun-2019  christos Sync with HEAD
 1.76.6.1  29-Feb-2020  ad Sync with head.
 1.81.10.2  01-Aug-2021  thorpej Sync with HEAD.
 1.81.10.1  17-Jun-2021  thorpej Sync w/ HEAD.
 1.84.4.3  03-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #924):

sys/rump/net/lib/libshmif/if_shmem.c: revision 1.89

shmif: Fix logics for media change and status

- shmif_mediachange: Drop check for if_link_state. Otherwise,
there can be race b/w events in if_link_queue.
- shmif_mediastatus: Set ifm_status appropriately, by which
link state appears in ifconfig(8) "status:" line.

Pointed out by roy@, and taken from his codes in vether(4). Thanks!!
 1.84.4.2  05-Sep-2024  martin Pull up following revision(s) (requested by ozaki-r in ticket #817):

tests/usr.bin/Makefile: revision 1.41 (patch)
distrib/sets/lists/base/mi: revision 1.1350 (patch)
usr.bin/shmif_pcapin/shmif_pcapin.1: revision 1.1
distrib/sets/lists/man/mi: revision 1.1787 (patch)
distrib/sets/lists/debug/mi: revision 1.447 (patch)
tests/usr.bin/shmif_pcapin/d_pcap.out.bz2.uue: revision 1.1
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.88
etc/mtree/NetBSD.dist.tests: revision 1.207
sys/rump/net/lib/libshmif/shmifvar.h: revision 1.12
usr.bin/shmif_pcapin/shmif_pcapin.c: revision 1.1
usr.bin/shmif_pcapin/Makefile: revision 1.1
tests/usr.bin/shmif_pcapin/t_basic.sh: revision 1.1
usr.bin/Makefile: revision 1.240
distrib/sets/lists/tests/mi: revision 1.1335 (patch)
tests/usr.bin/shmif_pcapin/Makefile: revision 1.1
tests/usr.bin/shmif_pcapin/d_pcap.in.bz2.uue: revision 1.1

shmif: export LOCK_* definitions
They will be used by upcoming shmif_pcapin.

Add shmif_pcapin(1) utility program

It can send any frames that are stored in a pcap(3) file format to
shmif(4) Ethernet interface via the bus of it. If you want to write
some tests for networking with rump kernels and the tests need to send
frames that are difficult to generate by stock programs, shmif_pcapin
can be helpful.

The author of shmif_pcapin is k-goda@IIJ and the man page is written
by ozaki-r.

tests: add a basic test for shmif_pcapin

The original author of the test is k-goda@IIJ. ozaki-r tweaked
the test to improve stability and added comments.
distrib, etc: install shmif_pcapin and its tests
 1.84.4.1  24-Aug-2024  martin Pull up following revision(s) (requested by ozaki-r in ticket #811):

tests/net/if_shmif/t_shmif.sh: revision 1.1
sbin/ifconfig/ifconfig.c: revision 1.251
sbin/ifconfig/ifconfig.8: revision 1.130
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.85
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.86
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.87
etc/mtree/NetBSD.dist.tests: revision 1.206
distrib/sets/lists/tests/mi: revision 1.1333
tests/net/if_shmif/Makefile: revision 1.1
tests/net/Makefile: revision 1.42

shmif: change behaviors about link states

- Change the link state to UP on ifconfig linkstr
- This behavior emulates physical devices
- Change the link state to UNKNOWN on ifconfig -linkstr just in case
- Reject sending/receiving packets if the link state is DOWN
- Permit to send/receive packets on UNKNOWN, which is required
to unbreak some ATF tests written in C

shmif: support media

It enables to link-down shmif by ifconfig media none and link-up
again by media auto.

ifconfig: show link state on -v

We could guess it through "media" or "status" output, however, we
sometimes want to know it directly for debugging or testing.

It is shown only if the -v option is specified.
tests: add tests for shmif

The test file is placed under tests/net, not tests/rump/rumpnet,
to leverage utility functions provided for tests in there.
shmem(4): Fix typo in comment: AFT -> ATF.

Also fix grammar (if I understood correctly what this meant: rump
servers written in C, rather than set up via shell scripts around
rump_server invoking ifconfig).

No functional change intended.

RSS XML Feed