if (port_id_is_invalid(res->port_id, ENABLED_WARN))
return;
- ports[res->port_id].tx_metadata = rte_cpu_to_be_32(res->value);
+ ports[res->port_id].tx_metadata = res->value;
/* Add/remove callback to insert valid metadata in every Tx packet. */
if (ports[res->port_id].tx_metadata)
add_tx_md_callback(res->port_id);
else
remove_tx_md_callback(res->port_id);
+ rte_flow_dynf_metadata_register();
}
cmdline_parse_token_string_t cmd_config_tx_metadata_specific_port =
DEV_TX_OFFLOAD_MBUF_FAST_FREE))
port->dev_conf.txmode.offloads &=
~DEV_TX_OFFLOAD_MBUF_FAST_FREE;
- if (!(port->dev_info.tx_offload_capa &
- DEV_TX_OFFLOAD_MATCH_METADATA))
- port->dev_conf.txmode.offloads &=
- ~DEV_TX_OFFLOAD_MATCH_METADATA;
if (numa_support) {
if (port_numa[pid] != NUMA_NO_CONFIG)
port_per_socket[port_numa[pid]]++;
struct softnic_port softport; /**< softnic params */
#endif
/**< metadata value to insert in Tx packets. */
- rte_be32_t tx_metadata;
+ uint32_t tx_metadata;
const struct rte_eth_rxtx_callback *tx_set_md_cb[MAX_QUEUE_ID+1];
};
mb->vlan_tci, mb->vlan_tci_outer);
else if (ol_flags & PKT_RX_VLAN)
printf(" - VLAN tci=0x%x", mb->vlan_tci);
- if (ol_flags & PKT_TX_METADATA)
- printf(" - Tx metadata: 0x%x", mb->tx_metadata);
+ if (ol_flags & PKT_TX_DYNF_METADATA)
+ printf(" - Tx metadata: 0x%x",
+ *RTE_FLOW_DYNF_METADATA(mb));
if (ol_flags & PKT_RX_DYNF_METADATA)
printf(" - Rx metadata: 0x%x",
*RTE_FLOW_DYNF_METADATA(mb));
* Add metadata value to every Tx packet,
* and set ol_flags accordingly.
*/
- for (i = 0; i < nb_pkts; i++) {
- pkts[i]->tx_metadata = ports[port_id].tx_metadata;
- pkts[i]->ol_flags |= PKT_TX_METADATA;
- }
+ if (rte_flow_dynf_metadata_avail())
+ for (i = 0; i < nb_pkts; i++) {
+ *RTE_FLOW_DYNF_METADATA(pkts[i]) =
+ ports[port_id].tx_metadata;
+ pkts[i]->ol_flags |= PKT_TX_DYNF_METADATA;
+ }
return nb_pkts;
}
VAL_NAME(PKT_TX_SEC_OFFLOAD),
VAL_NAME(PKT_TX_UDP_SEG),
VAL_NAME(PKT_TX_OUTER_UDP_CKSUM),
- VAL_NAME(PKT_TX_METADATA),
};
/* Test case to check with valid flag */
Matches 32 bit metadata item set.
On egress, metadata can be set either by mbuf metadata field with
-PKT_TX_METADATA flag or ``SET_META`` action. On ingress, ``SET_META``
+PKT_TX_DYNF_METADATA flag or ``SET_META`` action. On ingress, ``SET_META``
action sets metadata for a packet and the metadata will be reported via
``metadata`` dynamic field of ``rte_mbuf`` with PKT_RX_DYNF_METADATA flag.
Set metadata. Item ``META`` matches metadata.
-Metadata set by mbuf metadata field with PKT_TX_METADATA flag on egress will be
-overridden by this action. On ingress, the metadata will be carried by
+Metadata set by mbuf metadata field with PKT_TX_DYNF_METADATA flag on egress
+will be overridden by this action. On ingress, the metadata will be carried by
``metadata`` dynamic field of ``rte_mbuf`` which can be accessed by
``RTE_FLOW_DYNF_METADATA()``. PKT_RX_DYNF_METADATA flag will be set along
with the data.
is the minor compatibility issue for applications in case of 32-bit values
supported.
+* ethdev: the tx_metadata mbuf field is moved to dymanic one.
+ PKT_TX_METADATA flag is replaced with PKT_TX_DYNF_METADATA.
+ DEV_TX_OFFLOAD_MATCH_METADATA offload flag is removed, now metadata
+ support in PMD is engaged on dynamic field registration.
+
* event: The function ``rte_event_eth_tx_adapter_enqueue`` takes an additional
input as ``flags``. Flag ``RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST`` which
has been introduced in this release is used when used when all the packets
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-flow_dv_validate_item_meta(struct rte_eth_dev *dev,
+flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused,
const struct rte_flow_item *item,
const struct rte_flow_attr *attr,
struct rte_flow_error *error)
const struct rte_flow_item_meta *spec = item->spec;
const struct rte_flow_item_meta *mask = item->mask;
const struct rte_flow_item_meta nic_mask = {
- .data = RTE_BE32(UINT32_MAX)
+ .data = UINT32_MAX
};
int ret;
- uint64_t offloads = dev->data->dev_conf.txmode.offloads;
- if (!(offloads & DEV_TX_OFFLOAD_MATCH_METADATA))
- return rte_flow_error_set(error, EPERM,
- RTE_FLOW_ERROR_TYPE_ITEM,
- NULL,
- "match on metadata offload "
- "configuration is off for this port");
if (!spec)
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
meta_m = &rte_flow_item_meta_mask;
meta_v = (const void *)item->spec;
if (meta_v) {
- MLX5_SET(fte_match_set_misc2, misc2_m, metadata_reg_a,
- rte_be_to_cpu_32(meta_m->data));
- MLX5_SET(fte_match_set_misc2, misc2_v, metadata_reg_a,
- rte_be_to_cpu_32(meta_v->data & meta_m->data));
+ MLX5_SET(fte_match_set_misc2, misc2_m,
+ metadata_reg_a, meta_m->data);
+ MLX5_SET(fte_match_set_misc2, misc2_v,
+ metadata_reg_a, meta_v->data & meta_m->data);
}
}
es->swp_offs = txq_mbuf_to_swp(loc, &es->swp_flags, olx);
/* Fill metadata field if needed. */
es->metadata = MLX5_TXOFF_CONFIG(METADATA) ?
- loc->mbuf->ol_flags & PKT_TX_METADATA ?
- loc->mbuf->tx_metadata : 0 : 0;
+ loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
+ *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0 : 0;
/* Engage VLAN tag insertion feature if requested. */
if (MLX5_TXOFF_CONFIG(VLAN) &&
loc->mbuf->ol_flags & PKT_TX_VLAN_PKT) {
es->swp_offs = txq_mbuf_to_swp(loc, &es->swp_flags, olx);
/* Fill metadata field if needed. */
es->metadata = MLX5_TXOFF_CONFIG(METADATA) ?
- loc->mbuf->ol_flags & PKT_TX_METADATA ?
- loc->mbuf->tx_metadata : 0 : 0;
+ loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
+ *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0 : 0;
static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
(sizeof(uint16_t) +
sizeof(rte_v128u32_t)),
es->swp_offs = txq_mbuf_to_swp(loc, &es->swp_flags, olx);
/* Fill metadata field if needed. */
es->metadata = MLX5_TXOFF_CONFIG(METADATA) ?
- loc->mbuf->ol_flags & PKT_TX_METADATA ?
- loc->mbuf->tx_metadata : 0 : 0;
+ loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
+ *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0 : 0;
static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
(sizeof(uint16_t) +
sizeof(rte_v128u32_t)),
es->swp_offs = txq_mbuf_to_swp(loc, &es->swp_flags, olx);
/* Fill metadata field if needed. */
es->metadata = MLX5_TXOFF_CONFIG(METADATA) ?
- loc->mbuf->ol_flags & PKT_TX_METADATA ?
- loc->mbuf->tx_metadata : 0 : 0;
+ loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
+ *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0 : 0;
static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
(sizeof(uint16_t) +
sizeof(rte_v128u32_t)),
return false;
/* Fill metadata field if needed. */
if (MLX5_TXOFF_CONFIG(METADATA) &&
- es->metadata != (loc->mbuf->ol_flags & PKT_TX_METADATA ?
- loc->mbuf->tx_metadata : 0))
+ es->metadata != (loc->mbuf->ol_flags & PKT_TX_DYNF_METADATA ?
+ *RTE_FLOW_DYNF_METADATA(loc->mbuf) : 0))
return false;
/* There must be no VLAN packets in eMPW loop. */
if (MLX5_TXOFF_CONFIG(VLAN))
*/
olx |= MLX5_TXOFF_CONFIG_EMPW;
}
- if (tx_offloads & DEV_TX_OFFLOAD_MATCH_METADATA) {
+ if (rte_flow_dynf_metadata_avail()) {
/* We should support Flow metadata. */
olx |= MLX5_TXOFF_CONFIG_METADATA;
}
DEV_TX_OFFLOAD_TCP_CKSUM | \
DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)
-/* HW offload capabilities of vectorized Tx. */
-#define MLX5_VEC_TX_OFFLOAD_CAP \
- (MLX5_VEC_TX_CKSUM_OFFLOAD_CAP | \
- DEV_TX_OFFLOAD_MATCH_METADATA | \
- DEV_TX_OFFLOAD_MULTI_SEGS)
-
/*
* Compile time sanity check for vectorized functions.
*/
offloads |= (DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
DEV_TX_OFFLOAD_GRE_TNL_TSO);
}
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
- if (config->dv_flow_en)
- offloads |= DEV_TX_OFFLOAD_MATCH_METADATA;
-#endif
return offloads;
}
RTE_TX_OFFLOAD_BIT2STR(UDP_TNL_TSO),
RTE_TX_OFFLOAD_BIT2STR(IP_TNL_TSO),
RTE_TX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
- RTE_TX_OFFLOAD_BIT2STR(MATCH_METADATA),
};
#undef RTE_TX_OFFLOAD_BIT2STR
#define DEV_TX_OFFLOAD_IP_TNL_TSO 0x00080000
/** Device supports outer UDP checksum */
#define DEV_TX_OFFLOAD_OUTER_UDP_CKSUM 0x00100000
-/**
- * Device supports match on metadata Tx offload..
- * Application must set PKT_TX_METADATA and mbuf metadata field.
- */
-#define DEV_TX_OFFLOAD_MATCH_METADATA 0x00200000
#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001
/**< Device supports Rx queue setup after device started*/
/**
* RTE_FLOW_ITEM_TYPE_META
*
- * Matches a specified metadata value. On egress, metadata can be set either by
- * mbuf tx_metadata field with PKT_TX_METADATA flag or
- * RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META sets
- * metadata for a packet and the metadata will be reported via mbuf metadata
- * dynamic field with PKT_RX_DYNF_METADATA flag. The dynamic mbuf field must be
- * registered in advance by rte_flow_dynf_metadata_register().
+ * Matches a specified metadata value. On egress, metadata can be set
+ * either by mbuf dynamic metadata field with PKT_TX_DYNF_METADATA flag or
+ * RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META
+ * sets metadata for a packet and the metadata will be reported via mbuf
+ * metadata dynamic field with PKT_RX_DYNF_METADATA flag. The dynamic mbuf
+ * field must be registered in advance by rte_flow_dynf_metadata_register().
*/
struct rte_flow_item_meta {
uint32_t data;
*
* RTE_FLOW_ACTION_TYPE_SET_META
*
- * Set metadata. Metadata set by mbuf tx_metadata field with
- * PKT_TX_METADATA flag on egress will be overridden by this action. On
+ * Set metadata. Metadata set by mbuf metadata dynamic field with
+ * PKT_TX_DYNF_DATA flag on egress will be overridden by this action. On
* ingress, the metadata will be carried by mbuf metadata dynamic field
* with PKT_RX_DYNF_METADATA flag if set. The dynamic mbuf field must be
* registered in advance by rte_flow_dynf_metadata_register().
#define RTE_FLOW_DYNF_METADATA(m) \
RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
-/* Mbuf dynamic flag for metadata. */
+/* Mbuf dynamic flags for metadata. */
#define PKT_RX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
+#define PKT_TX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
__rte_experimental
static inline uint32_t
case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD";
case PKT_TX_UDP_SEG: return "PKT_TX_UDP_SEG";
case PKT_TX_OUTER_UDP_CKSUM: return "PKT_TX_OUTER_UDP_CKSUM";
- case PKT_TX_METADATA: return "PKT_TX_METADATA";
default: return NULL;
}
}
{ PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL },
{ PKT_TX_UDP_SEG, PKT_TX_UDP_SEG, NULL },
{ PKT_TX_OUTER_UDP_CKSUM, PKT_TX_OUTER_UDP_CKSUM, NULL },
- { PKT_TX_METADATA, PKT_TX_METADATA, NULL },
};
const char *name;
unsigned int i;
/* add new RX flags here, don't forget to update PKT_FIRST_FREE */
#define PKT_FIRST_FREE (1ULL << 23)
-#define PKT_LAST_FREE (1ULL << 39)
+#define PKT_LAST_FREE (1ULL << 40)
/* add new TX flags here, don't forget to update PKT_LAST_FREE */
-/**
- * Indicate that the metadata field in the mbuf is in use.
- */
-#define PKT_TX_METADATA (1ULL << 40)
-
/**
* Outer UDP checksum offload flag. This flag is used for enabling
* outer UDP checksum in PMD. To use outer UDP checksum, the user needs to
PKT_TX_MACSEC | \
PKT_TX_SEC_OFFLOAD | \
PKT_TX_UDP_SEG | \
- PKT_TX_OUTER_UDP_CKSUM | \
- PKT_TX_METADATA)
+ PKT_TX_OUTER_UDP_CKSUM)
/**
* Mbuf having an external buffer attached. shinfo in mbuf must be filled.
/**< User defined tags. See rte_distributor_process() */
uint32_t usr;
} hash; /**< hash information */
- struct {
- /**
- * Application specific metadata value
- * for egress flow rule match.
- * Valid if PKT_TX_METADATA is set.
- * Located here to allow conjunct use
- * with hash.sched.hi.
- */
- uint32_t tx_metadata;
- uint32_t reserved;
- };
};
/** Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ is set. */