summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r--src/plugins/dpdk/device/device.c18
-rw-r--r--src/plugins/dpdk/device/dpdk_priv.h31
-rw-r--r--src/plugins/dpdk/device/format.c7
-rw-r--r--src/plugins/dpdk/device/node.c38
4 files changed, 64 insertions, 30 deletions
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index f216bf05203..b8418278fba 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -228,16 +228,17 @@ dpdk_buffer_tx_offload (dpdk_device_t * xd, vlib_buffer_t * b,
outer_ip_cksum = oflags & VNET_BUFFER_OFFLOAD_F_OUTER_IP_CKSUM;
vxlan_tunnel = oflags & VNET_BUFFER_OFFLOAD_F_TNL_VXLAN;
- ol_flags = is_ip4 ? PKT_TX_IPV4 : PKT_TX_IPV6;
- ol_flags |= ip_cksum ? PKT_TX_IP_CKSUM : 0;
- ol_flags |= tcp_cksum ? PKT_TX_TCP_CKSUM : 0;
- ol_flags |= udp_cksum ? PKT_TX_UDP_CKSUM : 0;
+ ol_flags = is_ip4 ? RTE_MBUF_F_TX_IPV4 : RTE_MBUF_F_TX_IPV6;
+ ol_flags |= ip_cksum ? RTE_MBUF_F_TX_IP_CKSUM : 0;
+ ol_flags |= tcp_cksum ? RTE_MBUF_F_TX_TCP_CKSUM : 0;
+ ol_flags |= udp_cksum ? RTE_MBUF_F_TX_UDP_CKSUM : 0;
if (vxlan_tunnel)
{
- ol_flags |= outer_ip_cksum ? PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IP_CKSUM :
- PKT_TX_OUTER_IPV6;
- ol_flags |= PKT_TX_TUNNEL_VXLAN;
+ ol_flags |= outer_ip_cksum ?
+ RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_OUTER_IP_CKSUM :
+ RTE_MBUF_F_TX_OUTER_IPV6;
+ ol_flags |= RTE_MBUF_F_TX_TUNNEL_VXLAN;
mb->l2_len =
vnet_buffer (b)->l3_hdr_offset - vnet_buffer2 (b)->outer_l4_hdr_offset;
mb->l3_len =
@@ -265,7 +266,8 @@ dpdk_buffer_tx_offload (dpdk_device_t * xd, vlib_buffer_t * b,
max_pkt_len =
outer_hdr_len + mb->l2_len + mb->l3_len + mb->l4_len + mb->tso_segsz;
if (mb->tso_segsz != 0 && mb->pkt_len > max_pkt_len)
- ol_flags |= (tcp_cksum ? PKT_TX_TCP_SEG : PKT_TX_UDP_SEG);
+ ol_flags |=
+ (tcp_cksum ? RTE_MBUF_F_TX_TCP_SEG : RTE_MBUF_F_TX_UDP_SEG);
}
mb->ol_flags |= ol_flags;
diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h
index cdbc3999d0a..d1cdea32453 100644
--- a/src/plugins/dpdk/device/dpdk_priv.h
+++ b/src/plugins/dpdk/device/dpdk_priv.h
@@ -105,6 +105,37 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
dpdk_get_xstats (xd);
}
+#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
+#define RTE_MBUF_F_RX_VLAN PKT_RX_VLAN
+#define RTE_MBUF_F_RX_RSS_HASH PKT_RX_RSS_HASH
+#define RTE_MBUF_F_RX_FDIR PKT_RX_FDIR
+#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_RX_OUTER_IP_CKSUM_BAD PKT_RX_OUTER_IP_CKSUM_BAD
+#define RTE_MBUF_F_RX_VLAN_STRIPPED PKT_RX_VLAN_STRIPPED
+#define RTE_MBUF_F_RX_IP_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD
+#define RTE_MBUF_F_RX_L4_CKSUM_GOOD PKT_RX_L4_CKSUM_GOOD
+#define RTE_MBUF_F_RX_IEEE1588_PTP PKT_RX_IEEE1588_PTP
+#define RTE_MBUF_F_RX_IEEE1588_TMST PKT_RX_IEEE1588_TMST
+#define RTE_MBUF_F_RX_LRO PKT_RX_LRO
+#define RTE_MBUF_F_RX_QINQ_STRIPPED PKT_RX_QINQ_STRIPPED
+#define RTE_MBUF_F_RX_FDIR_ID PKT_RX_FDIR_ID
+#define RTE_MBUF_F_TX_VLAN_PKT PKT_TX_VLAN_PKT
+#define RTE_MBUF_F_TX_TUNNEL_VXLAN PKT_TX_TUNNEL_VXLAN
+#define RTE_MBUF_F_TX_IP_CKSUM PKT_TX_IP_CKSUM
+#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM
+#define RTE_MBUF_F_TX_UDP_CKSUM PKT_TX_UDP_CKSUM
+#define RTE_MBUF_F_TX_SCTP_CKSUM PKT_TX_SCTP_CKSUM
+#define RTE_MBUF_F_TX_OUTER_IP_CKSUM PKT_TX_OUTER_IP_CKSUM
+#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG
+#define RTE_MBUF_F_TX_IEEE1588_TMST PKT_TX_IEEE1588_TMST
+#define RTE_MBUF_F_TX_IPV4 PKT_TX_IPV4
+#define RTE_MBUF_F_TX_IPV6 PKT_TX_IPV6
+#define RTE_MBUF_F_TX_OUTER_IPV4 PKT_TX_OUTER_IPV4
+#define RTE_MBUF_F_TX_OUTER_IPV6 PKT_TX_OUTER_IPV6
+#define RTE_MBUF_F_TX_UDP_SEG PKT_TX_UDP_SEG
+#endif
+
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index 2da59831181..4d6e6313b24 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -879,7 +879,7 @@ u8 *
format_dpdk_rte_mbuf_tso (u8 *s, va_list *va)
{
struct rte_mbuf *mb = va_arg (*va, struct rte_mbuf *);
- if (mb->ol_flags & PKT_TX_TCP_SEG)
+ if (mb->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
{
s = format (s, "l4_len %u tso_segsz %u", mb->l4_len, mb->tso_segsz);
}
@@ -932,8 +932,9 @@ format_dpdk_rte_mbuf (u8 * s, va_list * va)
s = format (s, "\n%U%U", format_white_space, indent,
format_dpdk_pkt_offload_flags, &mb->ol_flags);
- if ((mb->ol_flags & PKT_RX_VLAN) &&
- ((mb->ol_flags & (PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ_STRIPPED)) == 0))
+ if ((mb->ol_flags & RTE_MBUF_F_RX_VLAN) &&
+ ((mb->ol_flags &
+ (RTE_MBUF_F_RX_VLAN_STRIPPED | RTE_MBUF_F_RX_QINQ_STRIPPED)) == 0))
{
ethernet_vlan_header_tv_t *vlan_hdr =
((ethernet_vlan_header_tv_t *) & (eth_hdr->type));
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c
index 46f0a4e98e4..d83fa35b177 100644
--- a/src/plugins/dpdk/device/node.c
+++ b/src/plugins/dpdk/device/node.c
@@ -36,12 +36,12 @@ static char *dpdk_error_strings[] = {
};
/* make sure all flags we need are stored in lower 32 bits */
-STATIC_ASSERT ((u64) (PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | PKT_RX_FDIR |
- PKT_RX_LRO) < (1ULL << 32),
+STATIC_ASSERT ((u64) (RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD |
+ RTE_MBUF_F_RX_FDIR | RTE_MBUF_F_RX_LRO) < (1ULL << 32),
"dpdk flags not in lower word, fix needed");
-STATIC_ASSERT (PKT_RX_L4_CKSUM_BAD == (1ULL << 3),
- "bit number of PKT_RX_L4_CKSUM_BAD is no longer 3!");
+STATIC_ASSERT (RTE_MBUF_F_RX_L4_CKSUM_BAD == (1ULL << 3),
+ "bit number of RTE_MBUF_F_RX_L4_CKSUM_BAD is no longer 3!");
static_always_inline uword
dpdk_process_subseq_segs (vlib_main_t * vm, vlib_buffer_t * b,
@@ -128,18 +128,18 @@ dpdk_prefetch_buffer_x4 (struct rte_mbuf *mb[])
@em Uses:
- <code>struct rte_mbuf mb->ol_flags</code>
- - PKT_RX_IP_CKSUM_BAD
+ - RTE_MBUF_F_RX_IP_CKSUM_BAD
@em Sets:
- <code>b->error</code> if the packet is to be dropped immediately
- <code>b->current_data, b->current_length</code>
- - adjusted as needed to skip the L2 header in direct-dispatch cases
+ - adjusted as needed to skip the L2 header in direct-dispatch cases
- <code>vnet_buffer(b)->sw_if_index[VLIB_RX]</code>
- - rx interface sw_if_index
+ - rx interface sw_if_index
- <code>vnet_buffer(b)->sw_if_index[VLIB_TX] = ~0</code>
- - required by ipX-lookup
+ - required by ipX-lookup
- <code>b->flags</code>
- - to indicate multi-segment pkts (VLIB_BUFFER_NEXT_PRESENT), etc.
+ - to indicate multi-segment pkts (VLIB_BUFFER_NEXT_PRESENT), etc.
<em>Next Nodes:</em>
- Static arcs to: error-drop, ethernet-input,
@@ -256,7 +256,7 @@ dpdk_process_flow_offload (dpdk_device_t * xd, dpdk_per_thread_data_t * ptd,
/* TODO prefetch and quad-loop */
for (n = 0; n < n_rx_packets; n++)
{
- if ((ptd->flags[n] & PKT_RX_FDIR_ID) == 0)
+ if ((ptd->flags[n] & RTE_MBUF_F_RX_FDIR_ID) == 0)
continue;
fle = pool_elt_at_index (xd->flow_lookup_entries,
@@ -329,7 +329,7 @@ dpdk_process_lro_offload (dpdk_device_t *xd, dpdk_per_thread_data_t *ptd,
for (n = 0; n < n_rx_packets; n++)
{
b0 = vlib_buffer_from_rte_mbuf (ptd->mbufs[n]);
- if (ptd->flags[n] & PKT_RX_LRO)
+ if (ptd->flags[n] & RTE_MBUF_F_RX_LRO)
{
b0->flags |= VNET_BUFFER_F_GSO;
vnet_buffer2 (b0)->gso_size = ptd->mbufs[n]->tso_segsz;
@@ -401,27 +401,27 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd,
else
n_rx_bytes = dpdk_process_rx_burst (vm, ptd, n_rx_packets, 0, &or_flags);
- if (PREDICT_FALSE ((or_flags & PKT_RX_LRO)))
+ if (PREDICT_FALSE ((or_flags & RTE_MBUF_F_RX_LRO)))
dpdk_process_lro_offload (xd, ptd, n_rx_packets);
- if (PREDICT_FALSE ((or_flags & PKT_RX_L4_CKSUM_BAD) &&
+ if (PREDICT_FALSE ((or_flags & RTE_MBUF_F_RX_L4_CKSUM_BAD) &&
(xd->buffer_flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT)))
{
for (n = 0; n < n_rx_packets; n++)
{
/* Check and reset VNET_BUFFER_F_L4_CHECKSUM_CORRECT flag
- if PKT_RX_L4_CKSUM_BAD is set.
- The magic num 3 is the bit number of PKT_RX_L4_CKSUM_BAD
+ if RTE_MBUF_F_RX_L4_CKSUM_BAD is set.
+ The magic num 3 is the bit number of RTE_MBUF_F_RX_L4_CKSUM_BAD
which is defined in DPDK.
Have made a STATIC_ASSERT in this file to ensure this.
*/
b0 = vlib_buffer_from_rte_mbuf (ptd->mbufs[n]);
- b0->flags ^= (ptd->flags[n] & PKT_RX_L4_CKSUM_BAD)
+ b0->flags ^= (ptd->flags[n] & RTE_MBUF_F_RX_L4_CKSUM_BAD)
<< (VNET_BUFFER_F_LOG2_L4_CHECKSUM_CORRECT - 3);
}
}
- if (PREDICT_FALSE (or_flags & PKT_RX_FDIR))
+ if (PREDICT_FALSE (or_flags & RTE_MBUF_F_RX_FDIR))
{
/* some packets will need to go to different next nodes */
for (n = 0; n < n_rx_packets; n++)
@@ -430,7 +430,7 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd,
/* flow offload - process if rx flow offload enabled and at least one
packet is marked */
if (PREDICT_FALSE ((xd->flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) &&
- (or_flags & PKT_RX_FDIR)))
+ (or_flags & RTE_MBUF_F_RX_FDIR)))
dpdk_process_flow_offload (xd, ptd, n_rx_packets);
/* enqueue buffers to the next node */
@@ -467,7 +467,7 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd,
marked as ip4 checksum bad we can notify ethernet input so it
can send pacets to ip4-input-no-checksum node */
if (xd->flags & DPDK_DEVICE_FLAG_RX_IP4_CKSUM &&
- (or_flags & PKT_RX_IP_CKSUM_BAD) == 0)
+ (or_flags & RTE_MBUF_F_RX_IP_CKSUM_BAD) == 0)
f->flags |= ETH_INPUT_FRAME_F_IP4_CKSUM_OK;
vlib_frame_no_append (f);
}