net: Introduce passthru_features_check
[cascardo/linux.git] / include / linux / netdevice.h
index 5897b4e..967bb4c 100644 (file)
@@ -261,7 +261,6 @@ struct header_ops {
                           unsigned short type, const void *daddr,
                           const void *saddr, unsigned int len);
        int     (*parse)(const struct sk_buff *skb, unsigned char *haddr);
-       int     (*rebuild)(struct sk_buff *skb);
        int     (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
        void    (*cache_update)(struct hh_cache *hh,
                                const struct net_device *dev,
@@ -588,6 +587,7 @@ struct netdev_queue {
 #ifdef CONFIG_BQL
        struct dql              dql;
 #endif
+       unsigned long           tx_maxrate;
 } ____cacheline_aligned_in_smp;
 
 static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
@@ -965,9 +965,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
  *     Used to add FDB entries to dump requests. Implementers should add
  *     entries to skb and update idx with the number of entries.
  *
- * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh)
+ * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh,
+ *                          u16 flags)
  * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
  *                          struct net_device *dev, u32 filter_mask)
+ * int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh,
+ *                          u16 flags);
  *
  * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier);
  *     Called to change device carrier. Soft-devices (like dummy, team, etc)
@@ -1023,15 +1026,10 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
  *     be otherwise expressed by feature flags. The check is called with
  *     the set of features that the stack has calculated and it returns
  *     those the driver believes to be appropriate.
- *
- * int (*ndo_switch_parent_id_get)(struct net_device *dev,
- *                                struct netdev_phys_item_id *psid);
- *     Called to get an ID of the switch chip this port is part of.
- *     If driver implements this, it indicates that it represents a port
- *     of a switch chip.
- * int (*ndo_switch_port_stp_update)(struct net_device *dev, u8 state);
- *     Called to notify switch device port of bridge port STP
- *     state change.
+ * int (*ndo_set_tx_maxrate)(struct net_device *dev,
+ *                          int queue_index, u32 maxrate);
+ *     Called when a user wants to set a max-rate limitation of specific
+ *     TX queue.
  */
 struct net_device_ops {
        int                     (*ndo_init)(struct net_device *dev);
@@ -1169,6 +1167,8 @@ struct net_device_ops {
                                                      bool new_carrier);
        int                     (*ndo_get_phys_port_id)(struct net_device *dev,
                                                        struct netdev_phys_item_id *ppid);
+       int                     (*ndo_get_phys_port_name)(struct net_device *dev,
+                                                         char *name, size_t len);
        void                    (*ndo_add_vxlan_port)(struct  net_device *dev,
                                                      sa_family_t sa_family,
                                                      __be16 port);
@@ -1188,12 +1188,9 @@ struct net_device_ops {
        netdev_features_t       (*ndo_features_check) (struct sk_buff *skb,
                                                       struct net_device *dev,
                                                       netdev_features_t features);
-#ifdef CONFIG_NET_SWITCHDEV
-       int                     (*ndo_switch_parent_id_get)(struct net_device *dev,
-                                                           struct netdev_phys_item_id *psid);
-       int                     (*ndo_switch_port_stp_update)(struct net_device *dev,
-                                                             u8 state);
-#endif
+       int                     (*ndo_set_tx_maxrate)(struct net_device *dev,
+                                                     int queue_index,
+                                                     u32 maxrate);
 };
 
 /**
@@ -1345,8 +1342,7 @@ enum netdev_priv_flags {
  *     @netdev_ops:    Includes several pointers to callbacks,
  *                     if one wants to override the ndo_*() functions
  *     @ethtool_ops:   Management operations
- *     @fwd_ops:       Management operations
- *     @header_ops:    Includes callbacks for creating,parsing,rebuilding,etc
+ *     @header_ops:    Includes callbacks for creating,parsing,caching,etc
  *                     of Layer 2 headers.
  *
  *     @flags:         Interface flags (a la BSD)
@@ -1554,7 +1550,9 @@ struct net_device {
 #endif
        const struct net_device_ops *netdev_ops;
        const struct ethtool_ops *ethtool_ops;
-       const struct forwarding_accel_ops *fwd_ops;
+#ifdef CONFIG_NET_SWITCHDEV
+       const struct swdev_ops *swdev_ops;
+#endif
 
        const struct header_ops *header_ops;
 
@@ -1699,9 +1697,7 @@ struct net_device {
        struct netpoll_info __rcu       *npinfo;
 #endif
 
-#ifdef CONFIG_NET_NS
-       struct net              *nd_net;
-#endif
+       possible_net_t                  nd_net;
 
        /* mid-layer private */
        union {
@@ -1841,10 +1837,7 @@ struct net *dev_net(const struct net_device *dev)
 static inline
 void dev_net_set(struct net_device *dev, struct net *net)
 {
-#ifdef CONFIG_NET_NS
-       release_net(dev->nd_net);
-       dev->nd_net = hold_net(net);
-#endif
+       write_pnet(&dev->nd_net, net);
 }
 
 static inline bool netdev_uses_dsa(struct net_device *dev)
@@ -2164,6 +2157,7 @@ struct net_device *__dev_get_by_name(struct net *net, const char *name);
 int dev_alloc_name(struct net_device *dev, const char *name);
 int dev_open(struct net_device *dev);
 int dev_close(struct net_device *dev);
+int dev_close_many(struct list_head *head, bool unlink);
 void dev_disable_lro(struct net_device *dev);
 int dev_loopback_xmit(struct sk_buff *newskb);
 int dev_queue_xmit(struct sk_buff *skb);
@@ -2342,6 +2336,7 @@ struct gro_remcsum {
 
 static inline void skb_gro_remcsum_init(struct gro_remcsum *grc)
 {
+       grc->offset = 0;
        grc->delta = 0;
 }
 
@@ -2399,15 +2394,6 @@ static inline int dev_parse_header(const struct sk_buff *skb,
        return dev->header_ops->parse(skb, haddr);
 }
 
-static inline int dev_rebuild_header(struct sk_buff *skb)
-{
-       const struct net_device *dev = skb->dev;
-
-       if (!dev->header_ops || !dev->header_ops->rebuild)
-               return 0;
-       return dev->header_ops->rebuild(skb);
-}
-
 typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
 int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
 static inline int unregister_gifconf(unsigned int family)
@@ -2965,6 +2951,8 @@ int dev_set_mac_address(struct net_device *, struct sockaddr *);
 int dev_change_carrier(struct net_device *, bool new_carrier);
 int dev_get_phys_port_id(struct net_device *dev,
                         struct netdev_phys_item_id *ppid);
+int dev_get_phys_port_name(struct net_device *dev,
+                          char *name, size_t len);
 struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
 struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
                                    struct netdev_queue *txq, int *ret);
@@ -3669,6 +3657,9 @@ void netdev_change_features(struct net_device *dev);
 void netif_stacked_transfer_operstate(const struct net_device *rootdev,
                                        struct net_device *dev);
 
+netdev_features_t passthru_features_check(struct sk_buff *skb,
+                                         struct net_device *dev,
+                                         netdev_features_t features);
 netdev_features_t netif_skb_features(struct sk_buff *skb);
 
 static inline bool net_gso_ok(netdev_features_t features, int gso_type)