Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Shyam Prasad N <nspmangalore@gmail.com>
To: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@cjr.nz,
	bharathsm.hsk@gmail.com, tom@talpey.com
Cc: Shyam Prasad N <sprasad@microsoft.com>
Subject: [PATCH 4/6] cifs: display the endpoint IP details in DebugData
Date: Fri,  9 Jun 2023 17:46:57 +0000	[thread overview]
Message-ID: <20230609174659.60327-4-sprasad@microsoft.com> (raw)
In-Reply-To: <20230609174659.60327-1-sprasad@microsoft.com>

With multichannel, it is useful to know the src port details
for each channel. This change will print the ip addr and
port details for both the socket dest and src endpoints.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/smb/client/cifs_debug.c | 46 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c
index 17c884724590..d5fd3681f56e 100644
--- a/fs/smb/client/cifs_debug.c
+++ b/fs/smb/client/cifs_debug.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/proc_fs.h>
 #include <linux/uaccess.h>
+#include <net/inet_sock.h>
 #include "cifspdu.h"
 #include "cifsglob.h"
 #include "cifsproto.h"
@@ -146,6 +147,30 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
 		   in_flight(server),
 		   atomic_read(&server->in_send),
 		   atomic_read(&server->num_waiters));
+
+#ifndef CONFIG_CIFS_SMB_DIRECT
+	if (server->ssocket) {
+		if (server->dstaddr.ss_family == AF_INET6) {
+			struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)&server->dstaddr;
+			struct sock *sk = server->ssocket->sk;
+			struct inet_sock *inet = inet_sk(server->ssocket->sk);
+			seq_printf(m, "\n\t\tIPv6 Dest: [%pI6]:%d Src: [%pI6]:%d",
+				   &ipv6->sin6_addr,
+				   ntohs(ipv6->sin6_port),
+				   &sk->sk_v6_rcv_saddr.s6_addr32,
+				   ntohs(inet->inet_sport));
+		} else {
+			struct sockaddr_in *ipv4 = (struct sockaddr_in *)&server->dstaddr;
+			struct inet_sock *inet = inet_sk(server->ssocket->sk);
+			seq_printf(m, "\n\t\tIPv4 Dest: %pI4:%d Src: %pI4:%d",
+				   &ipv4->sin_addr,
+				   ntohs(ipv4->sin_port),
+				   &inet->inet_saddr,
+				   ntohs(inet->inet_sport));
+		}
+	}
+#endif
+
 }
 
 static void
@@ -351,6 +376,27 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 			atomic_read(&server->smbd_conn->mr_ready_count),
 			atomic_read(&server->smbd_conn->mr_used_count));
 skip_rdma:
+#else
+		if (server->ssocket) {
+			if (server->dstaddr.ss_family == AF_INET6) {
+				struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)&server->dstaddr;
+				struct sock *sk = server->ssocket->sk;
+				struct inet_sock *inet = inet_sk(server->ssocket->sk);
+				seq_printf(m, "\nIPv6 Dest: [%pI6]:%d Src: [%pI6]:%d",
+					   &ipv6->sin6_addr,
+					   ntohs(ipv6->sin6_port),
+					   &sk->sk_v6_rcv_saddr.s6_addr32,
+					   ntohs(inet->inet_sport));
+			} else {
+				struct sockaddr_in *ipv4 = (struct sockaddr_in *)&server->dstaddr;
+				struct inet_sock *inet = inet_sk(server->ssocket->sk);
+				seq_printf(m, "\nIPv4 Dest: %pI4:%d Src: %pI4:%d",
+					   &ipv4->sin_addr,
+					   ntohs(ipv4->sin_port),
+					   &inet->inet_saddr,
+					   ntohs(inet->inet_sport));
+			}
+		}
 #endif
 		seq_printf(m, "\nNumber of credits: %d,%d,%d Dialect 0x%x",
 			server->credits,
-- 
2.34.1


  parent reply	other threads:[~2023-06-09 17:47 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 17:46 [PATCH 1/6] cifs: fix status checks in cifs_tree_connect Shyam Prasad N
2023-06-09 17:46 ` [PATCH 2/6] cifs: print all credit counters in DebugData Shyam Prasad N
2023-06-10 19:48   ` Steve French
2023-06-09 17:46 ` [PATCH 3/6] cifs: add a warning when the in-flight count goes negative Shyam Prasad N
2023-06-10 19:49   ` Steve French
2023-06-11  8:01     ` Shyam Prasad N
2023-06-23 16:22       ` Tom Talpey
2023-06-26  6:33         ` Shyam Prasad N
2023-06-27 19:40           ` Tom Talpey
2023-06-09 17:46 ` Shyam Prasad N [this message]
2023-06-09 18:02   ` [PATCH 4/6] cifs: display the endpoint IP details in DebugData Enzo Matsumiya
2023-06-11  8:02     ` Shyam Prasad N
2023-06-12  7:59       ` Shyam Prasad N
2023-06-12  7:59         ` Shyam Prasad N
2023-06-12 14:03           ` Enzo Matsumiya
2023-06-12 13:52         ` Enzo Matsumiya
2023-06-12 15:25         ` Paulo Alcantara
2023-06-12 15:29           ` Enzo Matsumiya
2023-06-23  4:21             ` Shyam Prasad N
2023-06-23 15:51               ` Steve French
2023-06-23 15:54               ` Tom Talpey
2023-06-27 12:17                 ` Shyam Prasad N
2023-06-28 10:20                   ` Shyam Prasad N
2023-06-28 13:39                     ` Tom Talpey
2023-06-28 16:24                       ` Steve French
2023-06-28 16:51                     ` Steve French
2023-06-28 17:07                     ` Steve French
2023-06-28 17:11                     ` Steve French
2023-06-29 15:35                       ` Shyam Prasad N
2023-06-09 17:46 ` [PATCH 5/6] cifs: fix max_credits implementation Shyam Prasad N
2023-06-23 16:00   ` Tom Talpey
2023-06-26  5:40     ` Shyam Prasad N
2023-06-09 17:46 ` [PATCH 6/6] cifs: fix sockaddr comparison in iface_cmp Shyam Prasad N
2023-06-23 16:09   ` Tom Talpey
2023-06-26 11:12     ` Dan Carpenter
2023-06-27 19:37       ` Tom Talpey
2023-06-10 19:45 ` [PATCH 1/6] cifs: fix status checks in cifs_tree_connect Steve French

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=20230609174659.60327-4-sprasad@microsoft.com \
    --to=nspmangalore@gmail.com \
    --cc=bharathsm.hsk@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@cjr.nz \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox