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 5226EA05D3 for ; Fri, 24 May 2019 16:51:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D8CF01B996; Fri, 24 May 2019 16:50:24 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 5DCF71B951 for ; Fri, 24 May 2019 16:50:12 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id f97so4281278plb.5 for ; Fri, 24 May 2019 07:50:12 -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=o/WkUVY2zE6MWdpaxuDke01F8QkmuMiegWL+O/xJf90=; b=Ann6Sq37Ek/XZTVe7BcCZZJbs+v+y6ridbegMRlPGox+Wmz7QHKSalG2DpGo+BTIcs XcmIMrh5l5EKsXOcY+202MyetRohIW+UunFkp3rR/SJxjF+kpMegYQ1WO0Jqfu7YkKRw IPEHgognGLclma6r+OtZEX0oN0SIZrNnWUs5U= 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=o/WkUVY2zE6MWdpaxuDke01F8QkmuMiegWL+O/xJf90=; b=F4ukheGKopQF10JzvyUOpx9sCTMiF9Q1Fuxl67k4qCuQ8xhEqHRIZwLQcCyMu/DpRO ySmA2Ih/qtPlu0Pav/ZIp4/UlqYIW1ZMq+pvh6qKcBT8obE8uOLOtv93JsGxKC1rPk2y fQM5NVgFvrhvpgmWoLZ1PKbVpB+ewzFxMCPXRTUGB8Fy/Ea8cGRQaXzhspBrzbNS5T1M kkKhuxqDFuHXbgx8yiolM1F5xFrQamip0Tept+qxvmi/HCzMufttRH+v9AUSpk/OBGDN nW7ZSwpJd1TgtqepGlicV4703uMEcZAJcudZMRclUXnkiXgD5vCQ+6QKr6pbjeRG/IRQ WewQ== X-Gm-Message-State: APjAAAVVkNu9xi1MwG0gGDxhebhZ6BuVoS4Qp/vkhvDP63haztbuN9QU qoEOoDFrXPSTwgS3jmbrZcggCvedIlOFvxXKXr9p/qutaulwCVo2LqNM2mTeWjS+kIo3p7RoNma l6pqRGnWAklHeIcBosGQ+vo5X860n/kFc8LDFAQbDQZYPozmm3vgq+RaqLAc/hU78 X-Google-Smtp-Source: APXvYqx3ROk02FMDr88maXNYNywLL/fqk7/ErqMlK7TRDRkPXoK7SN51kVKdHdKe+X6FCpIwmYpF/w== X-Received: by 2002:a17:902:158b:: with SMTP id m11mr65768024pla.268.1558709411354; Fri, 24 May 2019 07:50:11 -0700 (PDT) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id x23sm2723705pfn.160.2019.05.24.07.50.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 May 2019 07:50:10 -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:31 -0400 Message-Id: <20190524144935.18765-7-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 06/10] net/bnxt: fix reta query op 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 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: Lance Richardson Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 47 +++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index d2b89a217..70924d93d 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. @@ -986,6 +980,19 @@ static struct bnxt_rx_queue *bnxt_qid_to_rxq(struct bnxt *bp, uint16_t qid) 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) @@ -1039,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) @@ -1048,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; -- 2.17.1