From nobody Sun Feb 8 10:21:57 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:35eb:0:0:0:0:0 with SMTP id w11csp412365uau; Fri, 24 Jun 2022 09:38:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tIfRbrboDXbiVSMxhN8I74xC501PiYQyiipSWEpyL2JIXCqIQAdcdcEkDGvhC8MNgq9FnU X-Received: by 2002:a17:902:f114:b0:16a:133a:b1fe with SMTP id e20-20020a170902f11400b0016a133ab1femr33368808plb.66.1656088703557; Fri, 24 Jun 2022 09:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656088703; cv=none; d=google.com; s=arc-20160816; b=b5GW4/5JkBgU89n1aIo5hmIUEk/wYyvIJ0XmzdUo+Q+0+VwsOA3G9noLsV+yyi+qCF 0t/UE6i52UbfJLYfvUJf6bWFY3UmL6NCS6A6b+umxwyTEO2MfO717Zadh4JJ+W/M1DM2 In4q/tsoBH/CRRB5MHKEHh1jBjvGQCrk/gbwajFadhMWNRlrsVEIMnA4xO5zXabOEHh1 F8GuraFf2Urznrmp8RVuZTwry9VrKZYBlMDfqPJ1rF8EdbJaCnV71rWd8vgge1ujTOuh droYq4z/X8EVJolOn01ZEEfOrjVjLwqSv3Pt0TrttDCtM3YBCKL7Eif+cNoq7MKHIgLn WQFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=pXMCy+nIpSmrgqNJN+8DnoYqilodAvmKSi1TZI1d8Ng=; b=YzwwIO5QeOOj3zOpXxOso7E0QJjgUP+VScKzul1PyoNGhYGHHNBADR55zCZtqbG7ft 8twaCL3eXM96u6tBdHHpPibnfbRJNGO9KrRUCT1oSdq4MisDAoEVwSrb/pheKBuQq7Bj zV5pBE/LQdgeTxDN4vlHHzzxUPrkDg1/TAV9lvTf4VD3wA1bWoPiIR+KZrz3HRPfrEgZ Zglydam/nsZrouhBdGqrwkqcVcBc02HeOT2dKIy6CKqE3MNPrWDWZxROAS4l4pGwX+HA cx5kUMe5b0nBY3PZi1IOIAqNFvxP0XgXH4+H/k1ETh4HH47nfAXgSEsTXcnx6xX5xwv6 8TxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fB0a+8Tz; spf=pass (google.com: domain of mptcp+bounces-5818-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5818-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h2-20020a17090a2ec200b001e2f5701113si6878905pjs.25.2022.06.24.09.38.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jun 2022 09:38:23 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5818-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fB0a+8Tz; spf=pass (google.com: domain of mptcp+bounces-5818-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5818-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E670F280C83 for ; Fri, 24 Jun 2022 16:38:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB9263D65; Fri, 24 Jun 2022 16:38:21 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76E077C for ; Fri, 24 Jun 2022 16:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656088699; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pXMCy+nIpSmrgqNJN+8DnoYqilodAvmKSi1TZI1d8Ng=; b=fB0a+8Tz5dhDE+78JS9qOPGt92w80b3OiaIXQRNeyVHN4j6MzsEXmkIz+1ukRzNtpcueg7 3ExJoWFFwVQ3tDprjPok5sHDK/JgNW7413NghDZbeyDnFVBoF3bkBCscWkSDnWoKVmB1jI mHZtpbi0+49+dMPou3/Wl5BiwQv9/Uk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-479-bWKM-CyiPW-J6vkE6YPjLg-1; Fri, 24 Jun 2022 12:38:18 -0400 X-MC-Unique: bWKM-CyiPW-J6vkE6YPjLg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 05ECC811E75 for ; Fri, 24 Jun 2022 16:38:18 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EA112026D64 for ; Fri, 24 Jun 2022 16:38:17 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH RFC 3/4] mptcp: allow the in kernel PM to set MPC subflow priority Date: Fri, 24 Jun 2022 18:38:09 +0200 Message-Id: <8a80c3bf12e43985e00b4fb04beccd38d69e505b.1656088406.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" Any local endpoints configured on the address matching the MPC subflow are currently ignored. Specifically, setting a backup flag on them has no effect on the first subflow, as the MPC handshake can't carry such info. This change refactors the MPC endpoint id accounting to additionally fetch the priority info from the relevant endpoint and eventually trigger the MP_PRIO handshake as needed. As a result, the MPC subflow now switches to backup priority after that the MPTCP socket is fully established, according to the local endpoint configuration. Signed-off-by: Paolo Abeni --- net/mptcp/pm_netlink.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 91f6ed2a076a..a6eb501e5031 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -505,30 +505,14 @@ __lookup_addr(struct pm_nl_pernet *pernet, const stru= ct mptcp_addr_info *info, struct mptcp_pm_addr_entry *entry; =20 list_for_each_entry(entry, &pernet->local_addr_list, list) { - if ((!lookup_by_id && mptcp_addresses_equal(&entry->addr, info, true)) || + if ((!lookup_by_id && + mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) || (lookup_by_id && entry->addr.id =3D=3D info->id)) return entry; } return NULL; } =20 -static int -lookup_id_by_addr(const struct pm_nl_pernet *pernet, const struct mptcp_ad= dr_info *addr) -{ - const struct mptcp_pm_addr_entry *entry; - int ret =3D -1; - - rcu_read_lock(); - list_for_each_entry(entry, &pernet->local_addr_list, list) { - if (mptcp_addresses_equal(&entry->addr, addr, entry->addr.port)) { - ret =3D entry->addr.id; - break; - } - } - rcu_read_unlock(); - return ret; -} - static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) { struct sock *sk =3D (struct sock *)msk; @@ -546,13 +530,22 @@ static void mptcp_pm_create_subflow_or_signal_addr(st= ruct mptcp_sock *msk) =20 /* do lazy endpoint usage accounting for the MPC subflows */ if (unlikely(!(msk->pm.status & BIT(MPTCP_PM_MPC_ENDPOINT_ACCOUNTED))) &&= msk->first) { + struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(msk->first); + struct mptcp_pm_addr_entry *entry; struct mptcp_addr_info mpc_addr; - int mpc_id; + bool backup =3D false; =20 local_address((struct sock_common *)msk->first, &mpc_addr); - mpc_id =3D lookup_id_by_addr(pernet, &mpc_addr); - if (mpc_id >=3D 0) - __clear_bit(mpc_id, msk->pm.id_avail_bitmap); + rcu_read_lock(); + entry =3D __lookup_addr(pernet, &mpc_addr, false); + if (entry) { + __clear_bit(entry->addr.id, msk->pm.id_avail_bitmap); + backup =3D !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); + } + rcu_read_unlock(); + + if (backup) + mptcp_pm_send_ack(msk, subflow, true, backup); =20 msk->pm.status |=3D BIT(MPTCP_PM_MPC_ENDPOINT_ACCOUNTED); } --=20 2.35.3