From patchwork Fri Jun 21 16:08:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13707808 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 A6E4D15FA77 for ; Fri, 21 Jun 2024 16:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718986110; cv=none; b=Mz1yQnfO5MrT3VzNtXJFV72Ycep7A8m1Qme6hxYMcsIStzG1SvKunhvNPtBm57oUz3CBdZ++m4iHs0RlfJxAZylGBNH0xoKzqbWOvaUVu0hwYDwXL0OvFlogPCZukAK6JV05oT15Fg961ZrYJIFAgd9gAKmQaLKzkBhulRYkvZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718986110; c=relaxed/simple; bh=jkQS3w1J+PHU+PKmLuHy+rzY/m1nnelk8ZAolmFhTrQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r6V6ytKXB3NT8b6H+9LVUMiXG44yl5FziIG4cDpwscPWWaUdQbgfQ3iWrz2lIALmtdtJFrmLp9zqiUJ0FX97pQAJQd0Sq04/eCISc/36dA/x8NtnRRIi5f3ly89Azy2Gy2JVzDeVGlBqzJLQR1Qi37cCfLAHALq4/E6ZJDGReOI= 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=YGzXXVBo; arc=none smtp.client-ip=198.175.65.15 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="YGzXXVBo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718986108; x=1750522108; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jkQS3w1J+PHU+PKmLuHy+rzY/m1nnelk8ZAolmFhTrQ=; b=YGzXXVBoqRSKhSlEfUQXZ5Ror8CaZUr6zDueuWurObKVRlvxuyDyEm5+ CCGqOHA+arKh/6iwsqdL0jVFBGKHAAHNzhAJSR4Z2h0k3NrpuBifBCyJL c7OkDToLLKtE5LJz2yk6ySBW+LcNkujfMOTd/B8oeEQypNtapbjJIBKIK EU60qdHm+eOg78RdFOeTG8/G0/vOxacXE68KbRV3ktwMan2U+OEgWbuhj A8Fp1+XsAI3SLrRNFjMwHuMG0X4ZMev3HlaOJo6vFXwQDvvBN5MlURrLq GYPyHHqoYN9D7QaVJyfRwwcTelUSewHgJWDQlYiWjqmjKs4VWRf1Fzx4u Q==; X-CSE-ConnectionGUID: dPB688QkSqKqXSu70i6bJw== X-CSE-MsgGUID: 9lSC35kBRIiSe0oKb/HsvQ== X-IronPort-AV: E=McAfee;i="6700,10204,11110"; a="19801400" X-IronPort-AV: E=Sophos;i="6.08,255,1712646000"; d="scan'208";a="19801400" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2024 09:08:27 -0700 X-CSE-ConnectionGUID: PpN5mS1JQrazFyPD7Nthvg== X-CSE-MsgGUID: OpUy7L/BQNWqMBlezH9rSA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,255,1712646000"; d="scan'208";a="47149799" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by fmviesa004.fm.intel.com with ESMTP; 21 Jun 2024 09:08:26 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Michal Swiatkowski , anthony.l.nguyen@intel.com, Wojciech Drewek , Simon Horman , Sujai Buvaneswaran Subject: [PATCH net-next 1/4] ice: store representor ID in bridge port Date: Fri, 21 Jun 2024 09:08:14 -0700 Message-ID: <20240621160820.3394806-2-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240621160820.3394806-1-anthony.l.nguyen@intel.com> References: <20240621160820.3394806-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.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 Reviewed-by: Simon Horman Tested-by: Sujai Buvaneswaran Signed-off-by: Tony Nguyen --- 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 | 3 +-- 4 files changed, 7 insertions(+), 8 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..488661b2900b 100644 --- a/drivers/net/ethernet/intel/ice/ice_repr.h +++ b/drivers/net/ethernet/intel/ice/ice_repr.h @@ -35,9 +35,8 @@ void ice_repr_stop_tx_queues(struct ice_repr *repr); struct ice_repr *ice_netdev_to_repr(const struct net_device *netdev); bool ice_is_port_repr_netdev(const struct net_device *netdev); -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