From patchwork Tue Jul 7 09:22:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 234979 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp739823ilg; Tue, 7 Jul 2020 02:32:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhyJLNV81OqaXFYfohpaJF5YnE8obKFKkZSoUk/nq0iso+9OvhzqD56G1AK+L0xpum/9m8 X-Received: by 2002:a25:3610:: with SMTP id d16mr91454712yba.213.1594114361845; Tue, 07 Jul 2020 02:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594114361; cv=none; d=google.com; s=arc-20160816; b=FSTi7F25DnEt+CZL1/KrNu9psr8iGovTB430yP5th7ZWahudgthSAQUZEoJsJA6Lp/ e5LKOm64jWRXt3d/y/CMid/2GrkO5Q7LG3GoFDZY0twT+Q2Jzgym1viNwN7d71zlYrdB m6yb437R24HpAyhwEBmxeie2H9yZaPLrvu3lvK0oUfuHvXdjHADgnsoyGnfeSePy3ddI zmWo+TCLLgjVN2+xpjepSRt/z0SqH0547vG3rPUyaxUI4yc4lhHcwk3AQ7gnoQIzRFsh P7lGCiKJl4T3FXj+oZKOhv6+nNRdJpL4qqsGb/LK7slZUJfshEPgHwAFrVbAKR51gU6L MwVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=Lyd1t8Vx8mcWtSjKsthKn0BcqOfA0fagjWMvvZCfJic=; b=al62RvlaP6+SbTd8MZd3yXJ+Ru6wUi/voCktDIUeW0i9yzS0XW11a9zRYQdb4LE4at eE+hUoxV0Ht/hUSohsolH5hSppaSSdhEND1910DSM8Ja3giGNRnT10ZIKUUYuQ8aMyUf B2ctdOnq2NmmB6i3UsR/SoPrMvYWbYxwvX5GCnre5p3g7oXHiI+UFKp9YGm54R4Jm4U+ 8kf3d1RPeDEW9B9CdXSlpHSkqJja92Mt1ObEzgh51YYO1cu/1lv1Ccjh4rtKGmOWBBuq W/Jetvit9HorpvzIiDZt9FMOuQiIXfFR+Jmh/yZILYjPFeIqPp2mO073y1Mk6In6JAty bKBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id e7si14245874ybh.109.2020.07.07.02.32.41; Tue, 07 Jul 2020 02:32:41 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D46E71DE1B; Tue, 7 Jul 2020 11:27:38 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id D7AE31DD5F for ; Tue, 7 Jul 2020 11:27:16 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id BBBEB20060D; Tue, 7 Jul 2020 11:27:16 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C0F822008CE; Tue, 7 Jul 2020 11:27:14 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 84AF4402F7; Tue, 7 Jul 2020 17:27:12 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Jun Yang Date: Tue, 7 Jul 2020 14:52:41 +0530 Message-Id: <20200707092244.12791-27-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200707092244.12791-1-hemant.agrawal@nxp.com> References: <20200527132326.1382-1-hemant.agrawal@nxp.com> <20200707092244.12791-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 26/29] net/dpaa2: modify flow API QoS setup to follow FS setup 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" From: Jun Yang In HW/MC logical, QoS setup should follow FS setup. In addition, Skip QoS setup if MAX TC number of DPNI is set 1. Signed-off-by: Jun Yang --- drivers/net/dpaa2/dpaa2_flow.c | 151 ++++++++++++++++++--------------- 1 file changed, 84 insertions(+), 67 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index 3601829c9..9239fa459 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -2872,11 +2872,13 @@ dpaa2_flow_entry_update( dpaa2_flow_qos_entry_log("Before update", curr, qos_index); - ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, - priv->token, &curr->qos_rule); - if (ret) { - DPAA2_PMD_ERR("Qos entry remove failed."); - return -1; + if (priv->num_rx_tc > 1) { + ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, + priv->token, &curr->qos_rule); + if (ret) { + DPAA2_PMD_ERR("Qos entry remove failed."); + return -1; + } } extend = -1; @@ -2977,13 +2979,15 @@ dpaa2_flow_entry_update( dpaa2_flow_qos_entry_log("Start update", curr, qos_index); - ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, - priv->token, &curr->qos_rule, - curr->tc_id, qos_index, - 0, 0); - if (ret) { - DPAA2_PMD_ERR("Qos entry update failed."); - return -1; + if (priv->num_rx_tc > 1) { + ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, + priv->token, &curr->qos_rule, + curr->tc_id, qos_index, + 0, 0); + if (ret) { + DPAA2_PMD_ERR("Qos entry update failed."); + return -1; + } } if (curr->action != RTE_FLOW_ACTION_TYPE_QUEUE) { @@ -3313,31 +3317,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow, flow->action = RTE_FLOW_ACTION_TYPE_QUEUE; memset(&action, 0, sizeof(struct dpni_fs_action_cfg)); action.flow_id = rxq->flow_id; - if (is_keycfg_configured & DPAA2_QOS_TABLE_RECONFIGURE) { - dpaa2_flow_qos_table_extracts_log(priv); - if (dpkg_prepare_key_cfg( - &priv->extract.qos_key_extract.dpkg, - (uint8_t *)(size_t)priv->extract.qos_extract_param) - < 0) { - DPAA2_PMD_ERR( - "Unable to prepare extract parameters"); - return -1; - } - memset(&qos_cfg, 0, sizeof(struct dpni_qos_tbl_cfg)); - qos_cfg.discard_on_miss = true; - qos_cfg.keep_entries = true; - qos_cfg.key_cfg_iova = - (size_t)priv->extract.qos_extract_param; - ret = dpni_set_qos_table(dpni, CMD_PRI_LOW, - priv->token, &qos_cfg); - if (ret < 0) { - DPAA2_PMD_ERR( - "Distribution cannot be configured.(%d)" - , ret); - return -1; - } - } + /* Configure FS table first*/ if (is_keycfg_configured & DPAA2_FS_TABLE_RECONFIGURE) { dpaa2_flow_fs_table_extracts_log(priv, flow->tc_id); if (dpkg_prepare_key_cfg( @@ -3366,17 +3347,39 @@ dpaa2_generic_flow_set(struct rte_flow *flow, return -1; } } - /* Configure QoS table first */ - qos_index = flow->tc_id * priv->fs_entries + - flow->tc_index; + /* Configure QoS table then.*/ + if (is_keycfg_configured & DPAA2_QOS_TABLE_RECONFIGURE) { + dpaa2_flow_qos_table_extracts_log(priv); + if (dpkg_prepare_key_cfg( + &priv->extract.qos_key_extract.dpkg, + (uint8_t *)(size_t)priv->extract.qos_extract_param) < 0) { + DPAA2_PMD_ERR( + "Unable to prepare extract parameters"); + return -1; + } - if (qos_index >= priv->qos_entries) { - DPAA2_PMD_ERR("QoS table with %d entries full", - priv->qos_entries); - return -1; + memset(&qos_cfg, 0, sizeof(struct dpni_qos_tbl_cfg)); + qos_cfg.discard_on_miss = false; + qos_cfg.default_tc = 0; + qos_cfg.keep_entries = true; + qos_cfg.key_cfg_iova = + (size_t)priv->extract.qos_extract_param; + /* QoS table is effecitive for multiple TCs.*/ + if (priv->num_rx_tc > 1) { + ret = dpni_set_qos_table(dpni, CMD_PRI_LOW, + priv->token, &qos_cfg); + if (ret < 0) { + DPAA2_PMD_ERR( + "RSS QoS table can not be configured(%d)\n", + ret); + return -1; + } + } } - flow->qos_rule.key_size = FIXED_ENTRY_SIZE; + + flow->qos_real_key_size = priv->extract + .qos_key_extract.key_info.key_total_size; if (flow->ipaddr_rule.ipaddr_type == FLOW_IPV4_ADDR) { if (flow->ipaddr_rule.qos_ipdst_offset >= flow->ipaddr_rule.qos_ipsrc_offset) { @@ -3402,21 +3405,30 @@ dpaa2_generic_flow_set(struct rte_flow *flow, } } - flow->qos_rule.key_size = FIXED_ENTRY_SIZE; + /* QoS entry added is only effective for multiple TCs.*/ + if (priv->num_rx_tc > 1) { + qos_index = flow->tc_id * priv->fs_entries + + flow->tc_index; + if (qos_index >= priv->qos_entries) { + DPAA2_PMD_ERR("QoS table with %d entries full", + priv->qos_entries); + return -1; + } + flow->qos_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_qos_entry_log("Start add", flow, qos_index); + dpaa2_flow_qos_entry_log("Start add", flow, qos_index); - ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, + ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, priv->token, &flow->qos_rule, flow->tc_id, qos_index, 0, 0); - if (ret < 0) { - DPAA2_PMD_ERR( - "Error in addnig entry to QoS table(%d)", ret); - return ret; + if (ret < 0) { + DPAA2_PMD_ERR( + "Error in addnig entry to QoS table(%d)", ret); + return ret; + } } - /* Then Configure FS table */ if (flow->tc_index >= priv->fs_entries) { DPAA2_PMD_ERR("FS table with %d entries full", priv->fs_entries); @@ -3507,7 +3519,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow, &tc_cfg); if (ret < 0) { DPAA2_PMD_ERR( - "Distribution cannot be configured: %d\n", ret); + "RSS FS table cannot be configured: %d\n", + ret); rte_free((void *)param); return -1; } @@ -3841,13 +3854,15 @@ int dpaa2_flow_destroy(struct rte_eth_dev *dev, switch (flow->action) { case RTE_FLOW_ACTION_TYPE_QUEUE: - /* Remove entry from QoS table first */ - ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, priv->token, - &flow->qos_rule); - if (ret < 0) { - DPAA2_PMD_ERR( - "Error in adding entry to QoS table(%d)", ret); - goto error; + if (priv->num_rx_tc > 1) { + /* Remove entry from QoS table first */ + ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, priv->token, + &flow->qos_rule); + if (ret < 0) { + DPAA2_PMD_ERR( + "Error in removing entry from QoS table(%d)", ret); + goto error; + } } /* Then remove entry from FS table */ @@ -3855,17 +3870,19 @@ int dpaa2_flow_destroy(struct rte_eth_dev *dev, flow->tc_id, &flow->fs_rule); if (ret < 0) { DPAA2_PMD_ERR( - "Error in entry addition in FS table(%d)", ret); + "Error in removing entry from FS table(%d)", ret); goto error; } break; case RTE_FLOW_ACTION_TYPE_RSS: - ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, priv->token, - &flow->qos_rule); - if (ret < 0) { - DPAA2_PMD_ERR( - "Error in entry addition in QoS table(%d)", ret); - goto error; + if (priv->num_rx_tc > 1) { + ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, priv->token, + &flow->qos_rule); + if (ret < 0) { + DPAA2_PMD_ERR( + "Error in entry addition in QoS table(%d)", ret); + goto error; + } } break; default: