mirror of
https://github.com/immortalwrt/immortalwrt.git
synced 2025-08-07 22:06:25 +08:00
Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
54
package/libs/libbpf/patches/100-bpf_tc_classid.patch
Normal file
54
package/libs/libbpf/patches/100-bpf_tc_classid.patch
Normal file
@ -0,0 +1,54 @@
|
||||
--- a/src/libbpf.h
|
||||
+++ b/src/libbpf.h
|
||||
@@ -1291,9 +1291,10 @@ struct bpf_tc_opts {
|
||||
__u32 prog_id;
|
||||
__u32 handle;
|
||||
__u32 priority;
|
||||
+ __u32 classid;
|
||||
size_t :0;
|
||||
};
|
||||
-#define bpf_tc_opts__last_field priority
|
||||
+#define bpf_tc_opts__last_field classid
|
||||
|
||||
LIBBPF_API int bpf_tc_hook_create(struct bpf_tc_hook *hook);
|
||||
LIBBPF_API int bpf_tc_hook_destroy(struct bpf_tc_hook *hook);
|
||||
--- a/src/netlink.c
|
||||
+++ b/src/netlink.c
|
||||
@@ -673,6 +673,8 @@ static int __get_tc_info(void *cookie, s
|
||||
OPTS_SET(info->opts, prog_id, libbpf_nla_getattr_u32(tbb[TCA_BPF_ID]));
|
||||
OPTS_SET(info->opts, handle, tc->tcm_handle);
|
||||
OPTS_SET(info->opts, priority, TC_H_MAJ(tc->tcm_info) >> 16);
|
||||
+ if (tbb[TCA_BPF_CLASSID])
|
||||
+ OPTS_SET(info->opts, classid, libbpf_nla_getattr_u32(tbb[TCA_BPF_CLASSID]));
|
||||
|
||||
info->processed = true;
|
||||
return unicast ? NL_NEXT : NL_DONE;
|
||||
@@ -717,7 +719,7 @@ static int tc_add_fd_and_name(struct lib
|
||||
|
||||
int bpf_tc_attach(const struct bpf_tc_hook *hook, struct bpf_tc_opts *opts)
|
||||
{
|
||||
- __u32 protocol, bpf_flags, handle, priority, parent, prog_id, flags;
|
||||
+ __u32 protocol, bpf_flags, handle, priority, parent, prog_id, flags, classid;
|
||||
int ret, ifindex, attach_point, prog_fd;
|
||||
struct bpf_cb_ctx info = {};
|
||||
struct libbpf_nla_req req;
|
||||
@@ -737,6 +739,7 @@ int bpf_tc_attach(const struct bpf_tc_ho
|
||||
prog_fd = OPTS_GET(opts, prog_fd, 0);
|
||||
prog_id = OPTS_GET(opts, prog_id, 0);
|
||||
flags = OPTS_GET(opts, flags, 0);
|
||||
+ classid = OPTS_GET(opts, classid, 0);
|
||||
|
||||
if (ifindex <= 0 || !prog_fd || prog_id)
|
||||
return libbpf_err(-EINVAL);
|
||||
@@ -776,6 +779,11 @@ int bpf_tc_attach(const struct bpf_tc_ho
|
||||
ret = nlattr_add(&req, TCA_BPF_FLAGS, &bpf_flags, sizeof(bpf_flags));
|
||||
if (ret < 0)
|
||||
return libbpf_err(ret);
|
||||
+ if (classid) {
|
||||
+ ret = nlattr_add(&req, TCA_BPF_CLASSID, &classid, sizeof(classid));
|
||||
+ if (ret < 0)
|
||||
+ return libbpf_err(ret);
|
||||
+ }
|
||||
nlattr_end_nested(&req, nla);
|
||||
|
||||
info.opts = opts;
|
@ -620,7 +620,7 @@ uc_bpf_map_pin(uc_vm_t *vm, size_t nargs)
|
||||
|
||||
static uc_value_t *
|
||||
uc_bpf_set_tc_hook(uc_value_t *ifname, uc_value_t *type, uc_value_t *prio,
|
||||
int fd)
|
||||
uc_value_t *classid, int fd)
|
||||
{
|
||||
DECLARE_LIBBPF_OPTS(bpf_tc_hook, hook);
|
||||
DECLARE_LIBBPF_OPTS(bpf_tc_opts, attach_tc,
|
||||
@ -657,6 +657,7 @@ uc_bpf_set_tc_hook(uc_value_t *ifname, uc_value_t *type, uc_value_t *prio,
|
||||
goto out;
|
||||
|
||||
attach_tc.prog_fd = fd;
|
||||
attach_tc.classid = ucv_int64_get(classid);
|
||||
if (bpf_tc_attach(&hook, &attach_tc) < 0)
|
||||
goto error;
|
||||
|
||||
@ -676,11 +677,12 @@ uc_bpf_program_tc_attach(uc_vm_t *vm, size_t nargs)
|
||||
uc_value_t *ifname = uc_fn_arg(0);
|
||||
uc_value_t *type = uc_fn_arg(1);
|
||||
uc_value_t *prio = uc_fn_arg(2);
|
||||
uc_value_t *classid = uc_fn_arg(3);
|
||||
|
||||
if (!f)
|
||||
err_return(EINVAL, NULL);
|
||||
|
||||
return uc_bpf_set_tc_hook(ifname, type, prio, f->fd);
|
||||
return uc_bpf_set_tc_hook(ifname, type, prio, classid, f->fd);
|
||||
}
|
||||
|
||||
static uc_value_t *
|
||||
@ -690,7 +692,7 @@ uc_bpf_tc_detach(uc_vm_t *vm, size_t nargs)
|
||||
uc_value_t *type = uc_fn_arg(1);
|
||||
uc_value_t *prio = uc_fn_arg(2);
|
||||
|
||||
return uc_bpf_set_tc_hook(ifname, type, prio, -1);
|
||||
return uc_bpf_set_tc_hook(ifname, type, prio, NULL, -1);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -0,0 +1,81 @@
|
||||
From 26f732791f2bcab18f59c61915bbe35225f30136 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sat, 12 Jul 2025 16:39:21 +0100
|
||||
Subject: [PATCH] Revert "leds: trigger: netdev: Configure LED blink interval
|
||||
for HW offload"
|
||||
|
||||
This reverts commit c629c972b310af41e9e072febb6dae9a299edde6.
|
||||
|
||||
While .led_blink_set() would previously put an LED into an unconditional
|
||||
permanently blinking state, the offending commit now uses same operation
|
||||
to (also?) set the blink timing of the netdev trigger when offloading.
|
||||
|
||||
This breaks many if not all of the existing PHY drivers which offer
|
||||
offloading LED operations, as those drivers would just put the LED into
|
||||
blinking state after .led_blink_set() has been called.
|
||||
|
||||
Unfortunately the change even made it into stable kernels for unknown
|
||||
reasons, so it should be reverted there as well.
|
||||
|
||||
Fixes: c629c972b310a ("leds: trigger: netdev: Configure LED blink interval for HW offload")
|
||||
Link: https://lore.kernel.org/linux-leds/c6134e26-2e45-4121-aa15-58aaef327201@lunn.ch/T/#m9d6fe81bbcb273e59f12bbedbd633edd32118387
|
||||
Suggested-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://lore.kernel.org/r/6dcc77ee1c9676891d6250d8994850f521426a0f.1752334655.git.daniel@makrotopia.org
|
||||
Signed-off-by: Lee Jones <lee@kernel.org>
|
||||
---
|
||||
drivers/leds/trigger/ledtrig-netdev.c | 16 +++-------------
|
||||
1 file changed, 3 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/drivers/leds/trigger/ledtrig-netdev.c
|
||||
+++ b/drivers/leds/trigger/ledtrig-netdev.c
|
||||
@@ -68,7 +68,6 @@ struct led_netdev_data {
|
||||
unsigned int last_activity;
|
||||
|
||||
unsigned long mode;
|
||||
- unsigned long blink_delay;
|
||||
int link_speed;
|
||||
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported_link_modes);
|
||||
u8 duplex;
|
||||
@@ -87,10 +86,6 @@ static void set_baseline_state(struct le
|
||||
/* Already validated, hw control is possible with the requested mode */
|
||||
if (trigger_data->hw_control) {
|
||||
led_cdev->hw_control_set(led_cdev, trigger_data->mode);
|
||||
- if (led_cdev->blink_set) {
|
||||
- led_cdev->blink_set(led_cdev, &trigger_data->blink_delay,
|
||||
- &trigger_data->blink_delay);
|
||||
- }
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -459,11 +454,10 @@ static ssize_t interval_store(struct dev
|
||||
size_t size)
|
||||
{
|
||||
struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
|
||||
- struct led_classdev *led_cdev = trigger_data->led_cdev;
|
||||
unsigned long value;
|
||||
int ret;
|
||||
|
||||
- if (trigger_data->hw_control && !led_cdev->blink_set)
|
||||
+ if (trigger_data->hw_control)
|
||||
return -EINVAL;
|
||||
|
||||
ret = kstrtoul(buf, 0, &value);
|
||||
@@ -472,13 +466,9 @@ static ssize_t interval_store(struct dev
|
||||
|
||||
/* impose some basic bounds on the timer interval */
|
||||
if (value >= 5 && value <= 10000) {
|
||||
- if (trigger_data->hw_control) {
|
||||
- trigger_data->blink_delay = value;
|
||||
- } else {
|
||||
- cancel_delayed_work_sync(&trigger_data->work);
|
||||
+ cancel_delayed_work_sync(&trigger_data->work);
|
||||
|
||||
- atomic_set(&trigger_data->interval, msecs_to_jiffies(value));
|
||||
- }
|
||||
+ atomic_set(&trigger_data->interval, msecs_to_jiffies(value));
|
||||
set_baseline_state(trigger_data); /* resets timer */
|
||||
}
|
||||
|
@ -0,0 +1,81 @@
|
||||
From 26f732791f2bcab18f59c61915bbe35225f30136 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sat, 12 Jul 2025 16:39:21 +0100
|
||||
Subject: [PATCH] Revert "leds: trigger: netdev: Configure LED blink interval
|
||||
for HW offload"
|
||||
|
||||
This reverts commit c629c972b310af41e9e072febb6dae9a299edde6.
|
||||
|
||||
While .led_blink_set() would previously put an LED into an unconditional
|
||||
permanently blinking state, the offending commit now uses same operation
|
||||
to (also?) set the blink timing of the netdev trigger when offloading.
|
||||
|
||||
This breaks many if not all of the existing PHY drivers which offer
|
||||
offloading LED operations, as those drivers would just put the LED into
|
||||
blinking state after .led_blink_set() has been called.
|
||||
|
||||
Unfortunately the change even made it into stable kernels for unknown
|
||||
reasons, so it should be reverted there as well.
|
||||
|
||||
Fixes: c629c972b310a ("leds: trigger: netdev: Configure LED blink interval for HW offload")
|
||||
Link: https://lore.kernel.org/linux-leds/c6134e26-2e45-4121-aa15-58aaef327201@lunn.ch/T/#m9d6fe81bbcb273e59f12bbedbd633edd32118387
|
||||
Suggested-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://lore.kernel.org/r/6dcc77ee1c9676891d6250d8994850f521426a0f.1752334655.git.daniel@makrotopia.org
|
||||
Signed-off-by: Lee Jones <lee@kernel.org>
|
||||
---
|
||||
drivers/leds/trigger/ledtrig-netdev.c | 16 +++-------------
|
||||
1 file changed, 3 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/drivers/leds/trigger/ledtrig-netdev.c
|
||||
+++ b/drivers/leds/trigger/ledtrig-netdev.c
|
||||
@@ -54,7 +54,6 @@ struct led_netdev_data {
|
||||
unsigned int last_activity;
|
||||
|
||||
unsigned long mode;
|
||||
- unsigned long blink_delay;
|
||||
int link_speed;
|
||||
u8 duplex;
|
||||
|
||||
@@ -70,10 +69,6 @@ static void set_baseline_state(struct le
|
||||
/* Already validated, hw control is possible with the requested mode */
|
||||
if (trigger_data->hw_control) {
|
||||
led_cdev->hw_control_set(led_cdev, trigger_data->mode);
|
||||
- if (led_cdev->blink_set) {
|
||||
- led_cdev->blink_set(led_cdev, &trigger_data->blink_delay,
|
||||
- &trigger_data->blink_delay);
|
||||
- }
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -415,11 +410,10 @@ static ssize_t interval_store(struct dev
|
||||
size_t size)
|
||||
{
|
||||
struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
|
||||
- struct led_classdev *led_cdev = trigger_data->led_cdev;
|
||||
unsigned long value;
|
||||
int ret;
|
||||
|
||||
- if (trigger_data->hw_control && !led_cdev->blink_set)
|
||||
+ if (trigger_data->hw_control)
|
||||
return -EINVAL;
|
||||
|
||||
ret = kstrtoul(buf, 0, &value);
|
||||
@@ -428,13 +422,9 @@ static ssize_t interval_store(struct dev
|
||||
|
||||
/* impose some basic bounds on the timer interval */
|
||||
if (value >= 5 && value <= 10000) {
|
||||
- if (trigger_data->hw_control) {
|
||||
- trigger_data->blink_delay = value;
|
||||
- } else {
|
||||
- cancel_delayed_work_sync(&trigger_data->work);
|
||||
+ cancel_delayed_work_sync(&trigger_data->work);
|
||||
|
||||
- atomic_set(&trigger_data->interval, msecs_to_jiffies(value));
|
||||
- }
|
||||
+ atomic_set(&trigger_data->interval, msecs_to_jiffies(value));
|
||||
set_baseline_state(trigger_data); /* resets timer */
|
||||
}
|
||||
|
@ -29,9 +29,6 @@ extern const struct dsa_switch_ops rtl930x_switch_ops;
|
||||
extern const struct phylink_pcs_ops rtl83xx_pcs_ops;
|
||||
extern const struct phylink_pcs_ops rtl93xx_pcs_ops;
|
||||
|
||||
extern int rtmdio_838x_read_phy(u32 port, u32 page, u32 reg, u32 *val);
|
||||
extern int rtmdio_838x_write_phy(u32 port, u32 page, u32 reg, u32 val);
|
||||
|
||||
DEFINE_MUTEX(smi_lock);
|
||||
|
||||
int rtl83xx_port_get_stp_state(struct rtl838x_switch_priv *priv, int port)
|
||||
@ -243,38 +240,6 @@ u64 rtl839x_get_port_reg_le(int reg)
|
||||
return v;
|
||||
}
|
||||
|
||||
int read_phy(u32 port, u32 page, u32 reg, u32 *val)
|
||||
{
|
||||
switch (soc_info.family) {
|
||||
case RTL8380_FAMILY_ID:
|
||||
return rtmdio_838x_read_phy(port, page, reg, val);
|
||||
case RTL8390_FAMILY_ID:
|
||||
return rtl839x_read_phy(port, page, reg, val);
|
||||
case RTL9300_FAMILY_ID:
|
||||
return rtl930x_read_phy(port, page, reg, val);
|
||||
case RTL9310_FAMILY_ID:
|
||||
return rtl931x_read_phy(port, page, reg, val);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int write_phy(u32 port, u32 page, u32 reg, u32 val)
|
||||
{
|
||||
switch (soc_info.family) {
|
||||
case RTL8380_FAMILY_ID:
|
||||
return rtmdio_838x_write_phy(port, page, reg, val);
|
||||
case RTL8390_FAMILY_ID:
|
||||
return rtl839x_write_phy(port, page, reg, val);
|
||||
case RTL9300_FAMILY_ID:
|
||||
return rtl930x_write_phy(port, page, reg, val);
|
||||
case RTL9310_FAMILY_ID:
|
||||
return rtl931x_write_phy(port, page, reg, val);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int rtldsa_bus_read(struct mii_bus *bus, int addr, int regnum)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = bus->priv;
|
||||
@ -1599,7 +1564,7 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev)
|
||||
priv->cpu_port = RTL931X_CPU_PORT;
|
||||
priv->port_mask = 0x3f;
|
||||
priv->port_width = 2;
|
||||
priv->irq_mask = 0xFFFFFFFFFFFFFULL;
|
||||
priv->irq_mask = GENMASK_ULL(priv->cpu_port - 1, 0);
|
||||
priv->r = &rtl931x_reg;
|
||||
priv->ds->num_ports = 57;
|
||||
priv->fib_entries = 16384;
|
||||
|
@ -519,7 +519,10 @@ static int rtl93xx_setup(struct dsa_switch *ds)
|
||||
}
|
||||
priv->r->traffic_set(priv->cpu_port, BIT_ULL(priv->cpu_port));
|
||||
|
||||
rtl930x_print_matrix();
|
||||
if (priv->family_id == RTL9300_FAMILY_ID)
|
||||
rtl930x_print_matrix();
|
||||
else if (priv->family_id == RTL9310_FAMILY_ID)
|
||||
rtl931x_print_matrix();
|
||||
|
||||
/* TODO: Initialize statistics */
|
||||
rtldsa_init_counters(priv);
|
||||
@ -2671,39 +2674,18 @@ out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl83xx_dsa_phy_read(struct dsa_switch *ds, int phy_addr, int phy_reg)
|
||||
static int rtldsa_phy_read(struct dsa_switch *ds, int addr, int regnum)
|
||||
{
|
||||
u32 val;
|
||||
u32 offset = 0;
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
|
||||
if ((phy_addr >= 24) &&
|
||||
(phy_addr <= 27) &&
|
||||
(priv->ports[24].phy == PHY_RTL838X_SDS)) {
|
||||
if (phy_addr == 26)
|
||||
offset = 0x100;
|
||||
val = sw_r32(RTL838X_SDS4_FIB_REG0 + offset + (phy_reg << 2)) & 0xffff;
|
||||
return val;
|
||||
}
|
||||
|
||||
read_phy(phy_addr, 0, phy_reg, &val);
|
||||
return val;
|
||||
return mdiobus_read_nested(priv->parent_bus, addr, regnum);
|
||||
}
|
||||
|
||||
static int rtl83xx_dsa_phy_write(struct dsa_switch *ds, int phy_addr, int phy_reg, u16 val)
|
||||
static int rtldsa_phy_write(struct dsa_switch *ds, int addr, int regnum, u16 val)
|
||||
{
|
||||
u32 offset = 0;
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
|
||||
if ((phy_addr >= 24) &&
|
||||
(phy_addr <= 27) &&
|
||||
(priv->ports[24].phy == PHY_RTL838X_SDS)) {
|
||||
if (phy_addr == 26)
|
||||
offset = 0x100;
|
||||
sw_w32(val, RTL838X_SDS4_FIB_REG0 + offset + (phy_reg << 2));
|
||||
return 0;
|
||||
}
|
||||
return write_phy(phy_addr, 0, phy_reg, val);
|
||||
return mdiobus_write_nested(priv->parent_bus, addr, regnum, val);
|
||||
}
|
||||
|
||||
const struct phylink_pcs_ops rtl83xx_pcs_ops = {
|
||||
@ -2716,8 +2698,8 @@ const struct dsa_switch_ops rtl83xx_switch_ops = {
|
||||
.get_tag_protocol = rtl83xx_get_tag_protocol,
|
||||
.setup = rtl83xx_setup,
|
||||
|
||||
.phy_read = rtl83xx_dsa_phy_read,
|
||||
.phy_write = rtl83xx_dsa_phy_write,
|
||||
.phy_read = rtldsa_phy_read,
|
||||
.phy_write = rtldsa_phy_write,
|
||||
|
||||
.phylink_get_caps = rtldsa_phylink_get_caps,
|
||||
.phylink_mac_config = rtl83xx_phylink_mac_config,
|
||||
@ -2779,8 +2761,8 @@ const struct dsa_switch_ops rtl930x_switch_ops = {
|
||||
.get_tag_protocol = rtl83xx_get_tag_protocol,
|
||||
.setup = rtl93xx_setup,
|
||||
|
||||
.phy_read = rtl83xx_dsa_phy_read,
|
||||
.phy_write = rtl83xx_dsa_phy_write,
|
||||
.phy_read = rtldsa_phy_read,
|
||||
.phy_write = rtldsa_phy_write,
|
||||
|
||||
.phylink_get_caps = rtldsa_phylink_get_caps,
|
||||
.phylink_mac_config = rtl93xx_phylink_mac_config,
|
||||
|
@ -139,9 +139,6 @@ int rtl83xx_port_is_under(const struct net_device * dev, struct rtl838x_switch_p
|
||||
void rtl83xx_port_stp_state_set(struct dsa_switch *ds, int port, u8 state);
|
||||
int rtl83xx_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data);
|
||||
|
||||
int read_phy(u32 port, u32 page, u32 reg, u32 *val);
|
||||
int write_phy(u32 port, u32 page, u32 reg, u32 val);
|
||||
|
||||
/* Port register accessor functions for the RTL839x and RTL931X SoCs */
|
||||
void rtl839x_mask_port_reg_be(u64 clear, u64 set, int reg);
|
||||
u32 rtl839x_get_egress_rate(struct rtl838x_switch_priv *priv, int port);
|
||||
@ -190,15 +187,13 @@ irqreturn_t rtl931x_switch_irq(int irq, void *dev_id);
|
||||
int rtl931x_sds_cmu_band_get(int sds, phy_interface_t mode);
|
||||
int rtl931x_sds_cmu_band_set(int sds, bool enable, u32 band, phy_interface_t mode);
|
||||
extern void rtl931x_sds_init(u32 sds, phy_interface_t mode);
|
||||
void rtl931x_print_matrix(void);
|
||||
|
||||
int rtl83xx_lag_add(struct dsa_switch *ds, int group, int port, struct netdev_lag_upper_info *info);
|
||||
int rtl83xx_lag_del(struct dsa_switch *ds, int group, int port);
|
||||
|
||||
/* phy functions that will need to be moved to the future mdio driver */
|
||||
|
||||
int rtl838x_read_mmd_phy(u32 port, u32 addr, u32 reg, u32 *val);
|
||||
int rtl838x_write_mmd_phy(u32 port, u32 addr, u32 reg, u32 val);
|
||||
|
||||
int rtl839x_read_mmd_phy(u32 port, u32 devnum, u32 regnum, u32 *val);
|
||||
int rtl839x_write_mmd_phy(u32 port, u32 devnum, u32 regnum, u32 val);
|
||||
|
||||
|
@ -464,12 +464,14 @@ int rtl931x_write_mmd_phy(u32 port, u32 devnum, u32 regnum, u32 val)
|
||||
|
||||
void rtl931x_print_matrix(void)
|
||||
{
|
||||
volatile u64 *ptr = RTL838X_SW_BASE + RTL839X_PORT_ISO_CTRL(0);
|
||||
struct table_reg *r = rtl_table_get(RTL9310_TBL_2, 1);
|
||||
|
||||
for (int i = 0; i < 52; i += 4)
|
||||
pr_debug("> %16llx %16llx %16llx %16llx\n",
|
||||
ptr[i + 0], ptr[i + 1], ptr[i + 2], ptr[i + 3]);
|
||||
pr_debug("CPU_PORT> %16llx\n", ptr[52]);
|
||||
for (int i = 0; i < 64; i++) {
|
||||
rtl_table_read(r, i);
|
||||
pr_info("> %08x %08x\n", sw_r32(rtl_table_data(r, 0)),
|
||||
sw_r32(rtl_table_data(r, 1)));
|
||||
}
|
||||
rtl_table_release(r);
|
||||
}
|
||||
|
||||
void rtl931x_set_receive_management_action(int port, rma_ctrl_t type, action_type_t action)
|
||||
@ -530,13 +532,15 @@ void rtl931x_set_receive_management_action(int port, rma_ctrl_t type, action_typ
|
||||
|
||||
static u64 rtl931x_traffic_get(int source)
|
||||
{
|
||||
u32 v;
|
||||
struct table_reg *r = rtl_table_get(RTL9310_TBL_0, 6);
|
||||
u64 v;
|
||||
struct table_reg *r = rtl_table_get(RTL9310_TBL_2, 1);
|
||||
|
||||
rtl_table_read(r, source);
|
||||
v = sw_r32(rtl_table_data(r, 0));
|
||||
v <<= 32;
|
||||
v |= sw_r32(rtl_table_data(r, 1));
|
||||
v >>= 7;
|
||||
rtl_table_release(r);
|
||||
v = v >> 3;
|
||||
|
||||
return v;
|
||||
}
|
||||
@ -544,27 +548,28 @@ static u64 rtl931x_traffic_get(int source)
|
||||
/* Enable traffic between a source port and a destination port matrix */
|
||||
static void rtl931x_traffic_set(int source, u64 dest_matrix)
|
||||
{
|
||||
struct table_reg *r = rtl_table_get(RTL9310_TBL_0, 6);
|
||||
struct table_reg *r = rtl_table_get(RTL9310_TBL_2, 1);
|
||||
|
||||
sw_w32((dest_matrix << 3), rtl_table_data(r, 0));
|
||||
sw_w32(dest_matrix >> (32 - 7), rtl_table_data(r, 0));
|
||||
sw_w32(dest_matrix << 7, rtl_table_data(r, 1));
|
||||
rtl_table_write(r, source);
|
||||
rtl_table_release(r);
|
||||
}
|
||||
|
||||
static void rtl931x_traffic_enable(int source, int dest)
|
||||
{
|
||||
struct table_reg *r = rtl_table_get(RTL9310_TBL_0, 6);
|
||||
struct table_reg *r = rtl_table_get(RTL9310_TBL_2, 1);
|
||||
rtl_table_read(r, source);
|
||||
sw_w32_mask(0, BIT(dest + 3), rtl_table_data(r, 0));
|
||||
sw_w32_mask(0, BIT((dest + 7) % 32), rtl_table_data(r, (dest + 7) / 32 ? 0 : 1));
|
||||
rtl_table_write(r, source);
|
||||
rtl_table_release(r);
|
||||
}
|
||||
|
||||
static void rtl931x_traffic_disable(int source, int dest)
|
||||
{
|
||||
struct table_reg *r = rtl_table_get(RTL9310_TBL_0, 6);
|
||||
struct table_reg *r = rtl_table_get(RTL9310_TBL_2, 1);
|
||||
rtl_table_read(r, source);
|
||||
sw_w32_mask(BIT(dest + 3), 0, rtl_table_data(r, 0));
|
||||
sw_w32_mask(BIT((dest + 7) % 32), 0, rtl_table_data(r, (dest + 7) / 32 ? 0 : 1));
|
||||
rtl_table_write(r, source);
|
||||
rtl_table_release(r);
|
||||
}
|
||||
|
@ -1711,9 +1711,11 @@ static int rtsds_930x_get_internal_mode(int sds)
|
||||
|
||||
static void rtsds_930x_set_power(int sds, bool on)
|
||||
{
|
||||
int power = on ? 0 : 3;
|
||||
int power_down = on ? 0x0 : 0x3;
|
||||
int rx_enable = on ? 0x3 : 0x1;
|
||||
|
||||
rtl9300_sds_field_w(sds, 0x20, 0x00, 7, 6, power);
|
||||
rtl9300_sds_field_w(sds, 0x20, 0x00, 7, 6, power_down);
|
||||
rtl9300_sds_field_w(sds, 0x20, 0x00, 5, 4, rx_enable);
|
||||
}
|
||||
|
||||
static int rtsds_930x_config_pll(int sds, phy_interface_t interface)
|
||||
|
@ -14,42 +14,15 @@ PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.41
|
||||
PKG_HASH:=be9ad9a276f4305ab7dd2f5225c8be1ff54352f565ff4dede9628c1aaa7dec57
|
||||
PKG_CPE_ID:=cpe:/a:kernel:util-linux
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/meson.mk
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--with-pic \
|
||||
--disable-shared \
|
||||
--disable-nls \
|
||||
--disable-all-programs \
|
||||
--enable-hexdump \
|
||||
--enable-libuuid \
|
||||
--without-util \
|
||||
--without-selinux \
|
||||
--without-audit \
|
||||
--without-udev \
|
||||
--without-ncursesw \
|
||||
--without-ncurses \
|
||||
--without-slang \
|
||||
--without-tinfo \
|
||||
--without-readline \
|
||||
--without-utempter \
|
||||
--without-cap-ng \
|
||||
--without-libz \
|
||||
--without-libmagic \
|
||||
--without-user \
|
||||
--without-btrfs \
|
||||
--without-systemd \
|
||||
--without-smack \
|
||||
--without-econf \
|
||||
--without-python \
|
||||
--without-cryptsetup
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
MESON_HOST_ARGS += \
|
||||
$(if $(findstring y,$(YEAR_2038)),,-Dallow-32bit-time=true) \
|
||||
-Dauto_features=disabled \
|
||||
-Dbuild-hexdump=enabled \
|
||||
-Dbuild-libuuid=enabled \
|
||||
-Dncurses=enabled \
|
||||
-Dprogram-tests=false
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
24
tools/util-linux/patches/010-meson-curses.patch
Normal file
24
tools/util-linux/patches/010-meson-curses.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From c1ca5ec4a5c6a0e4acbdcc6ff4e4fa2109c1ec24 Mon Sep 17 00:00:00 2001
|
||||
From: Rosen Penev <rosenp@gmail.com>
|
||||
Date: Wed, 30 Jul 2025 14:13:07 -0700
|
||||
Subject: [PATCH] meson: use curses for the non wide version
|
||||
|
||||
The curses dependency in meson in special in that it uses a combination
|
||||
of pkg-config, config-tool, and various system lookups to find it.
|
||||
|
||||
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
||||
---
|
||||
meson.build | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -289,7 +289,7 @@ if lib_ncursesw.found()
|
||||
lib_ncurses = disabler()
|
||||
else
|
||||
lib_ncurses = dependency(
|
||||
- 'ncurses',
|
||||
+ 'curses',
|
||||
disabler : true,
|
||||
required : get_option('ncurses'))
|
||||
headers += ['ncurses.h',
|
@ -0,0 +1,23 @@
|
||||
From 946c0b9c6f6481ed9370b8bd0f54a622a0c4a574 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Valgur <martin.valgur@gmail.com>
|
||||
Date: Tue, 15 Apr 2025 16:19:21 +0300
|
||||
Subject: [PATCH] meson: fix a bug in posixipc_libs configuration
|
||||
|
||||
Should append instead of assigning. Otherwise fails with
|
||||
|
||||
meson.build:1482:22: ERROR: Object <[ExternalLibraryHolder] holds [ExternalLibrary]: <ExternalLibrary rt: True>> of type ExternalLibrary does not support the `+` operator.
|
||||
---
|
||||
meson.build | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -1473,7 +1473,7 @@ has_seminfo_type = cc.has_type('struct s
|
||||
|
||||
posixipc_libs = []
|
||||
if not cc.has_function('shm_open') and conf.get('HAVE_SYS_MMAN_H').to_string() == '1'
|
||||
- posixipc_libs = cc.find_library('rt', required : true)
|
||||
+ posixipc_libs += cc.find_library('rt', required : true)
|
||||
endif
|
||||
|
||||
if not cc.has_function('sem_close') and conf.get('HAVE_SEMAPHORE_H').to_string() == '1'
|
@ -1,23 +0,0 @@
|
||||
From 15bc69131a1e08019096251ea848104e57d99a12 Mon Sep 17 00:00:00 2001
|
||||
From: Rosen Penev <rosenp@gmail.com>
|
||||
Date: Sun, 27 Jul 2025 11:55:56 -0700
|
||||
Subject: [PATCH] move libpthread to Libs
|
||||
|
||||
OpewWrt uses static host libraries and as such dependant libraries must
|
||||
be moved to public Libs. meson handles this automatically but Autotools
|
||||
does not.
|
||||
|
||||
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
||||
---
|
||||
libuuid/uuid.pc.in | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/libuuid/uuid.pc.in
|
||||
+++ b/libuuid/uuid.pc.in
|
||||
@@ -7,5 +7,4 @@ Name: uuid
|
||||
Description: Universally unique id library
|
||||
Version: @LIBUUID_VERSION@
|
||||
Cflags: -I${includedir}/uuid
|
||||
-Libs.private: @SOCKET_LIBS@ -lpthread
|
||||
-Libs: -L${libdir} -luuid
|
||||
+Libs: -L${libdir} -luuid @SOCKET_LIBS@ -lpthread
|
Reference in New Issue
Block a user