From: Jerin Jacob <jerinjacobk@gmail.com>
To: Pavan Nikhilesh <pbhagavatula@marvell.com>
Cc: Jerin Jacob <jerinj@marvell.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>,
Ankur Dwivedi <adwivedi@marvell.com>,
Anoob Joseph <anoobj@marvell.com>,
Tejasree Kondoj <ktejasree@marvell.com>,
Shijith Thotton <sthotton@marvell.com>, dpdk-dev <dev@dpdk.org>
Subject: Re: [PATCH v3] net/cnxk: avoid command copy from Tx queue
Date: Thu, 10 Feb 2022 15:49:18 +0530 [thread overview]
Message-ID: <CALBAE1Phzr9V1jva+s=kPSj0_X4jO1BCJDrKRzyCVDC2qqPX6A@mail.gmail.com> (raw)
In-Reply-To: <20220210101314.1215-1-pbhagavatula@marvell.com>
On Thu, Feb 10, 2022 at 3:43 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Tx command is prepared based on offloads enabled and stored in
> Tx queue structure at tx_queue_setup phase.
> In fastpath the command is copied from Tx queue to LMT line for
> all the packets.
> Since, the command contents are mostly constants we can move the
> command preparation to fastpath and avoid accessing Tx queue
> memory.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
> v3 Changes:
> - Rebase.
> - Split patches.
> - Refactoring large function.
>
> v2 Changes:
> - Rebase.
> - Fix incorrect use of RoC API
>
> drivers/common/cnxk/roc_io.h | 33 ++++-
> +static void
> +cnxk_sso_tx_queue_data_init(struct cnxk_sso_evdev *dev, uint64_t *txq_data,
> + uint16_t eth_port_id, uint16_t tx_queue_id)
> +{
> + uint64_t offset = 0;
> + int i, j;
> +
> + dev->max_queue_id[0] = RTE_MAX(dev->max_queue_id[0], eth_port_id);
> + for (i = 1; i < eth_port_id; i++) {
> + offset += (dev->max_queue_id[i - 1] + 1);
> + txq_data[i] |= offset << 48;
> + }
> + dev->max_port_id = RTE_MAX(dev->max_port_id, eth_port_id);
> + dev->max_queue_id[eth_port_id] =
> + RTE_MAX(dev->max_queue_id[eth_port_id], tx_queue_id);
> +}
> +
> +static void
> +cnxk_sso_tx_queue_data_rewrite(struct cnxk_sso_evdev *dev, uint64_t *txq_data,
> + uint16_t eth_port_id, uint16_t tx_queue_id,
> + uint64_t *otxq_data, uint16_t max_port_id,
> + uint16_t max_queue_id)
> +{
> + uint64_t offset = 0;
> + int i, j;
> +
> + for (i = 0; i < dev->max_queue_id[0] + 1; i++)
> + txq_data[i] |= (otxq_data[i] & ~((BIT_ULL(16) - 1) << 48));
> +
> + if (eth_port_id > max_port_id) {
> + dev->max_queue_id[0] =
> + RTE_MAX(dev->max_queue_id[0], eth_port_id);
> + dev->max_port_id = RTE_MAX(dev->max_port_id, eth_port_id);
> +
> + for (i = 1; i < eth_port_id; i++) {
> + offset += (dev->max_queue_id[i - 1] + 1);
> + txq_data[i] |= offset << 48;
> + for (j = 0; (i < dev->max_port_id) &&
> + (j < dev->max_queue_id[i] + 1);
> + j++)
> + txq_data[offset + j] =
> + otxq_data[(otxq_data[i] >> 48) + j];
> + }
> + dev->max_queue_id[eth_port_id] =
> + RTE_MAX(dev->max_queue_id[eth_port_id], tx_queue_id);
Could you move this as a separate static function? Too much depth
> + } else if (tx_queue_id > max_queue_id) {
> + dev->max_queue_id[eth_port_id] =
> + RTE_MAX(dev->max_queue_id[eth_port_id], tx_queue_id);
> + dev->max_port_id = RTE_MAX(max_port_id, eth_port_id);
> + for (i = 1; i < max_port_id + 1; i++) {
> + offset += (dev->max_queue_id[i - 1] + 1);
> + txq_data[i] |= offset << 48;
> + for (j = 0; j < dev->max_queue_id[i] + 1; j++) {
> + if (i == eth_port_id && j > max_queue_id)
> + continue;
> + txq_data[offset + j] =
> + otxq_data[(otxq_data[i] >> 48) + j];
> + }
> + }
> + }
> +}
Could you move this as a separate static function? Too much depth
> +
> static int
> cnxk_sso_updt_tx_queue_data(const struct rte_eventdev *event_dev,
> uint16_t eth_port_id, uint16_t tx_queue_id,
> void *txq)
> {
> struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> + uint16_t max_queue_id = dev->max_queue_id[eth_port_id];
> uint16_t max_port_id = dev->max_port_id;
> - uint64_t *txq_data = dev->tx_adptr_data;
> -
> - if (txq_data == NULL || eth_port_id > max_port_id) {
> - max_port_id = RTE_MAX(max_port_id, eth_port_id);
> - txq_data = rte_realloc_socket(
> - txq_data,
> - (sizeof(uint64_t) * (max_port_id + 1) *
> - RTE_MAX_QUEUES_PER_PORT),
> - RTE_CACHE_LINE_SIZE, event_dev->data->socket_id);
> + uint64_t offset = 0, row = 0;
> + uint64_t *txq_data = NULL;
> + size_t size = 0;
> + int i, j;
> +
> + if (((uint64_t)txq) & 0xFFFF000000000000)
> + return -EINVAL;
> +
> + if (dev->tx_adptr_data == NULL) {
> + size = (eth_port_id + 1);
> + size += (eth_port_id + tx_queue_id);
> + row = 2 * eth_port_id;
> + } else {
> + if (eth_port_id > max_port_id) {
> + size = (RTE_MAX(eth_port_id, dev->max_queue_id[0]) + 1);
> + for (i = 1; i < eth_port_id; i++)
> + size += (dev->max_queue_id[i] + 1);
> + row = size;
> + size += (tx_queue_id + 1);
> + } else if (tx_queue_id > max_queue_id) {
> + size = !eth_port_id ? tx_queue_id + 1 :
> + RTE_MAX(max_port_id,
> + dev->max_queue_id[0]) +
> + 1;
See below
> + for (i = 1; i < max_port_id + 1; i++) {
> + if (i == eth_port_id) {
> + row = size;
> + size += tx_queue_id + 1;
> + } else {
> + size += dev->max_queue_id[i] + 1;
> + }
> + }
> + }
> + }
Could you move this as a separate static function? Too much depth
The rest looks good.
next prev parent reply other threads:[~2022-02-10 10:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 7:13 [PATCH v2 1/4] " pbhagavatula
2022-01-19 7:13 ` [PATCH v2 2/4] event/cnxk: store and reuse workslot status pbhagavatula
2022-01-19 7:13 ` [PATCH v2 3/4] event/cnxk: disable default wait time for dequeue pbhagavatula
2022-01-19 7:13 ` [PATCH v2 4/4] net/cnxk: improve Rx performance pbhagavatula
2022-02-07 14:03 ` [PATCH v2 1/4] net/cnxk: avoid command copy from Tx queue Jerin Jacob
2022-02-10 10:13 ` [PATCH v3] " pbhagavatula
2022-02-10 10:19 ` Jerin Jacob [this message]
2022-02-10 13:15 ` [PATCH v4] " pbhagavatula
2022-02-11 10:27 ` Jerin Jacob
2022-02-10 10:19 ` [PATCH v3 1/3] event/cnxk: store and reuse workslot status pbhagavatula
2022-02-10 10:19 ` [PATCH v3 2/3] event/cnxk: disable default wait time for dequeue pbhagavatula
2022-02-10 10:19 ` [PATCH v3 3/3] net/cnxk: improve Rx performance pbhagavatula
2022-02-10 13:20 ` [PATCH v4 1/3] event/cnxk: store and reuse workslot status pbhagavatula
2022-02-10 13:20 ` [PATCH v4 2/3] event/cnxk: disable default wait time for dequeue pbhagavatula
2022-02-10 13:20 ` [PATCH v4 3/3] event/cnxk: improve Rx performance pbhagavatula
2022-02-14 9:29 ` [PATCH v4 1/3] event/cnxk: store and reuse workslot status Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALBAE1Phzr9V1jva+s=kPSj0_X4jO1BCJDrKRzyCVDC2qqPX6A@mail.gmail.com' \
--to=jerinjacobk@gmail.com \
--cc=adwivedi@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ktejasree@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=pbhagavatula@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
--cc=sthotton@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).