#include <rte_errno.h>
#include <rte_branch_prediction.h>
#include <rte_string_fns.h>
+#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include "rte_ethdev.h"
#include "rte_flow_driver.h"
#include "rte_flow.h"
+/* Mbuf dynamic field name for metadata. */
+int rte_flow_dynf_metadata_offs = -1;
+
+/* Mbuf dynamic field flag bit number for metadata. */
+uint64_t rte_flow_dynf_metadata_mask;
+
/**
* Flow elements description tables.
*/
sizeof(struct rte_flow_item_icmp6_nd_opt_tla_eth)),
MK_FLOW_ITEM(MARK, sizeof(struct rte_flow_item_mark)),
MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)),
+ MK_FLOW_ITEM(TAG, sizeof(struct rte_flow_item_tag)),
MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
+ MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)),
+ MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)),
+ MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)),
+ MK_FLOW_ITEM(PPPOE_PROTO_ID,
+ sizeof(struct rte_flow_item_pppoe_proto_id)),
+ MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
+ MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
+ MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+ MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
};
/** Generate flow_action[] entry. */
MK_FLOW_ACTION(DEC_TCP_SEQ, sizeof(rte_be32_t)),
MK_FLOW_ACTION(INC_TCP_ACK, sizeof(rte_be32_t)),
MK_FLOW_ACTION(DEC_TCP_ACK, sizeof(rte_be32_t)),
+ MK_FLOW_ACTION(SET_TAG, sizeof(struct rte_flow_action_set_tag)),
+ MK_FLOW_ACTION(SET_META, sizeof(struct rte_flow_action_set_meta)),
};
+int
+rte_flow_dynf_metadata_register(void)
+{
+ int offset;
+ int flag;
+
+ static const struct rte_mbuf_dynfield desc_offs = {
+ .name = RTE_MBUF_DYNFIELD_METADATA_NAME,
+ .size = sizeof(uint32_t),
+ .align = __alignof__(uint32_t),
+ };
+ static const struct rte_mbuf_dynflag desc_flag = {
+ .name = RTE_MBUF_DYNFLAG_METADATA_NAME,
+ };
+
+ offset = rte_mbuf_dynfield_register(&desc_offs);
+ if (offset < 0)
+ goto error;
+ flag = rte_mbuf_dynflag_register(&desc_flag);
+ if (flag < 0)
+ goto error;
+ rte_flow_dynf_metadata_offs = offset;
+ rte_flow_dynf_metadata_mask = (1ULL << flag);
+ return 0;
+
+error:
+ rte_flow_dynf_metadata_offs = -1;
+ rte_flow_dynf_metadata_mask = 0ULL;
+ return -rte_errno;
+}
+
static int
flow_err(uint16_t port_id, int ret, struct rte_flow_error *error)
{