Re: [PATCH] libtraceevent plugins: Add plugin_net to handle bswap during print
Steven Rostedt <[email protected]> Thu, 17 Apr 2025 07:49:00 -0400
| Newsgroups | org.kernel.vger.linux-trace-devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 17 Apr 2025 05:06:44 -0400 Petr Malat <[email protected]> wrote: > Sorry for the late reply, I tested my patch on mips, arm, arm64 and x86 and > it works everywhere, but for arm64 I had to add extra functions, because > it doesn't use the GCC __builin for swapping bytes. I have extended the > plugin and will send a new version. > > On mips using network order ntohs (and similar) expands to a cast only, so > the call to swap is not present. So if you record on x86 and read it on mips (or other big endian machines) does it produce the correct output? What about recording on mips and then reading it on x86? That is, do a "trace-cmd record" on a bigendian or little endian machine, then copying the trace.dat file to a machine with the opposite endian, and seeing if it still produces the correct output? BTW, libtraceevent also provides its own swap functions so if the GCC builtin is not always available, then it should use that instead. See the "tep_data2host*()" fuctions. But that may need to be updated as "tep_swapbytes*()" and have: if (!tep || tep->host_bigendian != tep->file_bigendian) return data; Instead. -- Steve