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 9B1B6A0C43; Wed, 12 May 2021 12:14:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07703410E3; Wed, 12 May 2021 12:14:25 +0200 (CEST) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by mails.dpdk.org (Postfix) with ESMTP id 35E8A410DF for ; Wed, 12 May 2021 12:14:23 +0200 (CEST) Received: by mail-lf1-f41.google.com with SMTP id 2so32934025lft.4 for ; Wed, 12 May 2021 03:14:23 -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 :mime-version:content-transfer-encoding; bh=d9MXBlKdhDkaV4GwG+h1Kj2PlflWwakmPHwuLvMDb50=; b=vv6iuQBrn3cV6jeWyzfBW/GFR5CnY7SNT7/L6mwqlOu6DIGrAiJfZEsLwrHwQkr3Iw EO7TfgYuC78gIlqYM45TmZa8waOcw2auG49VPoqm/Jtmk8lRr2I2QvCM5l9dTflcK5NU T96sZMcuQnZk/5mog4qOz+HOhAkhlsXdTuFfQ7lyfY/lsZ1ALDcIv2w0Fuq9iGIVoCRr IDr8Xv+QA2MiJoYp3IfQD2F5ReoxWjZ0j2/pQWjrA3OWhnGcwTnSPbLQ2wv4j9PXVPX9 sP+a0vQpFcF28oHJBK1SAOysBp45lwU2V/x78OFgia2yYP5A6Rh8+odgq97WeJssOHK4 2BEw== 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:mime-version:content-transfer-encoding; bh=d9MXBlKdhDkaV4GwG+h1Kj2PlflWwakmPHwuLvMDb50=; b=FRjQCegR6cjFsnhDYiCI+CND5yH9MGptp7zrXiLvCiZXz3YE5aG2eiNPy0SPRyESWt thkXnGabk7MRcquXps97VUWrtPlmlMnSuUxhyuRDYta2nGzRlMohy+TVGtBJFgZ3b5vj 2DOMy4BRe5lYd9RI2E9YOY9E1iPki7eGY2NTuWY9bZwAfS6x/jqkcQRTiMXu0ZQzRPx6 jB7R9JkfaevkbqGM+h1z28DqjmtnzsE9vK7ypvGE00ouCFqbP9TRf8eo3ZxJgZYcoM1T RLBumKx86xNrqzC1rGAoZTGm61Zdw5XRis9Lo58rmdjHesOKT/+fJ3VQKSY5boWYM2hp voXg== X-Gm-Message-State: AOAM530aedakcEQUeywbSIcj/O9lUoXTfXfrIlvkSYrgR6JrpToT/zD0 g3lcyERWgqQXXgAsBb7R4CJZjg== X-Google-Smtp-Source: ABdhPJyfZ9utOP/Al10CLsKU2ynOGb7ac8zo1E2L1v3KWTxWMduDiVN4wH8msGJ6hWDAgLt7hdNhNQ== X-Received: by 2002:a05:6512:2344:: with SMTP id p4mr24672077lfu.299.1620814462813; Wed, 12 May 2021 03:14:22 -0700 (PDT) Received: from DESKTOP-U5LNN3J.localdomain (89-79-189-199.dynamic.chello.pl. [89.79.189.199]) by smtp.gmail.com with ESMTPSA id d26sm2892244lfa.118.2021.05.12.03.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 03:14:22 -0700 (PDT) From: Michal Krawczyk To: ferruh.yigit@intel.com Cc: dev@dpdk.org, ndagan@amazon.com, gtzalik@amazon.com, igorch@amazon.com, upstream@semihalf.com, Michal Krawczyk , stable@dpdk.org, Amit Bernstein Date: Wed, 12 May 2021 12:13:44 +0200 Message-Id: <20210512101346.24803-2-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210512101346.24803-1-mk@semihalf.com> References: <20210512101346.24803-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 1/3] net/ena: indicate Rx RSS hash presence 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" To make it possible to the app to determine if the hash was calculated for the packet or not, the PKT_RX_RSS_HASH should be set in the mbuf's ol_flags. As the PMD wasn't setting that, the application couldn't check if there is a hash in a proper way. The hash is valid only if it's UDP or TCP and the IP packet wasn't fragmented. Fixes: e5df9f33db00 ("net/ena: fix passing RSS hash to mbuf") Cc: stable@dpdk.org Signed-off-by: Michal Krawczyk Reviewed-by: Igor Chauskin Reviewed-by: Amit Bernstein --- v5: * Announce Rx RSS hash support in the dev_info->rx_offload_capa. v4: * Add release notes. * Always announce DEV_RX_OFFLOAD_RSS_HASH if RSS is enabled. doc/guides/rel_notes/release_21_05.rst | 1 + drivers/net/ena/ena_ethdev.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index 4e669d3108..0466415112 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -120,6 +120,7 @@ New Features * Updated ena_com (HAL) to the latest version. * Fixed bugs when requesting large LLQ headers using the devargs. * Fixed bug when the default ring size was set. + * Added indication of the RSS hash presence in the mbuf. * **Updated Arkville PMD driver.** diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 54d5e756cb..fb2b19cfdb 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -51,6 +51,8 @@ #define ENA_MIN_RING_DESC 128 +#define ENA_PTYPE_HAS_HASH (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP) + enum ethtool_stringset { ETH_SS_TEST = 0, ETH_SS_STATS, @@ -314,6 +316,11 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, else ol_flags |= PKT_RX_L4_CKSUM_GOOD; + if (likely((packet_type & ENA_PTYPE_HAS_HASH) && !ena_rx_ctx->frag)) { + ol_flags |= PKT_RX_RSS_HASH; + mbuf->hash.rss = ena_rx_ctx->hash; + } + mbuf->ol_flags = ol_flags; mbuf->packet_type = packet_type; } @@ -1954,6 +1961,9 @@ static int ena_dev_configure(struct rte_eth_dev *dev) adapter->state = ENA_ADAPTER_STATE_CONFIG; + if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) + dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH; + adapter->tx_selected_offloads = dev->data->dev_conf.txmode.offloads; adapter->rx_selected_offloads = dev->data->dev_conf.rxmode.offloads; return 0; @@ -2030,6 +2040,7 @@ static int ena_infos_get(struct rte_eth_dev *dev, /* Inform framework about available features */ dev_info->rx_offload_capa = rx_feat; + 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; @@ -2242,8 +2253,6 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, ++rx_ring->rx_stats.bad_csum; } - mbuf->hash.rss = ena_rx_ctx.hash; - rx_pkts[completed] = mbuf; rx_ring->rx_stats.bytes += mbuf->pkt_len; } -- 2.25.1