All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [PATCH v2 3/7] trace-cmd library: Remove vsocket dependency on P2P protocol
Date: Sun, 17 Apr 2022 14:21:50 -0400	[thread overview]
Message-ID: <20220417182154.1041513-4-rostedt@goodmis.org> (raw)
In-Reply-To: <20220417182154.1041513-1-rostedt@goodmis.org>

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The P2P protocol can work with network connections as well. To allow
network agents, remove the dependency on cid ids, and just call them
local and remote ids.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 lib/trace-cmd/include/trace-tsync-local.h |  6 +++---
 lib/trace-cmd/trace-timesync-ptp.c        | 24 +++++++++++------------
 lib/trace-cmd/trace-timesync.c            |  6 +++---
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/lib/trace-cmd/include/trace-tsync-local.h b/lib/trace-cmd/include/trace-tsync-local.h
index d0f82f5d0916..4340dfaf80ca 100644
--- a/lib/trace-cmd/include/trace-tsync-local.h
+++ b/lib/trace-cmd/include/trace-tsync-local.h
@@ -49,9 +49,9 @@ struct clock_sync_context {
 							 * calculated offsets per CPU
 							 */
 
-	/* Identifiers of local and remote time sync peers: cid and port */
-	unsigned int			local_cid;
-	unsigned int			remote_cid;
+	/* Identifiers of local and remote time sync peers */
+	unsigned int			local_id;
+	unsigned int			remote_id;
 };
 
 int tracecmd_tsync_proto_register(const char *proto_name, int accuracy, int roles,
diff --git a/lib/trace-cmd/trace-timesync-ptp.c b/lib/trace-cmd/trace-timesync-ptp.c
index 4f7805627259..0e23ff83869a 100644
--- a/lib/trace-cmd/trace-timesync-ptp.c
+++ b/lib/trace-cmd/trace-timesync-ptp.c
@@ -100,8 +100,8 @@ struct ptp_markers_context {
 };
 
 struct ptp_marker_buf {
-	int local_cid;
-	int remote_cid;
+	int local_id;
+	int remote_id;
 	int count;
 	int packet_id;
 } __packed;
@@ -163,7 +163,7 @@ static int ptp_clock_sync_init(struct tracecmd_time_sync *tsync)
 		char buff[256];
 		int res_fd;
 
-		sprintf(buff, "res-cid%d.txt", clock_context->remote_cid);
+		sprintf(buff, "res-id%d.txt", clock_context->remote_id);
 
 		res_fd = open(buff, O_CREAT|O_WRONLY|O_TRUNC, 0644);
 		if (res_fd > 0)
@@ -247,8 +247,8 @@ static int ptp_marker_find(struct tep_event *event, struct tep_record *record,
 		return 0;
 	if (record->size >= (ctx->ptp->id->offset + sizeof(struct ptp_marker))) {
 		marker = (struct ptp_marker *)(record->data + ctx->ptp->id->offset);
-		if (marker->data.local_cid == ctx->clock->local_cid &&
-		    marker->data.remote_cid == ctx->clock->remote_cid &&
+		if (marker->data.local_id == ctx->clock->local_id &&
+		    marker->data.remote_id == ctx->clock->remote_id &&
 		    marker->series_id == ctx->ptp->series_id &&
 		    marker->data.count)
 			ptp_probe_store(ctx, marker, record->ts);
@@ -460,8 +460,8 @@ static int ptp_clock_client(struct tracecmd_time_sync *tsync,
 	ret = tracecmd_msg_send_time_sync(tsync->msg_handle, PTP_NAME,
 					  PTP_SYNC_PKT_START, sizeof(start),
 					  (char *)&start);
-	marker.data.local_cid = clock_context->local_cid;
-	marker.data.remote_cid = clock_context->remote_cid;
+	marker.data.local_id = clock_context->local_id;
+	marker.data.remote_id = clock_context->remote_id;
 	marker.series_id = ntohl(start.series_id);
 	marker.data.packet_id = 'r';
 	ptp->series_id = marker.series_id;
@@ -566,8 +566,8 @@ static int ptp_clock_server(struct tracecmd_time_sync *tsync,
 	tracefs_instance_file_write(clock_context->instance, "trace", "\0");
 
 	ptp->series_id++;
-	marker.data.local_cid = clock_context->local_cid;
-	marker.data.remote_cid = clock_context->remote_cid;
+	marker.data.local_id = clock_context->local_id;
+	marker.data.remote_id = clock_context->remote_id;
 	marker.series_id = ptp->series_id;
 	msg = (char *)&msg_ret;
 	size = sizeof(msg_ret);
@@ -627,7 +627,7 @@ static int ptp_clock_server(struct tracecmd_time_sync *tsync,
 		char buff[256];
 		int res_fd;
 
-		sprintf(buff, "res-cid%d.txt", clock_context->remote_cid);
+		sprintf(buff, "res-id%d.txt", clock_context->remote_id);
 
 		res_fd = open(buff, O_WRONLY|O_APPEND, 0644);
 		if (res_fd > 0) {
@@ -681,8 +681,8 @@ static int ptp_clock_sync_calc(struct tracecmd_time_sync *tsync,
 		ptp = (struct ptp_clock_sync *)clock_context->proto_data;
 		if (ptp->debug_fd > 0)
 			close(ptp->debug_fd);
-		sprintf(buff, "s-cid%d_%d.txt",
-				clock_context->remote_cid, ptp->series_id+1);
+		sprintf(buff, "s-id%d_%d.txt",
+				clock_context->remote_id, ptp->series_id+1);
 		ptp->debug_fd = open(buff, O_CREAT|O_WRONLY|O_TRUNC, 0644);
 	}
 #endif
diff --git a/lib/trace-cmd/trace-timesync.c b/lib/trace-cmd/trace-timesync.c
index 514d333e57a7..594f660e2a40 100644
--- a/lib/trace-cmd/trace-timesync.c
+++ b/lib/trace-cmd/trace-timesync.c
@@ -498,12 +498,12 @@ static int clock_context_init(struct tracecmd_time_sync *tsync,
 	clock->is_guest = guest;
 	clock->is_server = clock->is_guest;
 
-	if (get_vsocket_params(tsync->msg_handle->fd, &clock->local_cid,
-			       &clock->remote_cid))
+	if (get_vsocket_params(tsync->msg_handle->fd, &clock->local_id,
+			       &clock->remote_id))
 		goto error;
 
 	clock->instance = clock_synch_create_instance(tsync->clock_str,
-						      clock->remote_cid);
+						      clock->remote_id);
 	if (!clock->instance)
 		goto error;
 
-- 
2.35.1


  parent reply	other threads:[~2022-04-17 18:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-17 18:21 [PATCH v2 0/7] trace-cmd library: Remove dependency to vsockets Steven Rostedt
2022-04-17 18:21 ` [PATCH v2 1/7] trace-cmd: Add NO_VSOCK make option to force vsock code off Steven Rostedt
2022-04-17 18:21 ` [PATCH v2 2/7] trace-cmd library: Remove ports from clock context Steven Rostedt
2022-04-17 18:21 ` Steven Rostedt [this message]
2022-04-17 18:21 ` [PATCH v2 4/7] trace-cmd library: Remove dependency on vsocks for sync identifiers Steven Rostedt
2022-04-17 18:21 ` [PATCH v2 5/7] trace-cmd library: Have tracecmd_tsync_with_guest() not depend on cid/port Steven Rostedt
2022-04-17 18:21 ` [PATCH v2 6/7] trace-cmd library: Remove vsock dependency from tracecmd_tsync_with_host() Steven Rostedt
2022-04-17 18:21 ` [PATCH v2 7/7] trace-cmd: Move vsocket code into its own file Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220417182154.1041513-4-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.