From a5b2a4c4cb155d84ca24b2e7c4ea1a519190aceb Mon Sep 17 00:00:00 2001 From: Sham Muthayyan Date: Mon, 18 Sep 2017 16:36:17 +0530 Subject: [PATCH] ipq807x: Padding minimum packets before send to EDMA The EDMA HW is unable to process packets less than MIN_PKT_SIZE(33) bytes, then the EDMA stalls. This is to pad the packets up to MIN_PKT_SIZE. Change-Id: I473831a759ad6a764fefa095cf7ab347ba95ee97 Signed-off-by: Sham Muthayyan --- drivers/net/ipq807x/ipq807x_edma.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ipq807x/ipq807x_edma.c b/drivers/net/ipq807x/ipq807x_edma.c index f919b7e46a..7950bdfe86 100644 --- a/drivers/net/ipq807x/ipq807x_edma.c +++ b/drivers/net/ipq807x/ipq807x_edma.c @@ -436,6 +436,7 @@ static int ipq807x_edma_rx_complete(struct ipq807x_edma_common_info *c_info) return 0; } +#define MIN_PKT_SIZE 33 /* * ipq807x_eth_snd() * Transmit a packet using an EDMA ring @@ -528,7 +529,14 @@ static int ipq807x_eth_snd(struct eth_device *dev, void *packet, int length) * copy the packet */ memcpy(skb + IPQ807X_EDMA_TX_PREHDR_SIZE, packet, length); - + /* + * The EDMA HW is unable to process packets less than MIN_PKT_SIZE(33) bytes, + * then the EDMA stalls. This is to pad the packets up to MIN_PKT_SIZE. + */ + if (length < MIN_PKT_SIZE) { + memset(skb + IPQ807X_EDMA_TX_PREHDR_SIZE + length, 0x00, (MIN_PKT_SIZE - length)); + length = MIN_PKT_SIZE; + } /* * Populate Tx descriptor */