From patchwork Mon Feb 11 18:07:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1040055 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="asdoEMMK"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43ytyT4Myxz9sCh for ; Tue, 12 Feb 2019 05:06:20 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4EC262D012C for ; Mon, 11 Feb 2019 19:06:17 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id 79C832D0072 for ; Mon, 11 Feb 2019 19:06:15 +0100 (CET) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id C48621001195 for ; Mon, 11 Feb 2019 19:06:13 +0100 (CET) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1BI4TQm035702 for ; Mon, 11 Feb 2019 18:06:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=iKrK5rmBBNtpDjfheRMEUc1sPmzo/p1q2CnIf3NgUNI=; b=asdoEMMKHV63THAyaaWFHo5qu1hO9yz1LXUwmdKYfgYhfGDzB52Gr1r91JDqCnxARl2p l2ei/3eSTZZRcNe3U6MABS5NZt0YXI0YQ4yI8UySPX3+5YybVzTngLGx7eLeTrzNKZjr YsFisgp7K02InPFQ1ROu+SYqr5kNNN+IEBlQx+F+9eMrwZ1WFilr3wOW8QIz8mV79QEB 0jXUKTScrw4G49d4IbOm8h2bgnzYIufdDitJyFUd98n6lWKhWlDDP2mO50glg99iHgzE 3DyZiLhR6thMZ1117uP0lT1EuZ2Fb63i2Q3K60YnS4dwABWnr9jc4A3Fck60c+qxGC0f XQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2qhrek7c73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 11 Feb 2019 18:06:12 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x1BI6CgG005481 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 11 Feb 2019 18:06:12 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x1BI6BHm001073 for ; Mon, 11 Feb 2019 18:06:12 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 11 Feb 2019 10:06:10 -0800 From: Alexey Kodanev To: ltp@lists.linux.it Date: Mon, 11 Feb 2019 21:07:44 +0300 Message-Id: <1549908467-15609-2-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1549908467-15609-1-git-send-email-alexey.kodanev@oracle.com> References: <1549908467-15609-1-git-send-email-alexey.kodanev@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9164 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902110135 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 1/4] netstress: support SO_REUSEPORT with new 'P' flag X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" netstress tool can be used manually by setting -P flag for a server. There is no test-case yet that specifically auto tests this functionality or uses it, but it should be easy to create one. For example, starting multiple netstress instances on the same port. Signed-off-by: Alexey Kodanev Reviewed-by: Petr Vorel --- testcases/network/netstress/netstress.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c index 2c5a6bd..2cdc91a 100644 --- a/testcases/network/netstress/netstress.c +++ b/testcases/network/netstress/netstress.c @@ -147,6 +147,7 @@ struct sock_info { static char *zcopy; static int send_flags = MSG_NOSIGNAL; +static char *reuse_port; static void init_socket_opts(int sd) { @@ -308,6 +309,8 @@ static void bind_before_connect(int sd) if (bind_no_port) SAFE_SETSOCKOPT_INT(sd, SOL_IP, IP_BIND_ADDRESS_NO_PORT, 1); + if (reuse_port) + SAFE_SETSOCKOPT_INT(sd, SOL_SOCKET, SO_REUSEPORT, 1); SAFE_BIND(sd, local_addrinfo->ai_addr, local_addrinfo->ai_addrlen); @@ -674,6 +677,8 @@ static void server_init(void) /* IPv6 socket is also able to access IPv4 protocol stack */ sfd = SAFE_SOCKET(family, sock_type, protocol); SAFE_SETSOCKOPT_INT(sfd, SOL_SOCKET, SO_REUSEADDR, 1); + if (reuse_port) + SAFE_SETSOCKOPT_INT(sfd, SOL_SOCKET, SO_REUSEPORT, 1); tst_res(TINFO, "assigning a name to the server socket..."); SAFE_BIND(sfd, local_addrinfo->ai_addr, local_addrinfo->ai_addrlen); @@ -996,6 +1001,7 @@ static struct tst_option options[] = { {"b:", &barg, "-b x x - low latency busy poll timeout"}, {"T:", &type, "-T x tcp (default), udp, udp_lite, dccp, sctp"}, {"z", &zcopy, "-z enable SO_ZEROCOPY"}, + {"P:", &reuse_port, "-P enable SO_REUSEPORT"}, {"D:", &dev, "-d x bind to device x\n"}, {"H:", &server_addr, "Client:\n-H x Server name or IP address"},