[dpdk-dev] [PATCH v1] doc: add new OCTEON TX2 feature to release notes

2021-04-06 Thread smadarf
From: Smadar Fuks 

This patch updates release notes for added support of
OCTEON TX2 flow action to port id

Signed-off-by: Smadar Fuks 
---
 doc/guides/rel_notes/release_21_05.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/release_21_05.rst 
b/doc/guides/rel_notes/release_21_05.rst
index 3c76148b1..250fb8ea8 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -119,6 +119,10 @@ New Features
   * Added command to display Rx queue used descriptor count.
 ``show port (port_id) rxq (queue_id) desc used count``
 
+* **Updated OCTEON TX2 ethdev driver.**
+
+  * Added support for flow action port id.
+
 
 Removed Items
 -
-- 
2.27.0



[dpdk-dev] [PATCH v2] net/octeontx2: support flow action port id

2021-04-08 Thread smadarf
From: Smadar Fuks 

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 
---
v2 - add new octeon tx2 feature to release notes
---
---
 doc/guides/nics/octeontx2.rst   |  6 +++
 doc/guides/rel_notes/release_21_05.rst  |  4 ++
 drivers/net/octeontx2/otx2_ethdev.c |  6 +--
 drivers/net/octeontx2/otx2_ethdev.h |  5 +++
 drivers/net/octeontx2/otx2_ethdev_devargs.c |  2 +-
 drivers/net/octeontx2/otx2_flow_parse.c | 47 -
 6 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst
index cca7f7fc7..258c1693f 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 3c76148b1..250fb8ea8 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -119,6 +119,10 @@ New Features
   * Added command to display Rx queue used descriptor count.
 ``show port (port_id) rxq (queue_id) desc used count``
 
+* **Updated OCTEON TX2 ethdev driver.**
+
+  * Added support for flow action port id.
+
 
 Removed Items
 -
diff --git a/drivers/net/octeontx2/otx2_ethdev.c 
b/drivers/net/octeontx2/otx2_ethdev.c
index b4e58853b..0834de0cb 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 7391f09b8..ac50da7b1 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   0xULL
 
+#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 8d9feb3a8..83f905315 100644
--- a/drivers/net/octeontx2/otx2_ethdev_devargs.c
+++ b/drivers/net/octeontx2/otx2_ethdev_devargs.c
@@ -201,7 +201,7 @@ otx2_ethdev_parse_devargs(struct rte_devargs *devargs, 
struct otx2_eth_dev *dev)
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 bbb845811..63a33142a 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;
+   

[dpdk-dev] [PATCH v1] net/octeontx2: support flow action port id

2021-03-26 Thread smadarf
From: Smadar Fuks 

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 
---
 doc/guides/nics/octeontx2.rst   |  6 +++
 drivers/net/octeontx2/otx2_ethdev.c |  6 +--
 drivers/net/octeontx2/otx2_ethdev.h |  5 +++
 drivers/net/octeontx2/otx2_ethdev_devargs.c |  2 +-
 drivers/net/octeontx2/otx2_flow_parse.c | 47 -
 5 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst
index cca7f7fc7..258c1693f 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/drivers/net/octeontx2/otx2_ethdev.c 
b/drivers/net/octeontx2/otx2_ethdev.c
index 389b66d03..4f95917e7 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 99f0469d8..5a9dc9be0 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   0xULL
 
+#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 8d9feb3a8..83f905315 100644
--- a/drivers/net/octeontx2/otx2_ethdev_devargs.c
+++ b/drivers/net/octeontx2/otx2_ethdev_devargs.c
@@ -201,7 +201,7 @@ otx2_ethdev_parse_devargs(struct rte_devargs *devargs, 
struct otx2_eth_dev *dev)
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 bbb845811..63a33142a 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;
+