DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: dev@dpdk.org, rjarry@redhat.com, ruifeng.wang@arm.com,
	honnappa.nagarahalli@arm.com, david.marchand@redhat.com
Subject: Re: [PATCH v2 1/2] fib: implement RCU rule reclamation
Date: Tue, 8 Oct 2024 11:28:02 -0700	[thread overview]
Message-ID: <20241008112802.48bdd858@hermes.local> (raw)
In-Reply-To: <20241008175524.450829-1-vladimir.medvedkin@intel.com>

On Tue,  8 Oct 2024 17:55:23 +0000
Vladimir Medvedkin <vladimir.medvedkin@intel.com> wrote:
> +	if ((tbl8_idx == -ENOSPC) && dp->dq != NULL) {

Better to either drop the parenthesis here, or put it on both conditions.

> +		/* If there are no tbl8 groups try to reclaim one. */
> +		if (rte_rcu_qsbr_dq_reclaim(dp->dq, 1,
> +				NULL, NULL, NULL) == 0)
> +			tbl8_idx = tbl8_get_idx(dp);
> +	}

Could add unlikely() to this expression.

	/* If there are no tbl8 groups try to reclaim one. */
	if (unlikely(tbl8_idx == -ENOSPC && dp->dq &&
		     !rte_rcu_qsbr_dq_reclaim(dp->dq, 1, NULL, NULL, NULL)))
	    tbl8_idx = tbl8_get_idx(dp);


> +static void
> +__rcu_qsbr_free_resource(void *p, void *data, unsigned int n)
> +{
> +	struct dir24_8_tbl *dp = p;
> +	uint64_t tbl8_idx = *(uint64_t *)data;
> +	RTE_SET_USED(n);
> +
> +	tbl8_cleanup_and_free(dp, tbl8_idx);
> +}

My preference (not a requirement) is to use __rte_unused attribute
instead of RTE_SET_USED

> +	if (dp->v == NULL)
> +		tbl8_cleanup_and_free(dp, tbl8_idx);
> +	else if (dp->rcu_mode == RTE_FIB_QSBR_MODE_SYNC) {
> +		rte_rcu_qsbr_synchronize(dp->v,
> +			RTE_QSBR_THRID_INVALID);
> +		tbl8_cleanup_and_free(dp, tbl8_idx);
> +	} else { /* RTE_FIB_QSBR_MODE_DQ */
> +		if (rte_rcu_qsbr_dq_enqueue(dp->dq,
> +				(void *)&tbl8_idx))

Minor nit: cast to void * is not necessary in C (only in C++).
And can fit on one line; max line length now for DPDK is 100 characters.

Overall, looks good.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

  parent reply	other threads:[~2024-10-08 18:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 17:09 [PATCH] " Vladimir Medvedkin
2024-09-27 22:12 ` Robin Jarry
2024-09-27 23:52   ` David Marchand
2024-10-04 12:03     ` Vladimir Medvedkin
2024-10-08 17:55 ` [PATCH v2 1/2] " Vladimir Medvedkin
2024-10-08 17:55   ` [PATCH v2 2/2] test/fib: add RCU functional tests Vladimir Medvedkin
2024-10-08 18:18   ` [PATCH v2 1/2] fib: implement RCU rule reclamation Stephen Hemminger
2024-10-09 19:12     ` Doug Foster
2024-10-08 18:28   ` Stephen Hemminger [this message]
2024-10-10 11:21     ` Medvedkin, Vladimir
2024-10-10 11:27   ` [PATCH v3 " Vladimir Medvedkin
2024-10-10 11:27     ` [PATCH v3 2/2] test/fib: add RCU functional tests Vladimir Medvedkin
2024-10-11  9:10     ` [PATCH v3 1/2] fib: implement RCU rule reclamation David Marchand
2024-10-14 16:58     ` David Marchand
2024-10-14 17:10     ` David Marchand

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=20241008112802.48bdd858@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=rjarry@redhat.com \
    --cc=ruifeng.wang@arm.com \
    --cc=vladimir.medvedkin@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).