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 <smuthayy@codeaurora.org>
diff --git a/drivers/net/ipq807x/ipq807x_edma.c b/drivers/net/ipq807x/ipq807x_edma.c
index f919b7e..7950bdf 100644
--- a/drivers/net/ipq807x/ipq807x_edma.c
+++ b/drivers/net/ipq807x/ipq807x_edma.c
@@ -436,6 +436,7 @@
return 0;
}
+#define MIN_PKT_SIZE 33
/*
* ipq807x_eth_snd()
* Transmit a packet using an EDMA ring
@@ -528,7 +529,14 @@
* 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
*/