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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 4019CC3A5A1 for ; Wed, 28 Aug 2019 21:04:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13CE522CF8 for ; Wed, 28 Aug 2019 21:04:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="gF5RmwXp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727003AbfH1VEM (ORCPT ); Wed, 28 Aug 2019 17:04:12 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:1328 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726883AbfH1VEL (ORCPT ); Wed, 28 Aug 2019 17:04:11 -0400 Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7SL47O9028837 for ; Wed, 28 Aug 2019 14:04:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=iPq7cHxWDw+ax28E2LpaitvRSxJaxf2/KfQM8ivfW8E=; b=gF5RmwXp0Ez/AChRy1q6sLElJwG/h2G0LVFPEyRSnL7UpSRGMoU69YNPrQqh/gRCU6S+ jOsdl18697ElyCerdkVMCOOu8OKBySw0UaGHPpMETLxhjHzqynEHqBe3VXI5dz6dd6L2 z+rTg96uxyQvKJHyrTK0ZJ4DanDTgv6sSkk= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 2unvfyhhn7-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 28 Aug 2019 14:04:10 -0700 Received: from mx-out.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 28 Aug 2019 14:03:56 -0700 Received: by devvm2868.prn3.facebook.com (Postfix, from userid 125878) id C7EB8A25D5D7; Wed, 28 Aug 2019 14:03:55 -0700 (PDT) Smtp-Origin-Hostprefix: devvm From: Julia Kartseva Smtp-Origin-Hostname: devvm2868.prn3.facebook.com To: , , , , , CC: Julia Kartseva Smtp-Origin-Cluster: prn3c11 Subject: [PATCH bpf-next 01/10] bpf: introduce __MAX_BPF_PROG_TYPE and __MAX_BPF_MAP_TYPE enum values Date: Wed, 28 Aug 2019 14:03:04 -0700 Message-ID: <43989d37be938b7d284028481e63df0a0471e29f.1567024943.git.hex@fb.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-08-28_11:2019-08-28,2019-08-28 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 adultscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 clxscore=1015 malwarescore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1906280000 definitions=main-1908280206 X-FB-Internal: deliver Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Similar to __MAX_BPF_ATTACH_TYPE identifying the number of elements in bpf_attach_type enum, add tailing enum values __MAX_BPF_PROG_TYPE and __MAX_BPF_MAP_TYPE to simplify e.g. iteration over enums values in the case when new values are added. Signed-off-by: Julia Kartseva --- include/uapi/linux/bpf.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 5d2fb183ee2d..9b681bb82211 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -136,8 +136,11 @@ enum bpf_map_type { BPF_MAP_TYPE_STACK, BPF_MAP_TYPE_SK_STORAGE, BPF_MAP_TYPE_DEVMAP_HASH, + __MAX_BPF_MAP_TYPE }; +#define MAX_BPF_MAP_TYPE __MAX_BPF_MAP_TYPE + /* Note that tracing related programs such as * BPF_PROG_TYPE_{KPROBE,TRACEPOINT,PERF_EVENT,RAW_TRACEPOINT} * are not subject to a stable API since kernel internal data @@ -173,8 +176,11 @@ enum bpf_prog_type { BPF_PROG_TYPE_CGROUP_SYSCTL, BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, BPF_PROG_TYPE_CGROUP_SOCKOPT, + __MAX_BPF_PROG_TYPE }; +#define MAX_BPF_PROG_TYPE __MAX_BPF_PROG_TYPE + enum bpf_attach_type { BPF_CGROUP_INET_INGRESS, BPF_CGROUP_INET_EGRESS, -- 2.17.1