]> git.baikalelectronics.ru Git - kernel.git/commit
net: Add functions for handling padding frame and adding to length
authorAlexander Duyck <alexander.h.duyck@redhat.com>
Wed, 3 Dec 2014 16:17:33 +0000 (08:17 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Dec 2014 01:47:41 +0000 (20:47 -0500)
commitd5ea59d19fd994a16a3b3cee795eee5ee39e339b
treee76b631781ae57c158b29ff85077847998693c1e
parentb7f56a8ed97cf41ae2b49b4764f8b283a9d02fdc
net: Add functions for handling padding frame and adding to length

This patch adds two new helper functions skb_put_padto and eth_skb_pad.
These functions deviate from the standard skb_pad or skb_padto in that they
will also update the length and tail pointers so that they reflect the
padding added to the frame.

The eth_skb_pad helper is meant to be used with Ethernet devices to update
either Rx or Tx frames so that they report the correct size.  The
skb_put_padto helper is meant to be used primarily in the transmit path for
network devices that need frames to be padded up to some minimum size and
don't wish to simply update the length somewhere external to the frame.

The motivation behind this is that there are a number of implementations
throughout the network device drivers that are all doing the same thing,
but each a little bit differently and as a result several implementations
contain bugs such as updating the length without updating the tail offset
and other similar issues.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/etherdevice.h
include/linux/skbuff.h