@@ -465,6 +465,8 @@ enum index {
ITEM_METER,
ITEM_METER_COLOR,
ITEM_METER_COLOR_NAME,
+ ITEM_PHY_AFFINITY,
+ ITEM_PHY_AFFINITY_VALUE,
/* Validate/create actions. */
ACTIONS,
@@ -1355,6 +1357,7 @@ static const enum index next_item[] = {
ITEM_L2TPV2,
ITEM_PPP,
ITEM_METER,
+ ITEM_PHY_AFFINITY,
END_SET,
ZERO,
};
@@ -1821,6 +1824,12 @@ static const enum index item_meter[] = {
ZERO,
};
+static const enum index item_phy_affinity[] = {
+ ITEM_PHY_AFFINITY_VALUE,
+ ITEM_NEXT,
+ ZERO,
+};
+
static const enum index next_action[] = {
ACTION_END,
ACTION_VOID,
@@ -6443,6 +6452,23 @@ static const struct token token_list[] = {
ARGS_ENTRY(struct buffer, port)),
.call = parse_mp,
},
+ [ITEM_PHY_AFFINITY] = {
+ .name = "phy_affinity",
+ .help = "match on the physical affinity of the"
+ " received packet.",
+ .priv = PRIV_ITEM(PHY_AFFINITY,
+ sizeof(struct rte_flow_item_phy_affinity)),
+ .next = NEXT(item_phy_affinity),
+ .call = parse_vc,
+ },
+ [ITEM_PHY_AFFINITY_VALUE] = {
+ .name = "affinity",
+ .help = "physical affinity value",
+ .next = NEXT(item_phy_affinity, NEXT_ENTRY(COMMON_UNSIGNED),
+ item_param),
+ .args = ARGS(ARGS_ENTRY(struct rte_flow_item_phy_affinity,
+ affinity)),
+ },
};
/** Remove and return last entry from argument stack. */
@@ -10981,6 +11007,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
case RTE_FLOW_ITEM_TYPE_METER_COLOR:
mask = &rte_flow_item_meter_color_mask;
break;
+ case RTE_FLOW_ITEM_TYPE_PHY_AFFINITY:
+ mask = &rte_flow_item_phy_affinity_mask;
+ break;
default:
break;
}
@@ -1544,6 +1544,14 @@ Matches Color Marker set by a Meter.
- ``color``: Metering color marker.
+Item: ``PHY_AFFINITY``
+^^^^^^^^^^^^^^^^^^^^^^
+
+Matches on the physical affinity of the received packet, the physical port
+in the group of physical ports connected to a single DPDK port.
+
+- ``affinity``: Physical affinity.
+
Actions
~~~~~~~
@@ -69,6 +69,12 @@ New Features
``rte_event_dev_config::nb_single_link_event_port_queues`` parameter
required for eth_rx, eth_tx, crypto and timer eventdev adapters.
+* **Added rte_flow support for matching PHY affinity fields.**
+
+ For the multiple hardware ports connect to a single DPDK port (mhpsdp),
+ Added ``phy_affinity`` item in rte_flow to support physical affinity of
+ the packets.
+
Removed Items
-------------
@@ -3725,6 +3725,10 @@ This section lists supported pattern items and their attributes, if any.
- ``color {value}``: meter color value (green/yellow/red).
+- ``phy_affinity``: match physical affinity.
+
+ - ``affinity {value}``: physical affinity value.
+
- ``send_to_kernel``: send packets to kernel.
@@ -157,6 +157,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
MK_FLOW_ITEM(L2TPV2, sizeof(struct rte_flow_item_l2tpv2)),
MK_FLOW_ITEM(PPP, sizeof(struct rte_flow_item_ppp)),
MK_FLOW_ITEM(METER_COLOR, sizeof(struct rte_flow_item_meter_color)),
+ MK_FLOW_ITEM(PHY_AFFINITY, sizeof(struct rte_flow_item_phy_affinity)),
};
/** Generate flow_action[] entry. */
@@ -624,6 +624,13 @@ enum rte_flow_item_type {
* See struct rte_flow_item_meter_color.
*/
RTE_FLOW_ITEM_TYPE_METER_COLOR,
+
+ /**
+ * Matches on the physical affinity of the received packet.
+ *
+ * @see struct rte_flow_item_phy_affinity.
+ */
+ RTE_FLOW_ITEM_TYPE_PHY_AFFINITY,
};
/**
@@ -2103,6 +2110,32 @@ static const struct rte_flow_item_meter_color rte_flow_item_meter_color_mask = {
};
#endif
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_PHY_AFFINITY
+ *
+ * For the multiple hardware ports connect to a single DPDK port (mhpsdp),
+ * use this item to match the physical affinity of the packets.
+ */
+struct rte_flow_item_phy_affinity {
+ uint8_t affinity;
+ /**
+ * Affinity defines the phy affinity value to match the physical
+ * port of received packet. The value starts from 1 and uses 1 to
+ * match the first physical port.
+ */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_PHY_AFFINITY. */
+#ifndef __cplusplus
+static const struct rte_flow_item_phy_affinity
+rte_flow_item_phy_affinity_mask = {
+ .affinity = 0xff,
+};
+#endif
+
/**
* Action types.
*