From patchwork Wed Jul 31 22:10:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13749280 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 79ADB16D9B6 for ; Wed, 31 Jul 2024 22:10:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722463856; cv=none; b=dMRWKFV/l56/zyxnSIwQ2HE86rMWAOw3TnPQ/9A3+3hWShR/FaNO5xlbDh/NXWqe2m+56T4+3QuOxSwGwXhueJrI2siwGXQ9MamgMJqw8rb9NNAODjRKuXh3QWdEUwdxVcOUCjWbpQpGrxaZj/SBE4vqKP9BeMdHWg16vS9RpqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722463856; c=relaxed/simple; bh=g9mCwqh+CJ5G5wbBwv+GXtGW0PUDRYtDFrb7K8hqWqY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I3fS8C9CJqqqou0zg3RuRvZhkAyUpgu1aymIOVMZjjLeB6YMYl7y+Gd9Z35/HhXbj5g/iSswGYNSTNKPZC4/RQR1E9txdZECXqV2e6TN8JnqBxfR6rrQIa0TYl08LQTZGTetXgdeJnT8TPgdh8X/m2xegmIUVPYoM/hFKCglHko= 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=JsKWZjzD; arc=none smtp.client-ip=198.175.65.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="JsKWZjzD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722463855; x=1753999855; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=g9mCwqh+CJ5G5wbBwv+GXtGW0PUDRYtDFrb7K8hqWqY=; b=JsKWZjzDkvspqpSc17L9p3E5mFxw2pbAtf+DXU4O/jtvv7WodpOXIOYW mYhhtOPzAvs6yQXgwtn3D3O0/hjXXJr7B2bgbQidzOLVkmiQaJyMwixwb qPjUv9K+Z2Biz5DPRhVa5Ymk732wOBdByn2dMguHGyWP6T8JQi5UaJHpN NTXl5VuAKqNOZVujfqtrOG/LEad8vrKu/CkNWQkXImJ8olOPoUpyqvFQ0 PvL1rMm1/3n0IvDlYfJHWhw2mkggw+BC9wUFGi99CoIwtNiyoeqT0x0bC oZffr5P8lq6TAYi7pZQLNcAAqQ+bX+giLMwndE06NnWH+n5LRGW19vFyB w==; X-CSE-ConnectionGUID: fR8NxQdeSnSlNC1x3X1pmA== X-CSE-MsgGUID: FRVR4Ew3Rmu6mh4NdJnWaQ== X-IronPort-AV: E=McAfee;i="6700,10204,11150"; a="31765558" X-IronPort-AV: E=Sophos;i="6.09,251,1716274800"; d="scan'208";a="31765558" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2024 15:10:47 -0700 X-CSE-ConnectionGUID: 2yTau/+JTnaaHLTtO0O9nw== X-CSE-MsgGUID: k3OPixIDR1qS13ilnSHBsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,251,1716274800"; d="scan'208";a="54734167" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa010.jf.intel.com with ESMTP; 31 Jul 2024 15:10:47 -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, jiri@nvidia.com, shayd@nvidia.com, wojciech.drewek@intel.com, horms@kernel.org, sridhar.samudrala@intel.com, mateusz.polchlopek@intel.com, kalesh-anakkur.purayil@broadcom.com, michal.kubiak@intel.com, pio.raczynski@gmail.com, przemyslaw.kitszel@intel.com, jacob.e.keller@intel.com, maciej.fijalkowski@intel.com, Rafal Romanowski Subject: [PATCH net-next v2 11/15] ice: check if SF is ready in ethtool ops Date: Wed, 31 Jul 2024 15:10:22 -0700 Message-ID: <20240731221028.965449-12-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240731221028.965449-1-anthony.l.nguyen@intel.com> References: <20240731221028.965449-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 Now there is another type of port representor. Correct checking if parent device is ready to reflect also new PR type. Reviewed-by: Simon Horman Reviewed-by: Wojciech Drewek Signed-off-by: Michal Swiatkowski Tested-by: Rafal Romanowski Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 +++---- drivers/net/ethernet/intel/ice/ice_repr.c | 12 ++++++++++++ drivers/net/ethernet/intel/ice/ice_repr.h | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 8c990c976132..7b1f7725c0c8 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -4414,7 +4414,7 @@ ice_repr_get_drvinfo(struct net_device *netdev, { struct ice_repr *repr = ice_netdev_to_repr(netdev); - if (ice_check_vf_ready_for_cfg(repr->vf)) + if (repr->ops.ready(repr)) return; __ice_get_drvinfo(netdev, drvinfo, repr->src_vsi); @@ -4426,8 +4426,7 @@ ice_repr_get_strings(struct net_device *netdev, u32 stringset, u8 *data) struct ice_repr *repr = ice_netdev_to_repr(netdev); /* for port representors only ETH_SS_STATS is supported */ - if (ice_check_vf_ready_for_cfg(repr->vf) || - stringset != ETH_SS_STATS) + if (repr->ops.ready(repr) || stringset != ETH_SS_STATS) return; __ice_get_strings(netdev, stringset, data, repr->src_vsi); @@ -4440,7 +4439,7 @@ ice_repr_get_ethtool_stats(struct net_device *netdev, { struct ice_repr *repr = ice_netdev_to_repr(netdev); - if (ice_check_vf_ready_for_cfg(repr->vf)) + if (repr->ops.ready(repr)) return; __ice_get_ethtool_stats(netdev, stats, data, repr->src_vsi); diff --git a/drivers/net/ethernet/intel/ice/ice_repr.c b/drivers/net/ethernet/intel/ice/ice_repr.c index 5ea8b512c421..229831fe2cd2 100644 --- a/drivers/net/ethernet/intel/ice/ice_repr.c +++ b/drivers/net/ethernet/intel/ice/ice_repr.c @@ -283,6 +283,16 @@ ice_repr_reg_netdev(struct net_device *netdev) return register_netdev(netdev); } +static int ice_repr_ready_vf(struct ice_repr *repr) +{ + return !ice_check_vf_ready_for_cfg(repr->vf); +} + +static int ice_repr_ready_sf(struct ice_repr *repr) +{ + return !repr->sf->active; +} + /** * ice_repr_destroy - remove representor from VF * @repr: pointer to representor structure @@ -420,6 +430,7 @@ struct ice_repr *ice_repr_create_vf(struct ice_vf *vf) repr->vf = vf; repr->ops.add = ice_repr_add_vf; repr->ops.rem = ice_repr_rem_vf; + repr->ops.ready = ice_repr_ready_vf; ether_addr_copy(repr->parent_mac, vf->hw_lan_addr); @@ -466,6 +477,7 @@ struct ice_repr *ice_repr_create_sf(struct ice_dynamic_port *sf) repr->sf = sf; repr->ops.add = ice_repr_add_sf; repr->ops.rem = ice_repr_rem_sf; + repr->ops.ready = ice_repr_ready_sf; ether_addr_copy(repr->parent_mac, sf->hw_addr); diff --git a/drivers/net/ethernet/intel/ice/ice_repr.h b/drivers/net/ethernet/intel/ice/ice_repr.h index ee28632e87b4..35bd93165e1e 100644 --- a/drivers/net/ethernet/intel/ice/ice_repr.h +++ b/drivers/net/ethernet/intel/ice/ice_repr.h @@ -36,6 +36,7 @@ struct ice_repr { struct { int (*add)(struct ice_repr *repr); void (*rem)(struct ice_repr *repr); + int (*ready)(struct ice_repr *repr); } ops; };