Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit

Permalink
linux/ena: Fix possible stuck tx packets when a tx drop occurs
Browse files Browse the repository at this point in the history
This fix was suggested in [1].

In case there is a tx packet burst, where N packets are to be sent,
if the last packet in the burst is dropped in ena_start_xmit(),
the doorbell is not sent to the device for this burst.

In such a case, the first N-1 packets in the burst will not be sent
until the next time a doorbell is sent.

This commit fixes this issue by sending a doorbell after a dropped
packet if it is the last in a tx burst !netdev_xmit_more() and also
after checking that indeed there are descriptors sent to the device.

[1]: https://lore.kernel.org/netdev/CANn89iJRHuFgPrsezhm2DuAw7JmLL2ZkPhZaf2Ymuq+STUm-8w@mail.gmail.com/

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
  • Loading branch information
evgeny17387new committed Feb 21, 2024
1 parent 86e611a commit 2cc15c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 6 additions & 7 deletions kernel/linux/common/ena_com/ena_eth_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ static inline void ena_com_unmask_intr(struct ena_com_io_cq *io_cq,
writel(intr_reg->intr_control, io_cq->unmask_reg);
}

static inline int ena_com_free_q_entries(struct ena_com_io_sq *io_sq)
static inline u16 ena_com_used_q_entries(struct ena_com_io_sq *io_sq)
{
u16 tail, next_to_comp, cnt;

next_to_comp = io_sq->next_to_comp;
tail = io_sq->tail;
cnt = tail - next_to_comp;
return io_sq->tail - io_sq->next_to_comp;
}

return io_sq->q_depth - 1 - cnt;
static inline int ena_com_free_q_entries(struct ena_com_io_sq *io_sq)
{
return io_sq->q_depth - 1 - ena_com_used_q_entries(io_sq);
}

/* Check if the submission queue has enough space to hold required_buffers */
Expand Down
7 changes: 7 additions & 0 deletions kernel/linux/ena/ena_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3087,6 +3087,13 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev)
tx_info->skb = NULL;

error_drop_packet:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
if (!netdev_xmit_more() && ena_com_used_q_entries(tx_ring->ena_com_io_sq))
#else
if (ena_com_used_q_entries(tx_ring->ena_com_io_sq))
#endif
ena_ring_tx_doorbell(tx_ring);

dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
Expand Down

0 comments on commit 2cc15c1

Please sign in to comment.