* [PATCH net-next v2 1/2] selftests/txtimestamp: Add more configurable parameters
2018-03-14 21:54 [PATCH net-next v2 0/2] skbuff: Fix applications not being woken for errors Vinicius Costa Gomes
@ 2018-03-14 21:54 ` Vinicius Costa Gomes
2018-03-14 21:54 ` [PATCH net-next v2 2/2] skbuff: Fix not waking applications when errors are enqueued Vinicius Costa Gomes
2018-03-14 23:39 ` [PATCH net-next v2 0/2] skbuff: Fix applications not being woken for errors Andrew Lunn
2 siblings, 0 replies; 4+ messages in thread
From: Vinicius Costa Gomes @ 2018-03-14 21:54 UTC (permalink / raw)
To: netdev; +Cc: Vinicius Costa Gomes, randy.e.witt, davem, eric.dumazet
Add a way to configure if poll() should wait forever for an event, the
number of packets that should be sent for each and if there should be
any delay between packets.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
.../selftests/networking/timestamping/txtimestamp.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/networking/timestamping/txtimestamp.c b/tools/testing/selftests/networking/timestamping/txtimestamp.c
index 5df07047ca86..81a98a240456 100644
--- a/tools/testing/selftests/networking/timestamping/txtimestamp.c
+++ b/tools/testing/selftests/networking/timestamping/txtimestamp.c
@@ -68,9 +68,11 @@ static int cfg_num_pkts = 4;
static int do_ipv4 = 1;
static int do_ipv6 = 1;
static int cfg_payload_len = 10;
+static int cfg_poll_timeout = 100;
static bool cfg_show_payload;
static bool cfg_do_pktinfo;
static bool cfg_loop_nodata;
+static bool cfg_no_delay;
static uint16_t dest_port = 9000;
static struct sockaddr_in daddr;
@@ -171,7 +173,7 @@ static void __poll(int fd)
memset(&pollfd, 0, sizeof(pollfd));
pollfd.fd = fd;
- ret = poll(&pollfd, 1, 100);
+ ret = poll(&pollfd, 1, cfg_poll_timeout);
if (ret != 1)
error(1, errno, "poll");
}
@@ -371,7 +373,8 @@ static void do_test(int family, unsigned int opt)
error(1, errno, "send");
/* wait for all errors to be queued, else ACKs arrive OOO */
- usleep(50 * 1000);
+ if (!cfg_no_delay)
+ usleep(50 * 1000);
__poll(fd);
@@ -392,6 +395,9 @@ static void __attribute__((noreturn)) usage(const char *filepath)
" -4: only IPv4\n"
" -6: only IPv6\n"
" -h: show this message\n"
+ " -c N: number of packets for each test\n"
+ " -D: no delay between packets\n"
+ " -F: poll() waits forever for an event\n"
" -I: request PKTINFO\n"
" -l N: send N bytes at a time\n"
" -n: set no-payload option\n"
@@ -409,7 +415,7 @@ static void parse_opt(int argc, char **argv)
int proto_count = 0;
char c;
- while ((c = getopt(argc, argv, "46hIl:np:rRux")) != -1) {
+ while ((c = getopt(argc, argv, "46c:DFhIl:np:rRux")) != -1) {
switch (c) {
case '4':
do_ipv6 = 0;
@@ -417,6 +423,15 @@ static void parse_opt(int argc, char **argv)
case '6':
do_ipv4 = 0;
break;
+ case 'c':
+ cfg_num_pkts = strtoul(optarg, NULL, 10);
+ break;
+ case 'D':
+ cfg_no_delay = true;
+ break;
+ case 'F':
+ cfg_poll_timeout = -1;
+ break;
case 'I':
cfg_do_pktinfo = true;
break;
--
2.16.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net-next v2 2/2] skbuff: Fix not waking applications when errors are enqueued
2018-03-14 21:54 [PATCH net-next v2 0/2] skbuff: Fix applications not being woken for errors Vinicius Costa Gomes
2018-03-14 21:54 ` [PATCH net-next v2 1/2] selftests/txtimestamp: Add more configurable parameters Vinicius Costa Gomes
@ 2018-03-14 21:54 ` Vinicius Costa Gomes
2018-03-14 23:39 ` [PATCH net-next v2 0/2] skbuff: Fix applications not being woken for errors Andrew Lunn
2 siblings, 0 replies; 4+ messages in thread
From: Vinicius Costa Gomes @ 2018-03-14 21:54 UTC (permalink / raw)
To: netdev; +Cc: Vinicius Costa Gomes, randy.e.witt, davem, eric.dumazet
When errors are enqueued to the error queue via sock_queue_err_skb()
function, it is possible that the waiting application is not notified.
Calling 'sk->sk_data_ready()' would not notify applications that
selected only POLLERR events in poll() (for example).
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Randy E. Witt <randy.e.witt@intel.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
net/core/skbuff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 715c13495ba6..6def3534f509 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4181,7 +4181,7 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
skb_queue_tail(&sk->sk_error_queue, skb);
if (!sock_flag(sk, SOCK_DEAD))
- sk->sk_data_ready(sk);
+ sk->sk_error_report(sk);
return 0;
}
EXPORT_SYMBOL(sock_queue_err_skb);
--
2.16.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next v2 0/2] skbuff: Fix applications not being woken for errors
2018-03-14 21:54 [PATCH net-next v2 0/2] skbuff: Fix applications not being woken for errors Vinicius Costa Gomes
2018-03-14 21:54 ` [PATCH net-next v2 1/2] selftests/txtimestamp: Add more configurable parameters Vinicius Costa Gomes
2018-03-14 21:54 ` [PATCH net-next v2 2/2] skbuff: Fix not waking applications when errors are enqueued Vinicius Costa Gomes
@ 2018-03-14 23:39 ` Andrew Lunn
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2018-03-14 23:39 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: netdev, randy.e.witt, davem, eric.dumazet
On Wed, Mar 14, 2018 at 02:54:35PM -0700, Vinicius Costa Gomes wrote:
> Hi,
>
> Changes from v1:
> - Fixed comments from Willem de Bruijn, about the order of the
> options passed to getopt();
> - Added Reviewed-by and Fixes tags to patch (2);
>
> Changes from the RFC:
> - tweaked commit messages;
>
> Original cover letter:
>
> This is actually a "bug report"-RFC instead of the more usual "new
> feature"-RFC.
>
> We are developing an application that uses TX hardware timestamping to
> make some measurements, and during development Randy Witt initially
> reported that the application poll() never unblocked when TX hardware
> timestamping was enabled.
Hi Vinicius
This sounds a lot like an issue i was chasing a month ago with ptp4l
and the newly added PTP support for Marvell switch chips. I was seeing
poll not unblocking, and when it did, the sequence numbers for PTP
messages indicating they were old. But it suddenly started working,
and i've not been able to reproduce it again.
> (my hypothesis is that only triggers when the error is reported from
> a different task context than the application).
The case i was having problems with, it is a kernel task which does
the error reporting, which is clearly a different context to the ptp4l
application. So your hypothesis could be correct.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread