diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 5ae79496d898..4ae478712f6e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -701,6 +701,21 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } +#ifndef WITHOUT_ORACLE_EXTENSIONS + /* Packet is too small, drop it */ + if (unlikely(skb->len < ETH_HLEN)) { + if (sq->stats) + sq->stats->dropped++; + + WARN_ONCE(1, "Packet is too small\n"); + if (net_ratelimit()) + netdev_warn(dev, "Packet is too small. len=%d SQ=0x%x\n", + skb->len, sq->sqn); + dev_kfree_skb_any(skb); + return NETDEV_TX_OK; + } +#endif /* !WITHOUT_ORACLE_EXTENSIONS */ + /* May send SKBs and WQEs. */ if (unlikely(!mlx5e_accel_tx_begin(dev, sq, skb, &accel))) return NETDEV_TX_OK;