anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

Blame SOURCES/0189-libcxl-add-a-depth-attribute-to-cxl_port.patch

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