Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 2384D17F8 for ; Fri, 15 Jul 2022 06:26:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657866370; x=1689402370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PTUSsSk2CbP4ECnciH7F628Xix45xxUjqyby8J8SofY=; b=BqQq6HhtB8A6r6I0tVhWWWQ+pXV2cdQ3lE0MRm9/ua5KglhEDF9ioozx 1J2VXcKkxx3JgaK1Tm+Ct8xatXgqb79bgaI32pwp3Atk3ePh18JJoZF2I dbsBGr0uRN/jsIkTxq37vwUJlwFxNrMVDfibZjBpEnVsMstGqDSteFD8M zebHbxXtG+dAFvc2xgPy7iyIVbpcgEwxDMQH6kPHC3JxNqX0ezR0l3d2a JdSWvYnTRJIehwEK6pvteO8f29d1ok7itjXDQGNZmAFI4hW5Pd8lSNW+B AnrGqjTQROEWE0YBPd3B+THFPHMVYGJX67uyFTAsz6RQVzqyrUnEeulu0 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10408"; a="266125530" X-IronPort-AV: E=Sophos;i="5.92,273,1650956400"; d="scan'208";a="266125530" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2022 23:26:08 -0700 X-IronPort-AV: E=Sophos;i="5.92,273,1650956400"; d="scan'208";a="546544604" Received: from saseiper-mobl.amr.corp.intel.com (HELO vverma7-desk1.intel.com) ([10.212.71.32]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2022 23:26:08 -0700 From: Vishal Verma To: Cc: , Dan Williams , Alison Schofield , Ira Weiny , Dave Jiang , Vishal Verma Subject: [ndctl PATCH 1/8] libcxl: add a depth attribute to cxl_port Date: Fri, 15 Jul 2022 00:25:43 -0600 Message-Id: <20220715062550.789736-2-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220715062550.789736-1-vishal.l.verma@intel.com> References: <20220715062550.789736-1-vishal.l.verma@intel.com> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1182; h=from:subject; bh=PTUSsSk2CbP4ECnciH7F628Xix45xxUjqyby8J8SofY=; b=owGbwMvMwCXGf25diOft7jLG02pJDEkXOXJDgy9ej3oWcPMm42bf+khxwyWO06dPOcxzoH2pCCOr te6HjlIWBjEuBlkxRZa/ez4yHpPbns8TmOAIM4eVCWQIAxenAExEyp7hn6FM1zpm7o7wb+ftufsYOB /Je8e+qHK8uPmf4o4OE0HDEwz/098biE28z7PbpEfg/OJzrMJvZNoVr7yeotHjUHE47+AuBgA= X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF Content-Transfer-Encoding: 8bit Add a depth attribute to the cxl_port structure, that can be used for calculating its distance from the root port, and will be needed for interleave granularity calculations during region creation. Suggested-by: Dan Williams Signed-off-by: Vishal Verma --- cxl/lib/private.h | 1 + cxl/lib/libcxl.c | 1 + 2 files changed, 2 insertions(+) diff --git a/cxl/lib/private.h b/cxl/lib/private.h index f6d4573..832a815 100644 --- a/cxl/lib/private.h +++ b/cxl/lib/private.h @@ -66,6 +66,7 @@ struct cxl_port { int decoders_init; int dports_init; int nr_dports; + int depth; struct cxl_ctx *ctx; struct cxl_bus *bus; enum cxl_port_type type; diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c index be6bc2c..946cd4b 100644 --- a/cxl/lib/libcxl.c +++ b/cxl/lib/libcxl.c @@ -744,6 +744,7 @@ static int cxl_port_init(struct cxl_port *port, struct cxl_port *parent_port, port->type = type; port->parent = parent_port; port->type = type; + port->depth = parent_port ? parent_port->depth + 1 : 0; list_head_init(&port->child_ports); list_head_init(&port->endpoints); -- 2.36.1