From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935367AbdEWAk3 (ORCPT ); Mon, 22 May 2017 20:40:29 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:52992 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934067AbdEWAkY (ORCPT ); Mon, 22 May 2017 20:40:24 -0400 From: Teng Qin To: "David S . Miller" CC: Peter Zijlstra , Brendan Gregg , Daniel Borkmann , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Kernel Team , "Alexei Starovoitov" Subject: [PATCH net-next] bpf: update perf event helper function signature and documentation Thread-Topic: [PATCH net-next] bpf: update perf event helper function signature and documentation Thread-Index: AQHS010Mg9ZE0fNoskCvU5ua9kAkGw== Date: Tue, 23 May 2017 00:39:34 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=fb.com; x-originating-ip: [2620:10d:c090:200::f:51e] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CO1PR15MB0968;7:Yb63KxlZqKoCZjYYKMXkcQ2YjNjNo806ufO96GdyBYZllogH8ChOHm0Ykek25G91ACVuBFoJUgRFUV6oie7erscpxTEARcGR4e79t7a3vbCqVUC4OZD3uati/z/E7SOgfJzcP3h6q7uMki246Hlw80hDaePnNYj1IeVhZM03nAt4FcFEOWr/5ncWoMwS4O5yhW7qLb9/htamJfvpOmFvr5T5MnWexx4CkD7EiywXFz3T2ici0NGyY+CddjOQx2gwwUysTvTfVGZ8KaRytRGdNFieM0paasQFkvmIlDPOX6teATeCDrIX5I2nEJFmiwxxFu+I7k28W8ZeIzull9QCLQ==;20:NG0fi79qQAq/Q57kouw7yA4uvDhn9I1B4KsOPnmPeVv8GIin4bQtak/bFbrsTHHy8XzlUjEFmxgL81eKB2KnZmCUCC7+f/7SvZUAHX2BCx3V8hMjJ6M+CUzhb4amRv9kpkSGOuQTSzrhxnLa96GhAZNaETmQmoppNc3UtKrDSso= x-ms-traffictypediagnostic: CO1PR15MB0968: x-ms-office365-filtering-correlation-id: bb34ed1b-57e2-408b-4bf7-08d4a1742ef7 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075);SRVR:CO1PR15MB0968; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(67672495146484); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(20161123564025)(6072148);SRVR:CO1PR15MB0968;BCL:0;PCL:0;RULEID:;SRVR:CO1PR15MB0968; x-forefront-prvs: 0316567485 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39400400002)(39410400002)(39840400002)(39450400003)(39850400002)(82746002)(4326008)(102836003)(478600001)(6116002)(36756003)(77096006)(6486002)(25786009)(2900100001)(7736002)(83716003)(305945005)(86362001)(122556002)(5660300001)(6916009)(33656002)(53936002)(110136004)(189998001)(8676002)(6436002)(54906002)(99286003)(38730400002)(15650500001)(3660700001)(50986999)(3280700002)(81166006)(2906002)(54356999)(8936002)(6512007);DIR:OUT;SFP:1102;SCL:1;SRVR:CO1PR15MB0968;H:DM5PR15MB1915.namprd15.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <1ED13E5F2E3B0846B7CD9E1C75A6D01B@namprd15.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 May 2017 00:39:34.0758 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR15MB0968 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-22_13:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v4N0ehE7011022 From: Teng Qin This commit updates function signature of the bpf_perf_event_output and bpf_perf_event_read helpers to match their implementation. Also updates their documentation in the header files. Signed-off-by: Teng Qin Acked-by: Alexei Starovoitov --- include/uapi/linux/bpf.h | 11 +++++++---- samples/bpf/bpf_helpers.h | 5 ++--- tools/include/uapi/linux/bpf.h | 11 +++++++---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 94dfa9d..e78aece 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -313,8 +313,11 @@ union bpf_attr { * @flags: room for future extensions * Return: 0 on success or negative error * - * u64 bpf_perf_event_read(&map, index) - * Return: Number events read or error code + * u64 bpf_perf_event_read(map, flags) + * read perf event counter value + * @map: pointer to perf_event_array map + * @flags: index of event in the map or bitmask flags + * Return: value of perf event counter read or error code * * int bpf_redirect(ifindex, flags) * redirect to another netdev @@ -328,11 +331,11 @@ union bpf_attr { * @skb: pointer to skb * Return: realm if != 0 * - * int bpf_perf_event_output(ctx, map, index, data, size) + * int bpf_perf_event_output(ctx, map, flags, data, size) * output perf raw sample * @ctx: struct pt_regs* * @map: pointer to perf_event_array map - * @index: index of event in the map + * @flags: index of event in the map or bitmask flags * @data: data on stack to be output as raw data * @size: size of data * Return: 0 on success or negative error diff --git a/samples/bpf/bpf_helpers.h b/samples/bpf/bpf_helpers.h index 9a9c95f..a94ce42 100644 --- a/samples/bpf/bpf_helpers.h +++ b/samples/bpf/bpf_helpers.h @@ -37,9 +37,8 @@ static int (*bpf_clone_redirect)(void *ctx, int ifindex, int flags) = (void *) BPF_FUNC_clone_redirect; static int (*bpf_redirect)(int ifindex, int flags) = (void *) BPF_FUNC_redirect; -static int (*bpf_perf_event_output)(void *ctx, void *map, - unsigned long long flags, void *data, - int size) = +static int (*bpf_perf_event_output)(void *ctx, void *map, u64 flags, + void *data, int size) = (void *) BPF_FUNC_perf_event_output; static int (*bpf_get_stackid)(void *ctx, void *map, int flags) = (void *) BPF_FUNC_get_stackid; diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 94dfa9d..e78aece 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -313,8 +313,11 @@ union bpf_attr { * @flags: room for future extensions * Return: 0 on success or negative error * - * u64 bpf_perf_event_read(&map, index) - * Return: Number events read or error code + * u64 bpf_perf_event_read(map, flags) + * read perf event counter value + * @map: pointer to perf_event_array map + * @flags: index of event in the map or bitmask flags + * Return: value of perf event counter read or error code * * int bpf_redirect(ifindex, flags) * redirect to another netdev @@ -328,11 +331,11 @@ union bpf_attr { * @skb: pointer to skb * Return: realm if != 0 * - * int bpf_perf_event_output(ctx, map, index, data, size) + * int bpf_perf_event_output(ctx, map, flags, data, size) * output perf raw sample * @ctx: struct pt_regs* * @map: pointer to perf_event_array map - * @index: index of event in the map + * @flags: index of event in the map or bitmask flags * @data: data on stack to be output as raw data * @size: size of data * Return: 0 on success or negative error -- 2.9.3