Message ID | 20170407033105.29558-6-benh@kernel.crashing.org |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
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 <benh@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.
On Fri, 2017-04-07 at 06:05 -0700, Florian Fainelli wrote: > 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. Subsequent patch adds fragments, so it needs to bump headlen. I'll have a look this week-end, thanks. Cheers, Ben.
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; + } + + /* Reject oversize packets */ if (unlikely(skb->len > MAX_PKT_SIZE)) { if (net_ratelimit()) netdev_dbg(netdev, "tx packet too big\n");
Rather than just transmitting garbage past the end of the small packet. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 7 +++++++ 1 file changed, 7 insertions(+)