From: Tal Yacobi <talycb8@gmail.com>
To: jk@codeconstruct.com.au, matt@codeconstruct.com.au,
rostedt@goodmis.org, mhiramat@kernel.org,
mathieu.desnoyers@efficios.com, talycb8@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org
Subject: [PATCH] mctp i2c: Add rx trace
Date: Tue, 28 May 2024 17:34:20 +0300 [thread overview]
Message-ID: <20240528143420.742611-1-talycb8@gmail.com> (raw)
mctp-i2c rx implementation doesn't call
__i2c_transfer which calls the i2c reply trace function.
Add an mctp_reply trace function that will be used instead.
Signed-off-by: Tal Yacobi <talycb8@gmail.com>
---
drivers/net/mctp/mctp-i2c.c | 3 +++
include/trace/events/mctp.h | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c
index b37a9e4bade4..22754f4e4a8d 100644
--- a/drivers/net/mctp/mctp-i2c.c
+++ b/drivers/net/mctp/mctp-i2c.c
@@ -24,6 +24,7 @@
#include <linux/if_arp.h>
#include <net/mctp.h>
#include <net/mctpdevice.h>
+#include <trace/events/mctp.h>
/* byte_count is limited to u8 */
#define MCTP_I2C_MAXBLOCK 255
@@ -312,6 +313,8 @@ static int mctp_i2c_recv(struct mctp_i2c_dev *midev)
return -ENOMEM;
}
+ trace_mctp_reply(midev->rx_buffer, recvlen);
+
skb->protocol = htons(ETH_P_MCTP);
skb_put_data(skb, midev->rx_buffer, recvlen);
skb_reset_mac_header(skb);
diff --git a/include/trace/events/mctp.h b/include/trace/events/mctp.h
index 165cf25f77a7..d115c353dff9 100644
--- a/include/trace/events/mctp.h
+++ b/include/trace/events/mctp.h
@@ -73,6 +73,22 @@ TRACE_EVENT(mctp_key_release,
)
);
+TRACE_EVENT(mctp_reply,
+ TP_PROTO(const u8 *rx_buffer, const size_t recvlen),
+ TP_ARGS(rx_buffer, recvlen),
+ TP_STRUCT__entry(
+ __field(__u16, len)
+ __dynamic_array(__u8, buf, recvlen)),
+ TP_fast_assign(
+ __entry->len = (__u16) recvlen;
+ memcpy(__get_dynamic_array(buf), rx_buffer, recvlen);
+ ),
+ TP_printk("l=%u [%*phD]",
+ __entry->len,
+ __entry->len, __get_dynamic_array(buf)
+ )
+);
+
#endif
#include <trace/define_trace.h>
--
2.43.0
next reply other threads:[~2024-05-28 14:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 14:34 Tal Yacobi [this message]
2024-05-28 23:54 ` [PATCH] mctp i2c: Add rx trace Jeremy Kerr
2024-05-29 17:01 ` Tal Yacobi
2024-05-30 8:42 ` Jeremy Kerr
2024-05-31 22:13 ` kernel test robot
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=20240528143420.742611-1-talycb8@gmail.com \
--to=talycb8@gmail.com \
--cc=jk@codeconstruct.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=matt@codeconstruct.com.au \
--cc=mhiramat@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.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).