diff options
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 112 |
1 files changed, 55 insertions, 57 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 659366734f3f..1b55952a17f6 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #ifdef __KERNEL__ | 32 | #ifdef __KERNEL__ |
33 | #include <linux/timer.h> | 33 | #include <linux/timer.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/mm.h> | ||
35 | #include <asm/atomic.h> | 36 | #include <asm/atomic.h> |
36 | #include <asm/cache.h> | 37 | #include <asm/cache.h> |
37 | #include <asm/byteorder.h> | 38 | #include <asm/byteorder.h> |
@@ -96,7 +97,7 @@ struct wireless_dev; | |||
96 | * Compute the worst case header length according to the protocols | 97 | * Compute the worst case header length according to the protocols |
97 | * used. | 98 | * used. |
98 | */ | 99 | */ |
99 | 100 | ||
100 | #if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | 101 | #if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) |
101 | # if defined(CONFIG_MAC80211_MESH) | 102 | # if defined(CONFIG_MAC80211_MESH) |
102 | # define LL_MAX_HEADER 128 | 103 | # define LL_MAX_HEADER 128 |
@@ -124,7 +125,7 @@ struct wireless_dev; | |||
124 | * Network device statistics. Akin to the 2.0 ether stats but | 125 | * Network device statistics. Akin to the 2.0 ether stats but |
125 | * with byte counters. | 126 | * with byte counters. |
126 | */ | 127 | */ |
127 | 128 | ||
128 | struct net_device_stats | 129 | struct net_device_stats |
129 | { | 130 | { |
130 | unsigned long rx_packets; /* total packets received */ | 131 | unsigned long rx_packets; /* total packets received */ |
@@ -285,7 +286,7 @@ enum netdev_state_t | |||
285 | 286 | ||
286 | /* | 287 | /* |
287 | * This structure holds at boot time configured netdevice settings. They | 288 | * This structure holds at boot time configured netdevice settings. They |
288 | * are then used in the device probing. | 289 | * are then used in the device probing. |
289 | */ | 290 | */ |
290 | struct netdev_boot_setup { | 291 | struct netdev_boot_setup { |
291 | char name[IFNAMSIZ]; | 292 | char name[IFNAMSIZ]; |
@@ -314,6 +315,9 @@ struct napi_struct { | |||
314 | spinlock_t poll_lock; | 315 | spinlock_t poll_lock; |
315 | int poll_owner; | 316 | int poll_owner; |
316 | #endif | 317 | #endif |
318 | |||
319 | unsigned int gro_count; | ||
320 | |||
317 | struct net_device *dev; | 321 | struct net_device *dev; |
318 | struct list_head dev_list; | 322 | struct list_head dev_list; |
319 | struct sk_buff *gro_list; | 323 | struct sk_buff *gro_list; |
@@ -327,6 +331,14 @@ enum | |||
327 | NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ | 331 | NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ |
328 | }; | 332 | }; |
329 | 333 | ||
334 | enum { | ||
335 | GRO_MERGED, | ||
336 | GRO_MERGED_FREE, | ||
337 | GRO_HELD, | ||
338 | GRO_NORMAL, | ||
339 | GRO_DROP, | ||
340 | }; | ||
341 | |||
330 | extern void __napi_schedule(struct napi_struct *n); | 342 | extern void __napi_schedule(struct napi_struct *n); |
331 | 343 | ||
332 | static inline int napi_disable_pending(struct napi_struct *n) | 344 | static inline int napi_disable_pending(struct napi_struct *n) |
@@ -740,7 +752,7 @@ struct net_device | |||
740 | void *dsa_ptr; /* dsa specific data */ | 752 | void *dsa_ptr; /* dsa specific data */ |
741 | #endif | 753 | #endif |
742 | void *atalk_ptr; /* AppleTalk link */ | 754 | void *atalk_ptr; /* AppleTalk link */ |
743 | void *ip_ptr; /* IPv4 specific data */ | 755 | void *ip_ptr; /* IPv4 specific data */ |
744 | void *dn_ptr; /* DECnet specific data */ | 756 | void *dn_ptr; /* DECnet specific data */ |
745 | void *ip6_ptr; /* IPv6 specific data */ | 757 | void *ip6_ptr; /* IPv6 specific data */ |
746 | void *ec_ptr; /* Econet specific data */ | 758 | void *ec_ptr; /* Econet specific data */ |
@@ -753,7 +765,7 @@ struct net_device | |||
753 | */ | 765 | */ |
754 | unsigned long last_rx; /* Time of last Rx */ | 766 | unsigned long last_rx; /* Time of last Rx */ |
755 | /* Interface address info used in eth_type_trans() */ | 767 | /* Interface address info used in eth_type_trans() */ |
756 | unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast | 768 | unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast |
757 | because most packets are unicast) */ | 769 | because most packets are unicast) */ |
758 | 770 | ||
759 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | 771 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ |
@@ -984,6 +996,9 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi, | |||
984 | void netif_napi_del(struct napi_struct *napi); | 996 | void netif_napi_del(struct napi_struct *napi); |
985 | 997 | ||
986 | struct napi_gro_cb { | 998 | struct napi_gro_cb { |
999 | /* This indicates where we are processing relative to skb->data. */ | ||
1000 | int data_offset; | ||
1001 | |||
987 | /* This is non-zero if the packet may be of the same flow. */ | 1002 | /* This is non-zero if the packet may be of the same flow. */ |
988 | int same_flow; | 1003 | int same_flow; |
989 | 1004 | ||
@@ -1088,6 +1103,36 @@ extern int dev_restart(struct net_device *dev); | |||
1088 | #ifdef CONFIG_NETPOLL_TRAP | 1103 | #ifdef CONFIG_NETPOLL_TRAP |
1089 | extern int netpoll_trap(void); | 1104 | extern int netpoll_trap(void); |
1090 | #endif | 1105 | #endif |
1106 | extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen); | ||
1107 | extern int skb_gro_receive(struct sk_buff **head, | ||
1108 | struct sk_buff *skb); | ||
1109 | |||
1110 | static inline unsigned int skb_gro_offset(const struct sk_buff *skb) | ||
1111 | { | ||
1112 | return NAPI_GRO_CB(skb)->data_offset; | ||
1113 | } | ||
1114 | |||
1115 | static inline unsigned int skb_gro_len(const struct sk_buff *skb) | ||
1116 | { | ||
1117 | return skb->len - NAPI_GRO_CB(skb)->data_offset; | ||
1118 | } | ||
1119 | |||
1120 | static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len) | ||
1121 | { | ||
1122 | NAPI_GRO_CB(skb)->data_offset += len; | ||
1123 | } | ||
1124 | |||
1125 | static inline void skb_gro_reset_offset(struct sk_buff *skb) | ||
1126 | { | ||
1127 | NAPI_GRO_CB(skb)->data_offset = 0; | ||
1128 | } | ||
1129 | |||
1130 | static inline void *skb_gro_mac_header(struct sk_buff *skb) | ||
1131 | { | ||
1132 | return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) : | ||
1133 | page_address(skb_shinfo(skb)->frags[0].page) + | ||
1134 | skb_shinfo(skb)->frags[0].page_offset; | ||
1135 | } | ||
1091 | 1136 | ||
1092 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 1137 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
1093 | unsigned short type, | 1138 | unsigned short type, |
@@ -1376,12 +1421,15 @@ extern int netif_receive_skb(struct sk_buff *skb); | |||
1376 | extern void napi_gro_flush(struct napi_struct *napi); | 1421 | extern void napi_gro_flush(struct napi_struct *napi); |
1377 | extern int dev_gro_receive(struct napi_struct *napi, | 1422 | extern int dev_gro_receive(struct napi_struct *napi, |
1378 | struct sk_buff *skb); | 1423 | struct sk_buff *skb); |
1424 | extern int napi_skb_finish(int ret, struct sk_buff *skb); | ||
1379 | extern int napi_gro_receive(struct napi_struct *napi, | 1425 | extern int napi_gro_receive(struct napi_struct *napi, |
1380 | struct sk_buff *skb); | 1426 | struct sk_buff *skb); |
1381 | extern void napi_reuse_skb(struct napi_struct *napi, | 1427 | extern void napi_reuse_skb(struct napi_struct *napi, |
1382 | struct sk_buff *skb); | 1428 | struct sk_buff *skb); |
1383 | extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, | 1429 | extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, |
1384 | struct napi_gro_fraginfo *info); | 1430 | struct napi_gro_fraginfo *info); |
1431 | extern int napi_frags_finish(struct napi_struct *napi, | ||
1432 | struct sk_buff *skb, int ret); | ||
1385 | extern int napi_gro_frags(struct napi_struct *napi, | 1433 | extern int napi_gro_frags(struct napi_struct *napi, |
1386 | struct napi_gro_fraginfo *info); | 1434 | struct napi_gro_fraginfo *info); |
1387 | extern void netif_nit_deliver(struct sk_buff *skb); | 1435 | extern void netif_nit_deliver(struct sk_buff *skb); |
@@ -1575,56 +1623,6 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) | |||
1575 | return (1 << debug_value) - 1; | 1623 | return (1 << debug_value) - 1; |
1576 | } | 1624 | } |
1577 | 1625 | ||
1578 | /* Test if receive needs to be scheduled but only if up */ | ||
1579 | static inline int netif_rx_schedule_prep(struct napi_struct *napi) | ||
1580 | { | ||
1581 | return napi_schedule_prep(napi); | ||
1582 | } | ||
1583 | |||
1584 | /* Add interface to tail of rx poll list. This assumes that _prep has | ||
1585 | * already been called and returned 1. | ||
1586 | */ | ||
1587 | static inline void __netif_rx_schedule(struct napi_struct *napi) | ||
1588 | { | ||
1589 | __napi_schedule(napi); | ||
1590 | } | ||
1591 | |||
1592 | /* Try to reschedule poll. Called by irq handler. */ | ||
1593 | |||
1594 | static inline void netif_rx_schedule(struct napi_struct *napi) | ||
1595 | { | ||
1596 | if (netif_rx_schedule_prep(napi)) | ||
1597 | __netif_rx_schedule(napi); | ||
1598 | } | ||
1599 | |||
1600 | /* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ | ||
1601 | static inline int netif_rx_reschedule(struct napi_struct *napi) | ||
1602 | { | ||
1603 | if (napi_schedule_prep(napi)) { | ||
1604 | __netif_rx_schedule(napi); | ||
1605 | return 1; | ||
1606 | } | ||
1607 | return 0; | ||
1608 | } | ||
1609 | |||
1610 | /* same as netif_rx_complete, except that local_irq_save(flags) | ||
1611 | * has already been issued | ||
1612 | */ | ||
1613 | static inline void __netif_rx_complete(struct napi_struct *napi) | ||
1614 | { | ||
1615 | __napi_complete(napi); | ||
1616 | } | ||
1617 | |||
1618 | /* Remove interface from poll list: it must be in the poll list | ||
1619 | * on current cpu. This primitive is called by dev->poll(), when | ||
1620 | * it completes the work. The device cannot be out of poll list at this | ||
1621 | * moment, it is BUG(). | ||
1622 | */ | ||
1623 | static inline void netif_rx_complete(struct napi_struct *napi) | ||
1624 | { | ||
1625 | napi_complete(napi); | ||
1626 | } | ||
1627 | |||
1628 | static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) | 1626 | static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) |
1629 | { | 1627 | { |
1630 | spin_lock(&txq->_xmit_lock); | 1628 | spin_lock(&txq->_xmit_lock); |
@@ -1875,7 +1873,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) | |||
1875 | 1873 | ||
1876 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | 1874 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { |
1877 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && | 1875 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && |
1878 | skb->protocol == __constant_htons(ETH_P_ARP)) | 1876 | skb->protocol == __cpu_to_be16(ETH_P_ARP)) |
1879 | return 0; | 1877 | return 0; |
1880 | 1878 | ||
1881 | if (master->priv_flags & IFF_MASTER_ALB) { | 1879 | if (master->priv_flags & IFF_MASTER_ALB) { |
@@ -1884,7 +1882,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) | |||
1884 | return 0; | 1882 | return 0; |
1885 | } | 1883 | } |
1886 | if (master->priv_flags & IFF_MASTER_8023AD && | 1884 | if (master->priv_flags & IFF_MASTER_8023AD && |
1887 | skb->protocol == __constant_htons(ETH_P_SLOW)) | 1885 | skb->protocol == __cpu_to_be16(ETH_P_SLOW)) |
1888 | return 0; | 1886 | return 0; |
1889 | 1887 | ||
1890 | return 1; | 1888 | return 1; |