00204e374e37f2f9a213d47245b51b5c240c719f
[openwrt/svn-archive/archive.git] / target / linux / ps3 / patches-2.6.28 / 0016-ps3-gelic-fix-rxdmac.patch
1 Subject: net/ps3_gelic: Fix RX DMA restart
2
3 Fix the condition where PS3 network RX hangs when no network
4 TX is occuring by calling gelic_card_enable_rxdmac() during
5 RX_DMA_CHAIN_END event processing.
6
7 The gelic hardware automatically clears its RX_DMA_EN flag when
8 it detects an RX_DMA_CHAIN_END event. In its processing of
9 RX_DMA_CHAIN_END the gelic driver is required to set RX_DMA_EN
10 (with a call to gelic_card_enable_rxdmac()) to restart RX DMA
11 transfers. The existing gelic driver code does not set
12 RX_DMA_EN directly in its processing of the RX_DMA_CHAIN_END
13 event, but uses a flag variable card->rx_dma_restart_required
14 to schedule the setting of RX_DMA_EN until next inside the
15 interrupt handler.
16
17 It seems this delayed setting of RX_DMA_EN causes the hang since
18 the next RX interrupt after the RX_DMA_CHAIN_END event where
19 RX_DMA_EN is scheduled to be set will not occur since RX_DMA_EN
20 was not set. In the case were network TX is occuring, RX_DMA_EN
21 is set in the next TX interrupt and RX processing continues.
22
23 Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
24 ---
25 drivers/net/ps3_gelic_net.c | 21 ++++++++-------------
26 drivers/net/ps3_gelic_net.h | 1 -
27 2 files changed, 8 insertions(+), 14 deletions(-)
28
29 --- a/drivers/net/ps3_gelic_net.c
30 +++ b/drivers/net/ps3_gelic_net.c
31 @@ -970,10 +970,6 @@ static int gelic_card_decode_one_descr(s
32 int dmac_chain_ended;
33
34 status = gelic_descr_get_status(descr);
35 - /* is this descriptor terminated with next_descr == NULL? */
36 - dmac_chain_ended =
37 - be32_to_cpu(descr->dmac_cmd_status) &
38 - GELIC_DESCR_RX_DMA_CHAIN_END;
39
40 if (status == GELIC_DESCR_DMA_CARDOWNED)
41 return 0;
42 @@ -1036,6 +1032,11 @@ static int gelic_card_decode_one_descr(s
43 /* ok, we've got a packet in descr */
44 gelic_net_pass_skb_up(descr, card, netdev);
45 refill:
46 +
47 + /* is the current descriptor terminated with next_descr == NULL? */
48 + dmac_chain_ended =
49 + be32_to_cpu(descr->dmac_cmd_status) &
50 + GELIC_DESCR_RX_DMA_CHAIN_END;
51 /*
52 * So that always DMAC can see the end
53 * of the descriptor chain to avoid
54 @@ -1064,10 +1065,9 @@ refill:
55 * If dmac chain was met, DMAC stopped.
56 * thus re-enable it
57 */
58 - if (dmac_chain_ended) {
59 - card->rx_dma_restart_required = 1;
60 - dev_dbg(ctodev(card), "reenable rx dma scheduled\n");
61 - }
62 +
63 + if (dmac_chain_ended)
64 + gelic_card_enable_rxdmac(card);
65
66 return 1;
67 }
68 @@ -1133,11 +1133,6 @@ static irqreturn_t gelic_card_interrupt(
69
70 status &= card->irq_mask;
71
72 - if (card->rx_dma_restart_required) {
73 - card->rx_dma_restart_required = 0;
74 - gelic_card_enable_rxdmac(card);
75 - }
76 -
77 if (status & GELIC_CARD_RXINT) {
78 gelic_card_rx_irq_off(card);
79 napi_schedule(&card->napi);
80 --- a/drivers/net/ps3_gelic_net.h
81 +++ b/drivers/net/ps3_gelic_net.h
82 @@ -284,7 +284,6 @@ struct gelic_card {
83
84 struct gelic_descr_chain tx_chain;
85 struct gelic_descr_chain rx_chain;
86 - int rx_dma_restart_required;
87 int rx_csum;
88 /*
89 * tx_lock guards tx descriptor list and