DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Igor Romanov <igor.romanov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 5/6] net/sfc/base: add API to get currently operating filters
Date: Mon, 30 Mar 2020 11:25:44 +0100	[thread overview]
Message-ID: <1585563945-9537-6-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1585563945-9537-1-git-send-email-arybchenko@solarflare.com>

From: Igor Romanov <igor.romanov@oktetlabs.ru>

Unknown unicast filter creation may fail because of insufficient
permissions on VF. This failure is handled internally in libefx MAC
reconfiguration without any way for a user to know if it happened.
Making the MAC reconfiguration forward error code of filter
reconfiguration would be too destructive to the existing code
that may rely on the function never returning that error.

Add an API for getting the status of current unknown unicast and
all multicast filters since user must know that requested
filters are actually applied.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_filter.c | 22 ++++++++++++++++++++++
 drivers/net/sfc/base/efx.h         |  6 ++++++
 drivers/net/sfc/base/efx_impl.h    |  2 ++
 drivers/net/sfc/base/efx_mac.c     | 15 +++++++++++++++
 drivers/net/sfc/base/siena_mac.c   |  2 ++
 5 files changed, 47 insertions(+)

diff --git a/drivers/net/sfc/base/ef10_filter.c b/drivers/net/sfc/base/ef10_filter.c
index 0a8744c09e..0dff8397af 100644
--- a/drivers/net/sfc/base/ef10_filter.c
+++ b/drivers/net/sfc/base/ef10_filter.c
@@ -1761,6 +1761,7 @@ ef10_filter_remove_all_existing_filters(
 	__in				efx_nic_t *enp)
 {
 	ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
+	efx_port_t *epp = &(enp->en_port);
 	unsigned int i;
 
 	for (i = 0; i < table->eft_unicst_filter_count; i++) {
@@ -1780,6 +1781,9 @@ ef10_filter_remove_all_existing_filters(
 				table->eft_encap_filter_indexes[i]);
 	}
 	table->eft_encap_filter_count = 0;
+
+	epp->ep_all_unicst_inserted = B_FALSE;
+	epp->ep_all_mulcst_inserted = B_FALSE;
 }
 
 static			void
@@ -1812,6 +1816,7 @@ ef10_filter_insert_renew_unicst_filters(
 	__out				boolean_t *all_unicst_inserted)
 {
 	ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
+	efx_port_t *epp = &(enp->en_port);
 	efx_rc_t rc;
 
 	/*
@@ -1839,6 +1844,7 @@ ef10_filter_insert_renew_unicst_filters(
 						    filter_flags);
 		if (all_unicst_rc == 0) {
 			*all_unicst_inserted = B_TRUE;
+			epp->ep_all_unicst_inserted = B_TRUE;
 		} else if (rc != 0)
 			goto fail1;
 	}
@@ -1865,6 +1871,7 @@ ef10_filter_insert_renew_mulcst_filters(
 {
 	ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
 	efx_nic_cfg_t *encp = &enp->en_nic_cfg;
+	efx_port_t *epp = &(enp->en_port);
 	efx_rc_t rc;
 
 	*all_mulcst_inserted = B_FALSE;
@@ -1880,6 +1887,7 @@ ef10_filter_insert_renew_mulcst_filters(
 		all_mulcst_rc = ef10_filter_insert_all_multicast(enp,
 							    filter_flags);
 		if (all_mulcst_rc == 0) {
+			epp->ep_all_mulcst_inserted = B_TRUE;
 			*all_mulcst_inserted = B_TRUE;
 		} else {
 			rc = ef10_filter_insert_multicast_list(enp, B_TRUE,
@@ -1907,11 +1915,16 @@ ef10_filter_insert_renew_mulcst_filters(
 				 * by packets matching multiple filters.
 				 */
 				ef10_filter_remove_old(enp);
+				if (all_unicst_inserted == B_FALSE)
+					epp->ep_all_unicst_inserted = B_FALSE;
+				if (*all_mulcst_inserted == B_FALSE)
+					epp->ep_all_mulcst_inserted = B_FALSE;
 			}
 
 			rc = ef10_filter_insert_all_multicast(enp,
 							    filter_flags);
 			if (rc == 0) {
+				epp->ep_all_mulcst_inserted = B_TRUE;
 				*all_mulcst_inserted = B_TRUE;
 			} else {
 				rc = ef10_filter_insert_multicast_list(enp,
@@ -1952,6 +1965,7 @@ ef10_filter_reconfigure(
 	__in				uint32_t count)
 {
 	efx_nic_cfg_t *encp = &enp->en_nic_cfg;
+	efx_port_t *epp = &(enp->en_port);
 	ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
 	efx_filter_flags_t filter_flags;
 	unsigned int i;
@@ -2024,6 +2038,10 @@ ef10_filter_reconfigure(
 		 * multicast filters.
 		 */
 		ef10_filter_remove_old(enp);
+		if (all_unicst_inserted == B_FALSE)
+			epp->ep_all_unicst_inserted = B_FALSE;
+
+		epp->ep_all_mulcst_inserted = B_FALSE;
 	}
 
 	/* Insert or renew multicast filters */
@@ -2044,6 +2062,10 @@ ef10_filter_reconfigure(
 
 	/* Remove old filters which were not renewed */
 	ef10_filter_remove_old(enp);
+	if (all_unicst_inserted == B_FALSE)
+		epp->ep_all_unicst_inserted = B_FALSE;
+	if (all_mulcst_inserted == B_FALSE)
+		epp->ep_all_mulcst_inserted = B_FALSE;
 
 	/* report if any optional flags were rejected */
 	if (((all_unicst != B_FALSE) && (all_unicst_inserted == B_FALSE)) ||
diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index d94d3c02f7..86733f9317 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -544,6 +544,12 @@ efx_mac_filter_set(
 	__in				boolean_t all_mulcst,
 	__in				boolean_t brdcst);
 
+extern					void
+efx_mac_filter_get_all_ucast_mcast(
+	__in				efx_nic_t *enp,
+	__out				boolean_t *all_unicst,
+	__out				boolean_t *all_mulcst);
+
 extern	__checkReturn	efx_rc_t
 efx_mac_multicast_list_set(
 	__in				efx_nic_t *enp,
diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h
index 9755f4dfd2..adad7900f6 100644
--- a/drivers/net/sfc/base/efx_impl.h
+++ b/drivers/net/sfc/base/efx_impl.h
@@ -307,8 +307,10 @@ typedef struct efx_port_s {
 	uint8_t			ep_mac_addr[6];
 	efx_link_mode_t		ep_link_mode;
 	boolean_t		ep_all_unicst;
+	boolean_t		ep_all_unicst_inserted;
 	boolean_t		ep_mulcst;
 	boolean_t		ep_all_mulcst;
+	boolean_t		ep_all_mulcst_inserted;
 	boolean_t		ep_brdcst;
 	unsigned int		ep_fcntl;
 	boolean_t		ep_fcntl_autoneg;
diff --git a/drivers/net/sfc/base/efx_mac.c b/drivers/net/sfc/base/efx_mac.c
index 673bc4f4ee..b13321065a 100644
--- a/drivers/net/sfc/base/efx_mac.c
+++ b/drivers/net/sfc/base/efx_mac.c
@@ -218,6 +218,21 @@ efx_mac_filter_set(
 	return (rc);
 }
 
+					void
+efx_mac_filter_get_all_ucast_mcast(
+	__in				efx_nic_t *enp,
+	__out				boolean_t *all_unicst,
+	__out				boolean_t *all_mulcst)
+{
+	efx_port_t *epp = &(enp->en_port);
+
+	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
+
+	*all_unicst = epp->ep_all_unicst_inserted;
+	*all_mulcst = epp->ep_all_mulcst_inserted;
+}
+
 	__checkReturn			efx_rc_t
 efx_mac_drain(
 	__in				efx_nic_t *enp,
diff --git a/drivers/net/sfc/base/siena_mac.c b/drivers/net/sfc/base/siena_mac.c
index 928dfc340a..157d54c38f 100644
--- a/drivers/net/sfc/base/siena_mac.c
+++ b/drivers/net/sfc/base/siena_mac.c
@@ -107,6 +107,7 @@ siena_mac_reconfigure(
 		rc = req.emr_rc;
 		goto fail1;
 	}
+	epp->ep_all_unicst_inserted = epp->ep_all_unicst;
 
 	/* Push multicast hash */
 
@@ -158,6 +159,7 @@ siena_mac_reconfigure(
 		rc = req.emr_rc;
 		goto fail2;
 	}
+	epp->ep_all_mulcst_inserted = epp->ep_all_mulcst;
 
 	return (0);
 
-- 
2.17.1


  parent reply	other threads:[~2020-03-30 10:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 10:25 [dpdk-dev] [PATCH 0/6] net/sfc: improve Rx mode handling on VF Andrew Rybchenko
2020-03-30 10:25 ` [dpdk-dev] [PATCH 1/6] net/sfc/base: refactor filters cleanup in reconfigure Andrew Rybchenko
2020-03-30 10:25 ` [dpdk-dev] [PATCH 2/6] net/sfc/base: refactor filters mark " Andrew Rybchenko
2020-03-30 10:25 ` [dpdk-dev] [PATCH 3/6] net/sfc/base: refactor unicast filters reconfiguration Andrew Rybchenko
2020-03-30 10:25 ` [dpdk-dev] [PATCH 4/6] net/sfc/base: refactor mcast " Andrew Rybchenko
2020-03-30 10:25 ` Andrew Rybchenko [this message]
2020-03-30 10:25 ` [dpdk-dev] [PATCH 6/6] net/sfc: check actual all multicast unknown unicast filters Andrew Rybchenko
2020-04-02  9:37 ` [dpdk-dev] [PATCH 0/6] net/sfc: improve Rx mode handling on VF 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=1585563945-9537-6-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=igor.romanov@oktetlabs.ru \
    /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).