From 266f148b8080e9896fba1bdbaebb5e2dbfd44f07 Mon Sep 17 00:00:00 2001 From: kircher Date: Wed, 21 Jun 2023 15:03:47 +0800 Subject: [PATCH] enable UDP CKSUM in gazelle --- src/common/dpdk_common.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/common/dpdk_common.c b/src/common/dpdk_common.c index 23c96d6..52a163f 100644 --- a/src/common/dpdk_common.c +++ b/src/common/dpdk_common.c @@ -92,11 +92,18 @@ void eth_params_checksum(struct rte_eth_conf *conf, struct rte_eth_dev_info *dev COMMON_INFO("DEV_RX_OFFLOAD_IPV4_CKSUM\n"); } + // rx tcp if (rx_ol_capa & DEV_RX_OFFLOAD_TCP_CKSUM) { rx_ol |= DEV_RX_OFFLOAD_TCP_CKSUM; COMMON_INFO("DEV_RX_OFFLOAD_TCP_CKSUM\n"); } + // rx udp + if (rx_ol_capa & DEV_RX_OFFLOAD_UDP_CKSUM) { + rx_ol |= DEV_RX_OFFLOAD_UDP_CKSUM; + COMMON_INFO("DEV_RX_OFFLOAD_UDP_CKSUM\n"); + } + // tx ip if (tx_ol_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) { tx_ol |= DEV_TX_OFFLOAD_IPV4_CKSUM; @@ -109,15 +116,26 @@ void eth_params_checksum(struct rte_eth_conf *conf, struct rte_eth_dev_info *dev COMMON_INFO("DEV_TX_OFFLOAD_TCP_CKSUM\n"); } + // tx udp + if (tx_ol_capa & DEV_TX_OFFLOAD_UDP_CKSUM) { + tx_ol |= DEV_TX_OFFLOAD_UDP_CKSUM; + COMMON_INFO("DEV_TX_OFFLOAD_UDP_CKSUM\n"); + } + + // tx tso if (tx_ol_capa & DEV_TX_OFFLOAD_TCP_TSO) { tx_ol |= (DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_MULTI_SEGS); COMMON_INFO("DEV_TX_OFFLOAD_TCP_TSO\n"); } - if (!(rx_ol & DEV_RX_OFFLOAD_TCP_CKSUM) || !(rx_ol & DEV_RX_OFFLOAD_IPV4_CKSUM)) { + if (!(rx_ol & DEV_RX_OFFLOAD_UDP_CKSUM) || + !(rx_ol & DEV_RX_OFFLOAD_TCP_CKSUM) || + !(rx_ol & DEV_RX_OFFLOAD_IPV4_CKSUM)) { rx_ol = 0; } - if (!(tx_ol & DEV_TX_OFFLOAD_TCP_CKSUM) || !(tx_ol & DEV_TX_OFFLOAD_IPV4_CKSUM)) { + if (!(tx_ol & DEV_TX_OFFLOAD_UDP_CKSUM) || + !(tx_ol & DEV_TX_OFFLOAD_TCP_CKSUM) || + !(tx_ol & DEV_TX_OFFLOAD_IPV4_CKSUM)) { tx_ol = 0; } -- 2.33.0