* [dpdk-stable] [PATCH 1/2] net/ena: fix Rx descriptors allocation
@ 2017-05-18 15:41 Michal Krawczyk
2017-05-18 15:41 ` [dpdk-stable] [PATCH 2/2] net/ena: fix delayed cleanup of Rx descriptors Michal Krawczyk
2017-05-21 10:35 ` [dpdk-stable] [PATCH 1/2] net/ena: fix Rx descriptors allocation Yuanhan Liu
0 siblings, 2 replies; 3+ messages in thread
From: Michal Krawczyk @ 2017-05-18 15:41 UTC (permalink / raw)
To: stable; +Cc: mw, gtzalik, evgenys, Michal Krawczyk
[ backported from upstream commit a467e8f37a3eec98210c0c3ec04bf6e9506ddd81 ]
When application tried to allocate 1024 descriptors, device was not
initializing properly.
This patch solves it by avoiding allocation of all descriptors in the
ring in one attempt. At least one descriptor must remain unused in the
HW ring.
Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Jakub Palider <jpalider@gmail.com>
Acked-by: Jan Medala <jan.medala@outlook.com>
---
drivers/net/ena/ena_ethdev.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index a62db65..f24fd26 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -908,7 +908,7 @@ static int ena_start(struct rte_eth_dev *dev)
static int ena_queue_restart(struct ena_ring *ring)
{
- int rc;
+ int rc, bufs_num;
ena_assert_msg(ring->configured == 1,
"Trying to restart unconfigured queue\n");
@@ -919,9 +919,10 @@ static int ena_queue_restart(struct ena_ring *ring)
if (ring->type == ENA_RING_TYPE_TX)
return 0;
- rc = ena_populate_rx_queue(ring, ring->ring_size);
- if ((unsigned int)rc != ring->ring_size) {
- PMD_INIT_LOG(ERR, "Failed to populate rx ring !\n");
+ bufs_num = ring->ring_size - 1;
+ rc = ena_populate_rx_queue(ring, bufs_num);
+ if (rc != bufs_num) {
+ PMD_INIT_LOG(ERR, "Failed to populate rx ring !");
return (-1);
}
@@ -1132,7 +1133,7 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count)
return 0;
in_use = rxq->next_to_use - rxq->next_to_clean;
- ena_assert_msg(((in_use + count) <= ring_size), "bad ring state");
+ ena_assert_msg(((in_use + count) < ring_size), "bad ring state");
count = RTE_MIN(count,
(uint16_t)(ring_size - (next_to_use & ring_mask)));
@@ -1558,6 +1559,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
recv_idx++;
}
+ desc_in_use += 1;
/* Burst refill to save doorbells, memory barriers, const interval */
if (ring_size - desc_in_use > ENA_RING_DESCS_RATIO(ring_size))
ena_populate_rx_queue(rx_ring, ring_size - desc_in_use);
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-stable] [PATCH 2/2] net/ena: fix delayed cleanup of Rx descriptors
2017-05-18 15:41 [dpdk-stable] [PATCH 1/2] net/ena: fix Rx descriptors allocation Michal Krawczyk
@ 2017-05-18 15:41 ` Michal Krawczyk
2017-05-21 10:35 ` [dpdk-stable] [PATCH 1/2] net/ena: fix Rx descriptors allocation Yuanhan Liu
1 sibling, 0 replies; 3+ messages in thread
From: Michal Krawczyk @ 2017-05-18 15:41 UTC (permalink / raw)
To: stable; +Cc: mw, gtzalik, evgenys, Michal Krawczyk
[ backported from upstream commit ec78af6bc0556cf2a1133185ca33fb835b38afe0 ]
On RX path, after receiving bunch of packets, variable tracking
available descriptors in HW queue was not updated.
To fix this issue, variable tracking used descriptors must be updated
after receiving packets - it must be reduced by the amount of received
descriptors in current batch.
Additionally, variable next_to_clean in rx_ring must be updated before
entering ena_populate_rx_queue() to keep it up to date with the current
ring state.
Fixes: 1daff5260ff8 ("net/ena: use unmasked head and tail")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Jakub Palider <jpalider@gmail.com>
Acked-by: Jan Medala <jan.medala@outlook.com>
---
drivers/net/ena/ena_ethdev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index f24fd26..1fc3654 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1559,13 +1559,13 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
recv_idx++;
}
- desc_in_use += 1;
+ rx_ring->next_to_clean = next_to_clean;
+
+ desc_in_use = desc_in_use - completed + 1;
/* Burst refill to save doorbells, memory barriers, const interval */
if (ring_size - desc_in_use > ENA_RING_DESCS_RATIO(ring_size))
ena_populate_rx_queue(rx_ring, ring_size - desc_in_use);
- rx_ring->next_to_clean = next_to_clean;
-
return recv_idx;
}
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [PATCH 1/2] net/ena: fix Rx descriptors allocation
2017-05-18 15:41 [dpdk-stable] [PATCH 1/2] net/ena: fix Rx descriptors allocation Michal Krawczyk
2017-05-18 15:41 ` [dpdk-stable] [PATCH 2/2] net/ena: fix delayed cleanup of Rx descriptors Michal Krawczyk
@ 2017-05-21 10:35 ` Yuanhan Liu
1 sibling, 0 replies; 3+ messages in thread
From: Yuanhan Liu @ 2017-05-21 10:35 UTC (permalink / raw)
To: Michal Krawczyk; +Cc: stable, mw, gtzalik, evgenys
On Thu, May 18, 2017 at 05:41:50PM +0200, Michal Krawczyk wrote:
> [ backported from upstream commit a467e8f37a3eec98210c0c3ec04bf6e9506ddd81 ]
Thanks for the backport, both applied to dpdk-stable/16.11.
--yliu
>
> When application tried to allocate 1024 descriptors, device was not
> initializing properly.
>
> This patch solves it by avoiding allocation of all descriptors in the
> ring in one attempt. At least one descriptor must remain unused in the
> HW ring.
>
> Fixes: 1173fca25af9 ("ena: add polling-mode driver")
> Cc: stable@dpdk.org
>
> Signed-off-by: Michal Krawczyk <mk@semihalf.com>
> Reviewed-by: Jakub Palider <jpalider@gmail.com>
> Acked-by: Jan Medala <jan.medala@outlook.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-21 10:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18 15:41 [dpdk-stable] [PATCH 1/2] net/ena: fix Rx descriptors allocation Michal Krawczyk
2017-05-18 15:41 ` [dpdk-stable] [PATCH 2/2] net/ena: fix delayed cleanup of Rx descriptors Michal Krawczyk
2017-05-21 10:35 ` [dpdk-stable] [PATCH 1/2] net/ena: fix Rx descriptors allocation Yuanhan Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).