From: Smadar Fuks Date: Thu, 8 Apr 2021 10:21:13 +0000 (-0400) Subject: net/octeontx2: support flow action port ID X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1b14508b3b34e768ad92c757ecace48b6e23c485;p=dpdk.git net/octeontx2: support flow action port ID Action port_id was not supported until now. In this patch the action port_id supports passing from input port PF to output port which is one of input port respective VF Signed-off-by: Smadar Fuks Acked-by: Jerin Jacob --- diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst index cca7f7fc72..258c1693fc 100644 --- a/doc/guides/nics/octeontx2.rst +++ b/doc/guides/nics/octeontx2.rst @@ -401,6 +401,12 @@ Actions: +----+-----------------------------------------+ | 11 | RTE_FLOW_ACTION_TYPE_OF_POP_VLAN | +----+-----------------------------------------+ + | 12 | RTE_FLOW_ACTION_TYPE_PORT_ID | + +----+-----------------------------------------+ + +.. note:: + + ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its VFs. .. _table_octeontx2_supported_egress_action_types: diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index ba773defb4..f1ccbb58ee 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -113,6 +113,10 @@ New Features * Added Intel ice support on Windows. +* **Updated Marvell OCTEON TX2 ethdev driver.** + + * Added support for flow action port id. + * **Updated Mellanox mlx5 driver.** Updated the Mellanox mlx5 driver with new features and improvements, including: diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index b4e58853b3..0834de0cb1 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -2802,6 +2802,6 @@ static struct rte_pci_driver pci_nix = { .remove = nix_remove, }; -RTE_PMD_REGISTER_PCI(net_octeontx2, pci_nix); -RTE_PMD_REGISTER_PCI_TABLE(net_octeontx2, pci_nix_map); -RTE_PMD_REGISTER_KMOD_DEP(net_octeontx2, "vfio-pci"); +RTE_PMD_REGISTER_PCI(OCTEONTX2_PMD, pci_nix); +RTE_PMD_REGISTER_PCI_TABLE(OCTEONTX2_PMD, pci_nix_map); +RTE_PMD_REGISTER_KMOD_DEP(OCTEONTX2_PMD, "vfio-pci"); diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h index 7391f09b8a..ac50da7b18 100644 --- a/drivers/net/octeontx2/otx2_ethdev.h +++ b/drivers/net/octeontx2/otx2_ethdev.h @@ -164,6 +164,11 @@ /* Additional timesync values. */ #define OTX2_CYCLECOUNTER_MASK 0xffffffffffffffffULL +#define OCTEONTX2_PMD net_octeontx2 + +#define otx2_ethdev_is_same_driver(dev) \ + (strcmp((dev)->device->driver->name, RTE_STR(OCTEONTX2_PMD)) == 0) + enum nix_q_size_e { nix_q_size_16, /* 16 entries */ nix_q_size_64, /* 64 entries */ diff --git a/drivers/net/octeontx2/otx2_ethdev_devargs.c b/drivers/net/octeontx2/otx2_ethdev_devargs.c index 8d9feb3a8f..83f905315b 100644 --- a/drivers/net/octeontx2/otx2_ethdev_devargs.c +++ b/drivers/net/octeontx2/otx2_ethdev_devargs.c @@ -201,7 +201,7 @@ exit: return -EINVAL; } -RTE_PMD_REGISTER_PARAM_STRING(net_octeontx2, +RTE_PMD_REGISTER_PARAM_STRING(OCTEONTX2_PMD, OTX2_RSS_RETA_SIZE "=<64|128|256>" OTX2_IPSEC_IN_MAX_SPI "=<1-65535>" OTX2_SCL_ENABLE "=1" diff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c index bbb8458116..63a33142a5 100644 --- a/drivers/net/octeontx2/otx2_flow_parse.c +++ b/drivers/net/octeontx2/otx2_flow_parse.c @@ -900,14 +900,17 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev, { struct otx2_eth_dev *hw = dev->data->dev_private; struct otx2_npc_flow_info *npc = &hw->npc_flow; + const struct rte_flow_action_port_id *port_act; const struct rte_flow_action_count *act_count; const struct rte_flow_action_mark *act_mark; const struct rte_flow_action_queue *act_q; const struct rte_flow_action_vf *vf_act; + uint16_t pf_func, vf_id, port_id, pf_id; + char if_name[RTE_ETH_NAME_MAX_LEN]; bool vlan_insert_action = false; + struct rte_eth_dev *eth_dev; const char *errmsg = NULL; int sel_act, req_act = 0; - uint16_t pf_func, vf_id; int errcode = 0; int mark = 0; int rq = 0; @@ -983,6 +986,48 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev, } break; + case RTE_FLOW_ACTION_TYPE_PORT_ID: + port_act = (const struct rte_flow_action_port_id *) + actions->conf; + port_id = port_act->id; + if (rte_eth_dev_get_name_by_port(port_id, if_name)) { + errmsg = "Name not found for output port id"; + errcode = EINVAL; + goto err_exit; + } + eth_dev = rte_eth_dev_allocated(if_name); + if (!eth_dev) { + errmsg = "eth_dev not found for output port id"; + errcode = EINVAL; + goto err_exit; + } + if (!otx2_ethdev_is_same_driver(eth_dev)) { + errmsg = "Output port id unsupported type"; + errcode = ENOTSUP; + goto err_exit; + } + if (!otx2_dev_is_vf(otx2_eth_pmd_priv(eth_dev))) { + errmsg = "Output port should be VF"; + errcode = ENOTSUP; + goto err_exit; + } + vf_id = otx2_eth_pmd_priv(eth_dev)->vf; + if (vf_id >= hw->maxvf) { + errmsg = "Invalid vf for output port"; + errcode = EINVAL; + goto err_exit; + } + pf_id = otx2_eth_pmd_priv(eth_dev)->pf; + if (pf_id != hw->pf) { + errmsg = "Output port unsupported PF"; + errcode = ENOTSUP; + goto err_exit; + } + pf_func &= (0xfc00); + pf_func = (pf_func | (vf_id + 1)); + req_act |= OTX2_FLOW_ACT_VF; + break; + case RTE_FLOW_ACTION_TYPE_QUEUE: /* Applicable only to ingress flow */ act_q = (const struct rte_flow_action_queue *)