From patchwork Thu Jun 6 11:25:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Swiatkowski X-Patchwork-Id: 1944580 X-Patchwork-Delegate: anthony.l.nguyen@intel.com 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=QmZUTYLu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (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 4Vw22N3bQCz20KL for ; Thu, 6 Jun 2024 21:21:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5CA72614A1; Thu, 6 Jun 2024 11:20:58 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id fA6AXUZtVNdg; Thu, 6 Jun 2024 11:20:57 +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 smtp3.osuosl.org 8B93161483 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1717672857; bh=gw9WAJqzUMVe6bUlZiSD8Vr2XwfdoLi5gx3jCzGlbl4=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=QmZUTYLuS/m64MO0uy958NgpXRCUH5+yxqBIb8Q8R7dLffjwBUZ3jW/PxgvYmFnCp m9+SRsAEcf3zEykmtXxgA2FvlXizyg2SsDe+6Kjpht4eisIr+125JF8YA4erOumyL4 YZsx7iBmW824IgafGXAU8NPOgRjkK3iD+oY14e6YBGowC7Ccbf+PIbbE4G1vCBrRzF MxHWycMZchLBkvUErj4PziI2iHxh2WC/ucHq9cDdsYWTxv9ANvrJg7czEeZ+gGJgFN giZP0McXeQwBDU1jBZC3t0Tqzikx6mtEFYUPoapofqa5CvCpRfASvLbeQWNiuTWj3R LIGZAn/GSisBQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 8B93161483; Thu, 6 Jun 2024 11:20:57 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 011601BF591 for ; Thu, 6 Jun 2024 11:20:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id EE254400E5 for ; Thu, 6 Jun 2024 11:20:55 +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 ZFzhZe-H7UmB for ; Thu, 6 Jun 2024 11:20:55 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=198.175.65.15; helo=mgamail.intel.com; envelope-from=michal.swiatkowski@linux.intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org C8477400AF DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C8477400AF Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by smtp2.osuosl.org (Postfix) with ESMTPS id C8477400AF for ; Thu, 6 Jun 2024 11:20:54 +0000 (UTC) X-CSE-ConnectionGUID: jDI1W0ZmRNCRp8yjEvKC/g== X-CSE-MsgGUID: h26Q44qkQL+kd1kUE2i+DA== X-IronPort-AV: E=McAfee;i="6600,9927,11094"; a="18123820" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="18123820" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 04:20:54 -0700 X-CSE-ConnectionGUID: MPnCpDb+Q/SlviiamraW/A== X-CSE-MsgGUID: rKXDFcTxSPSHKRNLZ6Zp4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="42864772" Received: from wasp.igk.intel.com (HELO GK3153-DR2-R750-36946.localdomain.com) ([10.102.20.192]) by orviesa003.jf.intel.com with ESMTP; 06 Jun 2024 04:20:52 -0700 From: Michal Swiatkowski To: intel-wired-lan@lists.osuosl.org Date: Thu, 6 Jun 2024 13:25:01 +0200 Message-ID: <20240606112503.1939759-14-michal.swiatkowski@linux.intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240606112503.1939759-1-michal.swiatkowski@linux.intel.com> References: <20240606112503.1939759-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=1717672855; x=1749208855; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3C+ADSlBQHoB+U06BK12dRXhk49S8cfPGCKAN+6qgGw=; b=eDLD7H9QapBnPOnXWej02Z/eBHMeMLGPVvot8bd6PZKA41muKRmRG1Zc 8QJRD8zXnB7m0cyyJV6y4/ekMDXrbQ+2uYP2bxXlj/ZSmL/vRTf+xBL0w pqf0bT8+YzzqFdVJvYCHVUPfTzozK8QvBZfkLx7d1w0ZXBPcjyqxcu3cn 6kMYUoW39YpZYhkEStsLZQ7f2rYN/Pd+O/wW+kwpGoguSrPalWsaB1P+g DCSobbNSi3eXl+AJy3NOuvAMWgzzPmS+uGPD2GhUeSW+Hek7N44MeqKdn YdEbjpxqKixZy6+yXMLkEqs4JQokos+imMb5YQ1lWhIydHfdaCQ5io7XD Q==; X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dmarc=none (p=none dis=none) header.from=linux.intel.com X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=eDLD7H9Q Subject: [Intel-wired-lan] [iwl-next v5 13/15] ice: support subfunction devlink Tx topology 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" Flow for creating Tx topology is the same as for VF port representors, but the devlink port is stored in different place (sf->devlink_port). When creating VF devlink lock isn't taken, when creating subfunction it is. Setting Tx topology function needs to take this lock, check if it was taken before to not do it twice. Reviewed-by: Simon Horman Reviewed-by: Przemek Kitszel Reviewed-by: Wojciech Drewek Signed-off-by: Michal Swiatkowski Tested-by: Rafal Romanowski --- drivers/net/ethernet/intel/ice/devlink/devlink.c | 12 ++++++++++++ .../net/ethernet/intel/ice/devlink/devlink_port.c | 1 + drivers/net/ethernet/intel/ice/ice_repr.c | 12 +++++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c index 9bcbd04d29a9..037f4621e517 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink.c +++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c @@ -746,6 +746,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node struct ice_sched_node *tc_node, struct ice_pf *pf) { struct devlink_rate *rate_node = NULL; + struct ice_dynamic_port *sf; struct ice_vf *vf; int i; @@ -757,6 +758,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node /* create root node */ rate_node = devl_rate_node_create(devlink, node, node->name, NULL); } else if (node->vsi_handle && + pf->vsi[node->vsi_handle]->type == ICE_VSI_VF && pf->vsi[node->vsi_handle]->vf) { vf = pf->vsi[node->vsi_handle]->vf; if (!vf->devlink_port.devlink_rate) @@ -765,6 +767,16 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node */ devl_rate_leaf_create(&vf->devlink_port, node, node->parent->rate_node); + } else if (node->vsi_handle && + pf->vsi[node->vsi_handle]->type == ICE_VSI_SF && + pf->vsi[node->vsi_handle]->sf) { + sf = pf->vsi[node->vsi_handle]->sf; + if (!sf->devlink_port.devlink_rate) + /* leaf nodes doesn't have children + * so we don't set rate_node + */ + devl_rate_leaf_create(&sf->devlink_port, node, + node->parent->rate_node); } else if (node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF && node->parent->rate_node) { rate_node = devl_rate_node_create(devlink, node, node->name, diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink_port.c b/drivers/net/ethernet/intel/ice/devlink/devlink_port.c index fb3ff68e0666..4cfd90581d92 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink_port.c +++ b/drivers/net/ethernet/intel/ice/devlink/devlink_port.c @@ -711,6 +711,7 @@ int ice_devlink_create_sf_port(struct ice_dynamic_port *dyn_port) */ void ice_devlink_destroy_sf_port(struct ice_dynamic_port *dyn_port) { + devl_rate_leaf_destroy(&dyn_port->devlink_port); devl_port_unregister(&dyn_port->devlink_port); } diff --git a/drivers/net/ethernet/intel/ice/ice_repr.c b/drivers/net/ethernet/intel/ice/ice_repr.c index 78abfdf5d47b..00d4a9125dfa 100644 --- a/drivers/net/ethernet/intel/ice/ice_repr.c +++ b/drivers/net/ethernet/intel/ice/ice_repr.c @@ -347,16 +347,13 @@ static void ice_repr_rem_sf(struct ice_repr *repr) ice_devlink_destroy_sf_port(repr->sf); } -static void ice_repr_set_tx_topology(struct ice_pf *pf) +static void ice_repr_set_tx_topology(struct ice_pf *pf, struct devlink *devlink) { - struct devlink *devlink; - /* only export if ADQ and DCB disabled and eswitch enabled*/ if (ice_is_adq_active(pf) || ice_is_dcb_active(pf) || !ice_is_switchdev_running(pf)) return; - devlink = priv_to_devlink(pf); ice_devlink_rate_init_tx_topology(devlink, ice_get_main_vsi(pf)); } @@ -408,6 +405,7 @@ static struct ice_repr *ice_repr_create(struct ice_vsi *src_vsi) static int ice_repr_add_vf(struct ice_repr *repr) { struct ice_vf *vf = repr->vf; + struct devlink *devlink; int err; err = ice_devlink_create_vf_port(vf); @@ -424,7 +422,9 @@ static int ice_repr_add_vf(struct ice_repr *repr) goto err_cfg_vsi; ice_virtchnl_set_repr_ops(vf); - ice_repr_set_tx_topology(vf->pf); + + devlink = priv_to_devlink(vf->pf); + ice_repr_set_tx_topology(vf->pf, devlink); return 0; @@ -480,6 +480,8 @@ static int ice_repr_add_sf(struct ice_repr *repr) if (err) goto err_netdev; + ice_repr_set_tx_topology(sf->vsi->back, priv_to_devlink(sf->vsi->back)); + return 0; err_netdev: