From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEC7FC43381 for ; Sun, 24 Feb 2019 03:09:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 706AF205C9 for ; Sun, 24 Feb 2019 03:09:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="kwp4I3GY"; dkim=pass (1024-bit key) header.d=fb.onmicrosoft.com header.i=@fb.onmicrosoft.com header.b="EgdDv64L" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728000AbfBXDJP (ORCPT ); Sat, 23 Feb 2019 22:09:15 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:35092 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726466AbfBXDJO (ORCPT ); Sat, 23 Feb 2019 22:09:14 -0500 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.27/8.16.0.27) with SMTP id x1O33adl016095; Sat, 23 Feb 2019 19:08:54 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=/pHLNIXn6jkdsBwEdbnGq28GpCP3wbH6w88xW/iLN9Y=; b=kwp4I3GYQLFxdd2l5ABfJiQUjqTa+afVj9+vc4ZzTrPxeqUO04SUyAnd0IAgrIB1LbQD pBst/6sfBXDxp/iZ0FiCzNXuTJ9juvNK2KSGR3g0DoGvvrVCgc3JkLUfnR1HL5FprdhO rsG0MKPNvcKHetSNeTvh6TA2GaYrhOslY34= Received: from mail.thefacebook.com ([199.201.64.23]) by m0089730.ppops.net with ESMTP id 2quc6c0nu3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 23 Feb 2019 19:08:54 -0800 Received: from prn-mbx04.TheFacebook.com (2620:10d:c081:6::18) by prn-hub05.TheFacebook.com (2620:10d:c081:35::129) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1531.3; Sat, 23 Feb 2019 19:08:52 -0800 Received: from prn-hub05.TheFacebook.com (2620:10d:c081:35::129) by prn-mbx04.TheFacebook.com (2620:10d:c081:6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1531.3; Sat, 23 Feb 2019 19:08:52 -0800 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1531.3 via Frontend Transport; Sat, 23 Feb 2019 19:08:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/pHLNIXn6jkdsBwEdbnGq28GpCP3wbH6w88xW/iLN9Y=; b=EgdDv64LD4redWzbtdYL4wo/jQINRij0btLZF1QJOzvB+3lGd0V2EsZ933UVA9unfBoQDuzCQEbRfudLrmNNuGn0HMrNKtfNu8l52NuGoInpsT3j9E1ut9HmFMFew0p551Myq7noKg75s/BuMFxWNWTw3iX8TPkRAbr95TN0NLI= Received: from MWHPR15MB1790.namprd15.prod.outlook.com (10.174.255.19) by MWHPR15MB1742.namprd15.prod.outlook.com (10.174.255.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.18; Sun, 24 Feb 2019 03:08:48 +0000 Received: from MWHPR15MB1790.namprd15.prod.outlook.com ([fe80::ac2f:bf87:54e:48a2]) by MWHPR15MB1790.namprd15.prod.outlook.com ([fe80::ac2f:bf87:54e:48a2%12]) with mapi id 15.20.1643.019; Sun, 24 Feb 2019 03:08:48 +0000 From: Martin Lau To: Eric Dumazet CC: Lawrence Brakmo , netdev , "Alexei Starovoitov" , Daniel Borkmann , "Kernel Team" Subject: Re: [PATCH v2 bpf-next 2/9] bpf: Add bpf helper bpf_tcp_enter_cwr Thread-Topic: [PATCH v2 bpf-next 2/9] bpf: Add bpf helper bpf_tcp_enter_cwr Thread-Index: AQHUyxQyHg2G+7UO40qzQN9osxozBaXuK2EAgAAa+IA= Date: Sun, 24 Feb 2019 03:08:48 +0000 Message-ID: <20190224030845.imwjbkoaxipuzb75@kafai-mbp.dhcp.thefacebook.com> References: <20190223010703.678070-1-brakmo@fb.com> <20190223010703.678070-3-brakmo@fb.com> <2a218060-8a62-150c-c05e-5433df18aaab@gmail.com> In-Reply-To: <2a218060-8a62-150c-c05e-5433df18aaab@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR11CA0069.namprd11.prod.outlook.com (2603:10b6:a03:80::46) To MWHPR15MB1790.namprd15.prod.outlook.com (2603:10b6:301:4e::19) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2620:10d:c090:180::1:693f] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 26631d94-12d7-4132-616f-08d69a05651f x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(2017052603328)(7153060)(7193020);SRVR:MWHPR15MB1742; x-ms-traffictypediagnostic: MWHPR15MB1742: x-microsoft-exchange-diagnostics: 1;MWHPR15MB1742;20:xwF8FUEKS5cHhzKrBfG5Mu8cVR+WVQEgYlY/cV67jNQG3110Gi5t0/357wS+k3rf/+Jl0JsT7XxLgJjXhOvnbrEO9mVb+PmAtyqtzwDIMHOb00FFIEzweloajsSfBea/QG5CDu8O9YutxR/ACTxbQr5Vq1PFJ0evMs9SpEd+vMA= x-microsoft-antispam-prvs: x-forefront-prvs: 09583628E0 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(366004)(396003)(346002)(136003)(39860400002)(189003)(199004)(97736004)(476003)(46003)(478600001)(81166006)(81156014)(8676002)(486006)(446003)(5660300002)(6916009)(71190400001)(4326008)(11346002)(71200400001)(86362001)(7736002)(305945005)(186003)(6512007)(9686003)(25786009)(1076003)(106356001)(99286004)(53936002)(316002)(6246003)(68736007)(8936002)(229853002)(2906002)(6116002)(54906003)(14444005)(5024004)(14454004)(256004)(6506007)(76176011)(53546011)(102836004)(386003)(6486002)(6436002)(105586002)(52116002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1742;H:MWHPR15MB1790.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: fb.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: gqaH8sSiCC/n7ftgNSy314c1tDjeqFP1GKrVBUBaC0NDmaOtlpXp8lA3vv0HuheS+/3OQX3n3JMn6kxf1x6GM7PucNKezajTM2c1JktQzPDwJs97G7hhEaD9YhiDRH/7cPi5pFjNbDfx979P8LhfgFdtnNJDa/0PcGrUGoRf5TLuLMx17C0RNHWA6TSR8tS3Z0zZ0fczYRllutMoVRrkWsI8zvtZInuhtX931F2juCSQ9WfWd1yH4psAV0PlAvSh46JVmZWAKfekbVC8XZUmqLAyL5nbVOd+P05e6IHIwpb+zGCGNEMKzprPqhCw0iDvzV4+D/2QAo0Ci4ZbXhOtjZQ8wWZ7MHzO9a6BPLVHPyoXczfu0JNejLsLb/dBgPdHB9zsZVjyY+XZ4on1gOw9bwitOJT1ObkqwUbvDRr7erE= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 26631d94-12d7-4132-616f-08d69a05651f X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Feb 2019 03:08:47.5528 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1742 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-24_01:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, Feb 23, 2019 at 05:32:14PM -0800, Eric Dumazet wrote: >=20 >=20 > On 02/22/2019 05:06 PM, brakmo wrote: > > From: Martin KaFai Lau > >=20 > > This patch adds a new bpf helper BPF_FUNC_tcp_enter_cwr > > "int bpf_tcp_enter_cwr(struct bpf_tcp_sock *tp)". > > It is added to BPF_PROG_TYPE_CGROUP_SKB which can be attached > > to the egress path where the bpf prog is called by > > ip_finish_output() or ip6_finish_output(). The verifier > > ensures that the parameter must be a tcp_sock. > >=20 > > This helper makes a tcp_sock enter CWR state. It can be used > > by a bpf_prog to manage egress network bandwidth limit per > > cgroupv2. A later patch will have a sample program to > > show how it can be used to limit bandwidth usage per cgroupv2. > >=20 > > To ensure it is only called from BPF_CGROUP_INET_EGRESS, the > > attr->expected_attach_type must be specified as BPF_CGROUP_INET_EGRESS > > during load time if the prog uses this new helper. > > The newly added prog->enforce_expected_attach_type bit will also be set > > if this new helper is used. This bit is for backward compatibility rea= son > > because currently prog->expected_attach_type has been ignored in > > BPF_PROG_TYPE_CGROUP_SKB. During attach time, > > prog->expected_attach_type is only enforced if the > > prog->enforce_expected_attach_type bit is set. > > i.e. prog->expected_attach_type is only enforced if this new helper > > is used by the prog. > >=20 >=20 > BTW, it seems to me that BPF_CGROUP_INET_EGRESS can be used while the soc= ket lock is not held. Thanks for pointing it out. ic. I just noticed the comments at ip6_xmit(): /* * xmit an sk_buff (used by TCP, SCTP and DCCP) * Note : socket lock is not held for SYNACK packets, but might be modified * by calls to skb_set_owner_w() and ipv6_local_error(), * which are using proper atomic operations or spinlocks. */ Is there other cases other than SYNACK? Thanks, Martin