aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h60
1 files changed, 38 insertions, 22 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5cbaa20f1659..d94cb1431519 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -54,6 +54,7 @@
54#include <net/netprio_cgroup.h> 54#include <net/netprio_cgroup.h>
55 55
56#include <linux/netdev_features.h> 56#include <linux/netdev_features.h>
57#include <linux/neighbour.h>
57 58
58struct netpoll_info; 59struct netpoll_info;
59struct device; 60struct device;
@@ -288,7 +289,7 @@ struct hh_cache {
288struct header_ops { 289struct header_ops {
289 int (*create) (struct sk_buff *skb, struct net_device *dev, 290 int (*create) (struct sk_buff *skb, struct net_device *dev,
290 unsigned short type, const void *daddr, 291 unsigned short type, const void *daddr,
291 const void *saddr, unsigned len); 292 const void *saddr, unsigned int len);
292 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 293 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
293 int (*rebuild)(struct sk_buff *skb); 294 int (*rebuild)(struct sk_buff *skb);
294 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 295 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
@@ -905,6 +906,16 @@ struct netdev_fcoe_hbainfo {
905 * feature set might be less than what was returned by ndo_fix_features()). 906 * feature set might be less than what was returned by ndo_fix_features()).
906 * Must return >0 or -errno if it changed dev->features itself. 907 * Must return >0 or -errno if it changed dev->features itself.
907 * 908 *
909 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
910 * unsigned char *addr, u16 flags)
911 * Adds an FDB entry to dev for addr.
912 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
913 * unsigned char *addr)
914 * Deletes the FDB entry from dev coresponding to addr.
915 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
916 * struct net_device *dev, int idx)
917 * Used to add FDB entries to dump requests. Implementers should add
918 * entries to skb and update idx with the number of entries.
908 */ 919 */
909struct net_device_ops { 920struct net_device_ops {
910 int (*ndo_init)(struct net_device *dev); 921 int (*ndo_init)(struct net_device *dev);
@@ -1002,6 +1013,18 @@ struct net_device_ops {
1002 netdev_features_t features); 1013 netdev_features_t features);
1003 int (*ndo_neigh_construct)(struct neighbour *n); 1014 int (*ndo_neigh_construct)(struct neighbour *n);
1004 void (*ndo_neigh_destroy)(struct neighbour *n); 1015 void (*ndo_neigh_destroy)(struct neighbour *n);
1016
1017 int (*ndo_fdb_add)(struct ndmsg *ndm,
1018 struct net_device *dev,
1019 unsigned char *addr,
1020 u16 flags);
1021 int (*ndo_fdb_del)(struct ndmsg *ndm,
1022 struct net_device *dev,
1023 unsigned char *addr);
1024 int (*ndo_fdb_dump)(struct sk_buff *skb,
1025 struct netlink_callback *cb,
1026 struct net_device *dev,
1027 int idx);
1005}; 1028};
1006 1029
1007/* 1030/*
@@ -1132,7 +1155,6 @@ struct net_device {
1132 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1155 struct in_device __rcu *ip_ptr; /* IPv4 specific data */
1133 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ 1156 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */
1134 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ 1157 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */
1135 void *ec_ptr; /* Econet specific data */
1136 void *ax25_ptr; /* AX.25 specific data */ 1158 void *ax25_ptr; /* AX.25 specific data */
1137 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, 1159 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
1138 assign before registering */ 1160 assign before registering */
@@ -1403,15 +1425,6 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
1403 return 0; 1425 return 0;
1404} 1426}
1405 1427
1406#ifndef CONFIG_NET_NS
1407static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
1408{
1409 skb->dev = dev;
1410}
1411#else /* CONFIG_NET_NS */
1412void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
1413#endif
1414
1415static inline bool netdev_uses_trailer_tags(struct net_device *dev) 1428static inline bool netdev_uses_trailer_tags(struct net_device *dev)
1416{ 1429{
1417#ifdef CONFIG_NET_DSA_TAG_TRAILER 1430#ifdef CONFIG_NET_DSA_TAG_TRAILER
@@ -1486,6 +1499,8 @@ struct napi_gro_cb {
1486 1499
1487 /* Free the skb? */ 1500 /* Free the skb? */
1488 int free; 1501 int free;
1502#define NAPI_GRO_FREE 1
1503#define NAPI_GRO_FREE_STOLEN_HEAD 2
1489}; 1504};
1490 1505
1491#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 1506#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1689,7 +1704,7 @@ static inline void *skb_gro_network_header(struct sk_buff *skb)
1689static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1704static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
1690 unsigned short type, 1705 unsigned short type,
1691 const void *daddr, const void *saddr, 1706 const void *daddr, const void *saddr,
1692 unsigned len) 1707 unsigned int len)
1693{ 1708{
1694 if (!dev->header_ops || !dev->header_ops->create) 1709 if (!dev->header_ops || !dev->header_ops->create)
1695 return 0; 1710 return 0;
@@ -1740,7 +1755,7 @@ struct softnet_data {
1740 unsigned int input_queue_head; 1755 unsigned int input_queue_head;
1741 unsigned int input_queue_tail; 1756 unsigned int input_queue_tail;
1742#endif 1757#endif
1743 unsigned dropped; 1758 unsigned int dropped;
1744 struct sk_buff_head input_pkt_queue; 1759 struct sk_buff_head input_pkt_queue;
1745 struct napi_struct backlog; 1760 struct napi_struct backlog;
1746}; 1761};
@@ -1925,7 +1940,7 @@ static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
1925} 1940}
1926 1941
1927static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, 1942static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1928 unsigned pkts, unsigned bytes) 1943 unsigned int pkts, unsigned int bytes)
1929{ 1944{
1930#ifdef CONFIG_BQL 1945#ifdef CONFIG_BQL
1931 if (unlikely(!bytes)) 1946 if (unlikely(!bytes))
@@ -1949,7 +1964,7 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1949} 1964}
1950 1965
1951static inline void netdev_completed_queue(struct net_device *dev, 1966static inline void netdev_completed_queue(struct net_device *dev,
1952 unsigned pkts, unsigned bytes) 1967 unsigned int pkts, unsigned int bytes)
1953{ 1968{
1954 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes); 1969 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes);
1955} 1970}
@@ -2127,7 +2142,6 @@ extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2127extern gro_result_t napi_frags_finish(struct napi_struct *napi, 2142extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2128 struct sk_buff *skb, 2143 struct sk_buff *skb,
2129 gro_result_t ret); 2144 gro_result_t ret);
2130extern struct sk_buff * napi_frags_skb(struct napi_struct *napi);
2131extern gro_result_t napi_gro_frags(struct napi_struct *napi); 2145extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2132 2146
2133static inline void napi_free_frags(struct napi_struct *napi) 2147static inline void napi_free_frags(struct napi_struct *napi)
@@ -2144,9 +2158,9 @@ extern void netdev_rx_handler_unregister(struct net_device *dev);
2144extern bool dev_valid_name(const char *name); 2158extern bool dev_valid_name(const char *name);
2145extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2159extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2146extern int dev_ethtool(struct net *net, struct ifreq *); 2160extern int dev_ethtool(struct net *net, struct ifreq *);
2147extern unsigned dev_get_flags(const struct net_device *); 2161extern unsigned int dev_get_flags(const struct net_device *);
2148extern int __dev_change_flags(struct net_device *, unsigned int flags); 2162extern int __dev_change_flags(struct net_device *, unsigned int flags);
2149extern int dev_change_flags(struct net_device *, unsigned); 2163extern int dev_change_flags(struct net_device *, unsigned int);
2150extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); 2164extern void __dev_notify_flags(struct net_device *, unsigned int old_flags);
2151extern int dev_change_name(struct net_device *, const char *); 2165extern int dev_change_name(struct net_device *, const char *);
2152extern int dev_set_alias(struct net_device *, const char *, size_t); 2166extern int dev_set_alias(struct net_device *, const char *, size_t);
@@ -2546,6 +2560,7 @@ extern int dev_addr_init(struct net_device *dev);
2546 2560
2547/* Functions used for unicast addresses handling */ 2561/* Functions used for unicast addresses handling */
2548extern int dev_uc_add(struct net_device *dev, unsigned char *addr); 2562extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
2563extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr);
2549extern int dev_uc_del(struct net_device *dev, unsigned char *addr); 2564extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
2550extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2565extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2551extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2566extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
@@ -2555,6 +2570,7 @@ extern void dev_uc_init(struct net_device *dev);
2555/* Functions used for multicast addresses handling */ 2570/* Functions used for multicast addresses handling */
2556extern int dev_mc_add(struct net_device *dev, unsigned char *addr); 2571extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
2557extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); 2572extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
2573extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr);
2558extern int dev_mc_del(struct net_device *dev, unsigned char *addr); 2574extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
2559extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); 2575extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
2560extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2576extern int dev_mc_sync(struct net_device *to, struct net_device *from);
@@ -2779,15 +2795,15 @@ do { \
2779#define netif_info(priv, type, dev, fmt, args...) \ 2795#define netif_info(priv, type, dev, fmt, args...) \
2780 netif_level(info, priv, type, dev, fmt, ##args) 2796 netif_level(info, priv, type, dev, fmt, ##args)
2781 2797
2782#if defined(DEBUG) 2798#if defined(CONFIG_DYNAMIC_DEBUG)
2783#define netif_dbg(priv, type, dev, format, args...) \
2784 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
2785#elif defined(CONFIG_DYNAMIC_DEBUG)
2786#define netif_dbg(priv, type, netdev, format, args...) \ 2799#define netif_dbg(priv, type, netdev, format, args...) \
2787do { \ 2800do { \
2788 if (netif_msg_##type(priv)) \ 2801 if (netif_msg_##type(priv)) \
2789 dynamic_netdev_dbg(netdev, format, ##args); \ 2802 dynamic_netdev_dbg(netdev, format, ##args); \
2790} while (0) 2803} while (0)
2804#elif defined(DEBUG)
2805#define netif_dbg(priv, type, dev, format, args...) \
2806 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
2791#else 2807#else
2792#define netif_dbg(priv, type, dev, format, args...) \ 2808#define netif_dbg(priv, type, dev, format, args...) \
2793({ \ 2809({ \