From patchwork Wed Oct 7 12:56:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Vesnovaty X-Patchwork-Id: 79873 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 51469A04BA; Wed, 7 Oct 2020 14:56:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4C9921BBD1; Wed, 7 Oct 2020 14:56:26 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id B84851BBD1 for ; Wed, 7 Oct 2020 14:56:24 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from andreyv@nvidia.com) with SMTP; 7 Oct 2020 15:56:18 +0300 Received: from nvidia.com (r-arch-host11.mtr.labs.mlnx [10.213.43.60]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 097CuFhQ002963; Wed, 7 Oct 2020 15:56:18 +0300 From: Andrey Vesnovaty To: dev@dpdk.org Cc: jer@marvell.com, jerinjacobk@gmail.com, thomas@monjalon.net, ferruh.yigit@intel.com, stephen@networkplumber.org, bruce.richardson@intel.com, orika@nvidia.com, viacheslavo@nvidia.com, andrey.vesnovaty@gmail.com, mdr@ashroe.eu, nhorman@tuxdriver.com, ajit.khaparde@broadcom.com, samik.gupta@broadcom.com, Andrew Rybchenko Date: Wed, 7 Oct 2020 15:56:11 +0300 Message-Id: <20201007125612.20579-2-andreyv@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201007125612.20579-1-andreyv@nvidia.com> References: <20200702120511.16315-1-andreyv@mellanox.com> <20201007125612.20579-1-andreyv@nvidia.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v5 1/2] ethdev: add flow shared action API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commit introduces extension of DPDK flow action API enabling sharing of single rte_flow_action in multiple flows. The API intended for PMDs, where multiple HW offloaded flows can reuse the same HW essence/object representing flow action and modification of such an essence/object affects all the rules using it. Motivation and example === Adding or removing one or more queues to RSS used by multiple flow rules imposes per rule toll for current DPDK flow API; the scenario requires for each flow sharing cloned RSS action: - call `rte_flow_destroy()` - call `rte_flow_create()` with modified RSS action API for sharing action and its in-place update benefits: - reduce the overhead of multiple RSS flow rules reconfiguration - optimize resource utilization by sharing action across multiple flows Change description === Shared action === In order to represent flow action shared by multiple flows new action type RTE_FLOW_ACTION_TYPE_SHARED is introduced (see `enum rte_flow_action_type`). Actually the introduced API decouples action from any specific flow and enables sharing of single action by its handle across multiple flows. Shared action create/use/destroy === Shared action may be reused by some or none flow rules at any given moment, i.e. shared action reside outside of the context of any flow. Shared action represent HW resources/objects used for action offloading implementation. API for shared action create (see `rte_flow_shared_action_create()`): - should allocate HW resources and make related initializations required for shared action implementation. - make necessary preparations to maintain shared access to the action resources, configuration and state. API for shared action destroy (see `rte_flow_shared_action_destroy()`) should release HW resources and make related cleanups required for shared action implementation. In order to share some flow action reuse the handle of type `struct rte_flow_shared_action` returned by rte_flow_shared_action_create() as a `conf` field of `struct rte_flow_action` (see "example" section). If some shared action not used by any flow rule all resources allocated by the shared action can be released by rte_flow_shared_action_destroy() (see "example" section). The shared action handle passed as argument to destroy API should not be used any further i.e. result of the usage is undefined. Shared action re-configuration === Shared action behavior defined by its configuration can be updated via rte_flow_shared_action_update() (see "example" section). The shared action update operation modifies HW related resources/objects allocated on the action creation. The number of operations performed by the update operation should not depend on the number of flows sharing the related action. On return of shared action update API action behavior should be according to updated configuration for all flows sharing the action. Shared action query === Provide separate API to query shared action state (see rte_flow_shared_action_update()). Taking a counter as an example: query returns value aggregating all counter increments across all flow rules sharing the counter. This API doesn't query shared action configuration since it is controlled by rte_flow_shared_action_create() and rte_flow_shared_action_update() APIs and no supposed to change by other means. PMD support === The support of introduced API is pure PMD specific design and responsibility for each action type (see struct rte_flow_ops). testpmd === In order to utilize introduced API testpmd cli may implement following extension create/update/destroy/query shared action accordingly flow shared_action (port) create {action_id (id)} (action) / end flow shared_action (port) update (id) (action) / end flow shared_action (port) destroy action_id (id) {action_id (id) [...]} flow shared_action (port) query (id) testpmd example === configure rss to queues 1 & 2 > flow shared_action 0 create action_id 100 rss queues 1 2 end / end create flow rule utilizing shared action > flow create 0 ingress \ pattern eth dst is 0c:42:a1:15:fd:ac / ipv6 / tcp / end \ actions shared 100 / end add 2 more queues > flow shared_action 0 modify 100 rss queues 1 2 3 4 end / end example === struct rte_flow_action actions[2]; struct rte_flow_action action; /* skipped: initialize action */ struct rte_flow_shared_action *handle = rte_flow_shared_action_create( port_id, &action, &error); actions[0].type = RTE_FLOW_ACTION_TYPE_SHARED; actions[0].conf = handle; actions[1].type = RTE_FLOW_ACTION_TYPE_END; /* skipped: init attr0 & pattern0 args */ struct rte_flow *flow0 = rte_flow_create(port_id, &attr0, pattern0, actions, error); /* create more rules reusing shared action */ struct rte_flow *flow1 = rte_flow_create(port_id, &attr1, pattern1, actions, error); /* skipped: for flows 2 till N */ struct rte_flow *flowN = rte_flow_create(port_id, &attrN, patternN, actions, error); /* update shared action */ struct rte_flow_action updated_action; /* * skipped: initialize updated_action according to desired action * configuration change */ rte_flow_shared_action_update(port_id, handle, &updated_action, error); /* * from now on all flows 1 till N will act according to configuration of * updated_action */ /* skipped: destroy all flows 1 till N */ rte_flow_shared_action_destroy(port_id, handle, error); Signed-off-by: Andrey Vesnovaty Acked-by: Ori Kam --- doc/guides/prog_guide/rte_flow.rst | 19 +++ doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev_version.map | 4 + lib/librte_ethdev/rte_flow.c | 84 ++++++++++++ lib/librte_ethdev/rte_flow.h | 163 ++++++++++++++++++++++- lib/librte_ethdev/rte_flow_driver.h | 23 ++++ 6 files changed, 301 insertions(+), 1 deletion(-) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 119b128739..8cff8a0440 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2666,6 +2666,25 @@ timeout passed without any matching on the flow. | ``context`` | user input flow context | +--------------+---------------------------------+ +Action: ``SHARED`` +^^^^^^^^^^^^^^^^^^ + +Flow Utilize shared action by handle as returned from +``rte_flow_shared_action_create()``. + +The behaviour of the shared action defined by ``action`` argument of type +``struct rte_flow_action`` passed to ``rte_flow_shared_action_create()``. + +.. _table_rte_flow_shared_action: + +.. table:: SHARED + + +---------------+ + | Field | + +===============+ + | no properties | + +---------------+ + Negative types ~~~~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index 0b2a3700c3..87c90909be 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -109,6 +109,15 @@ New Features * Extern objects and functions can be plugged into the pipeline. * Transaction-oriented table updates. +* **Add shared action support for rte flow.** + + Added shared action support to utilize single rte flow action in multiple + rte flow rules. An update of shared action configuration alters the behavior + of all rte flow rules using it. + + * Added new action: ``RTE_FLOW_ACTION_TYPE_SHARED`` to use shared action + as rte flow action. + * Added new rte flow APIs to create/update/destroy/query shared action. Removed Items ------------- diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index c95ef5157a..a8a4821dbb 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -229,6 +229,10 @@ EXPERIMENTAL { # added in 20.11 rte_eth_link_speed_to_str; rte_eth_link_to_str; + rte_flow_shared_action_create; + rte_flow_shared_action_destroy; + rte_flow_shared_action_update; + rte_flow_shared_action_query; }; INTERNAL { diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index f8fdd68fe9..9afa8905df 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -174,6 +174,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(SET_IPV4_DSCP, sizeof(struct rte_flow_action_set_dscp)), MK_FLOW_ACTION(SET_IPV6_DSCP, sizeof(struct rte_flow_action_set_dscp)), MK_FLOW_ACTION(AGE, sizeof(struct rte_flow_action_age)), + MK_FLOW_ACTION(SHARED, 0), }; int @@ -1251,3 +1252,86 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, rte_strerror(ENOTSUP)); } + +struct rte_flow_shared_action * +rte_flow_shared_action_create(uint16_t port_id, + const struct rte_flow_shared_action_conf *conf, + const struct rte_flow_action *action, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + struct rte_flow_shared_action *shared_action; + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); + + if (unlikely(!ops)) + return NULL; + if (likely(!!ops->shared_action_create)) { + shared_action = ops->shared_action_create(dev, conf, action, + error); + if (shared_action == NULL) + flow_err(port_id, -rte_errno, error); + return shared_action; + } + rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(ENOSYS)); + return NULL; +} + +int +rte_flow_shared_action_destroy(uint16_t port_id, + struct rte_flow_shared_action *action, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); + + if (unlikely(!ops)) + return -rte_errno; + if (likely(!!ops->shared_action_destroy)) + return flow_err(port_id, + ops->shared_action_destroy(dev, action, error), + error); + return rte_flow_error_set(error, ENOSYS, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(ENOSYS)); +} + +int +rte_flow_shared_action_update(uint16_t port_id, + struct rte_flow_shared_action *action, + const struct rte_flow_action *update, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); + + if (unlikely(!ops)) + return -rte_errno; + if (likely(!!ops->shared_action_update)) + return flow_err(port_id, ops->shared_action_update(dev, action, + update, error), + error); + return rte_flow_error_set(error, ENOSYS, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(ENOSYS)); +} + +int +rte_flow_shared_action_query(uint16_t port_id, + const struct rte_flow_shared_action *action, + void *data, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); + + if (unlikely(!ops)) + return -rte_errno; + if (likely(!!ops->shared_action_query)) + return flow_err(port_id, ops->shared_action_query(dev, action, + data, error), + error); + return rte_flow_error_set(error, ENOSYS, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(ENOSYS)); +} diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index da8bfa5489..383d516fbd 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1714,7 +1714,8 @@ enum rte_flow_action_type { /** * Enables counters for this flow rule. * - * These counters can be retrieved and reset through rte_flow_query(), + * These counters can be retrieved and reset through rte_flow_query() or + * rte_flow_shared_action_query() if the action provided via handle, * see struct rte_flow_query_count. * * See struct rte_flow_action_count. @@ -2132,6 +2133,14 @@ enum rte_flow_action_type { * see enum RTE_ETH_EVENT_FLOW_AGED */ RTE_FLOW_ACTION_TYPE_AGE, + + /** + * Describe action shared a cross multiple flow rules. + * + * Allow multiple rules reference the same action by handle (see + * struct rte_flow_shared_action). + */ + RTE_FLOW_ACTION_TYPE_SHARED, }; /** @@ -2693,6 +2702,20 @@ struct rte_flow_action_set_dscp { uint8_t dscp; }; + +/** + * RTE_FLOW_ACTION_TYPE_SHARED + * + * Opaque type returned after successfully creating a shared action. + * + * This handle can be used to manage and query the related action: + * - share it a cross multiple flow rules + * - update action configuration + * - query action data + * - destroy action + */ +struct rte_flow_shared_action; + /* Mbuf dynamic field offset for metadata. */ extern int32_t rte_flow_dynf_metadata_offs; @@ -3357,6 +3380,144 @@ int rte_flow_get_aged_flows(uint16_t port_id, void **contexts, uint32_t nb_contexts, struct rte_flow_error *error); +/** + * Specify shared action configuration + */ +struct rte_flow_shared_action_conf { + uint32_t ingress:1; + /**< Action valid for rules applied to ingress traffic. */ + uint32_t egress:1; + /**< Action valid for rules applied to egress traffic. */ +}; + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Create shared action for reuse in multiple flow rules. + * The created shared action has single state and configuration + * across all flow rules using it. + * + * @param[in] port_id + * The port identifier of the Ethernet device. + * @param[in] conf + * Shared action configuration. + * @param[in] action + * Action configuration for shared action creation. + * @param[out] error + * Perform verbose error reporting if not NULL. PMDs initialize this + * structure in case of error only. + * @return + * A valid handle in case of success, NULL otherwise and rte_errno is set + * to one of the error codes defined: + * - (ENOSYS) if underlying device does not support this functionality. + * - (EIO) if underlying device is removed. + * - (EINVAL) if *action* invalid. + * - (ENOTSUP) if *action* valid but unsupported. + */ +__rte_experimental +struct rte_flow_shared_action * +rte_flow_shared_action_create(uint16_t port_id, + const struct rte_flow_shared_action_conf *conf, + const struct rte_flow_action *action, + struct rte_flow_error *error); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Destroy the shared action by handle. + * + * @param[in] port_id + * The port identifier of the Ethernet device. + * @param[in] action + * Handle for the shared action to be destroyed. + * @param[out] error + * Perform verbose error reporting if not NULL. PMDs initialize this + * structure in case of error only. + * @return + * - (0) if success. + * - (-ENOSYS) if underlying device does not support this functionality. + * - (-EIO) if underlying device is removed. + * - (-ENOENT) if action pointed by *action* handle was not found. + * - (-ETOOMANYREFS) if action pointed by *action* handle still used by one or + * more rules + * rte_errno is also set. + */ +__rte_experimental +int +rte_flow_shared_action_destroy(uint16_t port_id, + struct rte_flow_shared_action *action, + struct rte_flow_error *error); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Update in-place the shared action configuration pointed by *action* handle + * with the configuration provided as *update* argument. + * The update of the shared action configuration effects all flow rules reusing + * the action via handle. + * + * @param[in] port_id + * The port identifier of the Ethernet device. + * @param[in] action + * Handle for the shared action to be updated. + * @param[in] update + * Action specification used to modify the action pointed by handle. + * *update* should be of same type with the action pointed by the *action* + * handle argument, otherwise considered as invalid. + * @param[out] error + * Perform verbose error reporting if not NULL. PMDs initialize this + * structure in case of error only. + * @return + * - (0) if success. + * - (-ENOSYS) if underlying device does not support this functionality. + * - (-EIO) if underlying device is removed. + * - (-EINVAL) if *update* invalid. + * - (-ENOTSUP) if *update* valid but unsupported. + * - (-ENOENT) if action pointed by *ctx* was not found. + * rte_errno is also set. + */ +__rte_experimental +int +rte_flow_shared_action_update(uint16_t port_id, + struct rte_flow_shared_action *action, + const struct rte_flow_action *update, + struct rte_flow_error *error); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Query the shared action by handle. + * + * Retrieve action-specific data such as counters. + * Data is gathered by special action which may be present/referenced in + * more than one flow rule definition. + * + * \see RTE_FLOW_ACTION_TYPE_COUNT + * + * @param port_id + * Port identifier of Ethernet device. + * @param[in] action + * Handle for the shared action to query. + * @param[in, out] data + * Pointer to storage for the associated query data type. + * @param[out] error + * Perform verbose error reporting if not NULL. PMDs initialize this + * structure in case of error only. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +__rte_experimental +int +rte_flow_shared_action_query(uint16_t port_id, + const struct rte_flow_shared_action *action, + void *data, + struct rte_flow_error *error); + #ifdef __cplusplus } #endif diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h index 3ee871d3eb..adaace47ea 100644 --- a/lib/librte_ethdev/rte_flow_driver.h +++ b/lib/librte_ethdev/rte_flow_driver.h @@ -108,6 +108,29 @@ struct rte_flow_ops { void **context, uint32_t nb_contexts, struct rte_flow_error *err); + /** See rte_flow_shared_action_create() */ + struct rte_flow_shared_action *(*shared_action_create) + (struct rte_eth_dev *dev, + const struct rte_flow_shared_action_conf *conf, + const struct rte_flow_action *action, + struct rte_flow_error *error); + /** See rte_flow_shared_action_destroy() */ + int (*shared_action_destroy) + (struct rte_eth_dev *dev, + struct rte_flow_shared_action *shared_action, + struct rte_flow_error *error); + /** See rte_flow_shared_action_update() */ + int (*shared_action_update) + (struct rte_eth_dev *dev, + struct rte_flow_shared_action *shared_action, + const struct rte_flow_action *update, + struct rte_flow_error *error); + /** See rte_flow_shared_action_query() */ + int (*shared_action_query) + (struct rte_eth_dev *dev, + const struct rte_flow_shared_action *shared_action, + void *data, + struct rte_flow_error *error); }; /** From patchwork Wed Oct 7 12:56:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Vesnovaty X-Patchwork-Id: 79874 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33957A04BA; Wed, 7 Oct 2020 14:57:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CFCEB1BBEA; Wed, 7 Oct 2020 14:56:27 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id B94641BACD for ; Wed, 7 Oct 2020 14:56:24 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from andreyv@nvidia.com) with SMTP; 7 Oct 2020 15:56:20 +0300 Received: from nvidia.com (r-arch-host11.mtr.labs.mlnx [10.213.43.60]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 097CuFhR002963; Wed, 7 Oct 2020 15:56:19 +0300 From: Andrey Vesnovaty To: dev@dpdk.org Cc: jer@marvell.com, jerinjacobk@gmail.com, thomas@monjalon.net, ferruh.yigit@intel.com, stephen@networkplumber.org, bruce.richardson@intel.com, orika@nvidia.com, viacheslavo@nvidia.com, andrey.vesnovaty@gmail.com, mdr@ashroe.eu, nhorman@tuxdriver.com, ajit.khaparde@broadcom.com, samik.gupta@broadcom.com, Wenzhuo Lu , Beilei Xing , Bernard Iremonger Date: Wed, 7 Oct 2020 15:56:12 +0300 Message-Id: <20201007125612.20579-3-andreyv@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201007125612.20579-1-andreyv@nvidia.com> References: <20200702120511.16315-1-andreyv@mellanox.com> <20201007125612.20579-1-andreyv@nvidia.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v5 2/2] app/testpmd: support shared action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds shared action support to testpmd CLI. All shared actions created via testpmd CLI assigned ID for further reference in other CLI commands. Shared action ID supplied as CLI argument or assigned by testpmd is similar to flow ID & limited to scope of testpdm CLI. Create shared action syntax: flow shared_action (port) create {action_id (shared_action_id)} \ (action) / end Create shared action examples: flow shared_action 0 create action_id 100 \ rss queues 1 2 end / end This creates shared rss action with id 100 on port 0. flow shared_action 0 create action_id \ rss queues 0 1 end / end This creates shared rss action with id assigned by tetspmd on port 0. Update shared action syntax: flow shared_action (port) update (shared_action_id) (action) / end Update shared action example: flow shared_action 0 update 100 rss queues 0 3 end / end This updates shared rss action having id 100 on port 0 with rss to queues 0 3 (in create example rss queues were 1 & 2). Destroy shared action syntax: flow shared_action (port) destroy action_id (shared_action_id) \ { action_id (shared_action_id) [...]} Update shared action example: flow shared_action 0 destroy action_id 100 action_id 101 This destroys shared actions having id 100 & 101 Query shared action syntax: flow shared_action (port) query (shared_action_id) Query shared action example: flow shared_action 0 query 100 This queries shared actions having id 100 Use shared action as flow action syntax: flow create (port) ... / end actions {action / [...]} \ shared (action_id) / {action / [...]} end Use shared action as flow action example: flow create 0 ingress pattern ... / end \ actions shared 100 / end This creates flow rule where rss action is shared rss action having id 100. All shared action CLIs report status of the command. Shared action query CLI output depends on action type. Signed-off-by: Andrey Vesnovaty Acked-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 262 +++++++++++++++++++- app/test-pmd/config.c | 217 ++++++++++++++++ app/test-pmd/testpmd.h | 19 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 111 +++++++++ 4 files changed, 608 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 6e04d538ea..402ce69aa3 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -49,6 +49,7 @@ enum index { PORT_ID, GROUP_ID, PRIORITY_LEVEL, + SHARED_ACTION_ID, /* Top-level command. */ SET, @@ -60,6 +61,7 @@ enum index { /* Top-level command. */ FLOW, /* Sub-level commands. */ + SHARED_ACTION, VALIDATE, CREATE, DESTROY, @@ -89,6 +91,18 @@ enum index { EGRESS, TRANSFER, + /* Shared action arguments */ + SHARED_ACTION_CREATE, + SHARED_ACTION_UPDATE, + SHARED_ACTION_DESTROY, + SHARED_ACTION_QUERY, + + /* Shared action create arguments */ + SHARED_ACTION_CREATE_ID, + + /* Shared action destroy arguments */ + SHARED_ACTION_DESTROY_ID, + /* Validate/create pattern. */ PATTERN, ITEM_PARAM_IS, @@ -360,6 +374,8 @@ enum index { ACTION_SET_IPV6_DSCP_VALUE, ACTION_AGE, ACTION_AGE_TIMEOUT, + ACTION_SHARED, + SHARED_ACTION_ID2PTR, }; /** Maximum size for pattern in struct rte_flow_item_raw. */ @@ -653,6 +669,13 @@ struct buffer { enum index command; /**< Flow command. */ portid_t port; /**< Affected port ID. */ union { + struct { + uint32_t *action_id; + uint32_t action_id_n; + } sa_destroy; /**< Shared action destroy arguments. */ + struct { + uint32_t action_id; + } sa; /* Shared action query arguments */ struct { struct rte_flow_attr attr; struct rte_flow_item *pattern; @@ -709,6 +732,19 @@ struct parse_action_priv { .size = s, \ }) +static const enum index next_sa_create_attr[] = { + SHARED_ACTION_CREATE_ID, + ACTION_RSS, + ZERO, +}; + +static const enum index next_sa_subcmd[] = { + SHARED_ACTION_CREATE, + SHARED_ACTION_UPDATE, + SHARED_ACTION_DESTROY, + SHARED_ACTION_QUERY, +}; + static const enum index next_vc_attr[] = { GROUP, PRIORITY, @@ -743,6 +779,12 @@ static const enum index next_aged_attr[] = { ZERO, }; +static const enum index next_sa_destroy_attr[] = { + SHARED_ACTION_DESTROY_ID, + END, + ZERO, +}; + static const enum index item_param[] = { ITEM_PARAM_IS, ITEM_PARAM_SPEC, @@ -1193,6 +1235,7 @@ static const enum index next_action[] = { ACTION_SET_IPV4_DSCP, ACTION_SET_IPV6_DSCP, ACTION_AGE, + ACTION_SHARED, ZERO, }; @@ -1550,6 +1593,15 @@ static int parse_ipv6_addr(struct context *, const struct token *, static int parse_port(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); +static int parse_sa(struct context *, const struct token *, + const char *, unsigned int, + void *, unsigned int); +static int parse_sa_destroy(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size); +static int parse_sa_id2ptr(struct context *ctx, const struct token *token, + const char *str, unsigned int len, void *buf, + unsigned int size); static int comp_none(struct context *, const struct token *, unsigned int, char *, unsigned int); static int comp_boolean(struct context *, const struct token *, @@ -1688,13 +1740,21 @@ static const struct token token_list[] = { .call = parse_int, .comp = comp_none, }, + [SHARED_ACTION_ID] = { + .name = "{shared_action_id}", + .type = "SHARED_ACTION_ID", + .help = "shared action id", + .call = parse_int, + .comp = comp_none, + }, /* Top-level command. */ [FLOW] = { .name = "flow", .type = "{command} {port_id} [{arg} [...]]", .help = "manage ingress/egress flow rules", .next = NEXT(NEXT_ENTRY - (VALIDATE, + (SHARED_ACTION, + VALIDATE, CREATE, DESTROY, FLUSH, @@ -1705,7 +1765,45 @@ static const struct token token_list[] = { ISOLATE)), .call = parse_init, }, + /* Top-level command. */ + [SHARED_ACTION] = { + .name = "shared_action", + .type = "{command} {port_id} [{arg} [...]]", + .help = "manage shared actions", + .next = NEXT(next_sa_subcmd, NEXT_ENTRY(PORT_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, port)), + .call = parse_sa, + }, /* Sub-level commands. */ + [SHARED_ACTION_CREATE] = { + .name = "create", + .help = "create shared action", + .next = NEXT(next_sa_create_attr), + .args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)), + .call = parse_sa, + }, + [SHARED_ACTION_UPDATE] = { + .name = "update", + .help = "update shared action", + .next = NEXT(NEXT_ENTRY(ACTION_RSS), + NEXT_ENTRY(SHARED_ACTION_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)), + .call = parse_sa, + }, + [SHARED_ACTION_DESTROY] = { + .name = "destroy", + .help = "destroy shared action", + .next = NEXT(NEXT_ENTRY(SHARED_ACTION_DESTROY_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, port)), + .call = parse_sa_destroy, + }, + [SHARED_ACTION_QUERY] = { + .name = "query", + .help = "query shared action", + .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(SHARED_ACTION_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, args.sa.action_id)), + .call = parse_sa, + }, [VALIDATE] = { .name = "validate", .help = "check whether a flow rule can be created", @@ -3859,6 +3957,40 @@ static const struct token token_list[] = { .next = NEXT(action_age, NEXT_ENTRY(UNSIGNED)), .call = parse_vc_conf, }, + /* Shared action destroy arguments. */ + [SHARED_ACTION_DESTROY_ID] = { + .name = "action_id", + .help = "specify a shared action id to destroy", + .next = NEXT(next_sa_destroy_attr, + NEXT_ENTRY(SHARED_ACTION_ID)), + .args = ARGS(ARGS_ENTRY_PTR(struct buffer, + args.sa_destroy.action_id)), + .call = parse_sa_destroy, + }, + /* Shared action create arguments. */ + [SHARED_ACTION_CREATE_ID] = { + .name = "action_id", + .help = "specify a shared action id to create", + .next = NEXT(NEXT_ENTRY(ACTION_RSS), + NEXT_ENTRY(SHARED_ACTION_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)), + }, + [ACTION_SHARED] = { + .name = "shared", + .help = "apply shared action by id", + .priv = PRIV_ACTION(SHARED, 0), + .next = NEXT(NEXT_ENTRY(SHARED_ACTION_ID2PTR)), + .args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))), + .call = parse_vc, + }, + [SHARED_ACTION_ID2PTR] = { + .name = "{action_id}", + .type = "SHARED_ACTION_ID", + .help = "shared action id", + .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), + .call = parse_sa_id2ptr, + .comp = comp_none, + }, }; /** Remove and return last entry from argument stack. */ @@ -4043,6 +4175,91 @@ parse_init(struct context *ctx, const struct token *token, return len; } +/** Parse tokens for shared action commands. */ +static int +parse_sa(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size) +{ + struct buffer *out = buf; + + /* Token name must match. */ + if (parse_default(ctx, token, str, len, NULL, 0) < 0) + return -1; + /* Nothing else to do if there is no buffer. */ + if (!out) + return len; + if (!out->command) { + if (ctx->curr != SHARED_ACTION) + return -1; + if (sizeof(*out) > size) + return -1; + out->command = ctx->curr; + ctx->objdata = 0; + ctx->object = out; + ctx->objmask = NULL; + out->args.vc.data = (uint8_t *)out + size; + return len; + } + switch (ctx->curr) { + case SHARED_ACTION_CREATE: + case SHARED_ACTION_UPDATE: + out->args.vc.actions = + (void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1), + sizeof(double)); + out->args.vc.attr.group = UINT32_MAX; + /* fallthrough */ + case SHARED_ACTION_QUERY: + out->command = ctx->curr; + ctx->objdata = 0; + ctx->object = out; + ctx->objmask = NULL; + return len; + default: + return -1; + } +} + + +/** Parse tokens for shared action destroy command. */ +static int +parse_sa_destroy(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size) +{ + struct buffer *out = buf; + uint32_t *action_id; + + /* Token name must match. */ + if (parse_default(ctx, token, str, len, NULL, 0) < 0) + return -1; + /* Nothing else to do if there is no buffer. */ + if (!out) + return len; + if (!out->command || out->command == SHARED_ACTION) { + if (ctx->curr != SHARED_ACTION_DESTROY) + return -1; + if (sizeof(*out) > size) + return -1; + out->command = ctx->curr; + ctx->objdata = 0; + ctx->object = out; + ctx->objmask = NULL; + out->args.sa_destroy.action_id = + (void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1), + sizeof(double)); + return len; + } + action_id = out->args.sa_destroy.action_id + + out->args.sa_destroy.action_id_n++; + if ((uint8_t *)action_id > (uint8_t *)out + size) + return -1; + ctx->objdata = 0; + ctx->object = action_id; + ctx->objmask = NULL; + return len; +} + /** Parse tokens for validate/create commands. */ static int parse_vc(struct context *ctx, const struct token *token, @@ -6110,6 +6327,32 @@ parse_port(struct context *ctx, const struct token *token, return ret; } +static int +parse_sa_id2ptr(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size) +{ + struct rte_flow_action *action = ctx->object; + uint32_t id; + int ret; + + (void)buf; + (void)size; + ctx->objdata = 0; + ctx->object = &id; + ctx->objmask = NULL; + ret = parse_int(ctx, token, str, len, ctx->object, sizeof(id)); + ctx->object = action; + if (ret != (int)len) + return ret; + /* set shared action */ + if (action) { + action->conf = port_shared_action_get_by_id(ctx->port, id); + ret = (action->conf) ? ret : -1; + } + return ret; +} + /** Parse set command, initialize output buffer for subsequent tokens. */ static int parse_set_raw_encap_decap(struct context *ctx, const struct token *token, @@ -6559,6 +6802,23 @@ static void cmd_flow_parsed(const struct buffer *in) { switch (in->command) { + case SHARED_ACTION_CREATE: + port_shared_action_create(in->port, + in->args.vc.attr.group, + in->args.vc.actions); + break; + case SHARED_ACTION_DESTROY: + port_shared_action_destroy(in->port, + in->args.sa_destroy.action_id_n, + in->args.sa_destroy.action_id); + break; + case SHARED_ACTION_UPDATE: + port_shared_action_update(in->port, in->args.vc.attr.group, + in->args.vc.actions); + break; + case SHARED_ACTION_QUERY: + port_shared_action_query(in->port, in->args.sa.action_id); + break; case VALIDATE: port_flow_validate(in->port, &in->args.vc.attr, in->args.vc.pattern, in->args.vc.actions); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 418ea6dda4..d5adf881c5 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1580,6 +1580,223 @@ rss_config_display(struct rte_flow_action_rss *rss_conf) } } +static struct port_shared_action * +action_get_by_id(portid_t port_id, uint32_t id) +{ + struct rte_port *port; + struct port_shared_action **ppsa; + struct port_shared_action *psa = NULL; + + if (port_id_is_invalid(port_id, ENABLED_WARN) || + port_id == (portid_t)RTE_PORT_ALL) + return NULL; + port = &ports[port_id]; + ppsa = &port->actions_list; + while (*ppsa) { + if ((*ppsa)->id == id) { + psa = *ppsa; + break; + } + ppsa = &(*ppsa)->next; + } + if (!psa) + printf("Failed to find shared action #%u on port %u\n", + id, port_id); + return psa; +} + +static int +action_alloc(portid_t port_id, uint32_t id, + struct port_shared_action **action) +{ + struct rte_port *port; + struct port_shared_action **ppsa; + struct port_shared_action *psa = NULL; + + *action = NULL; + if (port_id_is_invalid(port_id, ENABLED_WARN) || + port_id == (portid_t)RTE_PORT_ALL) + return -EINVAL; + port = &ports[port_id]; + if (id == UINT32_MAX) { + /* taking first available ID */ + if (port->actions_list) { + if (port->actions_list->id == UINT32_MAX - 1) { + printf("Highest shared action ID is already" + " assigned, delete it first\n"); + return -ENOMEM; + } + id = port->actions_list->id + 1; + } else { + id = 0; + } + } + psa = calloc(1, sizeof(*psa)); + if (!psa) { + printf("Allocation of port %u shared action failed\n", + port_id); + return -ENOMEM; + } + ppsa = &port->actions_list; + while (*ppsa && (*ppsa)->id > id) + ppsa = &(*ppsa)->next; + if (*ppsa && (*ppsa)->id == id) { + printf("Shared action #%u is already assigned," + " delete it first\n", id); + free(psa); + return -EINVAL; + } + psa->next = *ppsa; + psa->id = id; + *ppsa = psa; + *action = psa; + return 0; +} + +/** Create shared action */ +int +port_shared_action_create(portid_t port_id, uint32_t id, + const struct rte_flow_action *action) +{ + struct port_shared_action *psa; + int ret; + struct rte_flow_error error; + + ret = action_alloc(port_id, id, &psa); + if (ret) + return ret; + /* Poisoning to make sure PMDs update it in case of error. */ + memset(&error, 0x22, sizeof(error)); + psa->action = rte_flow_shared_action_create(port_id, NULL, action, + &error); + if (!psa->action) { + uint32_t destroy_id = psa->id; + port_shared_action_destroy(port_id, 1, &destroy_id); + return port_flow_complain(&error); + } + psa->type = action->type; + printf("Shared action #%u created\n", psa->id); + return 0; +} + +/** Destroy shared action */ +int +port_shared_action_destroy(portid_t port_id, + uint32_t n, + const uint32_t *actions) +{ + struct rte_port *port; + struct port_shared_action **tmp; + uint32_t c = 0; + int ret = 0; + + if (port_id_is_invalid(port_id, ENABLED_WARN) || + port_id == (portid_t)RTE_PORT_ALL) + return -EINVAL; + port = &ports[port_id]; + tmp = &port->actions_list; + while (*tmp) { + uint32_t i; + + for (i = 0; i != n; ++i) { + struct rte_flow_error error; + struct port_shared_action *psa = *tmp; + + if (actions[i] != psa->id) + continue; + /* + * Poisoning to make sure PMDs update it in case + * of error. + */ + memset(&error, 0x33, sizeof(error)); + + if (psa->action && rte_flow_shared_action_destroy( + port_id, psa->action, &error)) { + ret = port_flow_complain(&error); + continue; + } + *tmp = psa->next; + free(psa); + printf("Shared action #%u destroyed\n", psa->id); + break; + } + if (i == n) + tmp = &(*tmp)->next; + ++c; + } + return ret; +} + + +/** Get shared action by port + id */ +struct rte_flow_shared_action * +port_shared_action_get_by_id(portid_t port_id, uint32_t id) +{ + + struct port_shared_action *psa = action_get_by_id(port_id, id); + + return (psa) ? psa->action : NULL; +} + +/** Update shared action */ +int +port_shared_action_update(portid_t port_id, uint32_t id, + const struct rte_flow_action *action) +{ + struct rte_flow_error error; + struct rte_flow_shared_action *shared_action; + + shared_action = port_shared_action_get_by_id(port_id, id); + if (!shared_action) + return -EINVAL; + if (rte_flow_shared_action_update(port_id, shared_action, action, + &error)) { + return port_flow_complain(&error); + } + printf("Shared action #%u updated\n", id); + return 0; +} + +int +port_shared_action_query(portid_t port_id, uint32_t id) +{ + struct rte_flow_error error; + struct port_shared_action *psa; + uint64_t default_data; + void *data = NULL; + int ret = 0; + + psa = action_get_by_id(port_id, id); + if (!psa) + return -EINVAL; + switch (psa->type) { + case RTE_FLOW_ACTION_TYPE_RSS: + data = &default_data; + break; + default: + printf("Shared action %u (type: %d) on port %u doesn't support" + " query\n", id, psa->type, port_id); + return -1; + } + if (rte_flow_shared_action_query(port_id, psa->action, data, &error)) + ret = port_flow_complain(&error); + switch (psa->type) { + case RTE_FLOW_ACTION_TYPE_RSS: + if (!ret) + printf("Shared RSS action:\n\trefs:%u\n", + *((uint32_t *)data)); + data = NULL; + break; + default: + printf("Shared action %u (type: %d) on port %u doesn't support" + " query\n", id, psa->type, port_id); + ret = -1; + } + if (data) + free(data); + return ret; +} + /** Validate flow rule. */ int port_flow_validate(portid_t port_id, diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index c7e7e41a97..a78fc9f3f0 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -142,6 +142,14 @@ struct port_flow { uint8_t data[]; /**< Storage for flow rule description */ }; +/* Descriptor for shared action */ +struct port_shared_action { + struct port_shared_action *next; /**< Next flow in list. */ + uint32_t id; /**< Shared action ID. */ + enum rte_flow_action_type type; /**< Action type. */ + struct rte_flow_shared_action *action; /**< Shared action handle. */ +}; + /** * The data structure associated with each port. */ @@ -172,6 +180,8 @@ struct rte_port { uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ uint8_t slave_flag; /**< bonding slave port */ struct port_flow *flow_list; /**< Associated flows. */ + struct port_shared_action *actions_list; + /**< Associated shared actions. */ const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1]; const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1]; /**< metadata value to insert in Tx packets. */ @@ -748,6 +758,14 @@ void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off, uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value); void port_reg_display(portid_t port_id, uint32_t reg_off); void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value); +int port_shared_action_create(portid_t port_id, uint32_t id, + const struct rte_flow_action *action); +int port_shared_action_destroy(portid_t port_id, + uint32_t n, const uint32_t *action); +struct rte_flow_shared_action *port_shared_action_get_by_id(portid_t port_id, + uint32_t id); +int port_shared_action_update(portid_t port_id, uint32_t id, + const struct rte_flow_action *action); int port_flow_validate(portid_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item *pattern, @@ -756,6 +774,7 @@ int port_flow_create(portid_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item *pattern, const struct rte_flow_action *actions); +int port_shared_action_query(portid_t port_id, uint32_t id); void update_age_action_context(const struct rte_flow_action *actions, struct port_flow *pf); int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule); diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 72bdb1be43..f4b26ed307 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -4382,6 +4382,11 @@ This section lists supported actions and their attributes, if any. - ``dscp_value {unsigned}``: The new DSCP value to be set +- ``shared``: Use shared action created via + ``flow shared_action {port_id} create`` + + - ``shared_action_id {unsigned}``: Shared action ID to use + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~ @@ -4671,6 +4676,112 @@ If attach ``destroy`` parameter, the command will destroy all the list aged flow testpmd> flow aged 0 Port 0 total aged flows: 0 +Creating shared actions +~~~~~~~~~~~~~~~~~~~~~~~ +``flow shared_action {port_id} create`` creates shared action with optional +shared action ID. It is bound to ``rte_flow_shared_action_create()``:: + + flow shared_action {port_id} create [action_id {shared_action_id}] \ + {action} / end + +If successful, it will show:: + + Shared action #[...] created + +Otherwise, it will complain either that shared action already exists or that +some error occurred:: + + Shared action #[...] is already assigned, delete it first + +:: + + Caught error type [...] ([...]): [...] + +Create shared rss action with id 100 to queues 1 and 2 on port 0:: + + testpmd> flow shared_action 0 create action_id 100 \ + rss queues 1 2 end / end + +Create shared rss action with id assigned by testpmd to queues 1 and 2 on +port 0:: + + testpmd> flow shared_action 0 create action_id \ + rss queues 0 1 end / end + +Updating shared actions +~~~~~~~~~~~~~~~~~~~~~~~ +``flow shared_action {port_id} update`` updates configuration of the shared +action from its shared action ID (as returned by +``flow shared_action {port_id} create``). It is bound to +``rte_flow_shared_action_update()``:: + + flow shared_action {port_id} update {shared_action_id} {action} / end + +If successful, it will show:: + + Shared action #[...] updated + +Otherwise, it will complain either that shared action not found or that some +error occurred:: + + Failed to find shared action #[...] on port [...] + +:: + + Caught error type [...] ([...]): [...] + +Update shared rss action having id 100 on port 0 with rss to queues 0 and 3 +(in create example above rss queues were 1 and 2):: + + testpmd> flow shared_action 0 update 100 rss queues 0 3 end / end + +Destroying shared actions +~~~~~~~~~~~~~~~~~~~~~~~~~ +``flow shared_action {port_id} update`` destroys one or more shared actions +from their shared action IDs (as returned by +``flow shared_action {port_id} create``). It is bound to +``rte_flow_shared_action_destroy()``:: + + flow shared_action {port_id} destroy action_id {shared_action_id} [...] + +If successful, it will show:: + + Shared action #[...] destroyed + +It does not report anything for shared action IDs that do not exist. +The usual error message is shown when a shared action cannot be destroyed:: + + Caught error type [...] ([...]): [...] + +Destroy shared actions having id 100 & 101:: + + testpmd> flow shared_action 0 destroy action_id 100 action_id 101 + +Query shared actions +~~~~~~~~~~~~~~~~~~~~ +``flow shared_action {port_id} query`` queries the shared action from its +shared action ID (as returned by ``flow shared_action {port_id} create``). +It is bound to ``rte_flow_shared_action_query()``:: + + flow shared_action {port_id} query {shared_action_id} + +Currently only rss shared action supported. If successful, it will show:: + + Shared RSS action: + refs:[...] + +Otherwise, it will complain either that shared action not found or that some +error occurred:: + + Failed to find shared action #[...] on port [...] + +:: + + Caught error type [...] ([...]): [...] + +Query shared action having id 100:: + + testpmd> flow shared_action 0 query 100 Sample QinQ flow rules ~~~~~~~~~~~~~~~~~~~~~~