From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by dpdk.org (Postfix) with ESMTP id E3E2A5A3E for ; Mon, 4 Jun 2018 14:10:09 +0200 (CEST) Received: by mail-lf0-f66.google.com with SMTP id y20-v6so24825999lfy.0 for ; Mon, 04 Jun 2018 05:10:09 -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=9jdegtg1jS662a37NWRFN3ahz1pTVsa+6RobxFzA+AM=; b=P4Yy4/pNb3ehFGQhVJXRrrsxuf2ioSnhe8kl8Xr7oDQK9bAgPxmX/L7c8exnXjepBT 845nz9jYkG4tcsDEX6j7ZdoXFsj1WPvFaUTgyB5bQB4UstQARNibKEFB41Ks68ylaNqz NlLwxTRdgsMMnwnezobnynsMxITRcX4o4z/dNMgCIVsfncKLtjBkqDotMLujbPRlh37k 5HImKR28WH+HyFP9FP90cKBEp/c0gnXtRyF+TmiSHjKNJi4/uzobUtTQMDeGofl06knK o5vhpsiYUYg+vO+4eSc5/kRgk0+wFL1yosUsrp3Th3x8y56LncAhE/8f7vNxUwDdTLPh Qx/Q== 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=9jdegtg1jS662a37NWRFN3ahz1pTVsa+6RobxFzA+AM=; b=MaMo0ZVix5PH5bkcoTBl3+Sht39OwjDQGSfd02tbvWMczU6hShxdVciA/GLgi1IuSZ Fhtp7ZUwVpYg9/rmiF8nykgNvNwLYn9rUkRhfH9JQCUq6ZdEKtRqmi0j8VqkeB3m3u2r qsZgMiLMWUgtO7RI0LCbXtINNxHFNO4x67i5trtc+aiQIY8AmPBzIjCz+WlmvCGdE3S1 ucGiUdQtnzP/m5kmEFrDBkQrrqFjFANIMFwjBIVA9kvkxDeXsWlxBpcxSf46+uQhJPWD olnoUHFaP6/pC3kl7kb3w0B6a3fOEU07JnZOpBiN8GP3Uh4QDn0dIEGfWpJk0A455mH9 ODBg== X-Gm-Message-State: ALKqPwfSeiRj5mJUmtIXBXyd/AZ0xESD9Uh0IImbhdI9slAmHOVGsRY6 ZfqejuubOJYY2i4ffBdqISLW/g== X-Google-Smtp-Source: ADUXVKJ9Bvi5JTjIBOStgg5pZUjaSx4D+wF2Vp6QoU0AvX2xwv1jjZR0HmRu3d1cw88J4YUpyl14Vw== X-Received: by 2002:a19:c90d:: with SMTP id z13-v6mr13371247lff.0.1528114209569; Mon, 04 Jun 2018 05:10:09 -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 g23-v6sm3817415lfi.49.2018.06.04.05.10.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 05:10:08 -0700 (PDT) From: Michal Krawczyk To: Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin Cc: dev@dpdk.org, matua@amazon.com, Rafal Kozik Date: Mon, 4 Jun 2018 14:09:45 +0200 Message-Id: <20180604120955.17319-8-mk@semihalf.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180604120955.17319-1-mk@semihalf.com> References: <20180604120955.17319-1-mk@semihalf.com> Subject: [dpdk-dev] [PATCH v2 17/26] 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: Mon, 04 Jun 2018 12:10:10 -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 2d9b104d6..11fe40814 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