@@ -6,6 +6,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
+#include "rte_gro.h"
#include "gro_tcp4.h"
void *
@@ -191,7 +192,8 @@ update_header(struct gro_tcp4_item *item)
int32_t
gro_tcp4_reassemble(struct rte_mbuf *pkt,
struct gro_tcp4_tbl *tbl,
- uint64_t start_time)
+ uint64_t start_time,
+ uint16_t flags)
{
struct rte_ether_hdr *eth_hdr;
struct rte_ipv4_hdr *ipv4_hdr;
@@ -205,7 +207,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
uint32_t cur_idx, prev_idx, item_idx;
uint32_t i, max_flow_num, remaining_flow_num;
int cmp;
- uint8_t find;
+ uint8_t find, tcp_flags;
/*
* Don't process the packet whose TCP header length is greater
@@ -221,9 +223,12 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
/*
* Don't process the packet which has FIN, SYN, RST, URG, ECE
- * or CWR set.
+ * or CWR set, the PSH flag is ignored at the user's discretion.
*/
- if (tcp_hdr->tcp_flags & (~(RTE_TCP_ACK_FLAG | RTE_TCP_PSH_FLAG)))
+ tcp_flags = tcp_hdr->tcp_flags & (~(RTE_TCP_ACK_FLAG));
+ if (flags & RTE_GRO_TCP_PUSH_IGNORE)
+ tcp_flags = tcp_flags & (~(RTE_TCP_PSH_FLAG));
+ if (tcp_flags)
return -1;
/*
* Don't process the packet whose payload length is less than or
@@ -134,6 +134,8 @@ void gro_tcp4_tbl_destroy(void *tbl);
* Pointer pointing to the TCP/IPv4 reassembly table
* @start_time
* The time when the packet is inserted into the table
+ * @flags
+ * Functional flags for GRO
*
* @return
* - Return a positive value if the packet is merged.
@@ -143,7 +145,8 @@ void gro_tcp4_tbl_destroy(void *tbl);
*/
int32_t gro_tcp4_reassemble(struct rte_mbuf *pkt,
struct gro_tcp4_tbl *tbl,
- uint64_t start_time);
+ uint64_t start_time,
+ uint16_t flags);
/**
* This function flushes timeout packets in a TCP/IPv4 reassembly table,
@@ -7,6 +7,7 @@
#include <rte_ethdev.h>
#include <rte_udp.h>
+#include "rte_gro.h"
#include "gro_vxlan_tcp4.h"
void *
@@ -287,7 +288,8 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item)
int32_t
gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt,
struct gro_vxlan_tcp4_tbl *tbl,
- uint64_t start_time)
+ uint64_t start_time,
+ uint16_t flags)
{
struct rte_ether_hdr *outer_eth_hdr, *eth_hdr;
struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr;
@@ -304,7 +306,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt,
uint32_t i, max_flow_num, remaining_flow_num;
int cmp;
uint16_t hdr_len;
- uint8_t find;
+ uint8_t find, tcp_flags;
/*
* Don't process the packet whose TCP header length is greater
@@ -326,10 +328,13 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt,
tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len);
/*
- * Don't process the packet which has FIN, SYN, RST, URG,
- * ECE or CWR set.
+ * Don't process the packet which has FIN, SYN, RST, URG, ECE
+ * or CWR set, the PSH flag is ignored at the user's discretion.
*/
- if (tcp_hdr->tcp_flags & (~(RTE_TCP_ACK_FLAG | RTE_TCP_PSH_FLAG)))
+ tcp_flags = tcp_hdr->tcp_flags & (~(RTE_TCP_ACK_FLAG));
+ if (flags & RTE_GRO_TCP_PUSH_IGNORE)
+ tcp_flags = tcp_flags & (~(RTE_TCP_PSH_FLAG));
+ if (tcp_flags)
return -1;
hdr_len = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len +
@@ -117,7 +117,8 @@ void gro_vxlan_tcp4_tbl_destroy(void *tbl);
*/
int32_t gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt,
struct gro_vxlan_tcp4_tbl *tbl,
- uint64_t start_time);
+ uint64_t start_time,
+ uint16_t flags);
/**
* This function flushes timeout packets in the VxLAN reassembly table,
@@ -77,6 +77,8 @@ struct gro_ctx {
uint64_t gro_types;
/* reassembly tables */
void *tbls[RTE_GRO_TYPE_MAX_NUM];
+ /**< Functional flags for GRO */
+ uint16_t flags;
};
void *
@@ -116,6 +118,7 @@ rte_gro_ctx_create(const struct rte_gro_param *param)
gro_types |= gro_type_flag;
}
gro_ctx->gro_types = param->gro_types;
+ gro_ctx->flags = param->flags;
return gro_ctx;
}
@@ -245,7 +248,8 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts,
if (IS_IPV4_VXLAN_TCP4_PKT(pkts[i]->packet_type) &&
do_vxlan_tcp_gro) {
ret = gro_vxlan_tcp4_reassemble(pkts[i],
- &vxlan_tcp_tbl, 0);
+ &vxlan_tcp_tbl, 0,
+ param->flags);
if (ret > 0)
/* Merge successfully */
nb_after_gro--;
@@ -262,7 +266,7 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts,
unprocess_pkts[unprocess_num++] = pkts[i];
} else if (IS_IPV4_TCP_PKT(pkts[i]->packet_type) &&
do_tcp4_gro) {
- ret = gro_tcp4_reassemble(pkts[i], &tcp_tbl, 0);
+ ret = gro_tcp4_reassemble(pkts[i], &tcp_tbl, 0, param->flags);
if (ret > 0)
/* merge successfully */
nb_after_gro--;
@@ -354,7 +358,7 @@ rte_gro_reassemble(struct rte_mbuf **pkts,
if (IS_IPV4_VXLAN_TCP4_PKT(pkts[i]->packet_type) &&
do_vxlan_tcp_gro) {
if (gro_vxlan_tcp4_reassemble(pkts[i], vxlan_tcp_tbl,
- current_time) < 0)
+ current_time, gro_ctx->flags) < 0)
unprocess_pkts[unprocess_num++] = pkts[i];
} else if (IS_IPV4_VXLAN_UDP4_PKT(pkts[i]->packet_type) &&
do_vxlan_udp_gro) {
@@ -364,7 +368,7 @@ rte_gro_reassemble(struct rte_mbuf **pkts,
} else if (IS_IPV4_TCP_PKT(pkts[i]->packet_type) &&
do_tcp4_gro) {
if (gro_tcp4_reassemble(pkts[i], tcp_tbl,
- current_time) < 0)
+ current_time, gro_ctx->flags) < 0)
unprocess_pkts[unprocess_num++] = pkts[i];
} else if (IS_IPV4_UDP_PKT(pkts[i]->packet_type) &&
do_udp4_gro) {
@@ -39,6 +39,7 @@ extern "C" {
#define RTE_GRO_IPV4_VXLAN_UDP_IPV4 (1ULL << RTE_GRO_IPV4_VXLAN_UDP_IPV4_INDEX)
/**< VxLAN UDP/IPv4 GRO flag. */
+#define RTE_GRO_TCP_PUSH_IGNORE 0x01
/**
* Structure used to create GRO context objects or used to pass
* application-determined parameters to rte_gro_reassemble_burst().
@@ -55,6 +56,10 @@ struct rte_gro_param {
* like reassembly tables. When use rte_gro_reassemble_burst(),
* applications don't need to set this value.
*/
+ uint16_t flags;
+ /**< Functional flags for GRO, For example,
+ * merge TCP packets with push flag.
+ */
};
/**