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 CC74C43BCF; Fri, 1 Mar 2024 14:51:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 659C9433F2; Fri, 1 Mar 2024 14:51:36 +0100 (CET) Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by mails.dpdk.org (Postfix) with ESMTP id 51E9143368 for ; Fri, 1 Mar 2024 14:51:34 +0100 (CET) Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3bbbc6bcc78so1513168b6e.1 for ; Fri, 01 Mar 2024 05:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709301093; x=1709905893; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZE/M+E1+4gbCWcWCUUWNNk4FwxY0cR/YcaoEuUQwDtw=; b=GJ8tTFhXRhpDZEeD1o5CqcEJWLiaeZTql/IdndBmfYUIatwCCliCb9Q8GtN+wbfHGt hFe3GJZwn7pRRVHfuRjDesvCTS6zEMxwxomPgk2uXJv83DSGokppk7INsTJ+Gc4iyYVZ YxaSlKkeZS5pMo9HuS4bSp8b5V/6c5mgD3nJge8vD9elNdu4Q8J/IMr9e+DsNDO6/77x VorEMPaSfZMqN13r0DcGZisnApoz8sg1tmP7FB7YNzY4xGWd1Yqi0k62oDOIfhmW6ygC PaxpTXNYzam4DrXiU+kVt1G84UVAs3riyrxvmif9lcnrWgHnmudnZoa7mCYk/dubo6y4 x/Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709301093; x=1709905893; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZE/M+E1+4gbCWcWCUUWNNk4FwxY0cR/YcaoEuUQwDtw=; b=wcB3NCNdsirps+AtJpww1vumuDtVnheZhEO/jKjIK44y36K4Pr7MbiiRXQoTJvpA5H nnCaoI1KHtXz9xW+xtHU4DnV2FbP3TvU87tNCitTKa0dZGxEbG47Jcg5Ip0ovNjgzI/6 A7rMbaIc+LX6dA1uKdMvd9qWy5wnuafbny8piiEVJLd5T4gnuyPeTd3b0PWTwf8oFDQ6 8KGgHWiQp7UUVIkKiTXGjlIJ3s5XZDZQ02a7n+82Rr6Cdp+2dKYb323ccjG3ekBXzt2r s0JBxOZdiiicze2gEHFCw1ew/bwKhpAhd8VxJhQsNOpYp4/7QyODyWh8N3POEt4DgZgt ZPEg== X-Forwarded-Encrypted: i=1; AJvYcCUCm4mXgUBmQSE7lW88Ei2mnBp8qcOXIpzZki34FLjdIiEyHf3fc+tDp/BJx1geOzADvGId9E96554rWic= X-Gm-Message-State: AOJu0YyStDWqkGxHpaPulH8PRbVuSkFaR+DlXciF9F07mwNcHhVOBRwQ zKK4FXYtIyZBmf+4DWCKAT8JYrP225xYi0wDyuZHIFZRjy86jNVqpC8CYFM2zCR7H1WO5GzHdB9 pRyFomd7ukynJYj4nWKnSKwaIaAQwSG3TSC4= X-Google-Smtp-Source: AGHT+IEOufEsavax/Fn0+KRvD2XxQfmpKs43tbGTdYHzUM6pLcJbixyyAniGBjJgqkHOFnEMr+A/BAD7l8YQXvBs4ms= X-Received: by 2002:a05:6808:128b:b0:3c1:d24e:80d2 with SMTP id a11-20020a056808128b00b003c1d24e80d2mr2092840oiw.1.1709301092290; Fri, 01 Mar 2024 05:51:32 -0800 (PST) MIME-Version: 1.0 References: <1709275704-7287-1-git-send-email-skoteshwar@marvell.com> <1709286509-18322-1-git-send-email-skoteshwar@marvell.com> In-Reply-To: <1709286509-18322-1-git-send-email-skoteshwar@marvell.com> From: Jerin Jacob Date: Fri, 1 Mar 2024 19:21:05 +0530 Message-ID: Subject: Re: [PATCH v4] net/cnxk: support Tx queue descriptor count To: skoteshwar@marvell.com Cc: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Fri, Mar 1, 2024 at 3:19=E2=80=AFPM wrote: > > From: Satha Rao > > Added CNXK APIs to get used txq descriptor count. > > Signed-off-by: Satha Rao > --- > > Depends-on: series-30833 ("ethdev: support Tx queue used count") Following build issue clang [1734/2932] Generating drivers/rte_net_ice.sym_chk with a custom command (wrapped by meson to capture output) [1735/2932] Compiling C object drivers/libtmp_rte_net_cnxk.a.p/net_cnxk_cn10k_ethdev_sec.c.o FAILED: drivers/libtmp_rte_net_cnxk.a.p/net_cnxk_cn10k_ethdev_sec.c.o ccache clang -Idrivers/libtmp_rte_net_cnxk.a.p -Idrivers -I../drivers -Idrivers/net/cnxk -I../drivers/net/cnxk -Ilib/ethdev -I../lib/ethdev -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/cryptodev -I../lib/cryptodev -Ilib/rcu -I../lib/rcu -Ilib/eventdev -I../lib/eventdev -Ilib/hash -I../lib/hash -Ilib/timer -I../lib/timer -Ilib/dmadev -I../lib/dmadev -Ilib/security -I../lib/security -Idrivers/common/cnxk -I../drivers/common/cnxk -Idrivers/mempool/cnxk -I../drivers/mempool/cnxk -fdiagnostics-color=3Dalways -D_FILE_OFFSET_BITS=3D64 -Wall -Winvalid-pch -Wextra -Werror -std=3Dc11 -O2 -g -include rte_config.h -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-missing-field-initializers -D_GNU_SOURCE -fPIC -march=3Dnative -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -flax-vector-conversions -Wno-strict-aliasing -Wno-asm-operand-widths -DRTE_LOG_DEFAULT_LOGTYPE=3Dpmd.net.cnxk -MD -MQ drivers/libtmp_rte_net_cnxk.a.p/net_cnxk_cn10k_ethdev_sec.c.o -MF drivers/libtmp_rte_net_cnxk.a.p/net_cnxk_cn10k_ethdev_sec.c.o.d -o drivers/libtmp_rte_net_cnxk.a.p/net_cnxk_cn10k_ethdev_sec.c.o -c ../drivers/net/cnxk/cn10k_ethdev_sec.c In file included from ../drivers/net/cnxk/cn10k_ethdev_sec.c:11: In file included from ../drivers/net/cnxk/cn10k_ethdev.h:7: ../drivers/net/cnxk/cnxk_ethdev.h:469:33: error: used type '_Atomic(uint64_t *)' where arithmetic or pointer type is required val =3D rte_atomic_load_explicit((RTE_ATOMIC(uint64_t *))mem, rte_memory_order_relaxed); ^ ~~~ ../lib/eal/include/rte_stdatomic.h:73:23: note: expanded from macro 'rte_atomic_load_explicit' atomic_load_explicit(ptr, memorder) ^~~ In file included from ../drivers/net/cnxk/cn10k_ethdev_sec.c:11: In file included from ../drivers/net/cnxk/cn10k_ethdev.h:7: ../drivers/net/cnxk/cnxk_ethdev.h:480:36: error: used type '_Atomic(uint64_t *)' where arithmetic or pointer type is required sq_cnt =3D rte_atomic_load_explicit((RTE_ATOMIC(uint64_t *))mem, rte_memory_order_relaxed); ^ ~~~ ../lib/eal/include/rte_stdatomic.h:73:23: note: expanded from macro 'rte_atomic_load_explicit' atomic_load_explicit(ptr, memorder) ^~~ In file included from ../drivers/net/cnxk/cn10k_ethdev_sec.c:11: In file included from ../drivers/net/cnxk/cn10k_ethdev.h:7: ../drivers/net/cnxk/cnxk_ethdev.h:482:37: error: used type '_Atomic(uint64_t *)' where arithmetic or pointer type is required sec_cnt =3D rte_atomic_load_explicit((RTE_ATOMIC(uint64_t *))sec_fc= , ^ ~~~~~~ ../lib/eal/include/rte_stdatomic.h:73:23: note: expanded from macro 'rte_atomic_load_explicit' atomic_load_explicit(ptr, memorder) [for-main]dell[dpdk-next-net-mrvl] $ clang -v clang version 16.0.6 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/1= 3.2.1 Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1 Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 > > v2: > Updated release notes and fixed API for CPT queues. > v3: > Addressed review comments > > doc/guides/nics/features/cnxk.ini | 1 + > doc/guides/rel_notes/release_24_03.rst | 1 + > drivers/net/cnxk/cn10k_tx_select.c | 22 ++++++++++++++++++++++ > drivers/net/cnxk/cn9k_tx_select.c | 23 +++++++++++++++++++++++ > drivers/net/cnxk/cnxk_ethdev.h | 25 +++++++++++++++++++++++++ > 5 files changed, 72 insertions(+) > > diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features= /cnxk.ini > index 94e7a6a..ab18f38 100644 > --- a/doc/guides/nics/features/cnxk.ini > +++ b/doc/guides/nics/features/cnxk.ini > @@ -40,6 +40,7 @@ Timesync =3D Y > Timestamp offload =3D Y > Rx descriptor status =3D Y > Tx descriptor status =3D Y > +Tx queue count =3D Y > Basic stats =3D Y > Stats per queue =3D Y > Extended stats =3D Y > diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_note= s/release_24_03.rst > index 8d440d5..1f85cda 100644 > --- a/doc/guides/rel_notes/release_24_03.rst > +++ b/doc/guides/rel_notes/release_24_03.rst > @@ -111,6 +111,7 @@ New Features > * Added support for ``RTE_FLOW_ITEM_TYPE_PPPOES`` flow item. > * Added support for ``RTE_FLOW_ACTION_TYPE_SAMPLE`` flow item. > * Added support for Rx inject. > + * Added support for ``rte_eth_tx_queue_count``. > > * **Updated Marvell OCTEON EP driver.** > > diff --git a/drivers/net/cnxk/cn10k_tx_select.c b/drivers/net/cnxk/cn10k_= tx_select.c > index 404f5ba..aa0620e 100644 > --- a/drivers/net/cnxk/cn10k_tx_select.c > +++ b/drivers/net/cnxk/cn10k_tx_select.c > @@ -20,6 +20,24 @@ > eth_dev->tx_pkt_burst; > } > > +#if defined(RTE_ARCH_ARM64) > +static int > +cn10k_nix_tx_queue_count(void *tx_queue) > +{ > + struct cn10k_eth_txq *txq =3D (struct cn10k_eth_txq *)tx_queue; > + > + return cnxk_nix_tx_queue_count(txq->fc_mem, txq->sqes_per_sqb_log= 2); > +} > + > +static int > +cn10k_nix_tx_queue_sec_count(void *tx_queue) > +{ > + struct cn10k_eth_txq *txq =3D (struct cn10k_eth_txq *)tx_queue; > + > + return cnxk_nix_tx_queue_sec_count(txq->fc_mem, txq->sqes_per_sqb= _log2, txq->cpt_fc); > +} > +#endif > + > void > cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev) > { > @@ -63,6 +81,10 @@ > if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) > pick_tx_func(eth_dev, nix_eth_tx_vec_burst_mseg); > } > + if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY) > + eth_dev->tx_queue_count =3D cn10k_nix_tx_queue_sec_count; > + else > + eth_dev->tx_queue_count =3D cn10k_nix_tx_queue_count; > > rte_mb(); > #else > diff --git a/drivers/net/cnxk/cn9k_tx_select.c b/drivers/net/cnxk/cn9k_tx= _select.c > index e08883f..5ecf919 100644 > --- a/drivers/net/cnxk/cn9k_tx_select.c > +++ b/drivers/net/cnxk/cn9k_tx_select.c > @@ -20,6 +20,24 @@ > eth_dev->tx_pkt_burst; > } > > +#if defined(RTE_ARCH_ARM64) > +static int > +cn9k_nix_tx_queue_count(void *tx_queue) > +{ > + struct cn9k_eth_txq *txq =3D (struct cn9k_eth_txq *)tx_queue; > + > + return cnxk_nix_tx_queue_count(txq->fc_mem, txq->sqes_per_sqb_log= 2); > +} > + > +static int > +cn9k_nix_tx_queue_sec_count(void *tx_queue) > +{ > + struct cn9k_eth_txq *txq =3D (struct cn9k_eth_txq *)tx_queue; > + > + return cnxk_nix_tx_queue_sec_count(txq->fc_mem, txq->sqes_per_sqb= _log2, txq->cpt_fc); > +} > +#endif > + > void > cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev) > { > @@ -59,6 +77,11 @@ > if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) > pick_tx_func(eth_dev, nix_eth_tx_vec_burst_mseg); > } > + if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY) > + eth_dev->tx_queue_count =3D cn9k_nix_tx_queue_sec_count; > + else > + eth_dev->tx_queue_count =3D cn9k_nix_tx_queue_count; > + > > rte_mb(); > #else > diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethde= v.h > index 80a9dc8..a5670a0 100644 > --- a/drivers/net/cnxk/cnxk_ethdev.h > +++ b/drivers/net/cnxk/cnxk_ethdev.h > @@ -461,6 +461,31 @@ struct cnxk_eth_txq_sp { > return ((struct cnxk_eth_txq_sp *)__txq) - 1; > } > > +static inline int > +cnxk_nix_tx_queue_count(uint64_t *mem, uint16_t sqes_per_sqb_log2) > +{ > + uint64_t val; > + > + val =3D rte_atomic_load_explicit((RTE_ATOMIC(uint64_t *))mem, rte= _memory_order_relaxed); > + val =3D (val << sqes_per_sqb_log2) - val; > + > + return (val & 0xFFFF); > +} > + > +static inline int > +cnxk_nix_tx_queue_sec_count(uint64_t *mem, uint16_t sqes_per_sqb_log2, u= int64_t *sec_fc) > +{ > + uint64_t sq_cnt, sec_cnt, val; > + > + sq_cnt =3D rte_atomic_load_explicit((RTE_ATOMIC(uint64_t *))mem, = rte_memory_order_relaxed); > + sq_cnt =3D (sq_cnt << sqes_per_sqb_log2) - sq_cnt; > + sec_cnt =3D rte_atomic_load_explicit((RTE_ATOMIC(uint64_t *))sec_= fc, > + rte_memory_order_relaxed); > + val =3D RTE_MAX(sq_cnt, sec_cnt); > + > + return (val & 0xFFFF); > +} > + > /* Common ethdev ops */ > extern struct eth_dev_ops cnxk_eth_dev_ops; > > -- > 1.8.3.1 >