Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1436760yba; Sun, 14 Apr 2019 10:01:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpsaxv3gu7tuD5ezqpe0T4SUwCKMQBf3a5hiWWgyD0d15BNwCLePdC+vobdJgvts3KZfeA X-Received: by 2002:a17:902:8a4:: with SMTP id 33mr71163000pll.7.1555261279903; Sun, 14 Apr 2019 10:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555261279; cv=none; d=google.com; s=arc-20160816; b=m+EtIN9M9kyrk2yOicC89QLbCPtb6tQtne6uaoaC7N4frm9VGvZsOwg8Fuam/zaYnX 1rOjlvoCOodIDl8vaa1uJN3pbQ/qeiCRSqbCfnBC4VECE4c7+DzIEKYLtdL2x960Fkit HH5JWMMP4HW+q7tlsWKHknwIhAC18QNfic1qtn3wwi7yIqHi+wsYyKQ7897z8REmnijX V2d072vAaZt5BftlC3QH93v5nJoAGedJErmGm1AmE+MEiN/3QAvfHAfsUK5ynYt/F9eE H9uzVHkIOll20jBg1KKu7Dlxu7X/FQg/rbEWFS1ySVYPtemK40Cw98i0vDaj2YkOWvOJ Mg4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ssMaGZRioh3Tphw5NqaiTGI5HreidLvqtXve6fx9Qg8=; b=EOR/8NNbroGZwIEKakS19f0mqXd33rPXAmoCXyAYc8FCBz2jGQGfKFxlY59L9thi8s M3o0Ibbffw8BhwQKwcdSbuFl/uDXF4C3i2wpkTUSXjOwa1pLQkubn1h3YL8nxy3gTJ7D m6+N5j8Wtl4sAmWHwDUUQUfLTIwfprvhYnVe2R7AmmV4aUN+cNqdFd6YDGR7A3JumAt6 mkLCeCet8KK+hLmROoHQFu6JeY+9lhEKWA3+/Y0md2h3qu+YefqKflGiot+4kVcvg4Dw 27DY/E2s7r3V5fjbbK2G3zkbfLeMgbrXTYIr570W3m9XRb/n1kQEOYfwOrH9yHoNTswe /tYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OIC6dQt7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n15si43143610pgg.308.2019.04.14.10.00.56; Sun, 14 Apr 2019 10:01:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OIC6dQt7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726835AbfDNRAR (ORCPT + 99 others); Sun, 14 Apr 2019 13:00:17 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:33548 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbfDNRAR (ORCPT ); Sun, 14 Apr 2019 13:00:17 -0400 Received: by mail-ed1-f66.google.com with SMTP id d55so11722411ede.0; Sun, 14 Apr 2019 10:00:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ssMaGZRioh3Tphw5NqaiTGI5HreidLvqtXve6fx9Qg8=; b=OIC6dQt7mp0q4bf/l9FI6aGZzU6mjZa2tx9p5NyoHwwG6XS450wu8P/EoNBs8817n4 hrY7FBdB/cHpGq8xTfStfEjG9HDOBhOpwv4AvQKB3BMA20FLtqFLi5Sx3VAhkHNUDkCV Z38U2RZ8PhV74S6YE9eGcQvz1nfwljkfufF3ZjBLMXfglk7GYLDV1bSidgdzZwKKO9As yKXi7/BFOcg8z5X7hTpUtGSMzRQNrjRxz6OCZJFMkoj6b2bzWH95fHXG2eHLBogkntTT jqD7bcwElt0KIfbRQqU/HuLXbCt0MJHNlV7v6nlDkuBdtieZk9A1eT3YwHcsVSRwisfi Liag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=ssMaGZRioh3Tphw5NqaiTGI5HreidLvqtXve6fx9Qg8=; b=ZOiWr1V/1x4hki5lMxj1gP6eow1DOmHn6QdwlmYB8L1vn6wRiana+B36kDOfXFIx5G XzYBkoaKH89QA7+g3QoenhNb6CMfX73QssVtMl/kRxtLD9YYYbyRJtBE0BI3Ph1QYIw0 wcRHiued81AhP/P8J1Pr4Oi0tmhHOmmqe0T4rohPTyn0M3dn5QHrM5XYD/dK10lqzIDk +1I1a7JPdKhvVRMCHWLxII+//KCFRUBSbEG/RYpb6dufFmqxLKFfH/iP/7JssOHSyP7D bthfef/W6ho0X12jAWxCGn4r7zVEPYR5j8hmt8rxqZjif21JE+Z8ZAHqAPo5mUmm/Z5L 9HcA== X-Gm-Message-State: APjAAAXbdlZb8m9e178VhQtQcX8QXQiq1Ho6QH2s28LPf+D+QOs3g9Tt gMDHKRoiduh7pHu9R9OVkv8= X-Received: by 2002:a17:906:7e47:: with SMTP id z7mr6855407ejr.248.1555261215106; Sun, 14 Apr 2019 10:00:15 -0700 (PDT) Received: from localhost.localdomain (ip5b402483.dynamic.kabel-deutschland.de. [91.64.36.131]) by smtp.gmail.com with ESMTPSA id o9sm8828926ejb.26.2019.04.14.10.00.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 10:00:14 -0700 (PDT) From: Alban Crequy X-Google-Original-From: Alban Crequy To: ast@kernel.org, daniel@iogearbox.net Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alban@kinvolk.io, iago@kinvolk.io, Mauricio Vasquez B Subject: [PATCH bpf-next v1] bpf: add map helper functions push,pop,peek in more BPF programs Date: Sun, 14 Apr 2019 18:58:46 +0200 Message-Id: <20190414165846.22107-1-alban@kinvolk.io> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alban Crequy commit f1a2e44a3aec ("bpf: add queue and stack maps") introduced new BPF helper functions: - BPF_FUNC_map_push_elem - BPF_FUNC_map_pop_elem - BPF_FUNC_map_peek_elem but they were made available only for network BPF programs. This patch makes them available for tracepoint, cgroup and lirc programs. Signed-off-by: Alban Crequy Cc: Mauricio Vasquez B --- drivers/media/rc/bpf-lirc.c | 6 ++++++ kernel/bpf/cgroup.c | 6 ++++++ kernel/trace/bpf_trace.c | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/drivers/media/rc/bpf-lirc.c b/drivers/media/rc/bpf-lirc.c index 390a722e6211..ee657003c1a1 100644 --- a/drivers/media/rc/bpf-lirc.c +++ b/drivers/media/rc/bpf-lirc.c @@ -97,6 +97,12 @@ lirc_mode2_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) return &bpf_map_update_elem_proto; case BPF_FUNC_map_delete_elem: return &bpf_map_delete_elem_proto; + case BPF_FUNC_map_push_elem: + return &bpf_map_push_elem_proto; + case BPF_FUNC_map_pop_elem: + return &bpf_map_pop_elem_proto; + case BPF_FUNC_map_peek_elem: + return &bpf_map_peek_elem_proto; case BPF_FUNC_ktime_get_ns: return &bpf_ktime_get_ns_proto; case BPF_FUNC_tail_call: diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index e58a6c247f56..fcde0f7b2585 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -713,6 +713,12 @@ cgroup_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) return &bpf_map_update_elem_proto; case BPF_FUNC_map_delete_elem: return &bpf_map_delete_elem_proto; + case BPF_FUNC_map_push_elem: + return &bpf_map_push_elem_proto; + case BPF_FUNC_map_pop_elem: + return &bpf_map_pop_elem_proto; + case BPF_FUNC_map_peek_elem: + return &bpf_map_peek_elem_proto; case BPF_FUNC_get_current_uid_gid: return &bpf_get_current_uid_gid_proto; case BPF_FUNC_get_local_storage: diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index d64c00afceb5..91800be0c8eb 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -569,6 +569,12 @@ tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) return &bpf_map_update_elem_proto; case BPF_FUNC_map_delete_elem: return &bpf_map_delete_elem_proto; + case BPF_FUNC_map_push_elem: + return &bpf_map_push_elem_proto; + case BPF_FUNC_map_pop_elem: + return &bpf_map_pop_elem_proto; + case BPF_FUNC_map_peek_elem: + return &bpf_map_peek_elem_proto; case BPF_FUNC_probe_read: return &bpf_probe_read_proto; case BPF_FUNC_ktime_get_ns: -- 2.20.1