From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id 084951B3E0 for ; Thu, 7 Jun 2018 11:44:01 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id g21-v6so11670096lfb.4 for ; Thu, 07 Jun 2018 02:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hRYhkDqnGV9EvmbmqtYMwX6hQQUnLmXw9D1CfMZa4iI=; b=lOdLwemPFDcuklZbIykJROgFb4KZx3D8yVIuvY85ocDm1QSGdC15vLczICqiOR7BqS TQQ6rHK1v7OMc5nyBtpYaGXD3HZPOkYO43EtNRi+JRmGwifBrdcrLdNpleXv3y9blVIQ u3GukJJ8AliKC8hcaZb6LPvPBgWmGkV+Wo0BWCDDASTlgvHvT1FgXdpMMoLQI5lqhbyg njvHRro9QADddQotuOEVuavw72KrgsV1X3Ky680rtSrBLJhvtKneroUcHmk4GV2xclZs mtJTm4dlZGbTWUopOE2j/CGPxwz34gvUI7+tmnhHOWhOCzj6NNaa6chaR9J+l1J8Ikzm hz5A== 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=hRYhkDqnGV9EvmbmqtYMwX6hQQUnLmXw9D1CfMZa4iI=; b=RdUcp5+PxeMU6agsFndZ3xlShaE19Pm7d4QD16xqR8n891CAdn4KkBgfFlGP8C0UPx rBa3qPcf+8i4kOGQaDiVFjdXimKNIPUw2m0tkwUm7r1yej3SE2wd58t3kM4K71EaSOm+ ZHoZabZ/ZO345jR7uwQdF25oix3fWaMAimFP8l1EIps5BdsXOwkNdqE8CZ0UwE3PSxph yBIN8wFRZz7czRvMEXX/4SfU9Du30EsZy4SLLGYLaOAK6PJzau2LeWG3bto7BmLORfIn 1hz+Z+kOZPFrE+JAPxkeNsj5/1vOUyqeYh80HY90kpeYbj1/RxevqRFl0DGil94JdWWi +Siw== X-Gm-Message-State: APt69E3Z/KNU2O4K+gXYsZzUFQCNHhijQJEGoG1Vf8JpA6ZHcEqyPecV +c/K+QQ9UZpvfQLDyxo/Qk27vw== X-Google-Smtp-Source: ADUXVKLtNY1BoCMp9xjglncnH7e2Bfr3TP/ZA/1MMv+N+IM8CVI2FZbJomMliBuLtsg3sMNsQQDR4g== X-Received: by 2002:a2e:878f:: with SMTP id n15-v6mr949746lji.69.1528364641437; Thu, 07 Jun 2018 02:44:01 -0700 (PDT) Received: from mkPC.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id p28-v6sm3612368lfh.24.2018.06.07.02.43.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 02:43:59 -0700 (PDT) From: Michal Krawczyk To: Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin Cc: dev@dpdk.org, matua@amazon.com, Rafal Kozik Date: Thu, 7 Jun 2018 11:43:13 +0200 Message-Id: <20180607094322.14312-18-mk@semihalf.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180607094322.14312-1-mk@semihalf.com> References: <20180607094322.14312-1-mk@semihalf.com> Subject: [dpdk-dev] [PATCH v3 18/27] net/ena: rework configuration of IO queue numbers 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: , X-List-Received-Date: Thu, 07 Jun 2018 09:44:02 -0000 From: Rafal Kozik Move configuration of IO queue numbers to separate function and take into consideration max number of IO completion queues. Signed-off-by: Rafal Kozik Acked-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 5f4956078..1f7463496 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1491,6 +1491,24 @@ static void ena_timer_wd_callback(__rte_unused struct rte_timer *timer, } } +static int ena_calc_io_queue_num(__rte_unused struct ena_com_dev *ena_dev, + struct ena_com_dev_get_features_ctx *get_feat_ctx) +{ + int io_sq_num, io_cq_num, io_queue_num; + + io_sq_num = get_feat_ctx->max_queues.max_sq_num; + io_cq_num = get_feat_ctx->max_queues.max_cq_num; + + io_queue_num = RTE_MIN(io_sq_num, io_cq_num); + + if (unlikely(io_queue_num == 0)) { + RTE_LOG(ERR, PMD, "Number of IO queues should not be 0\n"); + return -EFAULT; + } + + return io_queue_num; +} + static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) { struct rte_pci_device *pci_dev; @@ -1555,7 +1573,8 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) adapter->wd_state = wd_state; ena_dev->tx_mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST; - adapter->num_queues = get_feat_ctx.max_queues.max_sq_num; + adapter->num_queues = ena_calc_io_queue_num(ena_dev, + &get_feat_ctx); queue_size = ena_calc_queue_size(ena_dev, &tx_sgl_size, &get_feat_ctx); if ((queue_size <= 0) || (adapter->num_queues <= 0)) -- 2.14.1