Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203340
b: refs/heads/master
c: fe62c29
h: refs/heads/master
v: v3
  • Loading branch information
Denis Kirjanov authored and David S. Miller committed Jul 2, 2010
1 parent 1680a9e commit f33017d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 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: ee3cb6295144b0adfa75ccaca307643a6998b1e2
refs/heads/master: fe62c298e5bcff8b3414205b7b54975918b3b5c4
25 changes: 23 additions & 2 deletions trunk/drivers/net/ll_temac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,29 @@ static int temac_dma_bd_init(struct net_device *ndev)
int i;

lp->rx_skb = kzalloc(sizeof(*lp->rx_skb) * RX_BD_NUM, GFP_KERNEL);
if (!lp->rx_skb) {
dev_err(&ndev->dev,
"can't allocate memory for DMA RX buffer\n");
goto out;
}
/* allocate the tx and rx ring buffer descriptors. */
/* returns a virtual addres and a physical address. */
lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
sizeof(*lp->tx_bd_v) * TX_BD_NUM,
&lp->tx_bd_p, GFP_KERNEL);
if (!lp->tx_bd_v) {
dev_err(&ndev->dev,
"unable to allocate DMA TX buffer descriptors");
goto out;
}
lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent,
sizeof(*lp->rx_bd_v) * RX_BD_NUM,
&lp->rx_bd_p, GFP_KERNEL);
if (!lp->rx_bd_v) {
dev_err(&ndev->dev,
"unable to allocate DMA RX buffer descriptors");
goto out;
}

memset(lp->tx_bd_v, 0, sizeof(*lp->tx_bd_v) * TX_BD_NUM);
for (i = 0; i < TX_BD_NUM; i++) {
Expand All @@ -227,7 +242,7 @@ static int temac_dma_bd_init(struct net_device *ndev)

if (skb == 0) {
dev_err(&ndev->dev, "alloc_skb error %d\n", i);
return -1;
goto out;
}
lp->rx_skb[i] = skb;
/* returns physical address of skb->data */
Expand Down Expand Up @@ -258,6 +273,9 @@ static int temac_dma_bd_init(struct net_device *ndev)
lp->dma_out(lp, TX_CURDESC_PTR, lp->tx_bd_p);

return 0;

out:
return -ENOMEM;
}

/* ---------------------------------------------------------------------
Expand Down Expand Up @@ -505,7 +523,10 @@ static void temac_device_reset(struct net_device *ndev)
}
lp->dma_out(lp, DMA_CONTROL_REG, DMA_TAIL_ENABLE);

temac_dma_bd_init(ndev);
if (temac_dma_bd_init(ndev)) {
dev_err(&ndev->dev,
"temac_device_reset descriptor allocation failed\n");
}

temac_indirect_out32(lp, XTE_RXC0_OFFSET, 0);
temac_indirect_out32(lp, XTE_RXC1_OFFSET, 0);
Expand Down

0 comments on commit f33017d

Please sign in to comment.