From nobody Thu Dec 26 15:39:39 2024 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2084.outbound.protection.outlook.com [40.107.7.84]) (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 439A47E for ; Mon, 4 Sep 2023 09:40:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O4UmHbvwNT/fc7Xs6EnbAR40nDo6uC4ITyF0Q1sNzl/MwRvriKyciwD2PnPpDpxWdWIddvEHRUIryr24lqECnc0BGT8il9QI07OFaiz/gIsZ/tqzaTYI953BlWjfleP8biQlibyJ4kQPkw9kdBIsOusV+QM+rDZPhtL3pWc9nEDnUk/+tQIbaQj3bD1JICBSpyHb20ZSLJyMfKgyJCGki14fJCuHbJfuhm4bUepuI6vSelXH4ZQ73Fu+YG6mkGaFg1aoEMRbSMTJwRre+eVzmjIKAPrhe8HH3nJFsgHbU9OlZ45g/adIlWl3UwIApOPnS+7cp4YKg6LWl+z4Pg/JJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QXCwTe6+YRvW0UnHaqQotfRMpMHy3KjM2V4plXFEg2Y=; b=dmlrZHP3smw6Jjy03g2np5xdIDjDQ6Mmpfs37UVXUlW3cPWiM/jChsbYkfAa1wHBBSlpSTBeclMEss/+d3JPhqyC/VN5IkLq9LO8b9EeAj4nEQTh+g/8fa/NusUetmviOrNBuO++K1n4zHjRT7PiWQiPcO1akb3Sy8nFmySj4mjzY5vE1LNUtaeRxWuU+B/15zBmRi0haw8Y1+hW5U1tcrK8xyJ7OyKqPoRSU0pGjjPMN6REkEi+nU+jfm/MAaL/u7kLSJOLxIBv38BBvLvz4XCZdpySXS7FcILqQihyplP0NDM29kbGkOclzX8sW1sOwZKemVTsJ9cA2LJMmp1xlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QXCwTe6+YRvW0UnHaqQotfRMpMHy3KjM2V4plXFEg2Y=; b=AXZS8CbRHzM9VEPmHBhZhse5n/XZLC+MukLACO5g/LlZ2MG78LZm8Vge1TacnWUoDRc0c1wMB+Z365BG+T0JZjbtZkkZODd0oJvbAQ/8NBXnTEAEw5fmZHMXKCiVjUBx+0aNfMf/ewAXgzDT14M9ljP0G+FxddDxGpikivaro/IRZ8nJfQYVFA77PruTqkvTfANfCNnkdRiU+yFQvUI1BHEYwhDKxeMhwGmb9GHv+9AZXxJmJ6dptMDvvFguHHMT0EE0gXqe8eyGplMVrStwgH/U1VDFJCLOpT32/ZMsXDkQJ2uC3scyWPsZIwxqc9ak0l+duKNKMkFdgv0uLcm4jA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from VI1PR0402MB3503.eurprd04.prod.outlook.com (2603:10a6:803:d::26) by AM9PR04MB7716.eurprd04.prod.outlook.com (2603:10a6:20b:280::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.32; Mon, 4 Sep 2023 09:40:41 +0000 Received: from VI1PR0402MB3503.eurprd04.prod.outlook.com ([fe80::a5bd:13d0:b0ae:59da]) by VI1PR0402MB3503.eurprd04.prod.outlook.com ([fe80::a5bd:13d0:b0ae:59da%7]) with mapi id 15.20.6745.030; Mon, 4 Sep 2023 09:40:41 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 9/9] Squash to "selftests/bpf: Add bpf_burst scheduler" Date: Mon, 4 Sep 2023 17:39:28 +0800 Message-Id: <589720832d0408f7d3ff10a33e30b83217cf990a.1693820153.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: TYCP286CA0286.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c8::18) To VI1PR0402MB3503.eurprd04.prod.outlook.com (2603:10a6:803:d::26) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR0402MB3503:EE_|AM9PR04MB7716:EE_ X-MS-Office365-Filtering-Correlation-Id: 42b884a6-fab2-467b-cf10-08dbad2b00bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iT77OhRQq/vKtjrh75ttXzGHPtE4wGajMSZldPV2wapmLOfLzLeeXYtpiZF/ZUjlC2485P/aluIoh+YKIqKKtErstY2m2HTHZFIRXwu4QzES1snDjyJNPxWRE8NY0N9uaUUp8H0Hx6HNNhjPB9IpQmQ2QZp6Id/J2nwSATS0A+f6DRlsRTSWkJXLa0EsJNsaOzWQvmw5D3WyFKv5q1iDMUoNGXcvuriTH5ZeIvAJKa6CS80NuJiFW23IARuwGjYl6h0t15yt+L8mieJ4GXlW3CBPT3B0aEH/ofC3wHNfJOgLikTB6tN2ArXU7c273W6SeyrqK3OCxBy2Ut417XGFmPhz6C2YKhJVgjzDnPMpc0ApNy0xowL/yri8ufw9ANH+ZjhkXqFimkDIJCJ4slPJkI9T0UkESNWBVmrkxSnWFX3ML46RFGDb5lDVeY7p7Fs0ikiiDOmIdNfEX1KRqZL/ADDR3Sx3PbWkcN12uNyaiuzKGr9t0st6GEoABbp80MXJdTQObmYI0DhwgunCooG4OU+9BT4LaPPdVJcuZpCgtAscNOpxeQ5z0+n7y8oErsZN X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR0402MB3503.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(136003)(366004)(346002)(39860400002)(396003)(186009)(1800799009)(451199024)(41300700001)(6666004)(6506007)(6486002)(478600001)(38100700002)(83380400001)(2616005)(107886003)(6512007)(36756003)(2906002)(66556008)(316002)(66476007)(6916009)(86362001)(8936002)(66946007)(5660300002)(44832011)(8676002)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?i7MuRU/iJkZ0vGmuHfpkY6qdwkCt3QiuFq6tBuRQYtFv0IYOt0ej8AI06nLk?= =?us-ascii?Q?zVA/UrJYTYRd764r6sVKnhQnRDDgmrjgKRwMVgFOE2Z4tT7xULyYEqwuaCll?= =?us-ascii?Q?OLqBDQBTkkROJxmnouA1lpCLbmCi61i09Ww98fE4vQX27vJ7J1Hmfhlzgt2M?= =?us-ascii?Q?+HFwTyEUPk5FJjz3Lacfi5mtN+Tl4rURfwc2DgPp7gpZRI6VO61vfMLx5FPJ?= =?us-ascii?Q?e5Sg6WaSrrTtjkg4DG/tP7wTBGRbFx3CGwil577gjQB54tPBzooA13fAM7ds?= =?us-ascii?Q?D2lBbm508s2jdDJ698ThW2v3VZD4ZVIe9Q2m7kp7sZ2vJsrGydjiTaAYGKUz?= =?us-ascii?Q?6fuYNdw/5Xkeo1NwDpGHDSZT9UI7pFEiC/S3tlW3ybzjqeZCYuyClhibYzDf?= =?us-ascii?Q?GyOlsz+VndOZWxwcPUIh6P/lmudhvUKdR9QUPeGCNiVlVLu42w++YYT5Vd0x?= =?us-ascii?Q?6om+roMqhllM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JTyX7vwt?= =?us-ascii?Q?iSWd1PG0X6Pl8mPu1jq5WP0KK0bhgCpma0Oozuw0DBWc2ww1+bd9Q8CmXGQb?= =?us-ascii?Q?FS3kfA16ODhr/s8h0eVcJTB4rTC6vjWPkkp8ZCoQ5Ljl7XUwveai9vjXvSFz?= =?us-ascii?Q?QXsTQlPZBGJXQkLFlVn9Ws6zVVpNYOpllbWiFpWd+n8K4ICg4h4K3s8VvyhY?= =?us-ascii?Q?2NJX+4W8V4W4qsy7fC1a5v1VwfPjU+UrV9pIwXSd9nNVsgKlep1UyxbQ2rm7?= =?us-ascii?Q?HPTnOlZ36dx7PYeWMIe3dmHHIAKnWTM4jb5Gql9TWZzwrVuD/xD5JJB3sw91?= =?us-ascii?Q?VY1JXQ=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42b884a6-fab2-467b-cf10-08dbad2b00bb X-MS-Exchange-CrossTenant-AuthSource: VI1PR0402MB3503.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2023 09:40:41.3592 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TTEMRy5cg2FRHWLjRu6Maq1XfKbDAnFAJ/etRpXhulfISIGXGReTubeEAadfErWtVopnEAEHkn0JcB0Z60XzWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7716 Content-Type: text/plain; charset="utf-8" Update mptcp_sched_data_set_contexts and mptcp_subflow_ctx_by_pos. Store burst in msk->snd_burst instead of in sk_storage. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/bpf_tcp_helpers.h | 1 + .../selftests/bpf/progs/mptcp_bpf_burst.c | 30 ++++--------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/bpf/bpf_tcp_helpers.h b/tools/testing/= selftests/bpf/bpf_tcp_helpers.h index 36a53381a4c0..6b43845f1234 100644 --- a/tools/testing/selftests/bpf/bpf_tcp_helpers.h +++ b/tools/testing/selftests/bpf/bpf_tcp_helpers.h @@ -262,6 +262,7 @@ struct mptcp_sock { struct inet_connection_sock sk; =20 __u64 snd_nxt; + int snd_burst; __u32 token; struct sock *first; char ca_name[TCP_CA_NAME_MAX]; diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c b/tools/te= sting/selftests/bpf/progs/mptcp_bpf_burst.c index b6a8a051741d..b3c811564866 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c @@ -7,17 +7,6 @@ =20 char _license[] SEC("license") =3D "GPL"; =20 -struct mptcp_burst_storage { - int snd_burst; -}; - -struct { - __uint(type, BPF_MAP_TYPE_SK_STORAGE); - __uint(map_flags, BPF_F_NO_PREALLOC); - __type(key, int); - __type(value, struct mptcp_burst_storage); -} mptcp_burst_map SEC(".maps"); - #define MPTCP_SEND_BURST_SIZE 65428 =20 struct subflow_send_info { @@ -69,14 +58,11 @@ static __always_inline bool sk_stream_memory_free(const= struct sock *sk) SEC("struct_ops/mptcp_sched_burst_init") void BPF_PROG(mptcp_sched_burst_init, struct mptcp_sock *msk) { - bpf_sk_storage_get(&mptcp_burst_map, msk, 0, - BPF_LOCAL_STORAGE_GET_F_CREATE); } =20 SEC("struct_ops/mptcp_sched_burst_release") void BPF_PROG(mptcp_sched_burst_release, struct mptcp_sock *msk) { - bpf_sk_storage_delete(&mptcp_burst_map, msk); } =20 static int bpf_burst_get_send(struct mptcp_sock *msk, @@ -85,7 +71,6 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, struct subflow_send_info send_info[SSK_MODE_MAX]; struct mptcp_subflow_context *subflow; struct sock *sk =3D (struct sock *)msk; - struct mptcp_burst_storage *ptr; __u32 pace, burst, wmem; __u64 linger_time; struct sock *ssk; @@ -98,7 +83,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, } =20 for (i =3D 0; i < data->subflows && i < MPTCP_SUBFLOWS_MAX; i++) { - subflow =3D mptcp_subflow_ctx_by_pos(data, i); + subflow =3D bpf_mptcp_subflow_ctx_by_pos(data, i); if (!subflow) break; =20 @@ -127,7 +112,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, if (send_info[SSK_MODE_ACTIVE].subflow_id =3D=3D MPTCP_SUBFLOWS_MAX) send_info[SSK_MODE_ACTIVE].subflow_id =3D send_info[SSK_MODE_BACKUP].sub= flow_id; =20 - subflow =3D mptcp_subflow_ctx_by_pos(data, send_info[SSK_MODE_ACTIVE].sub= flow_id); + subflow =3D bpf_mptcp_subflow_ctx_by_pos(data, send_info[SSK_MODE_ACTIVE]= .subflow_id); if (!subflow) return -1; ssk =3D mptcp_subflow_tcp_sock(subflow); @@ -142,10 +127,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, subflow->avg_pacing_rate =3D div_u64((__u64)subflow->avg_pacing_rate * wm= em + ssk->sk_pacing_rate * burst, burst + wmem); - ptr =3D bpf_sk_storage_get(&mptcp_burst_map, msk, 0, - BPF_LOCAL_STORAGE_GET_F_CREATE); - if (ptr) - ptr->snd_burst =3D burst; + msk->snd_burst =3D burst; =20 out: mptcp_subflow_set_scheduled(subflow, true); @@ -161,7 +143,7 @@ static int bpf_burst_get_retrans(struct mptcp_sock *msk, struct sock *ssk; =20 for (int i =3D 0; i < data->subflows && i < MPTCP_SUBFLOWS_MAX; i++) { - subflow =3D mptcp_subflow_ctx_by_pos(data, i); + subflow =3D bpf_mptcp_subflow_ctx_by_pos(data, i); if (!subflow) break; =20 @@ -193,7 +175,7 @@ static int bpf_burst_get_retrans(struct mptcp_sock *msk, subflow_id =3D min_stale_count > 1 ? backup : MPTCP_SUBFLOWS_MAX; =20 out: - subflow =3D mptcp_subflow_ctx_by_pos(data, subflow_id); + subflow =3D bpf_mptcp_subflow_ctx_by_pos(data, subflow_id); if (!subflow) return -1; mptcp_subflow_set_scheduled(subflow, true); @@ -203,8 +185,6 @@ static int bpf_burst_get_retrans(struct mptcp_sock *msk, int BPF_STRUCT_OPS(bpf_burst_get_subflow, struct mptcp_sock *msk, struct mptcp_sched_data *data) { - mptcp_sched_data_set_contexts(msk, data); - if (data->reinject) return bpf_burst_get_retrans(msk, data); return bpf_burst_get_send(msk, data); --=20 2.35.3