DPDK patches and discussions
 help / color / mirror / Atom feed
From: Artemii Morozov <artemii.morozov@arknetworks.am>
To: dev@dpdk.org
Cc: Ivan Malov <ivan.malov@arknetworks.am>,
	Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [PATCH v7 2/4] common/sfc_efx/base: add API to get installed filters count
Date: Thu, 22 Jun 2023 19:11:21 +0400	[thread overview]
Message-ID: <20230622151123.275873-3-artemii.morozov@arknetworks.am> (raw)
In-Reply-To: <20230622151123.275873-1-artemii.morozov@arknetworks.am>

This API allows to get number of installed filters. This will
be used in the future patches.

Signed-off-by: Artemii Morozov <artemii.morozov@arknetworks.am>
---
 drivers/common/sfc_efx/base/ef10_filter.c | 20 ++++++++++++++
 drivers/common/sfc_efx/base/ef10_impl.h   |  6 +++++
 drivers/common/sfc_efx/base/efx_filter.c  | 32 +++++++++++++++++++++++
 drivers/common/sfc_efx/base/efx_impl.h    |  7 +++++
 4 files changed, 65 insertions(+)

diff --git a/drivers/common/sfc_efx/base/ef10_filter.c b/drivers/common/sfc_efx/base/ef10_filter.c
index d6940011c0..278502fb61 100644
--- a/drivers/common/sfc_efx/base/ef10_filter.c
+++ b/drivers/common/sfc_efx/base/ef10_filter.c
@@ -2113,6 +2113,26 @@ ef10_filter_reconfigure(
 	return (rc);
 }
 
+	__checkReturn	efx_rc_t
+ef10_filter_get_count(
+	__in	efx_nic_t *enp,
+	__out	uint32_t *count)
+{
+	ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
+	uint32_t filters_count;
+
+	EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp));
+	EFSYS_ASSERT(count != NULL);
+
+	filters_count = table->eft_unicst_filter_count +
+			table->eft_mulcst_filter_count +
+			table->eft_encap_filter_count;
+
+	*count = filters_count;
+
+	return (0);
+}
+
 		void
 ef10_filter_get_default_rxq(
 	__in		efx_nic_t *enp,
diff --git a/drivers/common/sfc_efx/base/ef10_impl.h b/drivers/common/sfc_efx/base/ef10_impl.h
index 877aedad45..914bba10ce 100644
--- a/drivers/common/sfc_efx/base/ef10_impl.h
+++ b/drivers/common/sfc_efx/base/ef10_impl.h
@@ -1347,6 +1347,12 @@ ef10_filter_reconfigure(
 	__in_ecount(6*count)		uint8_t const *addrs,
 	__in				uint32_t count);
 
+LIBEFX_INTERNAL
+extern	__checkReturn	efx_rc_t
+ef10_filter_get_count(
+	__in	efx_nic_t *enp,
+	__out	uint32_t *count);
+
 LIBEFX_INTERNAL
 extern		void
 ef10_filter_get_default_rxq(
diff --git a/drivers/common/sfc_efx/base/efx_filter.c b/drivers/common/sfc_efx/base/efx_filter.c
index 83c37ff859..064630a66b 100644
--- a/drivers/common/sfc_efx/base/efx_filter.c
+++ b/drivers/common/sfc_efx/base/efx_filter.c
@@ -53,6 +53,7 @@ static const efx_filter_ops_t	__efx_filter_siena_ops = {
 	siena_filter_delete,		/* efo_delete */
 	siena_filter_supported_filters,	/* efo_supported_filters */
 	NULL,				/* efo_reconfigure */
+	NULL,				/* efo_get_count */
 };
 #endif /* EFSYS_OPT_SIENA */
 
@@ -65,6 +66,7 @@ static const efx_filter_ops_t	__efx_filter_ef10_ops = {
 	ef10_filter_delete,		/* efo_delete */
 	ef10_filter_supported_filters,	/* efo_supported_filters */
 	ef10_filter_reconfigure,	/* efo_reconfigure */
+	ef10_filter_get_count,		/* efo_get_count */
 };
 #endif /* EFX_OPTS_EF10() */
 
@@ -77,6 +79,7 @@ static const efx_filter_ops_t	__efx_filter_rhead_ops = {
 	ef10_filter_delete,		/* efo_delete */
 	ef10_filter_supported_filters,	/* efo_supported_filters */
 	ef10_filter_reconfigure,	/* efo_reconfigure */
+	ef10_filter_get_count,		/* efo_get_count */
 };
 #endif /* EFSYS_OPT_RIVERHEAD */
 
@@ -309,6 +312,35 @@ efx_filter_reconfigure(
 fail1:
 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
+	return (rc);
+}
+
+	__checkReturn	efx_rc_t
+efx_filter_get_count(
+	__in	efx_nic_t *enp,
+	__out	uint32_t *count)
+{
+	efx_rc_t rc;
+
+	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
+	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_FILTER);
+
+	if (enp->en_efop->efo_get_count == NULL) {
+		rc = ENOTSUP;
+		goto fail1;
+	}
+
+	if ((rc = enp->en_efop->efo_get_count(enp, count)) != 0)
+		goto fail2;
+
+	return (0);
+
+fail2:
+	EFSYS_PROBE(fail2);
+fail1:
+	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
 	return (rc);
 }
 
diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h
index 92a30c34ae..91ba187c73 100644
--- a/drivers/common/sfc_efx/base/efx_impl.h
+++ b/drivers/common/sfc_efx/base/efx_impl.h
@@ -288,6 +288,7 @@ typedef struct efx_filter_ops_s {
 	efx_rc_t	(*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t,
 				   boolean_t, boolean_t, boolean_t,
 				   uint8_t const *, uint32_t);
+	efx_rc_t	(*efo_get_count)(efx_nic_t *, uint32_t *);
 } efx_filter_ops_t;
 
 LIBEFX_INTERNAL
@@ -302,6 +303,12 @@ efx_filter_reconfigure(
 	__in_ecount(6*count)		uint8_t const *addrs,
 	__in				uint32_t count);
 
+LIBEFX_INTERNAL
+extern	__checkReturn	efx_rc_t
+efx_filter_get_count(
+	__in	efx_nic_t *enp,
+	__out	uint32_t *count);
+
 #endif /* EFSYS_OPT_FILTER */
 
 #if EFSYS_OPT_TUNNEL
-- 
2.34.1


  parent reply	other threads:[~2023-06-22 15:11 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 13:41 [PATCH 0/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-05-31 13:41 ` [PATCH 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-01  8:12   ` [PATCH v2 0/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-01  8:12     ` [PATCH v2 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-01 14:35       ` [PATCH v3 0/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-01 14:35         ` [PATCH v3 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-01 14:35         ` [PATCH v3 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-01 14:35         ` [PATCH v3 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-01  8:12     ` [PATCH v2 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-01  8:12     ` [PATCH v2 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-05-31 13:41 ` [PATCH 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-05-31 13:41 ` [PATCH 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-01 15:30 ` [PATCH v4 0/3] " Artemii Morozov
2023-06-01 15:30   ` [PATCH v4 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-02  7:22     ` Andrew Rybchenko
2023-06-01 15:30   ` [PATCH v4 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-02  8:32     ` Andrew Rybchenko
2023-06-08 11:16       ` Artemii Morozov
2023-06-08 12:37         ` Andrew Rybchenko
2023-06-01 15:30   ` [PATCH v4 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-02  8:46     ` Andrew Rybchenko
2023-06-13 15:12 ` [PATCH v5 0/3] " Artemii Morozov
2023-06-13 15:12   ` [PATCH v5 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-19  9:43     ` Andrew Rybchenko
2023-06-13 15:12   ` [PATCH v5 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-19 10:28     ` Andrew Rybchenko
2023-06-20  9:55       ` Artemii Morozov
2023-06-20 11:50         ` Andrew Rybchenko
2023-06-20 13:10           ` Artemii Morozov
2023-06-20 13:53             ` Andrew Rybchenko
2023-06-13 15:12   ` [PATCH v5 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-19 10:36     ` Andrew Rybchenko
2023-06-22 11:31 ` [PATCH v6 0/4] " Artemii Morozov
2023-06-22 11:31   ` [PATCH v6 1/4] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-22 11:46     ` Andrew Rybchenko
2023-06-22 11:31   ` [PATCH v6 2/4] common/sfc_efx/base: add API to get installed filters count Artemii Morozov
2023-06-22 11:51     ` Andrew Rybchenko
2023-06-22 11:31   ` [PATCH v6 3/4] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-22 11:54     ` Andrew Rybchenko
2023-06-22 11:31   ` [PATCH v6 4/4] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-22 12:07     ` Andrew Rybchenko
2023-06-22 15:11 ` [PATCH v7 0/4] " Artemii Morozov
2023-06-22 15:11   ` [PATCH v7 1/4] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-22 15:11   ` Artemii Morozov [this message]
2023-06-22 15:42     ` [PATCH v7 2/4] common/sfc_efx/base: add API to get installed filters count Andrew Rybchenko
2023-06-22 15:11   ` [PATCH v7 3/4] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-22 15:40     ` Andrew Rybchenko
2023-06-22 15:11   ` [PATCH v7 4/4] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-22 15:41     ` Andrew Rybchenko
2023-06-22 16:05     ` Ferruh Yigit
2023-06-23  5:47 ` [PATCH v8 0/4] " Artemii Morozov
2023-06-23  5:47   ` [PATCH v8 1/4] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-23  5:47   ` [PATCH v8 2/4] common/sfc_efx/base: add API to get installed filters count Artemii Morozov
2023-06-23  7:24     ` Ivan Malov
2023-06-23  5:47   ` [PATCH v8 3/4] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-23  5:47   ` [PATCH v8 4/4] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-23 12:35   ` [PATCH v8 0/4] " Ferruh Yigit

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=20230622151123.275873-3-artemii.morozov@arknetworks.am \
    --to=artemii.morozov@arknetworks.am \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ivan.malov@arknetworks.am \
    --cc=viacheslav.galaktionov@arknetworks.am \
    /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).