anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone
Jeff Moyer 2c91dc
From 0a43bfdf030b4a84fce562462944a9a44888afaa Mon Sep 17 00:00:00 2001
Jeff Moyer 2c91dc
From: Vishal Verma <vishal.l.verma@intel.com>
Jeff Moyer 2c91dc
Date: Mon, 15 Aug 2022 13:22:04 -0600
Jeff Moyer 2c91dc
Subject: [PATCH 189/217] libcxl: add a depth attribute to cxl_port
Jeff Moyer 2c91dc
Jeff Moyer 2c91dc
Add a depth attribute to the cxl_port structure, that can be used for
Jeff Moyer 2c91dc
calculating its distance from the root port, and will be needed for
Jeff Moyer 2c91dc
interleave granularity calculations during region creation.
Jeff Moyer 2c91dc
Jeff Moyer 2c91dc
Link: https://lore.kernel.org/r/20220815192214.545800-2-vishal.l.verma@intel.com
Jeff Moyer 2c91dc
Suggested-by: Dan Williams <dan.j.williams@intel.com>
Jeff Moyer 2c91dc
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Jeff Moyer 2c91dc
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Jeff Moyer 2c91dc
---
Jeff Moyer 2c91dc
 cxl/lib/libcxl.c  | 1 +
Jeff Moyer 2c91dc
 cxl/lib/private.h | 1 +
Jeff Moyer 2c91dc
 2 files changed, 2 insertions(+)
Jeff Moyer 2c91dc
Jeff Moyer 2c91dc
diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
Jeff Moyer 2c91dc
index e52896f..145c6ba 100644
Jeff Moyer 2c91dc
--- a/cxl/lib/libcxl.c
Jeff Moyer 2c91dc
+++ b/cxl/lib/libcxl.c
Jeff Moyer 2c91dc
@@ -744,6 +744,7 @@ static int cxl_port_init(struct cxl_port *port, struct cxl_port *parent_port,
Jeff Moyer 2c91dc
 	port->type = type;
Jeff Moyer 2c91dc
 	port->parent = parent_port;
Jeff Moyer 2c91dc
 	port->type = type;
Jeff Moyer 2c91dc
+	port->depth = parent_port ? parent_port->depth + 1 : 0;
Jeff Moyer 2c91dc
 
Jeff Moyer 2c91dc
 	list_head_init(&port->child_ports);
Jeff Moyer 2c91dc
 	list_head_init(&port->endpoints);
Jeff Moyer 2c91dc
diff --git a/cxl/lib/private.h b/cxl/lib/private.h
Jeff Moyer 2c91dc
index f6d4573..832a815 100644
Jeff Moyer 2c91dc
--- a/cxl/lib/private.h
Jeff Moyer 2c91dc
+++ b/cxl/lib/private.h
Jeff Moyer 2c91dc
@@ -66,6 +66,7 @@ struct cxl_port {
Jeff Moyer 2c91dc
 	int decoders_init;
Jeff Moyer 2c91dc
 	int dports_init;
Jeff Moyer 2c91dc
 	int nr_dports;
Jeff Moyer 2c91dc
+	int depth;
Jeff Moyer 2c91dc
 	struct cxl_ctx *ctx;
Jeff Moyer 2c91dc
 	struct cxl_bus *bus;
Jeff Moyer 2c91dc
 	enum cxl_port_type type;
Jeff Moyer 2c91dc
-- 
Jeff Moyer 2c91dc
2.27.0
Jeff Moyer 2c91dc