DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Gregory Etelson <getelson@nvidia.com>
Cc: <ferruh.yigit@amd.com>, <aman.deep.singh@intel.com>,
	<david.marchand@redhat.com>, <dev@dpdk.org>,
	<dsosnowski@nvidia.com>, <mkashani@nvidia.com>,
	<thomas@monjalon.net>, <yuying.zhang@intel.com>
Subject: Re: [PATCH v6] testpmd: add hairpin map parameter
Date: Wed, 30 Oct 2024 12:37:35 -0700	[thread overview]
Message-ID: <20241030123735.62156d88@hermes.local> (raw)
In-Reply-To: <20241030073724.103112-1-getelson@nvidia.com>

On Wed, 30 Oct 2024 09:37:24 +0200
Gregory Etelson <getelson@nvidia.com> wrote:

> +static int
> +port_config_hairpin_rxq(portid_t pi, uint16_t peer_tx_port,
> +			queueid_t rxq_head, queueid_t txq_head,
> +			uint16_t qcount, uint32_t manual_bind)
> +{
> +	int diag;
> +	queueid_t i, qi;
> +	uint32_t tx_explicit = !!(hairpin_mode & 0x10);
> +	uint32_t force_mem = !!(hairpin_mode & HAIRPIN_MODE_RX_FORCE_MEMORY);
> +	uint32_t locked_mem = !!(hairpin_mode & HAIRPIN_MODE_RX_LOCKED_MEMORY);
> +	uint32_t rte_mem = !!(hairpin_mode & HAIRPIN_MODE_RX_RTE_MEMORY);
> +	struct rte_port *port = &ports[pi];
> +	struct rte_eth_hairpin_conf hairpin_conf = {
> +		.peer_count = 1,
> +	};
> +
> +	for (qi = rxq_head, i = 0; qi < rxq_head + qcount; qi++) {
> +		hairpin_conf.peers[0].port = peer_tx_port;
> +		hairpin_conf.peers[0].queue = i + txq_head;
> +		hairpin_conf.manual_bind = manual_bind;
> +		hairpin_conf.tx_explicit = tx_explicit;
> +		hairpin_conf.force_memory = force_mem;
> +		hairpin_conf.use_locked_device_memory = locked_mem;
> +		hairpin_conf.use_rte_memory = rte_mem;

Did you consider that most of the hairpin_conf values could just be set directly,
avoiding intermediate variables.


> +		diag = rte_eth_rx_hairpin_queue_setup
> +			(pi, qi, nb_rxd, &hairpin_conf);

Unnecessary line break.

Suggestion:

static int
port_config_hairpin_rxq(portid_t pi, uint16_t peer_tx_port,
			queueid_t rxq_head, queueid_t txq_head,
			uint16_t qcount, uint32_t manual_bind)
{
	int diag;
	queueid_t i, qi;
	struct rte_port *port = &ports[pi];
	struct rte_eth_hairpin_conf hairpin_conf = {
		.peer_count = 1,
		.manual_bind = manual_bind,
		.tx_explicit = !!(hairpin_mode & 0x10),
		.force_memory = !!(hairpin_mode & HAIRPIN_MODE_RX_FORCE_MEMORY),
		.use_locked_device_memory = !!(hairpin_mode & HAIRPIN_MODE_RX_LOCKED_MEMORY),
		.use_rte_memory = !!(hairpin_mode & HAIRPIN_MODE_RX_RTE_MEMORY),
	};

	for (qi = rxq_head, i = 0; qi < rxq_head + qcount; qi++) {
		hairpin_conf.peers[0].port = peer_tx_port;
		hairpin_conf.peers[0].queue = i + txq_head;

		diag = rte_eth_rx_hairpin_queue_setup(pi, qi, nb_rxd, &hairpin_conf);
		i++;
		if (diag == 0)
			continue;

  reply	other threads:[~2024-10-30 19:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19 10:10 [PATCH] testpmd: add hairpin-map parameter Gregory Etelson
2023-09-20 12:22 ` [PATCH v2] " Gregory Etelson
2023-09-28 15:36 ` [PATCH v3] " Gregory Etelson
2023-12-14  8:06   ` Dariusz Sosnowski
2024-03-01 18:54   ` Ferruh Yigit
2024-03-05  3:04     ` Gregory Etelson
2024-09-22  6:50     ` [PATCH v5 1/1] " Gregory Etelson
2024-10-16  8:11       ` Ferruh Yigit
2024-10-28 10:23       ` Gregory Etelson
2024-10-29 21:51       ` Ferruh Yigit
2024-10-29 22:23         ` Stephen Hemminger
2024-10-30  7:37       ` [PATCH v6] testpmd: add hairpin map parameter Gregory Etelson
2024-10-30 19:37         ` Stephen Hemminger [this message]
2024-09-11  5:08   ` [PATCH v4 1/1] testpmd: add hairpin-map parameter Gregory Etelson
2024-09-20 13:48     ` Singh, Aman Deep
2024-09-22  9:33       ` Etelson, Gregory

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=20241030123735.62156d88@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=aman.deep.singh@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=ferruh.yigit@amd.com \
    --cc=getelson@nvidia.com \
    --cc=mkashani@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=yuying.zhang@intel.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).