From patchwork Thu Apr 20 08:22:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13218136 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45540C77B73 for ; Thu, 20 Apr 2023 08:23:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234239AbjDTIW7 (ORCPT ); Thu, 20 Apr 2023 04:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234194AbjDTIWx (ORCPT ); Thu, 20 Apr 2023 04:22:53 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF2A44692 for ; Thu, 20 Apr 2023 01:22:43 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1a69f686345so7515405ad.2 for ; Thu, 20 Apr 2023 01:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681978962; x=1684570962; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4CKVN4OgWp070dKsrCkzTlYbbB9LErF2cMznFtz8ihA=; b=U+q2QZFhbZYxMbF0dbFyb9S5GKs0L3HFdPBnNXVdBBQlhBECn0KI/bxq1RaMbTw7u5 K+VtRMO5dRvnj8NRjp6syeRTdJNFMsj3bsvH39wM1MFyM6XTcFog28PsIdle5Hf5BPk7 HOfQqEkuocV77bRU6HqnOSiVpJwZhKZDmec8Sh10aHlpbDRtlFN44j/9swE/05P4+jT1 YvKmlBQ0ae8Q5ccKxcgD1ZcQZCo190d6EgdTP/0ocAHBRkVAc3d+r0T4rb0tbKm2EqSC 7lSSIDeX1UUPmvTWuubWqOmO9m8vl66MGb/fjEvUdsx/OQIxNjX3F7As9JYTHTk1dCHZ FY7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681978962; x=1684570962; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4CKVN4OgWp070dKsrCkzTlYbbB9LErF2cMznFtz8ihA=; b=iTijhZZfhamfKzEm8GlSICjsrV+TYBklyY2HKhyWnLi8hYNiOnuVyieVevSbKrtVeF n3Wo9e0GVnTNflcDTpeWLMnHpb2h1KUFw+kII/F8ljRewTI3gHmTdxl6T0UJOUNUD/sG OZV9//Sg/dc5YB73zpBROMHua/UlhlyKUiA53YpveQNSkXTBK3TK3ZXE3J5PZOyJeBSY me9uxwj2gpbahg4jSSuXB9ymBUNgapRb708WDVaTVDtXjeoQXrZXUzLGj3xIaikBH0l+ Bmx6ZpbCmoUKY/WV9kzOrEYFXKQyfwLax8rd3EFtqVwEu/tsa986TLCCfIOYflp0+EZC zLBw== X-Gm-Message-State: AAQBX9eGhZsWa9e5cI5OOrcdTM4UG0VsQSNRxjbiGEgZWdmDb85NsHzK OxoF6vVVsTOBsrCcy/gm0Eg//6dHRFPlI5T7RPc= X-Google-Smtp-Source: AKy350YJqcGbiwB2bgu7QFs0lE5fjqGwPHbI6UVJFivkq/6M9NxmFItuqLfL+icy0uzjF33mcszCJw== X-Received: by 2002:a17:903:2444:b0:1a9:23b7:9182 with SMTP id l4-20020a170903244400b001a923b79182mr1303987pls.27.1681978962525; Thu, 20 Apr 2023 01:22:42 -0700 (PDT) Received: from Laptop-X1.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id l11-20020a170902d34b00b001a1ed2fce9asm662175plk.235.2023.04.20.01.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 01:22:41 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: Jay Vosburgh , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Liang Li , Vincent Bernat , Hangbin Liu Subject: [PATCH net 1/4] bonding: fix send_peer_notif overflow Date: Thu, 20 Apr 2023 16:22:27 +0800 Message-Id: <20230420082230.2968883-2-liuhangbin@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230420082230.2968883-1-liuhangbin@gmail.com> References: <20230420082230.2968883-1-liuhangbin@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Bonding send_peer_notif was defined as u8. Since commit 07a4ddec3ce9 ("bonding: add an option to specify a delay between peer notifications"). the bond->send_peer_notif will be num_peer_notif multiplied by peer_notif_delay, which is u8 * u32. This would cause the send_peer_notif overflow easily. e.g. ip link add bond0 type bond mode 1 miimon 100 num_grat_arp 30 peer_notify_delay 1000 To fix the overflow, we have to set the send_peer_notif large enough. Fixes: 07a4ddec3ce9 ("bonding: add an option to specify a delay between peer notifications") Reported-by: Liang Li Signed-off-by: Hangbin Liu --- include/net/bonding.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/bonding.h b/include/net/bonding.h index c3843239517d..f4d376420e4d 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h @@ -233,7 +233,7 @@ struct bonding { */ spinlock_t mode_lock; spinlock_t stats_lock; - u8 send_peer_notif; + u64 send_peer_notif; u8 igmp_retrans; #ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_entry; From patchwork Thu Apr 20 08:22:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13218137 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21F5EC77B72 for ; Thu, 20 Apr 2023 08:23:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234421AbjDTIXB (ORCPT ); Thu, 20 Apr 2023 04:23:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234106AbjDTIW6 (ORCPT ); Thu, 20 Apr 2023 04:22:58 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B147A4EC7 for ; Thu, 20 Apr 2023 01:22:47 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1a66911f5faso7687615ad.0 for ; Thu, 20 Apr 2023 01:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681978966; x=1684570966; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+G6vgR3v0UbcyeLgoVJtbhyjb8Bnzg2BuB5vx6ENGSs=; b=gmHpqIYsFEawOoh6e/kYnNpsHMaFPJZafvyLbrYNV62K0tMz3a9gzV5FoV5+AOuj1f Hg6VHB3+T8L68chbn4wLx+AJvlnF50YnFWMGP1a7AT0q702poyfVJ4OFrRvMF09j3tmM fQT/lUMF7OqM91hE7tSUYVMBHX7eSHb47Ysq1G5yIRwf9knD29gquOIG8C7GJZVFcE3T 4ps3aMIqOF3TpV1PnHn9V8qmvISjL3+YeeuYgVzeF+5SgSQHdvMp3pyYKjFe7Qch+BQM XlMuAIn7nJvLyzBLaLKy7nWZCSIz5OfeHrjDCmXTyIvpzTAV1sfZi5WOI7sngF7UOA+t LMpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681978966; x=1684570966; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+G6vgR3v0UbcyeLgoVJtbhyjb8Bnzg2BuB5vx6ENGSs=; b=aBiHYsIkFtGPRgs0SfWCksX9/0mk4+foQNpkXQKSdS+7pqakxRB26H40EgUc0toq70 pl4WD0M/fiNukcPi1q6KpV97kr/wglwnFjgFOv6ui1lWrOLagOugIBT0ShTKzbX/OTon Wg+aWFsAYkzI6w3A/73QN6mIffWTOS8bNGawfQCOBFQSVH5v+ZUwZc9j7h2o0onHyQE5 XLSynfwosoJz41iYPrMioZr4sYMd/hn/LnEX/lhAY6vNLX5Lk+/T7RbDstYTxNKy7AZh dT/dvQfunH4UfyOSc8sh8xAo/b7u2kRVhsd19Y50RZkU5qsGX96/oOMzYAmczyUkTYan B8hA== X-Gm-Message-State: AAQBX9f4OdUknZkh2YOX4DwlWSBw38R5Oq6PwBRPUCUVp6LtsnrDwbk6 hZ5EpNAtOgQDZWDgw1Gs1w7cs/FKebfAO24C0pc= X-Google-Smtp-Source: AKy350aHayqN9Wuj51ay8xt6iuq7zZHPHcJ0dfd8AF/Ki6tENZWMXB50fy9k3t4/LQBcnillHSMoGg== X-Received: by 2002:a17:902:ea08:b0:1a2:85f0:e748 with SMTP id s8-20020a170902ea0800b001a285f0e748mr864961plg.20.1681978966430; Thu, 20 Apr 2023 01:22:46 -0700 (PDT) Received: from Laptop-X1.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id l11-20020a170902d34b00b001a1ed2fce9asm662175plk.235.2023.04.20.01.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 01:22:45 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: Jay Vosburgh , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Liang Li , Vincent Bernat , Hangbin Liu Subject: [PATCH net 2/4] Documentation: bonding: fix the doc of peer_notif_delay Date: Thu, 20 Apr 2023 16:22:28 +0800 Message-Id: <20230420082230.2968883-3-liuhangbin@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230420082230.2968883-1-liuhangbin@gmail.com> References: <20230420082230.2968883-1-liuhangbin@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Bonding only supports setting peer_notif_delay with miimon set. Fixes: 0307d589c4d6 ("bonding: add documentation for peer_notif_delay") Signed-off-by: Hangbin Liu --- Documentation/networking/bonding.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Documentation/networking/bonding.rst b/Documentation/networking/bonding.rst index adc4bf4f3c50..6daeb18911fb 100644 --- a/Documentation/networking/bonding.rst +++ b/Documentation/networking/bonding.rst @@ -776,10 +776,9 @@ peer_notif_delay Specify the delay, in milliseconds, between each peer notification (gratuitous ARP and unsolicited IPv6 Neighbor Advertisement) when they are issued after a failover event. - This delay should be a multiple of the link monitor interval - (arp_interval or miimon, whichever is active). The default - value is 0 which means to match the value of the link monitor - interval. + This delay should be a multiple of the MII link monitor interval + (miimon). The default value is 0 which means to match the value + of the MII link monitor interval. prio Slave priority. A higher number means higher priority. From patchwork Thu Apr 20 08:22:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13218138 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB361C77B73 for ; Thu, 20 Apr 2023 08:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233756AbjDTIXL (ORCPT ); Thu, 20 Apr 2023 04:23:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234194AbjDTIXH (ORCPT ); Thu, 20 Apr 2023 04:23:07 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE46335BB for ; Thu, 20 Apr 2023 01:22:51 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-63d4595d60fso5325509b3a.0 for ; Thu, 20 Apr 2023 01:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681978970; x=1684570970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=485fSWTzxfO4MaaYixxcOQ+EgmPdfYoR20+Ca5UsZVM=; b=V9NbdusIkzMvfYZgqNbfDbrqzg90dFtkrmCrk3ZqAjvytwnS6yts7BN3I2ZBybgXV7 gTredXCI+LeSNDyCkbbqFIQPGCOCErSC4LrrBkiHLPqbgjO9eC5YVmTGhAEPOFYUt2BI DtYGvrzzVuWT5FEXkmEn3UZ3PQiDECO+Odq/5UwGPhuO4IQFTg0KT1b0pv/JFyyXRlhe 4frgdYPiCnZrsqL+VTxAtNcHy34RSrdXxPm7f0lTte0mRCKNSsECyv83nmjP6X+PVqc+ C5DnsxfN90ClEdKWDZZgn9iKE95yc0HTv7M3adUwW0N90Ljpf4UiUl+Zk/xjtoPGY3fz CS7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681978970; x=1684570970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=485fSWTzxfO4MaaYixxcOQ+EgmPdfYoR20+Ca5UsZVM=; b=BsauMd0wMcy4VpSS2hiWJNkLv6TpaD6+YiLY4bct1lRo62FOipePZZ/ghQfz7ynrTw v88OIgrnog5M74YIYrxk5gbl64WhLRUpAQbwnywHL4d6g53QnNyvxakHHRqoDmW9OSzH a8pNdeGfhJUc9055vktMNcOujo/rpwm1i3+LVyhU3tb0LGlqpvIABixzC7wehXZDzGj4 yBkGg65iTm5gD2SB8ArW0zIy/2LoC+BPmApPSLn9QDWQo7VHGcrJ0drA+O0N1h4VY8p2 gQbVADeACA1QRqG+gwi70Z6H1LhNKfJ+RTkzhNX+//voxsVlZybF2Dk74Z2F3vHs6Kej 1GlQ== X-Gm-Message-State: AAQBX9c/3Yon6DccLsVk/DMnJXOoiC/T8h23It+q1/gQHz30DXtMituY Fcfq+EhUyVQLgUocqnepacHcI2pQyKKrEm9ZuXQ= X-Google-Smtp-Source: AKy350ayCkVMmvE5XuE0o4UpS5YTJYchzx5teI7xTKZ7GF9+nqA+43GgJsJKzIfgoQkLFfmuY4AIAQ== X-Received: by 2002:a17:903:124a:b0:1a6:bc34:2ee with SMTP id u10-20020a170903124a00b001a6bc3402eemr652519plh.21.1681978970279; Thu, 20 Apr 2023 01:22:50 -0700 (PDT) Received: from Laptop-X1.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id l11-20020a170902d34b00b001a1ed2fce9asm662175plk.235.2023.04.20.01.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 01:22:49 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: Jay Vosburgh , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Liang Li , Vincent Bernat , Hangbin Liu Subject: [PATCH net 3/4] selftests: forwarding: lib: add netns support for tc rule handle stats get Date: Thu, 20 Apr 2023 16:22:29 +0800 Message-Id: <20230420082230.2968883-4-liuhangbin@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230420082230.2968883-1-liuhangbin@gmail.com> References: <20230420082230.2968883-1-liuhangbin@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Signed-off-by: Hangbin Liu --- tools/testing/selftests/net/forwarding/lib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index d47499ba81c7..426bab05fe0a 100755 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -773,8 +773,9 @@ tc_rule_handle_stats_get() local id=$1; shift local handle=$1; shift local selector=${1:-.packets}; shift + local netns=${1:-""}; shift - tc -j -s filter show $id \ + tc $netns -j -s filter show $id \ | jq ".[] | select(.options.handle == $handle) | \ .options.actions[0].stats$selector" } From patchwork Thu Apr 20 08:22:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13218139 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48AD4C77B72 for ; Thu, 20 Apr 2023 08:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234438AbjDTIXV (ORCPT ); Thu, 20 Apr 2023 04:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234435AbjDTIXP (ORCPT ); Thu, 20 Apr 2023 04:23:15 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 890945266 for ; Thu, 20 Apr 2023 01:22:55 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1a6f0d8cdfeso7497705ad.2 for ; Thu, 20 Apr 2023 01:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681978974; x=1684570974; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YeQDXm9CMBUR8AZx0MS+ObA2072iRcqiixIQ1S3eJEE=; b=ZhWTt8RRTwq9m8zhg0QK6AEg07Vs2JHM6E61j+pzIVqj8Mk4DBTiDrxj2MXvc+C6sa C+rmkVJTJQ+cHwcuGOTEQO0PLTP5k4f4MBEFym4cA82LT1fZkj1q2Zva+07ze7OscLHU VzD/XIeXw2vfS+MUijkucX9Gv2XMc7QBLo6qyQT3ZBbgtBFt8Nho2I9JTHZiOjp5XZvS n4piIaYRnF8Nj98x/bUMeABbR27VZfSZqApLOPK/qppaOgFatqNQqYPr+JoaEBP+66vN jqORYIqGFc7y2DSsfGXwxwrhDZR8YJV1BjBfV8lAHkDeLN8QEpdSoPbZlfbkg/Xuf0tG 1EYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681978974; x=1684570974; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YeQDXm9CMBUR8AZx0MS+ObA2072iRcqiixIQ1S3eJEE=; b=byz8DrvEOBV/DSCuv4G+TsCPSzSHDCTlZ8+dEGnlGdSpYnkYk1HXs7HVHiKkHFHkPh EiLbHn6Gcy2iCP2//WcaHXdP9oHRB8a+zonAAH5K7nwz+hlU8XxF0YCkMjrGyDsfGBxI UJ0JuhFBHiKMry7j6w+XMr+GGnfI794gLRWnZExVHgs0RgxcmgpN5loxUF7XnPSP32KD loAqrd3y2ChlyE9yqEtb8S7Ah9XT/RVWOT4gEbZaJJ8np71KC00Uj0wPuwKyf/RkEdN3 RRzU4sFvjuvyEa/lbNADGq7T1f1/xGQC91J97HlhMbboH0VTw3QuUe7VksL1nT3VjEbN Z4gA== X-Gm-Message-State: AAQBX9fUtr+D8cx9OjXjVYqsy/qo2j06MK6nSe6EOsjMpEDsQARB9DKG GSlGtol7pdoIq4oIkWLvPQOt+2FUhIMfwYMZjzI= X-Google-Smtp-Source: AKy350aRn72PSLlgVJhjhBtvcRFMZP6fQR7lAZ1DMXMMWmn3mivyTtEYwZpT5GT/iLX6ibI3yR3CGg== X-Received: by 2002:a17:902:db0a:b0:1a1:b52d:68e1 with SMTP id m10-20020a170902db0a00b001a1b52d68e1mr843807plx.32.1681978974151; Thu, 20 Apr 2023 01:22:54 -0700 (PDT) Received: from Laptop-X1.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id l11-20020a170902d34b00b001a1ed2fce9asm662175plk.235.2023.04.20.01.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 01:22:53 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: Jay Vosburgh , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Liang Li , Vincent Bernat , Hangbin Liu Subject: [PATCH net 4/4] kselftest: bonding: add num_grat_arp test Date: Thu, 20 Apr 2023 16:22:30 +0800 Message-Id: <20230420082230.2968883-5-liuhangbin@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230420082230.2968883-1-liuhangbin@gmail.com> References: <20230420082230.2968883-1-liuhangbin@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org TEST: num_grat_arp (active-backup miimon num_grat_arp 10) [ OK ] TEST: num_grat_arp (active-backup miimon num_grat_arp 20) [ OK ] TEST: num_grat_arp (active-backup miimon num_grat_arp 30) [ OK ] TEST: num_grat_arp (active-backup miimon num_grat_arp 50) [ OK ] Signed-off-by: Hangbin Liu --- .../drivers/net/bonding/bond_options.sh | 50 +++++++++++++++++++ .../drivers/net/bonding/bond_topo_3d1c.sh | 2 + 2 files changed, 52 insertions(+) diff --git a/tools/testing/selftests/drivers/net/bonding/bond_options.sh b/tools/testing/selftests/drivers/net/bonding/bond_options.sh index db29a3146a86..607ba5c38977 100755 --- a/tools/testing/selftests/drivers/net/bonding/bond_options.sh +++ b/tools/testing/selftests/drivers/net/bonding/bond_options.sh @@ -6,6 +6,7 @@ ALL_TESTS=" prio arp_validate + num_grat_arp " REQUIRE_MZ=no @@ -255,6 +256,55 @@ arp_validate() arp_validate_ns "active-backup" } +garp_test() +{ + local param="$1" + local active_slave exp_num real_num i + RET=0 + + # create bond + bond_reset "${param}" + + bond_check_connection + [ $RET -ne 0 ] && log_test "num_grat_arp" "$retmsg" + + + # Add tc rules to count GARP number + for i in $(seq 0 2); do + tc -n ${g_ns} filter add dev s$i ingress protocol arp pref 1 handle 101 \ + flower skip_hw arp_op request arp_sip ${s_ip4} arp_tip ${s_ip4} action pass + done + + # Do failover + active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave") + ip -n ${s_ns} link set ${active_slave} down + + exp_num=$(echo "${param}" | cut -f6 -d ' ') + sleep $((exp_num + 2)) + + active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave") + + # check result + real_num=$(tc_rule_handle_stats_get "dev s${active_slave#eth} ingress" 101 ".packets" "-n ${g_ns}") + if [ "${real_num}" -ne "${exp_num}" ]; then + echo "$real_num garp packets sent on active slave ${active_slave}" + RET=1 + fi + + for i in $(seq 0 2); do + tc -n ${g_ns} filter del dev s$i ingress + done +} + +num_grat_arp() +{ + local val + for val in 10 20 30 50; do + garp_test "mode active-backup miimon 100 num_grat_arp $val peer_notify_delay 1000" + log_test "num_grat_arp" "active-backup miimon num_grat_arp $val" + done +} + trap cleanup EXIT setup_prepare diff --git a/tools/testing/selftests/drivers/net/bonding/bond_topo_3d1c.sh b/tools/testing/selftests/drivers/net/bonding/bond_topo_3d1c.sh index 4045ca97fb22..69ab99a56043 100644 --- a/tools/testing/selftests/drivers/net/bonding/bond_topo_3d1c.sh +++ b/tools/testing/selftests/drivers/net/bonding/bond_topo_3d1c.sh @@ -61,6 +61,8 @@ server_create() ip -n ${g_ns} link set s${i} up ip -n ${g_ns} link set s${i} master br0 ip -n ${s_ns} link set eth${i} master bond0 + + tc -n ${g_ns} qdisc add dev s${i} clsact done ip -n ${s_ns} link set bond0 up