Skip to content

Commit

Permalink
octeon_ep: update BQL sent bytes before ringing doorbell
Browse files Browse the repository at this point in the history
Sometimes Tx is completed immediately after doorbell is updated, which
causes Tx completion routing to update completion bytes before the
same packet bytes are updated in sent bytes in transmit function, hence
hitting BUG_ON() in dql_completed(). To avoid this, update BQL
sent bytes before ringing doorbell.

Fixes: 37d79d0 ("octeon_ep: add Tx/Rx processing and interrupt support")
Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Link: https://lore.kernel.org/r/20231017105030.2310966-1-srasheed@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Shinas Rasheed authored and Jakub Kicinski committed Oct 19, 2023
1 parent 2915240 commit a0ca6b9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drivers/net/ethernet/marvell/octeon_ep/octep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,20 +715,19 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
hw_desc->dptr = tx_buffer->sglist_dma;
}

/* Flush the hw descriptor before writing to doorbell */
wmb();

/* Ring Doorbell to notify the NIC there is a new packet */
writel(1, iq->doorbell_reg);
netdev_tx_sent_queue(iq->netdev_q, skb->len);
skb_tx_timestamp(skb);
atomic_inc(&iq->instr_pending);
wi++;
if (wi == iq->max_count)
wi = 0;
iq->host_write_index = wi;
/* Flush the hw descriptor before writing to doorbell */
wmb();

netdev_tx_sent_queue(iq->netdev_q, skb->len);
/* Ring Doorbell to notify the NIC there is a new packet */
writel(1, iq->doorbell_reg);
iq->stats.instr_posted++;
skb_tx_timestamp(skb);
return NETDEV_TX_OK;

dma_map_sg_err:
Expand Down

0 comments on commit a0ca6b9

Please sign in to comment.