Skip to content

Commit

Permalink
Add two new ifnet capabilities for hw checksumming and TSO for VXLAN …
Browse files Browse the repository at this point in the history
…traffic.

These are similar to the existing VLAN capabilities.

Reviewed by:	kib@
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D25873
  • Loading branch information
np-2020 committed Sep 18, 2020
1 parent 1f73138 commit 830edb4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
19 changes: 17 additions & 2 deletions sbin/ifconfig/ifconfig.8
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
.Dd June 4, 2020
.Dd September 17, 2020
.Dt IFCONFIG 8
.Os
.Sh NAME
Expand Down Expand Up @@ -587,7 +587,7 @@ If the driver offers user-configurable VLAN support, enable
reception of extended frames, tag processing in hardware,
frame filtering in hardware, checksum offloading, or TSO on VLAN,
respectively.
Note that this must be issued on a physical interface associated with
Note that this must be configured on a physical interface associated with
.Xr vlan 4 ,
not on a
.Xr vlan 4
Expand All @@ -597,6 +597,21 @@ If the driver offers user-configurable VLAN support, disable
reception of extended frames, tag processing in hardware,
frame filtering in hardware, or TSO on VLAN,
respectively.
.It Cm vxlanhwcsum , vxlanhwtso
If the driver offers user-configurable VXLAN support, enable inner checksum
offloading (receive and transmit) or TSO on VXLAN, respectively.
Note that this must be configured on a physical interface associated with
.Xr vxlan 4 ,
not on a
.Xr vxlan 4
interface itself.
The physical interface is either the interface specified as the vxlandev
or the interface hosting the vxlanlocal address.
The driver will offload as much checksum work and TSO as it can reliably
support, the exact level of offloading may vary between drivers.
.It Fl vxlanhwcsum , vxlanhwtso
If the driver offers user-configurable VXLAN support, disable checksum
offloading (receive and transmit) or TSO on VXLAN, respectively.
.It Cm vnet Ar jail
Move the interface to the
.Xr jail 8 ,
Expand Down
3 changes: 2 additions & 1 deletion sbin/ifconfig/ifconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,8 @@ unsetifdescr(const char *val, int value, int s, const struct afswtch *afp)
"\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \
"\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \
"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP\33NOMAP\34TXTLS4\35TXTLS6"
"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP\33NOMAP\34TXTLS4\35TXTLS6" \
"\36VXLAN_HWCSUM\37VXLAN_HWTSO"

/*
* Print the status of the interface. If an address family was
Expand Down
5 changes: 5 additions & 0 deletions sbin/ifconfig/ifvxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,11 @@ static struct cmd vxlan_cmds[] = {

DEF_CMD("vxlanflush", 0, setvxlan_flush),
DEF_CMD("vxlanflushall", 1, setvxlan_flush),

DEF_CMD("vxlanhwcsum", IFCAP_VXLAN_HWCSUM, setifcap),
DEF_CMD("-vxlanhwcsum", -IFCAP_VXLAN_HWCSUM, setifcap),
DEF_CMD("vxlanhwtso", IFCAP_VXLAN_HWTSO, setifcap),
DEF_CMD("-vxlanhwtso", -IFCAP_VXLAN_HWTSO, setifcap),
};

static struct afswtch af_vxlan = {
Expand Down
2 changes: 2 additions & 0 deletions sys/net/if.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ struct if_data {
#define IFCAP_NOMAP 0x4000000 /* can TX unmapped mbufs */
#define IFCAP_TXTLS4 0x8000000 /* can do TLS encryption and segmentation for TCP */
#define IFCAP_TXTLS6 0x10000000 /* can do TLS encryption and segmentation for TCP6 */
#define IFCAP_VXLAN_HWCSUM 0x20000000 /* can do IFCAN_HWCSUM on VXLANs */
#define IFCAP_VXLAN_HWTSO 0x40000000 /* can do IFCAP_TSO on VXLANs */

#define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6)

Expand Down

0 comments on commit 830edb4

Please sign in to comment.