From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Ignatov Subject: [PATCH v2 bpf-next 0/4] bpf_skb_ancestor_cgroup_id helper Date: Sun, 12 Aug 2018 10:49:26 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Cc: Andrey Ignatov , , , , , , To: Return-path: Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:55720 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727774AbeHLU2f (ORCPT ); Sun, 12 Aug 2018 16:28:35 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.22/8.16.0.22) with SMTP id w7CHlrlF016746 for ; Sun, 12 Aug 2018 10:49:48 -0700 Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 2ksufjj8rv-2 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sun, 12 Aug 2018 10:49:48 -0700 Sender: netdev-owner@vger.kernel.org List-ID: v1->v2: - more reliable check for testing IPv6 to become ready in selftest. This patch set adds new BPF helper bpf_skb_ancestor_cgroup_id that returns id of cgroup v2 that is ancestor of cgroup associated with the skb at the ancestor_level. The helper is useful to implement policies in TC based on cgroups that are upper in hierarchy than immediate cgroup associated with skb. Patch 0001 provides more details and describes use-cases. Patch 0002 syncs UAPI changes to tools/. Patch 0003 adds skb*cgroup_id helpers to bpf_helper.h header. Patch 0004 adds selftest for the new helper and is an example of usage. Andrey Ignatov (4): bpf: Introduce bpf_skb_ancestor_cgroup_id helper bpf: Sync bpf.h to tools/ selftests/bpf: Add cgroup id helpers to bpf_helpers.h selftests/bpf: Selftest for bpf_skb_ancestor_cgroup_id include/linux/cgroup.h | 30 +++ include/uapi/linux/bpf.h | 21 +- net/core/filter.c | 28 +++ tools/include/uapi/linux/bpf.h | 21 +- tools/testing/selftests/bpf/Makefile | 9 +- tools/testing/selftests/bpf/bpf_helpers.h | 4 + .../selftests/bpf/test_skb_cgroup_id.sh | 62 ++++++ .../selftests/bpf/test_skb_cgroup_id_kern.c | 47 +++++ .../selftests/bpf/test_skb_cgroup_id_user.c | 187 ++++++++++++++++++ 9 files changed, 404 insertions(+), 5 deletions(-) create mode 100755 tools/testing/selftests/bpf/test_skb_cgroup_id.sh create mode 100644 tools/testing/selftests/bpf/test_skb_cgroup_id_kern.c create mode 100644 tools/testing/selftests/bpf/test_skb_cgroup_id_user.c -- 2.17.1