From patchwork Tue Jun 20 18:34:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ertman, David M" X-Patchwork-Id: 13286351 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 423C21D2D6 for ; Tue, 20 Jun 2023 18:33:20 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 224E6172B for ; Tue, 20 Jun 2023 11:33:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687285997; x=1718821997; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=611SEqBh6n4pVUglZVLn4b1XEOXr8kOnAGyzrcT2ICA=; b=h9sjCxTiakoMSpwlR/ElHrK8uxQOT1eNXKIQ6wXMUw8ZSyRuBuih/gSP nTi2oXwnqEvx4QK9O1B1ujPbnPwOrawc26+y77C32m/pCMhb9J9jI1MUX b7aWR44ikcYsegGlV+Wi6MwNGOPFjbDpFMcnbYCneXADHLf3TCXTVpt+m Ck90Ja1Ih7BzyL6BD2lwb+d1S/kNRMQeQr1O/OXqhv9D1ScHWLBMGZZXB w/iTILPZeG7kB6//tQTmSDmJYZi+3RHnz602mGBUweAEC5fyg2BzLh3vq U9JOdoIsvMBcgwJPfl6TcDvR7JIVgUafmYfJl1r4I0ObSgDVQjybdOKgO Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="425907938" X-IronPort-AV: E=Sophos;i="6.00,257,1681196400"; d="scan'208";a="425907938" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2023 11:32:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="784204419" X-IronPort-AV: E=Sophos;i="6.00,257,1681196400"; d="scan'208";a="784204419" Received: from dmert-dev.jf.intel.com ([10.166.241.14]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2023 11:32:35 -0700 From: Dave Ertman To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, daniel.machon@microchip.com, simon.horman@corigine.com, bcreeley@amd.com Subject: [PATCH iwl-next v5 07/10] ice: support non-standard teardown of bond interface Date: Tue, 20 Jun 2023 11:34:11 -0700 Message-Id: <20230620183414.848016-8-david.m.ertman@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230620183414.848016-1-david.m.ertman@intel.com> References: <20230620183414.848016-1-david.m.ertman@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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. Reviewed-by: Daniel Machon Signed-off-by: Dave Ertman --- 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 c70b2e11b835..6b77a29a54ef 100644 --- a/drivers/net/ethernet/intel/ice/ice_lag.c +++ b/drivers/net/ethernet/intel/ice/ice_lag.c @@ -1186,15 +1186,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); } } @@ -1398,6 +1399,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); } /** @@ -1468,8 +1501,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;