2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

userspace TSO: SCTP checksum offload optional.

Ideally SCTP checksum offload needs be advertised by the
NIC when userspace TSO is enabled. However, very few drivers
do that and it's not a widely used protocol. So, this patch
enables SCTP checksum offload if available, otherwise userspace
TSO can still be enabled but SCTP packets will be dropped on
NICs without support.

Fixes: 29cf9c1b3b ("userspace: Add TCP Segmentation Offload support")
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Flavio Leitner
2020-02-14 10:03:36 -03:00
committed by Ilya Maximets
parent 8c5163fe81
commit 35b5586ba7
5 changed files with 35 additions and 3 deletions

View File

@@ -152,8 +152,10 @@ typedef uint16_t dpdk_port_t;
#define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
/* List of required flags advertised by the hardware that will be
* used if TSO is enabled. */
/* List of required flags advertised by the hardware that will be used
* if TSO is enabled. Ideally this should include DEV_TX_OFFLOAD_SCTP_CKSUM.
* However, very few drivers supports that the moment and SCTP is not a
* widely used protocol as TCP and UDP, so it's optional. */
#define DPDK_TX_TSO_OFFLOAD_FLAGS (DEV_TX_OFFLOAD_TCP_TSO \
| DEV_TX_OFFLOAD_TCP_CKSUM \
| DEV_TX_OFFLOAD_UDP_CKSUM \
@@ -423,6 +425,7 @@ enum dpdk_hw_ol_features {
NETDEV_RX_HW_CRC_STRIP = 1 << 1,
NETDEV_RX_HW_SCATTER = 1 << 2,
NETDEV_TX_TSO_OFFLOAD = 1 << 3,
NETDEV_TX_SCTP_CHECKSUM_OFFLOAD = 1 << 4,
};
/*
@@ -1006,6 +1009,9 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq)
if (dev->hw_ol_features & NETDEV_TX_TSO_OFFLOAD) {
conf.txmode.offloads |= DPDK_TX_TSO_OFFLOAD_FLAGS;
if (dev->hw_ol_features & NETDEV_TX_SCTP_CHECKSUM_OFFLOAD) {
conf.txmode.offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM;
}
}
/* Limit configured rss hash functions to only those supported
@@ -1141,6 +1147,13 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev)
if ((info.tx_offload_capa & tx_tso_offload_capa)
== tx_tso_offload_capa) {
dev->hw_ol_features |= NETDEV_TX_TSO_OFFLOAD;
if (info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) {
dev->hw_ol_features |= NETDEV_TX_SCTP_CHECKSUM_OFFLOAD;
} else {
VLOG_WARN("%s: Tx SCTP checksum offload is not supported, "
"SCTP packets sent to this device will be dropped",
netdev_get_name(&dev->up));
}
} else {
VLOG_WARN("%s: Tx TSO offload is not supported.",
netdev_get_name(&dev->up));
@@ -5116,6 +5129,9 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
netdev->ol_flags |= NETDEV_TX_OFFLOAD_TCP_CKSUM;
netdev->ol_flags |= NETDEV_TX_OFFLOAD_UDP_CKSUM;
netdev->ol_flags |= NETDEV_TX_OFFLOAD_IPV4_CKSUM;
if (dev->hw_ol_features & NETDEV_TX_SCTP_CHECKSUM_OFFLOAD) {
netdev->ol_flags |= NETDEV_TX_OFFLOAD_SCTP_CKSUM;
}
}
dev->tx_q = netdev_dpdk_alloc_txq(netdev->n_txq);
@@ -5258,6 +5274,7 @@ netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
netdev->ol_flags |= NETDEV_TX_OFFLOAD_TCP_TSO;
netdev->ol_flags |= NETDEV_TX_OFFLOAD_TCP_CKSUM;
netdev->ol_flags |= NETDEV_TX_OFFLOAD_UDP_CKSUM;
netdev->ol_flags |= NETDEV_TX_OFFLOAD_SCTP_CKSUM;
netdev->ol_flags |= NETDEV_TX_OFFLOAD_IPV4_CKSUM;
vhost_unsup_flags = 1ULL << VIRTIO_NET_F_HOST_ECN
| 1ULL << VIRTIO_NET_F_HOST_UFO;