From patchwork Tue Mar 26 01:14:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Hodges X-Patchwork-Id: 13603221 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 05A6E1CA8A; Tue, 26 Mar 2024 01:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711415694; cv=none; b=aoaGrE7xvzmu9JI/bzymEym2RiJNRAzHjze0VGDZ/JBRd/ZMLjOv17PVNnq5wkSwpuMn00CvXLDRl5XuCLq0GYoIVLiE4EcYFYeBN6ift/68JC3lzgTmuZUko4zTy0eO4ovZcHveOIUYmW5RocsxD3j/3O2PmRkBV/D7+kp9X0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711415694; c=relaxed/simple; bh=LNamZ53n+sf21S1d37n51soSjho7bKz8IPCYfm5DExQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sRTZN1uzhswLee5GDQSXEQYKCaxnGxTEFCjpJPevqDxZT+34F42v/2B+7eTbPDUYG/w1o3/SVRsBnVj2vtGznf9IdYZ4KuiRHZwgkO1ee8ODCI2kyqP/bIWZdqVCi0UT2cHN2HCl3gEBtiz6amWlOlU/jbXHMoixFDMek7+LEeQ= 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=Va8CB32L; arc=none smtp.client-ip=209.85.222.177 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="Va8CB32L" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-789e6e1d96eso341297085a.3; Mon, 25 Mar 2024 18:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711415692; x=1712020492; 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=y+qYgUKU9q0TXu31eGFg1uSz+Dtr3jRQUSc53hkqfKA=; b=Va8CB32L+G943QxTZFEzujdV69geUZBs99OQ3ZromGPd+W6lG5ISKmgLEiF+UzdDQ5 ybeALOgLLMTeGTMOGgI/VzmOQ0z8NMv8A9ulQfxqZOJffD5O66e6Z8/yTSi+/u7hfy7r duUsXKKJYjXzyJtp1Yh0RNy1Xt3QMCxwAocJt7G9g9eHJhc+10UIPeDGv0ZFKr2Wg0Qf ia9UbIMFBirRA4OILcS8eYKY1J3dddNaZIBZp5A/oDiQmPi/dtI0UbiWrbOKNhSICvUi 1lOWe5so9d4Z3MArHR2VW9ciUhdDDdNUZUrnBTtbIS5zV2Z8QRhxbYH5p/AkD5ktImk7 sgQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711415692; x=1712020492; 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=y+qYgUKU9q0TXu31eGFg1uSz+Dtr3jRQUSc53hkqfKA=; b=phvkuzBmeBvUGg1T5edfPzTiVw5KWVs1Ob/XiznZDItu6zyAEwxjtTWpjAAB2jgAgA 3awsWTK92xmfHCkT0imm2A/cmfMNQ8cYwlz4Y8PSKwuJVy8p3zv9ZS1YCKbSWPFK1MMV IVPahn/f7PHv+YnOu80cPnRXM8S+IKB5OLqDG+rHTHEF9e7drbS1pRs7h4oFVcSmVqDt n3CxFZBsU6EDbysGz3XXG4498ku/bbkDXVANRUISutt2irgeqWMfCLq36HM23coxM6jS 7QwXR74qF66VUvZphE1w/HnVKicyILGipHLN6u3WOTWSAbzHdldTztgTtzDmTChPl+Ly vRsw== X-Forwarded-Encrypted: i=1; AJvYcCV8BLmAFVL+Zc7bTscSak3T3c6xZ87kD2yvmCgvYs+T7d4fX+nJq32dRNrUsDUiA2WfolYvGDmhscRhwh2nRSmcDOL0408Epoyb5I4qLJhvmY7BEHsT5k+7RCBYT1ElnQEYTLxKXstyk9WaJOBAE1BlyivnuOHPfPsuXgHCaw== X-Gm-Message-State: AOJu0YwLo93FQG3nMy3/TZtsUWtTqusvTjwSYqtV9tQIQsf+LSM4qCac xPfcgImRgbL+49lxeU6C8Km30E3H2VkRWp1PRtcIvYFhLLbQRxRC X-Google-Smtp-Source: AGHT+IEa7/w1wZJ6dtNAPScNOQYk15s3E7Pu1UhRaNngaF89B9MLc6jMZ8CwFx7PUljKVceoyNzlaw== X-Received: by 2002:a05:6214:d63:b0:696:9e90:e025 with SMTP id 3-20020a0562140d6300b006969e90e025mr220539qvs.42.1711415691857; Mon, 25 Mar 2024 18:14:51 -0700 (PDT) Received: from l1441l.lan0.xorvpn.com (pool-98-116-41-146.nycmny.fios.verizon.net. [98.116.41.146]) by smtp.gmail.com with ESMTPSA id c5-20020a056214224500b006968d8f1c05sm1697208qvc.26.2024.03.25.18.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 18:14:51 -0700 (PDT) From: Daniel Hodges To: hodges.daniel.scott@gmail.com Cc: ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, lee@kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, pavel@ucw.cz Subject: [PATCH v2 1/3] leds: trigger: legtrig-bpf: Add ledtrig-bpf trigger Date: Mon, 25 Mar 2024 21:14:45 -0400 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: bpf@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 | 73 ++++++++++++++++++++++++++++++ 3 files changed, 84 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..99cabf816da4 --- /dev/null +++ b/drivers/leds/trigger/ledtrig-bpf.c @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * LED BPF Trigger + * + * Author: Daniel Hodges + */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +DEFINE_LED_TRIGGER(ledtrig_bpf); + +__bpf_kfunc_start_defs(); +__bpf_kfunc void bpf_ledtrig_blink(const char *led_name__str, unsigned long + delay_on, unsigned long delay_off, int invert) +{ + struct led_classdev *led_cdev; + + rcu_read_lock(); + list_for_each_entry_rcu(led_cdev, &ledtrig_bpf->led_cdevs, trig_list) { + if (strcmp(led_name__str, led_cdev->name) == 0) { + led_blink_set_oneshot(led_cdev, &delay_on, &delay_off, + invert); + break; + } + } + rcu_read_unlock(); +} +__bpf_kfunc_end_defs(); + +BTF_KFUNCS_START(ledtrig_bpf_kfunc_ids) +BTF_ID_FLAGS(func, bpf_ledtrig_blink, KF_TRUSTED_ARGS) +BTF_KFUNCS_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); + return ret; +} + +static int __init 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 Tue Mar 26 01:14:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Hodges X-Patchwork-Id: 13603222 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (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 7573C1CFB9; Tue, 26 Mar 2024 01:14:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711415699; cv=none; b=kqb+I6Lg6KT8Q/6yuXMufntP5T7KPnljHEIEAUmjn1hg/wmHblfC+1NXRYGFutASGZVIM9sM8DvFlkIHDkv2JOotXQtIuZY9NsvldlFoy5g+jqnTP+vWos7qH95Hy8Z6eI3Y1Q3+QMWJtee+nWUYkJpkqD71eS88Hzy8HEo6E8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711415699; c=relaxed/simple; bh=M+BsVnMf+g67qs1SA+qAhNNLZnMvvsIucUdMjPkinPk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zw7gf78Qsi6bJkfNnJwqT/NmkYApZ7E8nBv3EEe1AlgAXABHFfYZWgk4o3VUjmBBaeHjSXuke8va/AzzfYjXXIZep149WtWLMGZTaq6x5J01OdWBGb6x2cjocdLBWV7yS4d0vQSmdvEw9qhXAZw75tuhVo2DMGJy+ErN/2h5G2M= 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=IsSH8IrK; arc=none smtp.client-ip=209.85.219.52 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="IsSH8IrK" Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-696499bd61eso47967316d6.0; Mon, 25 Mar 2024 18:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711415696; x=1712020496; 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=QHLkuarhJN7RySXMXypyHFsucB45L1ocZHQUOCELI/A=; b=IsSH8IrK6HuTaz7/zlAkjR4DZAcfJTC6usEpAoBKFc2+BvUmiZ4QqTT4D+JlA1ONnw rpmwnjylyvLxfDzb4re+DoNTCaG65FfPRscSGdIVoHceyjWMtMiRVvIFf/HG+LxH9qjY 7m7rUh4+XvcaN8pdS5+e2kXYbqMnNCeZoGW5e7sludtlLZWXg1yfDS1mhVlUIXfCpqdF kZUQrWp38hWdX6GQw+7O2WZD17E0zMilPD2lF5EitGNhZYQ/n1AM4Q4SVTjUqH5FZtIz rgWC3/dRYojGF6ba3M28xAZYGRMRzqrpimyfxJ5JwNU/J303UaUImUd1LwIVpuZMjyY5 egKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711415696; x=1712020496; 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=QHLkuarhJN7RySXMXypyHFsucB45L1ocZHQUOCELI/A=; b=v1WT4JmkzgjcXGK7emnTScL1lAatHsq0tsdGrRoc3MQ1CJAlGKXgMxyTDIQwHj+NkD XF/DZ7/sWRmnjfWeIuG90GqsHtBJI2VP6A22Gp9GwLVNdBamqtyHf2qY3V9LQjv1vRVd i/7WABEOF5LQvW3kwCNJI0OTdVBozQLPbfwiZ4PrtkokSR3xBEx5X1JVXesqFsuw0sry VUILhLTlfPSMkpiCFQKFq2M9jRSkUJpnVnjGLfc54Uq/cOga/aadYqjfBP68W1ylHeW2 tJHV/OeV/6wyz1jApyU9CPCZlqoF/dsOzfEE8Dvx75t57lfYXhX3HkK5mjtFxjzA8nEd ndZQ== X-Forwarded-Encrypted: i=1; AJvYcCXnltSf0FIbjMQQyzXFm7NlMTE0IWQevyH6Y4kJxf5GYVkP27WaxdMDzX0XTXYN1ZEnEGnQpv7fwVJXXbFqv20R4+whRsFd3gn4aD4DC1IcisWzCgC0JyeLp3Pa4s5udHCGLj8rLcb3IIOm3+fnwQHDMKVPppIsLmMbFmxxBg== X-Gm-Message-State: AOJu0YzSEejsldLjVC8FjUd3prbdtGZZsQtjMPQo27CVvFjOAKm/LQWA iYLWzI7hu8ToyRyidWsY6n3/jH7OrE5W7HTEJBbwL3zUH2AX00NJqadpCpOc4KU= X-Google-Smtp-Source: AGHT+IFM0W4EV5psIPVeZrrsINiZeNegya11qTR6utIwolZBlz3euoGtForb1TvcUdg3zsfbWf2zhw== X-Received: by 2002:a05:6214:cc8:b0:696:1e36:6d0a with SMTP id 8-20020a0562140cc800b006961e366d0amr13848280qvx.14.1711415696334; Mon, 25 Mar 2024 18:14:56 -0700 (PDT) Received: from l1441l.lan0.xorvpn.com (pool-98-116-41-146.nycmny.fios.verizon.net. [98.116.41.146]) by smtp.gmail.com with ESMTPSA id c5-20020a056214224500b006968d8f1c05sm1697208qvc.26.2024.03.25.18.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 18:14:56 -0700 (PDT) From: Daniel Hodges To: hodges.daniel.scott@gmail.com Cc: ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, lee@kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, pavel@ucw.cz Subject: [PATCH v2 2/3] selftests/bpf: Add selftests for bpf led programs Date: Mon, 25 Mar 2024 21:14:46 -0400 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: bpf@iogearbox.net 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 | 32 +++++++++++++++++++ 2 files changed, 33 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..d2096f13e5b6 --- /dev/null +++ b/tools/testing/selftests/bpf/progs/ledtrig_bpf.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +#include +#include +#include + + +extern void bpf_ledtrig_blink(const char *led_name, unsigned long delay_on, + unsigned long delay_off, int invert) __weak __ksym; + + +SEC("perf_event") +int perf_blink(void) +{ + const char *led = "test_led"; + + bpf_ledtrig_blink(led, 30, 30, 0); + return 0; +} + + +SEC("syscall") +int fork_blink(void) +{ + const char *led = "test_led"; + + bpf_ledtrig_blink(led, 30, 30, 0); + return 0; +} + +char LICENSE[] SEC("license") = "GPL"; From patchwork Tue Mar 26 01:14:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Hodges X-Patchwork-Id: 13603223 Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (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 EB8D91D559; Tue, 26 Mar 2024 01:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711415702; cv=none; b=AtI8IhqB8O/+TX4RXG4Apcvk9K04CzAdzS3M2BG1uTsmvy1nLWhB/VF9yihV8ZiGPQIK7OHWhuPTU1KFfTPxZnRbEMoBgLBOD9B6qMEQGqp5TsDi7OxS8E/pTth3v9iHxR3gg3qUFtcR0YAAocx338wis2bI/skOPt64XTOLxZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711415702; c=relaxed/simple; bh=/jeoDp3vy66EH4yWjouOvq6LjAc/tE2jC0AC/sCGCgE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j5+BDe8XWWbwB/v9xWQgUtn25wKYRw4450P52KtQYenMCPGNpO+CLjIXD/lZpnpqPVZSXTieDyG224n9iklwqcoU3V/Hn0uFTUMUzNXBw68pyV34a42l2TepffXychiukE5713aV9pc02dupYW05wtmmMfR/0ngXYhsdrJAgCnM= 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=S5ZpkSP7; arc=none smtp.client-ip=209.85.219.44 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="S5ZpkSP7" Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6967e656fdeso5554156d6.0; Mon, 25 Mar 2024 18:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711415700; x=1712020500; 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=3McBefS0GNuytNG8zXk6mlYlPk717ppRvRvudwS38bY=; b=S5ZpkSP7qDZ/4PsWvqGbMX7bV5C64yYYgsrsUt/WFLSF3yHUz7JA0ZhwCqtQl8/j7G rxGdEIsO77ULCDHofSkJaby5PRIq++XZk7JvBnZtkEoDTAMnsyBLVwZhoyQdGmFzZud1 atc9tVkVs4gI6/SAfwAq/R7bdY+mGBcIdqaqVT2JCd1ya1tWwRgwA2AqlsCRbrowptw+ Wf4VZMXkzRZa0wdG1JxhUSDgXPkdVlmi/sTHTwBm2L6cAyWqjJbCv3TSsgYZ/VyG8Rx6 bugiSb3cZ82nYvxEBOcJTRBne5Yea9R5d/B8fqTu9N1qcBRt6WIYymYVAM5/HCtRCq5B qmlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711415700; x=1712020500; 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=3McBefS0GNuytNG8zXk6mlYlPk717ppRvRvudwS38bY=; b=AJlRgVCHgVWbQpPkxWH8xJF7W9yqws2BZUvMnVhUN2ZFA/S6nMqJl1LKh+MTUU7JjA 2iPS+JW0i3w3jqq0jkJMO1Vont7/xVrd6PDC312tfZ6J3roZ12wU1jdcvWzrQ/DaIJhD cDCqdDvgam4Y6/X+M6xi8yae71QlFko3W6MpzQe/IKKxyhQVdwp30PSyOZ74Ka02YJ3t V/SMrJFT9gjSuKQLb1Ftz2m20oVfunDRPtYc1cdd0bkQwbBx253qo6Sh6eKPE++Cynge yUd4arVALbH0Yg5CnJWmWBlHEX8V69NksXe81tLpTLKfz21fTE46djVBmaaQ7AyRVcj9 y/IQ== X-Forwarded-Encrypted: i=1; AJvYcCXEH1r+3QLnchzq2h6TAFHKRy1i9oqHoEkYmVU/ViBBzXVU+YjEpL4sOXB5JliLJfH7pHK7pMHK/F5tDevJdP+z0n86TQS3SPdcJqNjkC2m7AiF7v2LenZ1+xUl0jekOfyqPMnXtrWvW3vBD8DvMxVlHtfthsKBcN2sthuQUw== X-Gm-Message-State: AOJu0YygacC4U5l4VjPireflIS+GmXCCp3a38vrWS0ETcDusw2PP+1M7 cJZ7J0WY54STL+Q1TG+zrsQ/xar/WJiiVaf6gfqfLRDMvcPqxaqFGr1EDjtVNec= X-Google-Smtp-Source: AGHT+IEDYN1p1Ejz5uDuIbgSh4SFV11bXXrqvgBcuT0L7mAYmVLFZrgQ2Oa4MLglrle/kIutQPpxvg== X-Received: by 2002:a05:6214:21ce:b0:691:4eaf:ffeb with SMTP id d14-20020a05621421ce00b006914eafffebmr10343373qvh.44.1711415699918; Mon, 25 Mar 2024 18:14:59 -0700 (PDT) Received: from l1441l.lan0.xorvpn.com (pool-98-116-41-146.nycmny.fios.verizon.net. [98.116.41.146]) by smtp.gmail.com with ESMTPSA id c5-20020a056214224500b006968d8f1c05sm1697208qvc.26.2024.03.25.18.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 18:14:59 -0700 (PDT) From: Daniel Hodges To: hodges.daniel.scott@gmail.com Cc: ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, lee@kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, pavel@ucw.cz Subject: [PATCH v2 3/3] leds: trigger: Add documentation for ledtrig-bpf Date: Mon, 25 Mar 2024 21:14:47 -0400 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: bpf@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