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.h48
1 files changed, 33 insertions, 15 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 371ece521e58..9ea8d6dfe540 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -215,9 +215,12 @@ struct netdev_hw_addr {
215 struct list_head list; 215 struct list_head list;
216 unsigned char addr[MAX_ADDR_LEN]; 216 unsigned char addr[MAX_ADDR_LEN];
217 unsigned char type; 217 unsigned char type;
218#define NETDEV_HW_ADDR_T_LAN 1 218#define NETDEV_HW_ADDR_T_LAN 1
219#define NETDEV_HW_ADDR_T_SAN 2 219#define NETDEV_HW_ADDR_T_SAN 2
220#define NETDEV_HW_ADDR_T_SLAVE 3 220#define NETDEV_HW_ADDR_T_SLAVE 3
221#define NETDEV_HW_ADDR_T_UNICAST 4
222 int refcount;
223 bool synced;
221 struct rcu_head rcu_head; 224 struct rcu_head rcu_head;
222}; 225};
223 226
@@ -773,10 +776,11 @@ struct net_device
773 unsigned char addr_len; /* hardware address length */ 776 unsigned char addr_len; /* hardware address length */
774 unsigned short dev_id; /* for shared network cards */ 777 unsigned short dev_id; /* for shared network cards */
775 778
776 spinlock_t addr_list_lock; 779 struct list_head uc_list; /* Secondary unicast mac
777 struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */ 780 addresses */
778 int uc_count; /* Number of installed ucasts */ 781 int uc_count; /* Number of installed ucasts */
779 int uc_promisc; 782 int uc_promisc;
783 spinlock_t addr_list_lock;
780 struct dev_addr_list *mc_list; /* Multicast mac addresses */ 784 struct dev_addr_list *mc_list; /* Multicast mac addresses */
781 int mc_count; /* Number of installed mcasts */ 785 int mc_count; /* Number of installed mcasts */
782 unsigned int promiscuity; 786 unsigned int promiscuity;
@@ -905,7 +909,6 @@ struct net_device
905#define to_net_dev(d) container_of(d, struct net_device, dev) 909#define to_net_dev(d) container_of(d, struct net_device, dev)
906 910
907#define NETDEV_ALIGN 32 911#define NETDEV_ALIGN 32
908#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
909 912
910static inline 913static inline
911struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, 914struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
@@ -976,9 +979,7 @@ static inline bool netdev_uses_trailer_tags(struct net_device *dev)
976 */ 979 */
977static inline void *netdev_priv(const struct net_device *dev) 980static inline void *netdev_priv(const struct net_device *dev)
978{ 981{
979 return (char *)dev + ((sizeof(struct net_device) 982 return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN);
980 + NETDEV_ALIGN_CONST)
981 & ~NETDEV_ALIGN_CONST);
982} 983}
983 984
984/* Set the sysfs physical device reference for the network logical device 985/* Set the sysfs physical device reference for the network logical device
@@ -1839,8 +1840,8 @@ extern int dev_addr_del_multiple(struct net_device *to_dev,
1839/* Functions used for secondary unicast and multicast support */ 1840/* Functions used for secondary unicast and multicast support */
1840extern void dev_set_rx_mode(struct net_device *dev); 1841extern void dev_set_rx_mode(struct net_device *dev);
1841extern void __dev_set_rx_mode(struct net_device *dev); 1842extern void __dev_set_rx_mode(struct net_device *dev);
1842extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen); 1843extern int dev_unicast_delete(struct net_device *dev, void *addr);
1843extern int dev_unicast_add(struct net_device *dev, void *addr, int alen); 1844extern int dev_unicast_add(struct net_device *dev, void *addr);
1844extern int dev_unicast_sync(struct net_device *to, struct net_device *from); 1845extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
1845extern void dev_unicast_unsync(struct net_device *to, struct net_device *from); 1846extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
1846extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); 1847extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
@@ -1902,15 +1903,14 @@ static inline int net_gso_ok(int features, int gso_type)
1902 1903
1903static inline int skb_gso_ok(struct sk_buff *skb, int features) 1904static inline int skb_gso_ok(struct sk_buff *skb, int features)
1904{ 1905{
1905 return net_gso_ok(features, skb_shinfo(skb)->gso_type); 1906 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
1907 (!skb_has_frags(skb) || (features & NETIF_F_FRAGLIST));
1906} 1908}
1907 1909
1908static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) 1910static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1909{ 1911{
1910 return skb_is_gso(skb) && 1912 return skb_is_gso(skb) &&
1911 (!skb_gso_ok(skb, dev->features) || 1913 (!skb_gso_ok(skb, dev->features) ||
1912 (skb_shinfo(skb)->frag_list &&
1913 !(dev->features & NETIF_F_FRAGLIST)) ||
1914 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1914 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1915} 1915}
1916 1916
@@ -1920,6 +1920,16 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
1920 dev->gso_max_size = size; 1920 dev->gso_max_size = size;
1921} 1921}
1922 1922
1923static inline void skb_bond_set_mac_by_master(struct sk_buff *skb,
1924 struct net_device *master)
1925{
1926 if (skb->pkt_type == PACKET_HOST) {
1927 u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
1928
1929 memcpy(dest, master->dev_addr, ETH_ALEN);
1930 }
1931}
1932
1923/* On bonding slaves other than the currently active slave, suppress 1933/* On bonding slaves other than the currently active slave, suppress
1924 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and 1934 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1925 * ARP on active-backup slaves with arp_validate enabled. 1935 * ARP on active-backup slaves with arp_validate enabled.
@@ -1933,6 +1943,14 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1933 if (master->priv_flags & IFF_MASTER_ARPMON) 1943 if (master->priv_flags & IFF_MASTER_ARPMON)
1934 dev->last_rx = jiffies; 1944 dev->last_rx = jiffies;
1935 1945
1946 if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) {
1947 /* Do address unmangle. The local destination address
1948 * will be always the one master has. Provides the right
1949 * functionality in a bridge.
1950 */
1951 skb_bond_set_mac_by_master(skb, master);
1952 }
1953
1936 if (dev->priv_flags & IFF_SLAVE_INACTIVE) { 1954 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1937 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1955 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1938 skb->protocol == __cpu_to_be16(ETH_P_ARP)) 1956 skb->protocol == __cpu_to_be16(ETH_P_ARP))
@@ -1978,4 +1996,4 @@ static inline u32 dev_ethtool_get_flags(struct net_device *dev)
1978} 1996}
1979#endif /* __KERNEL__ */ 1997#endif /* __KERNEL__ */
1980 1998
1981#endif /* _LINUX_DEV_H */ 1999#endif /* _LINUX_NETDEVICE_H */