[PATCH] mptcp: move pr_fmt defining to protocol.h
From: Geliang Tang
Date: Fri Apr 03 2020 - 03:59:43 EST
Some of the mptcp logs didn't print out the format string "MPTCP":
[ 129.185774] DSS
[ 129.185774] data_fin=0 dsn64=1 use_map=1 ack64=1 use_ack=1
[ 129.185774] data_ack=5481534886531492085
[ 129.185775] data_seq=15725204003114694615 subflow_seq=1425409 data_len=5216
[ 129.185776] subflow=0000000093526a92 fully established=1 seq=0:0 remaining=28
[ 129.185776] MPTCP: msk=00000000d5a704a6 ssk=00000000b5aabc31 data_avail=0 skb=0000000088f05424
[ 129.185777] MPTCP: seq=15725204003114694615 is64=1 ssn=1425409 data_len=5216 data_fin=0
[ 129.185777] MPTCP: msk=00000000d5a704a6 ssk=00000000b5aabc31 status=0
[ 129.185778] MPTCP: msk ack_seq=da3b25b9a233c2c7 subflow ack_seq=da3b25b9a233c2c7
[ 129.185778] MPTCP: msk=00000000d5a704a6 ssk=00000000b5aabc31 data_avail=1 skb=000000000caed2cc
[ 129.185779] subflow=0000000093526a92 fully established=1 seq=0:0 remaining=28
So this patch moves the pr_fmt defining from protocol.c to protocol.h, which
is included by all the C files. Then we can get the same format string
"MPTCP" in all mptcp logs like this:
[ 141.854787] MPTCP: DSS
[ 141.854788] MPTCP: data_fin=0 dsn64=1 use_map=1 ack64=1 use_ack=1
[ 141.854788] MPTCP: data_ack=18028325517710311871
[ 141.854788] MPTCP: data_seq=6163976859259356786 subflow_seq=3309569 data_len=8192
[ 141.854789] MPTCP: msk=000000005847a66a ssk=0000000022469903 data_avail=0 skb=00000000dd95efc3
[ 141.854789] MPTCP: seq=6163976859259356786 is64=1 ssn=3309569 data_len=8192 data_fin=0
[ 141.854790] MPTCP: msk=000000005847a66a ssk=0000000022469903 status=0
[ 141.854790] MPTCP: msk ack_seq=558ad84b9be1d162 subflow ack_seq=558ad84b9be1d162
[ 141.854791] MPTCP: msk=000000005847a66a ssk=0000000022469903 data_avail=1 skb=000000000b8926f6
[ 141.854791] MPTCP: subflow=00000000e4e4579c fully established=1 seq=0:0 remaining=28
[ 141.854792] MPTCP: subflow=00000000e4e4579c fully established=1 seq=0:dcdf2f3b remaining=28
Signed-off-by: Geliang Tang <geliangtang@xxxxxxxxx>
---
net/mptcp/protocol.c | 2 --
net/mptcp/protocol.h | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 72f3176dc924..cc86137cd04f 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4,8 +4,6 @@
* Copyright (c) 2017 - 2019, Intel Corporation.
*/
-#define pr_fmt(fmt) "MPTCP: " fmt
-
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 67448002a2d7..3eff041eeccf 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -7,6 +7,8 @@
#ifndef __MPTCP_PROTOCOL_H
#define __MPTCP_PROTOCOL_H
+#define pr_fmt(fmt) "MPTCP: " fmt
+
#include <linux/random.h>
#include <net/tcp.h>
#include <net/inet_connection_sock.h>
--
2.17.1