Skip to content

Commit a0ca6b9

Browse files
shinas-marvellkuba-moo
authored andcommitted
octeon_ep: update BQL sent bytes before ringing doorbell
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2915240 commit a0ca6b9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/net/ethernet/marvell/octeon_ep/octep_main.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -715,20 +715,19 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
715715
hw_desc->dptr = tx_buffer->sglist_dma;
716716
}
717717

718-
/* Flush the hw descriptor before writing to doorbell */
719-
wmb();
720-
721-
/* Ring Doorbell to notify the NIC there is a new packet */
722-
writel(1, iq->doorbell_reg);
718+
netdev_tx_sent_queue(iq->netdev_q, skb->len);
719+
skb_tx_timestamp(skb);
723720
atomic_inc(&iq->instr_pending);
724721
wi++;
725722
if (wi == iq->max_count)
726723
wi = 0;
727724
iq->host_write_index = wi;
725+
/* Flush the hw descriptor before writing to doorbell */
726+
wmb();
728727

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

734733
dma_map_sg_err:

0 commit comments

Comments
 (0)