Skip to content

Commit bc3b417

Browse files
plappermaulrobimarko
authored andcommitted
realtek: dsa: move port_ignore constant to config
Device specific constants belong into the config structure. No need to initialize them manually during probing within a family_id switch statement. Although there are lots of constants that need to be converted start with port_ignore as a simple one. Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: openwrt/openwrt#22026 Signed-off-by: Robert Marko <robimarko@gmail.com>
1 parent 6d82a50 commit bc3b417

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ static int rtl83xx_l2_nexthop_add(struct rtl838x_switch_priv *priv, struct rtl83
575575
e.block_sa = false;
576576
e.suspended = false;
577577
e.age = 0; /* With port-ignore */
578-
e.port = priv->port_ignore;
578+
e.port = priv->r->port_ignore;
579579
u64_to_ether_addr(nh->mac, &e.mac[0]);
580580
}
581581
e.next_hop = true;
@@ -665,7 +665,7 @@ static int rtl83xx_l3_nexthop_update(struct rtl838x_switch_priv *priv, __be32 i
665665
pr_debug("Route with id %d to %pI4 / %d\n", r->id, &r->dst_ip, r->prefix_len);
666666

667667
r->nh.mac = r->nh.gw = mac;
668-
r->nh.port = priv->port_ignore;
668+
r->nh.port = priv->r->port_ignore;
669669
r->nh.id = r->id;
670670

671671
/* Do we need to explicitly add a DMAC entry with the route's nh index? */
@@ -1097,7 +1097,7 @@ static int rtldsa_fib4_add(struct rtl838x_switch_priv *priv,
10971097
int slot;
10981098

10991099
route->nh.mac = mac;
1100-
route->nh.port = priv->port_ignore;
1100+
route->nh.port = priv->r->port_ignore;
11011101
route->attr.valid = true;
11021102
route->attr.action = ROUTE_ACT_TRAP2CPU;
11031103
route->attr.type = 0;
@@ -1418,7 +1418,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
14181418
priv->l2_bucket_size = 4;
14191419
priv->n_mst = 64;
14201420
priv->n_pie_blocks = 12;
1421-
priv->port_ignore = 0x1f;
14221421
priv->n_counters = 128;
14231422
break;
14241423
case RTL8390_FAMILY_ID:
@@ -1433,7 +1432,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
14331432
priv->l2_bucket_size = 4;
14341433
priv->n_mst = 256;
14351434
priv->n_pie_blocks = 18;
1436-
priv->port_ignore = 0x3f;
14371435
priv->n_counters = 1024;
14381436
break;
14391437
case RTL9300_FAMILY_ID:
@@ -1449,7 +1447,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
14491447
priv->l2_bucket_size = 8;
14501448
priv->n_mst = 64;
14511449
priv->n_pie_blocks = 16;
1452-
priv->port_ignore = 0x3f;
14531450
priv->n_counters = 2048;
14541451
break;
14551452
case RTL9310_FAMILY_ID:
@@ -1465,7 +1462,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
14651462
priv->l2_bucket_size = 8;
14661463
priv->n_mst = 128;
14671464
priv->n_pie_blocks = 16;
1468-
priv->port_ignore = 0x3f;
14691465
priv->n_counters = 2048;
14701466
break;
14711467
}

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,7 @@ const struct rtldsa_config rtldsa_838x_cfg = {
17001700
.isr_port_link_sts_chg = RTL838X_ISR_PORT_LINK_STS_CHG,
17011701
.imr_port_link_sts_chg = RTL838X_IMR_PORT_LINK_STS_CHG,
17021702
.imr_glb = RTL838X_IMR_GLB,
1703+
.port_ignore = 0x1f,
17031704
.vlan_tables_read = rtl838x_vlan_tables_read,
17041705
.vlan_set_tagged = rtl838x_vlan_set_tagged,
17051706
.vlan_set_untagged = rtl838x_vlan_set_untagged,

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,7 @@ struct rtldsa_config {
12731273
int isr_port_link_sts_chg;
12741274
int imr_port_link_sts_chg;
12751275
int imr_glb;
1276+
u8 port_ignore;
12761277
void (*vlan_tables_read)(u32 vlan, struct rtl838x_vlan_info *info);
12771278
void (*vlan_set_tagged)(u32 vlan, struct rtl838x_vlan_info *info);
12781279
void (*vlan_set_untagged)(u32 vlan, u64 portmask);
@@ -1360,7 +1361,6 @@ struct rtl838x_switch_priv {
13601361
u8 cpu_port;
13611362
u8 port_mask;
13621363
u8 port_width;
1363-
u8 port_ignore;
13641364
u64 irq_mask;
13651365
u32 fib_entries;
13661366
int l2_bucket_size;

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl839x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,7 @@ const struct rtldsa_config rtldsa_839x_cfg = {
16401640
.isr_port_link_sts_chg = RTL839X_ISR_PORT_LINK_STS_CHG,
16411641
.imr_port_link_sts_chg = RTL839X_IMR_PORT_LINK_STS_CHG,
16421642
.imr_glb = RTL839X_IMR_GLB,
1643+
.port_ignore = 0x3f,
16431644
.vlan_tables_read = rtl839x_vlan_tables_read,
16441645
.vlan_set_tagged = rtl839x_vlan_set_tagged,
16451646
.vlan_set_untagged = rtl839x_vlan_set_untagged,

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,6 +2645,7 @@ const struct rtldsa_config rtldsa_930x_cfg = {
26452645
.isr_port_link_sts_chg = RTL930X_ISR_PORT_LINK_STS_CHG,
26462646
.imr_port_link_sts_chg = RTL930X_IMR_PORT_LINK_STS_CHG,
26472647
.imr_glb = RTL930X_IMR_GLB,
2648+
.port_ignore = 0x3f,
26482649
.vlan_tables_read = rtl930x_vlan_tables_read,
26492650
.vlan_set_tagged = rtl930x_vlan_set_tagged,
26502651
.vlan_set_untagged = rtl930x_vlan_set_untagged,

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,6 +1830,7 @@ const struct rtldsa_config rtldsa_931x_cfg = {
18301830
.isr_port_link_sts_chg = RTL931X_ISR_PORT_LINK_STS_CHG,
18311831
.imr_port_link_sts_chg = RTL931X_IMR_PORT_LINK_STS_CHG,
18321832
/* imr_glb does not exist on RTL931X */
1833+
.port_ignore = 0x3f,
18331834
.vlan_tables_read = rtl931x_vlan_tables_read,
18341835
.vlan_set_tagged = rtl931x_vlan_set_tagged,
18351836
.vlan_set_untagged = rtl931x_vlan_set_untagged,

0 commit comments

Comments
 (0)