Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158767
b: refs/heads/master
c: 50f238f
h: refs/heads/master
i:
  158765: cc7e457
  158763: fcb8426
  158759: ff66c47
  158751: 95f07ac
v: v3
  • Loading branch information
Anton Vorontsov authored and David S. Miller committed Jul 8, 2009
1 parent 30570fd commit f1c7946
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 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: ef0657c49e0f93dcebc9b4719e4fe0b478411f60
refs/heads/master: 50f238fdf38e37f0350be17c36e3ec0fd298cc40
40 changes: 28 additions & 12 deletions trunk/drivers/net/ucc_geth.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,10 @@ static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth,
{
struct sk_buff *skb = NULL;

skb = dev_alloc_skb(ugeth->ug_info->uf_info.max_rx_buf_length +
UCC_GETH_RX_DATA_BUF_ALIGNMENT);

skb = __skb_dequeue(&ugeth->rx_recycle);
if (!skb)
skb = dev_alloc_skb(ugeth->ug_info->uf_info.max_rx_buf_length +
UCC_GETH_RX_DATA_BUF_ALIGNMENT);
if (skb == NULL)
return NULL;

Expand Down Expand Up @@ -1986,6 +1987,8 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth)
iounmap(ugeth->ug_regs);
ugeth->ug_regs = NULL;
}

skb_queue_purge(&ugeth->rx_recycle);
}

static void ucc_geth_set_multi(struct net_device *dev)
Expand Down Expand Up @@ -2202,6 +2205,8 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
return -ENOMEM;
}

skb_queue_head_init(&ugeth->rx_recycle);

return 0;
}

Expand Down Expand Up @@ -3208,8 +3213,10 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
if (netif_msg_rx_err(ugeth))
ugeth_err("%s, %d: ERROR!!! skb - 0x%08x",
__func__, __LINE__, (u32) skb);
if (skb)
dev_kfree_skb_any(skb);
if (skb) {
skb->data = skb->head + NET_SKB_PAD;
__skb_queue_head(&ugeth->rx_recycle, skb);
}

ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = NULL;
dev->stats.rx_dropped++;
Expand Down Expand Up @@ -3267,6 +3274,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)

/* Normal processing. */
while ((bd_status & T_R) == 0) {
struct sk_buff *skb;

/* BD contains already transmitted buffer. */
/* Handle the transmitted buffer and release */
/* the BD to be used with the current frame */
Expand All @@ -3276,9 +3285,16 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)

dev->stats.tx_packets++;

/* Free the sk buffer associated with this TxBD */
dev_kfree_skb(ugeth->
tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]);
skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];

if (skb_queue_len(&ugeth->rx_recycle) < RX_BD_RING_LEN &&
skb_recycle_check(skb,
ugeth->ug_info->uf_info.max_rx_buf_length +
UCC_GETH_RX_DATA_BUF_ALIGNMENT))
__skb_queue_head(&ugeth->rx_recycle, skb);
else
dev_kfree_skb(skb);

ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL;
ugeth->skb_dirtytx[txQ] =
(ugeth->skb_dirtytx[txQ] +
Expand Down Expand Up @@ -3307,16 +3323,16 @@ static int ucc_geth_poll(struct napi_struct *napi, int budget)

ug_info = ugeth->ug_info;

howmany = 0;
for (i = 0; i < ug_info->numQueuesRx; i++)
howmany += ucc_geth_rx(ugeth, i, budget - howmany);

/* Tx event processing */
spin_lock(&ugeth->lock);
for (i = 0; i < ug_info->numQueuesTx; i++)
ucc_geth_tx(ugeth->ndev, i);
spin_unlock(&ugeth->lock);

howmany = 0;
for (i = 0; i < ug_info->numQueuesRx; i++)
howmany += ucc_geth_rx(ugeth, i, budget - howmany);

if (howmany < budget) {
napi_complete(napi);
setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS | UCCE_TX_EVENTS);
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/net/ucc_geth.h
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,8 @@ struct ucc_geth_private {
/* index of the first skb which hasn't been transmitted yet. */
u16 skb_dirtytx[NUM_TX_QUEUES];

struct sk_buff_head rx_recycle;

struct ugeth_mii_info *mii_info;
struct phy_device *phydev;
phy_interface_t phy_interface;
Expand Down

0 comments on commit f1c7946

Please sign in to comment.