From patchwork Mon Nov 30 07:11:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 1408047 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=LCmKYG+e; dkim-atps=neutral Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CkxHH5YPQz9s0b for ; Mon, 30 Nov 2020 18:11:39 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9EB2D100ED498; Sun, 29 Nov 2020 23:11:37 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::1043; helo=mail-pj1-x1043.google.com; envelope-from=geliangtang@gmail.com; receiver= Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BD5CB100EF278 for ; Sun, 29 Nov 2020 23:11:36 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id t21so814552pjw.2 for ; Sun, 29 Nov 2020 23:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f9inkU1iiRRMn94d6cMnu2LbkHF3Ly2CDhNyuFCVWgU=; b=LCmKYG+eMR2Y5d3iDxnhYywSyohek1wbyRF6cGaThUdOmY2Ff+25vDhLpQgjoiWBnh +LGJgYghpSuwCUJBtN6/qpcDe5DuMG5uOiwdl+hzkdxCq1djLY7zmWdfhTDyNzweXeMA MyBN79XpbEwsiSyS6nzJT7hOSC3sfFHrGMarRNLorj39/OOAzk3RXZ/Mi5GReAK8BSL7 bRbVYEMDu5/qkF8RBVSNafRN3YC9AMF/kaQxDpesV0SkipQml49DQgu8/K2d7Qu7mG6+ EEx9+QerdVeU73z6JrqPzmTwSipf0gUg+Qv6CQ6rj7NqWBHObwFxCp8y/8/oAHQHHyVg Phug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f9inkU1iiRRMn94d6cMnu2LbkHF3Ly2CDhNyuFCVWgU=; b=Cu0XAsoo9yBw8C/PYrS4YuuBSH22ex9RDfS7/r/n1hnHUCME7YxANmOhggq7/wQFFx kjZCuCsstDfrPFxf40y/UW6OsInYt5850SkGiyQJzUurBo/M0TxR03cjbKQdtSng1A9u UG9bW3WwV0hg4kUf3/iuRmshtu1QGxllzH7yNI2X2yoIIhCJs0qMfRbLky3864I/eU5V 7DEqQhGIjRLDDH6CiUs6BbIgeU948r3Dh8ZcEeiFnERBhaqbog9eE3QgmA42e8PPxlG3 7qBoNzx6gTvCLPdxIPOCJjEO2zRmQse7UcfAtTgJdXheisjuNqQuJcduZXnm9HeOG84e G0dg== X-Gm-Message-State: AOAM530gvDOthBOoT0p5DYX918vhkMXW+8/7eqGe1IdsgaLblU5iuuu8 qOID3dnkaLIAjK+gHIYAICJiUv4ykfWH/Q== X-Google-Smtp-Source: ABdhPJyoXQY096ZAulHH+kp1B9R9pZY2sMXuES2rOJFG8reokGLQZUFQk5dKwW4YH4B0yfj4v4JW5w== X-Received: by 2002:a17:90b:374f:: with SMTP id ne15mr24765704pjb.57.1606720295961; Sun, 29 Nov 2020 23:11:35 -0800 (PST) Received: from localhost ([2400:8800:300:11c:9b7d:697f:b379:5b54]) by smtp.gmail.com with ESMTPSA id z29sm6793983pgk.88.2020.11.29.23.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 23:11:35 -0800 (PST) From: Geliang Tang To: mptcp@lists.01.org Date: Mon, 30 Nov 2020 15:11:25 +0800 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Message-ID-Hash: OXJYGVPVWVBWT4HLETBDGJDULUXVCXHC X-Message-ID-Hash: OXJYGVPVWVBWT4HLETBDGJDULUXVCXHC X-MailFrom: geliangtang@gmail.com X-Mailman-Rule-Hits: member-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address CC: Geliang Tang X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [MPTCP][PATCH v2 mptcp-next 1/2] mptcp: remove address when netlink flush addrs List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: When the PM netlink flushs the addresses, invoke the remove address function mptcp_nl_remove_subflow_and_signal_addr to remove the addresses and the subflows. Since this function should not be invoked under lock, move __flush_addrs out of the pernet->lock. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index ba31065ef462..4f1b7f44c03b 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -962,13 +962,14 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info) return ret; } -static void __flush_addrs(struct pm_nl_pernet *pernet) +static void __flush_addrs(struct net *net, struct list_head *list) { - while (!list_empty(&pernet->local_addr_list)) { + while (!list_empty(list)) { struct mptcp_pm_addr_entry *cur; - cur = list_entry(pernet->local_addr_list.next, + cur = list_entry(list->next, struct mptcp_pm_addr_entry, list); + mptcp_nl_remove_subflow_and_signal_addr(net, &cur->addr); list_del_rcu(&cur->list); kfree_rcu(cur, rcu); } @@ -985,11 +986,13 @@ static void __reset_counters(struct pm_nl_pernet *pernet) static int mptcp_nl_cmd_flush_addrs(struct sk_buff *skb, struct genl_info *info) { struct pm_nl_pernet *pernet = genl_info_pm_nl(info); + LIST_HEAD(free_list); spin_lock_bh(&pernet->lock); - __flush_addrs(pernet); + list_splice_init(&pernet->local_addr_list, &free_list); __reset_counters(pernet); spin_unlock_bh(&pernet->lock); + __flush_addrs(sock_net(skb->sk), &free_list); return 0; } @@ -1253,10 +1256,12 @@ static void __net_exit pm_nl_exit_net(struct list_head *net_list) struct net *net; list_for_each_entry(net, net_list, exit_list) { + struct pm_nl_pernet *pernet = net_generic(net, pm_nl_pernet_id); + /* net is removed from namespace list, can't race with * other modifiers */ - __flush_addrs(net_generic(net, pm_nl_pernet_id)); + __flush_addrs(net, &pernet->local_addr_list); } } From patchwork Mon Nov 30 07:11:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 1408049 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=L35jt6/o; dkim-atps=neutral Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CkxHM1VgQz9s0b for ; Mon, 30 Nov 2020 18:11:43 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AEFDF100EC1EC; Sun, 29 Nov 2020 23:11:41 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::542; helo=mail-pg1-x542.google.com; envelope-from=geliangtang@gmail.com; receiver= Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5523D100EF274 for ; Sun, 29 Nov 2020 23:11:40 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id w4so9520171pgg.13 for ; Sun, 29 Nov 2020 23:11:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uT1GUYQHGouPCAHgkzSRq0F4jDvtoteSwL1hp6N5SFU=; b=L35jt6/oHK/5o5k7bO+C3KmJ1w3WhsL7JYNNAdzf30lZJ7e1Hk9L1DfKliB0iVGEdy OMZ7pPCkjPVZbqS6DqR2P3fMGQo0SJsmKFZVlMlR+JcDcQ73zf9SYVcCXFNrui8nSkn8 h2cV5CX8T/xYUzhLu8WqhE+v65cRt2x+gTUAJeBsOjFZMAM6GD0eL6y1ZiPzEqYiZ0ra TQEzug3mmBJFWaP0wPaTRHJ1c0gXcXCEwoIYP7REvc3IY+dflSJH9AuLFScV82mUB9U9 /Bi9oaqZQ4YFsfzw/j6pqkE3EVVLwmnM3p29BuWH1Kh4VfkDGCaVRnRmfc9oGkJvOTiz gAQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uT1GUYQHGouPCAHgkzSRq0F4jDvtoteSwL1hp6N5SFU=; b=UOWxa8l7e6cxfZ9j42JZg1zY2SECquMBj1CHgM6FaavcfNBMBi622IMv2Znd5+e53D qWDkJlkK//Q0QDRyq0Uxfaq+bFvL5G/pXT+R+7elWjSrO28Uc2B6nh4Zo9Tk+PdlVDLP 6VDzAa8cAA6pkFQTU6u9tNvXTyZl2j5YEnSWqEqpebCBHPIZb9xqOzF4ZZ6HPIOhHYyG QPL041U7pdHP8VvYT9jFOslXzopzZccmdlng5m0B9zyw1kqT/eDofwGh3DPw15Vw9W1k zNVYpaUmg1m/bDW/62g0AzHoXXWyXFRvjyCROCSokF+4Fgeafok02kQF+lprLAZnhihe 1gKw== X-Gm-Message-State: AOAM530RrqS4GFe5hlm+I/yaerwZzjCbtxO7PJWMigGVUXwfADap1e9V Tq2hJzNa8cmQTl9EQcgJc6olANlNupu6NQ== X-Google-Smtp-Source: ABdhPJw/uYT8aZ0q3q2j0t2R0xotmnklQpwWOuad03imVuVSv3WZskHi9MduP+ZNaF9z8/Eyf1dp+Q== X-Received: by 2002:a63:4b0f:: with SMTP id y15mr16802969pga.235.1606720299529; Sun, 29 Nov 2020 23:11:39 -0800 (PST) Received: from localhost ([2400:8800:300:11c:9b7d:697f:b379:5b54]) by smtp.gmail.com with ESMTPSA id l17sm20784863pjy.29.2020.11.29.23.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 23:11:38 -0800 (PST) From: Geliang Tang To: mptcp@lists.01.org Date: Mon, 30 Nov 2020 15:11:26 +0800 Message-Id: <02739eafbaeb1d87c069cec7db5c7a803e534a49.1606719598.git.geliangtang@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Message-ID-Hash: AESQKIMHPRJ3G5INZB7H7O5HPSI32JDQ X-Message-ID-Hash: AESQKIMHPRJ3G5INZB7H7O5HPSI32JDQ X-MailFrom: geliangtang@gmail.com X-Mailman-Rule-Hits: member-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address CC: Geliang Tang X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [MPTCP][PATCH v2 mptcp-next 2/2] selftests: mptcp: add the flush addrs testcase List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: This patch added the flush addrs testcase. In do_transfer, if the number of removing addresses is less than 8, use the del addr command to remove the addresses one by one. If the number is more than 8, use the flush addrs command to remove the addresses. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 50 +++++++++++++------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 38d756f5e366..00a3ed10bb85 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -264,27 +264,37 @@ do_transfer() cpid=$! if [ $rm_nr_ns1 -gt 0 ]; then - counter=1 - sleep 1 + if [ $rm_nr_ns1 -lt 8 ]; then + counter=1 + sleep 1 - while [ $counter -le $rm_nr_ns1 ] - do - ip netns exec ${listener_ns} ./pm_nl_ctl del $counter + while [ $counter -le $rm_nr_ns1 ] + do + ip netns exec ${listener_ns} ./pm_nl_ctl del $counter + sleep 1 + let counter+=1 + done + else sleep 1 - let counter+=1 - done + ip netns exec ${listener_ns} ./pm_nl_ctl flush + fi fi if [ $rm_nr_ns2 -gt 0 ]; then - counter=1 - sleep 1 + if [ $rm_nr_ns2 -lt 8 ]; then + counter=1 + sleep 1 - while [ $counter -le $rm_nr_ns2 ] - do - ip netns exec ${connector_ns} ./pm_nl_ctl del $counter + while [ $counter -le $rm_nr_ns2 ] + do + ip netns exec ${connector_ns} ./pm_nl_ctl del $counter + sleep 1 + let counter+=1 + done + else sleep 1 - let counter+=1 - done + ip netns exec ${connector_ns} ./pm_nl_ctl flush + fi fi wait $cpid @@ -749,6 +759,18 @@ chk_join_nr "remove subflows and signal" 3 3 3 chk_add_nr 1 1 chk_rm_nr 2 2 +# subflows and signal, flush +reset +ip netns exec $ns1 ./pm_nl_ctl limits 0 3 +ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal +ip netns exec $ns2 ./pm_nl_ctl limits 1 3 +ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow +ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow +run_tests $ns1 $ns2 10.0.1.1 0 8 8 slow +chk_join_nr "flush subflows and signal" 3 3 3 +chk_add_nr 1 1 +chk_rm_nr 2 2 + # subflow IPv6 reset ip netns exec $ns1 ./pm_nl_ctl limits 0 1