From patchwork Thu Sep 2 14:23:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 97819 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9CCFCA0C4C; Thu, 2 Sep 2021 16:24:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D7F934067E; Thu, 2 Sep 2021 16:24:11 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 98D514003E for ; Thu, 2 Sep 2021 16:24:09 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.121.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 370F07F6C0; Thu, 2 Sep 2021 17:24:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 370F07F6C0 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1630592649; bh=5vzOhOpKucKRfSdVLbbj6oo93ZcobAaRgMJhw+qQRC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WUC8Ig+aVyXop/jM1M4uCJEQoQ0I4jc56Z9QPYj6uHJf11hv12WHeYVeC9O7NrcwC RfvvabomOSwmgcInCa1rZn4gQFJ1jDtfWwwzp5tivRIec5r1kDCuNN0j+3rKY11+se 1TU25YGZFr8DMVLgspcIJ47shLpwSYTaaNjp95EI= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Thomas Monjalon , Ferruh Yigit , Ray Kinsella Date: Thu, 2 Sep 2021 17:23:55 +0300 Message-Id: <20210902142359.28138-2-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> References: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/5] ethdev: add API to negotiate support for Rx meta information X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Per-packet meta information (flag, mark and the likes) might be expensive to deliver in terms of small packet performance. If the features are not enabled by default, enabling them at short notice (for example, when a flow rule with action MARK gets created) without traffic disruption may not be possible. Letting applications request delivery of Rx meta information during initialisation can solve the said problem efficiently. Technically, that could be accomplished by defining new bits in DEV_RX_OFFLOAD namespace, but the ability to extract meta data cannot be considered an offload on its own. For example, Rx checksumming is an offload, while mark delivery is not as it needs an external party, a flow rule with action MARK, to hold the value and trigger mark insertion in the first place. With this in mind, add a means to let applications negotiate adapter support for the very delivery of Rx meta information. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko Acked-by: Ray Kinsella Acked-by: Jerin Jacob --- lib/ethdev/ethdev_driver.h | 19 +++++++++++ lib/ethdev/rte_ethdev.c | 25 +++++++++++++++ lib/ethdev/rte_ethdev.h | 66 ++++++++++++++++++++++++++++++++++++++ lib/ethdev/version.map | 3 ++ 4 files changed, 113 insertions(+) diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index 40e474aa7e..3e29555fc7 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -789,6 +789,22 @@ typedef int (*eth_get_monitor_addr_t)(void *rxq, typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev, struct rte_eth_representor_info *info); +/** + * @internal + * Negotiate support for specific fractions of Rx meta information. + * + * @param[in] dev + * Port (ethdev) handle + * + * @param[inout] features + * Feature selection buffer + * + * @return + * Negative errno value on error, zero otherwise + */ +typedef int (*eth_negotiate_rx_meta_t)(struct rte_eth_dev *dev, + uint64_t *features); + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -949,6 +965,9 @@ struct eth_dev_ops { eth_representor_info_get_t representor_info_get; /**< Get representor info. */ + + eth_negotiate_rx_meta_t negotiate_rx_meta; + /**< Negotiate support for specific fractions of Rx meta information. */ }; /** diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 9d95cd11e1..821450cbf9 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -6311,6 +6311,31 @@ rte_eth_representor_info_get(uint16_t port_id, return eth_err(port_id, (*dev->dev_ops->representor_info_get)(dev, info)); } +int +rte_eth_negotiate_rx_meta(uint16_t port_id, uint64_t *features) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (dev->data->dev_configured != 0) { + RTE_ETHDEV_LOG(ERR, + "The port (id=%"PRIu16") is already configured\n", + port_id); + return -EBUSY; + } + + if (features == NULL) { + RTE_ETHDEV_LOG(ERR, "Invalid features (NULL)\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->negotiate_rx_meta, -ENOTSUP); + return eth_err(port_id, + (*dev->dev_ops->negotiate_rx_meta)(dev, features)); +} + RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO); RTE_INIT(ethdev_init_telemetry) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index d2b27c351f..ac4d164aa8 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -4888,6 +4888,72 @@ __rte_experimental int rte_eth_representor_info_get(uint16_t port_id, struct rte_eth_representor_info *info); +/** + * The ethdev will be able to detect flagged packets provided that + * there are active flow rules comprising the corresponding action. + */ +#define RTE_ETH_RX_META_USER_FLAG (UINT64_C(1) << 0) + +/** + * The ethdev will manage to see mark IDs in packets provided that + * there are active flow rules comprising the corresponding action. + */ +#define RTE_ETH_RX_META_USER_MARK (UINT64_C(1) << 1) + +/** + * The ethdev will be able to identify partially offloaded packets + * and process rte_flow_get_restore_info() invocations accordingly + * provided that there're so-called "tunnel_set" flow rules in use. + */ +#define RTE_ETH_RX_META_TUNNEL_ID (UINT64_C(1) << 2) + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Negotiate support for specific fractions of Rx meta information. + * + * This function has to be invoked as early as possible, precisely, + * before the first rte_eth_dev_configure() invocation, to let the + * PMD make preparations which might be hard to do on later stages. + * + * The negotiation process is assumed to be carried out as follows: + * + * - the application composes a mask of preferred Rx meta features + * intending to enable at least some of them and invokes the API; + * + * - the ethdev driver reports back the optimal (from its point of + * view) subset of the initial feature set thus agreeing to make + * those comprising the subset simultaneously available to users; + * + * - should the application find the result unsatisfactory, it may + * come up with another pick of preferred features and try again; + * + * - the application can pass zero to clear the negotiation result; + * + * - the last negotiated result takes effect upon the ethdev start. + * + * If the method itself is unsupported by the PMD, the application + * may just ignore that and proceed with the rest of configuration + * procedure intending to simply try using the features it prefers. + * + * @param[in] port_id + * Port (ethdev) identifier + * + * @param[inout] features + * Feature selection buffer + * + * @return + * - (-EBUSY) if the port can't handle this in its current state; + * - (-ENOTSUP) if the method itself is not supported by the PMD; + * - (-ENODEV) if *port_id* is invalid; + * - (-EINVAL) if *features* is NULL; + * - (-EIO) if the device is removed; + * - (0) on success + */ +__rte_experimental +int rte_eth_negotiate_rx_meta(uint16_t port_id, uint64_t *features); + #include /** diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 3eece75b72..e390e5718c 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -249,6 +249,9 @@ EXPERIMENTAL { rte_mtr_meter_policy_delete; rte_mtr_meter_policy_update; rte_mtr_meter_policy_validate; + + # added in 21.11 + rte_eth_negotiate_rx_meta; }; INTERNAL { From patchwork Thu Sep 2 14:23:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 97820 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4B7B4A0C4C; Thu, 2 Sep 2021 16:24:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB7FC406A3; Thu, 2 Sep 2021 16:24:12 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id BFC954003C for ; Thu, 2 Sep 2021 16:24:09 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.121.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 7B5867F6C2; Thu, 2 Sep 2021 17:24:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 7B5867F6C2 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1630592649; bh=d13QPjIE1BqphbLQrxSGgE4bDZZ7EctKy+GiEVdT5DI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iIDkadRANBc20iTwdjltnvfVLMpeI/CbFdouWXHKjMe7EnW2UJrV6a+X2CIauxfVB yWzFEwJWCR+8M5dcshv74PRqzdU4esioD21UQiwl7qB/bnM45Q3IztO226yfx5ohpt JI4q0Khzc2ji5wKP4Dk9KZY1NwR2TzmJYPnr4y2k= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko Date: Thu, 2 Sep 2021 17:23:56 +0300 Message-Id: <20210902142359.28138-3-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> References: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/5] net/sfc: provide API to negotiate supported Rx meta features X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 is a preparation step. Later patches will make features FLAG and MARK on EF100 native Rx datapath available to users. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko --- drivers/net/sfc/sfc.h | 2 ++ drivers/net/sfc/sfc_ethdev.c | 34 ++++++++++++++++++++++++++++++++++ drivers/net/sfc/sfc_flow.c | 10 +++++----- drivers/net/sfc/sfc_mae.c | 22 ++++++++++++++++++++-- 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 331e06bac6..2812d76cbb 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -312,6 +312,8 @@ struct sfc_adapter { boolean_t tso; boolean_t tso_encap; + uint64_t negotiated_rx_meta; + uint32_t rxd_wait_timeout_ns; }; diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 2db0d000c3..57bcccdb1b 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -1859,6 +1859,27 @@ sfc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t ethdev_qid) return sap->dp_rx->intr_disable(rxq_info->dp); } +static int +sfc_negotiate_rx_meta(struct rte_eth_dev *dev, uint64_t *features) +{ + struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); + + sfc_adapter_lock(sa); + + if ((sa->priv.dp_rx->features & SFC_DP_RX_FEAT_FLOW_FLAG) != 0) + sa->negotiated_rx_meta |= RTE_ETH_RX_META_USER_FLAG; + + if ((sa->priv.dp_rx->features & SFC_DP_RX_FEAT_FLOW_MARK) != 0) + sa->negotiated_rx_meta |= RTE_ETH_RX_META_USER_MARK; + + sa->negotiated_rx_meta &= *features; + *features = sa->negotiated_rx_meta; + + sfc_adapter_unlock(sa); + + return 0; +} + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, @@ -1906,6 +1927,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .xstats_get_by_id = sfc_xstats_get_by_id, .xstats_get_names_by_id = sfc_xstats_get_names_by_id, .pool_ops_supported = sfc_pool_ops_supported, + .negotiate_rx_meta = sfc_negotiate_rx_meta, }; /** @@ -1998,6 +2020,18 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev) goto fail_dp_rx_name; } + if (strcmp(dp_rx->dp.name, SFC_KVARG_DATAPATH_EF10_ESSB) == 0) { + /* + * Datapath EF10 ESSB is available only on EF10 NICs running + * Rx FW variant DPDK, which always provides fields FLAG and + * MARK in Rx prefix, so point this fact out below. This way, + * legacy applications from EF10 era, which are not aware of + * rte_eth_negotiate_rx_meta(), can keep the workflow intact. + */ + sa->negotiated_rx_meta |= RTE_ETH_RX_META_USER_FLAG; + sa->negotiated_rx_meta |= RTE_ETH_RX_META_USER_MARK; + } + sfc_notice(sa, "use %s Rx datapath", sas->dp_rx_name); rc = sfc_kvargs_process(sa, SFC_KVARG_TX_DATAPATH, diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 4f5993a68d..a2034b5f5e 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -1759,7 +1759,7 @@ sfc_flow_parse_actions(struct sfc_adapter *sa, int rc; struct sfc_flow_spec *spec = &flow->spec; struct sfc_flow_spec_filter *spec_filter = &spec->filter; - const unsigned int dp_rx_features = sa->priv.dp_rx->features; + const uint64_t rx_meta = sa->negotiated_rx_meta; uint32_t actions_set = 0; const uint32_t fate_actions_mask = (1UL << RTE_FLOW_ACTION_TYPE_QUEUE) | (1UL << RTE_FLOW_ACTION_TYPE_RSS) | @@ -1827,10 +1827,10 @@ sfc_flow_parse_actions(struct sfc_adapter *sa, if ((actions_set & mark_actions_mask) != 0) goto fail_actions_overlap; - if ((dp_rx_features & SFC_DP_RX_FEAT_FLOW_FLAG) == 0) { + if ((rx_meta & RTE_ETH_RX_META_USER_FLAG) == 0) { rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, - "FLAG action is not supported on the current Rx datapath"); + "Action FLAG is unsupported on the current Rx datapath or has not been negotiated"); return -rte_errno; } @@ -1844,10 +1844,10 @@ sfc_flow_parse_actions(struct sfc_adapter *sa, if ((actions_set & mark_actions_mask) != 0) goto fail_actions_overlap; - if ((dp_rx_features & SFC_DP_RX_FEAT_FLOW_MARK) == 0) { + if ((rx_meta & RTE_ETH_RX_META_USER_MARK) == 0) { rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, - "MARK action is not supported on the current Rx datapath"); + "Action MARK is unsupported on the current Rx datapath or has not been negotiated"); return -rte_errno; } diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 4b520bc619..89c161ef88 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -2963,6 +2963,7 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa, efx_mae_actions_t *spec, struct rte_flow_error *error) { + const uint64_t rx_meta = sa->negotiated_rx_meta; bool custom_error = B_FALSE; int rc = 0; @@ -3012,12 +3013,29 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa, case RTE_FLOW_ACTION_TYPE_FLAG: SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_FLAG, bundle->actions_mask); - rc = efx_mae_action_set_populate_flag(spec); + if ((rx_meta & RTE_ETH_RX_META_USER_FLAG) != 0) { + rc = efx_mae_action_set_populate_flag(spec); + } else { + rc = rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + action, + "Action FLAG has not been negotiated"); + custom_error = B_TRUE; + } break; case RTE_FLOW_ACTION_TYPE_MARK: SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_MARK, bundle->actions_mask); - rc = sfc_mae_rule_parse_action_mark(sa, action->conf, spec); + if ((rx_meta & RTE_ETH_RX_META_USER_MARK) != 0) { + rc = sfc_mae_rule_parse_action_mark(sa, action->conf, + spec); + } else { + rc = rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + action, + "Action MARK has not been negotiated"); + custom_error = B_TRUE; + } break; case RTE_FLOW_ACTION_TYPE_PHY_PORT: SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_PHY_PORT, From patchwork Thu Sep 2 14:23:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 97821 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C417AA0C4C; Thu, 2 Sep 2021 16:24:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2259740E2D; Thu, 2 Sep 2021 16:24:14 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id E1E5B4003E for ; Thu, 2 Sep 2021 16:24:09 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.121.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id B3F847F53A; Thu, 2 Sep 2021 17:24:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru B3F847F53A DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1630592649; bh=PWWPjv+3NWjp4CYhGwswXAFPlTr6WUHQhEe84xHEmXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QYIOVHlcuqJCKmeYS41YtadeBYxQDb8ULzy2k3Zx4DbBchWVuFFQO5VQwjiAaEr6p A9eL99vurKLIFq7RBfZT6iU99vVyp/aEWnsIuDR04bw+t6p868Kx4hdR1iCdn0zhpC edLlGNOqA+3W1ynQu7w0TXBfzobtz/PJGsb0hmDY= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko Date: Thu, 2 Sep 2021 17:23:57 +0300 Message-Id: <20210902142359.28138-4-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> References: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 3/5] net/sfc: allow to use EF100 native datapath Rx mark in flows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" As of now, reading out mark on EF100 native datapath is used only by MAE counter support for delivery of generation count values. Make the feature available to flow action MARK users. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ef100_rx.c | 1 + drivers/net/sfc/sfc_rx.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c index d4cb96881c..e0cafbc579 100644 --- a/drivers/net/sfc/sfc_ef100_rx.c +++ b/drivers/net/sfc/sfc_ef100_rx.c @@ -914,6 +914,7 @@ struct sfc_dp_rx sfc_ef100_rx = { .hw_fw_caps = SFC_DP_HW_FW_CAP_EF100, }, .features = SFC_DP_RX_FEAT_MULTI_PROCESS | + SFC_DP_RX_FEAT_FLOW_MARK | SFC_DP_RX_FEAT_INTR, .dev_offload_capa = 0, .queue_offload_capa = DEV_RX_OFFLOAD_CHECKSUM | diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 280e8a61f9..c1acd2ed99 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -1178,6 +1178,9 @@ sfc_rx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index, if (offloads & DEV_RX_OFFLOAD_RSS_HASH) rxq_info->type_flags |= EFX_RXQ_FLAG_RSS_HASH; + if ((sa->negotiated_rx_meta & RTE_ETH_RX_META_USER_MARK) != 0) + rxq_info->type_flags |= EFX_RXQ_FLAG_USER_MARK; + rc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_RX, sw_index, evq_entries, socket_id, &evq); if (rc != 0) From patchwork Thu Sep 2 14:23:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 97822 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4C4B3A0C4C; Thu, 2 Sep 2021 16:24:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4BD2E410DC; Thu, 2 Sep 2021 16:24:15 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 42B194003C for ; Thu, 2 Sep 2021 16:24:10 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.121.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id F37C07F6C2; Thu, 2 Sep 2021 17:24:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru F37C07F6C2 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1630592650; bh=rJ0CHgcOHu8xUQDG/unm/YMgbCgbCAaTz7GVv85u0js=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LVFimsWuIDQTP0O0lqeGDylQbApAq+Xc2f9C+kZjOVA5041wEcIsH7/9mCGyc+yZG seHiTnuwmlCCQL7IyqXlpoxVez0zhVYaE9cFBqG12bu+375+1rCYhvTXl0feDLTRhZ gFDZIv8NYUDI7/qI2lXf0Rm24P4bp76yHUTf6Fzk= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko Date: Thu, 2 Sep 2021 17:23:58 +0300 Message-Id: <20210902142359.28138-5-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> References: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 4/5] common/sfc_efx/base: add RxQ flag to use Rx prefix user flag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Add an RxQ flag to request support for user flag field of Rx prefix. The feature is supported only on EF100 and EF10 ESSB. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko --- drivers/common/sfc_efx/base/ef10_rx.c | 54 ++++++++++++++++---------- drivers/common/sfc_efx/base/efx.h | 4 ++ drivers/common/sfc_efx/base/rhead_rx.c | 3 ++ 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_rx.c b/drivers/common/sfc_efx/base/ef10_rx.c index 0c3f9413cf..a658e0dba2 100644 --- a/drivers/common/sfc_efx/base/ef10_rx.c +++ b/drivers/common/sfc_efx/base/ef10_rx.c @@ -930,6 +930,10 @@ ef10_rx_qcreate( rc = ENOTSUP; goto fail2; } + if (flags & EFX_RXQ_FLAG_USER_FLAG) { + rc = ENOTSUP; + goto fail3; + } /* * Ignore EFX_RXQ_FLAG_RSS_HASH since if RSS hash is calculated * it is always delivered from HW in the pseudo-header. @@ -940,7 +944,7 @@ ef10_rx_qcreate( erpl = &ef10_packed_stream_rx_prefix_layout; if (type_data == NULL) { rc = EINVAL; - goto fail3; + goto fail4; } switch (type_data->ertd_packed_stream.eps_buf_size) { case EFX_RXQ_PACKED_STREAM_BUF_SIZE_1M: @@ -960,17 +964,21 @@ ef10_rx_qcreate( break; default: rc = ENOTSUP; - goto fail4; + goto fail5; } erp->er_buf_size = type_data->ertd_packed_stream.eps_buf_size; /* Packed stream pseudo header does not have RSS hash value */ if (flags & EFX_RXQ_FLAG_RSS_HASH) { rc = ENOTSUP; - goto fail5; + goto fail6; } if (flags & EFX_RXQ_FLAG_USER_MARK) { rc = ENOTSUP; - goto fail6; + goto fail7; + } + if (flags & EFX_RXQ_FLAG_USER_FLAG) { + rc = ENOTSUP; + goto fail8; } break; #endif /* EFSYS_OPT_RX_PACKED_STREAM */ @@ -979,7 +987,7 @@ ef10_rx_qcreate( erpl = &ef10_essb_rx_prefix_layout; if (type_data == NULL) { rc = EINVAL; - goto fail7; + goto fail9; } params.es_bufs_per_desc = type_data->ertd_es_super_buffer.eessb_bufs_per_desc; @@ -997,7 +1005,7 @@ ef10_rx_qcreate( #endif /* EFSYS_OPT_RX_ES_SUPER_BUFFER */ default: rc = ENOTSUP; - goto fail8; + goto fail10; } #if EFSYS_OPT_RX_PACKED_STREAM @@ -1005,13 +1013,13 @@ ef10_rx_qcreate( /* Check if datapath firmware supports packed stream mode */ if (encp->enc_rx_packed_stream_supported == B_FALSE) { rc = ENOTSUP; - goto fail9; + goto fail11; } /* Check if packed stream allows configurable buffer sizes */ if ((params.ps_buf_size != MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M) && (encp->enc_rx_var_packed_stream_supported == B_FALSE)) { rc = ENOTSUP; - goto fail10; + goto fail12; } } #else /* EFSYS_OPT_RX_PACKED_STREAM */ @@ -1022,17 +1030,17 @@ ef10_rx_qcreate( if (params.es_bufs_per_desc > 0) { if (encp->enc_rx_es_super_buffer_supported == B_FALSE) { rc = ENOTSUP; - goto fail11; + goto fail13; } if (!EFX_IS_P2ALIGNED(uint32_t, params.es_max_dma_len, EFX_RX_ES_SUPER_BUFFER_BUF_ALIGNMENT)) { rc = EINVAL; - goto fail12; + goto fail14; } if (!EFX_IS_P2ALIGNED(uint32_t, params.es_buf_stride, EFX_RX_ES_SUPER_BUFFER_BUF_ALIGNMENT)) { rc = EINVAL; - goto fail13; + goto fail15; } } #else /* EFSYS_OPT_RX_ES_SUPER_BUFFER */ @@ -1041,7 +1049,7 @@ ef10_rx_qcreate( if (flags & EFX_RXQ_FLAG_INGRESS_MPORT) { rc = ENOTSUP; - goto fail14; + goto fail16; } /* Scatter can only be disabled if the firmware supports doing so */ @@ -1057,7 +1065,7 @@ ef10_rx_qcreate( if ((rc = efx_mcdi_init_rxq(enp, ndescs, eep, label, index, esmp, ¶ms)) != 0) - goto fail15; + goto fail17; erp->er_eep = eep; erp->er_label = label; @@ -1070,40 +1078,44 @@ ef10_rx_qcreate( return (0); +fail17: + EFSYS_PROBE(fail15); +fail16: + EFSYS_PROBE(fail14); +#if EFSYS_OPT_RX_ES_SUPER_BUFFER fail15: EFSYS_PROBE(fail15); fail14: EFSYS_PROBE(fail14); -#if EFSYS_OPT_RX_ES_SUPER_BUFFER fail13: EFSYS_PROBE(fail13); +#endif /* EFSYS_OPT_RX_ES_SUPER_BUFFER */ +#if EFSYS_OPT_RX_PACKED_STREAM fail12: EFSYS_PROBE(fail12); fail11: EFSYS_PROBE(fail11); -#endif /* EFSYS_OPT_RX_ES_SUPER_BUFFER */ -#if EFSYS_OPT_RX_PACKED_STREAM +#endif /* EFSYS_OPT_RX_PACKED_STREAM */ fail10: EFSYS_PROBE(fail10); +#if EFSYS_OPT_RX_ES_SUPER_BUFFER fail9: EFSYS_PROBE(fail9); -#endif /* EFSYS_OPT_RX_PACKED_STREAM */ +#endif /* EFSYS_OPT_RX_ES_SUPER_BUFFER */ +#if EFSYS_OPT_RX_PACKED_STREAM fail8: EFSYS_PROBE(fail8); -#if EFSYS_OPT_RX_ES_SUPER_BUFFER fail7: EFSYS_PROBE(fail7); -#endif /* EFSYS_OPT_RX_ES_SUPER_BUFFER */ -#if EFSYS_OPT_RX_PACKED_STREAM fail6: EFSYS_PROBE(fail6); fail5: EFSYS_PROBE(fail5); fail4: EFSYS_PROBE(fail4); +#endif /* EFSYS_OPT_RX_PACKED_STREAM */ fail3: EFSYS_PROBE(fail3); -#endif /* EFSYS_OPT_RX_PACKED_STREAM */ fail2: EFSYS_PROBE(fail2); fail1: diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 24e1314cc3..bed1029f59 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -3007,6 +3007,10 @@ typedef enum efx_rxq_type_e { * Request user mark field in the Rx prefix of a queue. */ #define EFX_RXQ_FLAG_USER_MARK 0x10 +/* + * Request user flag field in the Rx prefix of a queue. + */ +#define EFX_RXQ_FLAG_USER_FLAG 0x20 LIBEFX_API extern __checkReturn efx_rc_t diff --git a/drivers/common/sfc_efx/base/rhead_rx.c b/drivers/common/sfc_efx/base/rhead_rx.c index 76b8ce302a..9d3258b503 100644 --- a/drivers/common/sfc_efx/base/rhead_rx.c +++ b/drivers/common/sfc_efx/base/rhead_rx.c @@ -635,6 +635,9 @@ rhead_rx_qcreate( if (flags & EFX_RXQ_FLAG_USER_MARK) fields_mask |= 1U << EFX_RX_PREFIX_FIELD_USER_MARK; + if (flags & EFX_RXQ_FLAG_USER_FLAG) + fields_mask |= 1U << EFX_RX_PREFIX_FIELD_USER_FLAG; + /* * LENGTH is required in EF100 host interface, as receive events * do not include the packet length. From patchwork Thu Sep 2 14:23:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 97823 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EEA8FA0C4C; Thu, 2 Sep 2021 16:24:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 778D5410F2; Thu, 2 Sep 2021 16:24:16 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 86CF04003C for ; Thu, 2 Sep 2021 16:24:10 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.121.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 3671C7F53A; Thu, 2 Sep 2021 17:24:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 3671C7F53A DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1630592650; bh=fTDiO4E/Vn43wAv723oBKLlXBo1jE0XLLtfFuLxQwgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PbetbPyl8jnc8sVkJbvaJqpeh0tESZJ+igkrQiyXDBs2cyB3u/d81kCapsv29dvSP nx01UG3Mi2lWRBM5SxRV+iXhlhIHbD+gGNavMaCJjPHmOCHKUdDYOaCKxjLfCdmRdW XtSmDW8Ht/NC5rJd7rQkPqkYSqxWfwQneUHQm6iw= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko Date: Thu, 2 Sep 2021 17:23:59 +0300 Message-Id: <20210902142359.28138-6-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> References: <20210902142359.28138-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 5/5] net/sfc: allow to discern user flag on EF100 native datapath X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Read out user flag from Rx prefix and indicate it to callers. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ef100_rx.c | 18 ++++++++++++++++++ drivers/net/sfc/sfc_rx.c | 3 +++ 2 files changed, 21 insertions(+) diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c index e0cafbc579..ba43e12739 100644 --- a/drivers/net/sfc/sfc_ef100_rx.c +++ b/drivers/net/sfc/sfc_ef100_rx.c @@ -62,6 +62,7 @@ struct sfc_ef100_rxq { #define SFC_EF100_RXQ_RSS_HASH 0x10 #define SFC_EF100_RXQ_USER_MARK 0x20 #define SFC_EF100_RXQ_FLAG_INTR_EN 0x40 +#define SFC_EF100_RXQ_USER_FLAG 0x80 unsigned int ptr_mask; unsigned int evq_phase_bit_shift; unsigned int ready_pkts; @@ -371,6 +372,7 @@ static const efx_rx_prefix_layout_t sfc_ef100_rx_prefix_layout = { SFC_EF100_RX_PREFIX_FIELD(RSS_HASH_VALID, B_FALSE), SFC_EF100_RX_PREFIX_FIELD(CLASS, B_FALSE), SFC_EF100_RX_PREFIX_FIELD(RSS_HASH, B_FALSE), + SFC_EF100_RX_PREFIX_FIELD(USER_FLAG, B_FALSE), SFC_EF100_RX_PREFIX_FIELD(USER_MARK, B_FALSE), #undef SFC_EF100_RX_PREFIX_FIELD @@ -407,6 +409,15 @@ sfc_ef100_rx_prefix_to_offloads(const struct sfc_ef100_rxq *rxq, ESF_GZ_RX_PREFIX_RSS_HASH); } + if (rxq->flags & SFC_EF100_RXQ_USER_FLAG) { + uint32_t user_flag; + + user_flag = EFX_OWORD_FIELD(rx_prefix[0], + ESF_GZ_RX_PREFIX_USER_FLAG); + if (user_flag != 0) + ol_flags |= PKT_RX_FDIR; + } + if (rxq->flags & SFC_EF100_RXQ_USER_MARK) { uint32_t user_mark; @@ -800,6 +811,12 @@ sfc_ef100_rx_qstart(struct sfc_dp_rxq *dp_rxq, unsigned int evq_read_ptr, else rxq->flags &= ~SFC_EF100_RXQ_RSS_HASH; + if ((unsup_rx_prefix_fields & + (1U << EFX_RX_PREFIX_FIELD_USER_FLAG)) == 0) + rxq->flags |= SFC_EF100_RXQ_USER_FLAG; + else + rxq->flags &= ~SFC_EF100_RXQ_USER_FLAG; + if ((unsup_rx_prefix_fields & (1U << EFX_RX_PREFIX_FIELD_USER_MARK)) == 0) rxq->flags |= SFC_EF100_RXQ_USER_MARK; @@ -914,6 +931,7 @@ struct sfc_dp_rx sfc_ef100_rx = { .hw_fw_caps = SFC_DP_HW_FW_CAP_EF100, }, .features = SFC_DP_RX_FEAT_MULTI_PROCESS | + SFC_DP_RX_FEAT_FLOW_FLAG | SFC_DP_RX_FEAT_FLOW_MARK | SFC_DP_RX_FEAT_INTR, .dev_offload_capa = 0, diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index c1acd2ed99..a3331c5089 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -1178,6 +1178,9 @@ sfc_rx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index, if (offloads & DEV_RX_OFFLOAD_RSS_HASH) rxq_info->type_flags |= EFX_RXQ_FLAG_RSS_HASH; + if ((sa->negotiated_rx_meta & RTE_ETH_RX_META_USER_FLAG) != 0) + rxq_info->type_flags |= EFX_RXQ_FLAG_USER_FLAG; + if ((sa->negotiated_rx_meta & RTE_ETH_RX_META_USER_MARK) != 0) rxq_info->type_flags |= EFX_RXQ_FLAG_USER_MARK;