]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/netdevice.h
net: introduce dev_net notifier register/unregister variants
[linux.git] / include / linux / netdevice.h
index ae5e260911e289a2f9b20db71268ac0a0755f9fc..4626188a754bf21be63a318e47c639ec4227c944 100644 (file)
@@ -849,6 +849,8 @@ enum tc_setup_type {
        TC_SETUP_QDISC_GRED,
        TC_SETUP_QDISC_TAPRIO,
        TC_SETUP_FT,
+       TC_SETUP_QDISC_ETS,
+       TC_SETUP_QDISC_TBF,
 };
 
 /* These structures hold the attributes of bpf state that are being passed
@@ -875,6 +877,7 @@ enum bpf_netdev_command {
 struct bpf_prog_offload_ops;
 struct netlink_ext_ack;
 struct xdp_umem;
+struct xdp_dev_bulk_queue;
 
 struct netdev_bpf {
        enum bpf_netdev_command command;
@@ -936,6 +939,11 @@ struct netdev_name_node {
 int netdev_name_node_alt_create(struct net_device *dev, const char *name);
 int netdev_name_node_alt_destroy(struct net_device *dev, const char *name);
 
+struct netdev_net_notifier {
+       struct list_head list;
+       struct notifier_block *nb;
+};
+
 /*
  * This structure defines the management hooks for network devices.
  * The following hooks can be defined; unless noted otherwise, they are
@@ -1014,7 +1022,7 @@ int netdev_name_node_alt_destroy(struct net_device *dev, const char *name);
  *     Called when a user wants to change the Maximum Transfer Unit
  *     of a device.
  *
- * void (*ndo_tx_timeout)(struct net_device *dev);
+ * void (*ndo_tx_timeout)(struct net_device *dev, unsigned int txqueue);
  *     Callback used when the transmitter has not made any progress
  *     for dev->watchdog ticks.
  *
@@ -1281,7 +1289,8 @@ struct net_device_ops {
                                                  int new_mtu);
        int                     (*ndo_neigh_setup)(struct net_device *dev,
                                                   struct neigh_parms *);
-       void                    (*ndo_tx_timeout) (struct net_device *dev);
+       void                    (*ndo_tx_timeout) (struct net_device *dev,
+                                                  unsigned int txqueue);
 
        void                    (*ndo_get_stats64)(struct net_device *dev,
                                                   struct rtnl_link_stats64 *storage);
@@ -1707,6 +1716,7 @@ enum netdev_priv_flags {
  *     @miniq_ingress:         ingress/clsact qdisc specific data for
  *                             ingress processing
  *     @ingress_queue:         XXX: need comments on this one
+ *     @nf_hooks_ingress:      netfilter hooks executed for ingress packets
  *     @broadcast:             hw bcast address
  *
  *     @rx_cpu_rmap:   CPU reverse-mapping for RX completion interrupts,
@@ -1788,6 +1798,10 @@ enum netdev_priv_flags {
  *
  *     @wol_enabled:   Wake-on-LAN is enabled
  *
+ *     @net_notifier_list:     List of per-net netdev notifier block
+ *                             that follow this device when it is moved
+ *                             to another network namespace.
+ *
  *     FIXME: cleanup struct net_device such that network protocol info
  *     moves out.
  */
@@ -1983,12 +1997,10 @@ struct net_device {
        unsigned int            num_tx_queues;
        unsigned int            real_num_tx_queues;
        struct Qdisc            *qdisc;
-#ifdef CONFIG_NET_SCHED
-       DECLARE_HASHTABLE       (qdisc_hash, 4);
-#endif
        unsigned int            tx_queue_len;
        spinlock_t              tx_global_lock;
-       int                     watchdog_timeo;
+
+       struct xdp_dev_bulk_queue __percpu *xdp_bulkq;
 
 #ifdef CONFIG_XPS
        struct xps_dev_maps __rcu *xps_cpus_map;
@@ -1998,11 +2010,15 @@ struct net_device {
        struct mini_Qdisc __rcu *miniq_egress;
 #endif
 
+#ifdef CONFIG_NET_SCHED
+       DECLARE_HASHTABLE       (qdisc_hash, 4);
+#endif
        /* These may be needed for future network-power-down code. */
        struct timer_list       watchdog_timer;
+       int                     watchdog_timeo;
 
-       int __percpu            *pcpu_refcnt;
        struct list_head        todo_list;
+       int __percpu            *pcpu_refcnt;
 
        struct list_head        link_watch_list;
 
@@ -2078,6 +2094,8 @@ struct net_device {
        struct lock_class_key   addr_list_lock_key;
        bool                    proto_down;
        unsigned                wol_enabled:1;
+
+       struct list_head        net_notifier_list;
 };
 #define to_net_dev(d) container_of(d, struct net_device, dev)
 
@@ -2319,7 +2337,8 @@ struct napi_gro_cb {
        /* Number of gro_receive callbacks this packet already went through */
        u8 recursion_counter:4;
 
-       /* 1 bit hole */
+       /* GRO is done by frag_list pointer chaining. */
+       u8      is_flist:1;
 
        /* used to support CHECKSUM_COMPLETE for tunneling protocols */
        __wsum  csum;
@@ -2521,6 +2540,12 @@ int unregister_netdevice_notifier(struct notifier_block *nb);
 int register_netdevice_notifier_net(struct net *net, struct notifier_block *nb);
 int unregister_netdevice_notifier_net(struct net *net,
                                      struct notifier_block *nb);
+int register_netdevice_notifier_dev_net(struct net_device *dev,
+                                       struct notifier_block *nb,
+                                       struct netdev_net_notifier *nn);
+int unregister_netdevice_notifier_dev_net(struct net_device *dev,
+                                         struct notifier_block *nb,
+                                         struct netdev_net_notifier *nn);
 
 struct netdev_notifier_info {
        struct net_device       *dev;
@@ -2687,6 +2712,7 @@ struct net_device *dev_get_by_napi_id(unsigned int napi_id);
 int netdev_get_name(struct net *net, char *name, int ifindex);
 int dev_restart(struct net_device *dev);
 int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
+int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb);
 
 static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
 {
@@ -2823,16 +2849,16 @@ static inline bool __skb_gro_checksum_convert_check(struct sk_buff *skb)
 }
 
 static inline void __skb_gro_checksum_convert(struct sk_buff *skb,
-                                             __sum16 check, __wsum pseudo)
+                                             __wsum pseudo)
 {
        NAPI_GRO_CB(skb)->csum = ~pseudo;
        NAPI_GRO_CB(skb)->csum_valid = 1;
 }
 
-#define skb_gro_checksum_try_convert(skb, proto, check, compute_pseudo)        \
+#define skb_gro_checksum_try_convert(skb, proto, compute_pseudo)       \
 do {                                                                   \
        if (__skb_gro_checksum_convert_check(skb))                      \
-               __skb_gro_checksum_convert(skb, check,                  \
+               __skb_gro_checksum_convert(skb,                         \
                                           compute_pseudo(skb, proto)); \
 } while (0)
 
@@ -3698,6 +3724,8 @@ int dev_set_alias(struct net_device *, const char *, size_t);
 int dev_get_alias(const struct net_device *, char *, size_t);
 int dev_change_net_namespace(struct net_device *, struct net *, const char *);
 int __dev_set_mtu(struct net_device *, int);
+int dev_validate_mtu(struct net_device *dev, int mtu,
+                    struct netlink_ext_ack *extack);
 int dev_set_mtu_ext(struct net_device *dev, int mtu,
                    struct netlink_ext_ack *extack);
 int dev_set_mtu(struct net_device *, int);
@@ -4391,6 +4419,15 @@ struct netdev_notifier_bonding_info {
 void netdev_bonding_info_change(struct net_device *dev,
                                struct netdev_bonding_info *bonding_info);
 
+#if IS_ENABLED(CONFIG_ETHTOOL_NETLINK)
+void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data);
+#else
+static inline void ethtool_notify(struct net_device *dev, unsigned int cmd,
+                                 const void *data)
+{
+}
+#endif
+
 static inline
 struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
 {
@@ -4552,6 +4589,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
        BUILD_BUG_ON(SKB_GSO_ESP != (NETIF_F_GSO_ESP >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_GSO_UDP >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_UDP_L4 != (NETIF_F_GSO_UDP_L4 >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_FRAGLIST != (NETIF_F_GSO_FRAGLIST >> NETIF_F_GSO_SHIFT));
 
        return (features & feature) == feature;
 }