From patchwork Fri Mar 22 14:08:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Hodges X-Patchwork-Id: 781974 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36BC647A73; Fri, 22 Mar 2024 14:08:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711116525; cv=none; b=qP8Ph2WOeyeH+XdCLlvOntReKStWwagb9S+kELZYvaQJCNkjjNOcEEx1xH5tBYBU0cft/7rQKP2TJbBg/hW3QmE+Shj0S4ug0jm/jFa1qrFYz0PNUWifsDMijla7W8jkXyP1Plqpw3iyejeLJr4Wy37TRLF41rElmtArY/gjFEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711116525; c=relaxed/simple; bh=UIw0hbWtNaDlGWJzbYyJLOmx5j+S2LrI6K9g4R/oh2U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FYrhBdL094/O9bvKczeMHaD6K0t+5JwvUp6Xy9y/xWlUY1yxdH7CbkABXM8JxQpKo8jr/NloPiBU8ROiEc8EyvYtaQSoGPL30GNQThP6ZApmdTd543yMIuEgvb/DIJuetwXTmaFu5CkfKcknZOiTCVDt3qPjanNLMqDSZG1wplw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nmkZApxX; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nmkZApxX" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-690c43c5b5aso13419826d6.1; Fri, 22 Mar 2024 07:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711116523; x=1711721323; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0GBU+KmNHRv/u1R4uPURpDW3nbDs5YT//LSngK9akqw=; b=nmkZApxX5ISs7v4FI/2/hijyw+lD9fQzSU/Ku6Nau0uftC5PCV92DitF1AwuWDXYdC /bs1eU6xP/zjQHPcpNEia2Af408Cwi1tv8Knr0VIuwUnD8UwIq8z0KDs1vQiVEkqOWOE grqGByejq+wqbrER01ZGSLxTlaiI3ABJduMl1nbIzs+kd0cywFYDCGXUP1DK0eTW04Cg +n4Npsgg2X2nojJjAYIS804olcooyL2Z4zaBxc5l6RG5LJF9D/gJN8r7JJPCjelvVE8U XwGXdPW9cVE8bgrFEtJWeZK2EfUmh2fXf8Mv16fzXpRUE4boZYCLKwj+h2jRPTkQSdlD BsOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711116523; x=1711721323; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0GBU+KmNHRv/u1R4uPURpDW3nbDs5YT//LSngK9akqw=; b=qmgDonMuQZJdrhRMvUs4KrunT5uXRTP04FZxeGNJiVK63XFAhOfsyjcpgcKLeKuNFS ZGxwfRjf4mmLPQi+FCp7nxwoQcOVmrYh90GGv726hdgaZ6rWZGZD3nAuUqwr6Ifr+fD6 09cBPnFolDWhfWB9rDrpHfQvDfQOGPOz1PF8wuGTO88SES+1jPMlX5zEpI4ANYcVT3ik A2AFraacEPMT9ZpQ9N3UoXYYyUGeyBQk4uJ9CJPG0jHbd7QkezD4hLgohfm3YuM6SEz7 Qagw+VCgDoYH5wmr1RId3WT6wqR0nwoSrlYrjRjc6X4qPYsYGOocB4tZkmeFC4S2QF4W 4zdg== X-Forwarded-Encrypted: i=1; AJvYcCXkrhA7pf9liwuiEw9rAqYUB3DAg4NeXVp5RfdnCvR+w4tFaXcgsWSR58LvDUeze5Fa30GhNl5IOzeLB6Q36+RT6d1msYNuZqRyFx5JkEHskWQ4g5GPpNgC5KsHzbrOcztdgP1KmalO4Z3Gl2l+YWeWfjGYN8bBCKzeEdO6uw== X-Gm-Message-State: AOJu0YydYMpU/881X/4Iib3aKbSVbYeybxogb3p+BlRgHAGIhGNOv4Ez 4rUNsE0VOyHmsXLgytjmVqbx95V1MpKNjek1zrJbFn/OJsoMP+S0 X-Google-Smtp-Source: AGHT+IHG8JFIG7cv/R8tzugTW/o95ZEQlG6AsudPtfcpwlxxlHRgCrDVnH3tSxalyUIFHcZ1z13Ajw== X-Received: by 2002:a05:6214:5183:b0:691:ad5:646b with SMTP id kl3-20020a056214518300b006910ad5646bmr2597975qvb.11.1711116523044; Fri, 22 Mar 2024 07:08:43 -0700 (PDT) Received: from l1441l.thefacebook.com ([2620:10d:c091:600::1:b4ee]) by smtp.gmail.com with ESMTPSA id kc22-20020a056214411600b0069124fff14esm1099508qvb.138.2024.03.22.07.08.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 07:08:42 -0700 (PDT) From: Daniel Hodges To: ast@kernel.org, pavel@ucw.cz, lee@kernel.org, linux-leds@vger.kernel.org, daniel@iogearbox.net, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Hodges Subject: [PATCH 1/3] leds: trigger: legtrig-bpf: Add ledtrig-bpf module Date: Fri, 22 Mar 2024 10:08:14 -0400 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch adds a led trigger that interfaces with the bpf subsystem. It allows for BPF programs to control LED activity through calling bpf kfuncs. This functionality is useful in giving users a physical indication that a BPF program has performed an operation such as handling a packet or probe point. Signed-off-by: Daniel Hodges --- drivers/leds/trigger/Kconfig | 10 +++++ drivers/leds/trigger/Makefile | 1 + drivers/leds/trigger/ledtrig-bpf.c | 72 ++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 drivers/leds/trigger/ledtrig-bpf.c diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig index d11d80176fc0..30b0fd3847be 100644 --- a/drivers/leds/trigger/Kconfig +++ b/drivers/leds/trigger/Kconfig @@ -152,4 +152,14 @@ config LEDS_TRIGGER_TTY When build as a module this driver will be called ledtrig-tty. +config LEDS_TRIGGER_BPF + tristate "LED BPF Trigger" + depends on BPF + depends on BPF_SYSCALL + help + This allows LEDs to be controlled by the BPF subsystem. This trigger + must be used with a loaded BPF program in order to control LED state. + BPF programs can control LED state with kfuncs. + If unsure, say N. + endif # LEDS_TRIGGERS diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile index 25c4db97cdd4..ac47128d406c 100644 --- a/drivers/leds/trigger/Makefile +++ b/drivers/leds/trigger/Makefile @@ -16,3 +16,4 @@ obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o obj-$(CONFIG_LEDS_TRIGGER_PATTERN) += ledtrig-pattern.o obj-$(CONFIG_LEDS_TRIGGER_AUDIO) += ledtrig-audio.o obj-$(CONFIG_LEDS_TRIGGER_TTY) += ledtrig-tty.o +obj-$(CONFIG_LEDS_TRIGGER_BPF) += ledtrig-bpf.o diff --git a/drivers/leds/trigger/ledtrig-bpf.c b/drivers/leds/trigger/ledtrig-bpf.c new file mode 100644 index 000000000000..e3b0b8281b70 --- /dev/null +++ b/drivers/leds/trigger/ledtrig-bpf.c @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * LED BPF Trigger + * + * Author: Daniel Hodges + */ + +#include +#include +#include +#include +#include +#include +#include + + +DEFINE_LED_TRIGGER(ledtrig_bpf); + +__bpf_hook_start() + +__bpf_kfunc void bpf_ledtrig_blink(unsigned long delay_on, unsigned long delay_off, int invert) +{ + led_trigger_blink_oneshot(ledtrig_bpf, delay_on, delay_off, invert); +} +__bpf_hook_end(); + +BTF_SET8_START(ledtrig_bpf_kfunc_ids) +BTF_ID_FLAGS(func, bpf_ledtrig_blink) +BTF_SET8_END(ledtrig_bpf_kfunc_ids) + +static const struct btf_kfunc_id_set ledtrig_bpf_kfunc_set = { + .owner = THIS_MODULE, + .set = &ledtrig_bpf_kfunc_ids, +}; + +static int init_bpf(void) +{ + int ret; + + ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_UNSPEC, + &ledtrig_bpf_kfunc_set); + ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, + &ledtrig_bpf_kfunc_set); + ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SYSCALL, + &ledtrig_bpf_kfunc_set); + ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SK_SKB, + &ledtrig_bpf_kfunc_set); + ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_CLS, + &ledtrig_bpf_kfunc_set); + ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_ACT, + &ledtrig_bpf_kfunc_set); + return ret; +} + +static int ledtrig_bpf_init(void) +{ + led_trigger_register_simple("bpf", &ledtrig_bpf); + + return init_bpf(); +} + +static void __exit ledtrig_bpf_exit(void) +{ + led_trigger_unregister_simple(ledtrig_bpf); +} + +module_init(ledtrig_bpf_init); +module_exit(ledtrig_bpf_exit); + +MODULE_AUTHOR("Daniel Hodges "); +MODULE_DESCRIPTION("BPF LED trigger"); +MODULE_LICENSE("GPL v2"); From patchwork Fri Mar 22 14:08:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Hodges X-Patchwork-Id: 782138 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF5BE46521; Fri, 22 Mar 2024 14:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711116527; cv=none; b=RVpjBjN0SAn/KiI3HT2R1n0YQOu0DwM2WkTM0Trqp2RS8CreubhCJVeNnuco9dJdXOKJvrf7OG2twX+7FwKThfBoLtFMdyNQQTrKCjomFytn7STt7CBlUhTRRvJX9TOVfpsuipe854xPWHBnA9RYPnwc4iNuBj6/vY5id8tUrgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711116527; c=relaxed/simple; bh=Bwz5RcwiuCpAzYmrEv7NZcbjbycUeN5g3JVLZ8o/qaw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rShtUbcnskV+7ph7mjcIEymayDFHhav0ljDyixpZb4/7uN69EwCpxygbo6GHBGGxVAnU/xSwilASX2gSBw948qa6uV0uLFihvrKMoLB0mEvGGyYRhRhMrcUTSizLpwVsbjRQNStmbbMQvN4Vz13pQt2ACKlBSSAMwYHPXqUxCzc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OaYwqF8K; arc=none smtp.client-ip=209.85.222.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OaYwqF8K" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-789db18e169so162094885a.1; Fri, 22 Mar 2024 07:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711116524; x=1711721324; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3X4/2Xm3PbRw8DKV5QisHNANeMPm8iTDsE53VCImsrM=; b=OaYwqF8KTB0Z29hICt3nuyrxhK9vj50H0te8sm0kb1x1EoGQDx+m9d5s3L7bmIguAk eMRE0rUgFVkMla3o1qBLCUSf3ZNafx45sf6QKCG+iaBcNSrPFQC1w4cuMuoSMJIJdkjv 7pM0yhMMrdrO0xFPXKaDeGia0bxDYU1RBqqnMA+0gG+xL8PmUlJ+EfCm6bYkJZhARAUr MQMK4/LtZWuig9FXN13uibNu6ML891MeJQsgUMrh9NfPbqD6Ru5jt0evT2jF6PIkOud6 RHYv/Sl0Snv/6xqpze41LhhHOKfIQEbZ9Hth21UXnA5zlK76IAkFlyvxd/Qpx868ilXh aXJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711116524; x=1711721324; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3X4/2Xm3PbRw8DKV5QisHNANeMPm8iTDsE53VCImsrM=; b=JIRptaMAGGsanFiSMy4utBBi//jdUQmlFJ3V0IbmPW1Dp+ysO3CVF5sIvj7boXgl0d lal0eBbD2DLCet5GxZOwCoCmkNgn2EXqayQH1FaEQrHWIcS0uUcUR/Y4OZysrhu/SLYB f5+kxl4AD5SmdBi4jzySOjHM9XNsrSjPEJoKqwQlqMuCRA8pv78KHpDILnhw/FzPMLUw 9pT7hpXswa4v+hZx8KSKUeWM5df3+htK67nuxbdHjLhqhIt4KZSCc+9KuFoVCHsq0nxr 3xREQMEmWAZ8B5RxMeh64atcMXm/HyRKQtvyZHaMzT4yyfCFVmHQlAgs3SpfhOCpnHK2 0TXg== X-Forwarded-Encrypted: i=1; AJvYcCWjM5xlAk0T8JIyR6Xo3SfGdPBuw7Ak1ONpjIH7FBvU38TMQSA9GxHiTvPV8cYGcL9PvyudGUVBt/7HhqYU7+fzeCxQ6+cNlJ0+bgkiqxzL8WQYYWXmvRY+EajR2SMo1eXzqVkuzJ/Ueu89GKL+esjQKZgzM2m26bWPkAHXbw== X-Gm-Message-State: AOJu0YxjT5FBLL7ZyxfPJ7HDM8nOHZwr0Td6grzCUJeVODQdyZEcQaWW TB91rbQxqsJ6049+L+t+S8Vq0NxXG87Y9U78dJ/Z7tAFlWch+Nx1 X-Google-Smtp-Source: AGHT+IFCYvlYKOKP9CKwLzd8AxesuhdY5oIXXHnN1fgoahG82YiWCA22iRstrQb1bDoSG/c4e2wu2A== X-Received: by 2002:a05:6214:4005:b0:690:d7dc:df9d with SMTP id kd5-20020a056214400500b00690d7dcdf9dmr2635918qvb.13.1711116524597; Fri, 22 Mar 2024 07:08:44 -0700 (PDT) Received: from l1441l.thefacebook.com ([2620:10d:c091:600::1:b4ee]) by smtp.gmail.com with ESMTPSA id kc22-20020a056214411600b0069124fff14esm1099508qvb.138.2024.03.22.07.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 07:08:44 -0700 (PDT) From: Daniel Hodges To: ast@kernel.org, pavel@ucw.cz, lee@kernel.org, linux-leds@vger.kernel.org, daniel@iogearbox.net, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Hodges Subject: [PATCH 2/3] selftests/bpf: Add selftests for bpf led programs Date: Fri, 22 Mar 2024 10:08:15 -0400 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add selftests for led trigger bpf programs. To run the tests use the "test_progs -t ledtrig_bpf" helper. Signed-off-by: Daniel Hodges --- tools/testing/selftests/bpf/config | 1 + .../testing/selftests/bpf/progs/ledtrig_bpf.c | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/ledtrig_bpf.c diff --git a/tools/testing/selftests/bpf/config b/tools/testing/selftests/bpf/config index 01f241ea2c67..17a027905dcd 100644 --- a/tools/testing/selftests/bpf/config +++ b/tools/testing/selftests/bpf/config @@ -42,6 +42,7 @@ CONFIG_IPV6_SEG6_BPF=y CONFIG_IPV6_SIT=y CONFIG_IPV6_TUNNEL=y CONFIG_KEYS=y +CONFIG_LEDS_TRIGGER_BPF=y CONFIG_LIRC=y CONFIG_LWTUNNEL=y CONFIG_MODULE_SIG=y diff --git a/tools/testing/selftests/bpf/progs/ledtrig_bpf.c b/tools/testing/selftests/bpf/progs/ledtrig_bpf.c new file mode 100644 index 000000000000..8bf1044e6896 --- /dev/null +++ b/tools/testing/selftests/bpf/progs/ledtrig_bpf.c @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +#include +#include +#include + + +extern void bpf_ledtrig_blink(unsigned long delay_on, unsigned long delay_off, + int invert) __weak __ksym; + + +SEC("perf_event") +int perf_blink(void) +{ + bpf_ledtrig_blink(30, 30, 0); + return 0; +} + + +SEC("syscall") +int fork_blink(void) +{ + bpf_ledtrig_blink(30, 30, 0); + return 0; +} + +char LICENSE[] SEC("license") = "GPL"; From patchwork Fri Mar 22 14:08:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Hodges X-Patchwork-Id: 781973 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F237D481DD; Fri, 22 Mar 2024 14:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711116529; cv=none; b=k0zMR5uCH84k+IuouqcY/SwMFf9GjqPwJe/i5DZ0133FrzypQ1Fdm5nOna+qpSfX2sdFgO6foYTFdm+bSdQjYnwVXTIRMozSAR3OukjLn5kf6jjCRNVAT54tqgM1YxNU/OTXYXigrKGEG47tVS5OiNPzmahUWSppsBJypws5ATg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711116529; c=relaxed/simple; bh=turmBzRmql7+31PREK5QaeIbLQ1mPenOQjp2Kh63vRo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YsMyxMvmiEdr+8OPwsL0lskyk1eQKkGyfSteR5iDaBqqLFdBXNWaQUirzT5ZDWXcZxQSasN45+S24TybBeTx9iy74NFMKCEnrqYFjTYJTquERMtau0MXfiWfFxT2i8zYkU62B4gR6xWqUGOOrRWd0ZmgoNnX5cBPBBuiUg6Vl/Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hMzFM8U1; arc=none smtp.client-ip=209.85.219.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hMzFM8U1" Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-69629b4ae2bso18566306d6.3; Fri, 22 Mar 2024 07:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711116527; x=1711721327; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FossVTVmjL68nyfPQZCKYx8qjMlzIsUJgOQrUcYnW2w=; b=hMzFM8U1kCyaTQ7g/z7ZI6NoAaySvmkBHudEV628nJxorupMhF+s3g4V7XLFxX7lCd FVB3S1dXXfTZtb8j4QoES03aH3jVA5DRsh1N9W+UJ9Teii/+q4JBX16m7NfKf2D3f61p WN38Sezr2nqB/cWDlAfEcBVbslqLPtToeMSnZdThlKYZTkQheB9zZFEI4tUOIprNhEyJ XSBXnPpF720a370lhC6TU4fJhZKv2JTf/MbFMbNinvidwCeOn283ibulhNXRaGpuax91 a87/ibJ0jRINLy3OPYLi0d/wUVvTDZY6ZnXcpgAc16Z+vTPnZ6UywrskSqgqeF7XPxkB Q2YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711116527; x=1711721327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FossVTVmjL68nyfPQZCKYx8qjMlzIsUJgOQrUcYnW2w=; b=cBmmoYS/cNewDZLS57HXUQU7QXIviZkGbcrbdcW0kIdrEfiSGPGuDTE/N2D34+oYd/ wzqPfkNTK3vqr/nsillL/d9kibzhgHlBFAkPIchy1Xgk2jqGNTPU/2/Zod5pwVRrQtn6 xaT8CUpaYRM/Z8rp0Fi9evjf2qyEcMLSohG2bKW8KKw1DU6msNgTETlvJRPdSxnfFoN3 nKW5J8ErMPPecOT34qd9C6UHYSqlYOTG5Ra/efPggMgpf3YCmIc4eu4PXEtrK7JouIHJ nsA0eOry6BQTAaTVRtR2l4ai+pYv6/Qgm8v7HS/Krh/lHJd/7mBdsqK5ROfTBo7sbdrg axgg== X-Forwarded-Encrypted: i=1; AJvYcCXS4WItrFALmty8qciGjWFSVaGe7bTXOdjsJ9fo65KhhX7KzH5ZKFsEEXUoU4Y4pUhCaMnZD6mPFsRN/5Q0KRbFVwlQxmkymOEjxbXZrVVWS1uk4WUjgj5I9BQVv2Wp0yeVZmd1tFkLD5zReVWghPnSFOMd4HGzSNn1bwgb8g== X-Gm-Message-State: AOJu0YzfvxMrjMqDBE5wE8vBVjpLi8iUFTmmNKGN+5bSREg8zrHK5nrN 4owPrudjLdZFGSGbuVdMGVDFFvcbd0fvw9kQYPv/22ax1G/dYpM9 X-Google-Smtp-Source: AGHT+IF2PYsxGINwGFey4BHK+Lz1mbILhIHEQY+3mK6bFTwve5jKVSRS6g1orEAM5Pr0SPDD6o/IYQ== X-Received: by 2002:a05:6214:234e:b0:691:43bd:f3ed with SMTP id hu14-20020a056214234e00b0069143bdf3edmr2703921qvb.57.1711116526826; Fri, 22 Mar 2024 07:08:46 -0700 (PDT) Received: from l1441l.thefacebook.com ([2620:10d:c091:600::1:b4ee]) by smtp.gmail.com with ESMTPSA id kc22-20020a056214411600b0069124fff14esm1099508qvb.138.2024.03.22.07.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 07:08:46 -0700 (PDT) From: Daniel Hodges To: ast@kernel.org, pavel@ucw.cz, lee@kernel.org, linux-leds@vger.kernel.org, daniel@iogearbox.net, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Hodges Subject: [PATCH 3/3] leds: trigger: Add documentation for ledtrig-bpf Date: Fri, 22 Mar 2024 10:08:16 -0400 Message-ID: <3ce269887c51319b2428a75e7fd008abc6fd6638.1711113657.git.hodges.daniel.scott@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Update the documentation for led triggers to include the BPF LED trigger. Signed-off-by: Daniel Hodges --- Documentation/leds/index.rst | 1 + Documentation/leds/ledtrig-bpf.rst | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 Documentation/leds/ledtrig-bpf.rst diff --git a/Documentation/leds/index.rst b/Documentation/leds/index.rst index 3ade16c18328..2af52a19d6bb 100644 --- a/Documentation/leds/index.rst +++ b/Documentation/leds/index.rst @@ -10,6 +10,7 @@ LEDs leds-class leds-class-flash leds-class-multicolor + ledtrig-bpf ledtrig-oneshot ledtrig-transient ledtrig-usbport diff --git a/Documentation/leds/ledtrig-bpf.rst b/Documentation/leds/ledtrig-bpf.rst new file mode 100644 index 000000000000..391a305f69d1 --- /dev/null +++ b/Documentation/leds/ledtrig-bpf.rst @@ -0,0 +1,13 @@ +==================== +BPF LED Trigger +==================== + +This LED trigger is useful for triggering LEDs from the BPF subsystem. This +trigger is designed to be used in combination with a BPF program that interacts +with the trigger via a kfunc. The exported kfuncs will have BTF names that +start with "bpf_ledtrig_". + +The trigger can be activated from user space on led class devices as shown +below:: + + echo bpf > trigger