From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 265BAA09E0; Fri, 11 Dec 2020 17:00:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3991DBC88; Fri, 11 Dec 2020 17:00:28 +0100 (CET) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id 9E934AC9B for ; Fri, 11 Dec 2020 17:00:25 +0100 (CET) Received: by mail-pj1-f67.google.com with SMTP id m5so2561522pjv.5 for ; Fri, 11 Dec 2020 08:00:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=c19557RPdNekaFwnL3uYpq/02Ifkvi4F3pEhpjAydyY=; b=PHPWUuKJOchT0HRqkH8z+NqViylTH396uzVhISvvZicbqgIP+QVprNnORJr6TLw0yM 1Zie53ONOsdF7nWNE7ebCV6hYjviEtX13aec6bD6EtIKkIyjxbbRSsKIUWFiXYMPA7jL vKXpx/dkBjS1dSjwyf5OG56Iavm8b8LUQMGAQ8iWvpAfjMjVDIXvb6o9VcfLQksKwAaY bKPyvEtoj09zsQO1RAf/hsz3FJegusOfKTljZXEIatQDFpK/K4YI/6Z2n6YhclxaMugz avwq3x1ywThNh3yWcRREj70uWRzvb98OE46BTKKn9/JW2BOaDCP1NK86aXGXmyMMaN5u XTCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=c19557RPdNekaFwnL3uYpq/02Ifkvi4F3pEhpjAydyY=; b=gtkNpvsqatJfqdpR5xPxtEB0/mky7aiRmHDo/wz6+UrDcdKqkNDGMHTx43+l1sPLFg fTl/tfRbayVv5K87iX/g7X6e8J28fK6US/eX8SaSkjZKtpDiONNCh1sQn3Ibp28SkXni NXVz+CdwnaQ/c276BEP4yzC+W/ZwjMgSj9cp/1sirluunPyNz+kBZrLHQUMxy+K4vTQw sXCnR6FH+BX6njIMDZ0ep+XSbfC1aG9Iq5NiLmCm5aAeUDkTE/c5PyaHkWkbNA60+5GA H49dp3I+uS4fScRk5JFkgR8ZsIv+zXQgq0uFnsYSQFxJprJCTdve3NMxv/sRQaHsg4NL ypDQ== X-Gm-Message-State: AOAM5320Wa9zfSJMdOSXBESpFN8nvGhCNWnoo2/bBQ/EtJ6AprNmKxQz xHRdL7OJfL1FpkI1TMfRHuXBpA== X-Google-Smtp-Source: ABdhPJx6VmIWMm5eR1Y3GivazH+4VdZbvrufGFegC7xWZS7zO6ipoE0WLLgmRYXd5z8Rl1NL1bdQ3w== X-Received: by 2002:a17:90a:bb91:: with SMTP id v17mr13924015pjr.231.1607702423819; Fri, 11 Dec 2020 08:00:23 -0800 (PST) Received: from ?IPv6:2600:1700:6b0:fde0:8480:9ed8:a345:ea98? ([2600:1700:6b0:fde0:8480:9ed8:a345:ea98]) by smtp.gmail.com with ESMTPSA id c184sm10730997pfb.11.2020.12.11.08.00.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Dec 2020 08:00:23 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) From: Andrew Boyer In-Reply-To: <1607699265-5238-1-git-send-email-viacheslavo@nvidia.com> Date: Fri, 11 Dec 2020 11:00:20 -0500 Cc: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com, stable@dpdk.org Content-Transfer-Encoding: quoted-printable Message-Id: <40F5C8DC-8461-43E4-BF37-16FB1D4CA990@pensando.io> References: <1607699265-5238-1-git-send-email-viacheslavo@nvidia.com> To: Viacheslav Ovsiienko X-Mailer: Apple Mail (2.3608.120.23.2.4) Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix segment number check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" > On Dec 11, 2020, at 10:07 AM, Viacheslav Ovsiienko = wrote: >=20 > The --txpkts command line parameter was silently ignored due to > application was unable to check the Tx queue ring sizes for non > configured ports [1]. ... ignored because the application... > The "set txpkts " was also rejected if there > was some stopped or /unconfigured port. ... was a stopped or unconfigured ... >=20 > This provides the following: >=20 > - number of segment check is performed against > configured Tx queues only >=20 > - the capability to send single packet is supposed to > be very basic and always supported, the setting segment > number to 1 is always allowed, no check performed >=20 > - at the moment of Tx queue setup the descriptor number is > checked against configured segment number >=20 > Fixes: 8dae835d88b7 ("app/testpmd: remove restriction on Tx segments = set") > Cc: stable@dpdk.org > Bugzilla ID: 584 >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > app/test-pmd/cmdline.c | 5 +++++ > app/test-pmd/config.c | 21 ++++++++++++++++----- > app/test-pmd/testpmd.c | 7 ++++++- > 3 files changed, 27 insertions(+), 6 deletions(-) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 0d2d6aa..86388a2 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -2798,6 +2798,11 @@ struct cmd_setup_rxtx_queue { > if (!numa_support || socket_id =3D=3D NUMA_NO_CONFIG) > socket_id =3D port->socket_id; >=20 > + if (port->nb_tx_desc[res->qid] < tx_pkt_nb_segs) { > + printf("Failed to setup TX queue: " setup -> set up I find it helpful when the numbers are logged in the error message. = Like =E2=80=9Cnb_desc 8 < nb_segs 16=E2=80=9D. > + "not enough descriptors\n"); > + return; > + } Why is there a relationship between the number of descriptors and the = number of segments? For our device, there isn=E2=80=99t. We can send 16 = Tx segments per descriptor and (I suppose) you could try to create an 8 = descriptor ring. Maybe this is to protect a simpler device that consumes one descriptor = per segment? If so, the check would ideally be conditioned on a related = device capability flag. I=E2=80=99m not sure if there is such a flag = today. > ret =3D rte_eth_tx_queue_setup(res->portid, > res->qid, > port->nb_tx_desc[res->qid], > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index b51de59..a6fccfa 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -3911,12 +3911,18 @@ struct igb_ring_desc_16_bytes { > for (queue_id =3D 0; queue_id < nb_txq; queue_id++) { > ret =3D get_tx_ring_size(port_id, queue_id, = &ring_size); >=20 > - if (ret) > + /* Do the check only for the active/configured = ports. */ > + if (ret =3D=3D -EINVAL) > + continue; > + if (ret) { > + printf("failed to get ring size for TX " > + "queue(%u) Port(%u) - txpkts = ignored\n", > + port_id, queue_id); > return true; > - > + } > if (ring_size < nb_segs) { > - printf("nb segments per TX packets=3D%u = >=3D " > - "TX queue(%u) ring_size=3D%u - = ignored\n", > + printf("nb segments per TX packets=3D%u = >=3D TX " > + "queue(%u) ring_size=3D%u - = txpkts ignored\n", > nb_segs, queue_id, ring_size); > return true; > } > @@ -3932,7 +3938,12 @@ struct igb_ring_desc_16_bytes { > uint16_t tx_pkt_len; > unsigned int i; >=20 > - if (nb_segs_is_invalid(nb_segs)) > + /* > + * For single sengment settings failed check is ignored. > + * It is a very basic capability to send the single segment > + * packets, suppose it is always supported. sengment -> segment ... to send single segment... suppose -> assume > + */ > + if (nb_segs > 1 && nb_segs_is_invalid(nb_segs)) > return; >=20 > /* > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 33fc0fd..9ea0145 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -2575,6 +2575,11 @@ struct extmem_param { > port->need_reconfig_queues =3D 0; > /* setup tx queues */ > for (qi =3D 0; qi < nb_txq; qi++) { > + if (port->nb_tx_desc[qi] < = tx_pkt_nb_segs) { > + printf("Failed to setup TX = queue: " > + "not enough = descriptors\n"); Same comments as above > + goto fail; > + } > if ((numa_support) && > (txring_numa[pi] !=3D = NUMA_NO_CONFIG)) > diag =3D = rte_eth_tx_queue_setup(pi, qi, > @@ -2589,7 +2594,7 @@ struct extmem_param { >=20 > if (diag =3D=3D 0) > continue; > - > +fail: > /* Fail to setup tx queue, return */ > if = (rte_atomic16_cmpset(&(port->port_status), > = RTE_PORT_HANDLING, > --=20 > 1.8.3.1 >=20