[PATCH v2] rtl83xx-poe: add package
Rafał Miłecki
zajec5 at gmail.com
Wed Apr 14 06:21:44 BST 2021
On 13.03.2021 17:54, Bjørn Mork wrote:
> From: John Crispin <john at phrozen.org>
>
> This package implements the microcontroller protocol used to
> talk Broadcom PSE controllers on a number of realtek switches.
> It is required to enable PoE ouput on supported hardware.
>
> The implemented ABI allows individial control and monitoring
> of each PoE port using ubus. Example from a ZyXEL GS1900-10HP:
>
> root at gs1900-10hp:~# ubus -v list poe
> 'poe' @3c3a28fb
> "info":{}
> "port":{"enable":"Boolean","port":"Integer"}
> root at gs1900-10hp:~# ubus call poe info
> {
> "ports": [
> "enabled",
> "enabled",
> "0W",
> "enabled",
> "enabled",
> "enabled",
> "4.6W",
> "4W"
> ],
> "power_budget": "77W",
> "power_consumption": "7.8W"
> }
>
> Tested-by: Birger Koblitz <mail at birger-koblitz.de>
> Signed-off-by: John Crispin <john at phrozen.org>
> Signed-off-by: Bjørn Mork <bjorn at mork.no> [commit message, release number]
This is a rather hacky way to support one particular device rather than
a proper solution for PoE capable devices. I really think we should
design a proper PoE layer instead of accepting this hack.
I'm sorry but I'm really against commiting this as it is. It supports
rtl83xx without any standarized way. It adds non-generic ubus object
with a generic "poe" name. It opens doors for more unstandarized
solutions.
Because of above:
Nacked-by: Rafał Miłecki <rafal at milecki.pl>
Now how about to solve it.
Regarding UCI syntax. One idea is to have section for PoE /device/ and
sections for each of its ports. That way we can also support more
complex devices, e.g. those with more port options. I think there may be
hw allowing e.g. setting max port power budget or port priority.
Example /etc/config/poe:
config hw rtl83xx
option protocol rtl83xx
option budget 65
config port
option poe rtl83xx
option index 0
option enabled 0
config port
option poe rtl83xx
option index 1
option enabled 1
option priority 3 # <- example for further devices
I'm still wondering if a separated config file (/etc/config/poe) is a
correct solution. After all we describe swithes in the
/etc/config/network . Maybe we can just extend that?
Then ubus + reading PoE status. I think we should support:
1. More than 1 PoE device (so e.g. poe.rtl83xx, poe.foo, poe.bar)
2. Have more generic ports syntax. 0W doesn't tell me if power usage is
so low or if port is disabled
Maybe somethig like:
# ubus call poe.rtl83xx info
{
"power_budget": "77 W",
"power_consumption": "7.8 W",
"ports": [
{
"index": 0,
"enabled": 0
},
{
"index": 0,
"enabled": 1,
"current_power": "7 W"
}
]
}
Design I described above should be generic enough & allow e.g. adding
LuCI support for handling PoE devices cleanly.
Finally I think we could pick a better language than Lua for
implementing rtl83xx driver.
More information about the openwrt-devel
mailing list