mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 08:49:45 +00:00
![Linus Torvalds](/assets/img/avatar_default.png)
Core ---- - Introduce XDP multi-buffer support, allowing the use of XDP with jumbo frame MTUs and combination with Rx coalescing offloads (LRO). - Speed up netns dismantling (5x) and lower the memory cost a little. Remove unnecessary per-netns sockets. Scope some lists to a netns. Cut down RCU syncing. Use batch methods. Allow netdev registration to complete out of order. - Support distinguishing timestamp types (ingress vs egress) and maintaining them across packet scrubbing points (e.g. redirect). - Continue the work of annotating packet drop reasons throughout the stack. - Switch netdev error counters from an atomic to dynamically allocated per-CPU counters. - Rework a few preempt_disable(), local_irq_save() and busy waiting sections problematic on PREEMPT_RT. - Extend the ref_tracker to allow catching use-after-free bugs. BPF --- - Introduce "packing allocator" for BPF JIT images. JITed code is marked read only, and used to be allocated at page granularity. Custom allocator allows for more efficient memory use, lower iTLB pressure and prevents identity mapping huge pages from getting split. - Make use of BTF type annotations (e.g. __user, __percpu) to enforce the correct probe read access method, add appropriate helpers. - Convert the BPF preload to use light skeleton and drop the user-mode-driver dependency. - Allow XDP BPF_PROG_RUN test infra to send real packets, enabling its use as a packet generator. - Allow local storage memory to be allocated with GFP_KERNEL if called from a hook allowed to sleep. - Introduce fprobe (multi kprobe) to speed up mass attachment (arch bits to come later). - Add unstable conntrack lookup helpers for BPF by using the BPF kfunc infra. - Allow cgroup BPF progs to return custom errors to user space. - Add support for AF_UNIX iterator batching. - Allow iterator programs to use sleepable helpers. - Support JIT of add, and, or, xor and xchg atomic ops on arm64. - Add BTFGen support to bpftool which allows to use CO-RE in kernels without BTF info. - Large number of libbpf API improvements, cleanups and deprecations. Protocols --------- - Micro-optimize UDPv6 Tx, gaining up to 5% in test on dummy netdev. - Adjust TSO packet sizes based on min_rtt, allowing very low latency links (data centers) to always send full-sized TSO super-frames. - Make IPv6 flow label changes (AKA hash rethink) more configurable, via sysctl and setsockopt. Distinguish between server and client behavior. - VxLAN support to "collect metadata" devices to terminate only configured VNIs. This is similar to VLAN filtering in the bridge. - Support inserting IPv6 IOAM information to a fraction of frames. - Add protocol attribute to IP addresses to allow identifying where given address comes from (kernel-generated, DHCP etc.) - Support setting socket and IPv6 options via cmsg on ping6 sockets. - Reject mis-use of ECN bits in IP headers as part of DSCP/TOS. Define dscp_t and stop taking ECN bits into account in fib-rules. - Add support for locked bridge ports (for 802.1X). - tun: support NAPI for packets received from batched XDP buffs, doubling the performance in some scenarios. - IPv6 extension header handling in Open vSwitch. - Support IPv6 control message load balancing in bonding, prevent neighbor solicitation and advertisement from using the wrong port. Support NS/NA monitor selection similar to existing ARP monitor. - SMC - improve performance with TCP_CORK and sendfile() - support auto-corking - support TCP_NODELAY - MCTP (Management Component Transport Protocol) - add user space tag control interface - I2C binding driver (as specified by DMTF DSP0237) - Multi-BSSID beacon handling in AP mode for WiFi. - Bluetooth: - handle MSFT Monitor Device Event - add MGMT Adv Monitor Device Found/Lost events - Multi-Path TCP: - add support for the SO_SNDTIMEO socket option - lots of selftest cleanups and improvements - Increase the max PDU size in CAN ISOTP to 64 kB. Driver API ---------- - Add HW counters for SW netdevs, a mechanism for devices which offload packet forwarding to report packet statistics back to software interfaces such as tunnels. - Select the default NIC queue count as a fraction of number of physical CPU cores, instead of hard-coding to 8. - Expose devlink instance locks to drivers. Allow device layer of drivers to use that lock directly instead of creating their own which always runs into ordering issues in devlink callbacks. - Add header/data split indication to guide user space enabling of TCP zero-copy Rx. - Allow configuring completion queue event size. - Refactor page_pool to enable fragmenting after allocation. - Add allocation and page reuse statistics to page_pool. - Improve Multiple Spanning Trees support in the bridge to allow reuse of topologies across VLANs, saving HW resources in switches. - DSA (Distributed Switch Architecture): - replay and offload of host VLAN entries - offload of static and local FDB entries on LAG interfaces - FDB isolation and unicast filtering New hardware / drivers ---------------------- - Ethernet: - LAN937x T1 PHYs - Davicom DM9051 SPI NIC driver - Realtek RTL8367S, RTL8367RB-VB switch and MDIO - Microchip ksz8563 switches - Netronome NFP3800 SmartNICs - Fungible SmartNICs - MediaTek MT8195 switches - WiFi: - mt76: MediaTek mt7916 - mt76: MediaTek mt7921u USB adapters - brcmfmac: Broadcom BCM43454/6 - Mobile: - iosm: Intel M.2 7360 WWAN card Drivers ------- - Convert many drivers to the new phylink API built for split PCS designs but also simplifying other cases. - Intel Ethernet NICs: - add TTY for GNSS module for E810T device - improve AF_XDP performance - GTP-C and GTP-U filter offload - QinQ VLAN support - Mellanox Ethernet NICs (mlx5): - support xdp->data_meta - multi-buffer XDP - offload tc push_eth and pop_eth actions - Netronome Ethernet NICs (nfp): - flow-independent tc action hardware offload (police / meter) - AF_XDP - Other Ethernet NICs: - at803x: fiber and SFP support - xgmac: mdio: preamble suppression and custom MDC frequencies - r8169: enable ASPM L1.2 if system vendor flags it as safe - macb/gem: ZynqMP SGMII - hns3: add TX push mode - dpaa2-eth: software TSO - lan743x: multi-queue, mdio, SGMII, PTP - axienet: NAPI and GRO support - Mellanox Ethernet switches (mlxsw): - source and dest IP address rewrites - RJ45 ports - Marvell Ethernet switches (prestera): - basic routing offload - multi-chain TC ACL offload - NXP embedded Ethernet switches (ocelot & felix): - PTP over UDP with the ocelot-8021q DSA tagging protocol - basic QoS classification on Felix DSA switch using dcbnl - port mirroring for ocelot switches - Microchip high-speed industrial Ethernet (sparx5): - offloading of bridge port flooding flags - PTP Hardware Clock - Other embedded switches: - lan966x: PTP Hardward Clock - qca8k: mdio read/write operations via crafted Ethernet packets - Qualcomm 802.11ax WiFi (ath11k): - add LDPC FEC type and 802.11ax High Efficiency data in radiotap - enable RX PPDU stats in monitor co-exist mode - Intel WiFi (iwlwifi): - UHB TAS enablement via BIOS - band disablement via BIOS - channel switch offload - 32 Rx AMPDU sessions in newer devices - MediaTek WiFi (mt76): - background radar detection - thermal management improvements on mt7915 - SAR support for more mt76 platforms - MBSSID and 6 GHz band on mt7915 - RealTek WiFi: - rtw89: AP mode - rtw89: 160 MHz channels and 6 GHz band - rtw89: hardware scan - Bluetooth: - mt7921s: wake on Bluetooth, SCO over I2S, wide-band-speed (WBS) - Microchip CAN (mcp251xfd): - multiple RX-FIFOs and runtime configurable RX/TX rings - internal PLL, runtime PM handling simplification - improve chip detection and error handling after wakeup Signed-off-by: Jakub Kicinski <kuba@kernel.org> -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE6jPA+I1ugmIBA4hXMUZtbf5SIrsFAmI7YBcACgkQMUZtbf5S IrveSBAAmSNJlUK6vPsnNzs7IhsZnfI/AUjm2TCLZnlhKttbpI4A/4Pohk33V7RS FGX7f8kjEfhUwrIiLDgeCnztNHRECrCmk6aZc/jLEvecmTauJ+f6kjShkDY/wix+ AkPHmrZnQeLPAEVuljDdV+sL6ik08+zQL7PazIYHsaSKKC0MGQptRwcri8PLRAKE KPBAhVhleq2rAZ/ntprSN52F4Af6rpFTrPIWuN8Bqdbc9dy5094LT0mpOOWYvgr3 /DLvvAPuLemwyIQkjWknVKBRUAQcmNPC+BY3J8K3LRaiNhekGqOFan46BfqP+k2J 6DWu0Qrp2yWt4BMOeEToZR5rA6v5suUAMIBu8PRZIDkINXQMlIxHfGjZyNm0rVfw 7edNri966yus9OdzwPa32MIG3oC6PnVAwYCJAjjBMNS8sSIkp7wgHLkgWN4UFe2H K/e6z8TLF4UQ+zFM0aGI5WZ+9QqWkTWEDF3R3OhdFpGrznna0gxmkOeV2YvtsgxY cbS0vV9Zj73o+bYzgBKJsw/dAjyLdXoHUGvus26VLQ78S/VGunVKtItwoxBAYmZo krW964qcC89YofzSi8RSKLHuEWtNWZbVm8YXr75u6jpr5GhMBu0CYefLs+BuZcxy dw8c69cGneVbGZmY2J3rBhDkchbuICl8vdUPatGrOJAoaFdYKuw= =ELpe -----END PGP SIGNATURE----- Merge tag 'net-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next Pull networking updates from Jakub Kicinski: "The sprinkling of SPI drivers is because we added a new one and Mark sent us a SPI driver interface conversion pull request. Core ---- - Introduce XDP multi-buffer support, allowing the use of XDP with jumbo frame MTUs and combination with Rx coalescing offloads (LRO). - Speed up netns dismantling (5x) and lower the memory cost a little. Remove unnecessary per-netns sockets. Scope some lists to a netns. Cut down RCU syncing. Use batch methods. Allow netdev registration to complete out of order. - Support distinguishing timestamp types (ingress vs egress) and maintaining them across packet scrubbing points (e.g. redirect). - Continue the work of annotating packet drop reasons throughout the stack. - Switch netdev error counters from an atomic to dynamically allocated per-CPU counters. - Rework a few preempt_disable(), local_irq_save() and busy waiting sections problematic on PREEMPT_RT. - Extend the ref_tracker to allow catching use-after-free bugs. BPF --- - Introduce "packing allocator" for BPF JIT images. JITed code is marked read only, and used to be allocated at page granularity. Custom allocator allows for more efficient memory use, lower iTLB pressure and prevents identity mapping huge pages from getting split. - Make use of BTF type annotations (e.g. __user, __percpu) to enforce the correct probe read access method, add appropriate helpers. - Convert the BPF preload to use light skeleton and drop the user-mode-driver dependency. - Allow XDP BPF_PROG_RUN test infra to send real packets, enabling its use as a packet generator. - Allow local storage memory to be allocated with GFP_KERNEL if called from a hook allowed to sleep. - Introduce fprobe (multi kprobe) to speed up mass attachment (arch bits to come later). - Add unstable conntrack lookup helpers for BPF by using the BPF kfunc infra. - Allow cgroup BPF progs to return custom errors to user space. - Add support for AF_UNIX iterator batching. - Allow iterator programs to use sleepable helpers. - Support JIT of add, and, or, xor and xchg atomic ops on arm64. - Add BTFGen support to bpftool which allows to use CO-RE in kernels without BTF info. - Large number of libbpf API improvements, cleanups and deprecations. Protocols --------- - Micro-optimize UDPv6 Tx, gaining up to 5% in test on dummy netdev. - Adjust TSO packet sizes based on min_rtt, allowing very low latency links (data centers) to always send full-sized TSO super-frames. - Make IPv6 flow label changes (AKA hash rethink) more configurable, via sysctl and setsockopt. Distinguish between server and client behavior. - VxLAN support to "collect metadata" devices to terminate only configured VNIs. This is similar to VLAN filtering in the bridge. - Support inserting IPv6 IOAM information to a fraction of frames. - Add protocol attribute to IP addresses to allow identifying where given address comes from (kernel-generated, DHCP etc.) - Support setting socket and IPv6 options via cmsg on ping6 sockets. - Reject mis-use of ECN bits in IP headers as part of DSCP/TOS. Define dscp_t and stop taking ECN bits into account in fib-rules. - Add support for locked bridge ports (for 802.1X). - tun: support NAPI for packets received from batched XDP buffs, doubling the performance in some scenarios. - IPv6 extension header handling in Open vSwitch. - Support IPv6 control message load balancing in bonding, prevent neighbor solicitation and advertisement from using the wrong port. Support NS/NA monitor selection similar to existing ARP monitor. - SMC - improve performance with TCP_CORK and sendfile() - support auto-corking - support TCP_NODELAY - MCTP (Management Component Transport Protocol) - add user space tag control interface - I2C binding driver (as specified by DMTF DSP0237) - Multi-BSSID beacon handling in AP mode for WiFi. - Bluetooth: - handle MSFT Monitor Device Event - add MGMT Adv Monitor Device Found/Lost events - Multi-Path TCP: - add support for the SO_SNDTIMEO socket option - lots of selftest cleanups and improvements - Increase the max PDU size in CAN ISOTP to 64 kB. Driver API ---------- - Add HW counters for SW netdevs, a mechanism for devices which offload packet forwarding to report packet statistics back to software interfaces such as tunnels. - Select the default NIC queue count as a fraction of number of physical CPU cores, instead of hard-coding to 8. - Expose devlink instance locks to drivers. Allow device layer of drivers to use that lock directly instead of creating their own which always runs into ordering issues in devlink callbacks. - Add header/data split indication to guide user space enabling of TCP zero-copy Rx. - Allow configuring completion queue event size. - Refactor page_pool to enable fragmenting after allocation. - Add allocation and page reuse statistics to page_pool. - Improve Multiple Spanning Trees support in the bridge to allow reuse of topologies across VLANs, saving HW resources in switches. - DSA (Distributed Switch Architecture): - replay and offload of host VLAN entries - offload of static and local FDB entries on LAG interfaces - FDB isolation and unicast filtering New hardware / drivers ---------------------- - Ethernet: - LAN937x T1 PHYs - Davicom DM9051 SPI NIC driver - Realtek RTL8367S, RTL8367RB-VB switch and MDIO - Microchip ksz8563 switches - Netronome NFP3800 SmartNICs - Fungible SmartNICs - MediaTek MT8195 switches - WiFi: - mt76: MediaTek mt7916 - mt76: MediaTek mt7921u USB adapters - brcmfmac: Broadcom BCM43454/6 - Mobile: - iosm: Intel M.2 7360 WWAN card Drivers ------- - Convert many drivers to the new phylink API built for split PCS designs but also simplifying other cases. - Intel Ethernet NICs: - add TTY for GNSS module for E810T device - improve AF_XDP performance - GTP-C and GTP-U filter offload - QinQ VLAN support - Mellanox Ethernet NICs (mlx5): - support xdp->data_meta - multi-buffer XDP - offload tc push_eth and pop_eth actions - Netronome Ethernet NICs (nfp): - flow-independent tc action hardware offload (police / meter) - AF_XDP - Other Ethernet NICs: - at803x: fiber and SFP support - xgmac: mdio: preamble suppression and custom MDC frequencies - r8169: enable ASPM L1.2 if system vendor flags it as safe - macb/gem: ZynqMP SGMII - hns3: add TX push mode - dpaa2-eth: software TSO - lan743x: multi-queue, mdio, SGMII, PTP - axienet: NAPI and GRO support - Mellanox Ethernet switches (mlxsw): - source and dest IP address rewrites - RJ45 ports - Marvell Ethernet switches (prestera): - basic routing offload - multi-chain TC ACL offload - NXP embedded Ethernet switches (ocelot & felix): - PTP over UDP with the ocelot-8021q DSA tagging protocol - basic QoS classification on Felix DSA switch using dcbnl - port mirroring for ocelot switches - Microchip high-speed industrial Ethernet (sparx5): - offloading of bridge port flooding flags - PTP Hardware Clock - Other embedded switches: - lan966x: PTP Hardward Clock - qca8k: mdio read/write operations via crafted Ethernet packets - Qualcomm 802.11ax WiFi (ath11k): - add LDPC FEC type and 802.11ax High Efficiency data in radiotap - enable RX PPDU stats in monitor co-exist mode - Intel WiFi (iwlwifi): - UHB TAS enablement via BIOS - band disablement via BIOS - channel switch offload - 32 Rx AMPDU sessions in newer devices - MediaTek WiFi (mt76): - background radar detection - thermal management improvements on mt7915 - SAR support for more mt76 platforms - MBSSID and 6 GHz band on mt7915 - RealTek WiFi: - rtw89: AP mode - rtw89: 160 MHz channels and 6 GHz band - rtw89: hardware scan - Bluetooth: - mt7921s: wake on Bluetooth, SCO over I2S, wide-band-speed (WBS) - Microchip CAN (mcp251xfd): - multiple RX-FIFOs and runtime configurable RX/TX rings - internal PLL, runtime PM handling simplification - improve chip detection and error handling after wakeup" * tag 'net-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2521 commits) llc: fix netdevice reference leaks in llc_ui_bind() drivers: ethernet: cpsw: fix panic when interrupt coaleceing is set via ethtool ice: don't allow to run ice_send_event_to_aux() in atomic ctx ice: fix 'scheduling while atomic' on aux critical err interrupt net/sched: fix incorrect vlan_push_eth dest field net: bridge: mst: Restrict info size queries to bridge ports net: marvell: prestera: add missing destroy_workqueue() in prestera_module_init() drivers: net: xgene: Fix regression in CRC stripping net: geneve: add missing netlink policy and size for IFLA_GENEVE_INNER_PROTO_INHERIT net: dsa: fix missing host-filtered multicast addresses net/mlx5e: Fix build warning, detected write beyond size of field iwlwifi: mvm: Don't fail if PPAG isn't supported selftests/bpf: Fix kprobe_multi test. Revert "rethook: x86: Add rethook x86 implementation" Revert "arm64: rethook: Add arm64 rethook implementation" Revert "powerpc: Add rethook support" Revert "ARM: rethook: Add rethook arm implementation" netdevice: add missing dm_private kdoc net: bridge: mst: prevent NULL deref in br_mst_info_size() selftests: forwarding: Use same VRF for port and VLAN upper ...
234 lines
7.2 KiB
C
234 lines
7.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* linux/include/linux/sunrpc/svc_xprt.h
|
|
*
|
|
* RPC server transport I/O
|
|
*/
|
|
|
|
#ifndef SUNRPC_SVC_XPRT_H
|
|
#define SUNRPC_SVC_XPRT_H
|
|
|
|
#include <linux/sunrpc/svc.h>
|
|
|
|
struct module;
|
|
|
|
struct svc_xprt_ops {
|
|
struct svc_xprt *(*xpo_create)(struct svc_serv *,
|
|
struct net *net,
|
|
struct sockaddr *, int,
|
|
int);
|
|
struct svc_xprt *(*xpo_accept)(struct svc_xprt *);
|
|
int (*xpo_has_wspace)(struct svc_xprt *);
|
|
int (*xpo_recvfrom)(struct svc_rqst *);
|
|
int (*xpo_sendto)(struct svc_rqst *);
|
|
int (*xpo_result_payload)(struct svc_rqst *, unsigned int,
|
|
unsigned int);
|
|
void (*xpo_release_rqst)(struct svc_rqst *);
|
|
void (*xpo_detach)(struct svc_xprt *);
|
|
void (*xpo_free)(struct svc_xprt *);
|
|
void (*xpo_secure_port)(struct svc_rqst *rqstp);
|
|
void (*xpo_kill_temp_xprt)(struct svc_xprt *);
|
|
void (*xpo_start_tls)(struct svc_xprt *);
|
|
};
|
|
|
|
struct svc_xprt_class {
|
|
const char *xcl_name;
|
|
struct module *xcl_owner;
|
|
const struct svc_xprt_ops *xcl_ops;
|
|
struct list_head xcl_list;
|
|
u32 xcl_max_payload;
|
|
int xcl_ident;
|
|
};
|
|
|
|
/*
|
|
* This is embedded in an object that wants a callback before deleting
|
|
* an xprt; intended for use by NFSv4.1, which needs to know when a
|
|
* client's tcp connection (and hence possibly a backchannel) goes away.
|
|
*/
|
|
struct svc_xpt_user {
|
|
struct list_head list;
|
|
void (*callback)(struct svc_xpt_user *);
|
|
};
|
|
|
|
struct svc_xprt {
|
|
struct svc_xprt_class *xpt_class;
|
|
const struct svc_xprt_ops *xpt_ops;
|
|
struct kref xpt_ref;
|
|
struct list_head xpt_list;
|
|
struct list_head xpt_ready;
|
|
unsigned long xpt_flags;
|
|
#define XPT_BUSY 0 /* enqueued/receiving */
|
|
#define XPT_CONN 1 /* conn pending */
|
|
#define XPT_CLOSE 2 /* dead or dying */
|
|
#define XPT_DATA 3 /* data pending */
|
|
#define XPT_TEMP 4 /* connected transport */
|
|
#define XPT_DEAD 6 /* transport closed */
|
|
#define XPT_CHNGBUF 7 /* need to change snd/rcv buf sizes */
|
|
#define XPT_DEFERRED 8 /* deferred request pending */
|
|
#define XPT_OLD 9 /* used for xprt aging mark+sweep */
|
|
#define XPT_LISTENER 10 /* listening endpoint */
|
|
#define XPT_CACHE_AUTH 11 /* cache auth info */
|
|
#define XPT_LOCAL 12 /* connection from loopback interface */
|
|
#define XPT_KILL_TEMP 13 /* call xpo_kill_temp_xprt before closing */
|
|
#define XPT_CONG_CTRL 14 /* has congestion control */
|
|
|
|
struct svc_serv *xpt_server; /* service for transport */
|
|
atomic_t xpt_reserved; /* space on outq that is rsvd */
|
|
atomic_t xpt_nr_rqsts; /* Number of requests */
|
|
struct mutex xpt_mutex; /* to serialize sending data */
|
|
spinlock_t xpt_lock; /* protects sk_deferred
|
|
* and xpt_auth_cache */
|
|
void *xpt_auth_cache;/* auth cache */
|
|
struct list_head xpt_deferred; /* deferred requests that need
|
|
* to be revisted */
|
|
struct sockaddr_storage xpt_local; /* local address */
|
|
size_t xpt_locallen; /* length of address */
|
|
struct sockaddr_storage xpt_remote; /* remote peer's address */
|
|
size_t xpt_remotelen; /* length of address */
|
|
char xpt_remotebuf[INET6_ADDRSTRLEN + 10];
|
|
struct list_head xpt_users; /* callbacks on free */
|
|
|
|
struct net *xpt_net;
|
|
netns_tracker ns_tracker;
|
|
const struct cred *xpt_cred;
|
|
struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */
|
|
struct rpc_xprt_switch *xpt_bc_xps; /* NFSv4.1 backchannel */
|
|
};
|
|
|
|
static inline void unregister_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u)
|
|
{
|
|
spin_lock(&xpt->xpt_lock);
|
|
list_del_init(&u->list);
|
|
spin_unlock(&xpt->xpt_lock);
|
|
}
|
|
|
|
static inline int register_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u)
|
|
{
|
|
spin_lock(&xpt->xpt_lock);
|
|
if (test_bit(XPT_CLOSE, &xpt->xpt_flags)) {
|
|
/*
|
|
* The connection is about to be deleted soon (or,
|
|
* worse, may already be deleted--in which case we've
|
|
* already notified the xpt_users).
|
|
*/
|
|
spin_unlock(&xpt->xpt_lock);
|
|
return -ENOTCONN;
|
|
}
|
|
list_add(&u->list, &xpt->xpt_users);
|
|
spin_unlock(&xpt->xpt_lock);
|
|
return 0;
|
|
}
|
|
|
|
static inline bool svc_xprt_is_dead(const struct svc_xprt *xprt)
|
|
{
|
|
return (test_bit(XPT_DEAD, &xprt->xpt_flags) != 0) ||
|
|
(test_bit(XPT_CLOSE, &xprt->xpt_flags) != 0);
|
|
}
|
|
|
|
int svc_reg_xprt_class(struct svc_xprt_class *);
|
|
void svc_unreg_xprt_class(struct svc_xprt_class *);
|
|
void svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *,
|
|
struct svc_serv *);
|
|
int svc_xprt_create(struct svc_serv *serv, const char *xprt_name,
|
|
struct net *net, const int family,
|
|
const unsigned short port, int flags,
|
|
const struct cred *cred);
|
|
void svc_xprt_destroy_all(struct svc_serv *serv, struct net *net);
|
|
void svc_xprt_received(struct svc_xprt *xprt);
|
|
void svc_xprt_enqueue(struct svc_xprt *xprt);
|
|
void svc_xprt_put(struct svc_xprt *xprt);
|
|
void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt);
|
|
void svc_xprt_close(struct svc_xprt *xprt);
|
|
int svc_port_is_privileged(struct sockaddr *sin);
|
|
int svc_print_xprts(char *buf, int maxlen);
|
|
struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
|
|
struct net *net, const sa_family_t af,
|
|
const unsigned short port);
|
|
int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen);
|
|
void svc_add_new_perm_xprt(struct svc_serv *serv, struct svc_xprt *xprt);
|
|
void svc_age_temp_xprts_now(struct svc_serv *, struct sockaddr *);
|
|
void svc_xprt_deferred_close(struct svc_xprt *xprt);
|
|
|
|
static inline void svc_xprt_get(struct svc_xprt *xprt)
|
|
{
|
|
kref_get(&xprt->xpt_ref);
|
|
}
|
|
static inline void svc_xprt_set_local(struct svc_xprt *xprt,
|
|
const struct sockaddr *sa,
|
|
const size_t salen)
|
|
{
|
|
memcpy(&xprt->xpt_local, sa, salen);
|
|
xprt->xpt_locallen = salen;
|
|
}
|
|
static inline void svc_xprt_set_remote(struct svc_xprt *xprt,
|
|
const struct sockaddr *sa,
|
|
const size_t salen)
|
|
{
|
|
memcpy(&xprt->xpt_remote, sa, salen);
|
|
xprt->xpt_remotelen = salen;
|
|
snprintf(xprt->xpt_remotebuf, sizeof(xprt->xpt_remotebuf) - 1,
|
|
"%pISpc", sa);
|
|
}
|
|
|
|
static inline unsigned short svc_addr_port(const struct sockaddr *sa)
|
|
{
|
|
const struct sockaddr_in *sin = (const struct sockaddr_in *)sa;
|
|
const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sa;
|
|
|
|
switch (sa->sa_family) {
|
|
case AF_INET:
|
|
return ntohs(sin->sin_port);
|
|
case AF_INET6:
|
|
return ntohs(sin6->sin6_port);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static inline size_t svc_addr_len(const struct sockaddr *sa)
|
|
{
|
|
switch (sa->sa_family) {
|
|
case AF_INET:
|
|
return sizeof(struct sockaddr_in);
|
|
case AF_INET6:
|
|
return sizeof(struct sockaddr_in6);
|
|
}
|
|
BUG();
|
|
}
|
|
|
|
static inline unsigned short svc_xprt_local_port(const struct svc_xprt *xprt)
|
|
{
|
|
return svc_addr_port((const struct sockaddr *)&xprt->xpt_local);
|
|
}
|
|
|
|
static inline unsigned short svc_xprt_remote_port(const struct svc_xprt *xprt)
|
|
{
|
|
return svc_addr_port((const struct sockaddr *)&xprt->xpt_remote);
|
|
}
|
|
|
|
static inline char *__svc_print_addr(const struct sockaddr *addr,
|
|
char *buf, const size_t len)
|
|
{
|
|
const struct sockaddr_in *sin = (const struct sockaddr_in *)addr;
|
|
const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)addr;
|
|
|
|
switch (addr->sa_family) {
|
|
case AF_INET:
|
|
snprintf(buf, len, "%pI4, port=%u", &sin->sin_addr,
|
|
ntohs(sin->sin_port));
|
|
break;
|
|
|
|
case AF_INET6:
|
|
snprintf(buf, len, "%pI6, port=%u",
|
|
&sin6->sin6_addr,
|
|
ntohs(sin6->sin6_port));
|
|
break;
|
|
|
|
default:
|
|
snprintf(buf, len, "unknown address type: %d", addr->sa_family);
|
|
break;
|
|
}
|
|
|
|
return buf;
|
|
}
|
|
#endif /* SUNRPC_SVC_XPRT_H */
|