diff options
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 103 |
1 files changed, 46 insertions, 57 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 659366734f3f..493b065f76d7 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 | ||
128 | struct net_device_stats | 128 | struct 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 | */ |
290 | struct netdev_boot_setup { | 290 | struct 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; |
@@ -740,7 +743,7 @@ struct net_device | |||
740 | void *dsa_ptr; /* dsa specific data */ | 743 | void *dsa_ptr; /* dsa specific data */ |
741 | #endif | 744 | #endif |
742 | void *atalk_ptr; /* AppleTalk link */ | 745 | void *atalk_ptr; /* AppleTalk link */ |
743 | void *ip_ptr; /* IPv4 specific data */ | 746 | void *ip_ptr; /* IPv4 specific data */ |
744 | void *dn_ptr; /* DECnet specific data */ | 747 | void *dn_ptr; /* DECnet specific data */ |
745 | void *ip6_ptr; /* IPv6 specific data */ | 748 | void *ip6_ptr; /* IPv6 specific data */ |
746 | void *ec_ptr; /* Econet specific data */ | 749 | void *ec_ptr; /* Econet specific data */ |
@@ -753,7 +756,7 @@ struct net_device | |||
753 | */ | 756 | */ |
754 | unsigned long last_rx; /* Time of last Rx */ | 757 | unsigned long last_rx; /* Time of last Rx */ |
755 | /* Interface address info used in eth_type_trans() */ | 758 | /* Interface address info used in eth_type_trans() */ |
756 | unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast | 759 | unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast |
757 | because most packets are unicast) */ | 760 | because most packets are unicast) */ |
758 | 761 | ||
759 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | 762 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ |
@@ -984,6 +987,9 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi, | |||
984 | void netif_napi_del(struct napi_struct *napi); | 987 | void netif_napi_del(struct napi_struct *napi); |
985 | 988 | ||
986 | struct napi_gro_cb { | 989 | struct napi_gro_cb { |
990 | /* This indicates where we are processing relative to skb->data. */ | ||
991 | int data_offset; | ||
992 | |||
987 | /* This is non-zero if the packet may be of the same flow. */ | 993 | /* This is non-zero if the packet may be of the same flow. */ |
988 | int same_flow; | 994 | int same_flow; |
989 | 995 | ||
@@ -1088,6 +1094,36 @@ extern int dev_restart(struct net_device *dev); | |||
1088 | #ifdef CONFIG_NETPOLL_TRAP | 1094 | #ifdef CONFIG_NETPOLL_TRAP |
1089 | extern int netpoll_trap(void); | 1095 | extern int netpoll_trap(void); |
1090 | #endif | 1096 | #endif |
1097 | extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen); | ||
1098 | extern int skb_gro_receive(struct sk_buff **head, | ||
1099 | struct sk_buff *skb); | ||
1100 | |||
1101 | static inline unsigned int skb_gro_offset(const struct sk_buff *skb) | ||
1102 | { | ||
1103 | return NAPI_GRO_CB(skb)->data_offset; | ||
1104 | } | ||
1105 | |||
1106 | static inline unsigned int skb_gro_len(const struct sk_buff *skb) | ||
1107 | { | ||
1108 | return skb->len - NAPI_GRO_CB(skb)->data_offset; | ||
1109 | } | ||
1110 | |||
1111 | static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len) | ||
1112 | { | ||
1113 | NAPI_GRO_CB(skb)->data_offset += len; | ||
1114 | } | ||
1115 | |||
1116 | static inline void skb_gro_reset_offset(struct sk_buff *skb) | ||
1117 | { | ||
1118 | NAPI_GRO_CB(skb)->data_offset = 0; | ||
1119 | } | ||
1120 | |||
1121 | static inline void *skb_gro_mac_header(struct sk_buff *skb) | ||
1122 | { | ||
1123 | return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) : | ||
1124 | page_address(skb_shinfo(skb)->frags[0].page) + | ||
1125 | skb_shinfo(skb)->frags[0].page_offset; | ||
1126 | } | ||
1091 | 1127 | ||
1092 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 1128 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
1093 | unsigned short type, | 1129 | unsigned short type, |
@@ -1376,12 +1412,15 @@ extern int netif_receive_skb(struct sk_buff *skb); | |||
1376 | extern void napi_gro_flush(struct napi_struct *napi); | 1412 | extern void napi_gro_flush(struct napi_struct *napi); |
1377 | extern int dev_gro_receive(struct napi_struct *napi, | 1413 | extern int dev_gro_receive(struct napi_struct *napi, |
1378 | struct sk_buff *skb); | 1414 | struct sk_buff *skb); |
1415 | extern int napi_skb_finish(int ret, struct sk_buff *skb); | ||
1379 | extern int napi_gro_receive(struct napi_struct *napi, | 1416 | extern int napi_gro_receive(struct napi_struct *napi, |
1380 | struct sk_buff *skb); | 1417 | struct sk_buff *skb); |
1381 | extern void napi_reuse_skb(struct napi_struct *napi, | 1418 | extern void napi_reuse_skb(struct napi_struct *napi, |
1382 | struct sk_buff *skb); | 1419 | struct sk_buff *skb); |
1383 | extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, | 1420 | extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, |
1384 | struct napi_gro_fraginfo *info); | 1421 | struct napi_gro_fraginfo *info); |
1422 | extern int napi_frags_finish(struct napi_struct *napi, | ||
1423 | struct sk_buff *skb, int ret); | ||
1385 | extern int napi_gro_frags(struct napi_struct *napi, | 1424 | extern int napi_gro_frags(struct napi_struct *napi, |
1386 | struct napi_gro_fraginfo *info); | 1425 | struct napi_gro_fraginfo *info); |
1387 | extern void netif_nit_deliver(struct sk_buff *skb); | 1426 | extern void netif_nit_deliver(struct sk_buff *skb); |
@@ -1575,56 +1614,6 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) | |||
1575 | return (1 << debug_value) - 1; | 1614 | return (1 << debug_value) - 1; |
1576 | } | 1615 | } |
1577 | 1616 | ||
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) | 1617 | static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) |
1629 | { | 1618 | { |
1630 | spin_lock(&txq->_xmit_lock); | 1619 | spin_lock(&txq->_xmit_lock); |
@@ -1875,7 +1864,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) | |||
1875 | 1864 | ||
1876 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | 1865 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { |
1877 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && | 1866 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && |
1878 | skb->protocol == __constant_htons(ETH_P_ARP)) | 1867 | skb->protocol == __cpu_to_be16(ETH_P_ARP)) |
1879 | return 0; | 1868 | return 0; |
1880 | 1869 | ||
1881 | if (master->priv_flags & IFF_MASTER_ALB) { | 1870 | if (master->priv_flags & IFF_MASTER_ALB) { |
@@ -1884,7 +1873,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) | |||
1884 | return 0; | 1873 | return 0; |
1885 | } | 1874 | } |
1886 | if (master->priv_flags & IFF_MASTER_8023AD && | 1875 | if (master->priv_flags & IFF_MASTER_8023AD && |
1887 | skb->protocol == __constant_htons(ETH_P_SLOW)) | 1876 | skb->protocol == __cpu_to_be16(ETH_P_SLOW)) |
1888 | return 0; | 1877 | return 0; |
1889 | 1878 | ||
1890 | return 1; | 1879 | return 1; |