add support for PLCA RS
Subsystems (4)
v5 cover add support for PLCA RS
Add support for the IEEE802.3cg-2019 Clause 148 PLCA Reconciliation Sublayer. Add get/set configuration and get status functions. Additionally, shows PLCA capabilities and status when invoked without arguments.
Piergiorgio Beruto (1):
add support for IEEE 802.3cg-2019 Clause 148
Makefile.am | 1 + ethtool.8.in | 83 ++++++++++++- ethtool.c | 21 ++++ netlink/extapi.h | 6 + netlink/plca.c | 296 +++++++++++++++++++++++++++++++++++++++++++++ netlink/settings.c | 82 ++++++++++++- 6 files changed, 486 insertions(+), 3 deletions(-) create mode 100644 netlink/plca.c
Signature · 1 line
2.37.4
PATCH v5 1/1 add support for IEEE 802.3cg-2019 Clause 148
This patch adds support for the Physical Layer Collision Avoidance Reconciliation Sublayer which was introduced in the IEEE 802.3 standard by the 802.3cg working group in 2019.
The ethtool interface has been extended as follows:
- show if the device supports PLCA when ethtool is invoked without FLAGS
- additionally show what PLCA version is supported
- show the current PLCA status
- add FLAGS for getting and setting the PLCA configuration
--- Makefile.am | 1 + ethtool.8.in | 83 ++++++++++++- ethtool.c | 21 ++++ netlink/extapi.h | 6 + netlink/plca.c | 296 +++++++++++++++++++++++++++++++++++++++++++++ netlink/settings.c | 82 ++++++++++++- 6 files changed, 486 insertions(+), 3 deletions(-) create mode 100644 netlink/plca.c
Makefile.am +1 -0
@@ -42,6 +42,7 @@ ethtool_SOURCES += \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/module-eeprom.c netlink/module.c netlink/rss.c \ netlink/desc-rtnl.c netlink/cable_test.c netlink/tunnels.c \ + netlink/plca.c \ uapi/linux/ethtool_netlink.h \ uapi/linux/netlink.h uapi/linux/genetlink.h \ uapi/linux/rtnetlink.h uapi/linux/if_link.h \
ethtool.8.in +81 -2
107 lines not on this page · raw message
ethtool.c +21 -0
@@ -6080,6 +6080,27 @@ static const struct option args[] = { .help = "Set transceiver module settings", .xhelp = " [ power-mode-policy high|auto ]\n" }, + { + .opts = "--get-plca-cfg", + .nlfunc = nl_plca_get_cfg, + .help = "Get PLCA configuration", + }, + { + .opts = "--set-plca-cfg", + .nlfunc = nl_plca_set_cfg, + .help = "Set PLCA configuration", + .xhelp =" [ enable on|off ]\n" +" [ node-id N ]\n" +" [ node-cnt N ]\n" +" [ to-tmr N ]\n" +" [ burst-cnt N ]\n" +" [ burst-tmr N ]\n" + }, + { + .opts = "--get-plca-status", + .nlfunc = nl_plca_get_status, + .help = "Get PLCA status information", + }, { .opts = "-h|--help", .no_dev = true,
netlink/extapi.h +6 -0
@@ -48,6 +48,9 @@ int nl_smodule(struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);int nl_getmodule (struct cmd_context *ctx);int nl_grss (struct cmd_context *ctx); +int nl_plca_get_cfg (struct cmd_context *ctx); +int nl_plca_set_cfg (struct cmd_context *ctx); +int nl_plca_get_status (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -116,6 +119,9 @@ nl_get_eeprom_page(struct cmd_context *ctx __maybe_unused,#define nl_gmodule NULL#define nl_smodule NULL#define nl_grss NULL +#define nl_plca_get_cfg NULL +#define nl_plca_set_cfg NULL +#define nl_plca_get_status NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/plca.c new file +296 -0
296 lines not on this page · raw message
netlink/settings.c +81 -1
106 lines not on this page · raw message
Signature · 1 line
2.37.4
Re: [PATCH v5 ethtool-next 1/1] add support for IEEE 802.3cg-2019 Clause 148
Quoted 11 lines · Piergiorgio Beruto
This patch adds support for the Physical Layer Collision Avoidance Reconciliation Sublayer which was introduced in the IEEE 802.3 standard by the 802.3cg working group in 2019.
The ethtool interface has been extended as follows:
- show if the device supports PLCA when ethtool is invoked without FLAGS
- additionally show what PLCA version is supported
- show the current PLCA status
- add FLAGS for getting and setting the PLCA configurationSigned-off-by Piergiorgio Beruto <[email protected]>
Sorry for the delay, I missed the patch in the mailing list and did not get it directly into my inbox. Thankfully I noticed it in patchwork.
Quoted 26 lines
--- Makefile.am | 1 + ethtool.8.in | 83 ++++++++++++- ethtool.c | 21 ++++ netlink/extapi.h | 6 + netlink/plca.c | 296 +++++++++++++++++++++++++++++++++++++++++++++ netlink/settings.c | 82 ++++++++++++- 6 files changed, 486 insertions(+), 3 deletions(-) create mode 100644 netlink/plca.cMakefile.am +1
-0@@ -42,6 +42,7 @@ ethtool_SOURCES += \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/module-eeprom.c netlink/module.c netlink/rss.c \ netlink/desc-rtnl.c netlink/cable_test.c netlink/tunnels.c \ + netlink/plca.c \ uapi/linux/ethtool_netlink.h \ uapi/linux/netlink.h uapi/linux/genetlink.h \ uapi/linux/rtnetlink.h uapi/linux/if_link.h \ethtool.8.in +0
-0
[...]
Quoted 25 lines
+.TP
+.BI node\-cnt \ Nethtool.8.in +23
-0+The node-cnt [1 .. 255] should be set after the maximum number of nodes that +can be plugged to the multi-drop network. This parameter regulates the minimum +length of the PLCA cycle. Therefore, it is only meaningful for the coordinator +node (\fBnod-id\fR = 0). Setting this parameter on a follower node has no +effect. The \fBnode\-cnt\fR parameter maps to IEEE 802.3cg-2019 clause +30.16.1.1.3 (aPLCANodeCount). +.TP +.BI to\-tmr \ N +The TO timer parameter sets the value of the transmit opportunity timer in +bit-times, and shall be set equal across all the nodes sharing the same +medium for PLCA to work. The default value of 32 is enough to cover a link of +roughly 50 mt. This parameter maps to IEEE 802.3cg-2019 clause 30.16.1.1.5 +(aPLCATransmitOpportunityTimer). +.TP +.BI burst\-cnt \ N +The \fBburst\-cnt\fR parameter [0 .. 255] indicates the extra number of packets +that the node is allowed to send during a single transmit opportunity. +By default, this attribute is 0, meaning that the node can send a sigle frame +per TO. When greater than 0, the PLCA RS keeps the TO after any transmission, +waiting for the MAC to send a new frame for up to \fBburst\-tmr\fR BTs. This can +only happen a number of times per PLCA cycle up to the value of this parameter. +After that, the burst is over and the normal counting of TOs resumes. +This parameter maps to IEEE 802.3cg-2019 clause 30.16.1.1.6 (aPLCAMaxBurstCount).
ethtool.8.in administratively up and to low power mode when the last port using it is put · line 1588
Quoted 10 lines
ethtool.8.in +10
-0+.TP +.BI burst\-tmr \ N +The \fBburst\-tmr\fR parameter [0 .. 255] sets how many bit-times the PLCA RS +waits for the MAC to initiate a new transmission when \fBburst\-cnt\fR is +greater than 0. If the MAC fails to send a new frame within this time, the burst +ends and the counting of TOs resumes. Otherwise, the new frame is sent as part +of the current burst. This parameter maps to IEEE 802.3cg-2019 clause +30.16.1.1.7 (aPLCABurstTimer). The value of \fBburst\-tmr\fR should be set +greater than the Inter-Frame-Gap (IFG) time of the MAC (plus some margin) +for PLCA burst mode to work as intended.
There are some trailing spaces in these paragraphs.
Quoted 10 lines
+.RE
+.TP
+.B \-\-get\-plca\-statusethtool.8.in +3
-0+Show the current PLCA status for the given interface. If \fBon\fR, the PHY is +successfully receiving or generating the BEACON signal. If \fBoff\fR, the PLCA +function is temporarily disabled and the PHY is operating in plain CSMA/CD mode. .SH BUGS Not supported (in part or whole) on all network drivers. .SH AUTHOR
ethtool.8.in Alexander Duyck, · line 1617
Quoted 9 lines
ethtool.8.in +2
-1@@ -1532,7 +1610,8 @@ Alexander Duyck, Sucheta Chakraborty, Jesse Brandeburg, Ben Hutchings, -Scott Branden. +Scott Branden, +Piergiorgio Beruto. .SH AVAILABILITY .B ethtool is available from
Do you have a strong reason to add your name here? In general, I rather see lists like these as a historical relic. In this case, the list has not been updated since 2017 and even before that, I'm pretty sure it is only a small fraction of contributors. IMHO the git log serves the purpose much better today.
[...]
Quoted 4 lines
netlink/settings.c +0
-0
[...]
netlink/settings.c int nl_gset(struct cmd_context *ctx) · line 991
Quoted 7 lines
netlink/settings.c +2
-1@@ -923,7 +987,10 @@ int nl_gset(struct cmd_context *ctx)netlink_cmd_check (ctx,ETHTOOL_MSG_LINKINFO_GET , true) ||netlink_cmd_check (ctx,ETHTOOL_MSG_WOL_GET , true) ||netlink_cmd_check (ctx,ETHTOOL_MSG_DEBUG_GET , true) || - netlink_cmd_check(ctx, ETHTOOL_MSG_LINKSTATE_GET, true)) +netlink_cmd_check (ctx,ETHTOOL_MSG_LINKSTATE_GET , true) || + netlink_cmd_check(ctx, ETHTOOL_MSG_LINKSTATE_GET, true) ||
You accidentally duplicated the line here.
Quoted 21 lines
netlink/settings.c +8
-0+netlink_cmd_check (ctx,ETHTOOL_MSG_PLCA_GET_CFG , true) || + netlink_cmd_check(ctx, ETHTOOL_MSG_PLCA_GET_STATUS, true)) return -EOPNOTSUPP; nlctx->suppress_nlerr =1 ;@@ -943,6 +1010,12 @@ int nl_gset(struct cmd_context *ctx)if (ret == -ENODEV )return ret; + ret =gset_request (nlctx,ETHTOOL_MSG_PLCA_GET_CFG , +ETHTOOL_A_PLCA_HEADER , plca_cfg_reply_cb); + +if (ret == -ENODEV ) +return ret; + ret =gset_request (nlctx,ETHTOOL_MSG_DEBUG_GET ,ETHTOOL_A_DEBUG_HEADER , debug_reply_cb);if (ret == -ENODEV )@@ -950,6 +1023,13 @@ int nl_gset(struct cmd_context *ctx) ret = gset_request(nlctx, ETHTOOL_MSG_LINKSTATE_GET,
netlink/settings.c int nl_gset(struct cmd_context *ctx) · line 1034
Quoted 10 lines
netlink/settings.c +7
-0ETHTOOL_A_LINKSTATE_HEADER, linkstate_reply_cb); + +if (ret == -ENODEV ) +return ret; + + + ret =gset_request (nlctx,ETHTOOL_MSG_PLCA_GET_STATUS , +ETHTOOL_A_PLCA_HEADER , plca_status_reply_cb);if (ret == -ENODEV )return ret;
Please make the whitespace consistent with existing code, i.e. no empty line between gset_request() call and the test of ret and no double empty line.
As I have no actual objections, I can adjust the whitespace issues here and in ethtool.8.in if you would prefer to avoid v6 before moving on to the MAC merge series.
Michal
Re: [PATCH v5 ethtool-next 1/1] add support for IEEE 802.3cg-2019 Clause 148
Quoted 11 lines · Michal Kubecek
Quoted 10 lines · Piergiorgio Beruto
This patch adds support for the Physical Layer Collision Avoidance Reconciliation Sublayer which was introduced in the IEEE 802.3 standard by the 802.3cg working group in 2019.
The ethtool interface has been extended as follows:
- show if the device supports PLCA when ethtool is invoked without FLAGS
- additionally show what PLCA version is supported
- show the current PLCA status
- add FLAGS for getting and setting the PLCA configuration
Quoted 4 lines
Quoted 1 line
Signed-off-by Piergiorgio Beruto <[email protected]>Sorry for the delay, I missed the patch in the mailing list and did not get it directly into my inbox. Thankfully I noticed it in patchwork.
No worries, thanks for taking time to review this :-)
Quoted 57 lines
Quoted 27 lines
--- Makefile.am | 1 + ethtool.8.in | 83 ++++++++++++- ethtool.c | 21 ++++ netlink/extapi.h | 6 + netlink/plca.c | 296 +++++++++++++++++++++++++++++++++++++++++++++ netlink/settings.c | 82 ++++++++++++- 6 files changed, 486 insertions(+), 3 deletions(-) create mode 100644 netlink/plca.cMakefile.am +1
-0@@ -42,6 +42,7 @@ ethtool_SOURCES += \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/module-eeprom.c netlink/module.c netlink/rss.c \ netlink/desc-rtnl.c netlink/cable_test.c netlink/tunnels.c \ + netlink/plca.c \ uapi/linux/ethtool_netlink.h \ uapi/linux/netlink.h uapi/linux/genetlink.h \ uapi/linux/rtnetlink.h uapi/linux/if_link.h \ethtool.8.in +0
-0[...]
Quoted 29 lines
+.TP
+.BI node\-cnt \ Nethtool.8.in +27
-0+The node-cnt [1 .. 255] should be set after the maximum number of nodes that +can be plugged to the multi-drop network. This parameter regulates the minimum +length of the PLCA cycle. Therefore, it is only meaningful for the coordinator +node (\fBnod-id\fR = 0). Setting this parameter on a follower node has no +effect. The \fBnode\-cnt\fR parameter maps to IEEE 802.3cg-2019 clause +30.16.1.1.3 (aPLCANodeCount). +.TP +.BI to\-tmr \ N +The TO timer parameter sets the value of the transmit opportunity timer in +bit-times, and shall be set equal across all the nodes sharing the same +medium for PLCA to work. The default value of 32 is enough to cover a link of +roughly 50 mt. This parameter maps to IEEE 802.3cg-2019 clause 30.16.1.1.5 +(aPLCATransmitOpportunityTimer). +.TP +.BI burst\-cnt \ N +The \fBburst\-cnt\fR parameter [0 .. 255] indicates the extra number of packets +that the node is allowed to send during a single transmit opportunity. +By default, this attribute is 0, meaning that the node can send a sigle frame +per TO. When greater than 0, the PLCA RS keeps the TO after any transmission, +waiting for the MAC to send a new frame for up to \fBburst\-tmr\fR BTs. This can +only happen a number of times per PLCA cycle up to the value of this parameter. +After that, the burst is over and the normal counting of TOs resumes. +This parameter maps to IEEE 802.3cg-2019 clause 30.16.1.1.6 (aPLCAMaxBurstCount). +.TP +.BI burst\-tmr \ N +The \fBburst\-tmr\fR parameter [0 .. 255] sets how many bit-times the PLCA RS +waits for the MAC to initiate a new transmission when \fBburst\-cnt\fR is
Quoted 8 lines
ethtool.8.in administratively up and to low power mode when the last port using it is put · line 1588
Quoted 6 lines
ethtool.8.in +6
-0+greater than 0. If the MAC fails to send a new frame within this time, the burst +ends and the counting of TOs resumes. Otherwise, the new frame is sent as part +of the current burst. This parameter maps to IEEE 802.3cg-2019 clause +30.16.1.1.7 (aPLCABurstTimer). The value of \fBburst\-tmr\fR should be set +greater than the Inter-Frame-Gap (IFG) time of the MAC (plus some margin) +for PLCA burst mode to work as intended.There are some trailing spaces in these paragraphs.
Uh, sorry, thanks for noticing!
Quoted 18 lines
Quoted 18 lines
+.RE
+.TP
+.B \-\-get\-plca\-statusethtool.8.in +5
-1+Show the current PLCA status for the given interface. If \fBon\fR, the PHY is +successfully receiving or generating the BEACON signal. If \fBoff\fR, the PLCA +function is temporarily disabled and the PHY is operating in plain CSMA/CD mode. .SH BUGS Not supported (in part or whole) on all network drivers. .SH AUTHOR@@ -1532,7 +1610,8 @@ Alexander Duyck, Sucheta Chakraborty, Jesse Brandeburg, Ben Hutchings, -Scott Branden. +Scott Branden, +Piergiorgio Beruto. .SH AVAILABILITY
Quoted 8 lines
ethtool.8.in Alexander Duyck, · line 1617
Quoted 2 lines
ethtool.8.in +0
-0.B ethtool is available fromDo you have a strong reason to add your name here? In general, I rather see lists like these as a historical relic. In this case, the list has not been updated since 2017 and even before that, I'm pretty sure it is only a small fraction of contributors. IMHO the git log serves the purpose much better today.
Ah, not really. I just read through the doc and finding this I assumed it was a list to be populated with contributors! No real reasons.
Quoted 7 lines
[...]
Quoted 4 lines
netlink/settings.c +0
-0[...]
Quoted 9 lines
netlink/settings.c int nl_gset(struct cmd_context *ctx) · line 991
Quoted 7 lines
netlink/settings.c +2
-1@@ -923,7 +987,10 @@ int nl_gset(struct cmd_context *ctx)netlink_cmd_check (ctx,ETHTOOL_MSG_LINKINFO_GET , true) ||netlink_cmd_check (ctx,ETHTOOL_MSG_WOL_GET , true) ||netlink_cmd_check (ctx,ETHTOOL_MSG_DEBUG_GET , true) || - netlink_cmd_check(ctx, ETHTOOL_MSG_LINKSTATE_GET, true)) +netlink_cmd_check (ctx,ETHTOOL_MSG_LINKSTATE_GET , true) || + netlink_cmd_check(ctx, ETHTOOL_MSG_LINKSTATE_GET, true) ||You accidentally duplicated the line here.
Thanks for noticing.
Quoted 21 lines
Quoted 21 lines
netlink/settings.c +8
-0+netlink_cmd_check (ctx,ETHTOOL_MSG_PLCA_GET_CFG , true) || + netlink_cmd_check(ctx, ETHTOOL_MSG_PLCA_GET_STATUS, true)) return -EOPNOTSUPP; nlctx->suppress_nlerr =1 ;@@ -943,6 +1010,12 @@ int nl_gset(struct cmd_context *ctx)if (ret == -ENODEV )return ret; + ret =gset_request (nlctx,ETHTOOL_MSG_PLCA_GET_CFG , +ETHTOOL_A_PLCA_HEADER , plca_cfg_reply_cb); + +if (ret == -ENODEV ) +return ret; + ret =gset_request (nlctx,ETHTOOL_MSG_DEBUG_GET ,ETHTOOL_A_DEBUG_HEADER , debug_reply_cb);if (ret == -ENODEV )@@ -950,6 +1023,13 @@ int nl_gset(struct cmd_context *ctx)
Quoted 15 lines
netlink/settings.c int nl_gset(struct cmd_context *ctx) · line 1034
Quoted 11 lines
netlink/settings.c +7
-0ret =gset_request (nlctx,ETHTOOL_MSG_LINKSTATE_GET ,ETHTOOL_A_LINKSTATE_HEADER , linkstate_reply_cb); + +if (ret == -ENODEV ) +return ret; + + + ret =gset_request (nlctx,ETHTOOL_MSG_PLCA_GET_STATUS , +ETHTOOL_A_PLCA_HEADER , plca_status_reply_cb);if (ret == -ENODEV )return ret;Please make the whitespace consistent with existing code, i.e. no empty line between
gset_request()call and the test of ret and no double empty line.
Got it!
Quoted 4 lines
As I have no actual objections, I can adjust the whitespace issues here and in ethtool.8.in if you would prefer to avoid v6 before moving on to the MAC merge series.
Oh, thank you! I really appreciate this.
--Piergiorgio
Quoted 2 lines
Michal