* [dpdk-dev] [PATCH] ena: fix doorbell submission when not needed
@ 2016-07-07 11:33 Jan Mędala
2016-07-08 11:11 ` [dpdk-dev] [PATCH v2] ena: doorbell fix Jan Medala
0 siblings, 1 reply; 4+ messages in thread
From: Jan Mędala @ 2016-07-07 11:33 UTC (permalink / raw)
To: dev; +Cc: Alexander Matushevsky, Jan Mędala
Avoid submitting doorbell when:
* no packets have been submitted to TX
* no free resources have been submitted while RX
Sending doorbell without actual work to be performed by device
violates ENA specification and can lead to unpredictable behavior.
Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
---
drivers/net/ena/ena_ethdev.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 702289b..d68e7ec 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -920,10 +920,14 @@ static int ena_populate_rx_queue(struct ena_ring
*rxq, unsigned int count)
next_to_use = ENA_RX_RING_IDX_NEXT(next_to_use, ring_size);
}
- rte_wmb();
- rxq->next_to_use = next_to_use;
- /* let HW know that it can fill buffers with data */
- ena_com_write_sq_doorbell(rxq->ena_com_io_sq);
+ /* When we submitted free recources to device... */
+ if (i > 0) {
+ /* ...let HW know that it can fill buffers with data */
+ rte_wmb();
+ ena_com_write_sq_doorbell(rxq->ena_com_io_sq);
+
+ rxq->next_to_use = next_to_use;
+ }
return i;
}
@@ -1316,7 +1320,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue,
struct rte_mbuf **tx_pkts,
struct ena_tx_buffer *tx_info;
struct ena_com_buf *ebuf;
uint16_t rc, req_id, total_tx_descs = 0;
- int sent_idx = 0;
+ uint16_t sent_idx = 0;
int nb_hw_desc;
/* Check adapter state */
@@ -1395,9 +1399,14 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue,
struct rte_mbuf **tx_pkts,
next_to_use = ENA_TX_RING_IDX_NEXT(next_to_use, ring_size);
}
- /* Let HW do it's best :-) */
- rte_wmb();
- ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
+ /* If there are ready packets to be xmitted... */
+ if (sent_idx > 0) {
+ /* ...let HW do its best :-) */
+ rte_wmb();
+ ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
+
+ tx_ring->next_to_use = next_to_use;
+ }
/* Clear complete packets */
while (ena_com_tx_comp_req_id_get(tx_ring->ena_com_io_cq, &req_id) >= 0) {
@@ -1420,9 +1429,11 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue,
struct rte_mbuf **tx_pkts,
break;
}
- /* acknowledge completion of sent packets */
- ena_com_comp_ack(tx_ring->ena_com_io_sq, total_tx_descs);
- tx_ring->next_to_use = next_to_use;
+ if (total_tx_descs > 0) {
+ /* acknowledge completion of sent packets */
+ ena_com_comp_ack(tx_ring->ena_com_io_sq, total_tx_descs);
+ }
+
return sent_idx;
}
--
2.8.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v2] ena: doorbell fix
2016-07-07 11:33 [dpdk-dev] [PATCH] ena: fix doorbell submission when not needed Jan Mędala
@ 2016-07-08 11:11 ` Jan Medala
2016-07-08 11:11 ` [dpdk-dev] [PATCH v2] ena: fix doorbell submission when not needed Jan Medala
0 siblings, 1 reply; 4+ messages in thread
From: Jan Medala @ 2016-07-08 11:11 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, Jan Medala
v2: resend patch, as previous one probably had some format corruption.
Jan Medala (1):
ena: fix doorbell submission when not needed
drivers/net/ena/ena_ethdev.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
--
2.9.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v2] ena: fix doorbell submission when not needed
2016-07-08 11:11 ` [dpdk-dev] [PATCH v2] ena: doorbell fix Jan Medala
@ 2016-07-08 11:11 ` Jan Medala
2016-07-08 21:03 ` Bruce Richardson
0 siblings, 1 reply; 4+ messages in thread
From: Jan Medala @ 2016-07-08 11:11 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, Jan Medala, Alexander Matushevsky
Avoid submitting doorbell when:
* no packets have been submitted to TX
* no free resources have been submitted while RX
Sending doorbell without actual work to be performed by device
violates ENA specification and can lead to unpredictable behavior.
Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
---
drivers/net/ena/ena_ethdev.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 702289b..d68e7ec 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -920,10 +920,14 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count)
next_to_use = ENA_RX_RING_IDX_NEXT(next_to_use, ring_size);
}
- rte_wmb();
- rxq->next_to_use = next_to_use;
- /* let HW know that it can fill buffers with data */
- ena_com_write_sq_doorbell(rxq->ena_com_io_sq);
+ /* When we submitted free recources to device... */
+ if (i > 0) {
+ /* ...let HW know that it can fill buffers with data */
+ rte_wmb();
+ ena_com_write_sq_doorbell(rxq->ena_com_io_sq);
+
+ rxq->next_to_use = next_to_use;
+ }
return i;
}
@@ -1316,7 +1320,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
struct ena_tx_buffer *tx_info;
struct ena_com_buf *ebuf;
uint16_t rc, req_id, total_tx_descs = 0;
- int sent_idx = 0;
+ uint16_t sent_idx = 0;
int nb_hw_desc;
/* Check adapter state */
@@ -1395,9 +1399,14 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
next_to_use = ENA_TX_RING_IDX_NEXT(next_to_use, ring_size);
}
- /* Let HW do it's best :-) */
- rte_wmb();
- ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
+ /* If there are ready packets to be xmitted... */
+ if (sent_idx > 0) {
+ /* ...let HW do its best :-) */
+ rte_wmb();
+ ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
+
+ tx_ring->next_to_use = next_to_use;
+ }
/* Clear complete packets */
while (ena_com_tx_comp_req_id_get(tx_ring->ena_com_io_cq, &req_id) >= 0) {
@@ -1420,9 +1429,11 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
break;
}
- /* acknowledge completion of sent packets */
- ena_com_comp_ack(tx_ring->ena_com_io_sq, total_tx_descs);
- tx_ring->next_to_use = next_to_use;
+ if (total_tx_descs > 0) {
+ /* acknowledge completion of sent packets */
+ ena_com_comp_ack(tx_ring->ena_com_io_sq, total_tx_descs);
+ }
+
return sent_idx;
}
--
2.9.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] ena: fix doorbell submission when not needed
2016-07-08 11:11 ` [dpdk-dev] [PATCH v2] ena: fix doorbell submission when not needed Jan Medala
@ 2016-07-08 21:03 ` Bruce Richardson
0 siblings, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2016-07-08 21:03 UTC (permalink / raw)
To: Jan Medala; +Cc: dev, thomas.monjalon, Alexander Matushevsky
On Fri, Jul 08, 2016 at 01:11:30PM +0200, Jan Medala wrote:
> Avoid submitting doorbell when:
> * no packets have been submitted to TX
> * no free resources have been submitted while RX
>
> Sending doorbell without actual work to be performed by device
> violates ENA specification and can lead to unpredictable behavior.
>
> Fixes: 1173fca25af9 ("ena: add polling-mode driver")
>
> Signed-off-by: Alexander Matushevsky <matua@amazon.com>
> Signed-off-by: Jan Medala <jan@semihalf.com>
> ---
Applied to dpdk-net-net/rel_16_07
/Bruce
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-08 21:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07 11:33 [dpdk-dev] [PATCH] ena: fix doorbell submission when not needed Jan Mędala
2016-07-08 11:11 ` [dpdk-dev] [PATCH v2] ena: doorbell fix Jan Medala
2016-07-08 11:11 ` [dpdk-dev] [PATCH v2] ena: fix doorbell submission when not needed Jan Medala
2016-07-08 21:03 ` Bruce Richardson
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).