Commit f73332fc authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

ixgbe: simplify padding and length checks

The check for length <= 0 is bogus because length is unsigned, and network
stack never sends zero length packets (unless it is totally broken).

The check for really small packets can be optimized (using unlikely)
and calling skb_pad directly.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fd62e09b
...@@ -6380,17 +6380,12 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, ...@@ -6380,17 +6380,12 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb,
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct ixgbe_ring *tx_ring; struct ixgbe_ring *tx_ring;
if (skb->len <= 0) {
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
/* /*
* The minimum packet size for olinfo paylen is 17 so pad the skb * The minimum packet size for olinfo paylen is 17 so pad the skb
* in order to meet this minimum size requirement. * in order to meet this minimum size requirement.
*/ */
if (skb->len < 17) { if (unlikely(skb->len < 17)) {
if (skb_padto(skb, 17)) if (skb_pad(skb, 17 - skb->len))
return NETDEV_TX_OK; return NETDEV_TX_OK;
skb->len = 17; skb->len = 17;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment