diff mbox series

[net,v2] selftests: txtimestamp: fix compilation issue

Message ID 1612452064-20797-1-git-send-email-vfedorenko@novek.ru (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net,v2] selftests: txtimestamp: fix compilation issue | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers warning 4 maintainers not CCed: shuah@kernel.org linux-kselftest@vger.kernel.org davem@davemloft.net willemb@google.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 35 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Vadim Fedorenko Feb. 4, 2021, 3:21 p.m. UTC
PACKET_TX_TIMESTAMP is defined in if_packet.h but it is not included in
test. It could be included instead of <netpacket/packet.h> otherwise
the error of redefinition arrives.

Fixes: 8fe2f761cae9 (net-timestamp: expand documentation)
Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>
---
 tools/testing/selftests/net/txtimestamp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Willem de Bruijn Feb. 4, 2021, 3:50 p.m. UTC | #1
On Thu, Feb 4, 2021 at 10:21 AM Vadim Fedorenko <vfedorenko@novek.ru> wrote:
>
> PACKET_TX_TIMESTAMP is defined in if_packet.h but it is not included in
> test. It could be included instead of <netpacket/packet.h> otherwise
> the error of redefinition arrives.
>
> Fixes: 8fe2f761cae9 (net-timestamp: expand documentation)

Needs quotes

  Fixes: 8fe2f761cae9 ("net-timestamp: expand documentation")

When resending, can you also revise "It could be included instead .. "
to "Include instead .."

And mention in the commit the other warning fixed at the same time.
Thanks for including that.

> Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>
Vadim Fedorenko Feb. 4, 2021, 4:23 p.m. UTC | #2
On 04.02.2021 15:50, Willem de Bruijn wrote:
> On Thu, Feb 4, 2021 at 10:21 AM Vadim Fedorenko <vfedorenko@novek.ru> wrote:
>>
>> PACKET_TX_TIMESTAMP is defined in if_packet.h but it is not included in
>> test. It could be included instead of <netpacket/packet.h> otherwise
>> the error of redefinition arrives.
>>
>> Fixes: 8fe2f761cae9 (net-timestamp: expand documentation)
> 
> Needs quotes
> 
>    Fixes: 8fe2f761cae9 ("net-timestamp: expand documentation")
> 
> When resending, can you also revise "It could be included instead .. "
> to "Include instead .."
> 
> And mention in the commit the other warning fixed at the same time.
> Thanks for including that.
> 
>> Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
>> Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>

Ok, no problem. Thanks for reviewing!
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/txtimestamp.c b/tools/testing/selftests/net/txtimestamp.c
index 490a8cc..3d6bf54 100644
--- a/tools/testing/selftests/net/txtimestamp.c
+++ b/tools/testing/selftests/net/txtimestamp.c
@@ -26,6 +26,7 @@ 
 #include <inttypes.h>
 #include <linux/errqueue.h>
 #include <linux/if_ether.h>
+#include <linux/if_packet.h>
 #include <linux/ipv6.h>
 #include <linux/net_tstamp.h>
 #include <netdb.h>
@@ -34,7 +35,6 @@ 
 #include <netinet/ip.h>
 #include <netinet/udp.h>
 #include <netinet/tcp.h>
-#include <netpacket/packet.h>
 #include <poll.h>
 #include <stdarg.h>
 #include <stdbool.h>
@@ -53,6 +53,7 @@ 
 #define NSEC_PER_USEC	1000L
 #define USEC_PER_SEC	1000000L
 #define NSEC_PER_SEC	1000000000LL
+#define PACKET_TX_TIMESTAMP		16
 
 /* command line parameters */
 static int cfg_proto = SOCK_STREAM;
@@ -495,12 +496,12 @@  static void do_test(int family, unsigned int report_opt)
 	total_len = cfg_payload_len;
 	if (cfg_use_pf_packet || cfg_proto == SOCK_RAW) {
 		total_len += sizeof(struct udphdr);
-		if (cfg_use_pf_packet || cfg_ipproto == IPPROTO_RAW)
+		if (cfg_use_pf_packet || cfg_ipproto == IPPROTO_RAW) {
 			if (family == PF_INET)
 				total_len += sizeof(struct iphdr);
 			else
 				total_len += sizeof(struct ipv6hdr);
-
+		}
 		/* special case, only rawv6_sendmsg:
 		 * pass proto in sin6_port if not connected
 		 * also see ANK comment in net/ipv4/raw.c