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.h79
1 files changed, 29 insertions, 50 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ec54785d34f9..7a5057fbb7cd 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -984,6 +984,9 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
984void netif_napi_del(struct napi_struct *napi); 984void netif_napi_del(struct napi_struct *napi);
985 985
986struct napi_gro_cb { 986struct napi_gro_cb {
987 /* This indicates where we are processing relative to skb->data. */
988 int data_offset;
989
987 /* This is non-zero if the packet may be of the same flow. */ 990 /* This is non-zero if the packet may be of the same flow. */
988 int same_flow; 991 int same_flow;
989 992
@@ -1087,6 +1090,29 @@ extern int dev_restart(struct net_device *dev);
1087#ifdef CONFIG_NETPOLL_TRAP 1090#ifdef CONFIG_NETPOLL_TRAP
1088extern int netpoll_trap(void); 1091extern int netpoll_trap(void);
1089#endif 1092#endif
1093extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen);
1094extern int skb_gro_receive(struct sk_buff **head,
1095 struct sk_buff *skb);
1096
1097static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1098{
1099 return NAPI_GRO_CB(skb)->data_offset;
1100}
1101
1102static inline unsigned int skb_gro_len(const struct sk_buff *skb)
1103{
1104 return skb->len - NAPI_GRO_CB(skb)->data_offset;
1105}
1106
1107static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
1108{
1109 NAPI_GRO_CB(skb)->data_offset += len;
1110}
1111
1112static inline void skb_gro_reset_offset(struct sk_buff *skb)
1113{
1114 NAPI_GRO_CB(skb)->data_offset = 0;
1115}
1090 1116
1091static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1117static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
1092 unsigned short type, 1118 unsigned short type,
@@ -1375,12 +1401,15 @@ extern int netif_receive_skb(struct sk_buff *skb);
1375extern void napi_gro_flush(struct napi_struct *napi); 1401extern void napi_gro_flush(struct napi_struct *napi);
1376extern int dev_gro_receive(struct napi_struct *napi, 1402extern int dev_gro_receive(struct napi_struct *napi,
1377 struct sk_buff *skb); 1403 struct sk_buff *skb);
1404extern int napi_skb_finish(int ret, struct sk_buff *skb);
1378extern int napi_gro_receive(struct napi_struct *napi, 1405extern int napi_gro_receive(struct napi_struct *napi,
1379 struct sk_buff *skb); 1406 struct sk_buff *skb);
1380extern void napi_reuse_skb(struct napi_struct *napi, 1407extern void napi_reuse_skb(struct napi_struct *napi,
1381 struct sk_buff *skb); 1408 struct sk_buff *skb);
1382extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, 1409extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
1383 struct napi_gro_fraginfo *info); 1410 struct napi_gro_fraginfo *info);
1411extern int napi_frags_finish(struct napi_struct *napi,
1412 struct sk_buff *skb, int ret);
1384extern int napi_gro_frags(struct napi_struct *napi, 1413extern int napi_gro_frags(struct napi_struct *napi,
1385 struct napi_gro_fraginfo *info); 1414 struct napi_gro_fraginfo *info);
1386extern void netif_nit_deliver(struct sk_buff *skb); 1415extern void netif_nit_deliver(struct sk_buff *skb);
@@ -1574,56 +1603,6 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1574 return (1 << debug_value) - 1; 1603 return (1 << debug_value) - 1;
1575} 1604}
1576 1605
1577/* Test if receive needs to be scheduled but only if up */
1578static inline int netif_rx_schedule_prep(struct napi_struct *napi)
1579{
1580 return napi_schedule_prep(napi);
1581}
1582
1583/* Add interface to tail of rx poll list. This assumes that _prep has
1584 * already been called and returned 1.
1585 */
1586static inline void __netif_rx_schedule(struct napi_struct *napi)
1587{
1588 __napi_schedule(napi);
1589}
1590
1591/* Try to reschedule poll. Called by irq handler. */
1592
1593static inline void netif_rx_schedule(struct napi_struct *napi)
1594{
1595 if (netif_rx_schedule_prep(napi))
1596 __netif_rx_schedule(napi);
1597}
1598
1599/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
1600static inline int netif_rx_reschedule(struct napi_struct *napi)
1601{
1602 if (napi_schedule_prep(napi)) {
1603 __netif_rx_schedule(napi);
1604 return 1;
1605 }
1606 return 0;
1607}
1608
1609/* same as netif_rx_complete, except that local_irq_save(flags)
1610 * has already been issued
1611 */
1612static inline void __netif_rx_complete(struct napi_struct *napi)
1613{
1614 __napi_complete(napi);
1615}
1616
1617/* Remove interface from poll list: it must be in the poll list
1618 * on current cpu. This primitive is called by dev->poll(), when
1619 * it completes the work. The device cannot be out of poll list at this
1620 * moment, it is BUG().
1621 */
1622static inline void netif_rx_complete(struct napi_struct *napi)
1623{
1624 napi_complete(napi);
1625}
1626
1627static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1606static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
1628{ 1607{
1629 spin_lock(&txq->_xmit_lock); 1608 spin_lock(&txq->_xmit_lock);