From patchwork Mon Jun 3 09:50:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Swiatkowski X-Patchwork-Id: 1942787 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=fBtvmnik; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vt84R3pl0z20PW for ; Mon, 3 Jun 2024 19:46:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A6F1D41488; Mon, 3 Jun 2024 09:46:12 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id bJcGSSk5XdWq; Mon, 3 Jun 2024 09:46:11 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C050A41490 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1717407971; bh=4A8EWWamK6/Bp3pbKgQLUtKZN72Uh5ayicu7Ig4ZqYI=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=fBtvmnikzagyIGNANee3asX9zY9P5LOsIHWJZJbogShbfH5+KaXXvBPZKf/fCZauA DBSPMcb+amx8g8frusBeAQYQmNNVqsN+k5uCJZpt2zIKHNe4ZrjPRTPJ907tDJhX98 dYHET7UUXlcrXC15aJzHCMcRO0BGSqcq6zpUzstKs7HixzMMwcgf5zsAB17k9l2JML keiR938sGJeEE7moVQ8eJ64/BF89G9BHUDh8RTbE9KC4Esey1lTs0ONp+tSF8dWG2v QVep+BLRgpzHQGVV7Beg1Btjaw0vKpAOaGMZnL1Yax0kkWZ/u6yIQOtOwsdAOqYwrh zkmnUVt/aw8SQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id C050A41490; Mon, 3 Jun 2024 09:46:11 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 6C07C1BF3EB for ; Mon, 3 Jun 2024 09:46:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 64B3E40592 for ; Mon, 3 Jun 2024 09:46:10 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 0rc-LaXwaVuj for ; Mon, 3 Jun 2024 09:46:09 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=192.198.163.12; helo=mgamail.intel.com; envelope-from=michal.swiatkowski@linux.intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 4949D4051B DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4949D4051B Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4949D4051B for ; Mon, 3 Jun 2024 09:46:09 +0000 (UTC) X-CSE-ConnectionGUID: 1nPy1M8PQhWzejVeXKxvJQ== X-CSE-MsgGUID: Wbya+uobTv2SQhOhxJFeEw== X-IronPort-AV: E=McAfee;i="6600,9927,11091"; a="17732727" X-IronPort-AV: E=Sophos;i="6.08,211,1712646000"; d="scan'208";a="17732727" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2024 02:46:09 -0700 X-CSE-ConnectionGUID: 7fAICirVSbyrAuQpH2rTKg== X-CSE-MsgGUID: FTRiksVTThShBdLgZtePGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,211,1712646000"; d="scan'208";a="37448255" Received: from wasp.igk.intel.com (HELO GK3153-DR2-R750-36946.localdomain.com) ([10.102.20.192]) by orviesa007.jf.intel.com with ESMTP; 03 Jun 2024 02:46:06 -0700 From: Michal Swiatkowski To: intel-wired-lan@lists.osuosl.org Date: Mon, 3 Jun 2024 11:50:21 +0200 Message-ID: <20240603095025.1395347-12-michal.swiatkowski@linux.intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240603095025.1395347-1-michal.swiatkowski@linux.intel.com> References: <20240603095025.1395347-1-michal.swiatkowski@linux.intel.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717407969; x=1748943969; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vnRiwZH+8XzQ2rM2mF5CiloYUrntaiQTlzW/ZlJkukk=; b=RGWOJ6P57S28GbRNsRsSbkVQLI8ov2/DDrzPUJXYQWQnpVD06vEaS+PA FMQfjt6+Jnp6f8lNT+hrvhMBN7lOEbs++X5hpYkOUg3hV+pUPhJuRasHl Dbk7422APe767AMbCHt/BXbc6rzodzPMT8bicZbOT6XylATPm66eGBY08 d62ludLnYkcUa1/sEb+lHQgzFfp61qTwVI/VO8oJTbgn9bOX2nNYgOFCx 4pTWiwB8LZ/xjGXk93fJUykk1IdyDLQ9QDhloX22Ubhf35edAmdG9EEEy XH0lOgarzxCk2mGD5JGkUO75dV2+Ib/YdUGld6XFxOmVGdV4ijMRde+M9 A==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=none (p=none dis=none) header.from=linux.intel.com X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=RGWOJ6P5 Subject: [Intel-wired-lan] [iwl-next v4 11/15] ice: check if SF is ready in ethtool ops X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shayd@nvidia.com, maciej.fijalkowski@intel.com, horms@kernel.org, sridhar.samudrala@intel.com, mateusz.polchlopek@intel.com, netdev@vger.kernel.org, jiri@nvidia.com, kalesh-anakkur.purayil@broadcom.com, michal.kubiak@intel.com, pio.raczynski@gmail.com, przemyslaw.kitszel@intel.com, jacob.e.keller@intel.com, wojciech.drewek@intel.com Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 --- 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 62c8205fceba..211273d53f2b 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -4065,7 +4065,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); @@ -4077,8 +4077,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); @@ -4091,7 +4090,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 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; };