Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: DPDK-21.11 compile warnning #76

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/csum.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
#include <rte_version.h>
#include "mbuf.h"

#if RTE_VERSION < RTE_VERSION_NUM(21, 0, 0, 0)
#define RTE_MBUF_F_RX_L4_CKSUM_BAD PKT_RX_L4_CKSUM_BAD
#define RTE_MBUF_F_RX_IP_CKSUM_BAD PKT_RX_IP_CKSUM_BAD
#define RTE_MBUF_F_TX_IPV6 PKT_TX_IPV6
#define RTE_MBUF_F_TX_IP_CKSUM PKT_TX_IP_CKSUM
#define RTE_MBUF_F_TX_IPV4 PKT_TX_IPV4
#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM
#define RTE_MBUF_F_TX_UDP_CKSUM PKT_TX_UDP_CKSUM
#endif

static inline uint16_t csum_update_tcp_seq(uint16_t ocsum, uint32_t seq0, uint32_t seq1)
{
uint32_t csum = 0;
Expand Down Expand Up @@ -65,7 +75,7 @@ static inline void csum_ipv4(struct rte_mbuf *m, int offload)
iph = mbuf_ip_hdr(m);
iph->check = 0;
if (offload != 0) {
m->ol_flags |= PKT_TX_IP_CKSUM;
m->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM;
m->l2_len = sizeof(struct eth_hdr);
m->l3_len = sizeof(struct iphdr);
} else {
Expand Down Expand Up @@ -102,11 +112,11 @@ static inline void csum_offload_ip_tcpudp(struct rte_mbuf *m, uint64_t ol_flags)
th->th_sum = 0;
th->th_sum = RTE_IPV4_UDPTCP_CKSUM(iph, th);
} else {
m->ol_flags = ol_flags | PKT_TX_IPV4;
m->ol_flags = ol_flags | RTE_MBUF_F_TX_IPV4;
}

if (g_dev_tx_offload_ipv4_cksum) {
m->ol_flags |= PKT_TX_IP_CKSUM | PKT_TX_IPV4;
m->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_IPV4;
} else {
iph->check = RTE_IPV4_CKSUM(iph);
}
Expand All @@ -118,7 +128,7 @@ static inline void csum_offload_ip_tcpudp(struct rte_mbuf *m, uint64_t ol_flags)
th->th_sum = RTE_IPV6_UDPTCP_CKSUM(ip6h, th);
} else {
m->l3_len = sizeof(struct ip6_hdr);
m->ol_flags = ol_flags | PKT_TX_IPV6;
m->ol_flags = ol_flags | RTE_MBUF_F_TX_IPV6;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static inline void ipv4_input(struct work_space *ws, struct rte_mbuf *m,
eth = mbuf_eth_hdr(m);
iph = mbuf_ip_hdr(m);
if (likely(eth->type == htons(ETHER_TYPE_IPv4))) {
if (unlikely(m->ol_flags & (PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD))) {
if (unlikely(m->ol_flags & (RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD))) {
net_stats_rx_bad();
mbuf_free(m);
return;
Expand Down Expand Up @@ -155,7 +155,7 @@ static inline void ipv6_input(struct work_space *ws, struct rte_mbuf *m,
ip6h = mbuf_ip6_hdr(m);
proto = ip6h->ip6_nxt;

if (unlikely(m->ol_flags & (PKT_RX_L4_CKSUM_BAD))) {
if (unlikely(m->ol_flags & (RTE_MBUF_F_RX_L4_CKSUM_BAD))) {
net_stats_rx_bad();
mbuf_free(m);
return;
Expand Down
2 changes: 0 additions & 2 deletions src/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ static struct rte_eth_conf g_port_conf = {
.mq_mode = ETH_MQ_RX_NONE,
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
.max_rx_pkt_len = ETHER_MAX_LEN,
#else
.mtu = ETHER_MAX_LEN,
#endif
.split_hdr_size = 0,
#if RTE_VERSION < RTE_VERSION_NUM(18, 11, 0, 0)
Expand Down
6 changes: 3 additions & 3 deletions src/work_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ static inline void work_space_tx_send(struct work_space *ws, struct rte_mbuf *mb

static inline void work_space_tx_send_tcp(struct work_space *ws, struct rte_mbuf *mbuf)
{
uint64_t ol_flags = PKT_TX_TCP_CKSUM;
uint64_t ol_flags = RTE_MBUF_F_TX_TCP_CKSUM;

if (ws->vxlan) {
ol_flags = PKT_TX_UDP_CKSUM;
ol_flags = RTE_MBUF_F_TX_UDP_CKSUM;
}

csum_offload_ip_tcpudp(mbuf, ol_flags);
Expand All @@ -171,7 +171,7 @@ static inline void work_space_tx_send_tcp(struct work_space *ws, struct rte_mbuf

static inline void work_space_tx_send_udp(struct work_space *ws, struct rte_mbuf *mbuf)
{
csum_offload_ip_tcpudp(mbuf, PKT_TX_UDP_CKSUM);
csum_offload_ip_tcpudp(mbuf, RTE_MBUF_F_TX_UDP_CKSUM);
work_space_tx_send(ws, mbuf);
}

Expand Down