From patchwork Tue Jun 20 22:18:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Ertman X-Patchwork-Id: 13286482 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 86BB519925 for ; Tue, 20 Jun 2023 22:17:28 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76AC71726 for ; Tue, 20 Jun 2023 15:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687299447; x=1718835447; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vESeBwLxL0SNWT43u7650+mQELoTMeMd3PVtJS2osKs=; b=fl4e8/9MHWtXNxRYHcz1Ve54XO/knNeMfm7zAkewmpBahoPkPNw6J7Je 5rZklwnpXue55TnccPTvAC9cUARZUC/g/XmRVTQabr+SjD/EsMXm8Tb4l iMk8Afnk1TEJeBMgKZ3amptLhRcDmoH6leKptUovQ3tohcrgPCae8V63T pZbbrbxOTexlvq4Wv8SNmC+pM9rjVMj0KBQ4cDW+o7sQtum0BLhQ36E+D NU75XliAbL0UGhLXJJbz4hTOMRyY2A9RY9d/NziCgfpexU41+EC4Y/P0c +5RK2bHvOQBINIyUlgoIVZyGh0wuTrPUxevDsbsA13//vDmBRpnhOcMSC w==; X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="358869127" X-IronPort-AV: E=Sophos;i="6.00,258,1681196400"; d="scan'208";a="358869127" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2023 15:17:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="858744956" X-IronPort-AV: E=Sophos;i="6.00,258,1681196400"; d="scan'208";a="858744956" Received: from dmert-dev.jf.intel.com ([10.166.241.14]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2023 15:17:18 -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 v6 07/10] ice: support non-standard teardown of bond interface Date: Tue, 20 Jun 2023 15:18:51 -0700 Message-Id: <20230620221854.848606-8-david.m.ertman@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230620221854.848606-1-david.m.ertman@intel.com> References: <20230620221854.848606-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 Tested-by: Sujai Buvaneswaran --- 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 fa5527aedbe5..ed386c26dbc4 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); } } @@ -1397,6 +1398,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); } /** @@ -1466,8 +1499,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;