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 79336A0555 for ; Thu, 9 Jun 2022 13:38:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 731B840220; Thu, 9 Jun 2022 13:38:50 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 24E0F4069C for ; Thu, 9 Jun 2022 13:38:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654774728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sTYM/wXDNwExL9Ew7Uw8R6EpTquQw3h4ZO+vduMCd1c=; b=B1svrzIqLrJUpvsSjnojY3MoyZntJHPCVIcAdAb/mGtaqpSnPq3WWO73BxbmewjW8xVxZd nMy91Kqsl3xLGkc5uTkxD4KcLtGu4dLVm4UY24XQwXPZgbbVOJSdV2U/MpBThHk6jpiSWf rLI5Eag6yN3azDOh9uiuFbFMRaDe0G4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-499-HhWC1XMaM4m82QyhJoniMQ-1; Thu, 09 Jun 2022 07:38:45 -0400 X-MC-Unique: HhWC1XMaM4m82QyhJoniMQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76454801E67; Thu, 9 Jun 2022 11:38:45 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.195.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE1EA18EA4; Thu, 9 Jun 2022 11:38:44 +0000 (UTC) From: Kevin Traynor To: Huisong Li Cc: dpdk stable Subject: patch 'examples/dma: fix MTU configuration' has been queued to stable release 21.11.2 Date: Thu, 9 Jun 2022 12:36:57 +0100 Message-Id: <20220609113701.386938-70-ktraynor@redhat.com> In-Reply-To: <20220609113701.386938-1-ktraynor@redhat.com> References: <20220609113701.386938-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/13/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/d6c4c6477678456f878fa6b1d5aa69de60362f82 Thanks. Kevin --- >From d6c4c6477678456f878fa6b1d5aa69de60362f82 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Sun, 24 Apr 2022 14:07:39 +0800 Subject: [PATCH] examples/dma: fix MTU configuration [ upstream commit e0e95de2be21f05b0a7beb0e63ef969337b60a40 ] The MTU in dma App can be configured by 'max_frame_size' parameters which have a default value(1518). It's not reasonable to use it directly as MTU. This patch fix it. Fixes: 1bb4a528c41f ("ethdev: fix max Rx packet length") Signed-off-by: Huisong Li --- examples/dma/dmafwd.c | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c index 608487e35c..a03ca05129 100644 --- a/examples/dma/dmafwd.c +++ b/examples/dma/dmafwd.c @@ -118,5 +118,5 @@ static volatile bool force_quit; static uint32_t dma_batch_sz = MAX_PKT_BURST; -static uint32_t max_frame_size = RTE_ETHER_MAX_LEN; +static uint32_t max_frame_size; /* ethernet addresses of ports */ @@ -852,4 +852,36 @@ assign_rings(void) /* >8 End of assigning ring structures for packet exchanging. */ +static uint32_t +eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu) +{ + uint32_t overhead_len; + + if (max_mtu != UINT16_MAX && max_rx_pktlen > max_mtu) + overhead_len = max_rx_pktlen - max_mtu; + else + overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; + + return overhead_len; +} + +static int +config_port_max_pkt_len(struct rte_eth_conf *conf, + struct rte_eth_dev_info *dev_info) +{ + uint32_t overhead_len; + + if (max_frame_size == 0) + return 0; + + if (max_frame_size < RTE_ETHER_MIN_LEN) + return -1; + + overhead_len = eth_dev_get_overhead_len(dev_info->max_rx_pktlen, + dev_info->max_mtu); + conf->rxmode.mtu = max_frame_size - overhead_len; + + return 0; +} + /* * Initializes a given port using global settings and with the RX buffers @@ -879,7 +911,4 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues) int ret, i; - if (max_frame_size > local_port_conf.rxmode.mtu) - local_port_conf.rxmode.mtu = max_frame_size; - /* Skip ports that are not enabled */ if ((dma_enabled_port_mask & (1 << portid)) == 0) { @@ -896,4 +925,10 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues) rte_strerror(-ret), portid); + ret = config_port_max_pkt_len(&local_port_conf, &dev_info); + if (ret != 0) + rte_exit(EXIT_FAILURE, + "Invalid max frame size: %u (port %u)\n", + max_frame_size, portid); + local_port_conf.rx_adv_conf.rss_conf.rss_hf &= dev_info.flow_type_rss_offloads; -- 2.34.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-09 12:34:31.358342128 +0100 +++ 0070-examples-dma-fix-MTU-configuration.patch 2022-06-09 12:34:29.811980753 +0100 @@ -1 +1 @@ -From e0e95de2be21f05b0a7beb0e63ef969337b60a40 Mon Sep 17 00:00:00 2001 +From d6c4c6477678456f878fa6b1d5aa69de60362f82 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e0e95de2be21f05b0a7beb0e63ef969337b60a40 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org