Skip to content

Commit

Permalink
Add software padding processing in Ethernet Tx path.
Browse files Browse the repository at this point in the history
It's found that too-short packets would lead to
switch Tx CRC error, followed by switch output
queue stuck issue. So Ethernet driver should check
if the packet is too short and conduct software
padding when necessary.

If without this patch, switch might encounter output
queue stuck issue.

Change-Id: Ibd94cbf3be0530d2b9ee61477b0362d099c47d8e
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7109899
  • Loading branch information
developer authored and frank-w committed Oct 4, 2024
1 parent 89ff036 commit f581b58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/net/ethernet/mediatek/mtk_eth_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,13 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
int queue = skb_get_queue_mapping(skb);
int k = 0;

if (skb->len < 32) {
if (skb_put_padto(skb, MTK_MIN_TX_LENGTH))
return -ENOMEM;

txd_info.size = skb_headlen(skb);
}

txq = netdev_get_tx_queue(dev, queue);
itxd = ring->next_free;
itxd_pdma = qdma_to_pdma(ring, itxd);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/mediatek/mtk_eth_soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define MTK_MAX_RX_LENGTH_2K 2048
#define MTK_TX_DMA_BUF_LEN 0x3fff
#define MTK_TX_DMA_BUF_LEN_V2 0xffff
#define MTK_MIN_TX_LENGTH 60
#define MTK_QDMA_RING_SIZE 2048
#define MTK_DMA_SIZE(x) (SZ_##x)
#define MTK_FQ_DMA_HEAD 32
Expand Down

0 comments on commit f581b58

Please sign in to comment.