--- zzzz-none-000/linux-4.1.38/include/linux/netdevice.h 2017-01-18 18:48:06.000000000 +0000 +++ bcm63-7582-715/linux-4.1.38/include/linux/netdevice.h 2020-11-25 10:06:48.000000000 +0000 @@ -48,10 +48,21 @@ #include #include +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) +#include +#include +#endif #include #include #include +#if defined(CONFIG_BCM_KF_MODULE_OWNER) +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) +#define SET_MODULE_OWNER(dev) do { } while (0) +#endif +#endif /* CONFIG_BCM_KF_MODULE_OWNER */ + struct netpoll_info; struct device; struct phy_device; @@ -178,6 +189,16 @@ unsigned long tx_window_errors; unsigned long rx_compressed; unsigned long tx_compressed; +#if defined(CONFIG_BCM_KF_EXTSTATS) + unsigned long tx_multicast_packets; /* multicast packets transmitted */ + unsigned long rx_multicast_bytes; /* multicast bytes recieved */ + unsigned long tx_multicast_bytes; /* multicast bytes transmitted */ + unsigned long rx_broadcast_packets; /* broadcast packets recieved */ + unsigned long tx_broadcast_packets; /* broadcast packets transmitted */ + /* NOTE: Unicast packets are not counted but are instead calculated as needed + using total - (broadcast + multicast) */ + unsigned long rx_unknown_packets; /* unknown protocol packets recieved */ +#endif }; @@ -591,7 +612,8 @@ unsigned long tx_maxrate; } ____cacheline_aligned_in_smp; -static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) +static inline int netdev_queue_numa_node_read( + const struct netdev_queue *q __maybe_unused) { #if defined(CONFIG_XPS) && defined(CONFIG_NUMA) return q->numa_node; @@ -600,7 +622,9 @@ #endif } -static inline void netdev_queue_numa_node_write(struct netdev_queue *q, int node) +static inline void netdev_queue_numa_node_write( + struct netdev_queue *q __maybe_unused, + int node __maybe_unused) { #if defined(CONFIG_XPS) && defined(CONFIG_NUMA) q->numa_node = node; @@ -1050,6 +1074,10 @@ int (*ndo_stop)(struct net_device *dev); netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb, struct net_device *dev); +#if defined(CONFIG_BCM_KF_DPI) && defined(CONFIG_BCM_DPI_QOS_CPU) + int (*ndo_dpi_enqueue)(struct sk_buff *skb, + struct net_device *dev); +#endif u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, void *accel_priv, @@ -1210,6 +1238,31 @@ int (*ndo_get_iflink)(const struct net_device *dev); }; +#if defined(CONFIG_BCM_KF_NETDEV_PATH) +#define NETDEV_PATH_HW_SUBPORTS_MAX CONFIG_BCM_MAX_GEM_PORTS +struct netdev_path +{ + /* this pointer is used to create lists of interfaces that belong + to the same interface path in Linux. It points to the next + interface towards the physical interface (the root interface) */ + struct net_device *next_dev; + /* this reference counter indicates the number of interfaces + referencing this interface */ + int refcount; + /* indicates the hardware port number associated to the + interface */ + unsigned int hw_port; + /* hardware port type, must be set to one of the types defined in + BlogPhy_t */ + unsigned int hw_port_type; + /* some device drivers support virtual subports within a hardware + port. hw_subport_mcast is used to map a multicast hw subport + to a hw port. */ + unsigned int hw_subport_mcast_idx; +}; +#endif + + /** * enum net_device_priv_flags - &struct net_device priv_flags * @@ -1271,6 +1324,25 @@ IFF_XMIT_DST_RELEASE_PERM = 1<<22, IFF_IPVLAN_MASTER = 1<<23, IFF_IPVLAN_SLAVE = 1<<24, +#if defined(CONFIG_BCM_KF_WANDEV) + IFF_WANDEV = 1<<26, /* avoid WAN bridge traffic leaking */ +#endif +#if defined(CONFIG_BCM_KF_VLAN) + IFF_BCM_VLAN = 1<<27, /* Broadcom VLAN Interface */ +#endif +#if defined(CONFIG_BCM_KF_PPP) + IFF_PPP =1<<28, /* PPP Interface */ +#endif +#if defined(CONFIG_BCM_KF_IP) + IFF_EPON_IF =1<<29, /* Indicates SFU hardware switching. */ +#endif +#if defined(CONFIG_BCM_KF_ENET_SWITCH) + IFF_HW_SWITCH =1<<30, + IFF_EXT_SWITCH =1<<31, /* Indicates the interface is an external switch interface */ + +#endif /* CONFIG_BCM_KF_ENET_SWITCH */ + + }; #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN @@ -1555,6 +1627,22 @@ struct net_device_stats stats; +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + /* Update the bstats */ + void (*put_stats)(struct net_device *dev_p, BlogStats_t * bStats_p); + /* Get stats pointer by type */ + void* (*get_stats_pointer)(struct net_device *dev_p, char type); + /* Clear the stats information */ + void (*clr_stats)(struct net_device *dev_p); + /* runner multicast acceleration hook,to be enclosed in different MACRO??? */ + wlan_client_get_info_t wlan_client_get_info; +#endif + + +#if defined(CONFIG_BCM_KF_NETDEV_PATH) + struct netdev_path path; +#endif + atomic_long_t rx_dropped; atomic_long_t tx_dropped; @@ -1841,18 +1929,19 @@ * Net namespace inlines */ static inline -struct net *dev_net(const struct net_device *dev) +struct net *dev_net(const struct net_device *dev __maybe_unused) { return read_pnet(&dev->nd_net); } static inline -void dev_net_set(struct net_device *dev, struct net *net) +void dev_net_set(struct net_device *dev __maybe_unused, + struct net *net __maybe_unused) { write_pnet(&dev->nd_net, net); } -static inline bool netdev_uses_dsa(struct net_device *dev) +static inline bool netdev_uses_dsa(struct net_device *dev __maybe_unused) { #if IS_ENABLED(CONFIG_NET_DSA) if (dev->dsa_ptr != NULL) @@ -2297,7 +2386,7 @@ __sum16 check) { return ((skb->ip_summed != CHECKSUM_PARTIAL || - skb_checksum_start_offset(skb) < + (unsigned int)skb_checksum_start_offset(skb) < skb_gro_offset(skb)) && !skb_at_gro_remcsum_start(skb) && NAPI_GRO_CB(skb)->csum_cnt == 0 && @@ -2361,7 +2450,7 @@ } static inline void __skb_gro_checksum_convert(struct sk_buff *skb, - __sum16 check, __wsum pseudo) + __sum16 check __maybe_unused, __wsum pseudo) { NAPI_GRO_CB(skb)->csum = ~pseudo; NAPI_GRO_CB(skb)->csum_valid = 1; @@ -2513,15 +2602,15 @@ }; -static inline void input_queue_head_incr(struct softnet_data *sd) +static inline void input_queue_head_incr(struct softnet_data *sd __attribute__((unused))) { #ifdef CONFIG_RPS sd->input_queue_head++; #endif } -static inline void input_queue_tail_incr_save(struct softnet_data *sd, - unsigned int *qtail) +static inline void input_queue_tail_incr_save(struct softnet_data *sd __attribute__((unused)), + unsigned int *qtail __attribute__((unused))) { #ifdef CONFIG_RPS *qtail = ++sd->input_queue_tail; @@ -2722,7 +2811,7 @@ } static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, - unsigned int pkts, unsigned int bytes) + unsigned int pkts __maybe_unused, unsigned int bytes __maybe_unused) { #ifdef CONFIG_BQL if (unlikely(!bytes)) @@ -2907,13 +2996,28 @@ #ifdef CONFIG_SYSFS int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq); #else -static inline int netif_set_real_num_rx_queues(struct net_device *dev, - unsigned int rxq) +static inline int netif_set_real_num_rx_queues(struct net_device *dev __attribute__((unused)), + unsigned int rxq __attribute__((unused))) { return 0; } #endif +#if (defined(CONFIG_BCM_KF_FAP_GSO_LOOPBACK) && defined(CONFIG_BCM_FAP_GSO_LOOPBACK)) +typedef enum { +BCM_GSO_LOOPBACK_NONE=0, /*null device for error protection*/ +BCM_GSO_LOOPBACK_WL0, /* wlan interface 0 */ +BCM_GSO_LOOPBACK_WL1, /* wlan interface 1 */ +BCM_GSO_LOOPBACK_WL2, /* wlan interface 2 */ +BCM_GSO_LOOPBACK_MAXDEVS +} gso_loopback_devids; + +extern int (*bcm_gso_loopback_hw_offload)(struct sk_buff *skb, unsigned int txDevId); +extern inline unsigned int bcm_is_gso_loopback_dev(void *dev); +extern unsigned int bcm_gso_loopback_devptr2devid(void *dev); +extern struct net_device * bcm_gso_loopback_devid2devptr(unsigned int devId); +#endif + #ifdef CONFIG_SYSFS static inline unsigned int get_netdev_rx_queue_index( struct netdev_rx_queue *queue) @@ -2921,7 +3025,7 @@ struct net_device *dev = queue->dev; int index = queue - dev->_rx; - BUG_ON(index >= dev->num_rx_queues); + BUG_ON((unsigned int)index >= dev->num_rx_queues); return index; } #endif @@ -2935,6 +3039,15 @@ }; void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason); + +#if defined(CONFIG_BCM_KF_SKB_DEFINES) && defined(CONFIG_SMP) +/* put the skb on a queue, and wake up the skbfreeTask to free it later, + * to save some cyles now + */ +extern void dev_kfree_skb_thread(struct sk_buff *skb); +#endif + + void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason); /* @@ -3197,7 +3310,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) { /* use default */ - if (debug_value < 0 || debug_value >= (sizeof(u32) * 8)) + if (debug_value < 0 || debug_value >= (int)(sizeof(u32) * 8)) return default_msg_enable_bits; if (debug_value == 0) /* no output */ return 0; @@ -3729,6 +3842,10 @@ netdev_features_t features); netdev_features_t netif_skb_features(struct sk_buff *skb); +#if defined(CONFIG_BCM_KF_SPDSVC) && (defined(CONFIG_BCM_SPDSVC) || defined(CONFIG_BCM_SPDSVC_MODULE)) +int skb_bypass_hw_features(struct sk_buff *skb); +#endif + static inline bool net_gso_ok(netdev_features_t features, int gso_type) { netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; @@ -3827,6 +3944,58 @@ extern struct pernet_operations __net_initdata loopback_net_ops; +#if defined(CONFIG_BCM_KF_NETDEV_PATH) + +/* Returns TRUE when _dev is a member of a path, otherwise FALSE */ +#define netdev_path_is_linked(_dev) ( (_dev)->path.next_dev != NULL ) + +/* Returns TRUE when _dev is the leaf in a path, otherwise FALSE */ +#define netdev_path_is_leaf(_dev) ( (_dev)->path.refcount == 0 ) + +/* Returns TRUE when _dev is the root of a path, otherwise FALSE. The root + device is the physical device */ +#define netdev_path_is_root(_dev) ( (_dev)->path.next_dev == NULL ) + +/* Returns a pointer to the next device in a path, towards the root + (physical) device */ +#define netdev_path_next_dev(_dev) ( (_dev)->path.next_dev ) + +#define netdev_path_set_hw_port(_dev, _hw_port, _hw_port_type) \ + do { \ + (_dev)->path.hw_port = (_hw_port); \ + (_dev)->path.hw_port_type = (_hw_port_type); \ + } while(0) + +#define netdev_path_set_hw_port_only(_dev, _hw_port) \ + do { \ + (_dev)->path.hw_port = (_hw_port); \ + } while(0) + +#define netdev_path_get_hw_port(_dev) ( (_dev)->path.hw_port ) + +#define netdev_path_get_hw_port_type(_dev) ( (_dev)->path.hw_port_type ) + +#define netdev_path_get_hw_subport_mcast_idx(_dev) ( (_dev)->path.hw_subport_mcast_idx ) + +static inline struct net_device *netdev_path_get_root(struct net_device *dev) +{ + for (; !netdev_path_is_root(dev); dev = netdev_path_next_dev(dev)); + return dev; +} + +int netdev_path_add(struct net_device *new_dev, struct net_device *next_dev); + +int netdev_path_remove(struct net_device *dev); + +void netdev_path_dump(struct net_device *dev); + +int netdev_path_set_hw_subport_mcast_idx(struct net_device *dev, + unsigned int subport_idx); + +#endif /* CONFIG_BCM_KF_NETDEV_PATH */ + + + /* Logging, debugging and troubleshooting/diagnostic helpers. */ /* netdev_printk helpers, similar to dev_printk */ @@ -3969,6 +4138,10 @@ }) #endif +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) +extern struct net_device_stats * net_dev_collect_stats(struct net_device *net_p); +extern void net_dev_clear_stats(struct net_device * dev_p); +#endif /* * The list of packet types we will receive (as opposed to discard) * and the routines to invoke.