From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 0CF86A045E for ; Wed, 29 May 2019 23:03:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7FA521B948; Wed, 29 May 2019 23:02:53 +0200 (CEST) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 74A071B974 for ; Wed, 29 May 2019 23:02:45 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id t1so614764pgc.2 for ; Wed, 29 May 2019 14:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=k4TY5FBLXvLKCsOGNTnQU/+pX4V31t+IcXQ2V/amOYY=; b=Jcr/o9EZp4qzJzq4s3HUsMeqKecHg/oSXdltCPSAR6Y06Q9eqYPs/aY0uxaKgQVZPq Y29Jl8qxKVdzA8HuveH1XiyyAegGbKbM0ZIQ9+KmOKGQA8EgsaPtfVtJXKWIEhZE4DH4 UJIiin5EauueZXS1CUsX/W1mNIXfD6JllUPQU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=k4TY5FBLXvLKCsOGNTnQU/+pX4V31t+IcXQ2V/amOYY=; b=TjDPIyMtmqWPL3pBjDGEl3hHJcInV/NpFSnM8+DcmyFYS5Ttueo9qWjqW+y5yksCgd R+RiejFOKYBmcHttUKmV5Ts3E0ooaLsNCC4TEmqcAJZUzIUivVZxrGW5saQb/yXtW90o YEBPc5pcLruQcaZQHJjbwblBF1JvEV+pPlE04oW8cQ7u7j5PWdLrAoWgtoH0ZV8Mb6lM DY8vYyPhjfCgPbqrHZZj2pHS3zSMQnTTaD45zjGMYneP7OIrLc7i3j0VuhbYJZxV2zpb VVXnrwGbJXkBtu9nbsPu1zDDrmsC3+CKKuxyRKgHq632O8Ub+ZuNbZnnpcxpIopRIW6F 4sAQ== X-Gm-Message-State: APjAAAWklSL+Rb82FArVbSyolQ4axpte1Ch+dhJaN0GRA4hDx4Js6uMd kc1ADe1J7Icobo2ECxxuSZii0/0OzEICthyc9/0pi1keF+U01tBE3kpErzbI7hdMyccoUH3VY5g eGhN1dJlQ2FLI7aL9DGaCtpuK/KLcsP2VfU47ItxrzNd476XPGPqqpQw7WHe6q+Z9 X-Google-Smtp-Source: APXvYqxRpZ9Lt1qZ6RvEDl4z47yTU76h0/ABUorN77Z6YitvLCqbEVwoCCdnE10EEosd7RloE4Uxjw== X-Received: by 2002:a17:90a:17ca:: with SMTP id q68mr15010941pja.104.1559163759617; Wed, 29 May 2019 14:02:39 -0700 (PDT) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id r4sm403889pjd.25.2019.05.29.14.02.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 May 2019 14:02:39 -0700 (PDT) From: Lance Richardson To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com, maxime.coquelin@redhat.com, ktraynor@redhat.com, Lance Richardson , stable@dpdk.org Date: Wed, 29 May 2019 17:02:24 -0400 Message-Id: <20190529210227.17092-6-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190529210227.17092-1-lance.richardson@broadcom.com> References: <20190521213953.25425-1-ajit.khaparde@broadcom.com> <20190529210227.17092-1-lance.richardson@broadcom.com> Subject: [dpdk-dev] [PATCH v5 5/8] net/bnxt: fix RSS RETA indirection table ops 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: Ajit Khaparde We are trying to update the indirection table for all the VNICs. We should update the table only for the default vnic0. Fix the reta update function to only update table entries that are selected by the update mask. Translate queue number to firmware group ID when updating an entry. Fix reta query op to only return table entries as identfied by the provided mask. Translate firmware group IDs to queue numbers. Removed extraneous code from bnxt_reta_query_op(). Fixes: d819382543f3 ("net/bnxt: add RSS redirection table operations") Signed-off-by: Ajit Khaparde Signed-off-by: Lance Richardson Reviewed-by: Rahul Gupta Reviewed-by: Lance Richardson Reviewed-by: Ajit Khaparde Cc: stable@dpdk.org --- v3: * Squashed three RSS RETA fix commits into one. drivers/net/bnxt/bnxt_ethdev.c | 92 +++++++++++++++++++++++++--------- drivers/net/bnxt/bnxt_hwrm.c | 1 + 2 files changed, 70 insertions(+), 23 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index bccba445a..30dff72a6 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -618,12 +618,6 @@ static void bnxt_print_link_info(struct rte_eth_dev *eth_dev) eth_dev->data->port_id); } -static int bnxt_dev_lsc_intr_setup(struct rte_eth_dev *eth_dev) -{ - bnxt_print_link_info(eth_dev); - return 0; -} - /* * Determine whether the current configuration requires support for scattered * receive; return 1 if scattered receive is required and 0 if not. @@ -977,30 +971,72 @@ static void bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev) bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL); } +/* Return bnxt_rx_queue pointer corresponding to a given rxq. */ +static struct bnxt_rx_queue *bnxt_qid_to_rxq(struct bnxt *bp, uint16_t qid) +{ + if (qid >= bp->rx_nr_rings) + return NULL; + + return bp->eth_dev->data->rx_queues[qid]; +} + +/* Return rxq corresponding to a given rss table ring/group ID. */ +static uint16_t bnxt_rss_to_qid(struct bnxt *bp, uint16_t fwr) +{ + unsigned int i; + + for (i = 0; i < bp->rx_nr_rings; i++) { + if (bp->grp_info[i].fw_grp_id == fwr) + return i; + } + + return INVALID_HW_RING_ID; +} + static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf; - struct bnxt_vnic_info *vnic; + struct bnxt_vnic_info *vnic = &bp->vnic_info[0]; + uint16_t tbl_size = HW_HASH_INDEX_SIZE; + uint16_t idx, sft; int i; + if (!vnic->rss_table) + return -EINVAL; + if (!(dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)) return -EINVAL; - if (reta_size != HW_HASH_INDEX_SIZE) { + if (reta_size != tbl_size) { PMD_DRV_LOG(ERR, "The configured hash table lookup size " "(%d) must equal the size supported by the hardware " - "(%d)\n", reta_size, HW_HASH_INDEX_SIZE); + "(%d)\n", reta_size, tbl_size); return -EINVAL; } - /* Update the RSS VNIC(s) */ - for (i = 0; i < bp->max_vnics; i++) { - vnic = &bp->vnic_info[i]; - memcpy(vnic->rss_table, reta_conf, reta_size); - bnxt_hwrm_vnic_rss_cfg(bp, vnic); + + for (i = 0; i < reta_size; i++) { + struct bnxt_rx_queue *rxq; + + idx = i / RTE_RETA_GROUP_SIZE; + sft = i % RTE_RETA_GROUP_SIZE; + + if (!(reta_conf[idx].mask & (1ULL << sft))) + continue; + + rxq = bnxt_qid_to_rxq(bp, reta_conf[idx].reta[sft]); + if (!rxq) { + PMD_DRV_LOG(ERR, "Invalid ring in reta_conf.\n"); + return -EINVAL; + } + + vnic->rss_table[i] = + vnic->fw_grp_ids[reta_conf[idx].reta[sft]]; } + + bnxt_hwrm_vnic_rss_cfg(bp, vnic); return 0; } @@ -1010,8 +1046,8 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev, { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; struct bnxt_vnic_info *vnic = &bp->vnic_info[0]; - struct rte_intr_handle *intr_handle - = &bp->pdev->intr_handle; + uint16_t tbl_size = HW_HASH_INDEX_SIZE; + uint16_t idx, sft, i; /* Retrieve from the default VNIC */ if (!vnic) @@ -1019,18 +1055,28 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev, if (!vnic->rss_table) return -EINVAL; - if (reta_size != HW_HASH_INDEX_SIZE) { + if (reta_size != tbl_size) { PMD_DRV_LOG(ERR, "The configured hash table lookup size " "(%d) must equal the size supported by the hardware " - "(%d)\n", reta_size, HW_HASH_INDEX_SIZE); + "(%d)\n", reta_size, tbl_size); return -EINVAL; } - /* EW - need to revisit here copying from uint64_t to uint16_t */ - memcpy(reta_conf, vnic->rss_table, reta_size); - if (rte_intr_allow_others(intr_handle)) { - if (eth_dev->data->dev_conf.intr_conf.lsc != 0) - bnxt_dev_lsc_intr_setup(eth_dev); + for (idx = 0, i = 0; i < reta_size; i++) { + idx = i / RTE_RETA_GROUP_SIZE; + sft = i % RTE_RETA_GROUP_SIZE; + + if (reta_conf[idx].mask & (1ULL << sft)) { + uint16_t qid; + + qid = bnxt_rss_to_qid(bp, vnic->rss_table[i]); + + if (qid == INVALID_HW_RING_ID) { + PMD_DRV_LOG(ERR, "Inv. entry in rss table.\n"); + return -EINVAL; + } + reta_conf[idx].reta[sft] = qid; + } } return 0; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index c5aca89b2..0c6af1622 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -1607,6 +1607,7 @@ int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp, req.hash_key_tbl_addr = rte_cpu_to_le_64(vnic->rss_hash_key_dma_addr); req.rss_ctx_idx = rte_cpu_to_le_16(vnic->rss_rule); + req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id); rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); -- 2.17.1