]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add ETHER_ALIGN support to ng_device(4).
authorIan Lepore <ian@FreeBSD.org>
Tue, 9 Nov 2021 14:34:06 +0000 (15:34 +0100)
committerEmmanuel Vadot <manu@FreeBSD.org>
Fri, 14 Jan 2022 13:28:43 +0000 (14:28 +0100)
commit1a86aab86af08a402e81b0216ca9fc34d2461c4a
tree1d9eb35ea6e1b704b296620a5c4aa0235165b2c9
parent1e2a0cef6bf10db00f230f33ee14293f5b00e894
Add ETHER_ALIGN support to ng_device(4).

This adds a new ng_device command, NGM_DEVICE_ETHERALIGN, which has no
associated args.  After the command arrives, the device begins adjusting all
packets sent out its hook to have ETHER_ALIGN bytes of padding at the
beginning of the packet.  The ETHER_ALIGN padding is added only when
running on an architecture that requires strict alignment of IP headers
(based on the __NO_STRICT_ALIGNMENT macro, which is only #define'd on
x86 as of this writing).

This also adds ascii <-> binary command translation to ng_device, both for
the existing NGM_DEVICE_GET_DEVNAME and the new ETHERALIGN command.

This also gives a name to every ng_device node when it is constructed, using
the cdev device name (ngd0, ngd1, etc).  This makes it easier to address
command msgs to the device using ngctl(8).

Reviewed by: donner, ray, adrian
Differential Revision: https://reviews.freebsd.org/D32905
MFC after:   1 week

(cherry picked from commit 44aae623ab858387301358b9b054cd229ce41068)
share/man/man4/ng_device.4
sys/netgraph/ng_device.c
sys/netgraph/ng_device.h