Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

realtek-poe daemon reload interrupts power to PoE sinks #5

Closed
mrnuke opened this issue Jun 21, 2022 · 7 comments
Closed

realtek-poe daemon reload interrupts power to PoE sinks #5

mrnuke opened this issue Jun 21, 2022 · 7 comments

Comments

@mrnuke
Copy link
Collaborator

mrnuke commented Jun 21, 2022

Summarry

It has been reported in this OpenWRT forum post that realtek-poe behavior is really annoying. PoE devices lose power whenever realtek-poe is started or restarted.

This is undesireable for two reasons:

  1. It's annoying
  2. Crashes in realtek-poe will shut down PoE devices.

Technical details

The following two lines in poe_initial_setup() cause the power to PoE ports to be cut off when realtek-poe is started:

realtek-poe/src/main.c

Lines 712 to 713 in db485c8

poe_cmd_global_power_budget(0, 0);
poe_cmd_global_port_enable(0);

Course of action

On my engenius-ews2910p with 22.10 firmware, the MCU does not care about the state of the ports. It will happily accept a "set global power budget" command and apply it dynamically.

  • Is this behavior reliable on other FW versions or MCUs?

If so, then we could simply remove the calls in question, and everything should work,

@Hurricos
Copy link
Owner

From #6 (comment):

The gpio-hogdefinition looks fine to me. I wonder if u-boot is forcing the GPIO low.

I can watch the line. I'm worried that OpenWrt is setting it low. Let me attempt to invoke a reboot from the OEM FW.

@mrnuke
Copy link
Collaborator Author

mrnuke commented Jun 27, 2022

There's a difference between a system reboot and a daemon restart. This issue is focused on shutting down and restarting realtek poe. For example:

/etc/init.d/poe restart

On a system reboot we really don't have that much control. If the bootloader decides to reset the PoE MCU, or disable the poe-enable line, there is little we can do to prevent that. Only in the event that the bootloader, and gpio-restart hardware do not touch the PSEs, do we have the power to not cut power.

@mrnuke
Copy link
Collaborator Author

mrnuke commented Jun 28, 2022

With #6 I will be removing the call to poe_cmd_global_power_budget{}. That only leaves poe_cmd_global_port_enable(0); which I think should just be removed as well.

@walterav1984
Copy link

walterav1984 commented Jun 28, 2022

This seems to be fixed for the CI22 realtek-poe package release, as in no interruption for a currently PoE powered device while changing /etc/config/poe and doing a /etc/init.d/poe reload or ubus call poe reload and powering on a other PoE device. Have to test extensive "disabling" and "enabling" in /etc/config/poe yet though.

@mrnuke
Copy link
Collaborator Author

mrnuke commented Jun 28, 2022

/etc/init.d/poe reload Does not stop the daemon, but /etc/init.d/poe restart does.

Hurricos pushed a commit that referenced this issue Jul 3, 2022
As noted in #5 [1], when `/etc/init.d/poe restart` is invoked, all PoE
sinks connected to the powering device will temporarily lose power and
reboot.

Fix this by removing `poe_cmd_global_port_enable(0)` from
`poe_initial_setup`. I'm unsure what the original intent of this line
was anyways -- perhas to prevent PoE devices that the user did not
want to be powered on from being powered on due to a stale MCU config?
But at least on the ZyXEL GS1900-24HPv1, the OEM firmware doesn't do
anything like this (or even use the `0x06` command in the first
place). (The original patchwork thread is here[2]).

Also, remove `poe_cmd_global_port_enable` entirely in order to avoid a
compiler warning (which the default OpenWrt build flags promote to an
error).

[1]: #5

[2]: https://patchwork.ozlabs.org/project/openwrt/patch/[email protected]/

Signed-off-by: Martin Kennedy <[email protected]>
Hurricos added a commit that referenced this issue Jul 3, 2022
As noted in #5 [1], when `/etc/init.d/poe restart` is invoked, all PoE
sinks connected to the powering device will temporarily lose power and
reboot.

Fix this by removing `poe_cmd_global_port_enable(0)` from
`poe_initial_setup`. I'm unsure what the original intent of this line
was anyways -- perhas to prevent PoE devices that the user did not
want to be powered on from being powered on due to a stale MCU config?
But at least on the ZyXEL GS1900-24HPv1, the OEM firmware doesn't do
anything like this (or even use the `0x06` command in the first
place). (The original patchwork thread is here[2]).

[1]: #5

[2]: https://patchwork.ozlabs.org/project/openwrt/patch/[email protected]/

Signed-off-by: Martin Kennedy <[email protected]>
Hurricos added a commit that referenced this issue Jul 3, 2022
As noted in #5 [1], when `/etc/init.d/poe restart` is invoked, all PoE
sinks connected to the powering device will temporarily lose power and
reboot.

Fix this by removing `poe_cmd_global_port_enable(0)` from
`poe_initial_setup`. I'm unsure what the original intent of this line
was anyways -- perhas to prevent PoE devices that the user did not
want to be powered on from being powered on due to a stale MCU config?
But at least on the ZyXEL GS1900-24HPv1, the OEM firmware doesn't do
anything like this (or even use the `0x06` command in the first
place). (The original patchwork thread is here[2]).

Also, remove `poe_cmd_global_port_enable` entirely in order to avoid a
compiler warning (which the default OpenWrt build flags promote to an
error).

[1]: #5

[2]: https://patchwork.ozlabs.org/project/openwrt/patch/[email protected]/

Signed-off-by: Martin Kennedy <[email protected]>
@Hurricos
Copy link
Owner

Hurricos commented Jul 4, 2022

Issue fixed by b1e21d6.

@Hurricos Hurricos closed this as completed Jul 4, 2022
@walterav1984
Copy link

Besides the non-interupted PoE ubus call poe reload or /etc/init.d/poe reload I can also confirm that even /etc/init.d/poe restart won't interupt PoE power anymore on already powered on PoE devices with package CI29.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants