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 0F6BFA034F; Fri, 15 Oct 2021 18:28:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 06880411B6; Fri, 15 Oct 2021 18:27:51 +0200 (CEST) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by mails.dpdk.org (Postfix) with ESMTP id 9657641147 for ; Fri, 15 Oct 2021 18:27:48 +0200 (CEST) Received: by mail-lf1-f53.google.com with SMTP id x27so44301347lfu.5 for ; Fri, 15 Oct 2021 09:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xpEKrR/ELZ5c3ce9pfZ9iajIFAVVntMOxjAjnVHUr2w=; b=k4o4WkpoQ8Rum/1C5485HS2+1YVHg1/aHMGqOzQ18g1imFdj6pQUQ9GTwVb2Nf/qMF c38VGWbwEIC0jjJisKdL1vGxxClQytRYkBlRxw0c1RyYLgruURT63EY8e2BFvX7LyjxE do7OA2XunTl5LhElf8+Gj242b2LHZIhnOfIZ2hefRjAYCtQHCxjyaFBV2Mxrqln183Ks wXqFOtZ7LJ6Sz9pl5jf0gccqg8pYNo6VVqDoXwVG/lSvDvVzoOSXD358rEoz9D8Iz+9K R0oJ5CKm4ipPBo6Cuq5urQDA/ePN1ixisYPs+lCN/U6bxepuc3NdgFFdsKR41dppdXzj 5fOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xpEKrR/ELZ5c3ce9pfZ9iajIFAVVntMOxjAjnVHUr2w=; b=HS1h7MaI54Yq4avIRl6utYCVE/1vQy92aDXCTNNE8u3oUQ8ExLp632lxWcxPq6jTDW 9CPOZjVpWlqpSo4ljqIBN19+rZkQ33xYSImXTPyxCOJkudSe0Hx3P5Os7FRgzb0Yn5X0 WXHhDL48H9GFVegjVZPvFT00RmTgyaqbonKuzsfV9wzI00wfaeehve80kdicKyqk4yGA 2MRKNwukO+gvc9dE+O3YCTrzTpPNsSOQt8hX1aShnL4OvyzVqu4wEG26f89a4eRkxy9c IEqiZz28+yq+bF+Ww1BzVHAgI10CAxP6yekCLf/IFgX2nZXP8ChvkmZfHVDlqjvnrrYk pmFQ== X-Gm-Message-State: AOAM530/0sd+A9HKXWUfSyyS/PBC7fWVtJuPwyoIzhB/43wCj8MMUPNr IVJQhDgQ56FNJnieVfoSKpybcQ== X-Google-Smtp-Source: ABdhPJymRaqKfPgq4iZoqF92SJodalZMbV0hJL4pR+xip8XMvx13rC7/Gp2c/4cd8j0/b2blB+QK/Q== X-Received: by 2002:a2e:611a:: with SMTP id v26mr13286520ljb.122.1634315268251; Fri, 15 Oct 2021 09:27:48 -0700 (PDT) Received: from DESKTOP-U5LNN3J.localdomain (89-79-181-52.dynamic.chello.pl. [89.79.181.52]) by smtp.gmail.com with ESMTPSA id b3sm559219lfe.58.2021.10.15.09.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 09:27:47 -0700 (PDT) From: Michal Krawczyk To: ferruh.yigit@intel.com Cc: dev@dpdk.org, upstream@semihalf.com, shaibran@amazon.com, ndagan@amazon.com, igorch@amazon.com, Michal Krawczyk , stable@dpdk.org Date: Fri, 15 Oct 2021 18:26:57 +0200 Message-Id: <20211015162701.16324-4-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211015162701.16324-1-mk@semihalf.com> References: <20211014201858.9571-1-mk@semihalf.com> <20211015162701.16324-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/7] net/ena: fix per-queue offload capabilities 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 Sender: "dev" PMD shouldn't advertise the same offloads as both per-queue and per-port [1]. Each offload capability should go either to the [rt]x_queue_offload_capa or [rt]x_offload_capa. As ENA currently doesn't support offloads which could be configured per-queue, only per-port flags should be set. In addition, to make the code cleaner, parsing appropriate offload flags is encapsulated into helper functions, in a similar matter it's done by the other PMDs. [1] https://doc.dpdk.org/guides/prog_guide/ poll_mode_drv.html?highlight=offloads#hardware-offload Fixes: 7369f88f88c0 ("net/ena: convert to new Rx offloads API") Fixes: 56b8b9b7e5d2 ("net/ena: convert to new Tx offloads API") Cc: stable@dpdk.org Signed-off-by: Michal Krawczyk Reviewed-by: Igor Chauskin Reviewed-by: Shai Brandes --- drivers/net/ena/ena_ethdev.c | 90 ++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 30 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 87216f75a9..c2bd2f12af 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -223,6 +223,10 @@ static int ena_queue_start(struct rte_eth_dev *dev, struct ena_ring *ring); static int ena_queue_start_all(struct rte_eth_dev *dev, enum ena_ring_type ring_type); static void ena_stats_restart(struct rte_eth_dev *dev); +static uint64_t ena_get_rx_port_offloads(struct ena_adapter *adapter); +static uint64_t ena_get_tx_port_offloads(struct ena_adapter *adapter); +static uint64_t ena_get_rx_queue_offloads(struct ena_adapter *adapter); +static uint64_t ena_get_tx_queue_offloads(struct ena_adapter *adapter); static int ena_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static void ena_interrupt_handler_rte(void *cb_arg); @@ -1959,12 +1963,63 @@ static void ena_init_rings(struct ena_adapter *adapter, } } +static uint64_t ena_get_rx_port_offloads(struct ena_adapter *adapter) +{ + uint64_t port_offloads = 0; + + if (adapter->offloads.rx_offloads & ENA_L3_IPV4_CSUM) + port_offloads |= DEV_RX_OFFLOAD_IPV4_CKSUM; + + if (adapter->offloads.rx_offloads & + (ENA_L4_IPV4_CSUM | ENA_L4_IPV6_CSUM)) + port_offloads |= + DEV_RX_OFFLOAD_UDP_CKSUM | DEV_RX_OFFLOAD_TCP_CKSUM; + + if (adapter->offloads.rx_offloads & ENA_RX_RSS_HASH) + port_offloads |= DEV_RX_OFFLOAD_RSS_HASH; + + port_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; + + return port_offloads; +} + +static uint64_t ena_get_tx_port_offloads(struct ena_adapter *adapter) +{ + uint64_t port_offloads = 0; + + if (adapter->offloads.tx_offloads & ENA_IPV4_TSO) + port_offloads |= DEV_TX_OFFLOAD_TCP_TSO; + + if (adapter->offloads.tx_offloads & ENA_L3_IPV4_CSUM) + port_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + if (adapter->offloads.tx_offloads & + (ENA_L4_IPV4_CSUM_PARTIAL | ENA_L4_IPV4_CSUM | + ENA_L4_IPV6_CSUM | ENA_L4_IPV6_CSUM_PARTIAL)) + port_offloads |= + DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM; + + return port_offloads; +} + +static uint64_t ena_get_rx_queue_offloads(struct ena_adapter *adapter) +{ + RTE_SET_USED(adapter); + + return 0; +} + +static uint64_t ena_get_tx_queue_offloads(struct ena_adapter *adapter) +{ + RTE_SET_USED(adapter); + + return 0; +} + static int ena_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct ena_adapter *adapter; struct ena_com_dev *ena_dev; - uint64_t rx_feat = 0, tx_feat = 0; ena_assert_msg(dev->data != NULL, "Uninitialized device\n"); ena_assert_msg(dev->data->dev_private != NULL, "Uninitialized device\n"); @@ -1983,33 +2038,11 @@ static int ena_infos_get(struct rte_eth_dev *dev, ETH_LINK_SPEED_50G | ETH_LINK_SPEED_100G; - /* Set Tx & Rx features available for device */ - if (adapter->offloads.tx_offloads & ENA_IPV4_TSO) - tx_feat |= DEV_TX_OFFLOAD_TCP_TSO; - - if (adapter->offloads.tx_offloads & ENA_L3_IPV4_CSUM) - tx_feat |= DEV_TX_OFFLOAD_IPV4_CKSUM; - if (adapter->offloads.tx_offloads & - (ENA_L4_IPV4_CSUM_PARTIAL | ENA_L4_IPV4_CSUM | - ENA_L4_IPV6_CSUM | ENA_L4_IPV6_CSUM_PARTIAL)) - tx_feat |= DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM; - - if (adapter->offloads.rx_offloads & ENA_L3_IPV4_CSUM) - rx_feat |= DEV_RX_OFFLOAD_IPV4_CKSUM; - if (adapter->offloads.rx_offloads & - (ENA_L4_IPV4_CSUM | ENA_L4_IPV6_CSUM)) - rx_feat |= DEV_RX_OFFLOAD_UDP_CKSUM | DEV_RX_OFFLOAD_TCP_CKSUM; - - rx_feat |= DEV_RX_OFFLOAD_JUMBO_FRAME; - tx_feat |= DEV_TX_OFFLOAD_MULTI_SEGS; - /* Inform framework about available features */ - dev_info->rx_offload_capa = rx_feat; - if (adapter->offloads.rx_offloads & ENA_RX_RSS_HASH) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_RSS_HASH; - dev_info->rx_queue_offload_capa = rx_feat; - dev_info->tx_offload_capa = tx_feat; - dev_info->tx_queue_offload_capa = tx_feat; + dev_info->rx_offload_capa = ena_get_rx_port_offloads(adapter); + dev_info->tx_offload_capa = ena_get_tx_port_offloads(adapter); + dev_info->rx_queue_offload_capa = ena_get_rx_queue_offloads(adapter); + dev_info->tx_queue_offload_capa = ena_get_tx_queue_offloads(adapter); dev_info->flow_type_rss_offloads = ENA_ALL_RSS_HF; dev_info->hash_key_size = ENA_HASH_KEY_SIZE; @@ -2022,9 +2055,6 @@ static int ena_infos_get(struct rte_eth_dev *dev, dev_info->max_tx_queues = adapter->max_num_io_queues; dev_info->reta_size = ENA_RX_RSS_TABLE_SIZE; - adapter->tx_supported_offloads = tx_feat; - adapter->rx_supported_offloads = rx_feat; - dev_info->rx_desc_lim.nb_max = adapter->max_rx_ring_size; dev_info->rx_desc_lim.nb_min = ENA_MIN_RING_DESC; dev_info->rx_desc_lim.nb_seg_max = RTE_MIN(ENA_PKT_MAX_BUFS, -- 2.25.1