--- zzzz-none-000/linux-5.15.111/include/linux/netdevice.h 2023-05-11 14:00:40.000000000 +0000 +++ puma7-atom-6670-761/linux-5.15.111/include/linux/netdevice.h 2024-02-07 10:23:27.000000000 +0000 @@ -18,9 +18,20 @@ * * Moved to /usr/include/linux for NET3 */ + /* + * Includes Maxlinear's changes dated: 2021, 2022, 2023. + * Changed portions - Copyright 2021-2023 MaxLinear, Inc. + * Includes Intel Corporation's changes dated: 2014, 2018. + * Changed portions - Copyright 2014-2018, Intel Corporation. + */ + #ifndef _LINUX_NETDEVICE_H #define _LINUX_NETDEVICE_H +#ifndef CONFIG_ARM_AVALANCHE_SOC +#include +#endif + #include #include #include @@ -31,6 +42,14 @@ #include #include +#ifdef CONFIG_TI_PACKET_PROCESSOR +#ifndef CONFIG_ARM_AVALANCHE_SOC +#include +#else +#include +#include +#endif +#endif /* CONFIG_TI_PACKET_PROCESSOR */ #include #include @@ -49,6 +68,19 @@ #include #include +#ifdef CONFIG_OPENVSWITCH_BRCOMPAT +extern struct rw_semaphore dev_addr_sem; +#endif + +/* Do not include avm_pa.h to avoid include cycle. Since we can't determine + * the size here we reserve some space, including some extra space for future + * extensions without having to rebuild the world. + * + * avm_pa contains a BUILD_BUG_ON() in case the reserve is too small. + */ +#define AVM_PA_DEV_INFO_DEV_RESERVE 32 +struct avm_pa_dev_info; + struct netpoll_info; struct device; struct ethtool_ops; @@ -162,6 +194,15 @@ #define MAX_HEADER (LL_MAX_HEADER + 48) #endif +#ifdef CONFIG_TI_DEVICE_INDEX_REUSE +/* Maximum number of net devices supported. TI L2 Selective forwarder uses + * 64 bits to mark the packet to indicate the device on which the packets should + * be forwarded. Hence Max Device Index is limited to 64. + * Do not increment the number. + */ +#define TI_MAX_DEVICE_INDEX 256 +#endif /* CONFIG_TI_DEVICE_INDEX_REUSE */ + /* * Old network device statistics. Fields are native words * (unsigned long) so they can be read and written atomically. @@ -1710,6 +1751,10 @@ ML_PRIV_CAN, }; +#ifdef CONFIG_INTEL_NS_DEVICE_FILTER +int intel_ns_handler (struct net_device *dev, const struct in6_addr* dst_addr, unsigned char banned_flags); +#endif + /** * struct net_device - The DEVICE structure. * @@ -2238,6 +2283,12 @@ struct pcpu_dstats __percpu *dstats; }; +#ifdef CONFIG_AVM_PA + u8 avm_pa[AVM_PA_DEV_INFO_DEV_RESERVE]; +#define AVM_PA_DEVINFO(dev) ((struct avm_pa_dev_info *) (dev)->avm_pa) +#else +#define AVM_PA_DEVINFO(dev) ((struct avm_pa_dev_info *) NULL) +#endif #if IS_ENABLED(CONFIG_GARP) struct garp_port __rcu *garp_port; #endif @@ -2270,6 +2321,88 @@ #if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) struct netprio_map __rcu *priomap; #endif +#ifdef CONFIG_TI_DEVICE_PROTOCOL_HANDLING + int (*packet_handler)(struct sk_buff *skb); +#endif + +#ifdef CONFIG_INTEL_NS_DEVICE_FILTER + int (*ns_handler)(struct net_device *dev, const struct in6_addr* dst_addr, unsigned char banned_flags); +#endif + +#ifdef CONFIG_TI_EGRESS_HOOK + int (*egress_hook)(struct sk_buff *skb); +#endif + +#ifdef CONFIG_TI_DOCSIS_EGRESS_HOOK + int (*docsis_egress_hook)(struct sk_buff *skb); +#endif + +#ifdef CONFIG_TI_GW_EGRESS_HOOK + int (*gw_egress_hook)(struct sk_buff *skb); +#endif + +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* PPM Device Information. Each networking device can be considered as a VPID + * instance executing on a PID. The PID is created when the hardware associated + * with the device has been initialized; the VPID Information is initialized and + * every subsequent call to bring the interface UP and DOWN results in VPID + * creation and deletion. Virtual networking interfaces do not have a matching + * VPID. So if the PID handle is -1 then there is no VPID manipulation done on the + * device. */ + int pid_handle; + int vpid_handle; + + /* netdev_ops->ndo_get_stats / netdev_ops->ndo_get_stats64 returns + the statistics of the traffic at the slow path. + The function below adds the statistics of the fast path traffic*/ + void (*add_offload_stats)(struct net_device *dev, + struct rtnl_link_stats64 *storage); + + /* The VPID Information block which is associated with the networking device. + * This field is kept in the networking device because it gives us a convenient + * place to store all the VPID specific information. As mentioned above not all + * networking devices are a networking endpoint. In such cases the values in this + * structure are ignored. */ +#ifdef CONFIG_MACH_PUMA5 + TI_PP_VPID vpid_block; +#else + AVALANCHE_PP_VPID_INFO_t vpid_block; +#endif + +#if PUMA7_OR_NEWER_SOC_TYPE + int (*netdev_copy_priv_hook)(struct net_device *newDev, struct net_device *origDev); + + /* For GMAC it will be set with NULL. for VLAN netdev we will set the original netdev pointer */ + struct net_device *parentDev; + + /* Hook for letting the net device set its own PSI during session creation */ + int (*netdev_set_psi_hook)(Uint32 *psi, struct sk_buff *skb, struct net_device *dev); +#endif + + /* There QoS may be defined either for physical or virtual device + The QoS setting hooks are being triggered by PID creation. + In case there is a need in alternative QoS scheme to be created it can be + specified by setting the qos_virtual_scheme_idx to a valid non default index + This alternative scheme creation is being triggered from VPID creation. + It has to be defined by the appropriate device drived */ +#define NETDEV_PP_QOS_PROFILE_DEFAULT (-1) + int qos_virtual_scheme_idx; + + int (*qos_setup_hook) (struct net_device *dev_p); + int (*qos_shutdown_hook)(struct net_device *dev_p); + int (*qos_select_hook) (struct sk_buff *skb); + void (*qos_get_params_hook) (struct net_device *dev, Uint16 *egressQ, Uint32 *rate, Uint32 *shaper); + int devInstance; +#else /* If not defined CONFIG_TI_PACKET_PROCESSOR */ +#ifdef CONFIG_PUMA_LITEPATH + /* pid handle for network device */ + unsigned int pid_handle; + + /* virtual pid handle for network device */ + unsigned int vpid_handle; +#endif /* CONFIG_PUMA_LITEPATH */ +#endif /* CONFIG_TI_PACKET_PROCESSOR */ + struct phy_device *phydev; struct sfp_bus *sfp_bus; struct lock_class_key *qdisc_tx_busylock; @@ -4051,6 +4184,11 @@ void netdev_rx_handler_unregister(struct net_device *dev); bool dev_valid_name(const char *name); +#ifdef CONFIG_OPENVSWITCH_BRCOMPAT +int dev_get_valid_name(struct net *net, struct net_device *dev, + const char *name); +#endif + static inline bool is_socket_ioctl_cmd(unsigned int cmd) { return _IOC_TYPE(cmd) == SOCK_IOC_TYPE; @@ -5202,6 +5340,11 @@ return dev->priv_flags & IFF_EBRIDGE; } +static inline bool netif_is_bridge_ovs(const struct net_device *dev) +{ + return dev->priv_flags & IFF_OPENVSWITCH; +} + static inline bool netif_is_bridge_port(const struct net_device *dev) { return dev->priv_flags & IFF_BRIDGE_PORT; @@ -5459,6 +5602,12 @@ }) #endif + +#ifdef CONFIG_TI_DEVICE_PROTOCOL_HANDLING +extern int ti_register_protocol_handler (struct net_device* dev, int (*packet_handler)(struct sk_buff *skb)); +extern int ti_deregister_protocol_handler (struct net_device* dev); +#endif /* CONFIG_TI_DEVICE_PROTOCOL_HANDLING */ + /* * The list of packet types we will receive (as opposed to discard) * and the routines to invoke.