From: Florian Fainelli Date: Sat, 9 Dec 2017 22:59:55 +0000 (-0800) Subject: net: designware: Pad small packets X-Git-Tag: v2018.03-rc1~175^2~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7a9ca9db400fc95463011449cf47012fb2e1db0d;p=oweals%2Fu-boot.git net: designware: Pad small packets Make sure that we pad small packets to a minimum length of 60 bytes (without FCS). This is necessary to interface with Ethernet switches that will reject RUNT frames unless padded correctly. Signed-off-by: Florian Fainelli --- diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 9207324731..6d5307128d 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include "designware.h" @@ -344,6 +345,8 @@ int designware_eth_enable(struct dw_eth_dev *priv) return 0; } +#define ETH_ZLEN 60 + static int _dw_eth_send(struct dw_eth_dev *priv, void *packet, int length) { struct eth_dma_regs *dma_p = priv->dma_regs_p; @@ -370,6 +373,8 @@ static int _dw_eth_send(struct dw_eth_dev *priv, void *packet, int length) return -EPERM; } + length = max(length, ETH_ZLEN); + memcpy((void *)data_start, packet, length); /* Flush data to be sent */