Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104403
b: refs/heads/master
c: 1ffb40b
h: refs/heads/master
i:
  104401: a63bfa5
  104399: 5a6e092
v: v3
  • Loading branch information
Isaku Yamahata authored and Ingo Molnar committed Jul 16, 2008
1 parent eb7222d commit 643bf1a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 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: 8ba6c2b0958c332d2f3336f4ca9c116ed81f38e9
refs/heads/master: 1ffb40b8ecdf314edd88dc5550d6bcbebf29970b
19 changes: 15 additions & 4 deletions trunk/drivers/net/xen-netfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct netfront_info {
*/
union skb_entry {
struct sk_buff *skb;
unsigned link;
unsigned long link;
} tx_skbs[NET_TX_RING_SIZE];
grant_ref_t gref_tx_head;
grant_ref_t grant_tx_ref[NET_TX_RING_SIZE];
Expand Down Expand Up @@ -125,14 +125,25 @@ struct netfront_rx_info {
struct xen_netif_extra_info extras[XEN_NETIF_EXTRA_TYPE_MAX - 1];
};

static void skb_entry_set_link(union skb_entry *list, unsigned short id)
{
list->link = id;
}

static int skb_entry_is_link(const union skb_entry *list)
{
BUILD_BUG_ON(sizeof(list->skb) != sizeof(list->link));
return ((unsigned long)list->skb < PAGE_OFFSET);
}

/*
* Access macros for acquiring freeing slots in tx_skbs[].
*/

static void add_id_to_freelist(unsigned *head, union skb_entry *list,
unsigned short id)
{
list[id].link = *head;
skb_entry_set_link(&list[id], *head);
*head = id;
}

Expand Down Expand Up @@ -993,7 +1004,7 @@ static void xennet_release_tx_bufs(struct netfront_info *np)

for (i = 0; i < NET_TX_RING_SIZE; i++) {
/* Skip over entries which are actually freelist references */
if ((unsigned long)np->tx_skbs[i].skb < PAGE_OFFSET)
if (skb_entry_is_link(&np->tx_skbs[i]))
continue;

skb = np->tx_skbs[i].skb;
Expand Down Expand Up @@ -1123,7 +1134,7 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev
/* Initialise tx_skbs as a free chain containing every entry. */
np->tx_skb_freelist = 0;
for (i = 0; i < NET_TX_RING_SIZE; i++) {
np->tx_skbs[i].link = i+1;
skb_entry_set_link(&np->tx_skbs[i], i+1);
np->grant_tx_ref[i] = GRANT_INVALID_REF;
}

Expand Down

0 comments on commit 643bf1a

Please sign in to comment.