Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[linux-2.6-microblaze.git] / include / linux / netdevice.h
index 02c6e8e..7c41593 100644 (file)
@@ -47,6 +47,7 @@
 #include <uapi/linux/if_bonding.h>
 #include <uapi/linux/pkt_cls.h>
 #include <linux/hashtable.h>
+#include <linux/rbtree.h>
 
 struct netpoll_info;
 struct device;
@@ -208,6 +209,7 @@ struct sk_buff;
 
 struct netdev_hw_addr {
        struct list_head        list;
+       struct rb_node          node;
        unsigned char           addr[MAX_ADDR_LEN];
        unsigned char           type;
 #define NETDEV_HW_ADDR_T_LAN           1
@@ -224,6 +226,9 @@ struct netdev_hw_addr {
 struct netdev_hw_addr_list {
        struct list_head        list;
        int                     count;
+
+       /* Auxiliary tree for faster lookup on addition and deletion */
+       struct rb_root          tree;
 };
 
 #define netdev_hw_addr_list_count(l) ((l)->count)
@@ -295,18 +300,6 @@ enum netdev_state_t {
 };
 
 
-/*
- * This structure holds boot-time configured netdevice settings. They
- * are then used in the device probing.
- */
-struct netdev_boot_setup {
-       char name[IFNAMSIZ];
-       struct ifmap map;
-};
-#define NETDEV_BOOT_SETUP_MAX 8
-
-int __init netdev_boot_setup(char *str);
-
 struct gro_list {
        struct list_head        list;
        int                     count;
@@ -734,13 +727,13 @@ bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
 
 /* This structure contains an instance of an RX queue. */
 struct netdev_rx_queue {
+       struct xdp_rxq_info             xdp_rxq;
 #ifdef CONFIG_RPS
        struct rps_map __rcu            *rps_map;
        struct rps_dev_flow_table __rcu *rps_flow_table;
 #endif
        struct kobject                  kobj;
        struct net_device               *dev;
-       struct xdp_rxq_info             xdp_rxq;
 #ifdef CONFIG_XDP_SOCKETS
        struct xsk_buff_pool            *pool;
 #endif
@@ -2944,7 +2937,6 @@ static inline struct net_device *first_net_device_rcu(struct net *net)
 }
 
 int netdev_boot_setup_check(struct net_device *dev);
-unsigned long netdev_boot_base(const char *prefix, int unit);
 struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
                                       const char *hwaddr);
 struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
@@ -3934,6 +3926,8 @@ static inline int netif_set_real_num_rx_queues(struct net_device *dev,
        return 0;
 }
 #endif
+int netif_set_real_num_queues(struct net_device *dev,
+                             unsigned int txq, unsigned int rxq);
 
 static inline struct netdev_rx_queue *
 __netif_get_rx_queue(struct net_device *dev, unsigned int rxq)
@@ -3967,7 +3961,7 @@ void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason);
 /*
  * It is not allowed to call kfree_skb() or consume_skb() from hardware
  * interrupt context or with hardware interrupts being disabled.
- * (in_irq() || irqs_disabled())
+ * (in_hardirq() || irqs_disabled())
  *
  * We provide four helpers that can be used in following contexts :
  *
@@ -4033,6 +4027,10 @@ int netdev_rx_handler_register(struct net_device *dev,
 void netdev_rx_handler_unregister(struct net_device *dev);
 
 bool dev_valid_name(const char *name);
+static inline bool is_socket_ioctl_cmd(unsigned int cmd)
+{
+       return _IOC_TYPE(cmd) == SOCK_IOC_TYPE;
+}
 int get_user_ifreq(struct ifreq *ifr, void __user **ifrdata, void __user *arg);
 int put_user_ifreq(struct ifreq *ifr, void __user *arg);
 int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr,
@@ -4160,11 +4158,13 @@ void netdev_run_todo(void);
  */
 static inline void dev_put(struct net_device *dev)
 {
+       if (dev) {
 #ifdef CONFIG_PCPU_DEV_REFCNT
-       this_cpu_dec(*dev->pcpu_refcnt);
+               this_cpu_dec(*dev->pcpu_refcnt);
 #else
-       refcount_dec(&dev->dev_refcnt);
+               refcount_dec(&dev->dev_refcnt);
 #endif
+       }
 }
 
 /**
@@ -4175,11 +4175,13 @@ static inline void dev_put(struct net_device *dev)
  */
 static inline void dev_hold(struct net_device *dev)
 {
+       if (dev) {
 #ifdef CONFIG_PCPU_DEV_REFCNT
-       this_cpu_inc(*dev->pcpu_refcnt);
+               this_cpu_inc(*dev->pcpu_refcnt);
 #else
-       refcount_inc(&dev->dev_refcnt);
+               refcount_inc(&dev->dev_refcnt);
 #endif
+       }
 }
 
 /* Carrier loss detection, dial on demand. The functions netif_carrier_on