From patchwork Tue Feb 13 07:27:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Swiatkowski X-Patchwork-Id: 13554570 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 25708182D2 for ; Tue, 13 Feb 2024 07:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707809019; cv=none; b=r+SYG1uDcrAYxFB9SPw57wpUUcIVD0LNFd3lZ8pgOd559RkdCDXXpMsoovREP2fIwWPTDJHp5XrXentY4eBE06guzrCrcun6kukgYjLU9+kJ8uZr5oMnoU379fQcvPivqYMXOoP6E8PZLSOUbVjav5Qx++8Gh2f9r8aCbxZauAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707809019; c=relaxed/simple; bh=6IxVXNcV42dE7VwWkYWwgVzhEiKQL7TvuCv25IexpxQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C2mq8pJaO4MVCALs2ntmMAjCfxv+o5Jn2rCRMnq0eRs9fdPAi1c9r7VKnb16dVtkkj6GhBSXjfHj8ny5bkrMC/LTWyiNdVoGoBUoSW9wMZd3bwjhrrqGvo8lK5tCGVp1xMFHrd7i3V5PR3nuS58StJv7KABne5MVvZP5KQS7xYs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TPRCv6UK; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TPRCv6UK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707809018; x=1739345018; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6IxVXNcV42dE7VwWkYWwgVzhEiKQL7TvuCv25IexpxQ=; b=TPRCv6UKdCCHi2CfgXMHKeuhIqbqSJiiLnXnYAPQHNi1gvemWC/x2Rdk dmWYR7l99CZAlpbMiUVTMnIIkapO2U0DPXdcXy4VasZbBKVWXvRXzcQTZ fZVW4t10oYwPDS4CiFuCwxAx5wVZ2clWLfl/EpDllUBqZ/PyuLARCQWEg YAUAuswNgWh5WQ0w/hYOaWL6ssKYwJCXByou3Un7qSIwearjbJBCUXma3 aiz+y39FIK2n5reeZaRa1jgZYyUh839qniYjext2R9pKJgzeh2+cWmbVv /HVo5rL/cSBS0G67+C11OidmC9rtSZLX1adQiQPjOS7tvkzN4bx4JCTVP Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="27247994" X-IronPort-AV: E=Sophos;i="6.06,156,1705392000"; d="scan'208";a="27247994" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 23:23:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,156,1705392000"; d="scan'208";a="7385404" Received: from wasp.igk.intel.com (HELO GK3153-DR2-R750-36946.localdomain.com) ([10.102.20.192]) by fmviesa003.fm.intel.com with ESMTP; 12 Feb 2024 23:23:35 -0800 From: Michal Swiatkowski To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, jacob.e.keller@intel.com, michal.kubiak@intel.com, maciej.fijalkowski@intel.com, sridhar.samudrala@intel.com, przemyslaw.kitszel@intel.com, wojciech.drewek@intel.com, pio.raczynski@gmail.com, Michal Swiatkowski Subject: [iwl-next v1 11/15] ice: check if SF is ready in ethtool ops Date: Tue, 13 Feb 2024 08:27:20 +0100 Message-ID: <20240213072724.77275-12-michal.swiatkowski@linux.intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240213072724.77275-1-michal.swiatkowski@linux.intel.com> References: <20240213072724.77275-1-michal.swiatkowski@linux.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 Now there is another type of port representor. Correct checking if parent device is ready to reflect also new PR type. Reviewed-by: Wojciech Drewek Signed-off-by: Michal Swiatkowski --- 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 c862b21bad9f..8a46550860e6 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -4018,7 +4018,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); @@ -4030,8 +4030,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); @@ -4044,7 +4043,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 7047fea66f4f..f0ae7a9000b4 100644 --- a/drivers/net/ethernet/intel/ice/ice_repr.c +++ b/drivers/net/ethernet/intel/ice/ice_repr.c @@ -317,6 +317,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 @@ -438,6 +448,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); @@ -463,6 +474,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 dcba07899877..27def65614f3 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; };