[openwrt/openwrt] realtek: 5.15: comment unused part of realtek ethernet driver

LEDE Commits lede-commits at lists.infradead.org
Thu May 11 18:25:03 PDT 2023


ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/1a0e9bc3b87bf2ebe89f4ed39b3219e975f76200

commit 1a0e9bc3b87bf2ebe89f4ed39b3219e975f76200
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Sun May 7 05:22:47 2023 +0200

    realtek: 5.15: comment unused part of realtek ethernet driver
    
    Comment unused part of realtek phy driver.
    Fix compilation warning:
    drivers/net/phy/rtl83xx-phy.c: In function 'rtl8380_configure_int_rtl8218b':
    drivers/net/phy/rtl83xx-phy.c:747:21: error: unused variable 'ipd_flag' [-Werror=unused-variable]
      747 |                 int ipd_flag = 1;
          |                     ^~~~~~~~
    drivers/net/phy/rtl83xx-phy.c: At top level:
    drivers/net/phy/rtl83xx-phy.c:3333:13: error: 'rtl931x_sds_disable' defined but not used [-Werror=unused-function]
     3333 | static void rtl931x_sds_disable(u32 sds)
          |             ^~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Comment unused part of realtek dsa driver.
    Fix compilation warning:
    drivers/net/dsa/rtl83xx/common.c: In function 'rtl83xx_fib_event':
    drivers/net/dsa/rtl83xx/common.c:1430:58: error: unused variable 'fen6_info' [-Werror=unused-variable]
     1430 |                         struct fib6_entry_notifier_info *fen6_info = ptr;
          |                                                          ^~~~~~~~~
    drivers/net/dsa/rtl83xx/common.c: At top level:
    drivers/net/dsa/rtl83xx/common.c:531:12: error: 'rtl83xx_octet_cntr_alloc' defined but not used [-Werror=unused-function]
      531 | static int rtl83xx_octet_cntr_alloc(struct rtl838x_switch_priv *priv)
          |            ^~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Drop unused priv in realtek dsa driver.
    Fix compilation warning:
    drivers/net/dsa/rtl83xx/dsa.c: In function 'rtl83xx_port_lag_change':
    drivers/net/dsa/rtl83xx/dsa.c:2016:37: error: unused variable 'priv' [-Werror=unused-variable]
     2016 |         struct rtl838x_switch_priv *priv = ds->priv;
          |                                     ^~~~
    cc1: all warnings being treated as errors
    
    Comment rtl838x_pie_rule_dump in realtek dsa driver for rtl83xx
    Fix compilation warning:
    drivers/net/dsa/rtl83xx/rtl838x.c:1294:13: error: 'rtl838x_pie_rule_dump' defined but not used [-Werror=unused-function]
     1294 | static void rtl838x_pie_rule_dump(struct  pie_rule *pr)
          |             ^~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Comment multiple function in realtek dsa driver for rtl930x
    Fix compilation warning:
    drivers/net/dsa/rtl83xx/rtl930x.c:1463:12: error: 'rtl930x_l3_intf_add' defined but not used [-Werror=unused-function]
     1463 | static int rtl930x_l3_intf_add(struct rtl838x_switch_priv *priv, struct rtl838x_l3_intf *intf)
          |            ^~~~~~~~~~~~~~~~~~~
    drivers/net/dsa/rtl83xx/rtl930x.c:1414:12: error: 'rtl930x_l3_mtu_del' defined but not used [-Werror=unused-function]
     1414 | static int rtl930x_l3_mtu_del(struct rtl838x_switch_priv *priv, int mtu)
          |            ^~~~~~~~~~~~~~~~~~
    drivers/net/dsa/rtl83xx/rtl930x.c:995:12: error: 'rtl930x_l3_hash6' defined but not used [-Werror=unused-function]
      995 | static u32 rtl930x_l3_hash6(struct in6_addr *ip6, int algorithm, bool move_dip)
          |            ^~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    drivers/net/dsa/rtl83xx/rtl930x.c:1690:13: error: 'rtl930x_read_pie_fixed_fields' defined but not used [-Werror=unused-function]
     1690 | static void rtl930x_read_pie_fixed_fields(u32 r[], struct pie_rule *pr)
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/net/dsa/rtl83xx/rtl930x.c:1432:12: error: 'rtl930x_l3_mtu_add' defined but not used [-Werror=unused-function]
     1432 | static int rtl930x_l3_mtu_add(struct rtl838x_switch_priv *priv, int mtu)
          |            ^~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Comment rtl931x_read_pie_fixed_fields in realtek dsa driver for rtl931x
    Fix compilation warning:
    drivers/net/dsa/rtl83xx/rtl931x.c:1116:13: error: 'rtl931x_read_pie_fixed_fields' defined but not used [-Werror=unused-function]
     1116 | static void rtl931x_read_pie_fixed_fields(u32 r[], struct pie_rule *pr)
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Comment rtl93xx_header_vlan_set in realtek ethernet driver for rtl838x
    Fix compilation warning:
    drivers/net/ethernet/rtl838x_eth.c: At top level:
    drivers/net/ethernet/rtl838x_eth.c:164:13: error: 'rtl93xx_header_vlan_set' defined but not used [-Werror=unused-function]
      164 | static void rtl93xx_header_vlan_set(struct p_hdr *h, int vlan)
          |             ^~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 .../files-5.15/drivers/net/dsa/rtl83xx/common.c    |  31 +-
 .../files-5.15/drivers/net/dsa/rtl83xx/dsa.c       |   2 -
 .../files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c   |  19 +-
 .../files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c   | 352 +++++++++++----------
 .../files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c   |  79 ++---
 .../files-5.15/drivers/net/ethernet/rtl838x_eth.c  |  13 +-
 .../files-5.15/drivers/net/phy/rtl83xx-phy.c       |  20 +-
 7 files changed, 263 insertions(+), 253 deletions(-)

diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c
index 3216d7eb83..4b928f248b 100644
--- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c
+++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c
@@ -527,24 +527,25 @@ int rtl83xx_lag_del(struct dsa_switch *ds, int group, int port)
 	return 0;
 }
 
-/* Allocate a 64 bit octet counter located in the LOG HW table */
-static int rtl83xx_octet_cntr_alloc(struct rtl838x_switch_priv *priv)
-{
-	int idx;
+// Currently Unused
+// /* Allocate a 64 bit octet counter located in the LOG HW table */
+// static int rtl83xx_octet_cntr_alloc(struct rtl838x_switch_priv *priv)
+// {
+// 	int idx;
 
-	mutex_lock(&priv->reg_mutex);
+// 	mutex_lock(&priv->reg_mutex);
 
-	idx = find_first_zero_bit(priv->octet_cntr_use_bm, MAX_COUNTERS);
-	if (idx >= priv->n_counters) {
-		mutex_unlock(&priv->reg_mutex);
-		return -1;
-	}
+// 	idx = find_first_zero_bit(priv->octet_cntr_use_bm, MAX_COUNTERS);
+// 	if (idx >= priv->n_counters) {
+// 		mutex_unlock(&priv->reg_mutex);
+// 		return -1;
+// 	}
 
-	set_bit(idx, priv->octet_cntr_use_bm);
-	mutex_unlock(&priv->reg_mutex);
+// 	set_bit(idx, priv->octet_cntr_use_bm);
+// 	mutex_unlock(&priv->reg_mutex);
 
-	return idx;
-}
+// 	return idx;
+// }
 
 /* Allocate a 32-bit packet counter
  * 2 32-bit packet counters share the location of a 64-bit octet counter
@@ -1427,7 +1428,7 @@ static int rtl83xx_fib_event(struct notifier_block *this, unsigned long event, v
 			fib_info_hold(fib_work->fen_info.fi);
 
 		} else if (info->family == AF_INET6) {
-			struct fib6_entry_notifier_info *fen6_info = ptr;
+			//struct fib6_entry_notifier_info *fen6_info = ptr;
 			pr_warn("%s: FIB_RULE ADD/DEL for IPv6 not supported\n", __func__);
 			kfree(fib_work);
 			return NOTIFY_DONE;
diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c
index 3c67ce5adb..5b5608b9b4 100644
--- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c
@@ -1991,8 +1991,6 @@ static bool rtl83xx_lag_can_offload(struct dsa_switch *ds,
 
 static int rtl83xx_port_lag_change(struct dsa_switch *ds, int port)
 {
-	struct rtl838x_switch_priv *priv = ds->priv;
-
 	pr_debug("%s: %d\n", __func__, port);
 	/* Nothing to be done... */
 
diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c
index 606066aeea..0f9c3c33a4 100644
--- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c
+++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c
@@ -1300,15 +1300,16 @@ static void rtl838x_pie_rule_dump_raw(u32 r[])
 	pr_info("Sel    : %08x\n", r[17]);
 }
 
-static void rtl838x_pie_rule_dump(struct  pie_rule *pr)
-{
-	pr_info("Drop: %d, fwd: %d, ovid: %d, ivid: %d, flt: %d, log: %d, rmk: %d, meter: %d tagst: %d, mir: %d, nopri: %d, cpupri: %d, otpid: %d, itpid: %d, shape: %d\n",
-		pr->drop, pr->fwd_sel, pr->ovid_sel, pr->ivid_sel, pr->flt_sel, pr->log_sel, pr->rmk_sel, pr->log_sel, pr->tagst_sel, pr->mir_sel, pr->nopri_sel,
-		pr->cpupri_sel, pr->otpid_sel, pr->itpid_sel, pr->shaper_sel);
-	if (pr->fwd_sel)
-		pr_info("FWD: %08x\n", pr->fwd_data);
-	pr_info("TID: %x, %x\n", pr->tid, pr->tid_m);
-}
+// Currently not used
+// static void rtl838x_pie_rule_dump(struct  pie_rule *pr)
+// {
+// 	pr_info("Drop: %d, fwd: %d, ovid: %d, ivid: %d, flt: %d, log: %d, rmk: %d, meter: %d tagst: %d, mir: %d, nopri: %d, cpupri: %d, otpid: %d, itpid: %d, shape: %d\n",
+// 		pr->drop, pr->fwd_sel, pr->ovid_sel, pr->ivid_sel, pr->flt_sel, pr->log_sel, pr->rmk_sel, pr->log_sel, pr->tagst_sel, pr->mir_sel, pr->nopri_sel,
+// 		pr->cpupri_sel, pr->otpid_sel, pr->itpid_sel, pr->shaper_sel);
+// 	if (pr->fwd_sel)
+// 		pr_info("FWD: %08x\n", pr->fwd_data);
+// 	pr_info("TID: %x, %x\n", pr->tid, pr->tid_m);
+// }
 
 static int rtl838x_pie_rule_read(struct rtl838x_switch_priv *priv, int idx, struct  pie_rule *pr)
 {
diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c
index 5a899f32ba..e65f95e9f1 100644
--- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c
+++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c
@@ -992,57 +992,58 @@ static u32 rtl930x_l3_hash4(u32 ip, int algorithm, bool move_dip)
 	return hash;
 }
 
-static u32 rtl930x_l3_hash6(struct in6_addr *ip6, int algorithm, bool move_dip)
-{
-	u32 rows[16];
-	u32 hash;
-	u32 s0, s1, pH;
-
-	rows[0] = (HASH_PICK(ip6->s6_addr[0], 6, 2) << 0);
-	rows[1] = (HASH_PICK(ip6->s6_addr[0], 0, 6) << 3) | HASH_PICK(ip6->s6_addr[1], 5, 3);
-	rows[2] = (HASH_PICK(ip6->s6_addr[1], 0, 5) << 4) | HASH_PICK(ip6->s6_addr[2], 4, 4);
-	rows[3] = (HASH_PICK(ip6->s6_addr[2], 0, 4) << 5) | HASH_PICK(ip6->s6_addr[3], 3, 5);
-	rows[4] = (HASH_PICK(ip6->s6_addr[3], 0, 3) << 6) | HASH_PICK(ip6->s6_addr[4], 2, 6);
-	rows[5] = (HASH_PICK(ip6->s6_addr[4], 0, 2) << 7) | HASH_PICK(ip6->s6_addr[5], 1, 7);
-	rows[6] = (HASH_PICK(ip6->s6_addr[5], 0, 1) << 8) | HASH_PICK(ip6->s6_addr[6], 0, 8);
-	rows[7] = (HASH_PICK(ip6->s6_addr[7], 0, 8) << 1) | HASH_PICK(ip6->s6_addr[8], 7, 1);
-	rows[8] = (HASH_PICK(ip6->s6_addr[8], 0, 7) << 2) | HASH_PICK(ip6->s6_addr[9], 6, 2);
-	rows[9] = (HASH_PICK(ip6->s6_addr[9], 0, 6) << 3) | HASH_PICK(ip6->s6_addr[10], 5, 3);
-	rows[10] = (HASH_PICK(ip6->s6_addr[10], 0, 5) << 4) | HASH_PICK(ip6->s6_addr[11], 4, 4);
-	if (!algorithm) {
-		rows[11] = (HASH_PICK(ip6->s6_addr[11], 0, 4) << 5) |
-		           (HASH_PICK(ip6->s6_addr[12], 3, 5) << 0);
-		rows[12] = (HASH_PICK(ip6->s6_addr[12], 0, 3) << 6) |
-		           (HASH_PICK(ip6->s6_addr[13], 2, 6) << 0);
-		rows[13] = (HASH_PICK(ip6->s6_addr[13], 0, 2) << 7) |
-		           (HASH_PICK(ip6->s6_addr[14], 1, 7) << 0);
-		if (!move_dip) {
-			rows[14] = (HASH_PICK(ip6->s6_addr[14], 0, 1) << 8) |
-			           (HASH_PICK(ip6->s6_addr[15], 0, 8) << 0);
-		}
-		hash = rows[0] ^ rows[1] ^ rows[2] ^ rows[3] ^ rows[4] ^
-		       rows[5] ^ rows[6] ^ rows[7] ^ rows[8] ^ rows[9] ^
-		       rows[10] ^ rows[11] ^ rows[12] ^ rows[13] ^ rows[14];
-	} else {
-		rows[11] = (HASH_PICK(ip6->s6_addr[11], 0, 4) << 5);
-		rows[12] = (HASH_PICK(ip6->s6_addr[12], 3, 5) << 0);
-		rows[13] = (HASH_PICK(ip6->s6_addr[12], 0, 3) << 6) |
-		           HASH_PICK(ip6->s6_addr[13], 2, 6);
-		rows[14] = (HASH_PICK(ip6->s6_addr[13], 0, 2) << 7) |
-		           HASH_PICK(ip6->s6_addr[14], 1, 7);
-		if (!move_dip) {
-			rows[15] = (HASH_PICK(ip6->s6_addr[14], 0, 1) << 8) |
-			           (HASH_PICK(ip6->s6_addr[15], 0, 8) << 0);
-		}
-		s0 = rows[12] + rows[13] + rows[14];
-		s1 = (s0 & 0x1ff) + ((s0 & (0x1ff << 9)) >> 9);
-		pH = (s1 & 0x1ff) + ((s1 & (0x1ff << 9)) >> 9);
-		hash = rows[0] ^ rows[1] ^ rows[2] ^ rows[3] ^ rows[4] ^
-		       rows[5] ^ rows[6] ^ rows[7] ^ rows[8] ^ rows[9] ^
-		       rows[10] ^ rows[11] ^ pH ^ rows[15];
-	}
-	return hash;
-}
+// Currently not used
+// static u32 rtl930x_l3_hash6(struct in6_addr *ip6, int algorithm, bool move_dip)
+// {
+// 	u32 rows[16];
+// 	u32 hash;
+// 	u32 s0, s1, pH;
+
+// 	rows[0] = (HASH_PICK(ip6->s6_addr[0], 6, 2) << 0);
+// 	rows[1] = (HASH_PICK(ip6->s6_addr[0], 0, 6) << 3) | HASH_PICK(ip6->s6_addr[1], 5, 3);
+// 	rows[2] = (HASH_PICK(ip6->s6_addr[1], 0, 5) << 4) | HASH_PICK(ip6->s6_addr[2], 4, 4);
+// 	rows[3] = (HASH_PICK(ip6->s6_addr[2], 0, 4) << 5) | HASH_PICK(ip6->s6_addr[3], 3, 5);
+// 	rows[4] = (HASH_PICK(ip6->s6_addr[3], 0, 3) << 6) | HASH_PICK(ip6->s6_addr[4], 2, 6);
+// 	rows[5] = (HASH_PICK(ip6->s6_addr[4], 0, 2) << 7) | HASH_PICK(ip6->s6_addr[5], 1, 7);
+// 	rows[6] = (HASH_PICK(ip6->s6_addr[5], 0, 1) << 8) | HASH_PICK(ip6->s6_addr[6], 0, 8);
+// 	rows[7] = (HASH_PICK(ip6->s6_addr[7], 0, 8) << 1) | HASH_PICK(ip6->s6_addr[8], 7, 1);
+// 	rows[8] = (HASH_PICK(ip6->s6_addr[8], 0, 7) << 2) | HASH_PICK(ip6->s6_addr[9], 6, 2);
+// 	rows[9] = (HASH_PICK(ip6->s6_addr[9], 0, 6) << 3) | HASH_PICK(ip6->s6_addr[10], 5, 3);
+// 	rows[10] = (HASH_PICK(ip6->s6_addr[10], 0, 5) << 4) | HASH_PICK(ip6->s6_addr[11], 4, 4);
+// 	if (!algorithm) {
+// 		rows[11] = (HASH_PICK(ip6->s6_addr[11], 0, 4) << 5) |
+// 		           (HASH_PICK(ip6->s6_addr[12], 3, 5) << 0);
+// 		rows[12] = (HASH_PICK(ip6->s6_addr[12], 0, 3) << 6) |
+// 		           (HASH_PICK(ip6->s6_addr[13], 2, 6) << 0);
+// 		rows[13] = (HASH_PICK(ip6->s6_addr[13], 0, 2) << 7) |
+// 		           (HASH_PICK(ip6->s6_addr[14], 1, 7) << 0);
+// 		if (!move_dip) {
+// 			rows[14] = (HASH_PICK(ip6->s6_addr[14], 0, 1) << 8) |
+// 			           (HASH_PICK(ip6->s6_addr[15], 0, 8) << 0);
+// 		}
+// 		hash = rows[0] ^ rows[1] ^ rows[2] ^ rows[3] ^ rows[4] ^
+// 		       rows[5] ^ rows[6] ^ rows[7] ^ rows[8] ^ rows[9] ^
+// 		       rows[10] ^ rows[11] ^ rows[12] ^ rows[13] ^ rows[14];
+// 	} else {
+// 		rows[11] = (HASH_PICK(ip6->s6_addr[11], 0, 4) << 5);
+// 		rows[12] = (HASH_PICK(ip6->s6_addr[12], 3, 5) << 0);
+// 		rows[13] = (HASH_PICK(ip6->s6_addr[12], 0, 3) << 6) |
+// 		           HASH_PICK(ip6->s6_addr[13], 2, 6);
+// 		rows[14] = (HASH_PICK(ip6->s6_addr[13], 0, 2) << 7) |
+// 		           HASH_PICK(ip6->s6_addr[14], 1, 7);
+// 		if (!move_dip) {
+// 			rows[15] = (HASH_PICK(ip6->s6_addr[14], 0, 1) << 8) |
+// 			           (HASH_PICK(ip6->s6_addr[15], 0, 8) << 0);
+// 		}
+// 		s0 = rows[12] + rows[13] + rows[14];
+// 		s1 = (s0 & 0x1ff) + ((s0 & (0x1ff << 9)) >> 9);
+// 		pH = (s1 & 0x1ff) + ((s1 & (0x1ff << 9)) >> 9);
+// 		hash = rows[0] ^ rows[1] ^ rows[2] ^ rows[3] ^ rows[4] ^
+// 		       rows[5] ^ rows[6] ^ rows[7] ^ rows[8] ^ rows[9] ^
+// 		       rows[10] ^ rows[11] ^ pH ^ rows[15];
+// 	}
+// 	return hash;
+// }
 
 /* Read a prefix route entry from the L3_PREFIX_ROUTE_IPUC table
  * We currently only support IPv4 and IPv6 unicast route
@@ -1411,85 +1412,89 @@ static void rtl930x_get_l3_nexthop(int idx, u16 *dmac_id, u16 *interface)
 	*interface = v & 0x7f;
 }
 
-static int rtl930x_l3_mtu_del(struct rtl838x_switch_priv *priv, int mtu)
-{
-	int i;
-
-	for (i = 0; i < MAX_INTF_MTUS; i++) {
-		if (mtu == priv->intf_mtus[i])
-			break;
-	}
-	if (i >= MAX_INTF_MTUS || !priv->intf_mtu_count[i]) {
-		pr_err("%s: No MTU slot found for MTU: %d\n", __func__, mtu);
-		return -EINVAL;
-	}
-
-	priv->intf_mtu_count[i]--;
-}
-
-static int rtl930x_l3_mtu_add(struct rtl838x_switch_priv *priv, int mtu)
-{
-	int i, free_mtu;
-	int mtu_id;
-
-	/* Try to find an existing mtu-value or a free slot */
-	free_mtu = MAX_INTF_MTUS;
-	for (i = 0; i < MAX_INTF_MTUS && priv->intf_mtus[i] != mtu; i++) {
-		if ((!priv->intf_mtu_count[i]) && (free_mtu == MAX_INTF_MTUS))
-			free_mtu = i;
-	}
-	i = (i < MAX_INTF_MTUS) ? i : free_mtu;
-	if (i < MAX_INTF_MTUS) {
-		mtu_id = i;
-	} else {
-		pr_err("%s: No free MTU slot available!\n", __func__);
-		return -EINVAL;
-	}
-
-	priv->intf_mtus[i] = mtu;
-	pr_info("Writing MTU %d to slot %d\n", priv->intf_mtus[i], i);
-	/* Set MTU-value of the slot TODO: distinguish between IPv4/IPv6 routes / slots */
-	sw_w32_mask(0xffff << ((i % 2) * 16), priv->intf_mtus[i] << ((i % 2) * 16),
-		    RTL930X_L3_IP_MTU_CTRL(i));
-	sw_w32_mask(0xffff << ((i % 2) * 16), priv->intf_mtus[i] << ((i % 2) * 16),
-		    RTL930X_L3_IP6_MTU_CTRL(i));
-
-	priv->intf_mtu_count[i]++;
-
-	return mtu_id;
-}
-
-/* Creates an interface for a route by setting up the HW tables in the SoC */
-static int rtl930x_l3_intf_add(struct rtl838x_switch_priv *priv, struct rtl838x_l3_intf *intf)
-{
-	int i, intf_id, mtu_id;
-	/* number of MTU-values < 16384 */
-
-	/* Use the same IPv6 mtu as the ip4 mtu for this route if unset */
-	intf->ip6_mtu = intf->ip6_mtu ? intf->ip6_mtu : intf->ip4_mtu;
-
-	mtu_id = rtl930x_l3_mtu_add(priv, intf->ip4_mtu);
-	pr_info("%s: added mtu %d with mtu-id %d\n", __func__, intf->ip4_mtu, mtu_id);
-	if (mtu_id < 0)
-		return -ENOSPC;
-	intf->ip4_mtu_id = mtu_id;
-	intf->ip6_mtu_id = mtu_id;
-
-	for (i = 0; i < MAX_INTERFACES; i++) {
-		if (!priv->interfaces[i])
-			break;
-	}
-	if (i >= MAX_INTERFACES) {
-		pr_err("%s: cannot find free interface entry\n", __func__);
-		return -EINVAL;
-	}
-	intf_id = i;
-	priv->interfaces[i] = kzalloc(sizeof(struct rtl838x_l3_intf), GFP_KERNEL);
-	if (!priv->interfaces[i]) {
-		pr_err("%s: no memory to allocate new interface\n", __func__);
-		return -ENOMEM;
-	}
-}
+// Currently not used
+// static int rtl930x_l3_mtu_del(struct rtl838x_switch_priv *priv, int mtu)
+// {
+// 	int i;
+
+// 	for (i = 0; i < MAX_INTF_MTUS; i++) {
+// 		if (mtu == priv->intf_mtus[i])
+// 			break;
+// 	}
+// 	if (i >= MAX_INTF_MTUS || !priv->intf_mtu_count[i]) {
+// 		pr_err("%s: No MTU slot found for MTU: %d\n", __func__, mtu);
+// 		return -EINVAL;
+// 	}
+
+// 	priv->intf_mtu_count[i]--;
+// }
+
+// Currently not used
+// static int rtl930x_l3_mtu_add(struct rtl838x_switch_priv *priv, int mtu)
+// {
+// 	int i, free_mtu;
+// 	int mtu_id;
+
+// 	/* Try to find an existing mtu-value or a free slot */
+// 	free_mtu = MAX_INTF_MTUS;
+// 	for (i = 0; i < MAX_INTF_MTUS && priv->intf_mtus[i] != mtu; i++) {
+// 		if ((!priv->intf_mtu_count[i]) && (free_mtu == MAX_INTF_MTUS))
+// 			free_mtu = i;
+// 	}
+// 	i = (i < MAX_INTF_MTUS) ? i : free_mtu;
+// 	if (i < MAX_INTF_MTUS) {
+// 		mtu_id = i;
+// 	} else {
+// 		pr_err("%s: No free MTU slot available!\n", __func__);
+// 		return -EINVAL;
+// 	}
+
+// 	priv->intf_mtus[i] = mtu;
+// 	pr_info("Writing MTU %d to slot %d\n", priv->intf_mtus[i], i);
+// 	/* Set MTU-value of the slot TODO: distinguish between IPv4/IPv6 routes / slots */
+// 	sw_w32_mask(0xffff << ((i % 2) * 16), priv->intf_mtus[i] << ((i % 2) * 16),
+// 		    RTL930X_L3_IP_MTU_CTRL(i));
+// 	sw_w32_mask(0xffff << ((i % 2) * 16), priv->intf_mtus[i] << ((i % 2) * 16),
+// 		    RTL930X_L3_IP6_MTU_CTRL(i));
+
+// 	priv->intf_mtu_count[i]++;
+
+// 	return mtu_id;
+// }
+
+
+// Currently not used
+// /* Creates an interface for a route by setting up the HW tables in the SoC
+// static int rtl930x_l3_intf_add(struct rtl838x_switch_priv *priv, struct rtl838x_l3_intf *intf)
+// {
+// 	int i, intf_id, mtu_id;
+// 	/* number of MTU-values < 16384 *\/
+
+// 	/* Use the same IPv6 mtu as the ip4 mtu for this route if unset */
+// 	intf->ip6_mtu = intf->ip6_mtu ? intf->ip6_mtu : intf->ip4_mtu;
+
+// 	mtu_id = rtl930x_l3_mtu_add(priv, intf->ip4_mtu);
+// 	pr_info("%s: added mtu %d with mtu-id %d\n", __func__, intf->ip4_mtu, mtu_id);
+// 	if (mtu_id < 0)
+// 		return -ENOSPC;
+// 	intf->ip4_mtu_id = mtu_id;
+// 	intf->ip6_mtu_id = mtu_id;
+
+// 	for (i = 0; i < MAX_INTERFACES; i++) {
+// 		if (!priv->interfaces[i])
+// 			break;
+// 	}
+// 	if (i >= MAX_INTERFACES) {
+// 		pr_err("%s: cannot find free interface entry\n", __func__);
+// 		return -EINVAL;
+// 	}
+// 	intf_id = i;
+// 	priv->interfaces[i] = kzalloc(sizeof(struct rtl838x_l3_intf), GFP_KERNEL);
+// 	if (!priv->interfaces[i]) {
+// 		pr_err("%s: no memory to allocate new interface\n", __func__);
+// 		return -ENOMEM;
+// 	}
+// }
 
 /* Set the destination MAC and L3 egress interface ID for a nexthop entry in the SoC's
  * L3_NEXTHOP table. The nexthop entry is identified by idx.
@@ -1683,49 +1688,50 @@ static void rtl930x_write_pie_templated(u32 r[], struct pie_rule *pr, enum templ
 	}
 }
 
-static void rtl930x_read_pie_fixed_fields(u32 r[], struct pie_rule *pr)
-{
-	pr->stacking_port = r[6] & BIT(31);
-	pr->spn = (r[6] >> 24) & 0x7f;
-	pr->mgnt_vlan = r[6] & BIT(23);
-	if (pr->phase == PHASE_IACL)
-		pr->dmac_hit_sw = r[6] & BIT(22);
-	else
-		pr->content_too_deep = r[6] & BIT(22);
-	pr->not_first_frag = r[6]  & BIT(21);
-	pr->frame_type_l4 = (r[6] >> 18) & 7;
-	pr->frame_type = (r[6] >> 16) & 3;
-	pr->otag_fmt = (r[6] >> 15) & 1;
-	pr->itag_fmt = (r[6] >> 14) & 1;
-	pr->otag_exist = (r[6] >> 13) & 1;
-	pr->itag_exist = (r[6] >> 12) & 1;
-	pr->frame_type_l2 = (r[6] >> 10) & 3;
-	pr->igr_normal_port = (r[6] >> 9) & 1;
-	pr->tid = (r[6] >> 8) & 1;
-
-	pr->stacking_port_m = r[12] & BIT(7);
-	pr->spn_m = r[12]  & 0x7f;
-	pr->mgnt_vlan_m = r[13] & BIT(31);
-	if (pr->phase == PHASE_IACL)
-		pr->dmac_hit_sw_m = r[13] & BIT(30);
-	else
-		pr->content_too_deep_m = r[13] & BIT(30);
-	pr->not_first_frag_m = r[13] & BIT(29);
-	pr->frame_type_l4_m = (r[13] >> 26) & 7;
-	pr->frame_type_m = (r[13] >> 24) & 3;
-	pr->otag_fmt_m = r[13] & BIT(23);
-	pr->itag_fmt_m = r[13] & BIT(22);
-	pr->otag_exist_m = r[13] & BIT(21);
-	pr->itag_exist_m = r[13] & BIT (20);
-	pr->frame_type_l2_m = (r[13] >> 18) & 3;
-	pr->igr_normal_port_m = r[13] & BIT(17);
-	pr->tid_m = (r[13] >> 16) & 1;
-
-	pr->valid = r[13] & BIT(15);
-	pr->cond_not = r[13] & BIT(14);
-	pr->cond_and1 = r[13] & BIT(13);
-	pr->cond_and2 = r[13] & BIT(12);
-}
+// Currently not used
+// static void rtl930x_read_pie_fixed_fields(u32 r[], struct pie_rule *pr)
+// {
+// 	pr->stacking_port = r[6] & BIT(31);
+// 	pr->spn = (r[6] >> 24) & 0x7f;
+// 	pr->mgnt_vlan = r[6] & BIT(23);
+// 	if (pr->phase == PHASE_IACL)
+// 		pr->dmac_hit_sw = r[6] & BIT(22);
+// 	else
+// 		pr->content_too_deep = r[6] & BIT(22);
+// 	pr->not_first_frag = r[6]  & BIT(21);
+// 	pr->frame_type_l4 = (r[6] >> 18) & 7;
+// 	pr->frame_type = (r[6] >> 16) & 3;
+// 	pr->otag_fmt = (r[6] >> 15) & 1;
+// 	pr->itag_fmt = (r[6] >> 14) & 1;
+// 	pr->otag_exist = (r[6] >> 13) & 1;
+// 	pr->itag_exist = (r[6] >> 12) & 1;
+// 	pr->frame_type_l2 = (r[6] >> 10) & 3;
+// 	pr->igr_normal_port = (r[6] >> 9) & 1;
+// 	pr->tid = (r[6] >> 8) & 1;
+
+// 	pr->stacking_port_m = r[12] & BIT(7);
+// 	pr->spn_m = r[12]  & 0x7f;
+// 	pr->mgnt_vlan_m = r[13] & BIT(31);
+// 	if (pr->phase == PHASE_IACL)
+// 		pr->dmac_hit_sw_m = r[13] & BIT(30);
+// 	else
+// 		pr->content_too_deep_m = r[13] & BIT(30);
+// 	pr->not_first_frag_m = r[13] & BIT(29);
+// 	pr->frame_type_l4_m = (r[13] >> 26) & 7;
+// 	pr->frame_type_m = (r[13] >> 24) & 3;
+// 	pr->otag_fmt_m = r[13] & BIT(23);
+// 	pr->itag_fmt_m = r[13] & BIT(22);
+// 	pr->otag_exist_m = r[13] & BIT(21);
+// 	pr->itag_exist_m = r[13] & BIT (20);
+// 	pr->frame_type_l2_m = (r[13] >> 18) & 3;
+// 	pr->igr_normal_port_m = r[13] & BIT(17);
+// 	pr->tid_m = (r[13] >> 16) & 1;
+
+// 	pr->valid = r[13] & BIT(15);
+// 	pr->cond_not = r[13] & BIT(14);
+// 	pr->cond_and1 = r[13] & BIT(13);
+// 	pr->cond_and2 = r[13] & BIT(12);
+// }
 
 static void rtl930x_write_pie_fixed_fields(u32 r[],  struct pie_rule *pr)
 {
diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c
index 92f0662223..5e1b00add5 100644
--- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c
+++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c
@@ -1113,45 +1113,46 @@ static void rtl931x_write_pie_templated(u32 r[], struct pie_rule *pr, enum templ
 	}
 }
 
-static void rtl931x_read_pie_fixed_fields(u32 r[], struct pie_rule *pr)
-{
-	pr->mgnt_vlan = r[7] & BIT(31);
-	if (pr->phase == PHASE_IACL)
-		pr->dmac_hit_sw = r[7] & BIT(30);
-	else  /* TODO: EACL/VACL phase handling */
-		pr->content_too_deep = r[7] & BIT(30);
-	pr->not_first_frag = r[7]  & BIT(29);
-	pr->frame_type_l4 = (r[7] >> 26) & 7;
-	pr->frame_type = (r[7] >> 24) & 3;
-	pr->otag_fmt = (r[7] >> 23) & 1;
-	pr->itag_fmt = (r[7] >> 22) & 1;
-	pr->otag_exist = (r[7] >> 21) & 1;
-	pr->itag_exist = (r[7] >> 20) & 1;
-	pr->frame_type_l2 = (r[7] >> 18) & 3;
-	pr->igr_normal_port = (r[7] >> 17) & 1;
-	pr->tid = (r[7] >> 16) & 1;
-
-	pr->mgnt_vlan_m = r[14] & BIT(15);
-	if (pr->phase == PHASE_IACL)
-		pr->dmac_hit_sw_m = r[14] & BIT(14);
-	else
-		pr->content_too_deep_m = r[14] & BIT(14);
-	pr->not_first_frag_m = r[14] & BIT(13);
-	pr->frame_type_l4_m = (r[14] >> 10) & 7;
-	pr->frame_type_m = (r[14] >> 8) & 3;
-	pr->otag_fmt_m = r[14] & BIT(7);
-	pr->itag_fmt_m = r[14] & BIT(6);
-	pr->otag_exist_m = r[14] & BIT(5);
-	pr->itag_exist_m = r[14] & BIT (4);
-	pr->frame_type_l2_m = (r[14] >> 2) & 3;
-	pr->igr_normal_port_m = r[14] & BIT(1);
-	pr->tid_m = r[14] & 1;
-
-	pr->valid = r[15] & BIT(31);
-	pr->cond_not = r[15] & BIT(30);
-	pr->cond_and1 = r[15] & BIT(29);
-	pr->cond_and2 = r[15] & BIT(28);
-}
+// Currently unused
+// static void rtl931x_read_pie_fixed_fields(u32 r[], struct pie_rule *pr)
+// {
+// 	pr->mgnt_vlan = r[7] & BIT(31);
+// 	if (pr->phase == PHASE_IACL)
+// 		pr->dmac_hit_sw = r[7] & BIT(30);
+// 	else  /* TODO: EACL/VACL phase handling */
+// 		pr->content_too_deep = r[7] & BIT(30);
+// 	pr->not_first_frag = r[7]  & BIT(29);
+// 	pr->frame_type_l4 = (r[7] >> 26) & 7;
+// 	pr->frame_type = (r[7] >> 24) & 3;
+// 	pr->otag_fmt = (r[7] >> 23) & 1;
+// 	pr->itag_fmt = (r[7] >> 22) & 1;
+// 	pr->otag_exist = (r[7] >> 21) & 1;
+// 	pr->itag_exist = (r[7] >> 20) & 1;
+// 	pr->frame_type_l2 = (r[7] >> 18) & 3;
+// 	pr->igr_normal_port = (r[7] >> 17) & 1;
+// 	pr->tid = (r[7] >> 16) & 1;
+
+// 	pr->mgnt_vlan_m = r[14] & BIT(15);
+// 	if (pr->phase == PHASE_IACL)
+// 		pr->dmac_hit_sw_m = r[14] & BIT(14);
+// 	else
+// 		pr->content_too_deep_m = r[14] & BIT(14);
+// 	pr->not_first_frag_m = r[14] & BIT(13);
+// 	pr->frame_type_l4_m = (r[14] >> 10) & 7;
+// 	pr->frame_type_m = (r[14] >> 8) & 3;
+// 	pr->otag_fmt_m = r[14] & BIT(7);
+// 	pr->itag_fmt_m = r[14] & BIT(6);
+// 	pr->otag_exist_m = r[14] & BIT(5);
+// 	pr->itag_exist_m = r[14] & BIT (4);
+// 	pr->frame_type_l2_m = (r[14] >> 2) & 3;
+// 	pr->igr_normal_port_m = r[14] & BIT(1);
+// 	pr->tid_m = r[14] & 1;
+
+// 	pr->valid = r[15] & BIT(31);
+// 	pr->cond_not = r[15] & BIT(30);
+// 	pr->cond_and1 = r[15] & BIT(29);
+// 	pr->cond_and2 = r[15] & BIT(28);
+// }
 
 static void rtl931x_write_pie_fixed_fields(u32 r[],  struct pie_rule *pr)
 {
diff --git a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c
index 1b35fae09b..06de0ada2a 100644
--- a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c
@@ -161,12 +161,13 @@ static void rtl931x_create_tx_header(struct p_hdr *h, unsigned int dest_port, in
 		h->cpu_tag[2] = (BIT(5) | (prio & 0x1f)) << 8;
 }
 
-static void rtl93xx_header_vlan_set(struct p_hdr *h, int vlan)
-{
-	h->cpu_tag[2] |= BIT(4); /* Enable VLAN forwarding offload */
-	h->cpu_tag[2] |= (vlan >> 8) & 0xf;
-	h->cpu_tag[3] |= (vlan & 0xff) << 8;
-}
+// Currently unused
+// static void rtl93xx_header_vlan_set(struct p_hdr *h, int vlan)
+// {
+// 	h->cpu_tag[2] |= BIT(4); /* Enable VLAN forwarding offload */
+// 	h->cpu_tag[2] |= (vlan >> 8) & 0xf;
+// 	h->cpu_tag[3] |= (vlan & 0xff) << 8;
+// }
 
 struct rtl838x_rx_q {
 	int id;
diff --git a/target/linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c b/target/linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c
index 7733252763..d47ba3e013 100644
--- a/target/linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c
+++ b/target/linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c
@@ -743,9 +743,10 @@ static int rtl8380_configure_int_rtl8218b(struct phy_device *phydev)
 	rtl838x_6275B_intPhy_perport = (void *)h + sizeof(struct fw_header) + h->parts[8].start;
 	rtl8218b_6276B_hwEsd_perport = (void *)h + sizeof(struct fw_header) + h->parts[9].start;
 
-	if (sw_r32(RTL838X_DMY_REG31) == 0x1) {
-		int ipd_flag = 1;
-	}
+	// Currently not used
+	// if (sw_r32(RTL838X_DMY_REG31) == 0x1) {
+	// 	int ipd_flag = 1;
+	// }
 
 	val = phy_read(phydev, 0);
 	if (val & BIT(11))
@@ -3330,13 +3331,14 @@ static void rtl931x_sds_rx_rst(u32 sds)
 	mdelay(50);
 }
 
-static void rtl931x_sds_disable(u32 sds)
-{
-	u32 v = 0x1f;
+// Currently not used
+// static void rtl931x_sds_disable(u32 sds)
+// {
+// 	u32 v = 0x1f;
 
-	v |= BIT(7);
-	sw_w32(v, RTL931X_SERDES_MODE_CTRL + (sds >> 2) * 4);
-}
+// 	v |= BIT(7);
+// 	sw_w32(v, RTL931X_SERDES_MODE_CTRL + (sds >> 2) * 4);
+// }
 
 static void rtl931x_sds_mii_mode_set(u32 sds, phy_interface_t mode)
 {




More information about the lede-commits mailing list