Netdev List
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: davem@davemloft.net
Cc: daniel@iogearbox.net, edumazet@google.com,
	netdev@vger.kernel.org, shaoyafang@didiglobal.com,
	Yafang Shao <laoar.shao@gmail.com>
Subject: [net-next 2/5] x25: clean up SOCK_DEBUG()
Date: Fri, 15 Feb 2019 22:49:44 +0800	[thread overview]
Message-ID: <1550242187-29660-3-git-send-email-laoar.shao@gmail.com> (raw)
In-Reply-To: <1550242187-29660-1-git-send-email-laoar.shao@gmail.com>

Per discussion with Daniel[1] and Eric[2], the SOCK_DEBUG() is a very
ancient interface, which is not very useful for debugging.
So we'd better clean up it.

This patch cleans up it for x25.

[1] https://patchwork.ozlabs.org/patch/1035573/
[2] https://patchwork.ozlabs.org/patch/1040533/

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 net/x25/af_x25.c         | 12 ------------
 net/x25/x25_facilities.c | 32 ++++++++++----------------------
 net/x25/x25_out.c        |  4 +---
 3 files changed, 11 insertions(+), 37 deletions(-)

diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 5121729..5892d05 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -705,7 +705,6 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 	x25_insert_socket(sk);
 	sock_reset_flag(sk, SOCK_ZAPPED);
 	release_sock(sk);
-	SOCK_DEBUG(sk, "x25_bind: socket is bound\n");
 out:
 	return rc;
 }
@@ -1148,11 +1147,7 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 		goto out;
 	}
 
-	SOCK_DEBUG(sk, "x25_sendmsg: sendto: Addresses built.\n");
-
 	/* Build a packet */
-	SOCK_DEBUG(sk, "x25_sendmsg: sendto: building packet.\n");
-
 	if ((msg->msg_flags & MSG_OOB) && len > 32)
 		len = 32;
 
@@ -1170,8 +1165,6 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 	/*
 	 *	Put the data on the end
 	 */
-	SOCK_DEBUG(sk, "x25_sendmsg: Copying user data\n");
-
 	skb_reset_transport_header(skb);
 	skb_put(skb, len);
 
@@ -1194,8 +1187,6 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 	/*
 	 *	Push down the X.25 header
 	 */
-	SOCK_DEBUG(sk, "x25_sendmsg: Building X.25 Header.\n");
-
 	if (msg->msg_flags & MSG_OOB) {
 		if (x25->neighbour->extended) {
 			asmptr    = skb_push(skb, X25_STD_MIN_LEN);
@@ -1228,9 +1219,6 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 			skb->data[0] |= X25_Q_BIT;
 	}
 
-	SOCK_DEBUG(sk, "x25_sendmsg: Built header.\n");
-	SOCK_DEBUG(sk, "x25_sendmsg: Transmitting buffer\n");
-
 	rc = -ENOTCONN;
 	if (sk->sk_state != TCP_ESTABLISHED)
 		goto out_kfree_skb;
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c
index ad1734d..74a5284 100644
--- a/net/x25/x25_facilities.c
+++ b/net/x25/x25_facilities.c
@@ -286,10 +286,8 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
 	/*
 	 *	They want reverse charging, we won't accept it.
 	 */
-	if ((theirs.reverse & 0x01 ) && (ours->reverse & 0x01)) {
-		SOCK_DEBUG(sk, "X.25: rejecting reverse charging request\n");
+	if ((theirs.reverse & 0x01) && (ours->reverse & 0x01))
 		return -1;
-	}
 
 	new->reverse = theirs.reverse;
 
@@ -298,37 +296,27 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
 		int theirs_out = theirs.throughput & 0xf0;
 		int ours_in  = ours->throughput & 0x0f;
 		int ours_out = ours->throughput & 0xf0;
-		if (!ours_in || theirs_in < ours_in) {
-			SOCK_DEBUG(sk, "X.25: inbound throughput negotiated\n");
+		if (!ours_in || theirs_in < ours_in)
 			new->throughput = (new->throughput & 0xf0) | theirs_in;
-		}
-		if (!ours_out || theirs_out < ours_out) {
-			SOCK_DEBUG(sk,
-				"X.25: outbound throughput negotiated\n");
+
+		if (!ours_out || theirs_out < ours_out)
 			new->throughput = (new->throughput & 0x0f) | theirs_out;
-		}
 	}
 
 	if (theirs.pacsize_in && theirs.pacsize_out) {
-		if (theirs.pacsize_in < ours->pacsize_in) {
-			SOCK_DEBUG(sk, "X.25: packet size inwards negotiated down\n");
+		if (theirs.pacsize_in < ours->pacsize_in)
 			new->pacsize_in = theirs.pacsize_in;
-		}
-		if (theirs.pacsize_out < ours->pacsize_out) {
-			SOCK_DEBUG(sk, "X.25: packet size outwards negotiated down\n");
+
+		if (theirs.pacsize_out < ours->pacsize_out)
 			new->pacsize_out = theirs.pacsize_out;
-		}
 	}
 
 	if (theirs.winsize_in && theirs.winsize_out) {
-		if (theirs.winsize_in < ours->winsize_in) {
-			SOCK_DEBUG(sk, "X.25: window size inwards negotiated down\n");
+		if (theirs.winsize_in < ours->winsize_in)
 			new->winsize_in = theirs.winsize_in;
-		}
-		if (theirs.winsize_out < ours->winsize_out) {
-			SOCK_DEBUG(sk, "X.25: window size outwards negotiated down\n");
+
+		if (theirs.winsize_out < ours->winsize_out)
 			new->winsize_out = theirs.winsize_out;
-		}
 	}
 
 	return len;
diff --git a/net/x25/x25_out.c b/net/x25/x25_out.c
index 0144271..2a74f26 100644
--- a/net/x25/x25_out.c
+++ b/net/x25/x25_out.c
@@ -77,9 +77,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb)
 					kfree_skb(skb);
 					return sent;
 				}
-				SOCK_DEBUG(sk, "x25_output: fragment alloc"
-					       " failed, err=%d, %d bytes "
-					       "sent\n", err, sent);
+
 				return err;
 			}
 
-- 
1.8.3.1


  parent reply	other threads:[~2019-02-15 14:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 14:49 [net-next 0/5] clean up SOCK_DEBUG() Yafang Shao
2019-02-15 14:49 ` [net-next 1/5] tcp: " Yafang Shao
2019-02-15 14:49 ` Yafang Shao [this message]
2019-02-15 14:49 ` [net-next 3/5] appletalk: " Yafang Shao
2019-02-15 14:49 ` [net-next 4/5] dccp: " Yafang Shao
2019-02-15 14:49 ` [net-next 5/5] net: sock: remove the definition of SOCK_DEBUG() Yafang Shao
2019-02-15 14:58   ` Eric Dumazet
2019-02-15 15:41     ` Yafang Shao
2019-02-15 15:54       ` Eric Dumazet
2019-02-15 18:12     ` Cong Wang
2019-02-15 18:22       ` Eric Dumazet
2019-02-15 18:51         ` Joe Perches
2019-02-16  2:50           ` Yafang Shao

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=1550242187-29660-3-git-send-email-laoar.shao@gmail.com \
    --to=laoar.shao@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=shaoyafang@didiglobal.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