From nobody Sun Feb 8 23:27:11 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:590e:0:0:0:0:0 with SMTP id n14csp2732835uad; Mon, 4 Jul 2022 02:15:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uLyHcJnmq/ZAaWgsz5ZWDS548itPTP4Ms6xtFXual1P0pmeqGmXv2S5uXnqRln/7L3h2Lv X-Received: by 2002:a63:6bc4:0:b0:40d:fd98:bb21 with SMTP id g187-20020a636bc4000000b0040dfd98bb21mr23859274pgc.249.1656926099911; Mon, 04 Jul 2022 02:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656926099; cv=none; d=google.com; s=arc-20160816; b=WtKwQQVjBu9Gpaoz4DJ/QMPVd/8G6Gv+Lyg0yBF0S37bS2s4X1eU6iZESMn1Wy3lD6 QFgToqS08TNgS1z68VBAElTM1Ww72bnmYTSNplrOjTMwivf0Nu68mH0RY4wcwcq+i3tt 4AAUY9+HHdivdc9lRLA9fHsQ4Z/cte/ISrfL7ldejmL/vLyfGQF2amSivaX8PTZznhVe ous5EmXvdQFYYVeoe4i/lg7R25eytiaAeXRx/eYd6PDsrLhiMIwqTJkEjXPnHBI4Zpgk v8xUr3Ls22XSZh+z1ZWQE9dF5gWUJ6aJDV9TSXpdFs7TB+LyFED0aqhkqHJ6mgXtPFIv gy3w== 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=TjR7Ms2pLLD69b5s2wUt45RzlgR9Ju8nK34ei07XjSY=; b=EGTB0W6yAmwRTr5CPuEALogFVF1CWL44ArzGV8+USXQhx2MMfXvJ4yO2DtpXzncfb1 +/S3jPmdNCFC+5lkjVqIKmMQG7UMa8rq13sGGp2mWmNGIh9bGX4DnVFXoptG6Nxo7MQ0 BLCcHYZ3Mf0yRdlH8yGayg+P2arvgfDSYIeVJKe2hS1ZAoWkcH0okJ1Xt1R0kzPiYTMO zwOohIdqNwgdCEIrxQwiwUOUFJ62bkN1S1Zk1CkLl98T7Z1l48Joqsttnmbki+k7FvOQ SISNh7fG4iRCTcESDOF/KodY73zkFbZz67AH4fjtidJt2RZfIfxEgxEU5U/6/ZnePeAW kN7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cMtDNhwk; spf=pass (google.com: domain of mptcp+bounces-5946-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5946-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 x69-20020a638648000000b00408a7a11803si19840218pgd.720.2022.07.04.02.14.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2022 02:14:59 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5946-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=cMtDNhwk; spf=pass (google.com: domain of mptcp+bounces-5946-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5946-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 58A0B280ABA for ; Mon, 4 Jul 2022 09:14:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DE3A23B6; Mon, 4 Jul 2022 09:14:57 +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.133.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 AE1AB23C8 for ; Mon, 4 Jul 2022 09:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656926094; 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=TjR7Ms2pLLD69b5s2wUt45RzlgR9Ju8nK34ei07XjSY=; b=cMtDNhwkm/HjiuV/Uex7RaCJD3aawY8n3bzaP2989uRnSUzCC+alrnYW7Bwirwj4cX7Avz mSJfewe62dYbiSVLLuIS3qcEatnyO0PMxihQQFr57sOT0f51hOtYAmuIPyobSCx5Rt/Vxg PHRksKMQQYerpw39zTExYNL4pciX574= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-TbA90xKxPtm2-SuAv_9gbQ-1; Mon, 04 Jul 2022 05:14:52 -0400 X-MC-Unique: TbA90xKxPtm2-SuAv_9gbQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43FC43C01D99 for ; Mon, 4 Jul 2022 09:14:52 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.193.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB0D82166B26 for ; Mon, 4 Jul 2022 09:14:51 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next 3/5] mptcp: allow the in kernel PM to set MPC subflow priority Date: Mon, 4 Jul 2022 11:14:34 +0200 Message-Id: <414465fb0c27e24f5616bc7660e018a6474ba672.1656925387.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.6 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 c0a4c947347b..d846ceeceb9a 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -514,30 +514,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; @@ -555,13 +539,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