On 04/06/2017 08:30 PM, Benjamin Herrenschmidt wrote:
> Rather than just transmitting garbage past the end of the small
> packet.
> 
> Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org>
> ---
>  drivers/net/ethernet/faraday/ftgmac100.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c 
> b/drivers/net/ethernet/faraday/ftgmac100.c
> index 6c71726..3f2172f 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -636,6 +636,13 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,
>       struct ftgmac100_txdes *txdes;
>       dma_addr_t map;
>  
> +     /* The HW doesn't pad small frames */
> +     if (skb_padto(skb, ETH_ZLEN) < 0) {
> +             netdev->stats.tx_dropped++;
> +             return NETDEV_TX_OK;
> +     }

You may want to use skb_put_padto() which also takes care of bumping
skb->len accordingly, in case that makes a difference for the ftgmac100
hardware.
-- 
Florian

Reply via email to