diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-12-09 14:59:55 -0800 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2018-01-15 12:05:21 -0600 |
commit | 7a9ca9db400fc95463011449cf47012fb2e1db0d (patch) | |
tree | 19777527e3536794dd0422f3693525f274f23275 /drivers/net/designware.c | |
parent | 137963d71a2b2e0a1ac1fd755e0bec1409c2cdbd (diff) |
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 <f.fainelli@gmail.com>
Diffstat (limited to 'drivers/net/designware.c')
-rw-r--r-- | drivers/net/designware.c | 5 |
1 files changed, 5 insertions, 0 deletions
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 <pci.h> #include <linux/compiler.h> #include <linux/err.h> +#include <linux/kernel.h> #include <asm/io.h> #include <power/regulator.h> #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 */ |