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>
This commit is contained in:
Sham Muthayyan 2017-09-18 16:36:17 +05:30
parent a7e05d55af
commit a5b2a4c4cb

View file

@ -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
*/