net/cnxk: support port ID flow action

This patch adds support for rte flow action type port_id to
enable directing packets from an input port PF to an output
port which is a VF of the input port PF.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Satheesh Paul 2021-10-21 10:41:15 +05:30 committed by Jerin Jacob
parent 15f0b8a5b9
commit 00ea15e7a3
3 changed files with 42 additions and 0 deletions

View File

@ -305,6 +305,11 @@ RTE flow GRE support
- ``RTE_FLOW_ITEM_TYPE_GRE_KEY`` works only when checksum and routing - ``RTE_FLOW_ITEM_TYPE_GRE_KEY`` works only when checksum and routing
bits in the GRE header are equal to 0. bits in the GRE header are equal to 0.
RTE flow action port_id support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its VFs.
Custom protocols supported in RTE Flow Custom protocols supported in RTE Flow
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -85,6 +85,7 @@ of_push_vlan = Y
of_set_vlan_pcp = Y of_set_vlan_pcp = Y
of_set_vlan_vid = Y of_set_vlan_vid = Y
pf = Y pf = Y
port_id = Y
queue = Y queue = Y
rss = Y rss = Y
security = Y security = Y

View File

@ -110,7 +110,13 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
struct roc_npc_action in_actions[], uint32_t *flowkey_cfg) struct roc_npc_action in_actions[], uint32_t *flowkey_cfg)
{ {
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
const struct rte_flow_action_port_id *port_act;
const struct rte_flow_action_queue *act_q; const struct rte_flow_action_queue *act_q;
struct roc_npc *roc_npc_src = &dev->npc;
struct rte_eth_dev *portid_eth_dev;
char if_name[RTE_ETH_NAME_MAX_LEN];
struct cnxk_eth_dev *hw_dst;
struct roc_npc *roc_npc_dst;
int i = 0, rc = 0; int i = 0, rc = 0;
int rq; int rq;
@ -146,6 +152,36 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
in_actions[i].conf = actions->conf; in_actions[i].conf = actions->conf;
break; break;
case RTE_FLOW_ACTION_TYPE_PORT_ID:
in_actions[i].type = ROC_NPC_ACTION_TYPE_PORT_ID;
in_actions[i].conf = actions->conf;
port_act = (const struct rte_flow_action_port_id *)
actions->conf;
if (rte_eth_dev_get_name_by_port(port_act->id,
if_name)) {
plt_err("Name not found for output port id");
goto err_exit;
}
portid_eth_dev = rte_eth_dev_allocated(if_name);
if (!portid_eth_dev) {
plt_err("eth_dev not found for output port id");
goto err_exit;
}
if (strcmp(portid_eth_dev->device->driver->name,
eth_dev->device->driver->name) != 0) {
plt_err("Output port not under same driver");
goto err_exit;
}
hw_dst = portid_eth_dev->data->dev_private;
roc_npc_dst = &hw_dst->npc;
rc = roc_npc_validate_portid_action(roc_npc_src,
roc_npc_dst);
if (rc)
goto err_exit;
break;
case RTE_FLOW_ACTION_TYPE_QUEUE: case RTE_FLOW_ACTION_TYPE_QUEUE:
act_q = (const struct rte_flow_action_queue *) act_q = (const struct rte_flow_action_queue *)
actions->conf; actions->conf;