Skip to content

Commit afa4017

Browse files
developerfrank-w
developer
authored andcommitted
Add+Fix software padding processing in Ethernet Tx path.
Add software padding processing in Ethernet Tx path. 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 Fix software padding processing in Ethernet Tx path. It's found that 20bytes(LLC), 28bytes, and 36bytes(PPP LCP Configuration Ack) packets with additional 4bytes special tag for dsa driver would lead to switch Tx CRC error, followed by switch output queue stuck issue. Therefore, Ethernet driver check skb->len <= 40(36bytes PPP LCP + 4bytes special tag) and conduct software padding. Moreover, skb linearization should be checked again after conduct software padding. If without this patch, users might encounter problems when establishing a PPPoE tunnel. Change-Id: Id28fa3870dc9e905207d95634fe5cd692f363761 Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9129634 frank-w: changed condition to MTK_MIN_TX_LENGTH
1 parent 5fed8aa commit afa4017

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

drivers/net/ethernet/mediatek/mtk_eth_soc.c

+8
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,14 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
15651565
int queue = skb_get_queue_mapping(skb);
15661566
int k = 0;
15671567

1568+
if (skb->len <= MTK_MIN_TX_LENGTH) {
1569+
if (skb_put_padto(skb, MTK_MIN_TX_LENGTH))
1570+
return -ENOMEM;
1571+
1572+
txd_info.last = !skb_is_nonlinear(skb);
1573+
txd_info.size = skb_headlen(skb);
1574+
}
1575+
15681576
txq = netdev_get_tx_queue(dev, queue);
15691577
itxd = ring->next_free;
15701578
itxd_pdma = qdma_to_pdma(ring, itxd);

drivers/net/ethernet/mediatek/mtk_eth_soc.h

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define MTK_MAX_RX_LENGTH_2K 2048
3333
#define MTK_TX_DMA_BUF_LEN 0x3fff
3434
#define MTK_TX_DMA_BUF_LEN_V2 0xffff
35+
#define MTK_MIN_TX_LENGTH 60
3536
#define MTK_QDMA_RING_SIZE 2048
3637
#define MTK_DMA_SIZE(x) (SZ_##x)
3738
#define MTK_FQ_DMA_HEAD 32

0 commit comments

Comments
 (0)