netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Ertman <david.m.ertman@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org
Subject: [PATCH net v2 07/10] ice: support non-standard teardown of bond interface
Date: Mon,  5 Jun 2023 11:22:55 -0700	[thread overview]
Message-ID: <20230605182258.557933-8-david.m.ertman@intel.com> (raw)
In-Reply-To: <20230605182258.557933-1-david.m.ertman@intel.com>

Code for supporting removal of the PF driver (NETDEV_UNREGISTER) events for
both when the bond has the primary interface as active and when failed over
to thew secondary interface.

Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lag.c | 47 ++++++++++++++++++++----
 1 file changed, 40 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
index e46234ad836d..665faa9bf3eb 100644
--- a/drivers/net/ethernet/intel/ice/ice_lag.c
+++ b/drivers/net/ethernet/intel/ice/ice_lag.c
@@ -1226,15 +1226,16 @@ static void ice_lag_changeupper_event(struct ice_lag *lag, void *ptr)
 		if (!primary_lag && lag->primary)
 			primary_lag = lag;
 
-		if (primary_lag) {
-			if (!lag->primary) {
-				ice_lag_set_swid(0, lag, false);
-			} else {
+		if (!lag->primary) {
+			ice_lag_set_swid(0, lag, false);
+		} else {
+			if (primary_lag && lag->primary) {
 				ice_lag_primary_swid(lag, false);
 				ice_lag_del_prune_list(primary_lag, lag->pf);
 			}
-			ice_lag_cfg_cp_fltr(lag, false);
 		}
+		/* remove filter for control packets */
+		ice_lag_cfg_cp_fltr(lag, false);
 	}
 }
 
@@ -1442,6 +1443,38 @@ ice_lag_chk_comp(struct ice_lag *lag, void *ptr)
 static void
 ice_lag_unregister(struct ice_lag *lag, struct net_device *event_netdev)
 {
+	struct ice_netdev_priv *np;
+	struct ice_pf *event_pf;
+	struct ice_lag *p_lag;
+
+	p_lag = ice_lag_find_primary(lag);
+	np = netdev_priv(event_netdev);
+	event_pf = np->vsi->back;
+
+	if (p_lag) {
+		if (p_lag->active_port != p_lag->pf->hw.port_info->lport &&
+		    p_lag->active_port != ICE_LAG_INVALID_PORT) {
+			struct ice_hw *active_hw;
+
+			active_hw = ice_lag_find_hw_by_lport(lag,
+							     p_lag->active_port);
+			if (active_hw)
+				ice_lag_reclaim_vf_nodes(p_lag, active_hw);
+			lag->active_port = ICE_LAG_INVALID_PORT;
+		}
+	}
+
+	/* primary processing for primary */
+	if (lag->primary && lag->netdev == event_netdev)
+		ice_lag_primary_swid(lag, false);
+
+	/* primary processing for secondary */
+	if (lag->primary && lag->netdev != event_netdev)
+		ice_lag_del_prune_list(lag, event_pf);
+
+	/* secondary processing for secondary */
+	if (!lag->primary && lag->netdev == event_netdev)
+		ice_lag_set_swid(0, lag, false);
 }
 
 /**
@@ -1487,8 +1520,8 @@ static void ice_lag_process_event(struct work_struct *work)
 	case NETDEV_UNREGISTER:
 		if (ice_is_feature_supported(pf, ICE_F_SRIOV_LAG)) {
 			netdev = lag_work->info.bonding_info.info.dev;
-			if (netdev == lag_work->lag->netdev &&
-			    lag_work->lag->bonded)
+			if ((netdev == lag_work->lag->netdev ||
+			     lag_work->lag->primary) && lag_work->lag->bonded)
 				ice_lag_unregister(lag_work->lag, netdev);
 		}
 		break;
-- 
2.40.1


  parent reply	other threads:[~2023-06-05 18:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 18:22 [PATCH net v2 00/10] Implement support for SRIOV + LAG Dave Ertman
2023-06-05 18:22 ` [PATCH net v2 01/10] ice: Correctly initialize queue context values Dave Ertman
2023-06-06  9:03   ` Daniel Machon
2023-06-06 16:31     ` Ertman, David M
2023-06-05 18:22 ` [PATCH net v2 02/10] ice: Add driver support for firmware changes for LAG Dave Ertman
2023-06-06  9:16   ` Daniel Machon
2023-06-06 16:59     ` Ertman, David M
2023-06-05 18:22 ` [PATCH net v2 03/10] ice: changes to the interface with the HW and FW for SRIOV_VF+LAG Dave Ertman
2023-06-06  9:36   ` Daniel Machon
2023-06-06 18:11     ` Ertman, David M
2023-06-05 18:22 ` [PATCH net v2 04/10] ice: implement lag netdev event handler Dave Ertman
2023-06-06  9:56   ` Daniel Machon
2023-06-06 18:23     ` Ertman, David M
2023-06-07  7:22       ` Daniel Machon
2023-06-05 18:22 ` [PATCH net v2 05/10] ice: process events created by " Dave Ertman
2023-06-06 10:54   ` Daniel Machon
2023-06-06 18:26     ` Ertman, David M
2023-06-05 18:22 ` [PATCH net v2 06/10] ice: Flesh out implementation of support for SRIOV on bonded interface Dave Ertman
2023-06-07  8:42   ` Daniel Machon
2023-06-08  1:08     ` Ertman, David M
2023-06-05 18:22 ` Dave Ertman [this message]
2023-06-07  8:48   ` [PATCH net v2 07/10] ice: support non-standard teardown of bond interface Daniel Machon
2023-06-05 18:22 ` [PATCH net v2 08/10] ice: enforce interface eligibility and add messaging for SRIOV LAG Dave Ertman
2023-06-07  8:54   ` Daniel Machon
2023-06-05 18:22 ` [PATCH net v2 09/10] ice: enforce no DCB config changing when in bond Dave Ertman
2023-06-07  9:01   ` Daniel Machon
2023-06-05 18:22 ` [PATCH net v2 10/10] ice: update reset path for SRIOV LAG support Dave Ertman
2023-06-07 10:08   ` Daniel Machon
2023-06-08 17:24     ` Ertman, David M
2023-06-05 19:12 ` [PATCH net v2 00/10] Implement support for SRIOV + LAG Ertman, David M
2023-06-05 20:27   ` Jakub Kicinski

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=20230605182258.557933-8-david.m.ertman@intel.com \
    --to=david.m.ertman@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=netdev@vger.kernel.org \
    /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).