From patchwork Wed Jun 5 20:40:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 13687451 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 B222015EFDB for ; Wed, 5 Jun 2024 20:40:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717620048; cv=none; b=VmhK7BQsrh7E/AQQ3EsaDvnaVDS6BbrLukfcxXY9AZU6pVSMsu8fn5A9uqx7/wMCrj0wcMmdcDpXZukVPs/SoGHjD6/29qSp5E44W/Bb11oLaXrW16M73fKynhGLj/8AIgYSN7LEeQMhshDb3x0PX7R3FEqFtRzJq4FaqFMuN0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717620048; c=relaxed/simple; bh=eaAmhLuouq2E/NfXqCshM6878WjbMqTcwMma2+5nw70=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k2z9EhA9ELXNJPVGAg+bZ5fbiBBvRYrZYasBo1WF3nK9b3tzZDcsweTGbSFqvErVv0Rb6Odx7mrsXzslthW4E4ATWUjhdfU9w+xwRZ4VjFuYZKiYx1VTtSUXGWdF80jwG16N45cgiupY9p2jFFW/JOsoSMntxWuFxfiWQPgIE1Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gi6hGDO/; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gi6hGDO/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717620047; x=1749156047; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=eaAmhLuouq2E/NfXqCshM6878WjbMqTcwMma2+5nw70=; b=gi6hGDO/abIVluljM0KJoSrm1uhDFgLF84hd1+LYb2jR1DOyu/U9l25p PoR7GSovVaHrvvCJWYJQi3NutzCqrp4P5LEdNGh68iYAAGG1l85qcgXJd DesYVun8zpZo1A6QNABWEp2YQAJfyZ5NtxrrBJQtVc/Z/e5oEo5oH9xWY 3r8XU1olBHMmL3zPVnF+WLaYPqtdrh+nGfGazshrWEf0VafzcAQXo2Wnw 1tPr+Lc7jpnyEugCzXonBMz1+jD8ud2OKr1FZ8ETQgVRrma4ags1mCtmi tY9MWIUTe08ExgxU8cOfzWfS+fDIdkwwREGMn+VtssRpCz3Tdgw60EeUE Q==; X-CSE-ConnectionGUID: jf4TD4RuQWudNSJkFmQ0HA== X-CSE-MsgGUID: 99nYcQCCQEyFlcdQ96aeXg== X-IronPort-AV: E=McAfee;i="6600,9927,11094"; a="18103039" X-IronPort-AV: E=Sophos;i="6.08,217,1712646000"; d="scan'208";a="18103039" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 13:40:45 -0700 X-CSE-ConnectionGUID: qFOUha40SZGm+lkYjojsXA== X-CSE-MsgGUID: HgOT4iMBSSmUv5cs6+ZMwA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,217,1712646000"; d="scan'208";a="37824310" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.1]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 13:40:45 -0700 From: Jacob Keller Date: Wed, 05 Jun 2024 13:40:42 -0700 Subject: [PATCH v2 2/7] ice: store representor ID in bridge port Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240605-next-2024-06-03-intel-next-batch-v2-2-39c23963fa78@intel.com> References: <20240605-next-2024-06-03-intel-next-batch-v2-0-39c23963fa78@intel.com> In-Reply-To: <20240605-next-2024-06-03-intel-next-batch-v2-0-39c23963fa78@intel.com> To: netdev , David Miller , Jakub Kicinski Cc: Jacob Keller , Michal Swiatkowski , Wojciech Drewek , Sujai Buvaneswaran , Jiri Pirko X-Mailer: b4 0.13.0 X-Patchwork-Delegate: kuba@kernel.org From: Michal Swiatkowski It is used to get representor structure during cleaning. Reviewed-by: Wojciech Drewek Signed-off-by: Michal Swiatkowski Tested-by: Sujai Buvaneswaran Reviewed-by: Jiri Pirko Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ice/ice_eswitch_br.c | 4 +++- drivers/net/ethernet/intel/ice/ice_eswitch_br.h | 1 + drivers/net/ethernet/intel/ice/ice_repr.c | 7 ++----- drivers/net/ethernet/intel/ice/ice_repr.h | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c index ac5beecd028b..f5aceb32bf4d 100644 --- a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c +++ b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c @@ -896,7 +896,8 @@ ice_eswitch_br_port_deinit(struct ice_esw_br *bridge, if (br_port->type == ICE_ESWITCH_BR_UPLINK_PORT && vsi->back) { vsi->back->br_port = NULL; } else { - struct ice_repr *repr = ice_repr_get_by_vsi(vsi); + struct ice_repr *repr = + ice_repr_get(vsi->back, br_port->repr_id); if (repr) repr->br_port = NULL; @@ -937,6 +938,7 @@ ice_eswitch_br_vf_repr_port_init(struct ice_esw_br *bridge, br_port->vsi = repr->src_vsi; br_port->vsi_idx = br_port->vsi->idx; br_port->type = ICE_ESWITCH_BR_VF_REPR_PORT; + br_port->repr_id = repr->id; repr->br_port = br_port; err = xa_insert(&bridge->ports, br_port->vsi_idx, br_port, GFP_KERNEL); diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.h b/drivers/net/ethernet/intel/ice/ice_eswitch_br.h index 85a8fadb2928..c15c7344d7f8 100644 --- a/drivers/net/ethernet/intel/ice/ice_eswitch_br.h +++ b/drivers/net/ethernet/intel/ice/ice_eswitch_br.h @@ -46,6 +46,7 @@ struct ice_esw_br_port { enum ice_esw_br_port_type type; u16 vsi_idx; u16 pvid; + u32 repr_id; struct xarray vlans; }; diff --git a/drivers/net/ethernet/intel/ice/ice_repr.c b/drivers/net/ethernet/intel/ice/ice_repr.c index d367f4c66dcd..fe83f305cc7d 100644 --- a/drivers/net/ethernet/intel/ice/ice_repr.c +++ b/drivers/net/ethernet/intel/ice/ice_repr.c @@ -415,12 +415,9 @@ struct ice_repr *ice_repr_add_vf(struct ice_vf *vf) return ERR_PTR(err); } -struct ice_repr *ice_repr_get_by_vsi(struct ice_vsi *vsi) +struct ice_repr *ice_repr_get(struct ice_pf *pf, u32 id) { - if (!vsi->vf) - return NULL; - - return xa_load(&vsi->back->eswitch.reprs, vsi->vf->repr_id); + return xa_load(&pf->eswitch.reprs, id); } /** diff --git a/drivers/net/ethernet/intel/ice/ice_repr.h b/drivers/net/ethernet/intel/ice/ice_repr.h index cff730b15ca0..07842620d7a2 100644 --- a/drivers/net/ethernet/intel/ice/ice_repr.h +++ b/drivers/net/ethernet/intel/ice/ice_repr.h @@ -40,4 +40,5 @@ struct ice_repr *ice_repr_get_by_vsi(struct ice_vsi *vsi); void ice_repr_inc_tx_stats(struct ice_repr *repr, unsigned int len, int xmit_status); void ice_repr_inc_rx_stats(struct net_device *netdev, unsigned int len); +struct ice_repr *ice_repr_get(struct ice_pf *pf, u32 id); #endif