linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bernard Metzler" <BMT@zurich.ibm.com>
To: "Bart Van Assche" <bvanassche@acm.org>
Cc: "Jason Gunthorpe" <jgg@ziepe.ca>,
	"Leon Romanovsky" <leonro@mellanox.com>,
	"Doug Ledford" <dledford@redhat.com>,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH 03/15] RDMA/siw: Simplify several debug messages
Date: Tue, 1 Oct 2019 11:39:54 +0000	[thread overview]
Message-ID: <OF073BA5F3.9EA2563D-ON00258486.004013F1-00258486.004013F8@notes.na.collabserv.com> (raw)
In-Reply-To: <20190930231707.48259-4-bvanassche@acm.org>

-----"Bart Van Assche" <bvanassche@acm.org> wrote: -----

>To: "Jason Gunthorpe" <jgg@ziepe.ca>
>From: "Bart Van Assche" <bvanassche@acm.org>
>Date: 10/01/2019 01:17AM
>Cc: "Leon Romanovsky" <leonro@mellanox.com>, "Doug Ledford"
><dledford@redhat.com>, linux-rdma@vger.kernel.org, "Bart Van Assche"
><bvanassche@acm.org>, "Bernard Metzler" <bmt@zurich.ibm.com>
>Subject: [EXTERNAL] [PATCH 03/15] RDMA/siw: Simplify several debug
>messages
>
>Do not print the remote address if it is not used. Use %pISp instead
>of %pI4 %d.
>
>Cc: Bernard Metzler <bmt@zurich.ibm.com>
>Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>---
> drivers/infiniband/sw/siw/siw_cm.c | 36
>++++++------------------------
> 1 file changed, 7 insertions(+), 29 deletions(-)
>
>diff --git a/drivers/infiniband/sw/siw/siw_cm.c
>b/drivers/infiniband/sw/siw/siw_cm.c
>index 8c1931a57f4a..5a75deb9870b 100644
>--- a/drivers/infiniband/sw/siw/siw_cm.c
>+++ b/drivers/infiniband/sw/siw/siw_cm.c
>@@ -1373,22 +1373,8 @@ int siw_connect(struct iw_cm_id *id, struct
>iw_cm_conn_param *params)
> 		rv = -EINVAL;
> 		goto error;
> 	}
>-	if (v4)
>-		siw_dbg_qp(qp,
>-			   "pd_len %d, laddr %pI4 %d, raddr %pI4 %d\n",
>-			   pd_len,
>-			   &((struct sockaddr_in *)(laddr))->sin_addr,
>-			   ntohs(((struct sockaddr_in *)(laddr))->sin_port),
>-			   &((struct sockaddr_in *)(raddr))->sin_addr,
>-			   ntohs(((struct sockaddr_in *)(raddr))->sin_port));
>-	else
>-		siw_dbg_qp(qp,
>-			   "pd_len %d, laddr %pI6 %d, raddr %pI6 %d\n",
>-			   pd_len,
>-			   &((struct sockaddr_in6 *)(laddr))->sin6_addr,
>-			   ntohs(((struct sockaddr_in6 *)(laddr))->sin6_port),
>-			   &((struct sockaddr_in6 *)(raddr))->sin6_addr,
>-			   ntohs(((struct sockaddr_in6 *)(raddr))->sin6_port));
>+	siw_dbg_qp(qp, "pd_len %d, laddr %pISp, raddr %pISp\n", pd_len,
>laddr,
>+		   raddr);
> 
> 	rv = sock_create(v4 ? AF_INET : AF_INET6, SOCK_STREAM, IPPROTO_TCP,
>&s);
> 	if (rv < 0)
>@@ -1935,7 +1921,7 @@ static void siw_drop_listeners(struct iw_cm_id
>*id)
> /*
>  * siw_create_listen - Create resources for a listener's IWCM ID @id
>  *
>- * Listens on the socket addresses id->local_addr and
>id->remote_addr.
>+ * Listens on the socket address id->local_addr.
>  *
>  * If the listener's @id provides a specific local IP address, at
>most one
>  * listening socket is created and associated with @id.
>@@ -1959,7 +1945,7 @@ int siw_create_listen(struct iw_cm_id *id, int
>backlog)
> 	 */
> 	if (id->local_addr.ss_family == AF_INET) {
> 		struct in_device *in_dev = in_dev_get(dev);
>-		struct sockaddr_in s_laddr, *s_raddr;
>+		struct sockaddr_in s_laddr;
> 		const struct in_ifaddr *ifa;
> 
> 		if (!in_dev) {
>@@ -1967,12 +1953,8 @@ int siw_create_listen(struct iw_cm_id *id, int
>backlog)
> 			goto out;
> 		}
> 		memcpy(&s_laddr, &id->local_addr, sizeof(s_laddr));
>-		s_raddr = (struct sockaddr_in *)&id->remote_addr;
> 
>-		siw_dbg(id->device,
>-			"laddr %pI4:%d, raddr %pI4:%d\n",
>-			&s_laddr.sin_addr, ntohs(s_laddr.sin_port),
>-			&s_raddr->sin_addr, ntohs(s_raddr->sin_port));
>+		siw_dbg(id->device, "laddr %pISp\n", &s_laddr);
> 
> 		rtnl_lock();
> 		in_dev_for_each_ifa_rtnl(ifa, in_dev) {
>@@ -1992,17 +1974,13 @@ int siw_create_listen(struct iw_cm_id *id,
>int backlog)
> 	} else if (id->local_addr.ss_family == AF_INET6) {
> 		struct inet6_dev *in6_dev = in6_dev_get(dev);
> 		struct inet6_ifaddr *ifp;
>-		struct sockaddr_in6 *s_laddr = &to_sockaddr_in6(id->local_addr),
>-			*s_raddr = &to_sockaddr_in6(id->remote_addr);
>+		struct sockaddr_in6 *s_laddr = &to_sockaddr_in6(id->local_addr);
> 
> 		if (!in6_dev) {
> 			rv = -ENODEV;
> 			goto out;
> 		}
>-		siw_dbg(id->device,
>-			"laddr %pI6:%d, raddr %pI6:%d\n",
>-			&s_laddr->sin6_addr, ntohs(s_laddr->sin6_port),
>-			&s_raddr->sin6_addr, ntohs(s_raddr->sin6_port));
>+		siw_dbg(id->device, "laddr %pISp\n", &s_laddr);
> 
> 		rtnl_lock();
> 		list_for_each_entry(ifp, &in6_dev->addr_list, if_list) {
>-- 
>2.23.0.444.g18eeb5a265-goog
>
>

Thanks Bart! Obviously, I wasn't aware of %pISp formatting...
Looks so much prettier!

Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>


  parent reply	other threads:[~2019-10-01 11:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-30 23:16 [PATCH 00/15] RDMA patches for kernel v5.5 Bart Van Assche
2019-09-30 23:16 ` [PATCH 01/15] RDMA/ucma: Reduce the number of rdma_destroy_id() calls Bart Van Assche
2019-10-01 15:07   ` Jason Gunthorpe
2019-10-01 17:13     ` Bart Van Assche
2019-09-30 23:16 ` [PATCH 02/15] RDMA/iwcm: Fix a lock inversion issue Bart Van Assche
2019-10-01 15:17   ` Jason Gunthorpe
2019-09-30 23:16 ` [PATCH 03/15] RDMA/siw: Simplify several debug messages Bart Van Assche
2019-10-01 15:20   ` Jason Gunthorpe
2019-09-30 23:16 ` [PATCH 04/15] RDMA/siw: Fix port number endianness in a debug message Bart Van Assche
2019-10-01 15:20   ` Jason Gunthorpe
2019-09-30 23:16 ` [PATCH 05/15] RDMA/siw: Make node GUIDs valid EUI-64 identifiers Bart Van Assche
2019-09-30 23:16 ` [PATCH 06/15] RDMA/srp: Remove two casts Bart Van Assche
2019-09-30 23:16 ` [PATCH 07/15] RDMA/srp: Honor the max_send_sge device attribute Bart Van Assche
2019-09-30 23:17 ` [PATCH 08/15] RDMA/srp: Make route resolving error messages more informative Bart Van Assche
2019-09-30 23:17 ` [PATCH 09/15] RDMA/srpt: Fix handling of SR-IOV and iWARP ports Bart Van Assche
2019-10-02 14:14   ` Jason Gunthorpe
2019-10-02 15:21     ` Bart Van Assche
2019-10-02 16:51       ` Jason Gunthorpe
2019-10-02 17:24         ` Leon Romanovsky
2019-10-02 17:43           ` Bart Van Assche
2019-10-03  8:33             ` Leon Romanovsky
2019-09-30 23:17 ` [PATCH 10/15] RDMA/srpt: Fix handling of iWARP logins Bart Van Assche
2019-10-02 14:16   ` Jason Gunthorpe
2019-10-02 15:23     ` Bart Van Assche
2019-09-30 23:17 ` [PATCH 11/15] RDMA/srpt: Improve a debug message Bart Van Assche
2019-09-30 23:17 ` [PATCH 12/15] RDMA/srpt: Rework the approach for closing an RDMA channel Bart Van Assche
2019-09-30 23:17 ` [PATCH 13/15] RDMA/srpt: Rework the code that waits until an RDMA port is no longer in use Bart Van Assche
2019-09-30 23:17 ` [PATCH 14/15] RDMA/srpt: Make the code for handling port identities more systematic Bart Van Assche
2019-09-30 23:17 ` [PATCH 15/15] RDMA/srpt: Postpone HCA removal until after configfs directory removal Bart Van Assche
2019-10-01 11:39 ` Bernard Metzler [this message]
2019-10-01 11:45 ` [PATCH 04/15] RDMA/siw: Fix port number endianness in a debug message Bernard Metzler
2019-10-04 18:36 ` [PATCH 00/15] RDMA patches for kernel v5.5 Jason Gunthorpe

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=OF073BA5F3.9EA2563D-ON00258486.004013F1-00258486.004013F8@notes.na.collabserv.com \
    --to=bmt@zurich.ibm.com \
    --cc=bvanassche@acm.org \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).