mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
ena: Add ena_ring_tx_doorbell() function
Add ena_ring_tx_doorbell function to remove code duplication. Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc.
This commit is contained in:
parent
7fde0187cc
commit
3501d4f17e
3 changed files with 13 additions and 16 deletions
|
|
@ -543,4 +543,12 @@ ena_trigger_reset(struct ena_adapter *adapter,
|
|||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
ena_ring_tx_doorbell(struct ena_ring *tx_ring)
|
||||
{
|
||||
ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
|
||||
counter_u64_add(tx_ring->tx_stats.doorbells, 1);
|
||||
tx_ring->acum_pkts = 0;
|
||||
}
|
||||
|
||||
#endif /* !(ENA_H) */
|
||||
|
|
|
|||
|
|
@ -1017,9 +1017,7 @@ ena_xmit_mbuf(struct ena_ring *tx_ring, struct mbuf **mbuf)
|
|||
ena_log_io(pdev, DBG,
|
||||
"llq tx max burst size of queue %d achieved, writing doorbell to send burst\n",
|
||||
tx_ring->que->id);
|
||||
ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
|
||||
counter_u64_add(tx_ring->tx_stats.doorbells, 1);
|
||||
tx_ring->acum_pkts = 0;
|
||||
ena_ring_tx_doorbell(tx_ring);
|
||||
}
|
||||
|
||||
/* Prepare the packet's descriptors and send them to device */
|
||||
|
|
@ -1098,7 +1096,6 @@ ena_start_xmit(struct ena_ring *tx_ring)
|
|||
{
|
||||
struct mbuf *mbuf;
|
||||
struct ena_adapter *adapter = tx_ring->adapter;
|
||||
struct ena_com_io_sq* io_sq;
|
||||
int ena_qid;
|
||||
int ret = 0;
|
||||
|
||||
|
|
@ -1111,7 +1108,6 @@ ena_start_xmit(struct ena_ring *tx_ring)
|
|||
return;
|
||||
|
||||
ena_qid = ENA_IO_TXQ_IDX(tx_ring->que->id);
|
||||
io_sq = &adapter->ena_dev->io_sq_queues[ena_qid];
|
||||
|
||||
while ((mbuf = drbr_peek(adapter->ifp, tx_ring->br)) != NULL) {
|
||||
ena_log_io(adapter->pdev, DBG,
|
||||
|
|
@ -1149,9 +1145,7 @@ ena_start_xmit(struct ena_ring *tx_ring)
|
|||
|
||||
if (likely(tx_ring->acum_pkts != 0)) {
|
||||
/* Trigger the dma engine */
|
||||
ena_com_write_sq_doorbell(io_sq);
|
||||
counter_u64_add(tx_ring->tx_stats.doorbells, 1);
|
||||
tx_ring->acum_pkts = 0;
|
||||
ena_ring_tx_doorbell(tx_ring);
|
||||
}
|
||||
|
||||
if (unlikely(!tx_ring->running))
|
||||
|
|
|
|||
|
|
@ -375,9 +375,7 @@ ena_netmap_tx_frames(struct ena_netmap_ctx *ctx)
|
|||
/* If any packet was sent... */
|
||||
if (likely(ctx->nm_i != ctx->kring->nr_hwcur)) {
|
||||
/* ...send the doorbell to the device. */
|
||||
ena_com_write_sq_doorbell(ctx->io_sq);
|
||||
counter_u64_add(ctx->ring->tx_stats.doorbells, 1);
|
||||
tx_ring->acum_pkts = 0;
|
||||
ena_ring_tx_doorbell(tx_ring);
|
||||
|
||||
ctx->ring->next_to_use = ctx->nt;
|
||||
ctx->kring->nr_hwcur = ctx->nm_i;
|
||||
|
|
@ -431,11 +429,8 @@ ena_netmap_tx_frame(struct ena_netmap_ctx *ctx)
|
|||
/* There are no any offloads, as the netmap doesn't support them */
|
||||
|
||||
if (tx_ring->acum_pkts == DB_THRESHOLD ||
|
||||
ena_com_is_doorbell_needed(ctx->io_sq, &ena_tx_ctx)) {
|
||||
ena_com_write_sq_doorbell(ctx->io_sq);
|
||||
counter_u64_add(tx_ring->tx_stats.doorbells, 1);
|
||||
tx_ring->acum_pkts = 0;
|
||||
}
|
||||
ena_com_is_doorbell_needed(ctx->io_sq, &ena_tx_ctx))
|
||||
ena_ring_tx_doorbell(tx_ring);
|
||||
|
||||
rc = ena_com_prepare_tx(ctx->io_sq, &ena_tx_ctx, &nb_hw_desc);
|
||||
if (unlikely(rc != 0)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue