diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2017-04-10 11:15:19 +1000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-10 16:03:57 -0400 |
commit | 9b0f7711d92bf44b727751a87373089a92031918 (patch) | |
tree | ed936f5bd94e5a2fbda0b9a9b542d5b1c3793e10 /drivers/net/ethernet/faraday | |
parent | 3e427a3363edbc8416c36815c2f7de4621739273 (diff) | |
download | linux-9b0f7711d92bf44b727751a87373089a92031918.tar.bz2 |
ftgmac100: Pad small frames properly
Rather than just transmitting garbage past the end of the small
packet.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/faraday')
-rw-r--r-- | drivers/net/ethernet/faraday/ftgmac100.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index c8162d21c142..6325e326147d 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -632,11 +632,17 @@ static void ftgmac100_tx_complete(struct ftgmac100 *priv) static int ftgmac100_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev) { - unsigned int len = (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len; struct ftgmac100 *priv = netdev_priv(netdev); struct ftgmac100_txdes *txdes; dma_addr_t map; + /* The HW doesn't pad small frames */ + if (eth_skb_pad(skb)) { + netdev->stats.tx_dropped++; + return NETDEV_TX_OK; + } + + /* Reject oversize packets */ if (unlikely(skb->len > MAX_PKT_SIZE)) { if (net_ratelimit()) netdev_dbg(netdev, "tx packet too big\n"); @@ -657,7 +663,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, /* setup TX descriptor */ ftgmac100_txdes_set_skb(txdes, skb); ftgmac100_txdes_set_dma_addr(txdes, map); - ftgmac100_txdes_set_buffer_size(txdes, len); + ftgmac100_txdes_set_buffer_size(txdes, skb->len); ftgmac100_txdes_set_first_segment(txdes); ftgmac100_txdes_set_last_segment(txdes); |