From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F2F54A034C; Wed, 27 Apr 2022 16:59:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 941E842826; Wed, 27 Apr 2022 16:58:44 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id 9521942821 for ; Wed, 27 Apr 2022 16:58:42 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 2BE01C0000F2; Wed, 27 Apr 2022 07:58:40 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 2BE01C0000F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1651071522; bh=RuXxO3yepVPMg9w+vtaV6dty/9rXnzd77V1WcO7a0vI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aO9UZTlQ74uXpFaPeLAd+nxQMr40zujF9pGNlXjAKKJP2in8ML+Qj7VEbpGfUO+My KJMNdk6sNhqIrWixP/35jqzK8FHdA8h9C43wo1guBp5dThBmT69boaFvmEmdT/ei3R us3btgxZuj0wcxk9zJAZOnKWQN17aBNXAjZNew+A= From: Kalesh A P To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com Subject: [PATCH 09/17] net/bnxt: add check for dupliate queue ids Date: Wed, 27 Apr 2022 20:28:13 +0530 Message-Id: <20220427145821.5987-10-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20220427145821.5987-1-kalesh-anakkur.purayil@broadcom.com> References: <20220427145821.5987-1-kalesh-anakkur.purayil@broadcom.com> 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 From: Kalesh AP Currently driver does not have a check for duplicate queue ids. User must either specify all Rx queues created or no queues in the flow create command. Repeating the queue index is invalid. Also, moved the check for invalid queue to the beginning of the function. Fixes: 239695f754cb ("net/bnxt: enhance RSS action support") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt_flow.c | 49 +++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index bd96bba..fc5bacf 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -1115,7 +1115,7 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp, struct rte_flow_error *error) { const struct rte_flow_action_rss *rss; - unsigned int rss_idx, i; + unsigned int rss_idx, i, j; uint16_t hash_type; uint64_t types; int rc; @@ -1133,6 +1133,37 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp, goto ret; } + /* Validate Rx queues */ + for (i = 0; i < rss->queue_num; i++) { + PMD_DRV_LOG(DEBUG, "RSS action Queue %d\n", rss->queue[i]); + + if (rss->queue[i] >= bp->rx_nr_rings || + !bp->rx_queues[rss->queue[i]]) { + rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + act, + "Invalid queue ID for RSS"); + rc = -rte_errno; + goto ret; + } + } + + /* Duplicate queue ids are not supported. */ + for (i = 0; i < rss->queue_num; i++) { + for (j = i + 1; j < rss->queue_num; j++) { + if (rss->queue[i] == rss->queue[j]) { + rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + act, + "Duplicate queue ID for RSS"); + rc = -rte_errno; + goto ret; + } + } + } + /* Currently only Toeplitz hash is supported. */ if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT && rss->func != RTE_ETH_HASH_FUNCTION_TOEPLITZ) { @@ -1200,22 +1231,6 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp, if (rss->queue_num == 0) goto skip_rss_table; - /* Validate Rx queues */ - for (i = 0; i < rss->queue_num; i++) { - PMD_DRV_LOG(DEBUG, "RSS action Queue %d\n", rss->queue[i]); - - if (rss->queue[i] >= bp->rx_nr_rings || - !bp->rx_queues[rss->queue[i]]) { - rte_flow_error_set(error, - EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - act, - "Invalid queue ID for RSS"); - rc = -rte_errno; - goto ret; - } - } - /* Prepare the indirection table */ for (rss_idx = 0; rss_idx < HW_HASH_INDEX_SIZE; rss_idx++) { struct bnxt_rx_queue *rxq; -- 2.10.1