Message ID | 20240605192146.19052-6-ansuelsmth@gmail.com |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
Series | misc: introduce STATUS LED activity function | expand |
On Wed, 5 Jun 2024 at 20:51, Christian Marangi <ansuelsmth@gmail.com> wrote: > > Implement support for LED status activity. If the feature is enabled, > make the defined ACTIVITY LED to signal traffic. Would this not just duplicate the activity on the NIC LED? > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > --- > net/tftp.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/net/tftp.c b/net/tftp.c > index 2e335413492..07dea321bb4 100644 > --- a/net/tftp.c > +++ b/net/tftp.c > @@ -19,6 +19,7 @@ > #include <asm/global_data.h> > #include <net/tftp.h> > #include "bootp.h" > +#include <status_led.h> > > DECLARE_GLOBAL_DATA_PTR; > > @@ -193,6 +194,10 @@ static void new_transfer(void) > #ifdef CONFIG_CMD_TFTPPUT > tftp_put_final_block_sent = 0; > #endif > +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE > + status_led_set(CONFIG_LED_STATUS_ACTIVITY, > + CONFIG_LED_STATUS_BLINKING); > +#endif > } > > #ifdef CONFIG_CMD_TFTPPUT > @@ -228,6 +233,10 @@ static void show_block_marker(void) > { > ulong pos; > > +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE > + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); > +#endif > + > #ifdef CONFIG_TFTP_TSIZE > if (tftp_tsize) { > pos = tftp_cur_block * tftp_block_size + > @@ -290,6 +299,9 @@ static void tftp_complete(void) > /* Print hash marks for the last packet received */ > while (tftp_tsize && tftp_tsize_num_hash < 49) { > putc('#'); > +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE > + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); > +#endif > tftp_tsize_num_hash++; > } > puts(" "); > @@ -302,6 +314,10 @@ static void tftp_complete(void) > time_start * 1000, "/s"); > } > puts("\ndone\n"); > +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE > + status_led_set(CONFIG_LED_STATUS_ACTIVITY, > + CONFIG_LED_STATUS_OFF); > +#endif > if (!tftp_put_active) > efi_set_bootdev("Net", "", tftp_filename, > map_sysmem(tftp_load_addr, 0), > -- > 2.43.0 >
On Thu, Jun 06, 2024 at 09:22:05AM +0100, Peter Robinson wrote: > On Wed, 5 Jun 2024 at 20:51, Christian Marangi <ansuelsmth@gmail.com> wrote: > > > > Implement support for LED status activity. If the feature is enabled, > > make the defined ACTIVITY LED to signal traffic. > > Would this not just duplicate the activity on the NIC LED? > Yes but most of the time Vendor doesn't ship NIC port with LED attached or even some PHY require additional setup to make the NIC LED blink on traffic.
diff --git a/net/tftp.c b/net/tftp.c index 2e335413492..07dea321bb4 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -19,6 +19,7 @@ #include <asm/global_data.h> #include <net/tftp.h> #include "bootp.h" +#include <status_led.h> DECLARE_GLOBAL_DATA_PTR; @@ -193,6 +194,10 @@ static void new_transfer(void) #ifdef CONFIG_CMD_TFTPPUT tftp_put_final_block_sent = 0; #endif +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_BLINKING); +#endif } #ifdef CONFIG_CMD_TFTPPUT @@ -228,6 +233,10 @@ static void show_block_marker(void) { ulong pos; +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); +#endif + #ifdef CONFIG_TFTP_TSIZE if (tftp_tsize) { pos = tftp_cur_block * tftp_block_size + @@ -290,6 +299,9 @@ static void tftp_complete(void) /* Print hash marks for the last packet received */ while (tftp_tsize && tftp_tsize_num_hash < 49) { putc('#'); +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); +#endif tftp_tsize_num_hash++; } puts(" "); @@ -302,6 +314,10 @@ static void tftp_complete(void) time_start * 1000, "/s"); } puts("\ndone\n"); +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_OFF); +#endif if (!tftp_put_active) efi_set_bootdev("Net", "", tftp_filename, map_sysmem(tftp_load_addr, 0),
Implement support for LED status activity. If the feature is enabled, make the defined ACTIVITY LED to signal traffic. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> --- net/tftp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)