Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122714
b: refs/heads/master
c: d565b0a
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Dec 16, 2008
1 parent 0b0ea26 commit 96a87cb
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 60 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1a881f27c50b4fbd6858a8696a189263621136b0
refs/heads/master: d565b0a1a9b6ee7dff46e1f68b26b526ac11ae50
80 changes: 28 additions & 52 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,9 @@ struct napi_struct {
spinlock_t poll_lock;
int poll_owner;
struct net_device *dev;
struct list_head dev_list;
#endif
struct list_head dev_list;
struct sk_buff *gro_list;
};

enum
Expand Down Expand Up @@ -376,22 +377,8 @@ static inline int napi_reschedule(struct napi_struct *napi)
*
* Mark NAPI processing as complete.
*/
static inline void __napi_complete(struct napi_struct *n)
{
BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
list_del(&n->poll_list);
smp_mb__before_clear_bit();
clear_bit(NAPI_STATE_SCHED, &n->state);
}

static inline void napi_complete(struct napi_struct *n)
{
unsigned long flags;

local_irq_save(flags);
__napi_complete(n);
local_irq_restore(flags);
}
extern void __napi_complete(struct napi_struct *n);
extern void napi_complete(struct napi_struct *n);

/**
* napi_disable - prevent NAPI from scheduling
Expand Down Expand Up @@ -640,9 +627,7 @@ struct net_device
unsigned long state;

struct list_head dev_list;
#ifdef CONFIG_NETPOLL
struct list_head napi_list;
#endif

/* Net device features */
unsigned long features;
Expand All @@ -661,6 +646,7 @@ struct net_device
#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
/* do not use LLTX in new drivers */
#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
#define NETIF_F_GRO 16384 /* Generic receive offload */
#define NETIF_F_LRO 32768 /* large receive offload */

/* Segmentation offload features */
Expand Down Expand Up @@ -984,35 +970,29 @@ static inline void *netdev_priv(const struct net_device *dev)
* netif_napi_add() must be used to initialize a napi context prior to calling
* *any* of the other napi related functions.
*/
static inline void netif_napi_add(struct net_device *dev,
struct napi_struct *napi,
int (*poll)(struct napi_struct *, int),
int weight)
{
INIT_LIST_HEAD(&napi->poll_list);
napi->poll = poll;
napi->weight = weight;
#ifdef CONFIG_NETPOLL
napi->dev = dev;
list_add(&napi->dev_list, &dev->napi_list);
spin_lock_init(&napi->poll_lock);
napi->poll_owner = -1;
#endif
set_bit(NAPI_STATE_SCHED, &napi->state);
}
void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
int (*poll)(struct napi_struct *, int), int weight);

/**
* netif_napi_del - remove a napi context
* @napi: napi context
*
* netif_napi_del() removes a napi context from the network device napi list
*/
static inline void netif_napi_del(struct napi_struct *napi)
{
#ifdef CONFIG_NETPOLL
list_del(&napi->dev_list);
#endif
}
void netif_napi_del(struct napi_struct *napi);

struct napi_gro_cb {
/* This is non-zero if the packet may be of the same flow. */
int same_flow;

/* This is non-zero if the packet cannot be merged with the new skb. */
int flush;

/* Number of segments aggregated. */
int count;
};

#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)

struct packet_type {
__be16 type; /* This is really htons(ether_type). */
Expand All @@ -1024,6 +1004,9 @@ struct packet_type {
struct sk_buff *(*gso_segment)(struct sk_buff *skb,
int features);
int (*gso_send_check)(struct sk_buff *skb);
struct sk_buff **(*gro_receive)(struct sk_buff **head,
struct sk_buff *skb);
int (*gro_complete)(struct sk_buff *skb);
void *af_packet_priv;
struct list_head list;
};
Expand Down Expand Up @@ -1377,6 +1360,9 @@ extern int netif_rx(struct sk_buff *skb);
extern int netif_rx_ni(struct sk_buff *skb);
#define HAVE_NETIF_RECEIVE_SKB 1
extern int netif_receive_skb(struct sk_buff *skb);
extern void napi_gro_flush(struct napi_struct *napi);
extern int napi_gro_receive(struct napi_struct *napi,
struct sk_buff *skb);
extern void netif_nit_deliver(struct sk_buff *skb);
extern int dev_valid_name(const char *name);
extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
Expand Down Expand Up @@ -1621,17 +1607,7 @@ static inline void __netif_rx_complete(struct net_device *dev,
static inline void netif_rx_complete(struct net_device *dev,
struct napi_struct *napi)
{
unsigned long flags;

/*
* don't let napi dequeue from the cpu poll list
* just in case its running on a different cpu
*/
if (unlikely(test_bit(NAPI_STATE_NPSVC, &napi->state)))
return;
local_irq_save(flags);
__netif_rx_complete(dev, napi);
local_irq_restore(flags);
napi_complete(napi);
}

static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
Expand Down
5 changes: 0 additions & 5 deletions trunk/include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ static inline void netpoll_poll_unlock(void *have)
rcu_read_unlock();
}

static inline void netpoll_netdev_init(struct net_device *dev)
{
INIT_LIST_HEAD(&dev->napi_list);
}

#else
static inline int netpoll_rx(struct sk_buff *skb)
{
Expand Down
Loading

0 comments on commit 96a87cb

Please sign in to comment.