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 30B52A052A; Tue, 26 Jan 2021 04:22:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A86C21411E1; Tue, 26 Jan 2021 04:22:32 +0100 (CET) Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) by mails.dpdk.org (Postfix) with ESMTP id 1C9201411DE for ; Tue, 26 Jan 2021 04:22:31 +0100 (CET) Received: by mail-ot1-f50.google.com with SMTP id f6so14977487ots.9 for ; Mon, 25 Jan 2021 19:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7Wkdg0YPxOlu92DMSNNd/G1GXzO+XToyXFr+WxZrnOI=; b=Z1VBJM8g9CqKpDb2JFf3c/7xrMyTiDOQcBcmM4hkAb1A7wqLqhncATkRg2QqQrLkY/ VVwSlmCxteCHzntud8VIJBLknFSy5p6/nvLa96FxxMurdo3IgVmkAGL8QIhD38gIplhW TFOnyvQH1nRCsK5VVj5ggNAOlR+KXysAZf5Ec= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7Wkdg0YPxOlu92DMSNNd/G1GXzO+XToyXFr+WxZrnOI=; b=Cuf2fdbNZRGsu6v9h/L0yHjpHbDmIWPG/xE0fT9wBuxpWN4IzgEHmGWFuSprxU2KBn /O6ibmm4Y2eqqf49zWm7YKllKufft6mivKEQR/mtJVEowkRJw0+PqUb1iwWkL1qPyGJF Vw9bk7oGeVaXclPDV64tfd5PVRJoV8CRjNl6A8a/XzkGy/OUqtGx2w5gFphBvuxpvDb3 3QfuBB2eJxDsRklpa2zta6uWGkZoeeGr85aj+vRaovr00ZeOIq7xnh6LVlCPjSFksO5S woLFYJt9h2GWEsKA440hmEg84bZPIm7B8yMdy9TiV9ubq1vX49InuCT11QV6PK0V71Bw FJQA== X-Gm-Message-State: AOAM532ZDO+pwEtp4tZOQYf+5UdxMN7/aGKA75rXdoNz9gzvIOFNewA+ n5PGXpO0ZOhYt/0C5si/U7LEuBvTGBId3Mdn0/gpNg== X-Google-Smtp-Source: ABdhPJyGJ3KLwZiyY9Nj9SagyDJTmc/oAmlyw0RPH1csI0OvVt+6N/bendjDFs4oTwSWVEGEpdyTRlSR7bufWgrxhzQ= X-Received: by 2002:a9d:20a7:: with SMTP id x36mr2602543ota.172.1611631350234; Mon, 25 Jan 2021 19:22:30 -0800 (PST) MIME-Version: 1.0 References: <20210125083202.38267-1-stevex.yang@intel.com> <20210125181548.2713326-1-ferruh.yigit@intel.com> <1efbcf83-8b7f-682c-7494-44cacef55e36@intel.com> In-Reply-To: <1efbcf83-8b7f-682c-7494-44cacef55e36@intel.com> From: Lance Richardson Date: Mon, 25 Jan 2021 22:22:19 -0500 Message-ID: To: Ferruh Yigit Cc: Wenzhuo Lu , Xiaoyun Li , Bernard Iremonger , Steve Yang , dev@dpdk.org, stable@dpdk.org, oulijun@huawei.com, wisamm@mellanox.com, lihuisong@huawei.com Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000286abe05b9c52a28" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] [PATCH v5] app/testpmd: fix setting maximum packet length 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" --000000000000286abe05b9c52a28 Content-Type: text/plain; charset="UTF-8" Acked-by: Lance Richardson Thanks, Lance On Mon, Jan 25, 2021 at 7:44 PM Ferruh Yigit wrote: > > On 1/25/2021 7:41 PM, Lance Richardson wrote: > > On Mon, Jan 25, 2021 at 1:15 PM Ferruh Yigit wrote: > >> > >> From: Steve Yang > >> > >> "port config all max-pkt-len" command fails because it doesn't set the > >> 'DEV_RX_OFFLOAD_JUMBO_FRAME' offload flag properly. > >> > >> Commit in the fixes line moved the 'DEV_RX_OFFLOAD_JUMBO_FRAME' offload > >> flag update from 'cmd_config_max_pkt_len_parsed()' to 'init_config()'. > >> 'init_config()' function is only called during testpmd startup, but the > >> flag status needs to be calculated whenever 'max_rx_pkt_len' changes. > >> > >> The issue can be reproduce as [1], where the 'max-pkt-len' reduced and > >> 'DEV_RX_OFFLOAD_JUMBO_FRAME' offload flag should be cleared but it > >> didn't. > >> > >> Adding the 'update_jumbo_frame_offload()' helper function to update > >> 'DEV_RX_OFFLOAD_JUMBO_FRAME' offload flag and 'max_rx_pkt_len'. This > >> function is called both by 'init_config()' and > >> 'cmd_config_max_pkt_len_parsed()'. > >> > >> Default 'max-pkt-len' value set to zero, 'update_jumbo_frame_offload()' > >> updates it to "RTE_ETHER_MTU + PMD specific Ethernet overhead" when it > >> is zero. > >> If '--max-pkt-len=N' argument provided, it will be used instead. > >> And with each "port config all max-pkt-len" command, the > >> 'DEV_RX_OFFLOAD_JUMBO_FRAME' offload flag, 'max-pkt-len' and MTU is > >> updated. > >> > >> [1] > > > > > > > >> +/* > >> + * Helper function to arrange max_rx_pktlen value and JUMBO_FRAME offload, > >> + * MTU is also aligned if JUMBO_FRAME offload is not set. > >> + * > >> + * port->dev_info should be get before calling this function. > > > > Should this be "port->dev_info should be set ..." instead? > > > > Ack. > > > > > > > > >> + if (rx_offloads != port->dev_conf.rxmode.offloads) { > >> + uint16_t qid; > >> + > >> + port->dev_conf.rxmode.offloads = rx_offloads; > >> + > >> + /* Apply JUMBO_FRAME offload configuration to Rx queue(s) */ > >> + for (qid = 0; qid < port->dev_info.nb_rx_queues; qid++) { > >> + if (on) > >> + port->rx_conf[qid].offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; > >> + else > >> + port->rx_conf[qid].offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; > >> + } > > > > Is it correct to set per-queue offloads that aren't advertised by the PMD > > as supported in rx_queue_offload_capa? > > > > 'port->rx_conf[]' is testpmd struct, and 'port->dev_conf.rxmode.offloads' values > are reflected to 'port->rx_conf[].offloads' for all queues. > > We should set the offload in 'port->rx_conf[].offloads' if it is set in > 'port->dev_conf.rxmode.offloads'. > > If a port has capability for 'JUMBO_FRAME', 'port->rx_conf[].offloads' can have > it. And the port level capability is already checked above. > > >> + } > >> + > >> + /* If JUMBO_FRAME is set MTU conversion done by ethdev layer, > >> + * if unset do it here > >> + */ > >> + if ((rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) == 0) { > >> + ret = rte_eth_dev_set_mtu(portid, > >> + port->dev_conf.rxmode.max_rx_pkt_len - eth_overhead); > >> + if (ret) > >> + printf("Failed to set MTU to %u for port %u\n", > >> + port->dev_conf.rxmode.max_rx_pkt_len - eth_overhead, > >> + portid); > >> + } > >> + > >> + return 0; > >> +} > >> + > > > > Applied and tested with a few iterations of configuring max packet size > > back and forth between jumbo and non-jumbo sizes, also tried setting > > max packet size using the command-line option, all seems good based > > on rx offloads and packet forwarding. > > > > Two minor questions above, otherwise LGTM. > > > > Thanks for testing. I will wait for more comments before new version. --000000000000286abe05b9c52a28--