diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 239 |
1 files changed, 165 insertions, 74 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 5a96a1a406e9..d4a4d9867794 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -39,9 +39,11 @@ | |||
| 39 | 39 | ||
| 40 | #include <linux/device.h> | 40 | #include <linux/device.h> |
| 41 | #include <linux/percpu.h> | 41 | #include <linux/percpu.h> |
| 42 | #include <linux/rculist.h> | ||
| 42 | #include <linux/dmaengine.h> | 43 | #include <linux/dmaengine.h> |
| 43 | #include <linux/workqueue.h> | 44 | #include <linux/workqueue.h> |
| 44 | 45 | ||
| 46 | #include <linux/ethtool.h> | ||
| 45 | #include <net/net_namespace.h> | 47 | #include <net/net_namespace.h> |
| 46 | #include <net/dsa.h> | 48 | #include <net/dsa.h> |
| 47 | #ifdef CONFIG_DCB | 49 | #ifdef CONFIG_DCB |
| @@ -49,7 +51,6 @@ | |||
| 49 | #endif | 51 | #endif |
| 50 | 52 | ||
| 51 | struct vlan_group; | 53 | struct vlan_group; |
| 52 | struct ethtool_ops; | ||
| 53 | struct netpoll_info; | 54 | struct netpoll_info; |
| 54 | /* 802.11 specific */ | 55 | /* 802.11 specific */ |
| 55 | struct wireless_dev; | 56 | struct wireless_dev; |
| @@ -210,6 +211,24 @@ struct dev_addr_list | |||
| 210 | #define dmi_users da_users | 211 | #define dmi_users da_users |
| 211 | #define dmi_gusers da_gusers | 212 | #define dmi_gusers da_gusers |
| 212 | 213 | ||
| 214 | struct netdev_hw_addr { | ||
| 215 | struct list_head list; | ||
| 216 | unsigned char addr[MAX_ADDR_LEN]; | ||
| 217 | unsigned char type; | ||
| 218 | #define NETDEV_HW_ADDR_T_LAN 1 | ||
| 219 | #define NETDEV_HW_ADDR_T_SAN 2 | ||
| 220 | #define NETDEV_HW_ADDR_T_SLAVE 3 | ||
| 221 | #define NETDEV_HW_ADDR_T_UNICAST 4 | ||
| 222 | int refcount; | ||
| 223 | bool synced; | ||
| 224 | struct rcu_head rcu_head; | ||
| 225 | }; | ||
| 226 | |||
| 227 | struct netdev_hw_addr_list { | ||
| 228 | struct list_head list; | ||
| 229 | int count; | ||
| 230 | }; | ||
| 231 | |||
| 213 | struct hh_cache | 232 | struct hh_cache |
| 214 | { | 233 | { |
| 215 | struct hh_cache *hh_next; /* Next entry */ | 234 | struct hh_cache *hh_next; /* Next entry */ |
| @@ -447,12 +466,25 @@ enum netdev_queue_state_t | |||
| 447 | }; | 466 | }; |
| 448 | 467 | ||
| 449 | struct netdev_queue { | 468 | struct netdev_queue { |
| 469 | /* | ||
| 470 | * read mostly part | ||
| 471 | */ | ||
| 450 | struct net_device *dev; | 472 | struct net_device *dev; |
| 451 | struct Qdisc *qdisc; | 473 | struct Qdisc *qdisc; |
| 452 | unsigned long state; | 474 | unsigned long state; |
| 453 | spinlock_t _xmit_lock; | ||
| 454 | int xmit_lock_owner; | ||
| 455 | struct Qdisc *qdisc_sleeping; | 475 | struct Qdisc *qdisc_sleeping; |
| 476 | /* | ||
| 477 | * write mostly part | ||
| 478 | */ | ||
| 479 | spinlock_t _xmit_lock ____cacheline_aligned_in_smp; | ||
| 480 | int xmit_lock_owner; | ||
| 481 | /* | ||
| 482 | * please use this field instead of dev->trans_start | ||
| 483 | */ | ||
| 484 | unsigned long trans_start; | ||
| 485 | unsigned long tx_bytes; | ||
| 486 | unsigned long tx_packets; | ||
| 487 | unsigned long tx_dropped; | ||
| 456 | } ____cacheline_aligned_in_smp; | 488 | } ____cacheline_aligned_in_smp; |
| 457 | 489 | ||
| 458 | 490 | ||
| @@ -670,7 +702,9 @@ struct net_device | |||
| 670 | #define NETIF_F_GRO 16384 /* Generic receive offload */ | 702 | #define NETIF_F_GRO 16384 /* Generic receive offload */ |
| 671 | #define NETIF_F_LRO 32768 /* large receive offload */ | 703 | #define NETIF_F_LRO 32768 /* large receive offload */ |
| 672 | 704 | ||
| 705 | /* the GSO_MASK reserves bits 16 through 23 */ | ||
| 673 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ | 706 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ |
| 707 | #define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ | ||
| 674 | 708 | ||
| 675 | /* Segmentation offload features */ | 709 | /* Segmentation offload features */ |
| 676 | #define NETIF_F_GSO_SHIFT 16 | 710 | #define NETIF_F_GSO_SHIFT 16 |
| @@ -747,10 +781,10 @@ struct net_device | |||
| 747 | unsigned char addr_len; /* hardware address length */ | 781 | unsigned char addr_len; /* hardware address length */ |
| 748 | unsigned short dev_id; /* for shared network cards */ | 782 | unsigned short dev_id; /* for shared network cards */ |
| 749 | 783 | ||
| 750 | spinlock_t addr_list_lock; | 784 | struct netdev_hw_addr_list uc; /* Secondary unicast |
| 751 | struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */ | 785 | mac addresses */ |
| 752 | int uc_count; /* Number of installed ucasts */ | ||
| 753 | int uc_promisc; | 786 | int uc_promisc; |
| 787 | spinlock_t addr_list_lock; | ||
| 754 | struct dev_addr_list *mc_list; /* Multicast mac addresses */ | 788 | struct dev_addr_list *mc_list; /* Multicast mac addresses */ |
| 755 | int mc_count; /* Number of installed mcasts */ | 789 | int mc_count; /* Number of installed mcasts */ |
| 756 | unsigned int promiscuity; | 790 | unsigned int promiscuity; |
| @@ -776,8 +810,12 @@ struct net_device | |||
| 776 | */ | 810 | */ |
| 777 | unsigned long last_rx; /* Time of last Rx */ | 811 | unsigned long last_rx; /* Time of last Rx */ |
| 778 | /* Interface address info used in eth_type_trans() */ | 812 | /* Interface address info used in eth_type_trans() */ |
| 779 | unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast | 813 | unsigned char *dev_addr; /* hw address, (before bcast |
| 780 | because most packets are unicast) */ | 814 | because most packets are |
| 815 | unicast) */ | ||
| 816 | |||
| 817 | struct netdev_hw_addr_list dev_addrs; /* list of device | ||
| 818 | hw addresses */ | ||
| 781 | 819 | ||
| 782 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | 820 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ |
| 783 | 821 | ||
| @@ -797,6 +835,11 @@ struct net_device | |||
| 797 | * One part is mostly used on xmit path (device) | 835 | * One part is mostly used on xmit path (device) |
| 798 | */ | 836 | */ |
| 799 | /* These may be needed for future network-power-down code. */ | 837 | /* These may be needed for future network-power-down code. */ |
| 838 | |||
| 839 | /* | ||
| 840 | * trans_start here is expensive for high speed devices on SMP, | ||
| 841 | * please use netdev_queue->trans_start instead. | ||
| 842 | */ | ||
| 800 | unsigned long trans_start; /* Time (in jiffies) of last Tx */ | 843 | unsigned long trans_start; /* Time (in jiffies) of last Tx */ |
| 801 | 844 | ||
| 802 | int watchdog_timeo; /* used by dev_watchdog() */ | 845 | int watchdog_timeo; /* used by dev_watchdog() */ |
| @@ -867,49 +910,10 @@ struct net_device | |||
| 867 | /* max exchange id for FCoE LRO by ddp */ | 910 | /* max exchange id for FCoE LRO by ddp */ |
| 868 | unsigned int fcoe_ddp_xid; | 911 | unsigned int fcoe_ddp_xid; |
| 869 | #endif | 912 | #endif |
| 870 | |||
| 871 | #ifdef CONFIG_COMPAT_NET_DEV_OPS | ||
| 872 | struct { | ||
| 873 | int (*init)(struct net_device *dev); | ||
| 874 | void (*uninit)(struct net_device *dev); | ||
| 875 | int (*open)(struct net_device *dev); | ||
| 876 | int (*stop)(struct net_device *dev); | ||
| 877 | int (*hard_start_xmit) (struct sk_buff *skb, | ||
| 878 | struct net_device *dev); | ||
| 879 | u16 (*select_queue)(struct net_device *dev, | ||
| 880 | struct sk_buff *skb); | ||
| 881 | void (*change_rx_flags)(struct net_device *dev, | ||
| 882 | int flags); | ||
| 883 | void (*set_rx_mode)(struct net_device *dev); | ||
| 884 | void (*set_multicast_list)(struct net_device *dev); | ||
| 885 | int (*set_mac_address)(struct net_device *dev, | ||
| 886 | void *addr); | ||
| 887 | int (*validate_addr)(struct net_device *dev); | ||
| 888 | int (*do_ioctl)(struct net_device *dev, | ||
| 889 | struct ifreq *ifr, int cmd); | ||
| 890 | int (*set_config)(struct net_device *dev, | ||
| 891 | struct ifmap *map); | ||
| 892 | int (*change_mtu)(struct net_device *dev, int new_mtu); | ||
| 893 | int (*neigh_setup)(struct net_device *dev, | ||
| 894 | struct neigh_parms *); | ||
| 895 | void (*tx_timeout) (struct net_device *dev); | ||
| 896 | struct net_device_stats* (*get_stats)(struct net_device *dev); | ||
| 897 | void (*vlan_rx_register)(struct net_device *dev, | ||
| 898 | struct vlan_group *grp); | ||
| 899 | void (*vlan_rx_add_vid)(struct net_device *dev, | ||
| 900 | unsigned short vid); | ||
| 901 | void (*vlan_rx_kill_vid)(struct net_device *dev, | ||
| 902 | unsigned short vid); | ||
| 903 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 904 | void (*poll_controller)(struct net_device *dev); | ||
| 905 | #endif | ||
| 906 | }; | ||
| 907 | #endif | ||
| 908 | }; | 913 | }; |
| 909 | #define to_net_dev(d) container_of(d, struct net_device, dev) | 914 | #define to_net_dev(d) container_of(d, struct net_device, dev) |
| 910 | 915 | ||
| 911 | #define NETDEV_ALIGN 32 | 916 | #define NETDEV_ALIGN 32 |
| 912 | #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) | ||
| 913 | 917 | ||
| 914 | static inline | 918 | static inline |
| 915 | struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, | 919 | struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, |
| @@ -980,9 +984,7 @@ static inline bool netdev_uses_trailer_tags(struct net_device *dev) | |||
| 980 | */ | 984 | */ |
| 981 | static inline void *netdev_priv(const struct net_device *dev) | 985 | static inline void *netdev_priv(const struct net_device *dev) |
| 982 | { | 986 | { |
| 983 | return (char *)dev + ((sizeof(struct net_device) | 987 | return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN); |
| 984 | + NETDEV_ALIGN_CONST) | ||
| 985 | & ~NETDEV_ALIGN_CONST); | ||
| 986 | } | 988 | } |
| 987 | 989 | ||
| 988 | /* Set the sysfs physical device reference for the network logical device | 990 | /* Set the sysfs physical device reference for the network logical device |
| @@ -1012,6 +1014,12 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi, | |||
| 1012 | void netif_napi_del(struct napi_struct *napi); | 1014 | void netif_napi_del(struct napi_struct *napi); |
| 1013 | 1015 | ||
| 1014 | struct napi_gro_cb { | 1016 | struct napi_gro_cb { |
| 1017 | /* Virtual address of skb_shinfo(skb)->frags[0].page + offset. */ | ||
| 1018 | void *frag0; | ||
| 1019 | |||
| 1020 | /* Length of frag0. */ | ||
| 1021 | unsigned int frag0_len; | ||
| 1022 | |||
| 1015 | /* This indicates where we are processing relative to skb->data. */ | 1023 | /* This indicates where we are processing relative to skb->data. */ |
| 1016 | int data_offset; | 1024 | int data_offset; |
| 1017 | 1025 | ||
| @@ -1047,14 +1055,6 @@ struct packet_type { | |||
| 1047 | struct list_head list; | 1055 | struct list_head list; |
| 1048 | }; | 1056 | }; |
| 1049 | 1057 | ||
| 1050 | struct napi_gro_fraginfo { | ||
| 1051 | skb_frag_t frags[MAX_SKB_FRAGS]; | ||
| 1052 | unsigned int nr_frags; | ||
| 1053 | unsigned int ip_summed; | ||
| 1054 | unsigned int len; | ||
| 1055 | __wsum csum; | ||
| 1056 | }; | ||
| 1057 | |||
| 1058 | #include <linux/interrupt.h> | 1058 | #include <linux/interrupt.h> |
| 1059 | #include <linux/notifier.h> | 1059 | #include <linux/notifier.h> |
| 1060 | 1060 | ||
| @@ -1119,9 +1119,9 @@ extern int dev_restart(struct net_device *dev); | |||
| 1119 | #ifdef CONFIG_NETPOLL_TRAP | 1119 | #ifdef CONFIG_NETPOLL_TRAP |
| 1120 | extern int netpoll_trap(void); | 1120 | extern int netpoll_trap(void); |
| 1121 | #endif | 1121 | #endif |
| 1122 | extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen); | ||
| 1123 | extern int skb_gro_receive(struct sk_buff **head, | 1122 | extern int skb_gro_receive(struct sk_buff **head, |
| 1124 | struct sk_buff *skb); | 1123 | struct sk_buff *skb); |
| 1124 | extern void skb_gro_reset_offset(struct sk_buff *skb); | ||
| 1125 | 1125 | ||
| 1126 | static inline unsigned int skb_gro_offset(const struct sk_buff *skb) | 1126 | static inline unsigned int skb_gro_offset(const struct sk_buff *skb) |
| 1127 | { | 1127 | { |
| @@ -1138,16 +1138,34 @@ static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len) | |||
| 1138 | NAPI_GRO_CB(skb)->data_offset += len; | 1138 | NAPI_GRO_CB(skb)->data_offset += len; |
| 1139 | } | 1139 | } |
| 1140 | 1140 | ||
| 1141 | static inline void skb_gro_reset_offset(struct sk_buff *skb) | 1141 | static inline void *skb_gro_header_fast(struct sk_buff *skb, |
| 1142 | unsigned int offset) | ||
| 1143 | { | ||
| 1144 | return NAPI_GRO_CB(skb)->frag0 + offset; | ||
| 1145 | } | ||
| 1146 | |||
| 1147 | static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen) | ||
| 1148 | { | ||
| 1149 | return NAPI_GRO_CB(skb)->frag0_len < hlen; | ||
| 1150 | } | ||
| 1151 | |||
| 1152 | static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen, | ||
| 1153 | unsigned int offset) | ||
| 1142 | { | 1154 | { |
| 1143 | NAPI_GRO_CB(skb)->data_offset = 0; | 1155 | NAPI_GRO_CB(skb)->frag0 = NULL; |
| 1156 | NAPI_GRO_CB(skb)->frag0_len = 0; | ||
| 1157 | return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL; | ||
| 1144 | } | 1158 | } |
| 1145 | 1159 | ||
| 1146 | static inline void *skb_gro_mac_header(struct sk_buff *skb) | 1160 | static inline void *skb_gro_mac_header(struct sk_buff *skb) |
| 1147 | { | 1161 | { |
| 1148 | return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) : | 1162 | return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb); |
| 1149 | page_address(skb_shinfo(skb)->frags[0].page) + | 1163 | } |
| 1150 | skb_shinfo(skb)->frags[0].page_offset; | 1164 | |
| 1165 | static inline void *skb_gro_network_header(struct sk_buff *skb) | ||
| 1166 | { | ||
| 1167 | return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) + | ||
| 1168 | skb_network_offset(skb); | ||
| 1151 | } | 1169 | } |
| 1152 | 1170 | ||
| 1153 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 1171 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
| @@ -1442,12 +1460,18 @@ extern int napi_gro_receive(struct napi_struct *napi, | |||
| 1442 | struct sk_buff *skb); | 1460 | struct sk_buff *skb); |
| 1443 | extern void napi_reuse_skb(struct napi_struct *napi, | 1461 | extern void napi_reuse_skb(struct napi_struct *napi, |
| 1444 | struct sk_buff *skb); | 1462 | struct sk_buff *skb); |
| 1445 | extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, | 1463 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); |
| 1446 | struct napi_gro_fraginfo *info); | ||
| 1447 | extern int napi_frags_finish(struct napi_struct *napi, | 1464 | extern int napi_frags_finish(struct napi_struct *napi, |
| 1448 | struct sk_buff *skb, int ret); | 1465 | struct sk_buff *skb, int ret); |
| 1449 | extern int napi_gro_frags(struct napi_struct *napi, | 1466 | extern struct sk_buff * napi_frags_skb(struct napi_struct *napi); |
| 1450 | struct napi_gro_fraginfo *info); | 1467 | extern int napi_gro_frags(struct napi_struct *napi); |
| 1468 | |||
| 1469 | static inline void napi_free_frags(struct napi_struct *napi) | ||
| 1470 | { | ||
| 1471 | kfree_skb(napi->skb); | ||
| 1472 | napi->skb = NULL; | ||
| 1473 | } | ||
| 1474 | |||
| 1451 | extern void netif_nit_deliver(struct sk_buff *skb); | 1475 | extern void netif_nit_deliver(struct sk_buff *skb); |
| 1452 | extern int dev_valid_name(const char *name); | 1476 | extern int dev_valid_name(const char *name); |
| 1453 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 1477 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
| @@ -1514,6 +1538,8 @@ static inline int netif_carrier_ok(const struct net_device *dev) | |||
| 1514 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); | 1538 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); |
| 1515 | } | 1539 | } |
| 1516 | 1540 | ||
| 1541 | extern unsigned long dev_trans_start(struct net_device *dev); | ||
| 1542 | |||
| 1517 | extern void __netdev_watchdog_up(struct net_device *dev); | 1543 | extern void __netdev_watchdog_up(struct net_device *dev); |
| 1518 | 1544 | ||
| 1519 | extern void netif_carrier_on(struct net_device *dev); | 1545 | extern void netif_carrier_on(struct net_device *dev); |
| @@ -1671,6 +1697,12 @@ static inline void __netif_tx_unlock_bh(struct netdev_queue *txq) | |||
| 1671 | spin_unlock_bh(&txq->_xmit_lock); | 1697 | spin_unlock_bh(&txq->_xmit_lock); |
| 1672 | } | 1698 | } |
| 1673 | 1699 | ||
| 1700 | static inline void txq_trans_update(struct netdev_queue *txq) | ||
| 1701 | { | ||
| 1702 | if (txq->xmit_lock_owner != -1) | ||
| 1703 | txq->trans_start = jiffies; | ||
| 1704 | } | ||
| 1705 | |||
| 1674 | /** | 1706 | /** |
| 1675 | * netif_tx_lock - grab network device transmit lock | 1707 | * netif_tx_lock - grab network device transmit lock |
| 1676 | * @dev: network device | 1708 | * @dev: network device |
| @@ -1778,6 +1810,13 @@ static inline void netif_addr_unlock_bh(struct net_device *dev) | |||
| 1778 | spin_unlock_bh(&dev->addr_list_lock); | 1810 | spin_unlock_bh(&dev->addr_list_lock); |
| 1779 | } | 1811 | } |
| 1780 | 1812 | ||
| 1813 | /* | ||
| 1814 | * dev_addrs walker. Should be used only for read access. Call with | ||
| 1815 | * rcu_read_lock held. | ||
| 1816 | */ | ||
| 1817 | #define for_each_dev_addr(dev, ha) \ | ||
| 1818 | list_for_each_entry_rcu(ha, &dev->dev_addrs.list, list) | ||
| 1819 | |||
| 1781 | /* These functions live elsewhere (drivers/net/net_init.c, but related) */ | 1820 | /* These functions live elsewhere (drivers/net/net_init.c, but related) */ |
| 1782 | 1821 | ||
| 1783 | extern void ether_setup(struct net_device *dev); | 1822 | extern void ether_setup(struct net_device *dev); |
| @@ -1790,11 +1829,24 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, | |||
| 1790 | alloc_netdev_mq(sizeof_priv, name, setup, 1) | 1829 | alloc_netdev_mq(sizeof_priv, name, setup, 1) |
| 1791 | extern int register_netdev(struct net_device *dev); | 1830 | extern int register_netdev(struct net_device *dev); |
| 1792 | extern void unregister_netdev(struct net_device *dev); | 1831 | extern void unregister_netdev(struct net_device *dev); |
| 1832 | |||
| 1833 | /* Functions used for device addresses handling */ | ||
| 1834 | extern int dev_addr_add(struct net_device *dev, unsigned char *addr, | ||
| 1835 | unsigned char addr_type); | ||
| 1836 | extern int dev_addr_del(struct net_device *dev, unsigned char *addr, | ||
| 1837 | unsigned char addr_type); | ||
| 1838 | extern int dev_addr_add_multiple(struct net_device *to_dev, | ||
| 1839 | struct net_device *from_dev, | ||
| 1840 | unsigned char addr_type); | ||
| 1841 | extern int dev_addr_del_multiple(struct net_device *to_dev, | ||
| 1842 | struct net_device *from_dev, | ||
| 1843 | unsigned char addr_type); | ||
| 1844 | |||
| 1793 | /* Functions used for secondary unicast and multicast support */ | 1845 | /* Functions used for secondary unicast and multicast support */ |
| 1794 | extern void dev_set_rx_mode(struct net_device *dev); | 1846 | extern void dev_set_rx_mode(struct net_device *dev); |
| 1795 | extern void __dev_set_rx_mode(struct net_device *dev); | 1847 | extern void __dev_set_rx_mode(struct net_device *dev); |
| 1796 | extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen); | 1848 | extern int dev_unicast_delete(struct net_device *dev, void *addr); |
| 1797 | extern int dev_unicast_add(struct net_device *dev, void *addr, int alen); | 1849 | extern int dev_unicast_add(struct net_device *dev, void *addr); |
| 1798 | extern int dev_unicast_sync(struct net_device *to, struct net_device *from); | 1850 | extern int dev_unicast_sync(struct net_device *to, struct net_device *from); |
| 1799 | extern void dev_unicast_unsync(struct net_device *to, struct net_device *from); | 1851 | extern void dev_unicast_unsync(struct net_device *to, struct net_device *from); |
| 1800 | extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); | 1852 | extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); |
| @@ -1856,15 +1908,14 @@ static inline int net_gso_ok(int features, int gso_type) | |||
| 1856 | 1908 | ||
| 1857 | static inline int skb_gso_ok(struct sk_buff *skb, int features) | 1909 | static inline int skb_gso_ok(struct sk_buff *skb, int features) |
| 1858 | { | 1910 | { |
| 1859 | return net_gso_ok(features, skb_shinfo(skb)->gso_type); | 1911 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && |
| 1912 | (!skb_has_frags(skb) || (features & NETIF_F_FRAGLIST)); | ||
| 1860 | } | 1913 | } |
| 1861 | 1914 | ||
| 1862 | static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) | 1915 | static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) |
| 1863 | { | 1916 | { |
| 1864 | return skb_is_gso(skb) && | 1917 | return skb_is_gso(skb) && |
| 1865 | (!skb_gso_ok(skb, dev->features) || | 1918 | (!skb_gso_ok(skb, dev->features) || |
| 1866 | (skb_shinfo(skb)->frag_list && | ||
| 1867 | !(dev->features & NETIF_F_FRAGLIST)) || | ||
| 1868 | unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); | 1919 | unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); |
| 1869 | } | 1920 | } |
| 1870 | 1921 | ||
| @@ -1874,6 +1925,16 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
| 1874 | dev->gso_max_size = size; | 1925 | dev->gso_max_size = size; |
| 1875 | } | 1926 | } |
| 1876 | 1927 | ||
| 1928 | static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, | ||
| 1929 | struct net_device *master) | ||
| 1930 | { | ||
| 1931 | if (skb->pkt_type == PACKET_HOST) { | ||
| 1932 | u16 *dest = (u16 *) eth_hdr(skb)->h_dest; | ||
| 1933 | |||
| 1934 | memcpy(dest, master->dev_addr, ETH_ALEN); | ||
| 1935 | } | ||
| 1936 | } | ||
| 1937 | |||
| 1877 | /* On bonding slaves other than the currently active slave, suppress | 1938 | /* On bonding slaves other than the currently active slave, suppress |
| 1878 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and | 1939 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and |
| 1879 | * ARP on active-backup slaves with arp_validate enabled. | 1940 | * ARP on active-backup slaves with arp_validate enabled. |
| @@ -1887,6 +1948,14 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) | |||
| 1887 | if (master->priv_flags & IFF_MASTER_ARPMON) | 1948 | if (master->priv_flags & IFF_MASTER_ARPMON) |
| 1888 | dev->last_rx = jiffies; | 1949 | dev->last_rx = jiffies; |
| 1889 | 1950 | ||
| 1951 | if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) { | ||
| 1952 | /* Do address unmangle. The local destination address | ||
| 1953 | * will be always the one master has. Provides the right | ||
| 1954 | * functionality in a bridge. | ||
| 1955 | */ | ||
| 1956 | skb_bond_set_mac_by_master(skb, master); | ||
| 1957 | } | ||
| 1958 | |||
| 1890 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | 1959 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { |
| 1891 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && | 1960 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && |
| 1892 | skb->protocol == __cpu_to_be16(ETH_P_ARP)) | 1961 | skb->protocol == __cpu_to_be16(ETH_P_ARP)) |
| @@ -1908,6 +1977,28 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) | |||
| 1908 | } | 1977 | } |
| 1909 | 1978 | ||
| 1910 | extern struct pernet_operations __net_initdata loopback_net_ops; | 1979 | extern struct pernet_operations __net_initdata loopback_net_ops; |
| 1980 | |||
| 1981 | static inline int dev_ethtool_get_settings(struct net_device *dev, | ||
| 1982 | struct ethtool_cmd *cmd) | ||
| 1983 | { | ||
| 1984 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings) | ||
| 1985 | return -EOPNOTSUPP; | ||
| 1986 | return dev->ethtool_ops->get_settings(dev, cmd); | ||
| 1987 | } | ||
| 1988 | |||
| 1989 | static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) | ||
| 1990 | { | ||
| 1991 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) | ||
| 1992 | return 0; | ||
| 1993 | return dev->ethtool_ops->get_rx_csum(dev); | ||
| 1994 | } | ||
| 1995 | |||
| 1996 | static inline u32 dev_ethtool_get_flags(struct net_device *dev) | ||
| 1997 | { | ||
| 1998 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags) | ||
| 1999 | return 0; | ||
| 2000 | return dev->ethtool_ops->get_flags(dev); | ||
| 2001 | } | ||
| 1911 | #endif /* __KERNEL__ */ | 2002 | #endif /* __KERNEL__ */ |
| 1912 | 2003 | ||
| 1913 | #endif /* _LINUX_DEV_H */ | 2004 | #endif /* _LINUX_NETDEVICE_H */ |
