From patchwork Fri Feb 15 14:49:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 1042935 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FaKLyxGf"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 441GQM2tf1z9s5c for ; Sat, 16 Feb 2019 01:50:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729357AbfBOOuS (ORCPT ); Fri, 15 Feb 2019 09:50:18 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:33399 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbfBOOuR (ORCPT ); Fri, 15 Feb 2019 09:50:17 -0500 Received: by mail-pf1-f193.google.com with SMTP id c123so4955298pfb.0 for ; Fri, 15 Feb 2019 06:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZkqtwfokUFc5I4iISMT6Gjm9InpN3fFLQAXzafQBKKs=; b=FaKLyxGfLHaC+Z46t7jYssq0IaRb6eAo6bnEOnOe2ULH3s4f67YIKS/Cr2iMNADuS5 lFE6uE+F5pBwLY/lzurUtWaZym7ZOmssmCKteA7zq7kee8w/Uo+eY0q4TCUlSFAJZdEv kI92ce/4q4r5xVeF1CMzCemQRlIIYXvHFofUGP0dUV5cMTC6xOAcJ6R+qtqvHkH7uvYL ObJibhX0QAVUxt/HYuxppFm9YSiEtp66SZBAzNO1oy48vponO8zoGW3sSX32RfSVvsRQ G8Y9x9lzfwzYcy1DsZmSLjVRJGon5EnKUjyJvW7Elqr6Pv0Qp3R3OqLittD/h3PTOo6D nApQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZkqtwfokUFc5I4iISMT6Gjm9InpN3fFLQAXzafQBKKs=; b=XcC2Rctqx6dUSWpPHn4OFTFWIq/rrZPvcv2C9EWW5tD5t0IPyoRK9kjG0/Ncw6Hv8g ENJcgbgYIGTSz0Ggo0vUZdDbQ//Rozn7hDa5opw6Y2EYK36Vmrd8QFJVONhjBm0x+yWs ofUp78Yi5wlIbRGgvmHsq+mlfMVFSeiYDYe3eC0k2FsO0MJ5DysMJBCiEJitO+hzFDTG DK0Or+JjyNqO1K+h5k961mSxhhqT2PQlxMa1Pn5goukLGKRx6tnqCESphpcYHM8CI8dI N6M1bMfT2oNJ/OYWLK8e8qUBGOgE6pUIQ8pr2cfa7GBFAmU2b64efs6pbJwsHCkMNOkU iUnw== X-Gm-Message-State: AHQUAuY5hMVNCC9byQTCd6xQ1V4dJMLtPx9lRPu/94RwcoUpaX8/5FwF P4vH9d9Rmg0YlRjP24zRkXQ= X-Google-Smtp-Source: AHgI3IbR6s9SD/N9Bvv1pvbxoWRYQYflmmN6qcqu0tO0H8XU4hKHq048UAFTiJXeg16o7FvHMDthyA== X-Received: by 2002:a62:5f07:: with SMTP id t7mr10148833pfb.108.1550242216589; Fri, 15 Feb 2019 06:50:16 -0800 (PST) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id k65sm1900870pge.74.2019.02.15.06.50.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Feb 2019 06:50:15 -0800 (PST) From: Yafang Shao To: davem@davemloft.net Cc: daniel@iogearbox.net, edumazet@google.com, netdev@vger.kernel.org, shaoyafang@didiglobal.com, Yafang Shao Subject: [net-next 2/5] x25: clean up SOCK_DEBUG() Date: Fri, 15 Feb 2019 22:49:44 +0800 Message-Id: <1550242187-29660-3-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1550242187-29660-1-git-send-email-laoar.shao@gmail.com> References: <1550242187-29660-1-git-send-email-laoar.shao@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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; }