--- zzzz-none-000/linux-4.4.271/include/linux/netdevice.h 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/include/linux/netdevice.h 2023-04-19 10:22:30.000000000 +0000 @@ -52,6 +52,16 @@ #include #include + +/* 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 phy_device; @@ -133,7 +143,7 @@ */ #if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) -# if defined(CONFIG_MAC80211_MESH) +# if 1 || defined(CONFIG_MAC80211_MESH) # define LL_MAX_HEADER 128 # else # define LL_MAX_HEADER 96 @@ -180,7 +190,6 @@ unsigned long tx_compressed; }; - #include #include @@ -281,7 +290,6 @@ __LINK_STATE_DORMANT, }; - /* * This structure holds at boot time configured netdevice settings. They * are then used in the device probing. @@ -777,6 +785,17 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev, struct sk_buff *skb); +#ifdef CONFIG_RFS_ACCEL +typedef int (*set_rfs_filter_callback_t)(struct net_device *dev, + __be32 src, + __be32 dst, + __be16 sport, + __be16 dport, + u8 proto, + u16 rxq_index, + u32 action); +#endif + /* * This structure defines the management hooks for network devices. * The following hooks can be defined; unless noted otherwise, they are @@ -948,6 +967,15 @@ * Set hardware filter for RFS. rxq_index is the target queue index; * flow_id is a flow ID to be passed to rps_may_expire_flow() later. * Return the filter ID on success, or a negative error code. + * int (*ndo_register_rfs_filter(struct net_device *dev, + * set_rfs_filter_callback_t set_filter); + * Register callback to handle commands for low layer RFS filter engine. + * Return 0 on success, or a negative error code. + * + * Get Default VLAN tag + * int (*ndo_get_default_vlan_tag)(struct net_device *net); + * This api can be called by other modules to get + * the default vlan tag * * Slave management functions (for bridge, bonding, etc). * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev); @@ -1163,6 +1191,9 @@ const struct sk_buff *skb, u16 rxq_index, u32 flow_id); + int (*ndo_register_rfs_filter)(struct net_device *dev, + set_rfs_filter_callback_t set_filter); + int (*ndo_get_default_vlan_tag)(struct net_device *net); #endif int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev); @@ -1297,6 +1328,24 @@ IFF_NO_QUEUE = 1<<21, IFF_OPENVSWITCH = 1<<22, IFF_L3MDEV_SLAVE = 1<<23, + IFF_NO_IP_ALIGN = 1<<24, +}; + +/** + * enum netdev_priv_flags_ext - &struct net_device priv_flags_ext + * + * These flags are used to check for device type and can be + * set and used by the drivers + * + */ +enum netdev_priv_flags_ext { + IFF_EXT_TUN_TAP = 1<<0, + IFF_EXT_PPP_L2TPV2 = 1<<1, + IFF_EXT_PPP_L2TPV3 = 1<<2, + IFF_EXT_PPP_PPTP = 1<<3, + IFF_EXT_GRE_V4_TAP = 1<<4, + IFF_EXT_GRE_V6_TAP = 1<<5, + IFF_EXT_IFB = 1<<6, }; #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN @@ -1323,6 +1372,7 @@ #define IFF_NO_QUEUE IFF_NO_QUEUE #define IFF_OPENVSWITCH IFF_OPENVSWITCH #define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE +#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN /** * struct net_device - The DEVICE structure. @@ -1390,6 +1440,8 @@ * @flags: Interface flags (a la BSD) * @priv_flags: Like 'flags' but invisible to userspace, * see if.h for the definitions + * @prirv_flags_ext: Extension for 'priv_flags' + * * @gflags: Global flags ( kept as legacy ) * @padded: How much padding added by alloc_netdev() * @operstate: RFC2863 operstate @@ -1603,10 +1655,16 @@ const struct l3mdev_ops *l3mdev_ops; #endif +#ifdef CONFIG_ETHERNET_PACKET_MANGLE + void (*eth_mangle_rx)(struct net_device *dev, struct sk_buff *skb); + struct sk_buff *(*eth_mangle_tx)(struct net_device *dev, struct sk_buff *skb); +#endif + const struct header_ops *header_ops; unsigned int flags; unsigned int priv_flags; + unsigned int priv_flags_ext; unsigned short gflags; unsigned short padded; @@ -1644,13 +1702,14 @@ struct netdev_hw_addr_list mc; struct netdev_hw_addr_list dev_addrs; + unsigned char local_addr_mask[MAX_ADDR_LEN]; + #ifdef CONFIG_SYSFS struct kset *queues_kset; #endif unsigned int promiscuity; unsigned int allmulti; - /* Protocol specific pointers */ #if IS_ENABLED(CONFIG_VLAN_8021Q) @@ -1673,6 +1732,10 @@ struct mpls_dev __rcu *mpls_ptr; #endif +#ifdef CONFIG_ETHERNET_PACKET_MANGLE + void *phy_ptr; /* PHY device specific data */ +#endif + /* * Cache lines mostly used on receive path (including eth_type_trans()) */ @@ -1681,7 +1744,6 @@ /* Interface address info used in eth_type_trans() */ unsigned char *dev_addr; - #ifdef CONFIG_SYSFS struct netdev_rx_queue *_rx; @@ -1774,6 +1836,12 @@ struct pcpu_vstats __percpu *vstats; }; +#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 struct garp_port __rcu *garp_port; struct mrp_port __rcu *mrp_port; @@ -2056,6 +2124,7 @@ bool (*id_match)(struct packet_type *ptype, struct sock *sk); void *af_packet_priv; + struct list_head list; }; @@ -2168,6 +2237,8 @@ #define NETDEV_CHANGEINFODATA 0x0018 #define NETDEV_BONDING_INFO 0x0019 #define NETDEV_PRECHANGEUPPER 0x001A +#define NETDEV_BR_JOIN 0x001B +#define NETDEV_BR_LEAVE 0x001C int register_netdevice_notifier(struct notifier_block *nb); int unregister_netdevice_notifier(struct notifier_block *nb); @@ -2209,7 +2280,6 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev); - extern rwlock_t dev_base_lock; /* Device list lock */ #define for_each_netdev(net, d) \ @@ -2597,6 +2667,7 @@ */ struct softnet_data { struct list_head poll_list; + struct napi_struct *current_napi; struct sk_buff_head process_queue; /* stats */ @@ -3091,6 +3162,7 @@ gro_result_t napi_gro_frags(struct napi_struct *napi); struct packet_offload *gro_find_receive_by_type(__be16 type); struct packet_offload *gro_find_complete_by_type(__be16 type); +extern struct napi_struct *get_current_napi_context(void); static inline void napi_free_frags(struct napi_struct *napi) { @@ -3131,6 +3203,9 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb); +void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); +#define AVM_DEV_QUEUE_XMIT_NIT_EXPORT + extern int netdev_budget; /* Called by rtnetlink.c:rtnl_unlock() */ @@ -3179,7 +3254,7 @@ */ static inline bool netif_carrier_ok(const struct net_device *dev) { - return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); + return !test_bit(__LINK_STATE_NOCARRIER, &dev->state) || !strcmp(dev->name, "plc"); } unsigned long dev_trans_start(struct net_device *dev); @@ -3232,7 +3307,6 @@ return test_bit(__LINK_STATE_DORMANT, &dev->state); } - /** * netif_oper_up - test if device is operational * @dev: network device @@ -3534,6 +3608,15 @@ void dev_uc_init(struct net_device *dev); /** + * ifb_update_offload_stats - Update the IFB interface stats + * @dev: IFB device to update the stats + * @offload_stats: per CPU stats structure + * + * Allows update of IFB stats when flows are offloaded to an accelerator. + **/ +void ifb_update_offload_stats(struct net_device *dev, struct pcpu_sw_netstats *offload_stats); + +/** * __dev_uc_sync - Synchonize device's unicast list * @dev: device to sync * @sync: function to call if address should be added @@ -3953,6 +4036,11 @@ return dev->priv_flags & IFF_OPENVSWITCH; } +static inline bool netif_is_ifb_dev(const struct net_device *dev) +{ + return dev->priv_flags_ext & IFF_EXT_IFB; +} + /* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */ static inline void netif_keep_dst(struct net_device *dev) {