--- zzzz-none-000/linux-4.1.52/include/linux/netdevice.h 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/include/linux/netdevice.h 2022-03-02 11:37:13.000000000 +0000 @@ -48,6 +48,10 @@ #include #include +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) +#include +#include +#endif #include #include #include @@ -178,6 +182,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 +605,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 +615,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 +1067,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 +1231,34 @@ 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 RX hardware port number associated to the + interface */ + unsigned int hw_port; + /* indicates the TX hardware port number associated to the + interface */ + unsigned int hw_tx_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 +1320,28 @@ IFF_XMIT_DST_RELEASE_PERM = 1<<22, IFF_IPVLAN_MASTER = 1<<23, IFF_IPVLAN_SLAVE = 1<<24, +#if defined(CONFIG_BCM_KF_WL) + IFF_BCM_WLANDEV = 1<<25, /* Broadcom WLAN Interface */ +#endif +#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_RUNNER) + IFF_RNR =1<<29, /* Interface operated by Runner. */ +#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 +1626,36 @@ struct net_device_stats stats; +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + BlogStats_t blog_stats; /* Cummulative stats of accelerated flows */ + unsigned int blog_stats_flags; /* Blog stats collection property for the device */ + +#define BLOG_DEV_STAT_FLAG_INCLUDE_SW_UC (1<<0) /* Include SW accelerated Unicast stats */ +#define BLOG_DEV_STAT_FLAG_INCLUDE_HW_UC (1<<1) /* Include HW accelerated Unicast stats */ +#define BLOG_DEV_STAT_FLAG_INCLUDE_SW_MC (1<<2) /* Include SW accelerated Multicast stats */ +#define BLOG_DEV_STAT_FLAG_INCLUDE_HW_MC (1<<3) /* Include HW accelerated Multicast stats */ +#define BLOG_DEV_STAT_FLAG_INCLUDE_SW (BLOG_DEV_STAT_FLAG_INCLUDE_SW_UC|BLOG_DEV_STAT_FLAG_INCLUDE_SW_MC) +#define BLOG_DEV_STAT_FLAG_INCLUDE_HW (BLOG_DEV_STAT_FLAG_INCLUDE_HW_UC|BLOG_DEV_STAT_FLAG_INCLUDE_HW_MC) +#define BLOG_DEV_STAT_FLAG_INCLUDE_ALL (BLOG_DEV_STAT_FLAG_INCLUDE_SW|BLOG_DEV_STAT_FLAG_INCLUDE_HW) + + /* Clear the stats information */ + void (*clr_stats)(struct net_device *dev_p); /* This should not be tied to BLOG anymore ?*/ + + /* CAUTION : put_stats and get_stats_pointer MUST only be used by WLAN */ + /* 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); + + /* 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; @@ -1752,6 +1853,9 @@ #endif struct phy_device *phydev; struct lock_class_key *qdisc_tx_busylock; +#ifdef CONFIG_BCM_KF_MCAST + int bcm_mcastrouter; +#endif }; #define to_net_dev(d) container_of(d, struct net_device, dev) @@ -1841,18 +1945,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 +2402,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 +2466,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 +2618,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 +2827,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 +3012,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 +3041,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 +3055,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 +3326,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; @@ -3830,6 +3959,66 @@ 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_tx_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_set_hw_tx_port_only(_dev, _hw_port) \ + do { \ + (_dev)->path.hw_tx_port = (_hw_port); \ + } while(0) + +#define netdev_path_get_hw_port(_dev) ( (_dev)->path.hw_port ) +#define netdev_path_get_hw_tx_port(_dev) ( (_dev)->path.hw_tx_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); + +struct net_device *bcm_netdev_master_upper_dev_get_nolock(struct net_device *dev); +#endif /* CONFIG_BCM_KF_NETDEV_PATH */ + + + /* Logging, debugging and troubleshooting/diagnostic helpers. */ /* netdev_printk helpers, similar to dev_printk */