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 22BC1A0C43; Tue, 16 Nov 2021 10:14:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 06F8141143; Tue, 16 Nov 2021 10:14:53 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 8786040040 for ; Tue, 16 Nov 2021 10:14:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637054092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/KEemk32zi7l3T8+Y/HuoRpS7GwxFuIQu2GIC7mZnY8=; b=JDY5hWrBV9kxMbgt1kfHnSt5nMAC5GWopIoxooUm9R2nrXh0kWr8/ZcRNn58/HWezs5eq4 h1EWcvwAr6tTGQ3yBlGiDu5ezmTdHlOZ4iLW0mi+0LHw3PEyHajcRlhv/K1scFClZdoP3g ee6ziCE2JudJx5N8XEHbSy+2MuIAmL0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-492-19wZZyUOOO-q3bRkjcsbog-1; Tue, 16 Nov 2021 04:14:48 -0500 X-MC-Unique: 19wZZyUOOO-q3bRkjcsbog-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D8A9D102CB29; Tue, 16 Nov 2021 09:14:47 +0000 (UTC) Received: from [10.39.208.9] (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38E605D9DE; Tue, 16 Nov 2021 09:14:47 +0000 (UTC) Message-ID: <71299887-865b-f165-1d9c-1dd25578716c@redhat.com> Date: Tue, 16 Nov 2021 10:14:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH] examples/vhost: fix port init failure in mergeable mode To: Chenbo Xia , dev@dpdk.org References: <20211104051102.7155-1-chenbo.xia@intel.com> From: Maxime Coquelin In-Reply-To: <20211104051102.7155-1-chenbo.xia@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 On 11/4/21 06:11, Chenbo Xia wrote: > When the example starts in mergeable mode with an i40e port, > it fails to launch because the examples use default mtu MAX_MTU > to configure ethdev. The root cause is some devices have Ethernet > frame overhead and then MAX_MTU will be larger than device's max > mtu, so the ethdev configure will fail. > > This patch checks the device's max mtu before setting the ethdev > configuration. If the device has a max mtu, use that value to > configure. > > Fixes: 1bb4a528c41f ("ethdev: fix max Rx packet length") > > Signed-off-by: Chenbo Xia > Reported-by: Xingguang He > --- > examples/vhost/main.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/examples/vhost/main.c b/examples/vhost/main.c > index 58e12aa710..09fb2382bf 100644 > --- a/examples/vhost/main.c > +++ b/examples/vhost/main.c > @@ -273,6 +273,13 @@ port_init(uint16_t port) > > tx_rings = (uint16_t)rte_lcore_count(); > > + if (mergeable) { > + if (dev_info.max_mtu != UINT16_MAX && dev_info.max_rx_pktlen > dev_info.max_mtu) > + vmdq_conf_default.rxmode.mtu = dev_info.max_mtu; > + else > + vmdq_conf_default.rxmode.mtu = MAX_MTU; > + } > + > /* Get port configuration. */ > retval = get_eth_conf(&port_conf, num_devices); > if (retval < 0) > @@ -631,8 +638,6 @@ us_vhost_parse_args(int argc, char **argv) > return -1; > } > mergeable = !!ret; > - if (ret) > - vmdq_conf_default.rxmode.mtu = MAX_MTU; > break; > > case OPT_STATS_NUM: > Reviewed-by: Maxime Coquelin Thanks, Maxime