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.h111
1 files changed, 54 insertions, 57 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 659366734f3f..be3ebd7e8ce5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -96,7 +96,7 @@ struct wireless_dev;
96 * Compute the worst case header length according to the protocols 96 * Compute the worst case header length according to the protocols
97 * used. 97 * used.
98 */ 98 */
99 99
100#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 100#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
101# if defined(CONFIG_MAC80211_MESH) 101# if defined(CONFIG_MAC80211_MESH)
102# define LL_MAX_HEADER 128 102# define LL_MAX_HEADER 128
@@ -124,7 +124,7 @@ struct wireless_dev;
124 * Network device statistics. Akin to the 2.0 ether stats but 124 * Network device statistics. Akin to the 2.0 ether stats but
125 * with byte counters. 125 * with byte counters.
126 */ 126 */
127 127
128struct net_device_stats 128struct net_device_stats
129{ 129{
130 unsigned long rx_packets; /* total packets received */ 130 unsigned long rx_packets; /* total packets received */
@@ -285,7 +285,7 @@ enum netdev_state_t
285 285
286/* 286/*
287 * This structure holds at boot time configured netdevice settings. They 287 * This structure holds at boot time configured netdevice settings. They
288 * are then used in the device probing. 288 * are then used in the device probing.
289 */ 289 */
290struct netdev_boot_setup { 290struct netdev_boot_setup {
291 char name[IFNAMSIZ]; 291 char name[IFNAMSIZ];
@@ -314,6 +314,9 @@ struct napi_struct {
314 spinlock_t poll_lock; 314 spinlock_t poll_lock;
315 int poll_owner; 315 int poll_owner;
316#endif 316#endif
317
318 unsigned int gro_count;
319
317 struct net_device *dev; 320 struct net_device *dev;
318 struct list_head dev_list; 321 struct list_head dev_list;
319 struct sk_buff *gro_list; 322 struct sk_buff *gro_list;
@@ -327,6 +330,14 @@ enum
327 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ 330 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
328}; 331};
329 332
333enum {
334 GRO_MERGED,
335 GRO_MERGED_FREE,
336 GRO_HELD,
337 GRO_NORMAL,
338 GRO_DROP,
339};
340
330extern void __napi_schedule(struct napi_struct *n); 341extern void __napi_schedule(struct napi_struct *n);
331 342
332static inline int napi_disable_pending(struct napi_struct *n) 343static inline int napi_disable_pending(struct napi_struct *n)
@@ -740,7 +751,7 @@ struct net_device
740 void *dsa_ptr; /* dsa specific data */ 751 void *dsa_ptr; /* dsa specific data */
741#endif 752#endif
742 void *atalk_ptr; /* AppleTalk link */ 753 void *atalk_ptr; /* AppleTalk link */
743 void *ip_ptr; /* IPv4 specific data */ 754 void *ip_ptr; /* IPv4 specific data */
744 void *dn_ptr; /* DECnet specific data */ 755 void *dn_ptr; /* DECnet specific data */
745 void *ip6_ptr; /* IPv6 specific data */ 756 void *ip6_ptr; /* IPv6 specific data */
746 void *ec_ptr; /* Econet specific data */ 757 void *ec_ptr; /* Econet specific data */
@@ -753,7 +764,7 @@ struct net_device
753 */ 764 */
754 unsigned long last_rx; /* Time of last Rx */ 765 unsigned long last_rx; /* Time of last Rx */
755 /* Interface address info used in eth_type_trans() */ 766 /* Interface address info used in eth_type_trans() */
756 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 767 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
757 because most packets are unicast) */ 768 because most packets are unicast) */
758 769
759 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 770 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
@@ -984,6 +995,9 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
984void netif_napi_del(struct napi_struct *napi); 995void netif_napi_del(struct napi_struct *napi);
985 996
986struct napi_gro_cb { 997struct napi_gro_cb {
998 /* This indicates where we are processing relative to skb->data. */
999 int data_offset;
1000
987 /* This is non-zero if the packet may be of the same flow. */ 1001 /* This is non-zero if the packet may be of the same flow. */
988 int same_flow; 1002 int same_flow;
989 1003
@@ -1088,6 +1102,36 @@ extern int dev_restart(struct net_device *dev);
1088#ifdef CONFIG_NETPOLL_TRAP 1102#ifdef CONFIG_NETPOLL_TRAP
1089extern int netpoll_trap(void); 1103extern int netpoll_trap(void);
1090#endif 1104#endif
1105extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen);
1106extern int skb_gro_receive(struct sk_buff **head,
1107 struct sk_buff *skb);
1108
1109static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1110{
1111 return NAPI_GRO_CB(skb)->data_offset;
1112}
1113
1114static inline unsigned int skb_gro_len(const struct sk_buff *skb)
1115{
1116 return skb->len - NAPI_GRO_CB(skb)->data_offset;
1117}
1118
1119static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
1120{
1121 NAPI_GRO_CB(skb)->data_offset += len;
1122}
1123
1124static inline void skb_gro_reset_offset(struct sk_buff *skb)
1125{
1126 NAPI_GRO_CB(skb)->data_offset = 0;
1127}
1128
1129static inline void *skb_gro_mac_header(struct sk_buff *skb)
1130{
1131 return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) :
1132 page_address(skb_shinfo(skb)->frags[0].page) +
1133 skb_shinfo(skb)->frags[0].page_offset;
1134}
1091 1135
1092static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1136static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
1093 unsigned short type, 1137 unsigned short type,
@@ -1376,12 +1420,15 @@ extern int netif_receive_skb(struct sk_buff *skb);
1376extern void napi_gro_flush(struct napi_struct *napi); 1420extern void napi_gro_flush(struct napi_struct *napi);
1377extern int dev_gro_receive(struct napi_struct *napi, 1421extern int dev_gro_receive(struct napi_struct *napi,
1378 struct sk_buff *skb); 1422 struct sk_buff *skb);
1423extern int napi_skb_finish(int ret, struct sk_buff *skb);
1379extern int napi_gro_receive(struct napi_struct *napi, 1424extern int napi_gro_receive(struct napi_struct *napi,
1380 struct sk_buff *skb); 1425 struct sk_buff *skb);
1381extern void napi_reuse_skb(struct napi_struct *napi, 1426extern void napi_reuse_skb(struct napi_struct *napi,
1382 struct sk_buff *skb); 1427 struct sk_buff *skb);
1383extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, 1428extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
1384 struct napi_gro_fraginfo *info); 1429 struct napi_gro_fraginfo *info);
1430extern int napi_frags_finish(struct napi_struct *napi,
1431 struct sk_buff *skb, int ret);
1385extern int napi_gro_frags(struct napi_struct *napi, 1432extern int napi_gro_frags(struct napi_struct *napi,
1386 struct napi_gro_fraginfo *info); 1433 struct napi_gro_fraginfo *info);
1387extern void netif_nit_deliver(struct sk_buff *skb); 1434extern void netif_nit_deliver(struct sk_buff *skb);
@@ -1575,56 +1622,6 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1575 return (1 << debug_value) - 1; 1622 return (1 << debug_value) - 1;
1576} 1623}
1577 1624
1578/* Test if receive needs to be scheduled but only if up */
1579static 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 */
1587static 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
1594static 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(). */
1601static 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 */
1613static 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 */
1623static inline void netif_rx_complete(struct napi_struct *napi)
1624{
1625 napi_complete(napi);
1626}
1627
1628static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1625static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
1629{ 1626{
1630 spin_lock(&txq->_xmit_lock); 1627 spin_lock(&txq->_xmit_lock);
@@ -1875,7 +1872,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1875 1872
1876 if (dev->priv_flags & IFF_SLAVE_INACTIVE) { 1873 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1877 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1874 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1878 skb->protocol == __constant_htons(ETH_P_ARP)) 1875 skb->protocol == __cpu_to_be16(ETH_P_ARP))
1879 return 0; 1876 return 0;
1880 1877
1881 if (master->priv_flags & IFF_MASTER_ALB) { 1878 if (master->priv_flags & IFF_MASTER_ALB) {
@@ -1884,7 +1881,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1884 return 0; 1881 return 0;
1885 } 1882 }
1886 if (master->priv_flags & IFF_MASTER_8023AD && 1883 if (master->priv_flags & IFF_MASTER_8023AD &&
1887 skb->protocol == __constant_htons(ETH_P_SLOW)) 1884 skb->protocol == __cpu_to_be16(ETH_P_SLOW))
1888 return 0; 1885 return 0;
1889 1886
1890 return 1; 1887 return 1;