From patchwork Tue Mar 13 20:35:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Costa Gomes X-Patchwork-Id: 885468 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40167D2QJSz9sRG for ; Wed, 14 Mar 2018 07:35:36 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932472AbeCMUfe (ORCPT ); Tue, 13 Mar 2018 16:35:34 -0400 Received: from mga03.intel.com ([134.134.136.65]:31092 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932257AbeCMUf0 (ORCPT ); Tue, 13 Mar 2018 16:35:26 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2018 13:35:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,466,1515484800"; d="scan'208";a="34715655" Received: from ellie.jf.intel.com (HELO localhost.localdomain) ([10.54.70.23]) by orsmga003.jf.intel.com with ESMTP; 13 Mar 2018 13:35:25 -0700 From: Vinicius Costa Gomes To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , randy.e.witt@intel.com, davem@davemloft.net, eric.dumazet@gmail.com Subject: [PATCH net-next 1/2] selftests/txtimestamp: Add more configurable parameters Date: Tue, 13 Mar 2018 13:35:18 -0700 Message-Id: <20180313203519.8638-2-vinicius.gomes@intel.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313203519.8638-1-vinicius.gomes@intel.com> References: <20180313203519.8638-1-vinicius.gomes@intel.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- .../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..5190b1dd78b1 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); @@ -397,6 +400,9 @@ static void __attribute__((noreturn)) usage(const char *filepath) " -n: set no-payload option\n" " -r: use raw\n" " -R: use raw (IP_HDRINCL)\n" + " -D: no delay between packets\n" + " -F: poll() waits forever for an event\n" + " -c N: number of packets for each test\n" " -p N: connect to port N\n" " -u: use udp\n" " -x: show payload (up to 70 bytes)\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, "46hIl:np:rRuxc:DF")) != -1) { switch (c) { case '4': do_ipv6 = 0; @@ -447,6 +453,15 @@ static void parse_opt(int argc, char **argv) case 'x': cfg_show_payload = true; 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 'h': default: usage(argv[0]); From patchwork Tue Mar 13 20:35:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Costa Gomes X-Patchwork-Id: 885467 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4016790SW3z9sTD for ; Wed, 14 Mar 2018 07:35:33 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932277AbeCMUf0 (ORCPT ); Tue, 13 Mar 2018 16:35:26 -0400 Received: from mga03.intel.com ([134.134.136.65]:31092 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751997AbeCMUfZ (ORCPT ); Tue, 13 Mar 2018 16:35:25 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2018 13:35:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,466,1515484800"; d="scan'208";a="34715656" Received: from ellie.jf.intel.com (HELO localhost.localdomain) ([10.54.70.23]) by orsmga003.jf.intel.com with ESMTP; 13 Mar 2018 13:35:25 -0700 From: Vinicius Costa Gomes To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , randy.e.witt@intel.com, davem@davemloft.net, eric.dumazet@gmail.com Subject: [PATCH net-next 2/2] skbuff: Fix not waking applications when errors are enqueued Date: Tue, 13 Mar 2018 13:35:19 -0700 Message-Id: <20180313203519.8638-3-vinicius.gomes@intel.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313203519.8638-1-vinicius.gomes@intel.com> References: <20180313203519.8638-1-vinicius.gomes@intel.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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). Reported-by: Randy E. Witt Signed-off-by: Vinicius Costa Gomes Reviewed-by: Eric Dumazet --- 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);