git: 5ba503fc2cab - main - lagg: Remove the member pr_num from struct lagg_proto
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Feb 2026 03:38:53 UTC
The branch main has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=5ba503fc2cabc1a614997f102ace671d996bcc53
commit 5ba503fc2cabc1a614997f102ace671d996bcc53
Author: Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2026-02-06 03:37:43 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2026-02-06 03:37:43 +0000
lagg: Remove the member pr_num from struct lagg_proto
It is set but never used. Remove it to avoid confusion and save a
little space.
While here, use designated initializers to initialize the LAGG protocol
table. That improves readability, and it will be safer to initialize the
table if we introduce new protocols in the future.
No functional change intended.
Reviewed by: glebius
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D55124
---
sys/net/if_lagg.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
index 21ea2b30459b..1e4d3d8d85ac 100644
--- a/sys/net/if_lagg.c
+++ b/sys/net/if_lagg.c
@@ -208,7 +208,6 @@ static struct mbuf *lagg_default_input(struct lagg_softc *, struct lagg_port *,
/* lagg protocol table */
static const struct lagg_proto {
- lagg_proto pr_num;
void (*pr_attach)(struct lagg_softc *);
void (*pr_detach)(struct lagg_softc *);
int (*pr_start)(struct lagg_softc *, struct mbuf *);
@@ -223,24 +222,20 @@ static const struct lagg_proto {
void (*pr_request)(struct lagg_softc *, void *);
void (*pr_portreq)(struct lagg_port *, void *);
} lagg_protos[] = {
- {
- .pr_num = LAGG_PROTO_NONE,
+ [LAGG_PROTO_NONE] = {
.pr_start = lagg_none_start,
.pr_input = lagg_none_input,
},
- {
- .pr_num = LAGG_PROTO_ROUNDROBIN,
+ [LAGG_PROTO_ROUNDROBIN] = {
.pr_attach = lagg_rr_attach,
.pr_start = lagg_rr_start,
.pr_input = lagg_default_input,
},
- {
- .pr_num = LAGG_PROTO_FAILOVER,
+ [LAGG_PROTO_FAILOVER] = {
.pr_start = lagg_fail_start,
.pr_input = lagg_fail_input,
},
- {
- .pr_num = LAGG_PROTO_LOADBALANCE,
+ [LAGG_PROTO_LOADBALANCE] = {
.pr_attach = lagg_lb_attach,
.pr_detach = lagg_lb_detach,
.pr_start = lagg_lb_start,
@@ -248,8 +243,7 @@ static const struct lagg_proto {
.pr_addport = lagg_lb_port_create,
.pr_delport = lagg_lb_port_destroy,
},
- {
- .pr_num = LAGG_PROTO_LACP,
+ [LAGG_PROTO_LACP] = {
.pr_attach = lagg_lacp_attach,
.pr_detach = lagg_lacp_detach,
.pr_start = lagg_lacp_start,
@@ -263,8 +257,7 @@ static const struct lagg_proto {
.pr_request = lacp_req,
.pr_portreq = lacp_portreq,
},
- {
- .pr_num = LAGG_PROTO_BROADCAST,
+ [LAGG_PROTO_BROADCAST] = {
.pr_start = lagg_bcast_start,
.pr_input = lagg_default_input,
},