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 A5C77A0C45 for ; Fri, 3 Dec 2021 16:09:22 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 338D540692; Fri, 3 Dec 2021 16:09:22 +0100 (CET) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mails.dpdk.org (Postfix) with ESMTP id 51A2340041 for ; Fri, 3 Dec 2021 16:09:21 +0100 (CET) Received: by mail-wm1-f45.google.com with SMTP id i8-20020a7bc948000000b0030db7b70b6bso5119308wml.1 for ; Fri, 03 Dec 2021 07:09:21 -0800 (PST) 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=6wEvfC19sc7JpcidAqc14Ysr3hc1mxueweKjsyXfQsI=; b=wPhpXyyYlgOI57eli3B1oj2A7t94mAfPkjSQ4NMQGQPEdEKzUpNSQ0nzRcPq4WQraz cBs/VAb5HU3QzUqFfFahZ6NiFzHKYJrf1bvWxT+XtWyZ5DHLIbsvjXXzMUf8jtqYylEs dhK8PNJ9GV34nZ+lu8i1TU/hUK6glY2Jt9RePbtY8cvdxErfogmiPrrEkiMJ+2f9i6kR XTx8JSufdvj/aNVioWMBuEBim5d2xSFbDMxjoRpnt4qMBx9hmdb2ZKkkIH9lptCwbc8w cXqroa9PH46dibRAS44EnDyP4o+JvHynG+kmDdrZTzjkSONz5igkMdBCakNzOeGn/VFL UNrg== 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=6wEvfC19sc7JpcidAqc14Ysr3hc1mxueweKjsyXfQsI=; b=XAEhjz/WakzGsaZNZQ8tqkxXVPSn+WWz5sRXE+H68ULpR+SQJ00M0fRe+1Zg3QnFqf TuJtusctfQk9XyrinK85f4s4v6x5UelY7ynk0Bw4WXuzZ7vrOnVAvyfPHZ+llSUelFQB Qdl1QpX3sSp0m6aqR3AJyTxwK81YFbeW5wSyLJ12jZyilq5dKP+2nWF61eDmvoZ4/rzr RUqZ2rhDi0FrkHUw3g/85AZBYxxou2qULayZPYrmqNBHsIdNGhKWITuEOrh+aArk3Oc9 HWGjs8CvVUv2pNks7p26Dr6uOHjapUIDKbaAFtt3cQhLFWkSgBtv4tuTzZUFiUxpnDCT l/1g== X-Gm-Message-State: AOAM533C5dN5H/3I/DVXpIZDEc+m+FZKeZvpYHNXS5o+e3tjcKBgi+sP KJxhzTg89kaem59bEuxT1JnKCcjrTus0Wg== X-Google-Smtp-Source: ABdhPJzT0wxLBpbGx9pOw4DEABLKQ5o6E0zJ60I05TShSVFTrR26VUXPlqnnd0rm4yBdcq/HfmvqNg== X-Received: by 2002:a05:600c:4ed2:: with SMTP id g18mr15796161wmq.25.1638544160679; Fri, 03 Dec 2021 07:09:20 -0800 (PST) Received: from DESKTOP-U5LNN3J.localdomain (89-79-181-52.dynamic.chello.pl. [89.79.181.52]) by smtp.gmail.com with ESMTPSA id h2sm2777232wrz.23.2021.12.03.07.09.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 07:09:20 -0800 (PST) From: Michal Krawczyk To: stable@dpdk.org Cc: christian.ehrhardt@canonical.com, Michal Krawczyk , Igor Chauskin , Shai Brandes Subject: [PATCH 19.11 2/4] net/ena: fix per-queue offload capabilities Date: Fri, 3 Dec 2021 16:08:57 +0100 Message-Id: <20211203150859.3933-2-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211203150859.3933-1-mk@semihalf.com> References: <20211203150859.3933-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit 3a822d79c5da8ed65fd08a8188b9b7d4c35fe199 ] 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 | 91 ++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 29 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index a00d29aa1..5f15d55d4 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -229,6 +229,10 @@ static int ena_queue_start(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 int ena_rss_reta_update(struct rte_eth_dev *dev, @@ -1965,12 +1969,65 @@ 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; + + port_offloads |= DEV_TX_OFFLOAD_MULTI_SEGS; + + 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"); @@ -1989,33 +2046,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 = ETH_RSS_IP | ETH_RSS_TCP | ETH_RSS_UDP; @@ -2028,8 +2063,6 @@ static int ena_infos_get(struct rte_eth_dev *dev, dev_info->max_tx_queues = adapter->num_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->rx_ring_size; dev_info->rx_desc_lim.nb_min = ENA_MIN_RING_DESC; -- 2.25.1