diff options
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ef789e1d679e..5eef6c8e2741 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <net/dcbnl.h> | 44 | #include <net/dcbnl.h> |
45 | #endif | 45 | #endif |
46 | #include <net/netprio_cgroup.h> | 46 | #include <net/netprio_cgroup.h> |
47 | #include <net/xdp.h> | ||
47 | 48 | ||
48 | #include <linux/netdev_features.h> | 49 | #include <linux/netdev_features.h> |
49 | #include <linux/neighbour.h> | 50 | #include <linux/neighbour.h> |
@@ -686,6 +687,7 @@ struct netdev_rx_queue { | |||
686 | #endif | 687 | #endif |
687 | struct kobject kobj; | 688 | struct kobject kobj; |
688 | struct net_device *dev; | 689 | struct net_device *dev; |
690 | struct xdp_rxq_info xdp_rxq; | ||
689 | } ____cacheline_aligned_in_smp; | 691 | } ____cacheline_aligned_in_smp; |
690 | 692 | ||
691 | /* | 693 | /* |
@@ -778,6 +780,7 @@ enum tc_setup_type { | |||
778 | TC_SETUP_BLOCK, | 780 | TC_SETUP_BLOCK, |
779 | TC_SETUP_QDISC_CBS, | 781 | TC_SETUP_QDISC_CBS, |
780 | TC_SETUP_QDISC_RED, | 782 | TC_SETUP_QDISC_RED, |
783 | TC_SETUP_QDISC_PRIO, | ||
781 | }; | 784 | }; |
782 | 785 | ||
783 | /* These structures hold the attributes of bpf state that are being passed | 786 | /* These structures hold the attributes of bpf state that are being passed |
@@ -802,9 +805,11 @@ enum bpf_netdev_command { | |||
802 | BPF_OFFLOAD_VERIFIER_PREP, | 805 | BPF_OFFLOAD_VERIFIER_PREP, |
803 | BPF_OFFLOAD_TRANSLATE, | 806 | BPF_OFFLOAD_TRANSLATE, |
804 | BPF_OFFLOAD_DESTROY, | 807 | BPF_OFFLOAD_DESTROY, |
808 | BPF_OFFLOAD_MAP_ALLOC, | ||
809 | BPF_OFFLOAD_MAP_FREE, | ||
805 | }; | 810 | }; |
806 | 811 | ||
807 | struct bpf_ext_analyzer_ops; | 812 | struct bpf_prog_offload_ops; |
808 | struct netlink_ext_ack; | 813 | struct netlink_ext_ack; |
809 | 814 | ||
810 | struct netdev_bpf { | 815 | struct netdev_bpf { |
@@ -820,16 +825,22 @@ struct netdev_bpf { | |||
820 | struct { | 825 | struct { |
821 | u8 prog_attached; | 826 | u8 prog_attached; |
822 | u32 prog_id; | 827 | u32 prog_id; |
828 | /* flags with which program was installed */ | ||
829 | u32 prog_flags; | ||
823 | }; | 830 | }; |
824 | /* BPF_OFFLOAD_VERIFIER_PREP */ | 831 | /* BPF_OFFLOAD_VERIFIER_PREP */ |
825 | struct { | 832 | struct { |
826 | struct bpf_prog *prog; | 833 | struct bpf_prog *prog; |
827 | const struct bpf_ext_analyzer_ops *ops; /* callee set */ | 834 | const struct bpf_prog_offload_ops *ops; /* callee set */ |
828 | } verifier; | 835 | } verifier; |
829 | /* BPF_OFFLOAD_TRANSLATE, BPF_OFFLOAD_DESTROY */ | 836 | /* BPF_OFFLOAD_TRANSLATE, BPF_OFFLOAD_DESTROY */ |
830 | struct { | 837 | struct { |
831 | struct bpf_prog *prog; | 838 | struct bpf_prog *prog; |
832 | } offload; | 839 | } offload; |
840 | /* BPF_OFFLOAD_MAP_ALLOC, BPF_OFFLOAD_MAP_FREE */ | ||
841 | struct { | ||
842 | struct bpf_offloaded_map *offmap; | ||
843 | }; | ||
833 | }; | 844 | }; |
834 | }; | 845 | }; |
835 | 846 | ||
@@ -840,6 +851,7 @@ struct xfrmdev_ops { | |||
840 | void (*xdo_dev_state_free) (struct xfrm_state *x); | 851 | void (*xdo_dev_state_free) (struct xfrm_state *x); |
841 | bool (*xdo_dev_offload_ok) (struct sk_buff *skb, | 852 | bool (*xdo_dev_offload_ok) (struct sk_buff *skb, |
842 | struct xfrm_state *x); | 853 | struct xfrm_state *x); |
854 | void (*xdo_dev_state_advance_esn) (struct xfrm_state *x); | ||
843 | }; | 855 | }; |
844 | #endif | 856 | #endif |
845 | 857 | ||
@@ -1458,8 +1470,6 @@ enum netdev_priv_flags { | |||
1458 | * @base_addr: Device I/O address | 1470 | * @base_addr: Device I/O address |
1459 | * @irq: Device IRQ number | 1471 | * @irq: Device IRQ number |
1460 | * | 1472 | * |
1461 | * @carrier_changes: Stats to monitor carrier on<->off transitions | ||
1462 | * | ||
1463 | * @state: Generic network queuing layer state, see netdev_state_t | 1473 | * @state: Generic network queuing layer state, see netdev_state_t |
1464 | * @dev_list: The global list of network devices | 1474 | * @dev_list: The global list of network devices |
1465 | * @napi_list: List entry used for polling NAPI devices | 1475 | * @napi_list: List entry used for polling NAPI devices |
@@ -1495,6 +1505,8 @@ enum netdev_priv_flags { | |||
1495 | * do not use this in drivers | 1505 | * do not use this in drivers |
1496 | * @rx_nohandler: nohandler dropped packets by core network on | 1506 | * @rx_nohandler: nohandler dropped packets by core network on |
1497 | * inactive devices, do not use this in drivers | 1507 | * inactive devices, do not use this in drivers |
1508 | * @carrier_up_count: Number of times the carrier has been up | ||
1509 | * @carrier_down_count: Number of times the carrier has been down | ||
1498 | * | 1510 | * |
1499 | * @wireless_handlers: List of functions to handle Wireless Extensions, | 1511 | * @wireless_handlers: List of functions to handle Wireless Extensions, |
1500 | * instead of ioctl, | 1512 | * instead of ioctl, |
@@ -1669,8 +1681,6 @@ struct net_device { | |||
1669 | unsigned long base_addr; | 1681 | unsigned long base_addr; |
1670 | int irq; | 1682 | int irq; |
1671 | 1683 | ||
1672 | atomic_t carrier_changes; | ||
1673 | |||
1674 | /* | 1684 | /* |
1675 | * Some hardware also needs these fields (state,dev_list, | 1685 | * Some hardware also needs these fields (state,dev_list, |
1676 | * napi_list,unreg_list,close_list) but they are not | 1686 | * napi_list,unreg_list,close_list) but they are not |
@@ -1708,6 +1718,10 @@ struct net_device { | |||
1708 | atomic_long_t tx_dropped; | 1718 | atomic_long_t tx_dropped; |
1709 | atomic_long_t rx_nohandler; | 1719 | atomic_long_t rx_nohandler; |
1710 | 1720 | ||
1721 | /* Stats to monitor link on/off, flapping */ | ||
1722 | atomic_t carrier_up_count; | ||
1723 | atomic_t carrier_down_count; | ||
1724 | |||
1711 | #ifdef CONFIG_WIRELESS_EXT | 1725 | #ifdef CONFIG_WIRELESS_EXT |
1712 | const struct iw_handler_def *wireless_handlers; | 1726 | const struct iw_handler_def *wireless_handlers; |
1713 | struct iw_public_data *wireless_data; | 1727 | struct iw_public_data *wireless_data; |
@@ -1724,7 +1738,7 @@ struct net_device { | |||
1724 | const struct ndisc_ops *ndisc_ops; | 1738 | const struct ndisc_ops *ndisc_ops; |
1725 | #endif | 1739 | #endif |
1726 | 1740 | ||
1727 | #ifdef CONFIG_XFRM | 1741 | #ifdef CONFIG_XFRM_OFFLOAD |
1728 | const struct xfrmdev_ops *xfrmdev_ops; | 1742 | const struct xfrmdev_ops *xfrmdev_ops; |
1729 | #endif | 1743 | #endif |
1730 | 1744 | ||
@@ -1801,12 +1815,9 @@ struct net_device { | |||
1801 | /* Interface address info used in eth_type_trans() */ | 1815 | /* Interface address info used in eth_type_trans() */ |
1802 | unsigned char *dev_addr; | 1816 | unsigned char *dev_addr; |
1803 | 1817 | ||
1804 | #ifdef CONFIG_SYSFS | ||
1805 | struct netdev_rx_queue *_rx; | 1818 | struct netdev_rx_queue *_rx; |
1806 | |||
1807 | unsigned int num_rx_queues; | 1819 | unsigned int num_rx_queues; |
1808 | unsigned int real_num_rx_queues; | 1820 | unsigned int real_num_rx_queues; |
1809 | #endif | ||
1810 | 1821 | ||
1811 | struct bpf_prog __rcu *xdp_prog; | 1822 | struct bpf_prog __rcu *xdp_prog; |
1812 | unsigned long gro_flush_timeout; | 1823 | unsigned long gro_flush_timeout; |
@@ -2751,7 +2762,8 @@ static inline bool dev_validate_header(const struct net_device *dev, | |||
2751 | return false; | 2762 | return false; |
2752 | } | 2763 | } |
2753 | 2764 | ||
2754 | typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); | 2765 | typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, |
2766 | int len, int size); | ||
2755 | int register_gifconf(unsigned int family, gifconf_func_t *gifconf); | 2767 | int register_gifconf(unsigned int family, gifconf_func_t *gifconf); |
2756 | static inline int unregister_gifconf(unsigned int family) | 2768 | static inline int unregister_gifconf(unsigned int family) |
2757 | { | 2769 | { |
@@ -2791,7 +2803,9 @@ struct softnet_data { | |||
2791 | struct Qdisc *output_queue; | 2803 | struct Qdisc *output_queue; |
2792 | struct Qdisc **output_queue_tailp; | 2804 | struct Qdisc **output_queue_tailp; |
2793 | struct sk_buff *completion_queue; | 2805 | struct sk_buff *completion_queue; |
2794 | 2806 | #ifdef CONFIG_XFRM_OFFLOAD | |
2807 | struct sk_buff_head xfrm_backlog; | ||
2808 | #endif | ||
2795 | #ifdef CONFIG_RPS | 2809 | #ifdef CONFIG_RPS |
2796 | /* input_queue_head should be written by cpu owning this struct, | 2810 | /* input_queue_head should be written by cpu owning this struct, |
2797 | * and only read by other cpus. Worth using a cache line. | 2811 | * and only read by other cpus. Worth using a cache line. |
@@ -3214,6 +3228,12 @@ static inline int netif_set_real_num_rx_queues(struct net_device *dev, | |||
3214 | } | 3228 | } |
3215 | #endif | 3229 | #endif |
3216 | 3230 | ||
3231 | static inline struct netdev_rx_queue * | ||
3232 | __netif_get_rx_queue(struct net_device *dev, unsigned int rxq) | ||
3233 | { | ||
3234 | return dev->_rx + rxq; | ||
3235 | } | ||
3236 | |||
3217 | #ifdef CONFIG_SYSFS | 3237 | #ifdef CONFIG_SYSFS |
3218 | static inline unsigned int get_netdev_rx_queue_index( | 3238 | static inline unsigned int get_netdev_rx_queue_index( |
3219 | struct netdev_rx_queue *queue) | 3239 | struct netdev_rx_queue *queue) |
@@ -3302,7 +3322,9 @@ int netdev_rx_handler_register(struct net_device *dev, | |||
3302 | void netdev_rx_handler_unregister(struct net_device *dev); | 3322 | void netdev_rx_handler_unregister(struct net_device *dev); |
3303 | 3323 | ||
3304 | bool dev_valid_name(const char *name); | 3324 | bool dev_valid_name(const char *name); |
3305 | int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 3325 | int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr, |
3326 | bool *need_copyout); | ||
3327 | int dev_ifconf(struct net *net, struct ifconf *, int); | ||
3306 | int dev_ethtool(struct net *net, struct ifreq *); | 3328 | int dev_ethtool(struct net *net, struct ifreq *); |
3307 | unsigned int dev_get_flags(const struct net_device *); | 3329 | unsigned int dev_get_flags(const struct net_device *); |
3308 | int __dev_change_flags(struct net_device *, unsigned int flags); | 3330 | int __dev_change_flags(struct net_device *, unsigned int flags); |
@@ -3315,6 +3337,7 @@ int dev_get_alias(const struct net_device *, char *, size_t); | |||
3315 | int dev_change_net_namespace(struct net_device *, struct net *, const char *); | 3337 | int dev_change_net_namespace(struct net_device *, struct net *, const char *); |
3316 | int __dev_set_mtu(struct net_device *, int); | 3338 | int __dev_set_mtu(struct net_device *, int); |
3317 | int dev_set_mtu(struct net_device *, int); | 3339 | int dev_set_mtu(struct net_device *, int); |
3340 | int dev_change_tx_queue_len(struct net_device *, unsigned long); | ||
3318 | void dev_set_group(struct net_device *, int); | 3341 | void dev_set_group(struct net_device *, int); |
3319 | int dev_set_mac_address(struct net_device *, struct sockaddr *); | 3342 | int dev_set_mac_address(struct net_device *, struct sockaddr *); |
3320 | int dev_change_carrier(struct net_device *, bool new_carrier); | 3343 | int dev_change_carrier(struct net_device *, bool new_carrier); |
@@ -3323,14 +3346,15 @@ int dev_get_phys_port_id(struct net_device *dev, | |||
3323 | int dev_get_phys_port_name(struct net_device *dev, | 3346 | int dev_get_phys_port_name(struct net_device *dev, |
3324 | char *name, size_t len); | 3347 | char *name, size_t len); |
3325 | int dev_change_proto_down(struct net_device *dev, bool proto_down); | 3348 | int dev_change_proto_down(struct net_device *dev, bool proto_down); |
3326 | struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev); | 3349 | struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev, bool *again); |
3327 | struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | 3350 | struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, |
3328 | struct netdev_queue *txq, int *ret); | 3351 | struct netdev_queue *txq, int *ret); |
3329 | 3352 | ||
3330 | typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf); | 3353 | typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf); |
3331 | int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, | 3354 | int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, |
3332 | int fd, u32 flags); | 3355 | int fd, u32 flags); |
3333 | u8 __dev_xdp_attached(struct net_device *dev, bpf_op_t xdp_op, u32 *prog_id); | 3356 | void __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op, |
3357 | struct netdev_bpf *xdp); | ||
3334 | 3358 | ||
3335 | int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); | 3359 | int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); |
3336 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); | 3360 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); |
@@ -4399,11 +4423,11 @@ do { \ | |||
4399 | * file/line information and a backtrace. | 4423 | * file/line information and a backtrace. |
4400 | */ | 4424 | */ |
4401 | #define netdev_WARN(dev, format, args...) \ | 4425 | #define netdev_WARN(dev, format, args...) \ |
4402 | WARN(1, "netdevice: %s%s\n" format, netdev_name(dev), \ | 4426 | WARN(1, "netdevice: %s%s: " format, netdev_name(dev), \ |
4403 | netdev_reg_state(dev), ##args) | 4427 | netdev_reg_state(dev), ##args) |
4404 | 4428 | ||
4405 | #define netdev_WARN_ONCE(dev, condition, format, arg...) \ | 4429 | #define netdev_WARN_ONCE(dev, format, args...) \ |
4406 | WARN_ONCE(1, "netdevice: %s%s\n" format, netdev_name(dev) \ | 4430 | WARN_ONCE(1, "netdevice: %s%s: " format, netdev_name(dev), \ |
4407 | netdev_reg_state(dev), ##args) | 4431 | netdev_reg_state(dev), ##args) |
4408 | 4432 | ||
4409 | /* netif printk helpers, similar to netdev_printk */ | 4433 | /* netif printk helpers, similar to netdev_printk */ |