aboutsummaryrefslogtreecommitdiff
path: root/hw/net/cadence_gem.c
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@xilinx.com>2017-04-20 17:32:29 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-04-20 17:39:17 +0100
commitdacc0566acda512ebaf18ad051b387a56a3f7253 (patch)
treea6d24dba013b9528fe895c34a834de174fb7dcc9 /hw/net/cadence_gem.c
parent75b7760212b2cfa86977704a2c19a0d8daced5be (diff)
cadence_gem: Correct the multi-queue can rx logic
Correct the buffer descriptor busy logic to work correctly when using multiple queues. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Message-id: 8a7e8059984e27d46a276a66299d035a0afd280f.1491947224.git.alistair.francis@xilinx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/net/cadence_gem.c')
-rw-r--r--hw/net/cadence_gem.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index 17c229d486..a66a9cc922 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -481,14 +481,17 @@ static int gem_can_receive(NetClientState *nc)
}
for (i = 0; i < s->num_priority_queues; i++) {
- if (rx_desc_get_ownership(s->rx_desc[i]) == 1) {
- if (s->can_rx_state != 2) {
- s->can_rx_state = 2;
- DB_PRINT("can't receive - busy buffer descriptor (q%d) 0x%x\n",
- i, s->rx_desc_addr[i]);
- }
- return 0;
+ if (rx_desc_get_ownership(s->rx_desc[i]) != 1) {
+ break;
+ }
+ };
+
+ if (i == s->num_priority_queues) {
+ if (s->can_rx_state != 2) {
+ s->can_rx_state = 2;
+ DB_PRINT("can't receive - all the buffer descriptors are busy\n");
}
+ return 0;
}
if (s->can_rx_state != 0) {