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=-3.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 59E70C43381 for ; Fri, 1 Mar 2019 20:41:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 23BFB204EC for ; Fri, 1 Mar 2019 20:41:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="LNDBD8J0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbfCAUlC (ORCPT ); Fri, 1 Mar 2019 15:41:02 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:33670 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725862AbfCAUlB (ORCPT ); Fri, 1 Mar 2019 15:41:01 -0500 Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x21Kf0iX006835 for ; Fri, 1 Mar 2019 12:41:00 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=a2T2CSfHJjM/L7jxyvwRFEbEE4D7ZjjSFOS+yZoj15E=; b=LNDBD8J06Dfaycu6F0p98M0ryHI2xsnngWZdZ0mW6lIIFs+AAc+UtLfeU2fgHNBYWqb6 U+Hs5fy8gXIl0VdxU65Pdncq4YFBay3Gm7I1Lq3nQmDO4kWjRWMj2XtjTZZimy3ZBLrF bNGqSZ17ozszx/ZaB37E91RzsAdyHdETnZE= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2qy9af8ga0-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 01 Mar 2019 12:41:00 -0800 Received: from mx-out.facebook.com (2620:10d:c081:10::13) by mail.thefacebook.com (2620:10d:c081:35::127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5; Fri, 1 Mar 2019 12:38:45 -0800 Received: by devbig009.ftw2.facebook.com (Postfix, from userid 10340) id CD99B5AE176A; Fri, 1 Mar 2019 12:38:44 -0800 (PST) Smtp-Origin-Hostprefix: devbig From: brakmo Smtp-Origin-Hostname: devbig009.ftw2.facebook.com To: netdev CC: Martin Lau , Alexei Starovoitov , Daniel Borkmann , Kernel Team Smtp-Origin-Cluster: ftw2c04 Subject: [PATCH v3 bpf-next 0/5] bpf: Host Bandwidth Manager (HBM) Date: Fri, 1 Mar 2019 12:38:44 -0800 Message-ID: <20190301203844.4180919-1-brakmo@fb.com> X-Mailer: git-send-email 2.17.1 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-01_14:,, 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 Host Bandwidth Manager is a framework for limiting the bandwidth used by v2 cgroups. It consists of 1 BPF helper, a sample BPF program to limit egress bandwdith as well as a sample user program and script to simplify HBM testing. The sample HBM BPF program is not meant to be production quality, it is provided as proof of concept. A lot more information, including sample runs in some cases, are provided in the commit messages of the individual patches. A future patch will add support for reducing TCP's cwnd (we are evaluating alternatives). Another patch will add support for fair queueing's Earliest Departure Time. Until then, HBM is better suited for flows supporitng ECN. In addition, A BPF program to limit ingress bandwidth will be provided in an upcomming patchset. Changes from v1 to v2: * bpf_tcp_enter_cwr can only be called from a cgroup skb egress BPF program (otherwise load or attach will fail) where we already hold the sk lock. Also only applies for ESTABLISHED state. * bpf_skb_ecn_set_ce uses INET_ECN_set_ce() * bpf_tcp_check_probe_timer now uses tcp_reset_xmit_timer. Can only be used by egress cgroup skb programs. * removed load_cg_skb user program. * nrm bpf egress program checks packet header in skb to determine ECN value. Now also works for ECN enabled UDP packets. Using ECN_ defines instead of integers. * NRM script test program now uses bpftool instead of load_cg_skb Changes from v2 to v3: * Changed name from NRM (Network Resource Manager) to HBM (Host Bandwdith Manager) * The bpf helper to set ECN ce now checks that the header is writeable * Removed helper bpf functions that modified TCP state due to a concern about whether the socket is locked by the current thread. brakmo (5): bpf: add bpf helper bpf_skb_ecn_set_ce bpf: sync bpf.h to tools and update bpf_helpers.h bpf: Sample HBM BPF program to limit egress bw bpf: User program for testing HBM bpf: HBM test script include/uapi/linux/bpf.h | 10 +- net/core/filter.c | 28 ++ samples/bpf/Makefile | 5 + samples/bpf/do_hbm_test.sh | 436 +++++++++++++++++++++ samples/bpf/hbm.c | 441 ++++++++++++++++++++++ samples/bpf/hbm.h | 31 ++ samples/bpf/hbm_kern.h | 137 +++++++ samples/bpf/hbm_out_kern.c | 157 ++++++++ tools/include/uapi/linux/bpf.h | 10 +- tools/testing/selftests/bpf/bpf_helpers.h | 2 + 10 files changed, 1255 insertions(+), 2 deletions(-) create mode 100755 samples/bpf/do_hbm_test.sh create mode 100644 samples/bpf/hbm.c create mode 100644 samples/bpf/hbm.h create mode 100644 samples/bpf/hbm_kern.h create mode 100644 samples/bpf/hbm_out_kern.c -- 2.17.1