0fd8d358 emaste Aug. 10, 2022, 9:17 p.m.
Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36096
685866bb melifaro Aug. 10, 2022, 8:45 p.m.
MFC after:	1 month
348164aa manu Aug. 10, 2022, 8:07 p.m.
Those are the defines needed to change speed on a SDIO card.
49da0242 manu Aug. 10, 2022, 8:07 p.m.
1ee7a804 manu Aug. 10, 2022, 8:07 p.m.
SDIO CMD53 (RW Extented) can either write to the same address (useful for FIFO)
or auto increment the destination address (to write to multiple registers).
It is more logical to have read/write_4 to use incremental mode and make other
helper function for writing to a FIFO destination especially since most FIFO
write/read will be 8bits based and not 32bits based.
b9db5e0a manu Aug. 10, 2022, 8:07 p.m.
Do not use b/l but _1/_4 also address comes first and then data.
This makes them closer to something like bus_space_{read,write}
We have no users in the tree.
3471fcf3 emaste Aug. 10, 2022, 7:35 p.m.
Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
102e6817 melifaro Aug. 10, 2022, 6:56 p.m.
Currently, subr_bus.c shares logic for (a) maintaining all HW devices
 (e.g. discovery/attach/detach logic) and (b) generic devctl notification
 layer for devices/PMU/GEOM/interfaces/etc).
These two subsystems share really tiny interaction interface, composed of 3
 notification functions. With that in mind, move devctl layer to a
 separate file, establishing a clear notification interface between the
 sub.c bus layer and the provider (devctl).

The primary driver of this change is netlink implementation (D36002).
The idea is to propagate device-level events to netlink as well, so all
 netlink customers can subscribe to these changes.
The long-term goal is to deprecate devctl and to use netlink as the
 kernel<> userland transport provided netlink gets enough traction.

Reviewed by:	imp, markj
Differential Revision: https://reviews.freebsd.org/D36091
MFC after:	1 month
5c4d2252 melifaro Aug. 10, 2022, 6:56 p.m.
route_ctl.c size has grown considerably since initial introduction.
Factor out non-relevant parts:
* all rtentry logic, such as creation/destruction and accessors
 goes to net/route/route_rtentry.c
* all rtable subscription logic goes to net/route/route_subscription.c

Differential Revision: https://reviews.freebsd.org/D36074
MFC after:	1 month
2ce55385 melifaro Aug. 10, 2022, 6:56 p.m.
This change adds public KPI to work with routes using pre-created
 nexthops, instead of using data from addrinfo structures. These
 functions will be later used for adding/deleting kernel-originated
 routes and upcoming netlink protocol.

As a part of providing this KPI, low-level route addition code has been
 reworked to provide more control over route creation or change.
 Specifically, a number of operation flags
 (RTM_F_<CREATE|EXCL|REPLACE|APPEND>) have been added, defining the
 desired behaviour the the route already exists (or not exists). This
 change required some changes in the multipath addition code, resulting
 in moving this code to route_ctl.c, rendering mpath_ctl.c empty.

Differential Revision: https://reviews.freebsd.org/D36073
MFC after:	1 month
66230639 melifaro Aug. 10, 2022, 6:27 p.m.
This change is required for the upcoming introduction of the next
 nexhop-based operations KPI, as it will create rtentry and nexthops
 at different stages of route table modification.

Differential Revision: https://reviews.freebsd.org/D36072
MFC after:	2 weeks
dedeec11 melifaro Aug. 10, 2022, 6:20 p.m.
* Use same filter func (rib_filter_f_t) for nexhtop groups to
 simplify callbacks.
* simplify conditional route deletion & remove the need to pass
 rt_addrinfo to the low-level deletion functions
* speedup rib_walk_del() by removing an additional per-prefix lookup

Differential Revision: https://reviews.freebsd.org/D36071
MFC after:	1 month
0d60e88b melifaro Aug. 10, 2022, 6:20 p.m.
This and the follow-up routing-related changes target to remove or
 reduce `struct rt_addrinfo` usage and use recently-landed nhop(9)
 KPI instead.
Traditionally `rt_addrinfo` structure has been used to propagate all necessary
information between the protocol/rtsock and a routing layer. Many
functions inside routing subsystem uses it internally. However, using
this structure became somewhat complicated, as there are too many ways
of specifying a single state and verifying data consistency is hard.
For example, arerouting flgs consistent with mask/gateway sockaddr pointers?
Is mask really a host mask? Are sockaddr "valid" (e.g. properly zeroed, masked,
have proper length)? Are they mutable? Is the suggested interface specified
 by the interface index embedded into the sockadd_dl gateway, or passed
 as RTAX_IFP parameter, or directly provided by rti_ifp or it needs to
 be derived from the ifa?
These (and other similar) questions have to be considered every time when
 a function has `rt_addrinfo` pointer as an argument.

The new approach is to bring more control back to the protocols and
construct the desired routing objects themselves - in the end, it's the
protocol/subsystem who knows the desired outcome.

This specific diff changes the following:
* add explicit basic low-level radix operations:
 add_route() (renamed from add_route_nhop())
 delete_route() (factored from change_route_nhop())
 change_route() (renamed from change_route_nhop)
* remove "info" parameter from change_route_conditional() as a part
 of reducing rt_addrinfo usage in the internal KPIs
* add lookup_prefix_rt() wrapper for doing re-lookups after
 RIB lock/unlock

Differential Revision: https://reviews.freebsd.org/D36070
MFC after:	2 weeks
07285bb4 glebius Aug. 10, 2022, 6:09 p.m.
This streamlines cloning of a socket from a listener.  Now we do not
drop the inpcb lock during creation of a new socket, do not do useless
state transitions, and put a fully initialized socket+inpcb+tcpcb into
the listen queue.

Before this change, first we would allocate the socket and inpcb+tcpcb via
tcp_usr_attach() as TCPS_CLOSED, link them into global list of pcbs, unlock
pcb and put this onto incomplete queue (see 6f3caa6d815).  Then, after
sonewconn() we would lock it again, transition into TCPS_SYN_RECEIVED,
insert into inpcb hash, finalize initialization of tcpcb.  And then, in
call into tcp_do_segment() and upon transition to TCPS_ESTABLISHED call
soisconnected().  This call would lock the listening socket once again
with a LOR protection sequence and then we would relocate the socket onto
the complete queue and only now it is ready for accept(2).

Reviewed by:		rrs, tuexen
Differential revision:	https://reviews.freebsd.org/D36064
8f5a0a2e glebius Aug. 10, 2022, 6:09 p.m.
as alternative KPI to sonewconn().  The latter has three stages:
- check the listening socket queue limits
- allocate a new socket
- call into protocol attach method
- link the new socket into the listen queue of the listening socket

The attach method, originally designed for a creation of socket by the
socket(2) syscall has slightly different semantics than attach of a socket
cloned by listener.  Make it possible for protocols to call into the
first stage, then perform a different attach, and then call into the
final stage.  The first stage, that checks limits and clones a socket
is called solisten_clone(), and the function that enqueues the socket
is solisten_enqueue().

Reviewed by:		tuexen
Differential revision:	https://reviews.freebsd.org/D36063