networking changes for the 5.10 merge window
Add redirect_neigh() BPF packet redirect helper, allowing to limit stack traversal in common container configs and improving TCP back-pressure. Daniel reports ~10Gbps => ~15Gbps single stream TCP performance gain. Expand netlink policy support and improve policy export to user space. (Ge)netlink core performs request validation according to declared policies. Expand the expressiveness of those policies (min/max length and bitmasks). Allow dumping policies for particular commands. This is used for feature discovery by user space (instead of kernel version parsing or trial and error). Support IGMPv3/MLDv2 multicast listener discovery protocols in bridge. Allow more than 255 IPv4 multicast interfaces. Add support for Type of Service (ToS) reflection in SYN/SYN-ACK packets of TCPv6. In Multi-patch TCP (MPTCP) support concurrent transmission of data on multiple subflows in a load balancing scenario. Enhance advertising addresses via the RM_ADDR/ADD_ADDR options. Support SMC-Dv2 version of SMC, which enables multi-subnet deployments. Allow more calls to same peer in RxRPC. Support two new Controller Area Network (CAN) protocols - CAN-FD and ISO 15765-2:2016. Add xfrm/IPsec compat layer, solving the 32bit user space on 64bit kernel problem. Add TC actions for implementing MPLS L2 VPNs. Improve nexthop code - e.g. handle various corner cases when nexthop objects are removed from groups better, skip unnecessary notifications and make it easier to offload nexthops into HW by converting to a blocking notifier. Support adding and consuming TCP header options by BPF programs, opening the doors for easy experimental and deployment-specific TCP option use. Reorganize TCP congestion control (CC) initialization to simplify life of TCP CC implemented in BPF. Add support for shipping BPF programs with the kernel and loading them early on boot via the User Mode Driver mechanism, hence reusing all the user space infra we have. Support sleepable BPF programs, initially targeting LSM and tracing. Add bpf_d_path() helper for returning full path for given 'struct path'. Make bpf_tail_call compatible with bpf-to-bpf calls. Allow BPF programs to call map_update_elem on sockmaps. Add BPF Type Format (BTF) support for type and enum discovery, as well as support for using BTF within the kernel itself (current use is for pretty printing structures). Support listing and getting information about bpf_links via the bpf syscall. Enhance kernel interfaces around NIC firmware update. Allow specifying overwrite mask to control if settings etc. are reset during update; report expected max time operation may take to users; support firmware activation without machine reboot incl. limits of how much impact reset may have (e.g. dropping link or not). Extend ethtool configuration interface to report IEEE-standard counters, to limit the need for per-vendor logic in user space. Adopt or extend devlink use for debug, monitoring, fw update in many drivers (dsa loop, ice, ionic, sja1105, qed, mlxsw, mv88e6xxx, dpaa2-eth). In mlxsw expose critical and emergency SFP module temperature alarms. Refactor port buffer handling to make the defaults more suitable and support setting these values explicitly via the DCBNL interface. Add XDP support for Intel's igb driver. Support offloading TC flower classification and filtering rules to mscc_ocelot switches. Add PTP support for Marvell Octeontx2 and PP2.2 hardware, as well as fixed interval period pulse generator and one-step timestamping in dpaa-eth. Add support for various auth offloads in WiFi APs, e.g. SAE (WPA3) offload. Add Lynx PHY/PCS MDIO module, and convert various drivers which have this HW to use it. Convert mvpp2 to split PCS. Support Marvell Prestera 98DX3255 24-port switch ASICs, as well as 7-port Mediatek MT7531 IP. Add initial support for QCA6390 and IPQ6018 in ath11k WiFi driver, and wcn3680 support in wcn36xx. Improve performance for packets which don't require much offloads on recent Mellanox NICs by 20% by making multiple packets share a descriptor entry. Move chelsio inline crypto drivers (for TLS and IPsec) from the crypto subtree to drivers/net. Move MDIO drivers out of the phy directory. Clean up a lot of W=1 warnings, reportedly the actively developed subsections of networking drivers should now build W=1 warning free. Make sure drivers don't use in_interrupt() to dynamically adapt their code. Convert tasklets to use new tasklet_setup API (sadly this conversion is not yet complete). Signed-off-by: Jakub Kicinski <kuba@kernel.org> -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE6jPA+I1ugmIBA4hXMUZtbf5SIrsFAl+ItRwACgkQMUZtbf5S IrtTMg//UxpdR/MirT1DatBU0K/UGAZY82hV7F/UC8tPgjfHZeHvWlDFxfi3YP81 PtPKbhRZ7DhwBXefUp6nY3UdvjftrJK2lJm8prJUPSsZRye8Wlcb7y65q7/P2y2U Efucyopg6RUrmrM0DUsIGYGJgylQLHnMYUl/keCsD4t5Bp4ksyi9R2t5eitGoWzh r3QGdbSa0AuWx4iu0i+tqp6Tj0ekMBMXLVb35dtU1t0joj2KTNEnSgABN3prOa8E iWYf2erOau68Ogp3yU3miCy0ZU4p/7qGHTtzbcp677692P/ekak6+zmfHLT9/Pjy 2Stq2z6GoKuVxdktr91D9pA3jxG4LxSJmr0TImcGnXbvkMP3Ez3g9RrpV5fn8j6F mZCH8TKZAoD5aJrAJAMkhZmLYE1pvDa7KolSk8WogXrbCnTEb5Nv8FHTS1Qnk3yl wSKXuvutFVNLMEHCnWQLtODbTST9DI/aOi6EctPpuOA/ZyL1v3pl+gfp37S+LUTe owMnT/7TdvKaTD0+gIyU53M6rAWTtr5YyRQorX9awIu/4Ha0F0gYD7BJZQUGtegp HzKt59NiSrFdbSH7UdyemdBF4LuCgIhS7rgfeoUXMXmuPHq7eHXyHZt5dzPPa/xP 81P0MAvdpFVwg8ij2yp2sHS7sISIRKq17fd1tIewUabxQbjXqPc= =bc1U -----END PGP SIGNATURE----- Merge tag 'net-next-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next Pull networking updates from Jakub Kicinski: - Add redirect_neigh() BPF packet redirect helper, allowing to limit stack traversal in common container configs and improving TCP back-pressure. Daniel reports ~10Gbps => ~15Gbps single stream TCP performance gain. - Expand netlink policy support and improve policy export to user space. (Ge)netlink core performs request validation according to declared policies. Expand the expressiveness of those policies (min/max length and bitmasks). Allow dumping policies for particular commands. This is used for feature discovery by user space (instead of kernel version parsing or trial and error). - Support IGMPv3/MLDv2 multicast listener discovery protocols in bridge. - Allow more than 255 IPv4 multicast interfaces. - Add support for Type of Service (ToS) reflection in SYN/SYN-ACK packets of TCPv6. - In Multi-patch TCP (MPTCP) support concurrent transmission of data on multiple subflows in a load balancing scenario. Enhance advertising addresses via the RM_ADDR/ADD_ADDR options. - Support SMC-Dv2 version of SMC, which enables multi-subnet deployments. - Allow more calls to same peer in RxRPC. - Support two new Controller Area Network (CAN) protocols - CAN-FD and ISO 15765-2:2016. - Add xfrm/IPsec compat layer, solving the 32bit user space on 64bit kernel problem. - Add TC actions for implementing MPLS L2 VPNs. - Improve nexthop code - e.g. handle various corner cases when nexthop objects are removed from groups better, skip unnecessary notifications and make it easier to offload nexthops into HW by converting to a blocking notifier. - Support adding and consuming TCP header options by BPF programs, opening the doors for easy experimental and deployment-specific TCP option use. - Reorganize TCP congestion control (CC) initialization to simplify life of TCP CC implemented in BPF. - Add support for shipping BPF programs with the kernel and loading them early on boot via the User Mode Driver mechanism, hence reusing all the user space infra we have. - Support sleepable BPF programs, initially targeting LSM and tracing. - Add bpf_d_path() helper for returning full path for given 'struct path'. - Make bpf_tail_call compatible with bpf-to-bpf calls. - Allow BPF programs to call map_update_elem on sockmaps. - Add BPF Type Format (BTF) support for type and enum discovery, as well as support for using BTF within the kernel itself (current use is for pretty printing structures). - Support listing and getting information about bpf_links via the bpf syscall. - Enhance kernel interfaces around NIC firmware update. Allow specifying overwrite mask to control if settings etc. are reset during update; report expected max time operation may take to users; support firmware activation without machine reboot incl. limits of how much impact reset may have (e.g. dropping link or not). - Extend ethtool configuration interface to report IEEE-standard counters, to limit the need for per-vendor logic in user space. - Adopt or extend devlink use for debug, monitoring, fw update in many drivers (dsa loop, ice, ionic, sja1105, qed, mlxsw, mv88e6xxx, dpaa2-eth). - In mlxsw expose critical and emergency SFP module temperature alarms. Refactor port buffer handling to make the defaults more suitable and support setting these values explicitly via the DCBNL interface. - Add XDP support for Intel's igb driver. - Support offloading TC flower classification and filtering rules to mscc_ocelot switches. - Add PTP support for Marvell Octeontx2 and PP2.2 hardware, as well as fixed interval period pulse generator and one-step timestamping in dpaa-eth. - Add support for various auth offloads in WiFi APs, e.g. SAE (WPA3) offload. - Add Lynx PHY/PCS MDIO module, and convert various drivers which have this HW to use it. Convert mvpp2 to split PCS. - Support Marvell Prestera 98DX3255 24-port switch ASICs, as well as 7-port Mediatek MT7531 IP. - Add initial support for QCA6390 and IPQ6018 in ath11k WiFi driver, and wcn3680 support in wcn36xx. - Improve performance for packets which don't require much offloads on recent Mellanox NICs by 20% by making multiple packets share a descriptor entry. - Move chelsio inline crypto drivers (for TLS and IPsec) from the crypto subtree to drivers/net. Move MDIO drivers out of the phy directory. - Clean up a lot of W=1 warnings, reportedly the actively developed subsections of networking drivers should now build W=1 warning free. - Make sure drivers don't use in_interrupt() to dynamically adapt their code. Convert tasklets to use new tasklet_setup API (sadly this conversion is not yet complete). * tag 'net-next-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2583 commits) Revert "bpfilter: Fix build error with CONFIG_BPFILTER_UMH" net, sockmap: Don't call bpf_prog_put() on NULL pointer bpf, selftest: Fix flaky tcp_hdr_options test when adding addr to lo bpf, sockmap: Add locking annotations to iterator netfilter: nftables: allow re-computing sctp CRC-32C in 'payload' statements net: fix pos incrementment in ipv6_route_seq_next net/smc: fix invalid return code in smcd_new_buf_create() net/smc: fix valid DMBE buffer sizes net/smc: fix use-after-free of delayed events bpfilter: Fix build error with CONFIG_BPFILTER_UMH cxgb4/ch_ipsec: Replace the module name to ch_ipsec from chcr net: sched: Fix suspicious RCU usage while accessing tcf_tunnel_info bpf: Fix register equivalence tracking. rxrpc: Fix loss of final ack on shutdown rxrpc: Fix bundle counting for exclusive connections netfilter: restore NF_INET_NUMHOOKS ibmveth: Identify ingress large send packets. ibmveth: Switch order of ibmveth_helper calls. cxgb4: handle 4-tuple PEDIT to NAT mode translation selftests: Add VRF route leaking tests ...
This commit is contained in:
commit
9ff9b0d392
2301 changed files with 130033 additions and 50954 deletions
|
|
@ -279,6 +279,31 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key,
|
|||
#define BPF_CGROUP_RUN_PROG_UDP6_RECVMSG_LOCK(sk, uaddr) \
|
||||
BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, BPF_CGROUP_UDP6_RECVMSG, NULL)
|
||||
|
||||
/* The SOCK_OPS"_SK" macro should be used when sock_ops->sk is not a
|
||||
* fullsock and its parent fullsock cannot be traced by
|
||||
* sk_to_full_sk().
|
||||
*
|
||||
* e.g. sock_ops->sk is a request_sock and it is under syncookie mode.
|
||||
* Its listener-sk is not attached to the rsk_listener.
|
||||
* In this case, the caller holds the listener-sk (unlocked),
|
||||
* set its sock_ops->sk to req_sk, and call this SOCK_OPS"_SK" with
|
||||
* the listener-sk such that the cgroup-bpf-progs of the
|
||||
* listener-sk will be run.
|
||||
*
|
||||
* Regardless of syncookie mode or not,
|
||||
* calling bpf_setsockopt on listener-sk will not make sense anyway,
|
||||
* so passing 'sock_ops->sk == req_sk' to the bpf prog is appropriate here.
|
||||
*/
|
||||
#define BPF_CGROUP_RUN_PROG_SOCK_OPS_SK(sock_ops, sk) \
|
||||
({ \
|
||||
int __ret = 0; \
|
||||
if (cgroup_bpf_enabled) \
|
||||
__ret = __cgroup_bpf_run_filter_sock_ops(sk, \
|
||||
sock_ops, \
|
||||
BPF_CGROUP_SOCK_OPS); \
|
||||
__ret; \
|
||||
})
|
||||
|
||||
#define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) \
|
||||
({ \
|
||||
int __ret = 0; \
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ struct btf_type;
|
|||
struct exception_table_entry;
|
||||
struct seq_operations;
|
||||
struct bpf_iter_aux_info;
|
||||
struct bpf_local_storage;
|
||||
struct bpf_local_storage_map;
|
||||
|
||||
extern struct idr btf_idr;
|
||||
extern spinlock_t btf_idr_lock;
|
||||
|
|
@ -80,7 +82,7 @@ struct bpf_map_ops {
|
|||
void *(*map_fd_get_ptr)(struct bpf_map *map, struct file *map_file,
|
||||
int fd);
|
||||
void (*map_fd_put_ptr)(void *ptr);
|
||||
u32 (*map_gen_lookup)(struct bpf_map *map, struct bpf_insn *insn_buf);
|
||||
int (*map_gen_lookup)(struct bpf_map *map, struct bpf_insn *insn_buf);
|
||||
u32 (*map_fd_sys_lookup_elem)(void *ptr);
|
||||
void (*map_seq_show_elem)(struct bpf_map *map, void *key,
|
||||
struct seq_file *m);
|
||||
|
|
@ -104,6 +106,25 @@ struct bpf_map_ops {
|
|||
__poll_t (*map_poll)(struct bpf_map *map, struct file *filp,
|
||||
struct poll_table_struct *pts);
|
||||
|
||||
/* Functions called by bpf_local_storage maps */
|
||||
int (*map_local_storage_charge)(struct bpf_local_storage_map *smap,
|
||||
void *owner, u32 size);
|
||||
void (*map_local_storage_uncharge)(struct bpf_local_storage_map *smap,
|
||||
void *owner, u32 size);
|
||||
struct bpf_local_storage __rcu ** (*map_owner_storage_ptr)(void *owner);
|
||||
|
||||
/* map_meta_equal must be implemented for maps that can be
|
||||
* used as an inner map. It is a runtime check to ensure
|
||||
* an inner map can be inserted to an outer map.
|
||||
*
|
||||
* Some properties of the inner map has been used during the
|
||||
* verification time. When inserting an inner map at the runtime,
|
||||
* map_meta_equal has to ensure the inserting map has the same
|
||||
* properties that the verifier has used earlier.
|
||||
*/
|
||||
bool (*map_meta_equal)(const struct bpf_map *meta0,
|
||||
const struct bpf_map *meta1);
|
||||
|
||||
/* BTF name and id of struct allocated by map_alloc */
|
||||
const char * const map_btf_name;
|
||||
int *map_btf_id;
|
||||
|
|
@ -227,6 +248,9 @@ int map_check_no_btf(const struct bpf_map *map,
|
|||
const struct btf_type *key_type,
|
||||
const struct btf_type *value_type);
|
||||
|
||||
bool bpf_map_meta_equal(const struct bpf_map *meta0,
|
||||
const struct bpf_map *meta1);
|
||||
|
||||
extern const struct bpf_map_ops bpf_map_offload_ops;
|
||||
|
||||
/* function argument constraints */
|
||||
|
|
@ -268,6 +292,9 @@ enum bpf_arg_type {
|
|||
ARG_PTR_TO_ALLOC_MEM, /* pointer to dynamically allocated memory */
|
||||
ARG_PTR_TO_ALLOC_MEM_OR_NULL, /* pointer to dynamically allocated memory or NULL */
|
||||
ARG_CONST_ALLOC_SIZE_OR_ZERO, /* number of allocated bytes requested */
|
||||
ARG_PTR_TO_BTF_ID_SOCK_COMMON, /* pointer to in-kernel sock_common or bpf-mirrored bpf_sock */
|
||||
ARG_PTR_TO_PERCPU_BTF_ID, /* pointer to in-kernel percpu type */
|
||||
__BPF_ARG_TYPE_MAX,
|
||||
};
|
||||
|
||||
/* type of values returned from helper functions */
|
||||
|
|
@ -281,6 +308,8 @@ enum bpf_return_type {
|
|||
RET_PTR_TO_SOCK_COMMON_OR_NULL, /* returns a pointer to a sock_common or NULL */
|
||||
RET_PTR_TO_ALLOC_MEM_OR_NULL, /* returns a pointer to dynamically allocated memory or NULL */
|
||||
RET_PTR_TO_BTF_ID_OR_NULL, /* returns a pointer to a btf_id or NULL */
|
||||
RET_PTR_TO_MEM_OR_BTF_ID_OR_NULL, /* returns a pointer to a valid memory or a btf_id or NULL */
|
||||
RET_PTR_TO_MEM_OR_BTF_ID, /* returns a pointer to a valid memory or a btf_id */
|
||||
};
|
||||
|
||||
/* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs
|
||||
|
|
@ -302,13 +331,18 @@ struct bpf_func_proto {
|
|||
};
|
||||
enum bpf_arg_type arg_type[5];
|
||||
};
|
||||
int *btf_id; /* BTF ids of arguments */
|
||||
bool (*check_btf_id)(u32 btf_id, u32 arg); /* if the argument btf_id is
|
||||
* valid. Often used if more
|
||||
* than one btf id is permitted
|
||||
* for this argument.
|
||||
*/
|
||||
union {
|
||||
struct {
|
||||
u32 *arg1_btf_id;
|
||||
u32 *arg2_btf_id;
|
||||
u32 *arg3_btf_id;
|
||||
u32 *arg4_btf_id;
|
||||
u32 *arg5_btf_id;
|
||||
};
|
||||
u32 *arg_btf_id[5];
|
||||
};
|
||||
int *ret_btf_id; /* return value btf_id */
|
||||
bool (*allowed)(const struct bpf_prog *prog);
|
||||
};
|
||||
|
||||
/* bpf_context is intentionally undefined structure. Pointer to bpf_context is
|
||||
|
|
@ -352,14 +386,29 @@ enum bpf_reg_type {
|
|||
PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */
|
||||
PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */
|
||||
PTR_TO_XDP_SOCK, /* reg points to struct xdp_sock */
|
||||
PTR_TO_BTF_ID, /* reg points to kernel struct */
|
||||
PTR_TO_BTF_ID_OR_NULL, /* reg points to kernel struct or NULL */
|
||||
/* PTR_TO_BTF_ID points to a kernel struct that does not need
|
||||
* to be null checked by the BPF program. This does not imply the
|
||||
* pointer is _not_ null and in practice this can easily be a null
|
||||
* pointer when reading pointer chains. The assumption is program
|
||||
* context will handle null pointer dereference typically via fault
|
||||
* handling. The verifier must keep this in mind and can make no
|
||||
* assumptions about null or non-null when doing branch analysis.
|
||||
* Further, when passed into helpers the helpers can not, without
|
||||
* additional context, assume the value is non-null.
|
||||
*/
|
||||
PTR_TO_BTF_ID,
|
||||
/* PTR_TO_BTF_ID_OR_NULL points to a kernel struct that has not
|
||||
* been checked for null. Used primarily to inform the verifier
|
||||
* an explicit null check is required for this struct.
|
||||
*/
|
||||
PTR_TO_BTF_ID_OR_NULL,
|
||||
PTR_TO_MEM, /* reg points to valid memory region */
|
||||
PTR_TO_MEM_OR_NULL, /* reg points to valid memory region or NULL */
|
||||
PTR_TO_RDONLY_BUF, /* reg points to a readonly buffer */
|
||||
PTR_TO_RDONLY_BUF_OR_NULL, /* reg points to a readonly buffer or NULL */
|
||||
PTR_TO_RDWR_BUF, /* reg points to a read/write buffer */
|
||||
PTR_TO_RDWR_BUF_OR_NULL, /* reg points to a read/write buffer or NULL */
|
||||
PTR_TO_PERCPU_BTF_ID, /* reg points to a percpu kernel variable */
|
||||
};
|
||||
|
||||
/* The information passed from prog-specific *_is_valid_access
|
||||
|
|
@ -514,6 +563,8 @@ int arch_prepare_bpf_trampoline(void *image, void *image_end,
|
|||
/* these two functions are called from generated trampoline */
|
||||
u64 notrace __bpf_prog_enter(void);
|
||||
void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start);
|
||||
void notrace __bpf_prog_enter_sleepable(void);
|
||||
void notrace __bpf_prog_exit_sleepable(void);
|
||||
|
||||
struct bpf_ksym {
|
||||
unsigned long start;
|
||||
|
|
@ -559,6 +610,13 @@ struct bpf_trampoline {
|
|||
struct bpf_ksym ksym;
|
||||
};
|
||||
|
||||
struct bpf_attach_target_info {
|
||||
struct btf_func_model fmodel;
|
||||
long tgt_addr;
|
||||
const char *tgt_name;
|
||||
const struct btf_type *tgt_type;
|
||||
};
|
||||
|
||||
#define BPF_DISPATCHER_MAX 48 /* Fits in 2048B */
|
||||
|
||||
struct bpf_dispatcher_prog {
|
||||
|
|
@ -586,9 +644,10 @@ static __always_inline unsigned int bpf_dispatcher_nop_func(
|
|||
return bpf_func(ctx, insnsi);
|
||||
}
|
||||
#ifdef CONFIG_BPF_JIT
|
||||
struct bpf_trampoline *bpf_trampoline_lookup(u64 key);
|
||||
int bpf_trampoline_link_prog(struct bpf_prog *prog);
|
||||
int bpf_trampoline_unlink_prog(struct bpf_prog *prog);
|
||||
int bpf_trampoline_link_prog(struct bpf_prog *prog, struct bpf_trampoline *tr);
|
||||
int bpf_trampoline_unlink_prog(struct bpf_prog *prog, struct bpf_trampoline *tr);
|
||||
struct bpf_trampoline *bpf_trampoline_get(u64 key,
|
||||
struct bpf_attach_target_info *tgt_info);
|
||||
void bpf_trampoline_put(struct bpf_trampoline *tr);
|
||||
#define BPF_DISPATCHER_INIT(_name) { \
|
||||
.mutex = __MUTEX_INITIALIZER(_name.mutex), \
|
||||
|
|
@ -633,18 +692,21 @@ void bpf_image_ksym_del(struct bpf_ksym *ksym);
|
|||
void bpf_ksym_add(struct bpf_ksym *ksym);
|
||||
void bpf_ksym_del(struct bpf_ksym *ksym);
|
||||
#else
|
||||
static inline struct bpf_trampoline *bpf_trampoline_lookup(u64 key)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
static inline int bpf_trampoline_link_prog(struct bpf_prog *prog)
|
||||
static inline int bpf_trampoline_link_prog(struct bpf_prog *prog,
|
||||
struct bpf_trampoline *tr)
|
||||
{
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
static inline int bpf_trampoline_unlink_prog(struct bpf_prog *prog)
|
||||
static inline int bpf_trampoline_unlink_prog(struct bpf_prog *prog,
|
||||
struct bpf_trampoline *tr)
|
||||
{
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
static inline struct bpf_trampoline *bpf_trampoline_get(u64 key,
|
||||
struct bpf_attach_target_info *tgt_info)
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {}
|
||||
#define DEFINE_BPF_DISPATCHER(name)
|
||||
#define DECLARE_BPF_DISPATCHER(name)
|
||||
|
|
@ -670,16 +732,19 @@ enum bpf_jit_poke_reason {
|
|||
|
||||
/* Descriptor of pokes pointing /into/ the JITed image. */
|
||||
struct bpf_jit_poke_descriptor {
|
||||
void *ip;
|
||||
void *tailcall_target;
|
||||
void *tailcall_bypass;
|
||||
void *bypass_addr;
|
||||
union {
|
||||
struct {
|
||||
struct bpf_map *map;
|
||||
u32 key;
|
||||
} tail_call;
|
||||
};
|
||||
bool ip_stable;
|
||||
bool tailcall_target_stable;
|
||||
u8 adj_off;
|
||||
u16 reason;
|
||||
u32 insn_idx;
|
||||
};
|
||||
|
||||
/* reg_type info for ctx arguments */
|
||||
|
|
@ -704,13 +769,18 @@ struct bpf_prog_aux {
|
|||
u32 max_rdonly_access;
|
||||
u32 max_rdwr_access;
|
||||
const struct bpf_ctx_arg_aux *ctx_arg_info;
|
||||
struct bpf_prog *linked_prog;
|
||||
struct mutex dst_mutex; /* protects dst_* pointers below, *after* prog becomes visible */
|
||||
struct bpf_prog *dst_prog;
|
||||
struct bpf_trampoline *dst_trampoline;
|
||||
enum bpf_prog_type saved_dst_prog_type;
|
||||
enum bpf_attach_type saved_dst_attach_type;
|
||||
bool verifier_zext; /* Zero extensions has been inserted by verifier. */
|
||||
bool offload_requested;
|
||||
bool attach_btf_trace; /* true if attaching to BTF-enabled raw tp */
|
||||
bool func_proto_unreliable;
|
||||
bool sleepable;
|
||||
bool tail_call_reachable;
|
||||
enum bpf_tramp_prog_type trampoline_prog_type;
|
||||
struct bpf_trampoline *trampoline;
|
||||
struct hlist_node tramp_hlist;
|
||||
/* BTF_KIND_FUNC_PROTO for valid attach_btf_id */
|
||||
const struct btf_type *attach_func_proto;
|
||||
|
|
@ -723,6 +793,7 @@ struct bpf_prog_aux {
|
|||
struct bpf_ksym ksym;
|
||||
const struct bpf_prog_ops *ops;
|
||||
struct bpf_map **used_maps;
|
||||
struct mutex used_maps_mutex; /* mutex for used_maps and used_map_cnt */
|
||||
struct bpf_prog *prog;
|
||||
struct user_struct *user;
|
||||
u64 load_time; /* ns since boottime */
|
||||
|
|
@ -1218,12 +1289,18 @@ typedef int (*bpf_iter_attach_target_t)(struct bpf_prog *prog,
|
|||
union bpf_iter_link_info *linfo,
|
||||
struct bpf_iter_aux_info *aux);
|
||||
typedef void (*bpf_iter_detach_target_t)(struct bpf_iter_aux_info *aux);
|
||||
typedef void (*bpf_iter_show_fdinfo_t) (const struct bpf_iter_aux_info *aux,
|
||||
struct seq_file *seq);
|
||||
typedef int (*bpf_iter_fill_link_info_t)(const struct bpf_iter_aux_info *aux,
|
||||
struct bpf_link_info *info);
|
||||
|
||||
#define BPF_ITER_CTX_ARG_MAX 2
|
||||
struct bpf_iter_reg {
|
||||
const char *target;
|
||||
bpf_iter_attach_target_t attach_target;
|
||||
bpf_iter_detach_target_t detach_target;
|
||||
bpf_iter_show_fdinfo_t show_fdinfo;
|
||||
bpf_iter_fill_link_info_t fill_link_info;
|
||||
u32 ctx_arg_info_size;
|
||||
struct bpf_ctx_arg_aux ctx_arg_info[BPF_ITER_CTX_ARG_MAX];
|
||||
const struct bpf_iter_seq_info *seq_info;
|
||||
|
|
@ -1250,6 +1327,10 @@ int bpf_iter_new_fd(struct bpf_link *link);
|
|||
bool bpf_link_is_iter(struct bpf_link *link);
|
||||
struct bpf_prog *bpf_iter_get_info(struct bpf_iter_meta *meta, bool in_stop);
|
||||
int bpf_iter_run_prog(struct bpf_prog *prog, void *ctx);
|
||||
void bpf_iter_map_show_fdinfo(const struct bpf_iter_aux_info *aux,
|
||||
struct seq_file *seq);
|
||||
int bpf_iter_map_fill_link_info(const struct bpf_iter_aux_info *aux,
|
||||
struct bpf_link_info *info);
|
||||
|
||||
int bpf_percpu_hash_copy(struct bpf_map *map, void *key, void *value);
|
||||
int bpf_percpu_array_copy(struct bpf_map *map, void *key, void *value);
|
||||
|
|
@ -1292,6 +1373,8 @@ int bpf_check(struct bpf_prog **fp, union bpf_attr *attr,
|
|||
union bpf_attr __user *uattr);
|
||||
void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth);
|
||||
|
||||
struct btf *bpf_get_btf_vmlinux(void);
|
||||
|
||||
/* Map specifics */
|
||||
struct xdp_buff;
|
||||
struct sk_buff;
|
||||
|
|
@ -1333,6 +1416,9 @@ int bpf_prog_test_run_tracing(struct bpf_prog *prog,
|
|||
int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
|
||||
const union bpf_attr *kattr,
|
||||
union bpf_attr __user *uattr);
|
||||
int bpf_prog_test_run_raw_tp(struct bpf_prog *prog,
|
||||
const union bpf_attr *kattr,
|
||||
union bpf_attr __user *uattr);
|
||||
bool btf_ctx_access(int off, int size, enum bpf_access_type type,
|
||||
const struct bpf_prog *prog,
|
||||
struct bpf_insn_access_aux *info);
|
||||
|
|
@ -1340,8 +1426,8 @@ int btf_struct_access(struct bpf_verifier_log *log,
|
|||
const struct btf_type *t, int off, int size,
|
||||
enum bpf_access_type atype,
|
||||
u32 *next_btf_id);
|
||||
int btf_resolve_helper_id(struct bpf_verifier_log *log,
|
||||
const struct bpf_func_proto *fn, int);
|
||||
bool btf_struct_ids_match(struct bpf_verifier_log *log,
|
||||
int off, u32 id, u32 need_type_id);
|
||||
|
||||
int btf_distill_func_proto(struct bpf_verifier_log *log,
|
||||
struct btf *btf,
|
||||
|
|
@ -1354,10 +1440,11 @@ int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog,
|
|||
struct bpf_reg_state *regs);
|
||||
int btf_prepare_func_args(struct bpf_verifier_env *env, int subprog,
|
||||
struct bpf_reg_state *reg);
|
||||
int btf_check_type_match(struct bpf_verifier_env *env, struct bpf_prog *prog,
|
||||
int btf_check_type_match(struct bpf_verifier_log *log, const struct bpf_prog *prog,
|
||||
struct btf *btf, const struct btf_type *t);
|
||||
|
||||
struct bpf_prog *bpf_prog_by_id(u32 id);
|
||||
struct bpf_link *bpf_link_by_id(u32 id);
|
||||
|
||||
const struct bpf_func_proto *bpf_base_func_proto(enum bpf_func_id func_id);
|
||||
#else /* !CONFIG_BPF_SYSCALL */
|
||||
|
|
@ -1637,6 +1724,7 @@ int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog,
|
|||
struct bpf_prog *old, u32 which);
|
||||
int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog);
|
||||
int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype);
|
||||
int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value, u64 flags);
|
||||
void sock_map_unhash(struct sock *sk);
|
||||
void sock_map_close(struct sock *sk, long timeout);
|
||||
#else
|
||||
|
|
@ -1658,6 +1746,12 @@ static inline int sock_map_prog_detach(const union bpf_attr *attr,
|
|||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,
|
||||
u64 flags)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
#endif /* CONFIG_BPF_STREAM_PARSER */
|
||||
|
||||
#if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL)
|
||||
|
|
@ -1736,6 +1830,10 @@ extern const struct bpf_func_proto bpf_skc_to_tcp_sock_proto;
|
|||
extern const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto;
|
||||
extern const struct bpf_func_proto bpf_skc_to_tcp_request_sock_proto;
|
||||
extern const struct bpf_func_proto bpf_skc_to_udp6_sock_proto;
|
||||
extern const struct bpf_func_proto bpf_copy_from_user_proto;
|
||||
extern const struct bpf_func_proto bpf_snprintf_btf_proto;
|
||||
extern const struct bpf_func_proto bpf_per_cpu_ptr_proto;
|
||||
extern const struct bpf_func_proto bpf_this_cpu_ptr_proto;
|
||||
|
||||
const struct bpf_func_proto *bpf_tracing_func_proto(
|
||||
enum bpf_func_id func_id, const struct bpf_prog *prog);
|
||||
|
|
@ -1850,4 +1948,7 @@ enum bpf_text_poke_type {
|
|||
int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t,
|
||||
void *addr1, void *addr2);
|
||||
|
||||
struct btf_id_set;
|
||||
bool btf_id_set_contains(const struct btf_id_set *set, u32 id);
|
||||
|
||||
#endif /* _LINUX_BPF_H */
|
||||
|
|
|
|||
163
include/linux/bpf_local_storage.h
Normal file
163
include/linux/bpf_local_storage.h
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2019 Facebook
|
||||
* Copyright 2020 Google LLC.
|
||||
*/
|
||||
|
||||
#ifndef _BPF_LOCAL_STORAGE_H
|
||||
#define _BPF_LOCAL_STORAGE_H
|
||||
|
||||
#include <linux/bpf.h>
|
||||
#include <linux/rculist.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/hash.h>
|
||||
#include <linux/types.h>
|
||||
#include <uapi/linux/btf.h>
|
||||
|
||||
#define BPF_LOCAL_STORAGE_CACHE_SIZE 16
|
||||
|
||||
struct bpf_local_storage_map_bucket {
|
||||
struct hlist_head list;
|
||||
raw_spinlock_t lock;
|
||||
};
|
||||
|
||||
/* Thp map is not the primary owner of a bpf_local_storage_elem.
|
||||
* Instead, the container object (eg. sk->sk_bpf_storage) is.
|
||||
*
|
||||
* The map (bpf_local_storage_map) is for two purposes
|
||||
* 1. Define the size of the "local storage". It is
|
||||
* the map's value_size.
|
||||
*
|
||||
* 2. Maintain a list to keep track of all elems such
|
||||
* that they can be cleaned up during the map destruction.
|
||||
*
|
||||
* When a bpf local storage is being looked up for a
|
||||
* particular object, the "bpf_map" pointer is actually used
|
||||
* as the "key" to search in the list of elem in
|
||||
* the respective bpf_local_storage owned by the object.
|
||||
*
|
||||
* e.g. sk->sk_bpf_storage is the mini-map with the "bpf_map" pointer
|
||||
* as the searching key.
|
||||
*/
|
||||
struct bpf_local_storage_map {
|
||||
struct bpf_map map;
|
||||
/* Lookup elem does not require accessing the map.
|
||||
*
|
||||
* Updating/Deleting requires a bucket lock to
|
||||
* link/unlink the elem from the map. Having
|
||||
* multiple buckets to improve contention.
|
||||
*/
|
||||
struct bpf_local_storage_map_bucket *buckets;
|
||||
u32 bucket_log;
|
||||
u16 elem_size;
|
||||
u16 cache_idx;
|
||||
};
|
||||
|
||||
struct bpf_local_storage_data {
|
||||
/* smap is used as the searching key when looking up
|
||||
* from the object's bpf_local_storage.
|
||||
*
|
||||
* Put it in the same cacheline as the data to minimize
|
||||
* the number of cachelines access during the cache hit case.
|
||||
*/
|
||||
struct bpf_local_storage_map __rcu *smap;
|
||||
u8 data[] __aligned(8);
|
||||
};
|
||||
|
||||
/* Linked to bpf_local_storage and bpf_local_storage_map */
|
||||
struct bpf_local_storage_elem {
|
||||
struct hlist_node map_node; /* Linked to bpf_local_storage_map */
|
||||
struct hlist_node snode; /* Linked to bpf_local_storage */
|
||||
struct bpf_local_storage __rcu *local_storage;
|
||||
struct rcu_head rcu;
|
||||
/* 8 bytes hole */
|
||||
/* The data is stored in aother cacheline to minimize
|
||||
* the number of cachelines access during a cache hit.
|
||||
*/
|
||||
struct bpf_local_storage_data sdata ____cacheline_aligned;
|
||||
};
|
||||
|
||||
struct bpf_local_storage {
|
||||
struct bpf_local_storage_data __rcu *cache[BPF_LOCAL_STORAGE_CACHE_SIZE];
|
||||
struct hlist_head list; /* List of bpf_local_storage_elem */
|
||||
void *owner; /* The object that owns the above "list" of
|
||||
* bpf_local_storage_elem.
|
||||
*/
|
||||
struct rcu_head rcu;
|
||||
raw_spinlock_t lock; /* Protect adding/removing from the "list" */
|
||||
};
|
||||
|
||||
/* U16_MAX is much more than enough for sk local storage
|
||||
* considering a tcp_sock is ~2k.
|
||||
*/
|
||||
#define BPF_LOCAL_STORAGE_MAX_VALUE_SIZE \
|
||||
min_t(u32, \
|
||||
(KMALLOC_MAX_SIZE - MAX_BPF_STACK - \
|
||||
sizeof(struct bpf_local_storage_elem)), \
|
||||
(U16_MAX - sizeof(struct bpf_local_storage_elem)))
|
||||
|
||||
#define SELEM(_SDATA) \
|
||||
container_of((_SDATA), struct bpf_local_storage_elem, sdata)
|
||||
#define SDATA(_SELEM) (&(_SELEM)->sdata)
|
||||
|
||||
#define BPF_LOCAL_STORAGE_CACHE_SIZE 16
|
||||
|
||||
struct bpf_local_storage_cache {
|
||||
spinlock_t idx_lock;
|
||||
u64 idx_usage_counts[BPF_LOCAL_STORAGE_CACHE_SIZE];
|
||||
};
|
||||
|
||||
#define DEFINE_BPF_STORAGE_CACHE(name) \
|
||||
static struct bpf_local_storage_cache name = { \
|
||||
.idx_lock = __SPIN_LOCK_UNLOCKED(name.idx_lock), \
|
||||
}
|
||||
|
||||
u16 bpf_local_storage_cache_idx_get(struct bpf_local_storage_cache *cache);
|
||||
void bpf_local_storage_cache_idx_free(struct bpf_local_storage_cache *cache,
|
||||
u16 idx);
|
||||
|
||||
/* Helper functions for bpf_local_storage */
|
||||
int bpf_local_storage_map_alloc_check(union bpf_attr *attr);
|
||||
|
||||
struct bpf_local_storage_map *bpf_local_storage_map_alloc(union bpf_attr *attr);
|
||||
|
||||
struct bpf_local_storage_data *
|
||||
bpf_local_storage_lookup(struct bpf_local_storage *local_storage,
|
||||
struct bpf_local_storage_map *smap,
|
||||
bool cacheit_lockit);
|
||||
|
||||
void bpf_local_storage_map_free(struct bpf_local_storage_map *smap);
|
||||
|
||||
int bpf_local_storage_map_check_btf(const struct bpf_map *map,
|
||||
const struct btf *btf,
|
||||
const struct btf_type *key_type,
|
||||
const struct btf_type *value_type);
|
||||
|
||||
void bpf_selem_link_storage_nolock(struct bpf_local_storage *local_storage,
|
||||
struct bpf_local_storage_elem *selem);
|
||||
|
||||
bool bpf_selem_unlink_storage_nolock(struct bpf_local_storage *local_storage,
|
||||
struct bpf_local_storage_elem *selem,
|
||||
bool uncharge_omem);
|
||||
|
||||
void bpf_selem_unlink(struct bpf_local_storage_elem *selem);
|
||||
|
||||
void bpf_selem_link_map(struct bpf_local_storage_map *smap,
|
||||
struct bpf_local_storage_elem *selem);
|
||||
|
||||
void bpf_selem_unlink_map(struct bpf_local_storage_elem *selem);
|
||||
|
||||
struct bpf_local_storage_elem *
|
||||
bpf_selem_alloc(struct bpf_local_storage_map *smap, void *owner, void *value,
|
||||
bool charge_mem);
|
||||
|
||||
int
|
||||
bpf_local_storage_alloc(void *owner,
|
||||
struct bpf_local_storage_map *smap,
|
||||
struct bpf_local_storage_elem *first_selem);
|
||||
|
||||
struct bpf_local_storage_data *
|
||||
bpf_local_storage_update(void *owner, struct bpf_local_storage_map *smap,
|
||||
void *value, u64 map_flags);
|
||||
|
||||
#endif /* _BPF_LOCAL_STORAGE_H */
|
||||
|
|
@ -17,9 +17,28 @@
|
|||
#include <linux/lsm_hook_defs.h>
|
||||
#undef LSM_HOOK
|
||||
|
||||
struct bpf_storage_blob {
|
||||
struct bpf_local_storage __rcu *storage;
|
||||
};
|
||||
|
||||
extern struct lsm_blob_sizes bpf_lsm_blob_sizes;
|
||||
|
||||
int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
|
||||
const struct bpf_prog *prog);
|
||||
|
||||
static inline struct bpf_storage_blob *bpf_inode(
|
||||
const struct inode *inode)
|
||||
{
|
||||
if (unlikely(!inode->i_security))
|
||||
return NULL;
|
||||
|
||||
return inode->i_security + bpf_lsm_blob_sizes.lbs_inode;
|
||||
}
|
||||
|
||||
extern const struct bpf_func_proto bpf_inode_storage_get_proto;
|
||||
extern const struct bpf_func_proto bpf_inode_storage_delete_proto;
|
||||
void bpf_inode_storage_free(struct inode *inode);
|
||||
|
||||
#else /* !CONFIG_BPF_LSM */
|
||||
|
||||
static inline int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
|
||||
|
|
@ -28,6 +47,16 @@ static inline int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline struct bpf_storage_blob *bpf_inode(
|
||||
const struct inode *inode)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void bpf_inode_storage_free(struct inode *inode)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BPF_LSM */
|
||||
|
||||
#endif /* _LINUX_BPF_LSM_H */
|
||||
|
|
|
|||
|
|
@ -107,6 +107,9 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_SK_STORAGE, sk_storage_map_ops)
|
|||
BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops)
|
||||
BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKHASH, sock_hash_ops)
|
||||
#endif
|
||||
#ifdef CONFIG_BPF_LSM
|
||||
BPF_MAP_TYPE(BPF_MAP_TYPE_INODE_STORAGE, inode_storage_map_ops)
|
||||
#endif
|
||||
BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops)
|
||||
#if defined(CONFIG_XDP_SOCKETS)
|
||||
BPF_MAP_TYPE(BPF_MAP_TYPE_XSKMAP, xsk_map_ops)
|
||||
|
|
|
|||
|
|
@ -308,6 +308,13 @@ struct bpf_insn_aux_data {
|
|||
u32 map_index; /* index into used_maps[] */
|
||||
u32 map_off; /* offset from value base address */
|
||||
};
|
||||
struct {
|
||||
enum bpf_reg_type reg_type; /* type of pseudo_btf_id */
|
||||
union {
|
||||
u32 btf_id; /* btf_id for struct typed var */
|
||||
u32 mem_size; /* mem_size for non-struct typed var */
|
||||
};
|
||||
} btf_var;
|
||||
};
|
||||
u64 map_key_state; /* constant (32 bit) key tracking for maps */
|
||||
int ctx_field_size; /* the ctx field size for load insn, maybe 0 */
|
||||
|
|
@ -347,8 +354,9 @@ static inline bool bpf_verifier_log_full(const struct bpf_verifier_log *log)
|
|||
|
||||
static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log)
|
||||
{
|
||||
return (log->level && log->ubuf && !bpf_verifier_log_full(log)) ||
|
||||
log->level == BPF_LOG_KERNEL;
|
||||
return log &&
|
||||
((log->level && log->ubuf && !bpf_verifier_log_full(log)) ||
|
||||
log->level == BPF_LOG_KERNEL);
|
||||
}
|
||||
|
||||
#define BPF_MAX_SUBPROGS 256
|
||||
|
|
@ -358,6 +366,9 @@ struct bpf_subprog_info {
|
|||
u32 start; /* insn idx of function entry point */
|
||||
u32 linfo_idx; /* The idx to the main_prog->aux->linfo */
|
||||
u16 stack_depth; /* max. stack depth used by this function */
|
||||
bool has_tail_call;
|
||||
bool tail_call_reachable;
|
||||
bool has_ld_abs;
|
||||
};
|
||||
|
||||
/* single container for all structs
|
||||
|
|
@ -446,4 +457,17 @@ bpf_prog_offload_remove_insns(struct bpf_verifier_env *env, u32 off, u32 cnt);
|
|||
int check_ctx_reg(struct bpf_verifier_env *env,
|
||||
const struct bpf_reg_state *reg, int regno);
|
||||
|
||||
/* this lives here instead of in bpf.h because it needs to dereference tgt_prog */
|
||||
static inline u64 bpf_trampoline_compute_key(const struct bpf_prog *tgt_prog,
|
||||
u32 btf_id)
|
||||
{
|
||||
return tgt_prog ? (((u64)tgt_prog->aux->id) << 32 | btf_id) : btf_id;
|
||||
}
|
||||
|
||||
int bpf_check_attach_target(struct bpf_verifier_log *log,
|
||||
const struct bpf_prog *prog,
|
||||
const struct bpf_prog *tgt_prog,
|
||||
u32 btf_id,
|
||||
struct bpf_attach_target_info *tgt_info);
|
||||
|
||||
#endif /* _LINUX_BPF_VERIFIER_H */
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#define PHY_ID_BCM57780 0x03625d90
|
||||
#define PHY_ID_BCM89610 0x03625cd0
|
||||
|
||||
#define PHY_ID_BCM72113 0x35905310
|
||||
#define PHY_ID_BCM7250 0xae025280
|
||||
#define PHY_ID_BCM7255 0xae025120
|
||||
#define PHY_ID_BCM7260 0xae025190
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
#include <uapi/linux/btf.h>
|
||||
#include <uapi/linux/bpf.h>
|
||||
|
||||
#define BTF_TYPE_EMIT(type) ((void)(type *)0)
|
||||
|
||||
|
|
@ -13,6 +14,7 @@ struct btf;
|
|||
struct btf_member;
|
||||
struct btf_type;
|
||||
union bpf_attr;
|
||||
struct btf_show;
|
||||
|
||||
extern const struct file_operations btf_fops;
|
||||
|
||||
|
|
@ -46,8 +48,45 @@ int btf_get_info_by_fd(const struct btf *btf,
|
|||
const struct btf_type *btf_type_id_size(const struct btf *btf,
|
||||
u32 *type_id,
|
||||
u32 *ret_size);
|
||||
|
||||
/*
|
||||
* Options to control show behaviour.
|
||||
* - BTF_SHOW_COMPACT: no formatting around type information
|
||||
* - BTF_SHOW_NONAME: no struct/union member names/types
|
||||
* - BTF_SHOW_PTR_RAW: show raw (unobfuscated) pointer values;
|
||||
* equivalent to %px.
|
||||
* - BTF_SHOW_ZERO: show zero-valued struct/union members; they
|
||||
* are not displayed by default
|
||||
* - BTF_SHOW_UNSAFE: skip use of bpf_probe_read() to safely read
|
||||
* data before displaying it.
|
||||
*/
|
||||
#define BTF_SHOW_COMPACT BTF_F_COMPACT
|
||||
#define BTF_SHOW_NONAME BTF_F_NONAME
|
||||
#define BTF_SHOW_PTR_RAW BTF_F_PTR_RAW
|
||||
#define BTF_SHOW_ZERO BTF_F_ZERO
|
||||
#define BTF_SHOW_UNSAFE (1ULL << 4)
|
||||
|
||||
void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,
|
||||
struct seq_file *m);
|
||||
int btf_type_seq_show_flags(const struct btf *btf, u32 type_id, void *obj,
|
||||
struct seq_file *m, u64 flags);
|
||||
|
||||
/*
|
||||
* Copy len bytes of string representation of obj of BTF type_id into buf.
|
||||
*
|
||||
* @btf: struct btf object
|
||||
* @type_id: type id of type obj points to
|
||||
* @obj: pointer to typed data
|
||||
* @buf: buffer to write to
|
||||
* @len: maximum length to write to buf
|
||||
* @flags: show options (see above)
|
||||
*
|
||||
* Return: length that would have been/was copied as per snprintf, or
|
||||
* negative error.
|
||||
*/
|
||||
int btf_type_snprintf_show(const struct btf *btf, u32 type_id, void *obj,
|
||||
char *buf, int len, u64 flags);
|
||||
|
||||
int btf_get_fd_by_id(u32 id);
|
||||
u32 btf_id(const struct btf *btf);
|
||||
bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s,
|
||||
|
|
@ -64,14 +103,18 @@ const struct btf_type *btf_type_resolve_func_ptr(const struct btf *btf,
|
|||
u32 id, u32 *res_id);
|
||||
const struct btf_type *
|
||||
btf_resolve_size(const struct btf *btf, const struct btf_type *type,
|
||||
u32 *type_size, const struct btf_type **elem_type,
|
||||
u32 *total_nelems);
|
||||
u32 *type_size);
|
||||
|
||||
#define for_each_member(i, struct_type, member) \
|
||||
for (i = 0, member = btf_type_member(struct_type); \
|
||||
i < btf_type_vlen(struct_type); \
|
||||
i++, member++)
|
||||
|
||||
#define for_each_vsi(i, datasec_type, member) \
|
||||
for (i = 0, member = btf_type_var_secinfo(datasec_type); \
|
||||
i < btf_type_vlen(datasec_type); \
|
||||
i++, member++)
|
||||
|
||||
static inline bool btf_type_is_ptr(const struct btf_type *t)
|
||||
{
|
||||
return BTF_INFO_KIND(t->info) == BTF_KIND_PTR;
|
||||
|
|
@ -107,6 +150,21 @@ static inline bool btf_type_is_func_proto(const struct btf_type *t)
|
|||
return BTF_INFO_KIND(t->info) == BTF_KIND_FUNC_PROTO;
|
||||
}
|
||||
|
||||
static inline bool btf_type_is_var(const struct btf_type *t)
|
||||
{
|
||||
return BTF_INFO_KIND(t->info) == BTF_KIND_VAR;
|
||||
}
|
||||
|
||||
/* union is only a special case of struct:
|
||||
* all its offsetof(member) == 0
|
||||
*/
|
||||
static inline bool btf_type_is_struct(const struct btf_type *t)
|
||||
{
|
||||
u8 kind = BTF_INFO_KIND(t->info);
|
||||
|
||||
return kind == BTF_KIND_STRUCT || kind == BTF_KIND_UNION;
|
||||
}
|
||||
|
||||
static inline u16 btf_type_vlen(const struct btf_type *t)
|
||||
{
|
||||
return BTF_INFO_VLEN(t->info);
|
||||
|
|
@ -141,6 +199,12 @@ static inline const struct btf_member *btf_type_member(const struct btf_type *t)
|
|||
return (const struct btf_member *)(t + 1);
|
||||
}
|
||||
|
||||
static inline const struct btf_var_secinfo *btf_type_var_secinfo(
|
||||
const struct btf_type *t)
|
||||
{
|
||||
return (const struct btf_var_secinfo *)(t + 1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BPF_SYSCALL
|
||||
const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id);
|
||||
const char *btf_name_by_offset(const struct btf *btf, u32 offset);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@
|
|||
#ifndef _LINUX_BTF_IDS_H
|
||||
#define _LINUX_BTF_IDS_H
|
||||
|
||||
struct btf_id_set {
|
||||
u32 cnt;
|
||||
u32 ids[];
|
||||
};
|
||||
|
||||
#ifdef CONFIG_DEBUG_INFO_BTF
|
||||
|
||||
#include <linux/compiler.h> /* for __PASTE */
|
||||
|
|
@ -62,7 +67,7 @@ asm( \
|
|||
".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \
|
||||
"." #scope " " #name "; \n" \
|
||||
#name ":; \n" \
|
||||
".popsection; \n"); \
|
||||
".popsection; \n");
|
||||
|
||||
#define BTF_ID_LIST(name) \
|
||||
__BTF_ID_LIST(name, local) \
|
||||
|
|
@ -71,6 +76,13 @@ extern u32 name[];
|
|||
#define BTF_ID_LIST_GLOBAL(name) \
|
||||
__BTF_ID_LIST(name, globl)
|
||||
|
||||
/* The BTF_ID_LIST_SINGLE macro defines a BTF_ID_LIST with
|
||||
* a single entry.
|
||||
*/
|
||||
#define BTF_ID_LIST_SINGLE(name, prefix, typename) \
|
||||
BTF_ID_LIST(name) \
|
||||
BTF_ID(prefix, typename)
|
||||
|
||||
/*
|
||||
* The BTF_ID_UNUSED macro defines 4 zero bytes.
|
||||
* It's used when we want to define 'unused' entry
|
||||
|
|
@ -88,12 +100,57 @@ asm( \
|
|||
".zero 4 \n" \
|
||||
".popsection; \n");
|
||||
|
||||
/*
|
||||
* The BTF_SET_START/END macros pair defines sorted list of
|
||||
* BTF IDs plus its members count, with following layout:
|
||||
*
|
||||
* BTF_SET_START(list)
|
||||
* BTF_ID(type1, name1)
|
||||
* BTF_ID(type2, name2)
|
||||
* BTF_SET_END(list)
|
||||
*
|
||||
* __BTF_ID__set__list:
|
||||
* .zero 4
|
||||
* list:
|
||||
* __BTF_ID__type1__name1__3:
|
||||
* .zero 4
|
||||
* __BTF_ID__type2__name2__4:
|
||||
* .zero 4
|
||||
*
|
||||
*/
|
||||
#define __BTF_SET_START(name, scope) \
|
||||
asm( \
|
||||
".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \
|
||||
"." #scope " __BTF_ID__set__" #name "; \n" \
|
||||
"__BTF_ID__set__" #name ":; \n" \
|
||||
".zero 4 \n" \
|
||||
".popsection; \n");
|
||||
|
||||
#define BTF_SET_START(name) \
|
||||
__BTF_ID_LIST(name, local) \
|
||||
__BTF_SET_START(name, local)
|
||||
|
||||
#define BTF_SET_START_GLOBAL(name) \
|
||||
__BTF_ID_LIST(name, globl) \
|
||||
__BTF_SET_START(name, globl)
|
||||
|
||||
#define BTF_SET_END(name) \
|
||||
asm( \
|
||||
".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \
|
||||
".size __BTF_ID__set__" #name ", .-" #name " \n" \
|
||||
".popsection; \n"); \
|
||||
extern struct btf_id_set name;
|
||||
|
||||
#else
|
||||
|
||||
#define BTF_ID_LIST(name) static u32 name[5];
|
||||
#define BTF_ID(prefix, name)
|
||||
#define BTF_ID_UNUSED
|
||||
#define BTF_ID_LIST_GLOBAL(name) u32 name[1];
|
||||
#define BTF_ID_LIST_SINGLE(name, prefix, typename) static u32 name[1];
|
||||
#define BTF_SET_START(name) static struct btf_id_set name = { 0 };
|
||||
#define BTF_SET_START_GLOBAL(name) static struct btf_id_set name = { 0 };
|
||||
#define BTF_SET_END(name)
|
||||
|
||||
#endif /* CONFIG_DEBUG_INFO_BTF */
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
* linux/can/core.h
|
||||
*
|
||||
* Protoypes and definitions for CAN protocol modules using the PF_CAN core
|
||||
* Prototypes and definitions for CAN protocol modules using the PF_CAN core
|
||||
*
|
||||
* Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
|
||||
* Urs Thuermann <urs.thuermann@volkswagen.de>
|
||||
|
|
@ -18,13 +18,6 @@
|
|||
#include <linux/skbuff.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
#define CAN_VERSION "20170425"
|
||||
|
||||
/* increment this number each time you change some user-space interface */
|
||||
#define CAN_ABI_VERSION "9"
|
||||
|
||||
#define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION
|
||||
|
||||
#define DNAME(dev) ((dev) ? (dev)->name : "any")
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -82,15 +82,30 @@ struct can_priv {
|
|||
#endif
|
||||
};
|
||||
|
||||
#define CAN_SYNC_SEG 1
|
||||
|
||||
/*
|
||||
* can_bit_time() - Duration of one bit
|
||||
*
|
||||
* Please refer to ISO 11898-1:2015, section 11.3.1.1 "Bit time" for
|
||||
* additional information.
|
||||
*
|
||||
* Return: the number of time quanta in one bit.
|
||||
*/
|
||||
static inline unsigned int can_bit_time(const struct can_bittiming *bt)
|
||||
{
|
||||
return CAN_SYNC_SEG + bt->prop_seg + bt->phase_seg1 + bt->phase_seg2;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_can_dlc(value) - helper macro to cast a given data length code (dlc)
|
||||
* to __u8 and ensure the dlc value to be max. 8 bytes.
|
||||
* to u8 and ensure the dlc value to be max. 8 bytes.
|
||||
*
|
||||
* To be used in the CAN netdriver receive path to ensure conformance with
|
||||
* ISO 11898-1 Chapter 8.4.2.3 (DLC field)
|
||||
*/
|
||||
#define get_can_dlc(i) (min_t(__u8, (i), CAN_MAX_DLC))
|
||||
#define get_canfd_dlc(i) (min_t(__u8, (i), CANFD_MAX_DLC))
|
||||
#define get_can_dlc(i) (min_t(u8, (i), CAN_MAX_DLC))
|
||||
#define get_canfd_dlc(i) (min_t(u8, (i), CANFD_MAX_DLC))
|
||||
|
||||
/* Check for outgoing skbs that have not been created by the CAN subsystem */
|
||||
static inline bool can_skb_headroom_valid(struct net_device *dev,
|
||||
|
|
@ -108,7 +123,7 @@ static inline bool can_skb_headroom_valid(struct net_device *dev,
|
|||
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
|
||||
/* preform proper loopback on capable devices */
|
||||
/* perform proper loopback on capable devices */
|
||||
if (dev->flags & IFF_ECHO)
|
||||
skb->pkt_type = PACKET_LOOPBACK;
|
||||
else
|
||||
|
|
@ -201,8 +216,8 @@ void can_bus_off(struct net_device *dev);
|
|||
void can_change_state(struct net_device *dev, struct can_frame *cf,
|
||||
enum can_state tx_state, enum can_state rx_state);
|
||||
|
||||
void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned int idx);
|
||||
int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned int idx);
|
||||
struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx,
|
||||
u8 *len_ptr);
|
||||
unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ int can_rx_offload_add_timestamp(struct net_device *dev,
|
|||
int can_rx_offload_add_fifo(struct net_device *dev,
|
||||
struct can_rx_offload *offload,
|
||||
unsigned int weight);
|
||||
int can_rx_offload_add_manual(struct net_device *dev,
|
||||
struct can_rx_offload *offload,
|
||||
unsigned int weight);
|
||||
int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload,
|
||||
u64 reg);
|
||||
int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload);
|
||||
|
|
|
|||
51
include/linux/cookie.h
Normal file
51
include/linux/cookie.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __LINUX_COOKIE_H
|
||||
#define __LINUX_COOKIE_H
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <asm/local.h>
|
||||
|
||||
struct pcpu_gen_cookie {
|
||||
local_t nesting;
|
||||
u64 last;
|
||||
} __aligned(16);
|
||||
|
||||
struct gen_cookie {
|
||||
struct pcpu_gen_cookie __percpu *local;
|
||||
atomic64_t forward_last ____cacheline_aligned_in_smp;
|
||||
atomic64_t reverse_last;
|
||||
};
|
||||
|
||||
#define COOKIE_LOCAL_BATCH 4096
|
||||
|
||||
#define DEFINE_COOKIE(name) \
|
||||
static DEFINE_PER_CPU(struct pcpu_gen_cookie, __##name); \
|
||||
static struct gen_cookie name = { \
|
||||
.local = &__##name, \
|
||||
.forward_last = ATOMIC64_INIT(0), \
|
||||
.reverse_last = ATOMIC64_INIT(0), \
|
||||
}
|
||||
|
||||
static __always_inline u64 gen_cookie_next(struct gen_cookie *gc)
|
||||
{
|
||||
struct pcpu_gen_cookie *local = this_cpu_ptr(gc->local);
|
||||
u64 val;
|
||||
|
||||
if (likely(local_inc_return(&local->nesting) == 1)) {
|
||||
val = local->last;
|
||||
if (__is_defined(CONFIG_SMP) &&
|
||||
unlikely((val & (COOKIE_LOCAL_BATCH - 1)) == 0)) {
|
||||
s64 next = atomic64_add_return(COOKIE_LOCAL_BATCH,
|
||||
&gc->forward_last);
|
||||
val = next - COOKIE_LOCAL_BATCH;
|
||||
}
|
||||
local->last = ++val;
|
||||
} else {
|
||||
val = atomic64_dec_return(&gc->reverse_last);
|
||||
}
|
||||
local_dec(&local->nesting);
|
||||
return val;
|
||||
}
|
||||
|
||||
#endif /* __LINUX_COOKIE_H */
|
||||
|
|
@ -5,37 +5,49 @@
|
|||
#ifndef _NET_DSA_8021Q_H
|
||||
#define _NET_DSA_8021Q_H
|
||||
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
struct dsa_switch;
|
||||
struct sk_buff;
|
||||
struct net_device;
|
||||
struct packet_type;
|
||||
struct dsa_8021q_context;
|
||||
|
||||
struct dsa_8021q_crosschip_link {
|
||||
struct list_head list;
|
||||
int port;
|
||||
struct dsa_switch *other_ds;
|
||||
struct dsa_8021q_context *other_ctx;
|
||||
int other_port;
|
||||
refcount_t refcount;
|
||||
};
|
||||
|
||||
struct dsa_8021q_ops {
|
||||
int (*vlan_add)(struct dsa_switch *ds, int port, u16 vid, u16 flags);
|
||||
int (*vlan_del)(struct dsa_switch *ds, int port, u16 vid);
|
||||
};
|
||||
|
||||
struct dsa_8021q_context {
|
||||
const struct dsa_8021q_ops *ops;
|
||||
struct dsa_switch *ds;
|
||||
struct list_head crosschip_links;
|
||||
/* EtherType of RX VID, used for filtering on master interface */
|
||||
__be16 proto;
|
||||
};
|
||||
|
||||
#define DSA_8021Q_N_SUBVLAN 8
|
||||
|
||||
#if IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q)
|
||||
|
||||
int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
|
||||
bool enabled);
|
||||
int dsa_8021q_setup(struct dsa_8021q_context *ctx, bool enabled);
|
||||
|
||||
int dsa_8021q_crosschip_bridge_join(struct dsa_switch *ds, int port,
|
||||
struct dsa_switch *other_ds,
|
||||
int other_port,
|
||||
struct list_head *crosschip_links);
|
||||
int dsa_8021q_crosschip_bridge_join(struct dsa_8021q_context *ctx, int port,
|
||||
struct dsa_8021q_context *other_ctx,
|
||||
int other_port);
|
||||
|
||||
int dsa_8021q_crosschip_bridge_leave(struct dsa_switch *ds, int port,
|
||||
struct dsa_switch *other_ds,
|
||||
int other_port,
|
||||
struct list_head *crosschip_links);
|
||||
int dsa_8021q_crosschip_bridge_leave(struct dsa_8021q_context *ctx, int port,
|
||||
struct dsa_8021q_context *other_ctx,
|
||||
int other_port);
|
||||
|
||||
struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
|
||||
u16 tpid, u16 tci);
|
||||
|
|
@ -56,24 +68,21 @@ bool vid_is_dsa_8021q(u16 vid);
|
|||
|
||||
#else
|
||||
|
||||
int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
|
||||
bool enabled)
|
||||
int dsa_8021q_setup(struct dsa_8021q_context *ctx, bool enabled)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dsa_8021q_crosschip_bridge_join(struct dsa_switch *ds, int port,
|
||||
struct dsa_switch *other_ds,
|
||||
int other_port,
|
||||
struct list_head *crosschip_links)
|
||||
int dsa_8021q_crosschip_bridge_join(struct dsa_8021q_context *ctx, int port,
|
||||
struct dsa_8021q_context *other_ctx,
|
||||
int other_port)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dsa_8021q_crosschip_bridge_leave(struct dsa_switch *ds, int port,
|
||||
struct dsa_switch *other_ds,
|
||||
int other_port,
|
||||
struct list_head *crosschip_links)
|
||||
int dsa_8021q_crosschip_bridge_leave(struct dsa_8021q_context *ctx, int port,
|
||||
struct dsa_8021q_context *other_ctx,
|
||||
int other_port)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,6 +241,27 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
|
|||
ETHTOOL_COALESCE_PKT_RATE_LOW | ETHTOOL_COALESCE_PKT_RATE_HIGH | \
|
||||
ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL)
|
||||
|
||||
#define ETHTOOL_STAT_NOT_SET (~0ULL)
|
||||
|
||||
/**
|
||||
* struct ethtool_pause_stats - statistics for IEEE 802.3x pause frames
|
||||
* @tx_pause_frames: transmitted pause frame count. Reported to user space
|
||||
* as %ETHTOOL_A_PAUSE_STAT_TX_FRAMES.
|
||||
*
|
||||
* Equivalent to `30.3.4.2 aPAUSEMACCtrlFramesTransmitted`
|
||||
* from the standard.
|
||||
*
|
||||
* @rx_pause_frames: received pause frame count. Reported to user space
|
||||
* as %ETHTOOL_A_PAUSE_STAT_RX_FRAMES. Equivalent to:
|
||||
*
|
||||
* Equivalent to `30.3.4.3 aPAUSEMACCtrlFramesReceived`
|
||||
* from the standard.
|
||||
*/
|
||||
struct ethtool_pause_stats {
|
||||
u64 tx_pause_frames;
|
||||
u64 rx_pause_frames;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ethtool_ops - optional netdev operations
|
||||
* @supported_coalesce_params: supported types of interrupt coalescing.
|
||||
|
|
@ -282,6 +303,9 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
|
|||
* Returns a negative error code or zero.
|
||||
* @get_ringparam: Report ring sizes
|
||||
* @set_ringparam: Set ring sizes. Returns a negative error code or zero.
|
||||
* @get_pause_stats: Report pause frame statistics. Drivers must not zero
|
||||
* statistics which they don't report. The stats structure is initialized
|
||||
* to ETHTOOL_STAT_NOT_SET indicating driver does not report statistics.
|
||||
* @get_pauseparam: Report pause parameters
|
||||
* @set_pauseparam: Set pause parameters. Returns a negative error code
|
||||
* or zero.
|
||||
|
|
@ -418,6 +442,8 @@ struct ethtool_ops {
|
|||
struct ethtool_ringparam *);
|
||||
int (*set_ringparam)(struct net_device *,
|
||||
struct ethtool_ringparam *);
|
||||
void (*get_pause_stats)(struct net_device *dev,
|
||||
struct ethtool_pause_stats *pause_stats);
|
||||
void (*get_pauseparam)(struct net_device *,
|
||||
struct ethtool_pauseparam*);
|
||||
int (*set_pauseparam)(struct net_device *,
|
||||
|
|
@ -479,6 +505,10 @@ struct ethtool_ops {
|
|||
struct ethtool_fecparam *);
|
||||
void (*get_ethtool_phy_stats)(struct net_device *,
|
||||
struct ethtool_stats *, u64 *);
|
||||
int (*get_phy_tunable)(struct net_device *,
|
||||
const struct ethtool_tunable *, void *);
|
||||
int (*set_phy_tunable)(struct net_device *,
|
||||
const struct ethtool_tunable *, const void *);
|
||||
};
|
||||
|
||||
int ethtool_check_ops(const struct ethtool_ops *ops);
|
||||
|
|
|
|||
|
|
@ -1236,13 +1236,17 @@ struct bpf_sock_addr_kern {
|
|||
|
||||
struct bpf_sock_ops_kern {
|
||||
struct sock *sk;
|
||||
u32 op;
|
||||
union {
|
||||
u32 args[4];
|
||||
u32 reply;
|
||||
u32 replylong[4];
|
||||
};
|
||||
u32 is_fullsock;
|
||||
struct sk_buff *syn_skb;
|
||||
struct sk_buff *skb;
|
||||
void *skb_data_end;
|
||||
u8 op;
|
||||
u8 is_fullsock;
|
||||
u8 remaining_opt_len;
|
||||
u64 temp; /* temp and everything after is not
|
||||
* initialized to 0 before calling
|
||||
* the BPF program. New fields that
|
||||
|
|
@ -1283,6 +1287,8 @@ int copy_bpf_fprog_from_user(struct sock_fprog *dst, sockptr_t src, int len);
|
|||
struct bpf_sk_lookup_kern {
|
||||
u16 family;
|
||||
u16 protocol;
|
||||
__be16 sport;
|
||||
u16 dport;
|
||||
struct {
|
||||
__be32 saddr;
|
||||
__be32 daddr;
|
||||
|
|
@ -1291,8 +1297,6 @@ struct bpf_sk_lookup_kern {
|
|||
const struct in6_addr *saddr;
|
||||
const struct in6_addr *daddr;
|
||||
} v6;
|
||||
__be16 sport;
|
||||
u16 dport;
|
||||
struct sock *selected_sk;
|
||||
bool no_reuseport;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ struct ptp_qoriq_registers {
|
|||
#define DEFAULT_TMR_PRSC 2
|
||||
#define DEFAULT_FIPER1_PERIOD 1000000000
|
||||
#define DEFAULT_FIPER2_PERIOD 1000000000
|
||||
#define DEFAULT_FIPER3_PERIOD 1000000000
|
||||
|
||||
struct ptp_qoriq {
|
||||
void __iomem *base;
|
||||
|
|
@ -147,6 +148,7 @@ struct ptp_qoriq {
|
|||
struct dentry *debugfs_root;
|
||||
struct device *dev;
|
||||
bool extts_fifo_support;
|
||||
bool fiper3_support;
|
||||
int irq;
|
||||
int phc_index;
|
||||
u32 tclk_period; /* nanoseconds */
|
||||
|
|
@ -155,6 +157,7 @@ struct ptp_qoriq {
|
|||
u32 cksel;
|
||||
u32 tmr_fiper1;
|
||||
u32 tmr_fiper2;
|
||||
u32 tmr_fiper3;
|
||||
u32 (*read)(unsigned __iomem *addr);
|
||||
void (*write)(unsigned __iomem *addr, u32 val);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -151,6 +151,9 @@
|
|||
|
||||
#define IEEE80211_ANO_NETTYPE_WILD 15
|
||||
|
||||
/* bits unique to S1G beacon */
|
||||
#define IEEE80211_S1G_BCN_NEXT_TBTT 0x100
|
||||
|
||||
/* control extension - for IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTL_EXT */
|
||||
#define IEEE80211_CTL_EXT_POLL 0x2000
|
||||
#define IEEE80211_CTL_EXT_SPR 0x3000
|
||||
|
|
@ -553,6 +556,28 @@ static inline bool ieee80211_is_s1g_beacon(__le16 fc)
|
|||
cpu_to_le16(IEEE80211_FTYPE_EXT | IEEE80211_STYPE_S1G_BEACON);
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_next_tbtt_present - check if IEEE80211_FTYPE_EXT &&
|
||||
* IEEE80211_STYPE_S1G_BEACON && IEEE80211_S1G_BCN_NEXT_TBTT
|
||||
* @fc: frame control bytes in little-endian byteorder
|
||||
*/
|
||||
static inline bool ieee80211_next_tbtt_present(__le16 fc)
|
||||
{
|
||||
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
|
||||
cpu_to_le16(IEEE80211_FTYPE_EXT | IEEE80211_STYPE_S1G_BEACON) &&
|
||||
fc & cpu_to_le16(IEEE80211_S1G_BCN_NEXT_TBTT);
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_is_s1g_short_beacon - check if next tbtt present bit is set. Only
|
||||
* true for S1G beacons when they're short.
|
||||
* @fc: frame control bytes in little-endian byteorder
|
||||
*/
|
||||
static inline bool ieee80211_is_s1g_short_beacon(__le16 fc)
|
||||
{
|
||||
return ieee80211_is_s1g_beacon(fc) && ieee80211_next_tbtt_present(fc);
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM
|
||||
* @fc: frame control bytes in little-endian byteorder
|
||||
|
|
@ -962,6 +987,25 @@ enum ieee80211_vht_opmode_bits {
|
|||
IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF = 0x80,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ieee80211_s1g_chanwidth
|
||||
* These are defined in IEEE802.11-2016ah Table 10-20
|
||||
* as BSS Channel Width
|
||||
*
|
||||
* @IEEE80211_S1G_CHANWIDTH_1MHZ: 1MHz operating channel
|
||||
* @IEEE80211_S1G_CHANWIDTH_2MHZ: 2MHz operating channel
|
||||
* @IEEE80211_S1G_CHANWIDTH_4MHZ: 4MHz operating channel
|
||||
* @IEEE80211_S1G_CHANWIDTH_8MHZ: 8MHz operating channel
|
||||
* @IEEE80211_S1G_CHANWIDTH_16MHZ: 16MHz operating channel
|
||||
*/
|
||||
enum ieee80211_s1g_chanwidth {
|
||||
IEEE80211_S1G_CHANWIDTH_1MHZ = 0,
|
||||
IEEE80211_S1G_CHANWIDTH_2MHZ = 1,
|
||||
IEEE80211_S1G_CHANWIDTH_4MHZ = 3,
|
||||
IEEE80211_S1G_CHANWIDTH_8MHZ = 7,
|
||||
IEEE80211_S1G_CHANWIDTH_16MHZ = 15,
|
||||
};
|
||||
|
||||
#define WLAN_SA_QUERY_TR_ID_LEN 2
|
||||
#define WLAN_MEMBERSHIP_LEN 8
|
||||
#define WLAN_USER_POSITION_LEN 16
|
||||
|
|
@ -1034,6 +1078,13 @@ struct ieee80211_ext {
|
|||
u8 change_seq;
|
||||
u8 variable[0];
|
||||
} __packed s1g_beacon;
|
||||
struct {
|
||||
u8 sa[ETH_ALEN];
|
||||
__le32 timestamp;
|
||||
u8 change_seq;
|
||||
u8 next_tbtt[3];
|
||||
u8 variable[0];
|
||||
} __packed s1g_short_beacon;
|
||||
} u;
|
||||
} __packed __aligned(2);
|
||||
|
||||
|
|
@ -1068,6 +1119,11 @@ struct ieee80211_mgmt {
|
|||
/* followed by Supported rates */
|
||||
u8 variable[0];
|
||||
} __packed assoc_resp, reassoc_resp;
|
||||
struct {
|
||||
__le16 capab_info;
|
||||
__le16 status_code;
|
||||
u8 variable[0];
|
||||
} __packed s1g_assoc_resp, s1g_reassoc_resp;
|
||||
struct {
|
||||
__le16 capab_info;
|
||||
__le16 listen_interval;
|
||||
|
|
@ -2294,8 +2350,11 @@ ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper)
|
|||
}
|
||||
|
||||
/* HE Spatial Reuse defines */
|
||||
#define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT 0x4
|
||||
#define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT 0x8
|
||||
#define IEEE80211_HE_SPR_PSR_DISALLOWED BIT(0)
|
||||
#define IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED BIT(1)
|
||||
#define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT BIT(2)
|
||||
#define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT BIT(3)
|
||||
#define IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED BIT(4)
|
||||
|
||||
/*
|
||||
* ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size
|
||||
|
|
@ -2330,84 +2389,93 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)
|
|||
}
|
||||
|
||||
/* S1G Capabilities Information field */
|
||||
#define S1G_CAPAB_B0_S1G_LONG BIT(0)
|
||||
#define S1G_CAPAB_B0_SGI_1MHZ BIT(1)
|
||||
#define S1G_CAPAB_B0_SGI_2MHZ BIT(2)
|
||||
#define S1G_CAPAB_B0_SGI_4MHZ BIT(3)
|
||||
#define S1G_CAPAB_B0_SGI_8MHZ BIT(4)
|
||||
#define S1G_CAPAB_B0_SGI_16MHZ BIT(5)
|
||||
#define S1G_CAPAB_B0_SUPP_CH_WIDTH_MASK (BIT(6) | BIT(7))
|
||||
#define S1G_CAPAB_B0_SUPP_CH_WIDTH_SHIFT 6
|
||||
#define IEEE80211_S1G_CAPABILITY_LEN 15
|
||||
|
||||
#define S1G_CAPAB_B1_RX_LDPC BIT(0)
|
||||
#define S1G_CAPAB_B1_TX_STBC BIT(1)
|
||||
#define S1G_CAPAB_B1_RX_STBC BIT(2)
|
||||
#define S1G_CAPAB_B1_SU_BFER BIT(3)
|
||||
#define S1G_CAPAB_B1_SU_BFEE BIT(4)
|
||||
#define S1G_CAPAB_B1_BFEE_STS_MASK (BIT(5) | BIT(6) | BIT(7))
|
||||
#define S1G_CAPAB_B1_BFEE_STS_SHIFT 5
|
||||
#define S1G_CAP0_S1G_LONG BIT(0)
|
||||
#define S1G_CAP0_SGI_1MHZ BIT(1)
|
||||
#define S1G_CAP0_SGI_2MHZ BIT(2)
|
||||
#define S1G_CAP0_SGI_4MHZ BIT(3)
|
||||
#define S1G_CAP0_SGI_8MHZ BIT(4)
|
||||
#define S1G_CAP0_SGI_16MHZ BIT(5)
|
||||
#define S1G_CAP0_SUPP_CH_WIDTH GENMASK(7, 6)
|
||||
|
||||
#define S1G_CAPAB_B2_SOUNDING_DIMENSIONS_MASK (BIT(0) | BIT(1) | BIT(2))
|
||||
#define S1G_CAPAB_B2_SOUNDING_DIMENSIONS_SHIFT 0
|
||||
#define S1G_CAPAB_B2_MU_BFER BIT(3)
|
||||
#define S1G_CAPAB_B2_MU_BFEE BIT(4)
|
||||
#define S1G_CAPAB_B2_PLUS_HTC_VHT BIT(5)
|
||||
#define S1G_CAPAB_B2_TRAVELING_PILOT_MASK (BIT(6) | BIT(7))
|
||||
#define S1G_CAPAB_B2_TRAVELING_PILOT_SHIFT 6
|
||||
#define S1G_SUPP_CH_WIDTH_2 0
|
||||
#define S1G_SUPP_CH_WIDTH_4 1
|
||||
#define S1G_SUPP_CH_WIDTH_8 2
|
||||
#define S1G_SUPP_CH_WIDTH_16 3
|
||||
#define S1G_SUPP_CH_WIDTH_MAX(cap) ((1 << FIELD_GET(S1G_CAP0_SUPP_CH_WIDTH, \
|
||||
cap[0])) << 1)
|
||||
|
||||
#define S1G_CAPAB_B3_RD_RESPONDER BIT(0)
|
||||
#define S1G_CAPAB_B3_HT_DELAYED_BA BIT(1)
|
||||
#define S1G_CAPAB_B3_MAX_MPDU_LEN BIT(2)
|
||||
#define S1G_CAPAB_B3_MAX_AMPDU_LEN_EXP_MASK (BIT(3) | BIT(4))
|
||||
#define S1G_CAPAB_B3_MAX_AMPDU_LEN_EXP_SHIFT 3
|
||||
#define S1G_CAPAB_B3_MIN_MPDU_START_MASK (BIT(5) | BIT(6) | BIT(7))
|
||||
#define S1G_CAPAB_B3_MIN_MPDU_START_SHIFT 5
|
||||
#define S1G_CAP1_RX_LDPC BIT(0)
|
||||
#define S1G_CAP1_TX_STBC BIT(1)
|
||||
#define S1G_CAP1_RX_STBC BIT(2)
|
||||
#define S1G_CAP1_SU_BFER BIT(3)
|
||||
#define S1G_CAP1_SU_BFEE BIT(4)
|
||||
#define S1G_CAP1_BFEE_STS GENMASK(7, 5)
|
||||
|
||||
#define S1G_CAPAB_B4_UPLINK_SYNC BIT(0)
|
||||
#define S1G_CAPAB_B4_DYNAMIC_AID BIT(1)
|
||||
#define S1G_CAPAB_B4_BAT BIT(2)
|
||||
#define S1G_CAPAB_B4_TIME_ADE BIT(3)
|
||||
#define S1G_CAPAB_B4_NON_TIM BIT(4)
|
||||
#define S1G_CAPAB_B4_GROUP_AID BIT(5)
|
||||
#define S1G_CAPAB_B4_STA_TYPE_MASK (BIT(6) | BIT(7))
|
||||
#define S1G_CAPAB_B4_STA_TYPE_SHIFT 6
|
||||
#define S1G_CAP2_SOUNDING_DIMENSIONS GENMASK(2, 0)
|
||||
#define S1G_CAP2_MU_BFER BIT(3)
|
||||
#define S1G_CAP2_MU_BFEE BIT(4)
|
||||
#define S1G_CAP2_PLUS_HTC_VHT BIT(5)
|
||||
#define S1G_CAP2_TRAVELING_PILOT GENMASK(7, 6)
|
||||
|
||||
#define S1G_CAPAB_B5_CENT_AUTH_CONTROL BIT(0)
|
||||
#define S1G_CAPAB_B5_DIST_AUTH_CONTROL BIT(1)
|
||||
#define S1G_CAPAB_B5_AMSDU BIT(2)
|
||||
#define S1G_CAPAB_B5_AMPDU BIT(3)
|
||||
#define S1G_CAPAB_B5_ASYMMETRIC_BA BIT(4)
|
||||
#define S1G_CAPAB_B5_FLOW_CONTROL BIT(5)
|
||||
#define S1G_CAPAB_B5_SECTORIZED_BEAM_MASK (BIT(6) | BIT(7))
|
||||
#define S1G_CAPAB_B5_SECTORIZED_BEAM_SHIFT 6
|
||||
#define S1G_CAP3_RD_RESPONDER BIT(0)
|
||||
#define S1G_CAP3_HT_DELAYED_BA BIT(1)
|
||||
#define S1G_CAP3_MAX_MPDU_LEN BIT(2)
|
||||
#define S1G_CAP3_MAX_AMPDU_LEN_EXP GENMASK(4, 3)
|
||||
#define S1G_CAP3_MIN_MPDU_START GENMASK(7, 5)
|
||||
|
||||
#define S1G_CAPAB_B6_OBSS_MITIGATION BIT(0)
|
||||
#define S1G_CAPAB_B6_FRAGMENT_BA BIT(1)
|
||||
#define S1G_CAPAB_B6_NDP_PS_POLL BIT(2)
|
||||
#define S1G_CAPAB_B6_RAW_OPERATION BIT(3)
|
||||
#define S1G_CAPAB_B6_PAGE_SLICING BIT(4)
|
||||
#define S1G_CAPAB_B6_TXOP_SHARING_IMP_ACK BIT(5)
|
||||
#define S1G_CAPAB_B6_VHT_LINK_ADAPT_MASK (BIT(6) | BIT(7))
|
||||
#define S1G_CAPAB_B6_VHT_LINK_ADAPT_SHIFT 6
|
||||
#define S1G_CAP4_UPLINK_SYNC BIT(0)
|
||||
#define S1G_CAP4_DYNAMIC_AID BIT(1)
|
||||
#define S1G_CAP4_BAT BIT(2)
|
||||
#define S1G_CAP4_TIME_ADE BIT(3)
|
||||
#define S1G_CAP4_NON_TIM BIT(4)
|
||||
#define S1G_CAP4_GROUP_AID BIT(5)
|
||||
#define S1G_CAP4_STA_TYPE GENMASK(7, 6)
|
||||
|
||||
#define S1G_CAPAB_B7_TACK_AS_PS_POLL BIT(0)
|
||||
#define S1G_CAPAB_B7_DUP_1MHZ BIT(1)
|
||||
#define S1G_CAPAB_B7_MCS_NEGOTIATION BIT(2)
|
||||
#define S1G_CAPAB_B7_1MHZ_CTL_RESPONSE_PREAMBLE BIT(3)
|
||||
#define S1G_CAPAB_B7_NDP_BFING_REPORT_POLL BIT(4)
|
||||
#define S1G_CAPAB_B7_UNSOLICITED_DYN_AID BIT(5)
|
||||
#define S1G_CAPAB_B7_SECTOR_TRAINING_OPERATION BIT(6)
|
||||
#define S1G_CAPAB_B7_TEMP_PS_MODE_SWITCH BIT(7)
|
||||
#define S1G_CAP5_CENT_AUTH_CONTROL BIT(0)
|
||||
#define S1G_CAP5_DIST_AUTH_CONTROL BIT(1)
|
||||
#define S1G_CAP5_AMSDU BIT(2)
|
||||
#define S1G_CAP5_AMPDU BIT(3)
|
||||
#define S1G_CAP5_ASYMMETRIC_BA BIT(4)
|
||||
#define S1G_CAP5_FLOW_CONTROL BIT(5)
|
||||
#define S1G_CAP5_SECTORIZED_BEAM GENMASK(7, 6)
|
||||
|
||||
#define S1G_CAPAB_B8_TWT_GROUPING BIT(0)
|
||||
#define S1G_CAPAB_B8_BDT BIT(1)
|
||||
#define S1G_CAPAB_B8_COLOR_MASK (BIT(2) | BIT(3) | BIT(4))
|
||||
#define S1G_CAPAB_B8_COLOR_SHIFT 2
|
||||
#define S1G_CAPAB_B8_TWT_REQUEST BIT(5)
|
||||
#define S1G_CAPAB_B8_TWT_RESPOND BIT(6)
|
||||
#define S1G_CAPAB_B8_PV1_FRAME BIT(7)
|
||||
#define S1G_CAP6_OBSS_MITIGATION BIT(0)
|
||||
#define S1G_CAP6_FRAGMENT_BA BIT(1)
|
||||
#define S1G_CAP6_NDP_PS_POLL BIT(2)
|
||||
#define S1G_CAP6_RAW_OPERATION BIT(3)
|
||||
#define S1G_CAP6_PAGE_SLICING BIT(4)
|
||||
#define S1G_CAP6_TXOP_SHARING_IMP_ACK BIT(5)
|
||||
#define S1G_CAP6_VHT_LINK_ADAPT GENMASK(7, 6)
|
||||
|
||||
#define S1G_CAPAB_B9_LINK_ADAPT_PER_CONTROL_RESPONSE BIT(0)
|
||||
#define S1G_CAP7_TACK_AS_PS_POLL BIT(0)
|
||||
#define S1G_CAP7_DUP_1MHZ BIT(1)
|
||||
#define S1G_CAP7_MCS_NEGOTIATION BIT(2)
|
||||
#define S1G_CAP7_1MHZ_CTL_RESPONSE_PREAMBLE BIT(3)
|
||||
#define S1G_CAP7_NDP_BFING_REPORT_POLL BIT(4)
|
||||
#define S1G_CAP7_UNSOLICITED_DYN_AID BIT(5)
|
||||
#define S1G_CAP7_SECTOR_TRAINING_OPERATION BIT(6)
|
||||
#define S1G_CAP7_TEMP_PS_MODE_SWITCH BIT(7)
|
||||
|
||||
#define S1G_CAP8_TWT_GROUPING BIT(0)
|
||||
#define S1G_CAP8_BDT BIT(1)
|
||||
#define S1G_CAP8_COLOR GENMASK(4, 2)
|
||||
#define S1G_CAP8_TWT_REQUEST BIT(5)
|
||||
#define S1G_CAP8_TWT_RESPOND BIT(6)
|
||||
#define S1G_CAP8_PV1_FRAME BIT(7)
|
||||
|
||||
#define S1G_CAP9_LINK_ADAPT_PER_CONTROL_RESPONSE BIT(0)
|
||||
|
||||
#define S1G_OPER_CH_WIDTH_PRIMARY_1MHZ BIT(0)
|
||||
#define S1G_OPER_CH_WIDTH_OPER GENMASK(4, 1)
|
||||
|
||||
|
||||
#define LISTEN_INT_USF GENMASK(15, 14)
|
||||
#define LISTEN_INT_UI GENMASK(13, 0)
|
||||
|
||||
#define IEEE80211_MAX_USF FIELD_MAX(LISTEN_INT_USF)
|
||||
#define IEEE80211_MAX_UI FIELD_MAX(LISTEN_INT_UI)
|
||||
|
||||
/* Authentication algorithms */
|
||||
#define WLAN_AUTH_OPEN 0
|
||||
|
|
@ -2808,6 +2876,8 @@ enum ieee80211_eid {
|
|||
|
||||
WLAN_EID_REDUCED_NEIGHBOR_REPORT = 201,
|
||||
|
||||
WLAN_EID_AID_REQUEST = 210,
|
||||
WLAN_EID_AID_RESPONSE = 211,
|
||||
WLAN_EID_S1G_BCN_COMPAT = 213,
|
||||
WLAN_EID_S1G_SHORT_BCN_INTERVAL = 214,
|
||||
WLAN_EID_S1G_CAPABILITIES = 217,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,13 @@ struct br_ip {
|
|||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
struct in6_addr ip6;
|
||||
#endif
|
||||
} u;
|
||||
} src;
|
||||
union {
|
||||
__be32 ip4;
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
struct in6_addr ip6;
|
||||
#endif
|
||||
} dst;
|
||||
__be16 proto;
|
||||
__u16 vid;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,9 +27,18 @@ struct tun_xdp_hdr {
|
|||
#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE)
|
||||
struct socket *tun_get_socket(struct file *);
|
||||
struct ptr_ring *tun_get_tx_ring(struct file *file);
|
||||
bool tun_is_xdp_frame(void *ptr);
|
||||
void *tun_xdp_to_ptr(void *ptr);
|
||||
void *tun_ptr_to_xdp(void *ptr);
|
||||
static inline bool tun_is_xdp_frame(void *ptr)
|
||||
{
|
||||
return (unsigned long)ptr & TUN_XDP_FLAG;
|
||||
}
|
||||
static inline void *tun_xdp_to_ptr(struct xdp_frame *xdp)
|
||||
{
|
||||
return (void *)((unsigned long)xdp | TUN_XDP_FLAG);
|
||||
}
|
||||
static inline struct xdp_frame *tun_ptr_to_xdp(void *ptr)
|
||||
{
|
||||
return (void *)((unsigned long)ptr & ~TUN_XDP_FLAG);
|
||||
}
|
||||
void tun_ptr_free(void *ptr);
|
||||
#else
|
||||
#include <linux/err.h>
|
||||
|
|
@ -48,11 +57,11 @@ static inline bool tun_is_xdp_frame(void *ptr)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
static inline void *tun_xdp_to_ptr(void *ptr)
|
||||
static inline void *tun_xdp_to_ptr(struct xdp_frame *xdp)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
static inline void *tun_ptr_to_xdp(void *ptr)
|
||||
static inline struct xdp_frame *tun_ptr_to_xdp(void *ptr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ static inline size_t inet_diag_msg_attrs_size(void)
|
|||
#ifdef CONFIG_SOCK_CGROUP_DATA
|
||||
+ nla_total_size_64bit(sizeof(u64)) /* INET_DIAG_CGROUP_ID */
|
||||
#endif
|
||||
+ nla_total_size(sizeof(struct inet_diag_sockopt))
|
||||
/* INET_DIAG_SOCKOPT */
|
||||
;
|
||||
}
|
||||
int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
|
||||
|
|
|
|||
|
|
@ -177,17 +177,6 @@ static inline int inet6_sdif(const struct sk_buff *skb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* can not be used in TCP layer after tcp_v6_fill_cb */
|
||||
static inline bool inet6_exact_dif_match(struct net *net, struct sk_buff *skb)
|
||||
{
|
||||
#if defined(CONFIG_NET_L3_MASTER_DEV)
|
||||
if (!net->ipv4.sysctl_tcp_l3mdev_accept &&
|
||||
skb && ipv6_l3mdev_skb(IP6CB(skb)->flags))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
struct tcp6_request_sock {
|
||||
struct tcp_request_sock tcp6rsk_tcp;
|
||||
};
|
||||
|
|
@ -345,17 +334,6 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
|
|||
return (struct raw6_sock *)sk;
|
||||
}
|
||||
|
||||
static inline void inet_sk_copy_descendant(struct sock *sk_to,
|
||||
const struct sock *sk_from)
|
||||
{
|
||||
int ancestor_size = sizeof(struct inet_sock);
|
||||
|
||||
if (sk_from->sk_family == PF_INET6)
|
||||
ancestor_size += sizeof(struct ipv6_pinfo);
|
||||
|
||||
__inet_sk_copy_descendant(sk_to, sk_from, ancestor_size);
|
||||
}
|
||||
|
||||
#define __ipv6_only_sock(sk) (sk->sk_ipv6only)
|
||||
#define ipv6_only_sock(sk) (__ipv6_only_sock(sk))
|
||||
#define ipv6_sk_rxinfo(sk) ((sk)->sk_family == PF_INET6 && \
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ static inline u32 linkmode_adv_to_mii_10gbt_adv_t(unsigned long *advertising)
|
|||
/**
|
||||
* mii_10gbt_stat_mod_linkmode_lpa_t
|
||||
* @advertising: target the linkmode advertisement settings
|
||||
* @adv: value of the C45 10GBASE-T AN STATUS register
|
||||
* @lpa: value of the C45 10GBASE-T AN STATUS register
|
||||
*
|
||||
* A small helper function that translates C45 10GBASE-T AN STATUS register bits
|
||||
* to linkmode advertisement settings. Other bits in advertising aren't changed.
|
||||
|
|
@ -358,6 +358,12 @@ static inline int mdiobus_c45_read(struct mii_bus *bus, int prtad, int devad,
|
|||
return mdiobus_read(bus, prtad, mdiobus_c45_addr(devad, regnum));
|
||||
}
|
||||
|
||||
static inline int mdiobus_c45_write(struct mii_bus *bus, int prtad, int devad,
|
||||
u16 regnum, u16 val)
|
||||
{
|
||||
return mdiobus_write(bus, prtad, mdiobus_c45_addr(devad, regnum), val);
|
||||
}
|
||||
|
||||
int mdiobus_register_device(struct mdio_device *mdiodev);
|
||||
int mdiobus_unregister_device(struct mdio_device *mdiodev);
|
||||
bool mdiobus_is_registered_device(struct mii_bus *bus, int addr);
|
||||
|
|
@ -365,6 +371,7 @@ struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr);
|
|||
|
||||
/**
|
||||
* mdio_module_driver() - Helper macro for registering mdio drivers
|
||||
* @_mdio_driver: driver to register
|
||||
*
|
||||
* Helper macro for MDIO drivers which do not do anything special in module
|
||||
* init/exit. Each module may only use this macro once, and calling it
|
||||
|
|
|
|||
16
include/linux/mdio/mdio-i2c.h
Normal file
16
include/linux/mdio/mdio-i2c.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* MDIO I2C bridge
|
||||
*
|
||||
* Copyright (C) 2015 Russell King
|
||||
*/
|
||||
#ifndef MDIO_I2C_H
|
||||
#define MDIO_I2C_H
|
||||
|
||||
struct device;
|
||||
struct i2c_adapter;
|
||||
struct mii_bus;
|
||||
|
||||
struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c);
|
||||
|
||||
#endif
|
||||
130
include/linux/mdio/mdio-xgene.h
Normal file
130
include/linux/mdio/mdio-xgene.h
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/* Applied Micro X-Gene SoC MDIO Driver
|
||||
*
|
||||
* Copyright (c) 2016, Applied Micro Circuits Corporation
|
||||
* Author: Iyappan Subramanian <isubramanian@apm.com>
|
||||
*/
|
||||
|
||||
#ifndef __MDIO_XGENE_H__
|
||||
#define __MDIO_XGENE_H__
|
||||
|
||||
#define BLOCK_XG_MDIO_CSR_OFFSET 0x5000
|
||||
#define BLOCK_DIAG_CSR_OFFSET 0xd000
|
||||
#define XGENET_CONFIG_REG_ADDR 0x20
|
||||
|
||||
#define MAC_ADDR_REG_OFFSET 0x00
|
||||
#define MAC_COMMAND_REG_OFFSET 0x04
|
||||
#define MAC_WRITE_REG_OFFSET 0x08
|
||||
#define MAC_READ_REG_OFFSET 0x0c
|
||||
#define MAC_COMMAND_DONE_REG_OFFSET 0x10
|
||||
|
||||
#define CLKEN_OFFSET 0x08
|
||||
#define SRST_OFFSET 0x00
|
||||
|
||||
#define MENET_CFG_MEM_RAM_SHUTDOWN_ADDR 0x70
|
||||
#define MENET_BLOCK_MEM_RDY_ADDR 0x74
|
||||
|
||||
#define MAC_CONFIG_1_ADDR 0x00
|
||||
#define MII_MGMT_COMMAND_ADDR 0x24
|
||||
#define MII_MGMT_ADDRESS_ADDR 0x28
|
||||
#define MII_MGMT_CONTROL_ADDR 0x2c
|
||||
#define MII_MGMT_STATUS_ADDR 0x30
|
||||
#define MII_MGMT_INDICATORS_ADDR 0x34
|
||||
#define SOFT_RESET BIT(31)
|
||||
|
||||
#define MII_MGMT_CONFIG_ADDR 0x20
|
||||
#define MII_MGMT_COMMAND_ADDR 0x24
|
||||
#define MII_MGMT_ADDRESS_ADDR 0x28
|
||||
#define MII_MGMT_CONTROL_ADDR 0x2c
|
||||
#define MII_MGMT_STATUS_ADDR 0x30
|
||||
#define MII_MGMT_INDICATORS_ADDR 0x34
|
||||
|
||||
#define MIIM_COMMAND_ADDR 0x20
|
||||
#define MIIM_FIELD_ADDR 0x24
|
||||
#define MIIM_CONFIGURATION_ADDR 0x28
|
||||
#define MIIM_LINKFAILVECTOR_ADDR 0x2c
|
||||
#define MIIM_INDICATOR_ADDR 0x30
|
||||
#define MIIMRD_FIELD_ADDR 0x34
|
||||
|
||||
#define MDIO_CSR_OFFSET 0x5000
|
||||
|
||||
#define REG_ADDR_POS 0
|
||||
#define REG_ADDR_LEN 5
|
||||
#define PHY_ADDR_POS 8
|
||||
#define PHY_ADDR_LEN 5
|
||||
|
||||
#define HSTMIIMWRDAT_POS 0
|
||||
#define HSTMIIMWRDAT_LEN 16
|
||||
#define HSTPHYADX_POS 23
|
||||
#define HSTPHYADX_LEN 5
|
||||
#define HSTREGADX_POS 18
|
||||
#define HSTREGADX_LEN 5
|
||||
#define HSTLDCMD BIT(3)
|
||||
#define HSTMIIMCMD_POS 0
|
||||
#define HSTMIIMCMD_LEN 3
|
||||
|
||||
#define BUSY_MASK BIT(0)
|
||||
#define READ_CYCLE_MASK BIT(0)
|
||||
|
||||
enum xgene_enet_cmd {
|
||||
XGENE_ENET_WR_CMD = BIT(31),
|
||||
XGENE_ENET_RD_CMD = BIT(30)
|
||||
};
|
||||
|
||||
enum {
|
||||
MIIM_CMD_IDLE,
|
||||
MIIM_CMD_LEGACY_WRITE,
|
||||
MIIM_CMD_LEGACY_READ,
|
||||
};
|
||||
|
||||
enum xgene_mdio_id {
|
||||
XGENE_MDIO_RGMII = 1,
|
||||
XGENE_MDIO_XFI
|
||||
};
|
||||
|
||||
struct xgene_mdio_pdata {
|
||||
struct clk *clk;
|
||||
struct device *dev;
|
||||
void __iomem *mac_csr_addr;
|
||||
void __iomem *diag_csr_addr;
|
||||
void __iomem *mdio_csr_addr;
|
||||
struct mii_bus *mdio_bus;
|
||||
int mdio_id;
|
||||
spinlock_t mac_lock; /* mac lock */
|
||||
};
|
||||
|
||||
/* Set the specified value into a bit-field defined by its starting position
|
||||
* and length within a single u64.
|
||||
*/
|
||||
static inline u64 xgene_enet_set_field_value(int pos, int len, u64 val)
|
||||
{
|
||||
return (val & ((1ULL << len) - 1)) << pos;
|
||||
}
|
||||
|
||||
#define SET_VAL(field, val) \
|
||||
xgene_enet_set_field_value(field ## _POS, field ## _LEN, val)
|
||||
|
||||
#define SET_BIT(field) \
|
||||
xgene_enet_set_field_value(field ## _POS, 1, 1)
|
||||
|
||||
/* Get the value from a bit-field defined by its starting position
|
||||
* and length within the specified u64.
|
||||
*/
|
||||
static inline u64 xgene_enet_get_field_value(int pos, int len, u64 src)
|
||||
{
|
||||
return (src >> pos) & ((1ULL << len) - 1);
|
||||
}
|
||||
|
||||
#define GET_VAL(field, src) \
|
||||
xgene_enet_get_field_value(field ## _POS, field ## _LEN, src)
|
||||
|
||||
#define GET_BIT(field, src) \
|
||||
xgene_enet_get_field_value(field ## _POS, 1, src)
|
||||
|
||||
u32 xgene_mdio_rd_mac(struct xgene_mdio_pdata *pdata, u32 rd_addr);
|
||||
void xgene_mdio_wr_mac(struct xgene_mdio_pdata *pdata, u32 wr_addr, u32 data);
|
||||
int xgene_mdio_rgmii_read(struct mii_bus *bus, int phy_id, int reg);
|
||||
int xgene_mdio_rgmii_write(struct mii_bus *bus, int phy_id, int reg, u16 data);
|
||||
struct phy_device *xgene_enet_phy_register(struct mii_bus *bus, int phy_addr);
|
||||
|
||||
#endif /* __MDIO_XGENE_H__ */
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
#define PHY_ID_KSZ8061 0x00221570
|
||||
#define PHY_ID_KSZ9031 0x00221620
|
||||
#define PHY_ID_KSZ9131 0x00221640
|
||||
#define PHY_ID_LAN8814 0x00221660
|
||||
|
||||
#define PHY_ID_KSZ886X 0x00221430
|
||||
#define PHY_ID_KSZ8863 0x00221435
|
||||
|
|
|
|||
|
|
@ -366,6 +366,7 @@ enum {
|
|||
enum {
|
||||
MLX5_GENERAL_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1,
|
||||
MLX5_GENERAL_SUBTYPE_PCI_POWER_CHANGE_EVENT = 0x5,
|
||||
MLX5_GENERAL_SUBTYPE_FW_LIVE_PATCH_EVENT = 0x7,
|
||||
MLX5_GENERAL_SUBTYPE_PCI_SYNC_FOR_FW_UPDATE_EVENT = 0x8,
|
||||
};
|
||||
|
||||
|
|
@ -816,7 +817,7 @@ struct mlx5_mini_cqe8 {
|
|||
__be32 rx_hash_result;
|
||||
struct {
|
||||
__be16 checksum;
|
||||
__be16 rsvd;
|
||||
__be16 stridx;
|
||||
};
|
||||
struct {
|
||||
__be16 wqe_counter;
|
||||
|
|
@ -836,6 +837,7 @@ enum {
|
|||
|
||||
enum {
|
||||
MLX5_CQE_FORMAT_CSUM = 0x1,
|
||||
MLX5_CQE_FORMAT_CSUM_STRIDX = 0x3,
|
||||
};
|
||||
|
||||
#define MLX5_MINI_CQE_ARRAY_SIZE 8
|
||||
|
|
|
|||
|
|
@ -501,6 +501,7 @@ struct mlx5_mpfs;
|
|||
struct mlx5_eswitch;
|
||||
struct mlx5_lag;
|
||||
struct mlx5_devcom;
|
||||
struct mlx5_fw_reset;
|
||||
struct mlx5_eq_table;
|
||||
struct mlx5_irq_table;
|
||||
|
||||
|
|
@ -578,6 +579,7 @@ struct mlx5_priv {
|
|||
struct mlx5_core_sriov sriov;
|
||||
struct mlx5_lag *lag;
|
||||
struct mlx5_devcom *devcom;
|
||||
struct mlx5_fw_reset *fw_reset;
|
||||
struct mlx5_core_roce roce;
|
||||
struct mlx5_fc_stats fc_stats;
|
||||
struct mlx5_rl_table rl_table;
|
||||
|
|
@ -643,7 +645,6 @@ struct mlx5_pps {
|
|||
};
|
||||
|
||||
struct mlx5_clock {
|
||||
struct mlx5_core_dev *mdev;
|
||||
struct mlx5_nb pps_nb;
|
||||
seqlock_t lock;
|
||||
struct cyclecounter cycles;
|
||||
|
|
|
|||
|
|
@ -74,15 +74,16 @@ bool mlx5_eswitch_reg_c1_loopback_enabled(const struct mlx5_eswitch *esw);
|
|||
bool mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw);
|
||||
|
||||
/* Reg C0 usage:
|
||||
* Reg C0 = < ESW_VHCA_ID_BITS(8) | ESW_VPORT BITS(8) | ESW_CHAIN_TAG(16) >
|
||||
* Reg C0 = < ESW_PFNUM_BITS(4) | ESW_VPORT BITS(12) | ESW_CHAIN_TAG(16) >
|
||||
*
|
||||
* Highest 8 bits of the reg c0 is the vhca_id, next 8 bits is vport_num,
|
||||
* the rest (lowest 16 bits) is left for tc chain tag restoration.
|
||||
* VHCA_ID + VPORT comprise the SOURCE_PORT matching.
|
||||
* Highest 4 bits of the reg c0 is the PF_NUM (range 0-15), 12 bits of
|
||||
* unique non-zero vport id (range 1-4095). The rest (lowest 16 bits) is left
|
||||
* for tc chain tag restoration.
|
||||
* PFNUM + VPORT comprise the SOURCE_PORT matching.
|
||||
*/
|
||||
#define ESW_VHCA_ID_BITS 8
|
||||
#define ESW_VPORT_BITS 8
|
||||
#define ESW_SOURCE_PORT_METADATA_BITS (ESW_VHCA_ID_BITS + ESW_VPORT_BITS)
|
||||
#define ESW_VPORT_BITS 12
|
||||
#define ESW_PFNUM_BITS 4
|
||||
#define ESW_SOURCE_PORT_METADATA_BITS (ESW_PFNUM_BITS + ESW_VPORT_BITS)
|
||||
#define ESW_SOURCE_PORT_METADATA_OFFSET (32 - ESW_SOURCE_PORT_METADATA_BITS)
|
||||
#define ESW_CHAIN_TAG_METADATA_BITS (32 - ESW_SOURCE_PORT_METADATA_BITS)
|
||||
#define ESW_CHAIN_TAG_METADATA_MASK GENMASK(ESW_CHAIN_TAG_METADATA_BITS - 1,\
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ enum mlx5_flow_namespace_type {
|
|||
MLX5_FLOW_NAMESPACE_SNIFFER_RX,
|
||||
MLX5_FLOW_NAMESPACE_SNIFFER_TX,
|
||||
MLX5_FLOW_NAMESPACE_EGRESS,
|
||||
MLX5_FLOW_NAMESPACE_EGRESS_KERNEL,
|
||||
MLX5_FLOW_NAMESPACE_RDMA_RX,
|
||||
MLX5_FLOW_NAMESPACE_RDMA_RX_KERNEL,
|
||||
MLX5_FLOW_NAMESPACE_RDMA_TX,
|
||||
|
|
|
|||
|
|
@ -245,6 +245,10 @@ enum {
|
|||
MLX5_ETH_WQE_SWP_OUTER_L4_UDP = 1 << 5,
|
||||
};
|
||||
|
||||
enum {
|
||||
MLX5_ETH_WQE_FT_META_IPSEC = BIT(0),
|
||||
};
|
||||
|
||||
struct mlx5_wqe_eth_seg {
|
||||
u8 swp_outer_l4_offset;
|
||||
u8 swp_outer_l3_offset;
|
||||
|
|
@ -253,7 +257,7 @@ struct mlx5_wqe_eth_seg {
|
|||
u8 cs_flags;
|
||||
u8 swp_flags;
|
||||
__be16 mss;
|
||||
__be32 rsvd2;
|
||||
__be32 flow_table_metadata;
|
||||
union {
|
||||
struct {
|
||||
__be16 sz;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ struct net;
|
|||
#define SOCK_PASSCRED 3
|
||||
#define SOCK_PASSSEC 4
|
||||
|
||||
#define PROTO_CMSG_DATA_ONLY 0x0001
|
||||
|
||||
#ifndef ARCH_HAS_SOCKET_TYPES
|
||||
/**
|
||||
* enum sock_type - Socket types
|
||||
|
|
@ -136,6 +138,7 @@ typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
|
|||
|
||||
struct proto_ops {
|
||||
int family;
|
||||
unsigned int flags;
|
||||
struct module *owner;
|
||||
int (*release) (struct socket *sock);
|
||||
int (*bind) (struct socket *sock,
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ struct udp_tunnel_nic;
|
|||
struct bpf_prog;
|
||||
struct xdp_buff;
|
||||
|
||||
void synchronize_net(void);
|
||||
void netdev_set_default_ethtool_ops(struct net_device *dev,
|
||||
const struct ethtool_ops *ops);
|
||||
|
||||
|
|
@ -211,9 +212,8 @@ struct netdev_hw_addr {
|
|||
unsigned char type;
|
||||
#define NETDEV_HW_ADDR_T_LAN 1
|
||||
#define NETDEV_HW_ADDR_T_SAN 2
|
||||
#define NETDEV_HW_ADDR_T_SLAVE 3
|
||||
#define NETDEV_HW_ADDR_T_UNICAST 4
|
||||
#define NETDEV_HW_ADDR_T_MULTICAST 5
|
||||
#define NETDEV_HW_ADDR_T_UNICAST 3
|
||||
#define NETDEV_HW_ADDR_T_MULTICAST 4
|
||||
bool global_use;
|
||||
int sync_cnt;
|
||||
int refcount;
|
||||
|
|
@ -354,7 +354,7 @@ enum {
|
|||
NAPI_STATE_MISSED, /* reschedule a napi */
|
||||
NAPI_STATE_DISABLE, /* Disable pending */
|
||||
NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
|
||||
NAPI_STATE_HASHED, /* In NAPI hash (busy polling possible) */
|
||||
NAPI_STATE_LISTED, /* NAPI added to system lists */
|
||||
NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */
|
||||
NAPI_STATE_IN_BUSY_POLL,/* sk_busy_loop() owns this NAPI */
|
||||
};
|
||||
|
|
@ -364,7 +364,7 @@ enum {
|
|||
NAPIF_STATE_MISSED = BIT(NAPI_STATE_MISSED),
|
||||
NAPIF_STATE_DISABLE = BIT(NAPI_STATE_DISABLE),
|
||||
NAPIF_STATE_NPSVC = BIT(NAPI_STATE_NPSVC),
|
||||
NAPIF_STATE_HASHED = BIT(NAPI_STATE_HASHED),
|
||||
NAPIF_STATE_LISTED = BIT(NAPI_STATE_LISTED),
|
||||
NAPIF_STATE_NO_BUSY_POLL = BIT(NAPI_STATE_NO_BUSY_POLL),
|
||||
NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL),
|
||||
};
|
||||
|
|
@ -488,20 +488,6 @@ static inline bool napi_complete(struct napi_struct *n)
|
|||
return napi_complete_done(n, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* napi_hash_del - remove a NAPI from global table
|
||||
* @napi: NAPI context
|
||||
*
|
||||
* Warning: caller must observe RCU grace period
|
||||
* before freeing memory containing @napi, if
|
||||
* this function returns true.
|
||||
* Note: core networking stack automatically calls it
|
||||
* from netif_napi_del().
|
||||
* Drivers might want to call this helper to combine all
|
||||
* the needed RCU grace periods into a single one.
|
||||
*/
|
||||
bool napi_hash_del(struct napi_struct *napi);
|
||||
|
||||
/**
|
||||
* napi_disable - prevent NAPI from scheduling
|
||||
* @n: NAPI context
|
||||
|
|
@ -618,7 +604,7 @@ struct netdev_queue {
|
|||
/* Subordinate device that the queue has been assigned to */
|
||||
struct net_device *sb_dev;
|
||||
#ifdef CONFIG_XDP_SOCKETS
|
||||
struct xdp_umem *umem;
|
||||
struct xsk_buff_pool *pool;
|
||||
#endif
|
||||
/*
|
||||
* write-mostly part
|
||||
|
|
@ -640,11 +626,16 @@ struct netdev_queue {
|
|||
extern int sysctl_fb_tunnels_only_for_init_net;
|
||||
extern int sysctl_devconf_inherit_init_net;
|
||||
|
||||
/*
|
||||
* sysctl_fb_tunnels_only_for_init_net == 0 : For all netns
|
||||
* == 1 : For initns only
|
||||
* == 2 : For none.
|
||||
*/
|
||||
static inline bool net_has_fallback_tunnels(const struct net *net)
|
||||
{
|
||||
return net == &init_net ||
|
||||
!IS_ENABLED(CONFIG_SYSCTL) ||
|
||||
!sysctl_fb_tunnels_only_for_init_net;
|
||||
return !IS_ENABLED(CONFIG_SYSCTL) ||
|
||||
!sysctl_fb_tunnels_only_for_init_net ||
|
||||
(net == &init_net && sysctl_fb_tunnels_only_for_init_net == 1);
|
||||
}
|
||||
|
||||
static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
|
||||
|
|
@ -751,7 +742,7 @@ struct netdev_rx_queue {
|
|||
struct net_device *dev;
|
||||
struct xdp_rxq_info xdp_rxq;
|
||||
#ifdef CONFIG_XDP_SOCKETS
|
||||
struct xdp_umem *umem;
|
||||
struct xsk_buff_pool *pool;
|
||||
#endif
|
||||
} ____cacheline_aligned_in_smp;
|
||||
|
||||
|
|
@ -879,7 +870,7 @@ enum bpf_netdev_command {
|
|||
/* BPF program for offload callbacks, invoked at program load time. */
|
||||
BPF_OFFLOAD_MAP_ALLOC,
|
||||
BPF_OFFLOAD_MAP_FREE,
|
||||
XDP_SETUP_XSK_UMEM,
|
||||
XDP_SETUP_XSK_POOL,
|
||||
};
|
||||
|
||||
struct bpf_prog_offload_ops;
|
||||
|
|
@ -913,9 +904,9 @@ struct netdev_bpf {
|
|||
struct {
|
||||
struct bpf_offloaded_map *offmap;
|
||||
};
|
||||
/* XDP_SETUP_XSK_UMEM */
|
||||
/* XDP_SETUP_XSK_POOL */
|
||||
struct {
|
||||
struct xdp_umem *umem;
|
||||
struct xsk_buff_pool *pool;
|
||||
u16 queue_id;
|
||||
} xsk;
|
||||
};
|
||||
|
|
@ -1285,6 +1276,9 @@ struct netdev_net_notifier {
|
|||
* int (*ndo_tunnel_ctl)(struct net_device *dev, struct ip_tunnel_parm *p,
|
||||
* int cmd);
|
||||
* Add, change, delete or get information on an IPv4 tunnel.
|
||||
* struct net_device *(*ndo_get_peer_dev)(struct net_device *dev);
|
||||
* If a device is paired with a peer device, return the peer instance.
|
||||
* The caller must be under RCU read context.
|
||||
*/
|
||||
struct net_device_ops {
|
||||
int (*ndo_init)(struct net_device *dev);
|
||||
|
|
@ -1492,6 +1486,7 @@ struct net_device_ops {
|
|||
struct devlink_port * (*ndo_get_devlink_port)(struct net_device *dev);
|
||||
int (*ndo_tunnel_ctl)(struct net_device *dev,
|
||||
struct ip_tunnel_parm *p, int cmd);
|
||||
struct net_device * (*ndo_get_peer_dev)(struct net_device *dev);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -2208,6 +2203,22 @@ int netdev_get_num_tc(struct net_device *dev)
|
|||
return dev->num_tc;
|
||||
}
|
||||
|
||||
static inline void net_prefetch(void *p)
|
||||
{
|
||||
prefetch(p);
|
||||
#if L1_CACHE_BYTES < 128
|
||||
prefetch((u8 *)p + L1_CACHE_BYTES);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void net_prefetchw(void *p)
|
||||
{
|
||||
prefetchw(p);
|
||||
#if L1_CACHE_BYTES < 128
|
||||
prefetchw((u8 *)p + L1_CACHE_BYTES);
|
||||
#endif
|
||||
}
|
||||
|
||||
void netdev_unbind_sb_channel(struct net_device *dev,
|
||||
struct net_device *sb_dev);
|
||||
int netdev_bind_sb_channel_queue(struct net_device *dev,
|
||||
|
|
@ -2362,13 +2373,27 @@ static inline void netif_tx_napi_add(struct net_device *dev,
|
|||
netif_napi_add(dev, napi, poll, weight);
|
||||
}
|
||||
|
||||
/**
|
||||
* __netif_napi_del - remove a NAPI context
|
||||
* @napi: NAPI context
|
||||
*
|
||||
* Warning: caller must observe RCU grace period before freeing memory
|
||||
* containing @napi. Drivers might want to call this helper to combine
|
||||
* all the needed RCU grace periods into a single one.
|
||||
*/
|
||||
void __netif_napi_del(struct napi_struct *napi);
|
||||
|
||||
/**
|
||||
* netif_napi_del - remove a NAPI context
|
||||
* @napi: NAPI context
|
||||
*
|
||||
* netif_napi_del() removes a NAPI context from the network device NAPI list
|
||||
*/
|
||||
void netif_napi_del(struct napi_struct *napi);
|
||||
static inline void netif_napi_del(struct napi_struct *napi)
|
||||
{
|
||||
__netif_napi_del(napi);
|
||||
synchronize_net();
|
||||
}
|
||||
|
||||
struct napi_gro_cb {
|
||||
/* Virtual address of skb_shinfo(skb)->frags[0].page + offset. */
|
||||
|
|
@ -2522,6 +2547,16 @@ struct pcpu_lstats {
|
|||
|
||||
void dev_lstats_read(struct net_device *dev, u64 *packets, u64 *bytes);
|
||||
|
||||
static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int len)
|
||||
{
|
||||
struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
|
||||
|
||||
u64_stats_update_begin(&tstats->syncp);
|
||||
tstats->rx_bytes += len;
|
||||
tstats->rx_packets++;
|
||||
u64_stats_update_end(&tstats->syncp);
|
||||
}
|
||||
|
||||
static inline void dev_lstats_add(struct net_device *dev, unsigned int len)
|
||||
{
|
||||
struct pcpu_lstats *lstats = this_cpu_ptr(dev->lstats);
|
||||
|
|
@ -2792,7 +2827,6 @@ static inline void unregister_netdevice(struct net_device *dev)
|
|||
int netdev_refcnt_read(const struct net_device *dev);
|
||||
void free_netdev(struct net_device *dev);
|
||||
void netdev_freemem(struct net_device *dev);
|
||||
void synchronize_net(void);
|
||||
int init_dummy_netdev(struct net_device *dev);
|
||||
|
||||
struct net_device *netdev_get_xmit_slave(struct net_device *dev,
|
||||
|
|
@ -3777,6 +3811,7 @@ void generic_xdp_tx(struct sk_buff *skb, struct bpf_prog *xdp_prog);
|
|||
int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb);
|
||||
int netif_rx(struct sk_buff *skb);
|
||||
int netif_rx_ni(struct sk_buff *skb);
|
||||
int netif_rx_any_context(struct sk_buff *skb);
|
||||
int netif_receive_skb(struct sk_buff *skb);
|
||||
int netif_receive_skb_core(struct sk_buff *skb);
|
||||
void netif_receive_skb_list(struct list_head *head);
|
||||
|
|
@ -4464,6 +4499,8 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
|
|||
struct rtnl_link_stats64 *storage);
|
||||
void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
|
||||
const struct net_device_stats *netdev_stats);
|
||||
void dev_fetch_sw_netstats(struct rtnl_link_stats64 *s,
|
||||
const struct pcpu_sw_netstats __percpu *netstats);
|
||||
|
||||
extern int netdev_max_backlog;
|
||||
extern int netdev_tstamp_prequeue;
|
||||
|
|
@ -4704,16 +4741,6 @@ int netdev_class_create_file_ns(const struct class_attribute *class_attr,
|
|||
void netdev_class_remove_file_ns(const struct class_attribute *class_attr,
|
||||
const void *ns);
|
||||
|
||||
static inline int netdev_class_create_file(const struct class_attribute *class_attr)
|
||||
{
|
||||
return netdev_class_create_file_ns(class_attr, NULL);
|
||||
}
|
||||
|
||||
static inline void netdev_class_remove_file(const struct class_attribute *class_attr)
|
||||
{
|
||||
netdev_class_remove_file_ns(class_attr, NULL);
|
||||
}
|
||||
|
||||
extern const struct kobj_ns_type_operations net_ns_type_operations;
|
||||
|
||||
const char *netdev_drivername(const struct net_device *dev);
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
struct ip_conntrack_stat {
|
||||
unsigned int found;
|
||||
unsigned int invalid;
|
||||
unsigned int ignore;
|
||||
unsigned int insert;
|
||||
unsigned int insert_failed;
|
||||
unsigned int clash_resolve;
|
||||
unsigned int drop;
|
||||
unsigned int early_drop;
|
||||
unsigned int error;
|
||||
|
|
|
|||
|
|
@ -68,12 +68,14 @@ netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg)
|
|||
* @_msg: message string to report - don't access directly, use
|
||||
* %NL_SET_ERR_MSG
|
||||
* @bad_attr: attribute with error
|
||||
* @policy: policy for a bad attribute
|
||||
* @cookie: cookie data to return to userspace (for success)
|
||||
* @cookie_len: actual cookie data length
|
||||
*/
|
||||
struct netlink_ext_ack {
|
||||
const char *_msg;
|
||||
const struct nlattr *bad_attr;
|
||||
const struct nla_policy *policy;
|
||||
u8 cookie[NETLINK_MAX_COOKIE_LEN];
|
||||
u8 cookie_len;
|
||||
};
|
||||
|
|
@ -95,21 +97,29 @@ struct netlink_ext_ack {
|
|||
#define NL_SET_ERR_MSG_MOD(extack, msg) \
|
||||
NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg)
|
||||
|
||||
#define NL_SET_BAD_ATTR(extack, attr) do { \
|
||||
if ((extack)) \
|
||||
#define NL_SET_BAD_ATTR_POLICY(extack, attr, pol) do { \
|
||||
if ((extack)) { \
|
||||
(extack)->bad_attr = (attr); \
|
||||
} while (0)
|
||||
|
||||
#define NL_SET_ERR_MSG_ATTR(extack, attr, msg) do { \
|
||||
static const char __msg[] = msg; \
|
||||
struct netlink_ext_ack *__extack = (extack); \
|
||||
\
|
||||
if (__extack) { \
|
||||
__extack->_msg = __msg; \
|
||||
__extack->bad_attr = (attr); \
|
||||
(extack)->policy = (pol); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define NL_SET_BAD_ATTR(extack, attr) NL_SET_BAD_ATTR_POLICY(extack, attr, NULL)
|
||||
|
||||
#define NL_SET_ERR_MSG_ATTR_POL(extack, attr, pol, msg) do { \
|
||||
static const char __msg[] = msg; \
|
||||
struct netlink_ext_ack *__extack = (extack); \
|
||||
\
|
||||
if (__extack) { \
|
||||
__extack->_msg = __msg; \
|
||||
__extack->bad_attr = (attr); \
|
||||
__extack->policy = (pol); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define NL_SET_ERR_MSG_ATTR(extack, attr, msg) \
|
||||
NL_SET_ERR_MSG_ATTR_POL(extack, attr, NULL, msg)
|
||||
|
||||
static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack,
|
||||
u64 cookie)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -929,6 +929,11 @@ static inline int of_machine_is_compatible(const char *compat)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int of_remove_property(struct device_node *np, struct property *prop)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool of_console_check(const struct device_node *dn, const char *name, int index)
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ bool of_mdiobus_child_is_phy(struct device_node *child);
|
|||
int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
|
||||
int devm_of_mdiobus_register(struct device *dev, struct mii_bus *mdio,
|
||||
struct device_node *np);
|
||||
struct mdio_device *of_mdio_find_device(struct device_node *np);
|
||||
struct phy_device *of_phy_find_device(struct device_node *phy_np);
|
||||
struct phy_device *
|
||||
of_phy_connect(struct net_device *dev, struct device_node *phy_np,
|
||||
|
|
@ -74,6 +75,11 @@ static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *
|
|||
return mdiobus_register(mdio);
|
||||
}
|
||||
|
||||
static inline struct mdio_device *of_mdio_find_device(struct device_node *np)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct phy_device *of_phy_find_device(struct device_node *phy_np)
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
|||
21
include/linux/pcs-lynx.h
Normal file
21
include/linux/pcs-lynx.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
|
||||
/* Copyright 2020 NXP
|
||||
* Lynx PCS helpers
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_PCS_LYNX_H
|
||||
#define __LINUX_PCS_LYNX_H
|
||||
|
||||
#include <linux/mdio.h>
|
||||
#include <linux/phylink.h>
|
||||
|
||||
struct lynx_pcs {
|
||||
struct phylink_pcs pcs;
|
||||
struct mdio_device *mdio;
|
||||
};
|
||||
|
||||
struct lynx_pcs *lynx_pcs_create(struct mdio_device *mdio);
|
||||
|
||||
void lynx_pcs_destroy(struct lynx_pcs *pcs);
|
||||
|
||||
#endif /* __LINUX_PCS_LYNX_H */
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
* Synopsys DesignWare XPCS helpers
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_MDIO_XPCS_H
|
||||
#define __LINUX_MDIO_XPCS_H
|
||||
#ifndef __LINUX_PCS_XPCS_H
|
||||
#define __LINUX_PCS_XPCS_H
|
||||
|
||||
#include <linux/phy.h>
|
||||
#include <linux/phylink.h>
|
||||
|
|
@ -29,7 +29,7 @@ struct mdio_xpcs_ops {
|
|||
int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface);
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_MDIO_XPCS)
|
||||
#if IS_ENABLED(CONFIG_PCS_XPCS)
|
||||
struct mdio_xpcs_ops *mdio_xpcs_get_ops(void);
|
||||
#else
|
||||
static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void)
|
||||
|
|
@ -38,4 +38,4 @@ static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __LINUX_MDIO_XPCS_H */
|
||||
#endif /* __LINUX_PCS_XPCS_H */
|
||||
|
|
@ -82,7 +82,39 @@ extern const int phy_10gbit_features_array[1];
|
|||
#define PHY_POLL_CABLE_TEST 0x00000004
|
||||
#define MDIO_DEVICE_IS_PHY 0x80000000
|
||||
|
||||
/* Interface Mode definitions */
|
||||
/**
|
||||
* enum phy_interface_t - Interface Mode definitions
|
||||
*
|
||||
* @PHY_INTERFACE_MODE_NA: Not Applicable - don't touch
|
||||
* @PHY_INTERFACE_MODE_INTERNAL: No interface, MAC and PHY combined
|
||||
* @PHY_INTERFACE_MODE_MII: Median-independent interface
|
||||
* @PHY_INTERFACE_MODE_GMII: Gigabit median-independent interface
|
||||
* @PHY_INTERFACE_MODE_SGMII: Serial gigabit media-independent interface
|
||||
* @PHY_INTERFACE_MODE_TBI: Ten Bit Interface
|
||||
* @PHY_INTERFACE_MODE_REVMII: Reverse Media Independent Interface
|
||||
* @PHY_INTERFACE_MODE_RMII: Reduced Media Independent Interface
|
||||
* @PHY_INTERFACE_MODE_RGMII: Reduced gigabit media-independent interface
|
||||
* @PHY_INTERFACE_MODE_RGMII_ID: RGMII with Internal RX+TX delay
|
||||
* @PHY_INTERFACE_MODE_RGMII_RXID: RGMII with Internal RX delay
|
||||
* @PHY_INTERFACE_MODE_RGMII_TXID: RGMII with Internal RX delay
|
||||
* @PHY_INTERFACE_MODE_RTBI: Reduced TBI
|
||||
* @PHY_INTERFACE_MODE_SMII: ??? MII
|
||||
* @PHY_INTERFACE_MODE_XGMII: 10 gigabit media-independent interface
|
||||
* @PHY_INTERFACE_MODE_XLGMII:40 gigabit media-independent interface
|
||||
* @PHY_INTERFACE_MODE_MOCA: Multimedia over Coax
|
||||
* @PHY_INTERFACE_MODE_QSGMII: Quad SGMII
|
||||
* @PHY_INTERFACE_MODE_TRGMII: Turbo RGMII
|
||||
* @PHY_INTERFACE_MODE_1000BASEX: 1000 BaseX
|
||||
* @PHY_INTERFACE_MODE_2500BASEX: 2500 BaseX
|
||||
* @PHY_INTERFACE_MODE_RXAUI: Reduced XAUI
|
||||
* @PHY_INTERFACE_MODE_XAUI: 10 Gigabit Attachment Unit Interface
|
||||
* @PHY_INTERFACE_MODE_10GBASER: 10G BaseR
|
||||
* @PHY_INTERFACE_MODE_USXGMII: Universal Serial 10GE MII
|
||||
* @PHY_INTERFACE_MODE_10GKR: 10GBASE-KR - with Clause 73 AN
|
||||
* @PHY_INTERFACE_MODE_MAX: Book keeping
|
||||
*
|
||||
* Describes the interface between the MAC and PHY.
|
||||
*/
|
||||
typedef enum {
|
||||
PHY_INTERFACE_MODE_NA,
|
||||
PHY_INTERFACE_MODE_INTERNAL,
|
||||
|
|
@ -116,8 +148,8 @@ typedef enum {
|
|||
} phy_interface_t;
|
||||
|
||||
/**
|
||||
* phy_supported_speeds - return all speeds currently supported by a phy device
|
||||
* @phy: The phy device to return supported speeds of.
|
||||
* phy_supported_speeds - return all speeds currently supported by a PHY device
|
||||
* @phy: The PHY device to return supported speeds of.
|
||||
* @speeds: buffer to store supported speeds in.
|
||||
* @size: size of speeds buffer.
|
||||
*
|
||||
|
|
@ -134,9 +166,9 @@ unsigned int phy_supported_speeds(struct phy_device *phy,
|
|||
* phy_modes - map phy_interface_t enum to device tree binding of phy-mode
|
||||
* @interface: enum phy_interface_t value
|
||||
*
|
||||
* Description: maps 'enum phy_interface_t' defined in this file
|
||||
* Description: maps enum &phy_interface_t defined in this file
|
||||
* into the device tree binding of 'phy-mode', so that Ethernet
|
||||
* device driver can get phy interface from device tree.
|
||||
* device driver can get PHY interface from device tree.
|
||||
*/
|
||||
static inline const char *phy_modes(phy_interface_t interface)
|
||||
{
|
||||
|
|
@ -215,6 +247,14 @@ struct sfp_bus;
|
|||
struct sfp_upstream_ops;
|
||||
struct sk_buff;
|
||||
|
||||
/**
|
||||
* struct mdio_bus_stats - Statistics counters for MDIO busses
|
||||
* @transfers: Total number of transfers, i.e. @writes + @reads
|
||||
* @errors: Number of MDIO transfers that returned an error
|
||||
* @writes: Number of write transfers
|
||||
* @reads: Number of read transfers
|
||||
* @syncp: Synchronisation for incrementing statistics
|
||||
*/
|
||||
struct mdio_bus_stats {
|
||||
u64_stats_t transfers;
|
||||
u64_stats_t errors;
|
||||
|
|
@ -224,7 +264,15 @@ struct mdio_bus_stats {
|
|||
struct u64_stats_sync syncp;
|
||||
};
|
||||
|
||||
/* Represents a shared structure between different phydev's in the same
|
||||
/**
|
||||
* struct phy_package_shared - Shared information in PHY packages
|
||||
* @addr: Common PHY address used to combine PHYs in one package
|
||||
* @refcnt: Number of PHYs connected to this shared data
|
||||
* @flags: Initialization of PHY package
|
||||
* @priv_size: Size of the shared private data @priv
|
||||
* @priv: Driver private data shared across a PHY package
|
||||
*
|
||||
* Represents a shared structure between different phydev's in the same
|
||||
* package, for example a quad PHY. See phy_package_join() and
|
||||
* phy_package_leave().
|
||||
*/
|
||||
|
|
@ -247,7 +295,14 @@ struct phy_package_shared {
|
|||
#define PHY_SHARED_F_INIT_DONE 0
|
||||
#define PHY_SHARED_F_PROBE_DONE 1
|
||||
|
||||
/*
|
||||
/**
|
||||
* struct mii_bus - Represents an MDIO bus
|
||||
*
|
||||
* @owner: Who owns this device
|
||||
* @name: User friendly name for this MDIO device, or driver name
|
||||
* @id: Unique identifier for this bus, typical from bus hierarchy
|
||||
* @priv: Driver private data
|
||||
*
|
||||
* The Bus class for PHYs. Devices which provide access to
|
||||
* PHYs should register using this structure
|
||||
*/
|
||||
|
|
@ -256,49 +311,58 @@ struct mii_bus {
|
|||
const char *name;
|
||||
char id[MII_BUS_ID_SIZE];
|
||||
void *priv;
|
||||
/** @read: Perform a read transfer on the bus */
|
||||
int (*read)(struct mii_bus *bus, int addr, int regnum);
|
||||
/** @write: Perform a write transfer on the bus */
|
||||
int (*write)(struct mii_bus *bus, int addr, int regnum, u16 val);
|
||||
/** @reset: Perform a reset of the bus */
|
||||
int (*reset)(struct mii_bus *bus);
|
||||
|
||||
/** @stats: Statistic counters per device on the bus */
|
||||
struct mdio_bus_stats stats[PHY_MAX_ADDR];
|
||||
|
||||
/*
|
||||
* A lock to ensure that only one thing can read/write
|
||||
/**
|
||||
* @mdio_lock: A lock to ensure that only one thing can read/write
|
||||
* the MDIO bus at a time
|
||||
*/
|
||||
struct mutex mdio_lock;
|
||||
|
||||
/** @parent: Parent device of this bus */
|
||||
struct device *parent;
|
||||
/** @state: State of bus structure */
|
||||
enum {
|
||||
MDIOBUS_ALLOCATED = 1,
|
||||
MDIOBUS_REGISTERED,
|
||||
MDIOBUS_UNREGISTERED,
|
||||
MDIOBUS_RELEASED,
|
||||
} state;
|
||||
|
||||
/** @dev: Kernel device representation */
|
||||
struct device dev;
|
||||
|
||||
/* list of all PHYs on bus */
|
||||
/** @mdio_map: list of all MDIO devices on bus */
|
||||
struct mdio_device *mdio_map[PHY_MAX_ADDR];
|
||||
|
||||
/* PHY addresses to be ignored when probing */
|
||||
/** @phy_mask: PHY addresses to be ignored when probing */
|
||||
u32 phy_mask;
|
||||
|
||||
/* PHY addresses to ignore the TA/read failure */
|
||||
/** @phy_ignore_ta_mask: PHY addresses to ignore the TA/read failure */
|
||||
u32 phy_ignore_ta_mask;
|
||||
|
||||
/*
|
||||
* An array of interrupts, each PHY's interrupt at the index
|
||||
/**
|
||||
* @irq: An array of interrupts, each PHY's interrupt at the index
|
||||
* matching its address
|
||||
*/
|
||||
int irq[PHY_MAX_ADDR];
|
||||
|
||||
/* GPIO reset pulse width in microseconds */
|
||||
/** @reset_delay_us: GPIO reset pulse width in microseconds */
|
||||
int reset_delay_us;
|
||||
/* GPIO reset deassert delay in microseconds */
|
||||
/** @reset_post_delay_us: GPIO reset deassert delay in microseconds */
|
||||
int reset_post_delay_us;
|
||||
/* RESET GPIO descriptor pointer */
|
||||
/** @reset_gpiod: Reset GPIO descriptor pointer */
|
||||
struct gpio_desc *reset_gpiod;
|
||||
|
||||
/* bus capabilities, used for probing */
|
||||
/** @probe_capabilities: bus capabilities, used for probing */
|
||||
enum {
|
||||
MDIOBUS_NO_CAP = 0,
|
||||
MDIOBUS_C22,
|
||||
|
|
@ -306,15 +370,22 @@ struct mii_bus {
|
|||
MDIOBUS_C22_C45,
|
||||
} probe_capabilities;
|
||||
|
||||
/* protect access to the shared element */
|
||||
/** @shared_lock: protect access to the shared element */
|
||||
struct mutex shared_lock;
|
||||
|
||||
/* shared state across different PHYs */
|
||||
/** @shared: shared state across different PHYs */
|
||||
struct phy_package_shared *shared[PHY_MAX_ADDR];
|
||||
};
|
||||
#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
|
||||
|
||||
struct mii_bus *mdiobus_alloc_size(size_t);
|
||||
struct mii_bus *mdiobus_alloc_size(size_t size);
|
||||
|
||||
/**
|
||||
* mdiobus_alloc - Allocate an MDIO bus structure
|
||||
*
|
||||
* The internal state of the MDIO bus will be set of MDIOBUS_ALLOCATED ready
|
||||
* for the driver to register the bus.
|
||||
*/
|
||||
static inline struct mii_bus *mdiobus_alloc(void)
|
||||
{
|
||||
return mdiobus_alloc_size(0);
|
||||
|
|
@ -341,40 +412,41 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
|
|||
#define PHY_INTERRUPT_DISABLED false
|
||||
#define PHY_INTERRUPT_ENABLED true
|
||||
|
||||
/* PHY state machine states:
|
||||
/**
|
||||
* enum phy_state - PHY state machine states:
|
||||
*
|
||||
* DOWN: PHY device and driver are not ready for anything. probe
|
||||
* @PHY_DOWN: PHY device and driver are not ready for anything. probe
|
||||
* should be called if and only if the PHY is in this state,
|
||||
* given that the PHY device exists.
|
||||
* - PHY driver probe function will set the state to READY
|
||||
* - PHY driver probe function will set the state to @PHY_READY
|
||||
*
|
||||
* READY: PHY is ready to send and receive packets, but the
|
||||
* @PHY_READY: PHY is ready to send and receive packets, but the
|
||||
* controller is not. By default, PHYs which do not implement
|
||||
* probe will be set to this state by phy_probe().
|
||||
* - start will set the state to UP
|
||||
*
|
||||
* UP: The PHY and attached device are ready to do work.
|
||||
* @PHY_UP: The PHY and attached device are ready to do work.
|
||||
* Interrupts should be started here.
|
||||
* - timer moves to NOLINK or RUNNING
|
||||
* - timer moves to @PHY_NOLINK or @PHY_RUNNING
|
||||
*
|
||||
* NOLINK: PHY is up, but not currently plugged in.
|
||||
* - irq or timer will set RUNNING if link comes back
|
||||
* - phy_stop moves to HALTED
|
||||
* @PHY_NOLINK: PHY is up, but not currently plugged in.
|
||||
* - irq or timer will set @PHY_RUNNING if link comes back
|
||||
* - phy_stop moves to @PHY_HALTED
|
||||
*
|
||||
* RUNNING: PHY is currently up, running, and possibly sending
|
||||
* @PHY_RUNNING: PHY is currently up, running, and possibly sending
|
||||
* and/or receiving packets
|
||||
* - irq or timer will set NOLINK if link goes down
|
||||
* - phy_stop moves to HALTED
|
||||
* - irq or timer will set @PHY_NOLINK if link goes down
|
||||
* - phy_stop moves to @PHY_HALTED
|
||||
*
|
||||
* CABLETEST: PHY is performing a cable test. Packet reception/sending
|
||||
* @PHY_CABLETEST: PHY is performing a cable test. Packet reception/sending
|
||||
* is not expected to work, carrier will be indicated as down. PHY will be
|
||||
* poll once per second, or on interrupt for it current state.
|
||||
* Once complete, move to UP to restart the PHY.
|
||||
* - phy_stop aborts the running test and moves to HALTED
|
||||
* - phy_stop aborts the running test and moves to @PHY_HALTED
|
||||
*
|
||||
* HALTED: PHY is up, but no polling or interrupts are done. Or
|
||||
* @PHY_HALTED: PHY is up, but no polling or interrupts are done. Or
|
||||
* PHY is in an error state.
|
||||
* - phy_start moves to UP
|
||||
* - phy_start moves to @PHY_UP
|
||||
*/
|
||||
enum phy_state {
|
||||
PHY_DOWN = 0,
|
||||
|
|
@ -403,34 +475,67 @@ struct phy_c45_device_ids {
|
|||
struct macsec_context;
|
||||
struct macsec_ops;
|
||||
|
||||
/* phy_device: An instance of a PHY
|
||||
/**
|
||||
* struct phy_device - An instance of a PHY
|
||||
*
|
||||
* drv: Pointer to the driver for this PHY instance
|
||||
* phy_id: UID for this device found during discovery
|
||||
* c45_ids: 802.3-c45 Device Identifers if is_c45.
|
||||
* is_c45: Set to true if this phy uses clause 45 addressing.
|
||||
* is_internal: Set to true if this phy is internal to a MAC.
|
||||
* is_pseudo_fixed_link: Set to true if this phy is an Ethernet switch, etc.
|
||||
* is_gigabit_capable: Set to true if PHY supports 1000Mbps
|
||||
* has_fixups: Set to true if this phy has fixups/quirks.
|
||||
* suspended: Set to true if this phy has been suspended successfully.
|
||||
* suspended_by_mdio_bus: Set to true if this phy was suspended by MDIO bus.
|
||||
* sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal.
|
||||
* loopback_enabled: Set true if this phy has been loopbacked successfully.
|
||||
* downshifted_rate: Set true if link speed has been downshifted.
|
||||
* state: state of the PHY for management purposes
|
||||
* dev_flags: Device-specific flags used by the PHY driver.
|
||||
* irq: IRQ number of the PHY's interrupt (-1 if none)
|
||||
* phy_timer: The timer for handling the state machine
|
||||
* sfp_bus_attached: flag indicating whether the SFP bus has been attached
|
||||
* sfp_bus: SFP bus attached to this PHY's fiber port
|
||||
* attached_dev: The attached enet driver's device instance ptr
|
||||
* adjust_link: Callback for the enet controller to respond to
|
||||
* changes in the link state.
|
||||
* macsec_ops: MACsec offloading ops.
|
||||
* @mdio: MDIO bus this PHY is on
|
||||
* @drv: Pointer to the driver for this PHY instance
|
||||
* @phy_id: UID for this device found during discovery
|
||||
* @c45_ids: 802.3-c45 Device Identifiers if is_c45.
|
||||
* @is_c45: Set to true if this PHY uses clause 45 addressing.
|
||||
* @is_internal: Set to true if this PHY is internal to a MAC.
|
||||
* @is_pseudo_fixed_link: Set to true if this PHY is an Ethernet switch, etc.
|
||||
* @is_gigabit_capable: Set to true if PHY supports 1000Mbps
|
||||
* @has_fixups: Set to true if this PHY has fixups/quirks.
|
||||
* @suspended: Set to true if this PHY has been suspended successfully.
|
||||
* @suspended_by_mdio_bus: Set to true if this PHY was suspended by MDIO bus.
|
||||
* @sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal.
|
||||
* @loopback_enabled: Set true if this PHY has been loopbacked successfully.
|
||||
* @downshifted_rate: Set true if link speed has been downshifted.
|
||||
* @state: State of the PHY for management purposes
|
||||
* @dev_flags: Device-specific flags used by the PHY driver.
|
||||
* @irq: IRQ number of the PHY's interrupt (-1 if none)
|
||||
* @phy_timer: The timer for handling the state machine
|
||||
* @phylink: Pointer to phylink instance for this PHY
|
||||
* @sfp_bus_attached: Flag indicating whether the SFP bus has been attached
|
||||
* @sfp_bus: SFP bus attached to this PHY's fiber port
|
||||
* @attached_dev: The attached enet driver's device instance ptr
|
||||
* @adjust_link: Callback for the enet controller to respond to changes: in the
|
||||
* link state.
|
||||
* @phy_link_change: Callback for phylink for notification of link change
|
||||
* @macsec_ops: MACsec offloading ops.
|
||||
*
|
||||
* speed, duplex, pause, supported, advertising, lp_advertising,
|
||||
* and autoneg are used like in mii_if_info
|
||||
* @speed: Current link speed
|
||||
* @duplex: Current duplex
|
||||
* @pause: Current pause
|
||||
* @asym_pause: Current asymmetric pause
|
||||
* @supported: Combined MAC/PHY supported linkmodes
|
||||
* @advertising: Currently advertised linkmodes
|
||||
* @adv_old: Saved advertised while power saving for WoL
|
||||
* @lp_advertising: Current link partner advertised linkmodes
|
||||
* @eee_broken_modes: Energy efficient ethernet modes which should be prohibited
|
||||
* @autoneg: Flag autoneg being used
|
||||
* @link: Current link state
|
||||
* @autoneg_complete: Flag auto negotiation of the link has completed
|
||||
* @mdix: Current crossover
|
||||
* @mdix_ctrl: User setting of crossover
|
||||
* @interrupts: Flag interrupts have been enabled
|
||||
* @interface: enum phy_interface_t value
|
||||
* @skb: Netlink message for cable diagnostics
|
||||
* @nest: Netlink nest used for cable diagnostics
|
||||
* @ehdr: nNtlink header for cable diagnostics
|
||||
* @phy_led_triggers: Array of LED triggers
|
||||
* @phy_num_led_triggers: Number of triggers in @phy_led_triggers
|
||||
* @led_link_trigger: LED trigger for link up/down
|
||||
* @last_triggered: last LED trigger for link speed
|
||||
* @master_slave_set: User requested master/slave configuration
|
||||
* @master_slave_get: Current master/slave advertisement
|
||||
* @master_slave_state: Current master/slave configuration
|
||||
* @mii_ts: Pointer to time stamper callbacks
|
||||
* @lock: Mutex for serialization access to PHY
|
||||
* @state_queue: Work queue for state machine
|
||||
* @shared: Pointer to private data shared by phys in one package
|
||||
* @priv: Pointer to driver private data
|
||||
*
|
||||
* interrupts currently only supports enabled or disabled,
|
||||
* but could be changed in the future to support enabling
|
||||
|
|
@ -550,9 +655,18 @@ struct phy_device {
|
|||
#define to_phy_device(d) container_of(to_mdio_device(d), \
|
||||
struct phy_device, mdio)
|
||||
|
||||
/* A structure containing possible configuration parameters
|
||||
/**
|
||||
* struct phy_tdr_config - Configuration of a TDR raw test
|
||||
*
|
||||
* @first: Distance for first data collection point
|
||||
* @last: Distance for last data collection point
|
||||
* @step: Step between data collection points
|
||||
* @pair: Bitmap of cable pairs to collect data for
|
||||
*
|
||||
* A structure containing possible configuration parameters
|
||||
* for a TDR cable test. The driver does not need to implement
|
||||
* all the parameters, but should report what is actually used.
|
||||
* All distances are in centimeters.
|
||||
*/
|
||||
struct phy_tdr_config {
|
||||
u32 first;
|
||||
|
|
@ -562,18 +676,20 @@ struct phy_tdr_config {
|
|||
};
|
||||
#define PHY_PAIR_ALL -1
|
||||
|
||||
/* struct phy_driver: Driver structure for a particular PHY type
|
||||
/**
|
||||
* struct phy_driver - Driver structure for a particular PHY type
|
||||
*
|
||||
* driver_data: static driver data
|
||||
* phy_id: The result of reading the UID registers of this PHY
|
||||
* @mdiodrv: Data common to all MDIO devices
|
||||
* @phy_id: The result of reading the UID registers of this PHY
|
||||
* type, and ANDing them with the phy_id_mask. This driver
|
||||
* only works for PHYs with IDs which match this field
|
||||
* name: The friendly name of this PHY type
|
||||
* phy_id_mask: Defines the important bits of the phy_id
|
||||
* features: A mandatory list of features (speed, duplex, etc)
|
||||
* @name: The friendly name of this PHY type
|
||||
* @phy_id_mask: Defines the important bits of the phy_id
|
||||
* @features: A mandatory list of features (speed, duplex, etc)
|
||||
* supported by this PHY
|
||||
* flags: A bitfield defining certain other features this PHY
|
||||
* @flags: A bitfield defining certain other features this PHY
|
||||
* supports (like interrupts)
|
||||
* @driver_data: Static driver data
|
||||
*
|
||||
* All functions are optional. If config_aneg or read_status
|
||||
* are not implemented, the phy core uses the genphy versions.
|
||||
|
|
@ -592,151 +708,178 @@ struct phy_driver {
|
|||
u32 flags;
|
||||
const void *driver_data;
|
||||
|
||||
/*
|
||||
* Called to issue a PHY software reset
|
||||
/**
|
||||
* @soft_reset: Called to issue a PHY software reset
|
||||
*/
|
||||
int (*soft_reset)(struct phy_device *phydev);
|
||||
|
||||
/*
|
||||
* Called to initialize the PHY,
|
||||
/**
|
||||
* @config_init: Called to initialize the PHY,
|
||||
* including after a reset
|
||||
*/
|
||||
int (*config_init)(struct phy_device *phydev);
|
||||
|
||||
/*
|
||||
* Called during discovery. Used to set
|
||||
/**
|
||||
* @probe: Called during discovery. Used to set
|
||||
* up device-specific structures, if any
|
||||
*/
|
||||
int (*probe)(struct phy_device *phydev);
|
||||
|
||||
/*
|
||||
* Probe the hardware to determine what abilities it has.
|
||||
* Should only set phydev->supported.
|
||||
/**
|
||||
* @get_features: Probe the hardware to determine what
|
||||
* abilities it has. Should only set phydev->supported.
|
||||
*/
|
||||
int (*get_features)(struct phy_device *phydev);
|
||||
|
||||
/* PHY Power Management */
|
||||
/** @suspend: Suspend the hardware, saving state if needed */
|
||||
int (*suspend)(struct phy_device *phydev);
|
||||
/** @resume: Resume the hardware, restoring state if needed */
|
||||
int (*resume)(struct phy_device *phydev);
|
||||
|
||||
/*
|
||||
* Configures the advertisement and resets
|
||||
/**
|
||||
* @config_aneg: Configures the advertisement and resets
|
||||
* autonegotiation if phydev->autoneg is on,
|
||||
* forces the speed to the current settings in phydev
|
||||
* if phydev->autoneg is off
|
||||
*/
|
||||
int (*config_aneg)(struct phy_device *phydev);
|
||||
|
||||
/* Determines the auto negotiation result */
|
||||
/** @aneg_done: Determines the auto negotiation result */
|
||||
int (*aneg_done)(struct phy_device *phydev);
|
||||
|
||||
/* Determines the negotiated speed and duplex */
|
||||
/** @read_status: Determines the negotiated speed and duplex */
|
||||
int (*read_status)(struct phy_device *phydev);
|
||||
|
||||
/* Clears any pending interrupts */
|
||||
/** @ack_interrupt: Clears any pending interrupts */
|
||||
int (*ack_interrupt)(struct phy_device *phydev);
|
||||
|
||||
/* Enables or disables interrupts */
|
||||
/** @config_intr: Enables or disables interrupts */
|
||||
int (*config_intr)(struct phy_device *phydev);
|
||||
|
||||
/*
|
||||
* Checks if the PHY generated an interrupt.
|
||||
/**
|
||||
* @did_interrupt: Checks if the PHY generated an interrupt.
|
||||
* For multi-PHY devices with shared PHY interrupt pin
|
||||
* Set interrupt bits have to be cleared.
|
||||
*/
|
||||
int (*did_interrupt)(struct phy_device *phydev);
|
||||
|
||||
/* Override default interrupt handling */
|
||||
/** @handle_interrupt: Override default interrupt handling */
|
||||
irqreturn_t (*handle_interrupt)(struct phy_device *phydev);
|
||||
|
||||
/* Clears up any memory if needed */
|
||||
/** @remove: Clears up any memory if needed */
|
||||
void (*remove)(struct phy_device *phydev);
|
||||
|
||||
/* Returns true if this is a suitable driver for the given
|
||||
* phydev. If NULL, matching is based on phy_id and
|
||||
* phy_id_mask.
|
||||
/**
|
||||
* @match_phy_device: Returns true if this is a suitable
|
||||
* driver for the given phydev. If NULL, matching is based on
|
||||
* phy_id and phy_id_mask.
|
||||
*/
|
||||
int (*match_phy_device)(struct phy_device *phydev);
|
||||
|
||||
/* Some devices (e.g. qnap TS-119P II) require PHY register changes to
|
||||
* enable Wake on LAN, so set_wol is provided to be called in the
|
||||
* ethernet driver's set_wol function. */
|
||||
/**
|
||||
* @set_wol: Some devices (e.g. qnap TS-119P II) require PHY
|
||||
* register changes to enable Wake on LAN, so set_wol is
|
||||
* provided to be called in the ethernet driver's set_wol
|
||||
* function.
|
||||
*/
|
||||
int (*set_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
|
||||
|
||||
/* See set_wol, but for checking whether Wake on LAN is enabled. */
|
||||
/**
|
||||
* @get_wol: See set_wol, but for checking whether Wake on LAN
|
||||
* is enabled.
|
||||
*/
|
||||
void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
|
||||
|
||||
/*
|
||||
* Called to inform a PHY device driver when the core is about to
|
||||
* change the link state. This callback is supposed to be used as
|
||||
* fixup hook for drivers that need to take action when the link
|
||||
* state changes. Drivers are by no means allowed to mess with the
|
||||
/**
|
||||
* @link_change_notify: Called to inform a PHY device driver
|
||||
* when the core is about to change the link state. This
|
||||
* callback is supposed to be used as fixup hook for drivers
|
||||
* that need to take action when the link state
|
||||
* changes. Drivers are by no means allowed to mess with the
|
||||
* PHY device structure in their implementations.
|
||||
*/
|
||||
void (*link_change_notify)(struct phy_device *dev);
|
||||
|
||||
/*
|
||||
* Phy specific driver override for reading a MMD register.
|
||||
* This function is optional for PHY specific drivers. When
|
||||
* not provided, the default MMD read function will be used
|
||||
* by phy_read_mmd(), which will use either a direct read for
|
||||
* Clause 45 PHYs or an indirect read for Clause 22 PHYs.
|
||||
* devnum is the MMD device number within the PHY device,
|
||||
* regnum is the register within the selected MMD device.
|
||||
/**
|
||||
* @read_mmd: PHY specific driver override for reading a MMD
|
||||
* register. This function is optional for PHY specific
|
||||
* drivers. When not provided, the default MMD read function
|
||||
* will be used by phy_read_mmd(), which will use either a
|
||||
* direct read for Clause 45 PHYs or an indirect read for
|
||||
* Clause 22 PHYs. devnum is the MMD device number within the
|
||||
* PHY device, regnum is the register within the selected MMD
|
||||
* device.
|
||||
*/
|
||||
int (*read_mmd)(struct phy_device *dev, int devnum, u16 regnum);
|
||||
|
||||
/*
|
||||
* Phy specific driver override for writing a MMD register.
|
||||
* This function is optional for PHY specific drivers. When
|
||||
* not provided, the default MMD write function will be used
|
||||
* by phy_write_mmd(), which will use either a direct write for
|
||||
* Clause 45 PHYs, or an indirect write for Clause 22 PHYs.
|
||||
* devnum is the MMD device number within the PHY device,
|
||||
* regnum is the register within the selected MMD device.
|
||||
* val is the value to be written.
|
||||
/**
|
||||
* @write_mmd: PHY specific driver override for writing a MMD
|
||||
* register. This function is optional for PHY specific
|
||||
* drivers. When not provided, the default MMD write function
|
||||
* will be used by phy_write_mmd(), which will use either a
|
||||
* direct write for Clause 45 PHYs, or an indirect write for
|
||||
* Clause 22 PHYs. devnum is the MMD device number within the
|
||||
* PHY device, regnum is the register within the selected MMD
|
||||
* device. val is the value to be written.
|
||||
*/
|
||||
int (*write_mmd)(struct phy_device *dev, int devnum, u16 regnum,
|
||||
u16 val);
|
||||
|
||||
/** @read_page: Return the current PHY register page number */
|
||||
int (*read_page)(struct phy_device *dev);
|
||||
/** @write_page: Set the current PHY register page number */
|
||||
int (*write_page)(struct phy_device *dev, int page);
|
||||
|
||||
/* Get the size and type of the eeprom contained within a plug-in
|
||||
* module */
|
||||
/**
|
||||
* @module_info: Get the size and type of the eeprom contained
|
||||
* within a plug-in module
|
||||
*/
|
||||
int (*module_info)(struct phy_device *dev,
|
||||
struct ethtool_modinfo *modinfo);
|
||||
|
||||
/* Get the eeprom information from the plug-in module */
|
||||
/**
|
||||
* @module_eeprom: Get the eeprom information from the plug-in
|
||||
* module
|
||||
*/
|
||||
int (*module_eeprom)(struct phy_device *dev,
|
||||
struct ethtool_eeprom *ee, u8 *data);
|
||||
|
||||
/* Start a cable test */
|
||||
/** @cable_test_start: Start a cable test */
|
||||
int (*cable_test_start)(struct phy_device *dev);
|
||||
|
||||
/* Start a raw TDR cable test */
|
||||
/** @cable_test_tdr_start: Start a raw TDR cable test */
|
||||
int (*cable_test_tdr_start)(struct phy_device *dev,
|
||||
const struct phy_tdr_config *config);
|
||||
|
||||
/* Once per second, or on interrupt, request the status of the
|
||||
* test.
|
||||
/**
|
||||
* @cable_test_get_status: Once per second, or on interrupt,
|
||||
* request the status of the test.
|
||||
*/
|
||||
int (*cable_test_get_status)(struct phy_device *dev, bool *finished);
|
||||
|
||||
/* Get statistics from the phy using ethtool */
|
||||
/* Get statistics from the PHY using ethtool */
|
||||
/** @get_sset_count: Number of statistic counters */
|
||||
int (*get_sset_count)(struct phy_device *dev);
|
||||
/** @get_strings: Names of the statistic counters */
|
||||
void (*get_strings)(struct phy_device *dev, u8 *data);
|
||||
/** @get_stats: Return the statistic counter values */
|
||||
void (*get_stats)(struct phy_device *dev,
|
||||
struct ethtool_stats *stats, u64 *data);
|
||||
|
||||
/* Get and Set PHY tunables */
|
||||
/** @get_tunable: Return the value of a tunable */
|
||||
int (*get_tunable)(struct phy_device *dev,
|
||||
struct ethtool_tunable *tuna, void *data);
|
||||
/** @set_tunable: Set the value of a tunable */
|
||||
int (*set_tunable)(struct phy_device *dev,
|
||||
struct ethtool_tunable *tuna,
|
||||
const void *data);
|
||||
/** @set_loopback: Set the loopback mood of the PHY */
|
||||
int (*set_loopback)(struct phy_device *dev, bool enable);
|
||||
/** @get_sqi: Get the signal quality indication */
|
||||
int (*get_sqi)(struct phy_device *dev);
|
||||
/** @get_sqi_max: Get the maximum signal quality indication */
|
||||
int (*get_sqi_max)(struct phy_device *dev);
|
||||
};
|
||||
#define to_phy_driver(d) container_of(to_mdio_common_driver(d), \
|
||||
|
|
@ -890,6 +1033,24 @@ static inline int __phy_modify_changed(struct phy_device *phydev, u32 regnum,
|
|||
*/
|
||||
int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
|
||||
|
||||
/**
|
||||
* phy_read_mmd_poll_timeout - Periodically poll a PHY register until a
|
||||
* condition is met or a timeout occurs
|
||||
*
|
||||
* @phydev: The phy_device struct
|
||||
* @devaddr: The MMD to read from
|
||||
* @regnum: The register on the MMD to read
|
||||
* @val: Variable to read the register into
|
||||
* @cond: Break condition (usually involving @val)
|
||||
* @sleep_us: Maximum time to sleep between reads in us (0
|
||||
* tight-loops). Should be less than ~20ms since usleep_range
|
||||
* is used (see Documentation/timers/timers-howto.rst).
|
||||
* @timeout_us: Timeout in us, 0 means never timeout
|
||||
* @sleep_before_read: if it is true, sleep @sleep_us before read.
|
||||
* Returns 0 on success and -ETIMEDOUT upon a timeout. In either
|
||||
* case, the last read value at @args is stored in @val. Must not
|
||||
* be called from atomic context if sleep_us or timeout_us are used.
|
||||
*/
|
||||
#define phy_read_mmd_poll_timeout(phydev, devaddr, regnum, val, cond, \
|
||||
sleep_us, timeout_us, sleep_before_read) \
|
||||
({ \
|
||||
|
|
@ -1161,7 +1322,7 @@ static inline bool phy_is_internal(struct phy_device *phydev)
|
|||
/**
|
||||
* phy_interface_mode_is_rgmii - Convenience function for testing if a
|
||||
* PHY interface mode is RGMII (all variants)
|
||||
* @mode: the phy_interface_t enum
|
||||
* @mode: the &phy_interface_t enum
|
||||
*/
|
||||
static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode)
|
||||
{
|
||||
|
|
@ -1170,11 +1331,11 @@ static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode)
|
|||
};
|
||||
|
||||
/**
|
||||
* phy_interface_mode_is_8023z() - does the phy interface mode use 802.3z
|
||||
* phy_interface_mode_is_8023z() - does the PHY interface mode use 802.3z
|
||||
* negotiation
|
||||
* @mode: one of &enum phy_interface_t
|
||||
*
|
||||
* Returns true if the phy interface mode uses the 16-bit negotiation
|
||||
* Returns true if the PHY interface mode uses the 16-bit negotiation
|
||||
* word as defined in 802.3z. (See 802.3-2015 37.2.1 Config_Reg encoding)
|
||||
*/
|
||||
static inline bool phy_interface_mode_is_8023z(phy_interface_t mode)
|
||||
|
|
@ -1193,7 +1354,7 @@ static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
|
|||
return phy_interface_mode_is_rgmii(phydev->interface);
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* phy_is_pseudo_fixed_link - Convenience function for testing if this
|
||||
* PHY is the CPU port facing side of an Ethernet switch, or similar.
|
||||
* @phydev: the phy_device struct
|
||||
|
|
@ -1566,8 +1727,9 @@ static inline int mdiobus_register_board_info(const struct mdio_board_info *i,
|
|||
|
||||
|
||||
/**
|
||||
* module_phy_driver() - Helper macro for registering PHY drivers
|
||||
* phy_module_driver() - Helper macro for registering PHY drivers
|
||||
* @__phy_drivers: array of PHY drivers to register
|
||||
* @__count: Numbers of members in array
|
||||
*
|
||||
* Helper macro for PHY drivers which do not do anything special in module
|
||||
* init/exit. Each module may only use this macro once, and calling it
|
||||
|
|
|
|||
|
|
@ -490,4 +490,7 @@ void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs);
|
|||
|
||||
void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs,
|
||||
struct phylink_link_state *state);
|
||||
|
||||
void phylink_decode_usxgmii_word(struct phylink_link_state *state,
|
||||
uint16_t lpa);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (C) 2004-2006 Atmel Corporation
|
||||
*/
|
||||
#ifndef __MACB_PDATA_H__
|
||||
#define __MACB_PDATA_H__
|
||||
|
||||
#include <linux/clk.h>
|
||||
|
||||
/**
|
||||
* struct macb_platform_data - platform data for MACB Ethernet
|
||||
* @pclk: platform clock
|
||||
* @hclk: AHB clock
|
||||
*/
|
||||
struct macb_platform_data {
|
||||
struct clk *pclk;
|
||||
struct clk *hclk;
|
||||
};
|
||||
|
||||
#endif /* __MACB_PDATA_H__ */
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
#include <asm/processor.h>
|
||||
#include <asm/cache.h>
|
||||
|
||||
struct page;
|
||||
/*
|
||||
prefetch(x) attempts to pre-emptively get the memory pointed to
|
||||
by address "x" into the CPU L1 cache.
|
||||
|
|
@ -62,4 +63,11 @@ static inline void prefetch_range(void *addr, size_t len)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline void prefetch_page_address(struct page *page)
|
||||
{
|
||||
#if defined(WANT_PAGE_VIRTUAL) || defined(HASHED_PAGE_VIRTUAL)
|
||||
prefetch(page);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#define OFF_PTP_SOURCE_UUID 22 /* PTPv1 only */
|
||||
#define OFF_PTP_SEQUENCE_ID 30
|
||||
#define OFF_PTP_CONTROL 32 /* PTPv1 only */
|
||||
|
||||
/* Below defines should actually be removed at some point in time. */
|
||||
#define IP6_HLEN 40
|
||||
|
|
@ -44,6 +43,30 @@
|
|||
#define OFF_IHL 14
|
||||
#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2)
|
||||
|
||||
struct clock_identity {
|
||||
u8 id[8];
|
||||
} __packed;
|
||||
|
||||
struct port_identity {
|
||||
struct clock_identity clock_identity;
|
||||
__be16 port_number;
|
||||
} __packed;
|
||||
|
||||
struct ptp_header {
|
||||
u8 tsmt; /* transportSpecific | messageType */
|
||||
u8 ver; /* reserved | versionPTP */
|
||||
__be16 message_length;
|
||||
u8 domain_number;
|
||||
u8 reserved1;
|
||||
u8 flag_field[2];
|
||||
__be64 correction;
|
||||
__be32 reserved2;
|
||||
struct port_identity source_port_identity;
|
||||
__be16 sequence_id;
|
||||
u8 control;
|
||||
u8 log_message_interval;
|
||||
} __packed;
|
||||
|
||||
#if defined(CONFIG_NET_PTP_CLASSIFY)
|
||||
/**
|
||||
* ptp_classify_raw - classify a PTP packet
|
||||
|
|
@ -57,6 +80,46 @@
|
|||
*/
|
||||
unsigned int ptp_classify_raw(const struct sk_buff *skb);
|
||||
|
||||
/**
|
||||
* ptp_parse_header - Get pointer to the PTP v2 header
|
||||
* @skb: packet buffer
|
||||
* @type: type of the packet (see ptp_classify_raw())
|
||||
*
|
||||
* This function takes care of the VLAN, UDP, IPv4 and IPv6 headers. The length
|
||||
* is checked.
|
||||
*
|
||||
* Note, internally skb_mac_header() is used. Make sure that the @skb is
|
||||
* initialized accordingly.
|
||||
*
|
||||
* Return: Pointer to the ptp v2 header or NULL if not found
|
||||
*/
|
||||
struct ptp_header *ptp_parse_header(struct sk_buff *skb, unsigned int type);
|
||||
|
||||
/**
|
||||
* ptp_get_msgtype - Extract ptp message type from given header
|
||||
* @hdr: ptp header
|
||||
* @type: type of the packet (see ptp_classify_raw())
|
||||
*
|
||||
* This function returns the message type for a given ptp header. It takes care
|
||||
* of the different ptp header versions (v1 or v2).
|
||||
*
|
||||
* Return: The message type
|
||||
*/
|
||||
static inline u8 ptp_get_msgtype(const struct ptp_header *hdr,
|
||||
unsigned int type)
|
||||
{
|
||||
u8 msgtype;
|
||||
|
||||
if (unlikely(type & PTP_CLASS_V1)) {
|
||||
/* msg type is located at the control field for ptp v1 */
|
||||
msgtype = hdr->control;
|
||||
} else {
|
||||
msgtype = hdr->tsmt & 0x0f;
|
||||
}
|
||||
|
||||
return msgtype;
|
||||
}
|
||||
|
||||
void __init ptp_classifier_init(void);
|
||||
#else
|
||||
static inline void ptp_classifier_init(void)
|
||||
|
|
@ -66,5 +129,18 @@ static inline unsigned int ptp_classify_raw(struct sk_buff *skb)
|
|||
{
|
||||
return PTP_CLASS_NONE;
|
||||
}
|
||||
static inline struct ptp_header *ptp_parse_header(struct sk_buff *skb,
|
||||
unsigned int type)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
static inline u8 ptp_get_msgtype(const struct ptp_header *hdr,
|
||||
unsigned int type)
|
||||
{
|
||||
/* The return is meaningless. The stub function would not be
|
||||
* executed since no available header from ptp_parse_header.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* _PTP_CLASSIFY_H_ */
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <linux/qed/common_hsi.h>
|
||||
#include <linux/qed/qed_chain.h>
|
||||
#include <linux/io-64-nonatomic-lo-hi.h>
|
||||
#include <net/devlink.h>
|
||||
|
||||
enum dcbx_protocol_type {
|
||||
DCBX_PROTOCOL_ISCSI,
|
||||
|
|
@ -780,6 +781,11 @@ enum qed_nvm_flash_cmd {
|
|||
QED_NVM_FLASH_CMD_NVM_MAX,
|
||||
};
|
||||
|
||||
struct qed_devlink {
|
||||
struct qed_dev *cdev;
|
||||
struct devlink_health_reporter *fw_reporter;
|
||||
};
|
||||
|
||||
struct qed_common_cb_ops {
|
||||
void (*arfs_filter_op)(void *dev, void *fltr, u8 fw_rc);
|
||||
void (*link_update)(void *dev, struct qed_link_output *link);
|
||||
|
|
@ -845,10 +851,9 @@ struct qed_common_ops {
|
|||
struct qed_dev* (*probe)(struct pci_dev *dev,
|
||||
struct qed_probe_params *params);
|
||||
|
||||
void (*remove)(struct qed_dev *cdev);
|
||||
void (*remove)(struct qed_dev *cdev);
|
||||
|
||||
int (*set_power_state)(struct qed_dev *cdev,
|
||||
pci_power_t state);
|
||||
int (*set_power_state)(struct qed_dev *cdev, pci_power_t state);
|
||||
|
||||
void (*set_name) (struct qed_dev *cdev, char name[]);
|
||||
|
||||
|
|
@ -856,50 +861,51 @@ struct qed_common_ops {
|
|||
* PF params required for the call before slowpath_start is
|
||||
* documented within the qed_pf_params structure definition.
|
||||
*/
|
||||
void (*update_pf_params)(struct qed_dev *cdev,
|
||||
struct qed_pf_params *params);
|
||||
int (*slowpath_start)(struct qed_dev *cdev,
|
||||
struct qed_slowpath_params *params);
|
||||
void (*update_pf_params)(struct qed_dev *cdev,
|
||||
struct qed_pf_params *params);
|
||||
|
||||
int (*slowpath_stop)(struct qed_dev *cdev);
|
||||
int (*slowpath_start)(struct qed_dev *cdev,
|
||||
struct qed_slowpath_params *params);
|
||||
|
||||
int (*slowpath_stop)(struct qed_dev *cdev);
|
||||
|
||||
/* Requests to use `cnt' interrupts for fastpath.
|
||||
* upon success, returns number of interrupts allocated for fastpath.
|
||||
*/
|
||||
int (*set_fp_int)(struct qed_dev *cdev,
|
||||
u16 cnt);
|
||||
int (*set_fp_int)(struct qed_dev *cdev, u16 cnt);
|
||||
|
||||
/* Fills `info' with pointers required for utilizing interrupts */
|
||||
int (*get_fp_int)(struct qed_dev *cdev,
|
||||
struct qed_int_info *info);
|
||||
int (*get_fp_int)(struct qed_dev *cdev, struct qed_int_info *info);
|
||||
|
||||
u32 (*sb_init)(struct qed_dev *cdev,
|
||||
struct qed_sb_info *sb_info,
|
||||
void *sb_virt_addr,
|
||||
dma_addr_t sb_phy_addr,
|
||||
u16 sb_id,
|
||||
enum qed_sb_type type);
|
||||
u32 (*sb_init)(struct qed_dev *cdev,
|
||||
struct qed_sb_info *sb_info,
|
||||
void *sb_virt_addr,
|
||||
dma_addr_t sb_phy_addr,
|
||||
u16 sb_id,
|
||||
enum qed_sb_type type);
|
||||
|
||||
u32 (*sb_release)(struct qed_dev *cdev,
|
||||
struct qed_sb_info *sb_info,
|
||||
u16 sb_id,
|
||||
enum qed_sb_type type);
|
||||
u32 (*sb_release)(struct qed_dev *cdev,
|
||||
struct qed_sb_info *sb_info,
|
||||
u16 sb_id,
|
||||
enum qed_sb_type type);
|
||||
|
||||
void (*simd_handler_config)(struct qed_dev *cdev,
|
||||
void *token,
|
||||
int index,
|
||||
void (*handler)(void *));
|
||||
void (*simd_handler_config)(struct qed_dev *cdev,
|
||||
void *token,
|
||||
int index,
|
||||
void (*handler)(void *));
|
||||
|
||||
void (*simd_handler_clean)(struct qed_dev *cdev,
|
||||
int index);
|
||||
int (*dbg_grc)(struct qed_dev *cdev,
|
||||
void *buffer, u32 *num_dumped_bytes);
|
||||
void (*simd_handler_clean)(struct qed_dev *cdev, int index);
|
||||
|
||||
int (*dbg_grc)(struct qed_dev *cdev, void *buffer, u32 *num_dumped_bytes);
|
||||
|
||||
int (*dbg_grc_size)(struct qed_dev *cdev);
|
||||
|
||||
int (*dbg_all_data) (struct qed_dev *cdev, void *buffer);
|
||||
int (*dbg_all_data)(struct qed_dev *cdev, void *buffer);
|
||||
|
||||
int (*dbg_all_data_size) (struct qed_dev *cdev);
|
||||
int (*dbg_all_data_size)(struct qed_dev *cdev);
|
||||
|
||||
int (*report_fatal_error)(struct devlink *devlink,
|
||||
enum qed_hw_err_type err_type);
|
||||
|
||||
/**
|
||||
* @brief can_link_change - can the instance change the link or not
|
||||
|
|
@ -1138,6 +1144,10 @@ struct qed_common_ops {
|
|||
*
|
||||
*/
|
||||
int (*set_grc_config)(struct qed_dev *cdev, u32 cfg_id, u32 val);
|
||||
|
||||
struct devlink* (*devlink_register)(struct qed_dev *cdev);
|
||||
|
||||
void (*devlink_unregister)(struct devlink *devlink);
|
||||
};
|
||||
|
||||
#define MASK_FIELD(_name, _value) \
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ static inline void rcu_read_lock_trace(void)
|
|||
struct task_struct *t = current;
|
||||
|
||||
WRITE_ONCE(t->trc_reader_nesting, READ_ONCE(t->trc_reader_nesting) + 1);
|
||||
barrier();
|
||||
if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB) &&
|
||||
t->trc_reader_special.b.need_mb)
|
||||
smp_mb(); // Pairs with update-side barriers
|
||||
|
|
@ -72,6 +73,9 @@ static inline void rcu_read_unlock_trace(void)
|
|||
|
||||
rcu_lock_release(&rcu_trace_lock_map);
|
||||
nesting = READ_ONCE(t->trc_reader_nesting) - 1;
|
||||
barrier(); // Critical section before disabling.
|
||||
// Disable IPI-based setting of .need_qs.
|
||||
WRITE_ONCE(t->trc_reader_nesting, INT_MIN);
|
||||
if (likely(!READ_ONCE(t->trc_reader_special.s)) || nesting) {
|
||||
WRITE_ONCE(t->trc_reader_nesting, nesting);
|
||||
return; // We assume shallow reader nesting.
|
||||
|
|
@ -82,7 +86,14 @@ static inline void rcu_read_unlock_trace(void)
|
|||
void call_rcu_tasks_trace(struct rcu_head *rhp, rcu_callback_t func);
|
||||
void synchronize_rcu_tasks_trace(void);
|
||||
void rcu_barrier_tasks_trace(void);
|
||||
|
||||
#else
|
||||
/*
|
||||
* The BPF JIT forms these addresses even when it doesn't call these
|
||||
* functions, so provide definitions that result in runtime errors.
|
||||
*/
|
||||
static inline void call_rcu_tasks_trace(struct rcu_head *rhp, rcu_callback_t func) { BUG(); }
|
||||
static inline void rcu_read_lock_trace(void) { BUG(); }
|
||||
static inline void rcu_read_unlock_trace(void) { BUG(); }
|
||||
#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
|
||||
|
||||
#endif /* __LINUX_RCUPDATE_TRACE_H */
|
||||
|
|
|
|||
|
|
@ -2548,6 +2548,11 @@ static inline int skb_mac_header_was_set(const struct sk_buff *skb)
|
|||
return skb->mac_header != (typeof(skb->mac_header))~0U;
|
||||
}
|
||||
|
||||
static inline void skb_unset_mac_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->mac_header = (typeof(skb->mac_header))~0U;
|
||||
}
|
||||
|
||||
static inline void skb_reset_mac_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->mac_header = skb->data - skb->head;
|
||||
|
|
@ -3568,6 +3573,9 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len);
|
|||
int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci);
|
||||
int skb_vlan_pop(struct sk_buff *skb);
|
||||
int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
|
||||
int skb_eth_pop(struct sk_buff *skb);
|
||||
int skb_eth_push(struct sk_buff *skb, const unsigned char *dst,
|
||||
const unsigned char *src);
|
||||
int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
|
||||
int mac_len, bool ethernet);
|
||||
int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len,
|
||||
|
|
|
|||
|
|
@ -308,6 +308,8 @@ struct sk_psock *sk_psock_init(struct sock *sk, int node);
|
|||
int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock);
|
||||
void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock);
|
||||
void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock);
|
||||
void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock);
|
||||
void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock);
|
||||
|
||||
int sk_psock_msg_verdict(struct sock *sk, struct sk_psock *psock,
|
||||
struct sk_msg *msg);
|
||||
|
|
@ -340,23 +342,6 @@ static inline void sk_psock_update_proto(struct sock *sk,
|
|||
struct sk_psock *psock,
|
||||
struct proto *ops)
|
||||
{
|
||||
/* Initialize saved callbacks and original proto only once, since this
|
||||
* function may be called multiple times for a psock, e.g. when
|
||||
* psock->progs.msg_parser is updated.
|
||||
*
|
||||
* Since we've not installed the new proto, psock is not yet in use and
|
||||
* we can initialize it without synchronization.
|
||||
*/
|
||||
if (!psock->sk_proto) {
|
||||
struct proto *orig = READ_ONCE(sk->sk_prot);
|
||||
|
||||
psock->saved_unhash = orig->unhash;
|
||||
psock->saved_close = orig->close;
|
||||
psock->saved_write_space = sk->sk_write_space;
|
||||
|
||||
psock->sk_proto = orig;
|
||||
}
|
||||
|
||||
/* Pairs with lockless read in sk_clone_lock() */
|
||||
WRITE_ONCE(sk->sk_prot, ops);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,19 @@ void sock_diag_unregister(const struct sock_diag_handler *h);
|
|||
void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
|
||||
void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
|
||||
|
||||
u64 sock_gen_cookie(struct sock *sk);
|
||||
u64 __sock_gen_cookie(struct sock *sk);
|
||||
|
||||
static inline u64 sock_gen_cookie(struct sock *sk)
|
||||
{
|
||||
u64 cookie;
|
||||
|
||||
preempt_disable();
|
||||
cookie = __sock_gen_cookie(sk);
|
||||
preempt_enable();
|
||||
|
||||
return cookie;
|
||||
}
|
||||
|
||||
int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie);
|
||||
void sock_diag_save_cookie(struct sock *sk, __u32 *cookie);
|
||||
|
||||
|
|
|
|||
|
|
@ -198,5 +198,8 @@ struct plat_stmmacenet_data {
|
|||
int mac_port_sel_speed;
|
||||
bool en_tx_lpi_clockgating;
|
||||
int has_xgmac;
|
||||
bool vlan_fail_q_en;
|
||||
u8 vlan_fail_q;
|
||||
unsigned int eee_usecs_rate;
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ struct tcp_options_received {
|
|||
smc_ok : 1, /* SMC seen on SYN packet */
|
||||
snd_wscale : 4, /* Window scaling received from sender */
|
||||
rcv_wscale : 4; /* Window scaling to send to receiver */
|
||||
u8 saw_unknown:1, /* Received unknown option */
|
||||
unused:7;
|
||||
u8 num_sacks; /* Number of SACK blocks */
|
||||
u16 user_mss; /* mss requested by user in ioctl */
|
||||
u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
|
||||
|
|
@ -132,6 +134,7 @@ struct tcp_request_sock {
|
|||
* FastOpen it's the seq#
|
||||
* after data-in-SYN.
|
||||
*/
|
||||
u8 syn_tos;
|
||||
};
|
||||
|
||||
static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
|
||||
|
|
@ -237,14 +240,13 @@ struct tcp_sock {
|
|||
repair : 1,
|
||||
frto : 1;/* F-RTO (RFC5682) activated in CA_Loss */
|
||||
u8 repair_queue;
|
||||
u8 syn_data:1, /* SYN includes data */
|
||||
u8 save_syn:2, /* Save headers of SYN packet */
|
||||
syn_data:1, /* SYN includes data */
|
||||
syn_fastopen:1, /* SYN includes Fast Open option */
|
||||
syn_fastopen_exp:1,/* SYN includes Fast Open exp. option */
|
||||
syn_fastopen_ch:1, /* Active TFO re-enabling probe */
|
||||
syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
|
||||
save_syn:1, /* Save headers of SYN packet */
|
||||
is_cwnd_limited:1,/* forward progress limited by snd_cwnd? */
|
||||
syn_smc:1; /* SYN includes SMC */
|
||||
is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
|
||||
u32 tlp_high_seq; /* snd_nxt at the time of TLP */
|
||||
|
||||
u32 tcp_tx_delay; /* delay (in usec) added to TX packets */
|
||||
|
|
@ -391,6 +393,9 @@ struct tcp_sock {
|
|||
#if IS_ENABLED(CONFIG_MPTCP)
|
||||
bool is_mptcp;
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_SMC)
|
||||
bool syn_smc; /* SYN includes SMC */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TCP_MD5SIG
|
||||
/* TCP AF-Specific parts; only used by MD5 Signature support so far */
|
||||
|
|
@ -406,7 +411,7 @@ struct tcp_sock {
|
|||
* socket. Used to retransmit SYNACKs etc.
|
||||
*/
|
||||
struct request_sock __rcu *fastopen_rsk;
|
||||
u32 *saved_syn;
|
||||
struct saved_syn *saved_syn;
|
||||
};
|
||||
|
||||
enum tsq_enum {
|
||||
|
|
@ -484,6 +489,12 @@ static inline void tcp_saved_syn_free(struct tcp_sock *tp)
|
|||
tp->saved_syn = NULL;
|
||||
}
|
||||
|
||||
static inline u32 tcp_saved_syn_len(const struct saved_syn *saved_syn)
|
||||
{
|
||||
return saved_syn->mac_hdrlen + saved_syn->network_hdrlen +
|
||||
saved_syn->tcp_hdrlen;
|
||||
}
|
||||
|
||||
struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk,
|
||||
const struct sk_buff *orig_skb);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue