History log of /netbsd-src/sys/rump/net/lib/libshmif/if_shmem.c (Results 1 – 25 of 89)
Revision Date Author Comments
# fb485dae 01-Oct-2024 rin <rin@NetBSD.org>

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 appr

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!!

show more ...


# 9123ebc1 02-Sep-2024 ozaki-r <ozaki-r@NetBSD.org>

shmif: export LOCK_* definitions

They will be used by upcoming shmif_pcapin.


# dd766027 20-Aug-2024 riastradh <riastradh@NetBSD.org>

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 if

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.

show more ...


# d89b0a37 20-Aug-2024 ozaki-r <ozaki-r@NetBSD.org>

shmif: support media

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


# 4a952ad7 20-Aug-2024 ozaki-r <ozaki-r@NetBSD.org>

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 i

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

show more ...


# 36c7c52a 09-Apr-2022 riastradh <riastradh@NetBSD.org>

if_shmem(4): Use membar_acquire/release for lock acquire/release.


# f62bf30a 14-Jul-2021 ozaki-r <ozaki-r@NetBSD.org>

shmif: support ALTQ


# 076e3579 16-Jun-2021 riastradh <riastradh@NetBSD.org>

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

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.

show more ...


# 82bf8980 25-Feb-2020 ozaki-r <ozaki-r@NetBSD.org>

shmif: reduce the number of calls of cprng(9)


# 056381ce 25-Feb-2020 ozaki-r <ozaki-r@NetBSD.org>

shmif: s/sc_uuid/sc_uid/

It's not UUID :-/


# 01d5ee54 25-Feb-2020 ozaki-r <ozaki-r@NetBSD.org>

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 a

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

show more ...


# e90f6c59 20-Feb-2020 ozaki-r <ozaki-r@NetBSD.org>

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.
T

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.

show more ...


# c85e2f36 01-Feb-2020 thorpej <thorpej@NetBSD.org>

Adopt <net/if_stats.h>.


# f7201ab7 12-Dec-2018 rin <rin@NetBSD.org>

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 RUM

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

show more ...


# 3cd62456 26-Jun-2018 msaitoh <msaitoh@NetBSD.org>

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 th

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.

show more ...


# a6520789 23-Oct-2017 msaitoh <msaitoh@NetBSD.org>

Fix compile error.


# 916c83ee 23-Oct-2017 msaitoh <msaitoh@NetBSD.org>

If if_initialize() failed in the attach function, free resources and return.


# 95d40bea 22-Dec-2016 ozaki-r <ozaki-r@NetBSD.org>

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 conditio

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.

show more ...


# bf6d49ec 22-Dec-2016 ozaki-r <ozaki-r@NetBSD.org>

Fix handling return value of rumpcomp_shmif_watchwait


# dd8638ee 15-Dec-2016 ozaki-r <ozaki-r@NetBSD.org>

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_ip

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

show more ...


# 8bc54e5b 07-Jul-2016 msaitoh <msaitoh@NetBSD.org>

KNF. Remove extra spaces. No functional change.


# e1135cd9 16-Jun-2016 ozaki-r <ozaki-r@NetBSD.org>

Use curlwp_bind and curlwp_bindx instead of open-coding LP_BOUND


# d938d837 10-Jun-2016 ozaki-r <ozaki-r@NetBSD.org>

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 rcv

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.

show more ...


# 220ff4e7 19-Apr-2016 ozaki-r <ozaki-r@NetBSD.org>

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).


# 9c4cd063 09-Feb-2016 ozaki-r <ozaki-r@NetBSD.org>

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

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!

show more ...


1234