diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 80 |
1 files changed, 53 insertions, 27 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 6151e903eef0..a94a5a0ab122 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -144,8 +144,6 @@ static inline bool dev_xmit_complete(int rc) | |||
| 144 | # else | 144 | # else |
| 145 | # define LL_MAX_HEADER 96 | 145 | # define LL_MAX_HEADER 96 |
| 146 | # endif | 146 | # endif |
| 147 | #elif IS_ENABLED(CONFIG_TR) | ||
| 148 | # define LL_MAX_HEADER 48 | ||
| 149 | #else | 147 | #else |
| 150 | # define LL_MAX_HEADER 32 | 148 | # define LL_MAX_HEADER 32 |
| 151 | #endif | 149 | #endif |
| @@ -211,6 +209,7 @@ struct netdev_hw_addr { | |||
| 211 | #define NETDEV_HW_ADDR_T_UNICAST 4 | 209 | #define NETDEV_HW_ADDR_T_UNICAST 4 |
| 212 | #define NETDEV_HW_ADDR_T_MULTICAST 5 | 210 | #define NETDEV_HW_ADDR_T_MULTICAST 5 |
| 213 | bool global_use; | 211 | bool global_use; |
| 212 | int sync_cnt; | ||
| 214 | int refcount; | 213 | int refcount; |
| 215 | int synced; | 214 | int synced; |
| 216 | struct rcu_head rcu_head; | 215 | struct rcu_head rcu_head; |
| @@ -594,7 +593,6 @@ struct rps_dev_flow { | |||
| 594 | struct rps_dev_flow_table { | 593 | struct rps_dev_flow_table { |
| 595 | unsigned int mask; | 594 | unsigned int mask; |
| 596 | struct rcu_head rcu; | 595 | struct rcu_head rcu; |
| 597 | struct work_struct free_work; | ||
| 598 | struct rps_dev_flow flows[0]; | 596 | struct rps_dev_flow flows[0]; |
| 599 | }; | 597 | }; |
| 600 | #define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ | 598 | #define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ |
| @@ -785,13 +783,13 @@ struct netdev_fcoe_hbainfo { | |||
| 785 | * 3. Update dev->stats asynchronously and atomically, and define | 783 | * 3. Update dev->stats asynchronously and atomically, and define |
| 786 | * neither operation. | 784 | * neither operation. |
| 787 | * | 785 | * |
| 788 | * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); | 786 | * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16t vid); |
| 789 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) | 787 | * If device support VLAN filtering this function is called when a |
| 790 | * this function is called when a VLAN id is registered. | 788 | * VLAN id is registered. |
| 791 | * | 789 | * |
| 792 | * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); | 790 | * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); |
| 793 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) | 791 | * If device support VLAN filtering this function is called when a |
| 794 | * this function is called when a VLAN id is unregistered. | 792 | * VLAN id is unregistered. |
| 795 | * | 793 | * |
| 796 | * void (*ndo_poll_controller)(struct net_device *dev); | 794 | * void (*ndo_poll_controller)(struct net_device *dev); |
| 797 | * | 795 | * |
| @@ -935,9 +933,9 @@ struct net_device_ops { | |||
| 935 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); | 933 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
| 936 | 934 | ||
| 937 | int (*ndo_vlan_rx_add_vid)(struct net_device *dev, | 935 | int (*ndo_vlan_rx_add_vid)(struct net_device *dev, |
| 938 | unsigned short vid); | 936 | __be16 proto, u16 vid); |
| 939 | int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, | 937 | int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, |
| 940 | unsigned short vid); | 938 | __be16 proto, u16 vid); |
| 941 | #ifdef CONFIG_NET_POLL_CONTROLLER | 939 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 942 | void (*ndo_poll_controller)(struct net_device *dev); | 940 | void (*ndo_poll_controller)(struct net_device *dev); |
| 943 | int (*ndo_netpoll_setup)(struct net_device *dev, | 941 | int (*ndo_netpoll_setup)(struct net_device *dev, |
| @@ -1073,6 +1071,8 @@ struct net_device { | |||
| 1073 | struct list_head dev_list; | 1071 | struct list_head dev_list; |
| 1074 | struct list_head napi_list; | 1072 | struct list_head napi_list; |
| 1075 | struct list_head unreg_list; | 1073 | struct list_head unreg_list; |
| 1074 | struct list_head upper_dev_list; /* List of upper devices */ | ||
| 1075 | |||
| 1076 | 1076 | ||
| 1077 | /* currently active device features */ | 1077 | /* currently active device features */ |
| 1078 | netdev_features_t features; | 1078 | netdev_features_t features; |
| @@ -1145,6 +1145,13 @@ struct net_device { | |||
| 1145 | spinlock_t addr_list_lock; | 1145 | spinlock_t addr_list_lock; |
| 1146 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ | 1146 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ |
| 1147 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ | 1147 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ |
| 1148 | struct netdev_hw_addr_list dev_addrs; /* list of device | ||
| 1149 | * hw addresses | ||
| 1150 | */ | ||
| 1151 | #ifdef CONFIG_SYSFS | ||
| 1152 | struct kset *queues_kset; | ||
| 1153 | #endif | ||
| 1154 | |||
| 1148 | bool uc_promisc; | 1155 | bool uc_promisc; |
| 1149 | unsigned int promiscuity; | 1156 | unsigned int promiscuity; |
| 1150 | unsigned int allmulti; | 1157 | unsigned int allmulti; |
| @@ -1177,21 +1184,11 @@ struct net_device { | |||
| 1177 | * avoid dirtying this cache line. | 1184 | * avoid dirtying this cache line. |
| 1178 | */ | 1185 | */ |
| 1179 | 1186 | ||
| 1180 | struct list_head upper_dev_list; /* List of upper devices */ | ||
| 1181 | |||
| 1182 | /* Interface address info used in eth_type_trans() */ | 1187 | /* Interface address info used in eth_type_trans() */ |
| 1183 | unsigned char *dev_addr; /* hw address, (before bcast | 1188 | unsigned char *dev_addr; /* hw address, (before bcast |
| 1184 | because most packets are | 1189 | because most packets are |
| 1185 | unicast) */ | 1190 | unicast) */ |
| 1186 | 1191 | ||
| 1187 | struct netdev_hw_addr_list dev_addrs; /* list of device | ||
| 1188 | hw addresses */ | ||
| 1189 | |||
| 1190 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | ||
| 1191 | |||
| 1192 | #ifdef CONFIG_SYSFS | ||
| 1193 | struct kset *queues_kset; | ||
| 1194 | #endif | ||
| 1195 | 1192 | ||
| 1196 | #ifdef CONFIG_RPS | 1193 | #ifdef CONFIG_RPS |
| 1197 | struct netdev_rx_queue *_rx; | 1194 | struct netdev_rx_queue *_rx; |
| @@ -1202,18 +1199,14 @@ struct net_device { | |||
| 1202 | /* Number of RX queues currently active in device */ | 1199 | /* Number of RX queues currently active in device */ |
| 1203 | unsigned int real_num_rx_queues; | 1200 | unsigned int real_num_rx_queues; |
| 1204 | 1201 | ||
| 1205 | #ifdef CONFIG_RFS_ACCEL | ||
| 1206 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
| 1207 | * by RX queue number. Assigned by driver. This must only be | ||
| 1208 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
| 1209 | struct cpu_rmap *rx_cpu_rmap; | ||
| 1210 | #endif | ||
| 1211 | #endif | 1202 | #endif |
| 1212 | 1203 | ||
| 1213 | rx_handler_func_t __rcu *rx_handler; | 1204 | rx_handler_func_t __rcu *rx_handler; |
| 1214 | void __rcu *rx_handler_data; | 1205 | void __rcu *rx_handler_data; |
| 1215 | 1206 | ||
| 1216 | struct netdev_queue __rcu *ingress_queue; | 1207 | struct netdev_queue __rcu *ingress_queue; |
| 1208 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | ||
| 1209 | |||
| 1217 | 1210 | ||
| 1218 | /* | 1211 | /* |
| 1219 | * Cache lines mostly used on transmit path | 1212 | * Cache lines mostly used on transmit path |
| @@ -1235,6 +1228,12 @@ struct net_device { | |||
| 1235 | #ifdef CONFIG_XPS | 1228 | #ifdef CONFIG_XPS |
| 1236 | struct xps_dev_maps __rcu *xps_maps; | 1229 | struct xps_dev_maps __rcu *xps_maps; |
| 1237 | #endif | 1230 | #endif |
| 1231 | #ifdef CONFIG_RFS_ACCEL | ||
| 1232 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
| 1233 | * by RX queue number. Assigned by driver. This must only be | ||
| 1234 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
| 1235 | struct cpu_rmap *rx_cpu_rmap; | ||
| 1236 | #endif | ||
| 1238 | 1237 | ||
| 1239 | /* These may be needed for future network-power-down code. */ | 1238 | /* These may be needed for future network-power-down code. */ |
| 1240 | 1239 | ||
| @@ -1475,6 +1474,11 @@ static inline void *netdev_priv(const struct net_device *dev) | |||
| 1475 | */ | 1474 | */ |
| 1476 | #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) | 1475 | #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) |
| 1477 | 1476 | ||
| 1477 | /* Default NAPI poll() weight | ||
| 1478 | * Device drivers are strongly advised to not use bigger value | ||
| 1479 | */ | ||
| 1480 | #define NAPI_POLL_WEIGHT 64 | ||
| 1481 | |||
| 1478 | /** | 1482 | /** |
| 1479 | * netif_napi_add - initialize a napi context | 1483 | * netif_napi_add - initialize a napi context |
| 1480 | * @dev: network device | 1484 | * @dev: network device |
| @@ -1612,6 +1616,9 @@ extern seqcount_t devnet_rename_seq; /* Device rename seq */ | |||
| 1612 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) | 1616 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) |
| 1613 | #define for_each_netdev_continue_rcu(net, d) \ | 1617 | #define for_each_netdev_continue_rcu(net, d) \ |
| 1614 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) | 1618 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) |
| 1619 | #define for_each_netdev_in_bond_rcu(bond, slave) \ | ||
| 1620 | for_each_netdev_rcu(&init_net, slave) \ | ||
| 1621 | if (netdev_master_upper_dev_get_rcu(slave) == bond) | ||
| 1615 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) | 1622 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) |
| 1616 | 1623 | ||
| 1617 | static inline struct net_device *next_net_device(struct net_device *dev) | 1624 | static inline struct net_device *next_net_device(struct net_device *dev) |
| @@ -1684,7 +1691,6 @@ extern int netdev_refcnt_read(const struct net_device *dev); | |||
| 1684 | extern void free_netdev(struct net_device *dev); | 1691 | extern void free_netdev(struct net_device *dev); |
| 1685 | extern void synchronize_net(void); | 1692 | extern void synchronize_net(void); |
| 1686 | extern int init_dummy_netdev(struct net_device *dev); | 1693 | extern int init_dummy_netdev(struct net_device *dev); |
| 1687 | extern void netdev_resync_ops(struct net_device *dev); | ||
| 1688 | 1694 | ||
| 1689 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); | 1695 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); |
| 1690 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); | 1696 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
| @@ -2621,6 +2627,7 @@ extern int dev_uc_add(struct net_device *dev, const unsigned char *addr); | |||
| 2621 | extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); | 2627 | extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); |
| 2622 | extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); | 2628 | extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); |
| 2623 | extern int dev_uc_sync(struct net_device *to, struct net_device *from); | 2629 | extern int dev_uc_sync(struct net_device *to, struct net_device *from); |
| 2630 | extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from); | ||
| 2624 | extern void dev_uc_unsync(struct net_device *to, struct net_device *from); | 2631 | extern void dev_uc_unsync(struct net_device *to, struct net_device *from); |
| 2625 | extern void dev_uc_flush(struct net_device *dev); | 2632 | extern void dev_uc_flush(struct net_device *dev); |
| 2626 | extern void dev_uc_init(struct net_device *dev); | 2633 | extern void dev_uc_init(struct net_device *dev); |
| @@ -2632,6 +2639,7 @@ extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); | |||
| 2632 | extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); | 2639 | extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); |
| 2633 | extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); | 2640 | extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); |
| 2634 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); | 2641 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); |
| 2642 | extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from); | ||
| 2635 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); | 2643 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); |
| 2636 | extern void dev_mc_flush(struct net_device *dev); | 2644 | extern void dev_mc_flush(struct net_device *dev); |
| 2637 | extern void dev_mc_init(struct net_device *dev); | 2645 | extern void dev_mc_init(struct net_device *dev); |
| @@ -2678,6 +2686,19 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) | |||
| 2678 | { | 2686 | { |
| 2679 | return __skb_gso_segment(skb, features, true); | 2687 | return __skb_gso_segment(skb, features, true); |
| 2680 | } | 2688 | } |
| 2689 | __be16 skb_network_protocol(struct sk_buff *skb); | ||
| 2690 | |||
| 2691 | static inline bool can_checksum_protocol(netdev_features_t features, | ||
| 2692 | __be16 protocol) | ||
| 2693 | { | ||
| 2694 | return ((features & NETIF_F_GEN_CSUM) || | ||
| 2695 | ((features & NETIF_F_V4_CSUM) && | ||
| 2696 | protocol == htons(ETH_P_IP)) || | ||
| 2697 | ((features & NETIF_F_V6_CSUM) && | ||
| 2698 | protocol == htons(ETH_P_IPV6)) || | ||
| 2699 | ((features & NETIF_F_FCOE_CRC) && | ||
| 2700 | protocol == htons(ETH_P_FCOE))); | ||
| 2701 | } | ||
| 2681 | 2702 | ||
| 2682 | #ifdef CONFIG_BUG | 2703 | #ifdef CONFIG_BUG |
| 2683 | extern void netdev_rx_csum_fault(struct net_device *dev); | 2704 | extern void netdev_rx_csum_fault(struct net_device *dev); |
| @@ -2756,6 +2777,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
| 2756 | dev->gso_max_size = size; | 2777 | dev->gso_max_size = size; |
| 2757 | } | 2778 | } |
| 2758 | 2779 | ||
| 2780 | static inline bool netif_is_bond_master(struct net_device *dev) | ||
| 2781 | { | ||
| 2782 | return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; | ||
| 2783 | } | ||
| 2784 | |||
| 2759 | static inline bool netif_is_bond_slave(struct net_device *dev) | 2785 | static inline bool netif_is_bond_slave(struct net_device *dev) |
| 2760 | { | 2786 | { |
| 2761 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; | 2787 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; |
