]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: eth: drop family_id
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sat, 14 Mar 2026 18:05:48 +0000 (19:05 +0100)
committerRobert Marko <robimarko@gmail.com>
Wed, 25 Mar 2026 09:26:44 +0000 (10:26 +0100)
The RTL839x notify ring buffer setup is the last consumer
of family_id. Convert it to a device specific callback and
drop family_id from the configuration structure.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22421
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.h

index 6cd823f6808beef018a7ed41cfd32f4656e08d50..af39d8c7f950ea84a6d9b2f6ba031ae333191076 100644 (file)
@@ -647,7 +647,7 @@ static void rteth_setup_ring_buffer(struct rteth_ctrl *ctrl)
        }
 }
 
-static void rtl839x_setup_notify_ring_buffer(struct rteth_ctrl *ctrl)
+static void rteth_839x_setup_notify_ring_buffer(struct rteth_ctrl *ctrl)
 {
        struct notify_b *b = ctrl->membase;
 
@@ -664,6 +664,10 @@ static void rtl839x_setup_notify_ring_buffer(struct rteth_ctrl *ctrl)
        /* Enable Notification */
        sw_w32_mask(0, 1 << 0, RTL839X_L2_NOTIFICATION_CTRL);
        ctrl->lastEvent = 0;
+
+       /* Make sure the ring structure is visible to the ASIC */
+       mb();
+       flush_cache_all();
 }
 
 static void rteth_838x_hw_init(struct rteth_ctrl *ctrl)
@@ -714,12 +718,8 @@ static int rteth_open(struct net_device *ndev)
        ctrl->r->hw_reset(ctrl);
        rteth_setup_cpu_rx_rings(ctrl);
        rteth_setup_ring_buffer(ctrl);
-       if (ctrl->r->family_id == RTL8390_FAMILY_ID) {
-               rtl839x_setup_notify_ring_buffer(ctrl);
-               /* Make sure the ring structure is visible to the ASIC */
-               mb();
-               flush_cache_all();
-       }
+       if (ctrl->r->setup_notify_ring_buffer)
+               ctrl->r->setup_notify_ring_buffer(ctrl);
 
        rteth_hw_ring_setup(ctrl);
        phylink_start(ctrl->phylink);
@@ -1300,7 +1300,6 @@ static const struct net_device_ops rteth_838x_netdev_ops = {
 };
 
 static const struct rteth_config rteth_838x_cfg = {
-       .family_id = RTL8380_FAMILY_ID,
        .cpu_port = RTETH_838X_CPU_PORT,
        .rx_rings = 8,
        .tx_rx_enable = 0xc,
@@ -1346,7 +1345,6 @@ static const struct net_device_ops rteth_839x_netdev_ops = {
 };
 
 static const struct rteth_config rteth_839x_cfg = {
-       .family_id = RTL8390_FAMILY_ID,
        .cpu_port = RTETH_839X_CPU_PORT,
        .rx_rings = 8,
        .tx_rx_enable = 0xc,
@@ -1373,6 +1371,7 @@ static const struct rteth_config rteth_839x_cfg = {
        .hw_stop = &rteth_839x_hw_stop,
        .hw_reset = &rteth_839x_hw_reset,
        .init_mac = &rteth_839x_init_mac,
+       .setup_notify_ring_buffer = &rteth_839x_setup_notify_ring_buffer,
        .netdev_ops = &rteth_839x_netdev_ops,
 };
 
@@ -1390,7 +1389,6 @@ static const struct net_device_ops rteth_930x_netdev_ops = {
 };
 
 static const struct rteth_config rteth_930x_cfg = {
-       .family_id = RTL9300_FAMILY_ID,
        .cpu_port = RTETH_930X_CPU_PORT,
        .rx_rings = 32,
        .tx_rx_enable = 0x30,
@@ -1435,7 +1433,6 @@ static const struct net_device_ops rteth_931x_netdev_ops = {
 };
 
 static const struct rteth_config rteth_931x_cfg = {
-       .family_id = RTL9310_FAMILY_ID,
        .cpu_port = RTETH_931X_CPU_PORT,
        .rx_rings = 32,
        .tx_rx_enable = 0x30,
index 72665f0a0963855ab2d15253bff5c02763272452..8507ebfb0aa540d8c3349cd824940cc806951a75 100644 (file)
@@ -239,7 +239,6 @@ struct rteth_ctrl;
 struct rteth_packet;
 
 struct rteth_config {
-       int family_id;
        int cpu_port;
        int rx_rings;
        int tx_rx_enable;
@@ -267,6 +266,7 @@ struct rteth_config {
        void (*hw_stop)(struct rteth_ctrl *ctrl);
        void (*hw_reset)(struct rteth_ctrl *ctrl);
        int (*init_mac)(struct rteth_ctrl *ctrl);
+       void (*setup_notify_ring_buffer)(struct rteth_ctrl *ctrl);
        void (*update_counter)(struct rteth_ctrl *ctrl, int ring, int released);
        const struct net_device_ops *netdev_ops;
 };