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 C5953A05D3 for ; Fri, 24 May 2019 16:51:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E75D91B95D; Fri, 24 May 2019 16:50:18 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id E22D51B94F for ; Fri, 24 May 2019 16:50:10 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id g9so5459831pfo.11 for ; Fri, 24 May 2019 07:50:10 -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=UD7ly95CPVTkD8/OLJ0chiJKMw+oqmYmvTvzzQ6i/u0=; b=bPAJkSdKk3Tp322y0bAiFCj6YlMYJZWBUEN9lrBW/YtnFJ8Ah1RIqOX+jLVgdH5Wys 86eGJFWU+nraLNTrK6X3Q2/PF7NKi7tPjlGrD8zR4yyajr1AMtQuaLEzyV15fB80vOMx ag9ftmo4QO3qr3QfadzWPP9ieZT2Q0R9lDt90= 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=UD7ly95CPVTkD8/OLJ0chiJKMw+oqmYmvTvzzQ6i/u0=; b=r1w8pHYxRC+Ve9QnKOHFpyP4kVSj7mTZbYeHOrMrYe45jbEyPvrQqw4qg9sxXpFfJ2 CNIJs1sLid7WePlp+sI9ubgjFCQevmzVZ8POTle2Z6iTYrqGa+T82IFkb6uRpcLAMV7n 8IGHZJAJTUV/7i+SQRBGTk2b70mrXVdjPPChKITMd+5aMPUqkeHa9Z2tGcjGQcIrXhXu z274RpA/tITivQ+OWivm+1C9dcfjRk+hx2rFjNd+71++y86DpHOeqxYdgvnMQ/QyEZtK OwYRAHYYj+NnVgMxVmcqxYTcvqbL0DEmCGwzbId3fk2zY3WqsTJAZkC9IFZgPKd/IhRr NjbA== X-Gm-Message-State: APjAAAUrfA5+hy/HfW2jHzdw1s81DibGAj0/kps91SjJQULpyq2FLKM5 yMsvfcWtMfPZdB1O1QCmi42l8yrfgSB36ZIuf1yJ9O0fOKAeD6izwjVEdKZRqqyzLbS8XxQ/br0 WsW6D6LbLszfkbcJXvy1dSGpywwWqzomxqHHBHB6CoKo2WI55jqT44aWhWEQ/vHwO X-Google-Smtp-Source: APXvYqwgWDX/oedyxTMMQCUW7GWdXvSY7KrtTtBrA313mwRtKLpu6bEzuxJtfPgMtzPbFrB0NdGCCQ== X-Received: by 2002:a63:ed03:: with SMTP id d3mr105265988pgi.7.1558709409810; Fri, 24 May 2019 07:50:09 -0700 (PDT) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id x23sm2723705pfn.160.2019.05.24.07.50.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 May 2019 07:50:09 -0700 (PDT) From: Lance Richardson To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com, maxime.coquelin@redhat.com, Lance Richardson Date: Fri, 24 May 2019 10:49:30 -0400 Message-Id: <20190524144935.18765-6-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190524144935.18765-1-lance.richardson@broadcom.com> References: <20190521213953.25425-1-ajit.khaparde@broadcom.com> <20190524144935.18765-1-lance.richardson@broadcom.com> Subject: [dpdk-dev] [PATCH v2 05/10] net/bnxt: use reta update mask and translate qid to grp id 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" 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. Fixes: d819382543f3 ("net/bnxt: add RSS redirection table operations") Signed-off-by: Lance Richardson Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 39 ++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 2d892cd4f..d2b89a217 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -977,6 +977,15 @@ 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]; +} + static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) @@ -984,24 +993,42 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev, 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 = &bp->vnic_info[0]; + uint16_t tbl_size = HW_HASH_INDEX_SIZE; + uint16_t idx, sft; + int i; - /* Update the default RSS VNIC */ - if (!vnic) - return -EINVAL; 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; } - memcpy(vnic->rss_table, reta_conf, reta_size); + 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; } -- 2.17.1