diff options
| author | David S. Miller <davem@davemloft.net> | 2014-12-08 20:47:47 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-12-08 20:47:47 -0500 |
| commit | 99bc5c928d7c18b70de80e582fa8e2ecc705eb9a (patch) | |
| tree | 2626841ed96ee748b4e2699f840b5407cbfc77b7 /include/linux/etherdevice.h | |
| parent | 177211b993ec6d7a6f8f3b3595f647c378440c4e (diff) | |
| parent | 207c5f448f385536e0bbf81bfc3556a919b205e9 (diff) | |
Merge branch 'eth_skb_pad'
Alexander Duyck says:
====================
net: Add helper for padding short Ethernet frames
This patch series adds a pair of helpers to pad short Ethernet frames. The
general idea is to clean up a number of code paths that were all writing
their own versions of the same or similar function.
An added advantage is that this will help to discourage introducing new
bugs as in at least one case I found the skb->len had been updated, but the
tail pointer update was overlooked.
v2: Added skb_put_padto for cases where length is not ETH_ZLEN
Updated intel drivers and emulex driver to use skb_put_padto
Updated eth_skb_pad to use skb_put_padto
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/etherdevice.h')
| -rw-r--r-- | include/linux/etherdevice.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 733980fce8e3..41c891d05f04 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -392,4 +392,16 @@ static inline unsigned long compare_ether_header(const void *a, const void *b) #endif } +/** + * eth_skb_pad - Pad buffer to mininum number of octets for Ethernet frame + * @skb: Buffer to pad + * + * An Ethernet frame should have a minimum size of 60 bytes. This function + * takes short frames and pads them with zeros up to the 60 byte limit. + */ +static inline int eth_skb_pad(struct sk_buff *skb) +{ + return skb_put_padto(skb, ETH_ZLEN); +} + #endif /* _LINUX_ETHERDEVICE_H */ |
