diff --git a/config/Config-devel.in b/config/Config-devel.in index 57031d42f6..a8ea68916f 100644 --- a/config/Config-devel.in +++ b/config/Config-devel.in @@ -63,7 +63,7 @@ menuconfig DEVEL config CCACHE bool "Use ccache" if DEVEL - default y + default n help Compiler cache; see https://ccache.samba.org/ diff --git a/include/meson.mk b/include/meson.mk index 01d0ce0280..9862f0e662 100644 --- a/include/meson.mk +++ b/include/meson.mk @@ -19,7 +19,6 @@ # # Host packages are built in the same fashion, just use these vars instead: # -# HOST_BUILD_DEPENDS:=meson/host # MESON_HOST_ARGS+=-Dfoo -Dbar=baz # MESON_HOST_VARS+=FOO=bar @@ -57,7 +56,7 @@ MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))" endif define Meson - $(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(MESON_DIR)/meson.py $(1) + $(2) $(STAGING_DIR_HOST)/bin/meson $(1) endef define Meson/CreateNativeFile diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 922e7c544b..e1993444f7 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -157,6 +157,7 @@ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ $(eval $(call CleanupPython2)) $(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \ + python3.10 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \ python3.8 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \ @@ -164,6 +165,7 @@ $(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \ python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?')) $(eval $(call SetupHostCommand,python3,Please install Python >= 3.6, \ + python3.10 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \ python3.8 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \ @@ -184,7 +186,9 @@ $(eval $(call SetupHostCommand,rsync,Please install 'rsync', \ rsync --version <%:Uptime%>- <%:Load Average%>- <%:CPU usage (%)%>- - <%:Source Code%> - Project ImmortalWrt / ImmortalWrt Core - diff --git a/package/emortal/autocore/files/x86/index.htm b/package/emortal/autocore/files/x86/index.htm index 6506f87bf3..7e0edfb27a 100644 --- a/package/emortal/autocore/files/x86/index.htm +++ b/package/emortal/autocore/files/x86/index.htm @@ -724,9 +724,6 @@ <%:Uptime%>- <%:Load Average%>- <%:CPU usage (%)%>- - <%:Source Code%> - Project ImmortalWrt / ImmortalWrt Core - diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 926fc67386..fdcc089025 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -182,22 +182,6 @@ endef $(eval $(call KernelPackage,eeprom-at25)) -define KernelPackage/gpio-dev - SUBMENU:=$(OTHER_MENU) - TITLE:=Generic GPIO char device support - DEPENDS:=@GPIO_SUPPORT - KCONFIG:=CONFIG_GPIO_DEVICE - FILES:=$(LINUX_DIR)/drivers/char/gpio_dev.ko - AUTOLOAD:=$(call AutoLoad,40,gpio_dev) -endef - -define KernelPackage/gpio-dev/description - Kernel module to allows control of GPIO pins using a character device. -endef - -$(eval $(call KernelPackage,gpio-dev)) - - define KernelPackage/gpio-f7188x SUBMENU:=$(OTHER_MENU) TITLE:=Fintek F718xx/F818xx GPIO Support diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index ef0499824a..be28bc5b2c 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=r8125 -PKG_VERSION:=9.005.06 -PKG_RELEASE:=1 +PKG_VERSION:=9.006.04 +PKG_RELEASE:=$(AUTORELEASE) PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/package/kernel/r8125/src/Makefile b/package/kernel/r8125/src/Makefile index 3c57e3b0bd..514c0acdda 100644 --- a/package/kernel/r8125/src/Makefile +++ b/package/kernel/r8125/src/Makefile @@ -47,6 +47,8 @@ ENABLE_PTP_MASTER_MODE = n ENABLE_RSS_SUPPORT = y ENABLE_LIB_SUPPORT = n ENABLE_USE_FIRMWARE_FILE = n +DISABLE_PM_SUPPORT = n +DISABLE_MULTI_MSIX_VECTOR = n ifneq ($(KERNELRELEASE),) obj-m := r8125.o @@ -111,6 +113,12 @@ ifneq ($(KERNELRELEASE),) r8125-objs += r8125_firmware.o EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE endif + ifeq ($(DISABLE_PM_SUPPORT), y) + EXTRA_CFLAGS += -DDISABLE_PM_SUPPORT + endif + ifeq ($(DISABLE_MULTI_MSIX_VECTOR), y) + EXTRA_CFLAGS += -DDISABLE_MULTI_MSIX_VECTOR + endif else BASEDIR := /lib/modules/$(shell uname -r) KERNELDIR ?= $(BASEDIR)/build diff --git a/package/kernel/r8125/src/r8125.h b/package/kernel/r8125/src/r8125.h index d05d6883a4..6dd541d4ab 100644 --- a/package/kernel/r8125/src/r8125.h +++ b/package/kernel/r8125/src/r8125.h @@ -363,7 +363,7 @@ do { \ #define RSS_SUFFIX "" #endif -#define RTL8125_VERSION "9.005.06" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX +#define RTL8125_VERSION "9.006.04" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX #define MODULENAME "r8125" #define PFX MODULENAME ": " @@ -469,7 +469,7 @@ This is free software, and you are welcome to redistribute it under certain cond #define OCP_STD_PHY_BASE 0xa400 #ifdef ENABLE_LIB_SUPPORT -#define R8125_MULTI_RX_Q(tp) 1 +#define R8125_MULTI_RX_Q(tp) 0 #else #define R8125_MULTI_RX_Q(tp) (tp->num_rx_rings > 1) #endif @@ -542,6 +542,8 @@ This is free software, and you are welcome to redistribute it under certain cond #define RTK_ADVERTISE_2500FULL 0x80 #define RTK_LPA_ADVERTISE_2500FULL 0x20 +#define RTK_LPA_ADVERTISE_5000FULL 0x40 +#define RTK_LPA_ADVERTISE_10000FULL 0x800 /* Tx NO CLOSE */ #define MAX_TX_NO_CLOSE_DESC_PTR_V2 0x10000 @@ -1201,16 +1203,24 @@ enum RTL8125_registers { TIMER_INT3_8125 = 0x00F4, INT_MITI_V2_0_RX = 0x0A00, INT_MITI_V2_0_TX = 0x0A02, + INT_MITI_V2_1_RX = 0x0A08, INT_MITI_V2_1_TX = 0x0A0A, IMR_V2_CLEAR_REG_8125 = 0x0D00, ISR_V2_8125 = 0x0D04, IMR_V2_SET_REG_8125 = 0x0D0C, + TDU_STA_8125 = 0x0D08, + RDU_STA_8125 = 0x0D0A, + TX_NEW_CTRL = 0x203E, TNPDS_Q1_LOW_8125 = 0x2100, + PLA_TXQ0_IDLE_CREDIT = 0x2500, + PLA_TXQ1_IDLE_CREDIT = 0x2504, SW_TAIL_PTR0_8125 = 0x2800, HW_CLO_PTR0_8125 = 0x2802, RDSAR_Q1_LOW_8125 = 0x4000, RSS_CTRL_8125 = 0x4500, Q_NUM_CTRL_8125 = 0x4800, + RSS_KEY_8125 = 0x4600, + RSS_INDIRECTION_TBL_8125_V2 = 0x4700, EEE_TXIDLE_TIMER_8125 = 0x6048, PTP_CTRL_8125 = 0x6800, PTP_STATUS_8125 = 0x6802, @@ -1720,6 +1730,14 @@ struct pci_resource { u32 pci_sn_h; }; +enum r8125_flag { + R8125_FLAG_DOWN = 0, + R8125_FLAG_TASK_RESET_PENDING, + R8125_FLAG_TASK_ESD_CHECK_PENDING, + R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, + R8125_FLAG_MAX +}; + struct rtl8125_tx_ring { void* priv; u32 index; @@ -1768,6 +1786,210 @@ struct r8125_irq { char name[IFNAMSIZ + 10]; }; +#pragma pack(1) +struct rtl8125_regs { + //00 + u8 mac_id[6]; + u16 reg_06; + u8 mar[8]; + //10 + u64 dtccr; + u16 ledsel0; + u16 legreg; + u32 tctr3; + //20 + u32 txq0_dsc_st_addr_0; + u32 txq0_dsc_st_addr_2; + u64 reg_28; + //30 + u16 rit; + u16 ritc; + u16 reg_34; + u8 reg_36; + u8 command; + u32 imr0; + u32 isr0; + //40 + u32 tcr; + u32 rcr; + u32 tctr0; + u32 tctr1; + //50 + u8 cr93c46; + u8 config0; + u8 config1; + u8 config2; + u8 config3; + u8 config4; + u8 config5; + u8 tdfnr; + u32 timer_int0; + u32 timer_int1; + //60 + u32 gphy_mdcmdio; + u32 csidr; + u32 csiar; + u16 phy_status; + u8 config6; + u8 pmch; + //70 + u32 eridr; + u32 eriar; + u16 config7; + u16 reg_7a; + u32 ephy_rxerr_cnt; + //80 + u32 ephy_mdcmdio; + u16 ledsel2; + u16 ledsel1; + u32 tctr2; + u32 timer_int2; + //90 + u8 tppoll0; + u8 reg_91; + u16 reg_92; + u16 led_feature; + u16 ledsel3; + u16 eee_led_config; + u16 reg_9a; + u32 reg_9c; + //a0 + u32 reg_a0; + u32 reg_a4; + u32 reg_a8; + u32 reg_ac; + //b0 + u32 patch_dbg; + u32 reg_b4; + u32 gphy_ocp; + u32 reg_bc; + //c0 + u32 reg_c0; + u32 reg_c4; + u32 reg_c8; + u16 otp_cmd; + u16 otp_pg_config; + //d0 + u16 phy_pwr; + u8 twsi_ctrl; + u8 oob_ctrl; + u16 mac_dbgo; + u16 mac_dbg; + u16 reg_d8; + u16 rms; + u32 efuse_data; + //e0 + u16 cplus_cmd; + u16 reg_e2; + u32 rxq0_dsc_st_addr_0; + u32 rxq0_dsc_st_addr_2; + u16 reg_ec; + u16 tx10midle_cnt; + //f0 + u16 misc0; + u16 misc1; + u32 timer_int3; + u32 cmac_ib; + u16 reg_fc; + u16 sw_rst; +}; +#pragma pack() + +struct rtl8125_regs_save { + union { + u8 mac_io[R8125_MAC_REGS_SIZE]; + + struct rtl8125_regs mac_reg; + }; + u16 pcie_phy[R8125_EPHY_REGS_SIZE/2]; + u16 eth_phy[R8125_PHY_REGS_SIZE/2]; + u32 eri_reg[R8125_ERI_REGS_SIZE/4]; + u32 pci_reg[R8125_PCI_REGS_SIZE/4]; + u16 sw_tail_ptr_reg[R8125_MAX_TX_QUEUES]; + u16 hw_clo_ptr_reg[R8125_MAX_TX_QUEUES]; + + //ktime_t begin_ktime; + //ktime_t end_ktime; + //u64 duration_ns; + + u16 sw0_tail_ptr; + u16 next_hwq0_clo_ptr; + u16 sw1_tail_ptr; + u16 next_hwq1_clo_ptr; + + u16 int_miti_rxq0; + u16 int_miti_txq0; + u16 int_miti_rxq1; + u16 int_miti_txq1; + u8 int_config; + u32 imr_new; + u32 isr_new; + + u8 tdu_status; + u16 rdu_status; + + u16 tc_mode; + + u32 txq1_dsc_st_addr_0; + u32 txq1_dsc_st_addr_2; + + u32 pla_tx_q0_idle_credit; + u32 pla_tx_q1_idle_credit; + + u32 rxq1_dsc_st_addr_0; + u32 rxq1_dsc_st_addr_2; + + u32 rss_ctrl; + u8 rss_key[RTL8125_RSS_KEY_SIZE]; + u8 rss_i_table[RTL8125_MAX_INDIRECTION_TABLE_ENTRIES]; + u16 rss_queue_num_sel_r; +}; + +struct rtl8125_counters { + /* legacy */ + u64 tx_packets; + u64 rx_packets; + u64 tx_errors; + u32 rx_errors; + u16 rx_missed; + u16 align_errors; + u32 tx_one_collision; + u32 tx_multi_collision; + u64 rx_unicast; + u64 rx_broadcast; + u32 rx_multicast; + u16 tx_aborted; + u16 tx_underrun; + + /* extended */ + u64 tx_octets; + u64 rx_octets; + u64 rx_multicast64; + u64 tx_unicast64; + u64 tx_broadcast64; + u64 tx_multicast64; + u32 tx_pause_on; + u32 tx_pause_off; + u32 tx_pause_all; + u32 tx_deferred; + u32 tx_late_collision; + u32 tx_all_collision; + u32 tx_aborted32; + u32 align_errors32; + u32 rx_frame_too_long; + u32 rx_runt; + u32 rx_pause_on; + u32 rx_pause_off; + u32 rx_pause_all; + u32 rx_unknown_opcode; + u32 rx_mac_error; + u32 tx_underrun32; + u32 rx_mac_missed; + u32 rx_tcam_dropped; + u32 tdu; + u32 rdu; +}; + /* Flow Control Settings */ enum rtl8125_fc_mode { rtl8125_fc_none = 0, @@ -1788,7 +2010,6 @@ struct rtl8125_private { unsigned int min_irq_nvecs; //struct msix_entry msix_entries[R8125_MAX_MSIX_VEC]; struct net_device_stats stats; /* statistics of net device */ - spinlock_t lock; /* spin lock flag */ u32 msg_enable; u32 tx_tcp_csum_cmd; u32 tx_udp_csum_cmd; @@ -1819,8 +2040,8 @@ struct rtl8125_private { struct rtl8125_ring lib_tx_ring[R8125_MAX_TX_QUEUES]; struct rtl8125_ring lib_rx_ring[R8125_MAX_RX_QUEUES]; #endif - struct timer_list esd_timer; - struct timer_list link_timer; + //struct timer_list esd_timer; + //struct timer_list link_timer; struct pci_resource pci_cfg_space; unsigned int esd_flag; unsigned int pci_cfg_is_read; @@ -1863,10 +2084,15 @@ struct rtl8125_private { unsigned int (*phy_reset_pending)(struct net_device *); unsigned int (*link_ok)(struct net_device *); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - struct work_struct task; + struct work_struct reset_task; + struct work_struct esd_task; + struct work_struct linkchg_task; #else - struct delayed_work task; + struct delayed_work reset_task; + struct delayed_work esd_task; + struct delayed_work linkchg_task; #endif + DECLARE_BITMAP(task_flags, R8125_FLAG_MAX); unsigned features; u8 org_pci_offset_99; @@ -1921,6 +2147,11 @@ struct rtl8125_private { u8 random_mac; + u16 phy_reg_aner; + u16 phy_reg_anlpar; + u16 phy_reg_gbsr; + u16 phy_reg_status_2500; + u32 HwPcieSNOffset; u8 HwSuppTxNoCloseVer; @@ -1931,6 +2162,8 @@ struct rtl8125_private { u8 HwSuppIntMitiVer; + u8 HwSuppExtendTallyCounterVer; + u8 check_keep_link_speed; u8 resume_not_chg_speed; @@ -2063,9 +2296,7 @@ struct rtl8125_private { #ifdef ENABLE_RSS_SUPPORT u32 rss_flags; /* Receive Side Scaling settings */ -#define RTL8125_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ u8 rss_key[RTL8125_RSS_KEY_SIZE]; -#define RTL8125_MAX_INDIRECTION_TABLE_ENTRIES 128 u8 rss_indir_tbl[RTL8125_MAX_INDIRECTION_TABLE_ENTRIES]; u32 rss_options; #endif @@ -2248,7 +2479,6 @@ void rtl8125_hw_config(struct net_device *dev); void rtl8125_hw_set_timer_int_8125(struct rtl8125_private *tp, u32 message_id, u8 timer_intmiti_val); void rtl8125_set_rx_q_num(struct rtl8125_private *tp, unsigned int num_rx_queues); void rtl8125_set_tx_q_num(struct rtl8125_private *tp, unsigned int num_tx_queues); -int rtl8125_set_real_num_queue(struct rtl8125_private *tp); void rtl8125_hw_start(struct net_device *dev); void rtl8125_hw_reset(struct net_device *dev); void rtl8125_tx_clear(struct rtl8125_private *tp); @@ -2256,6 +2486,7 @@ void rtl8125_rx_clear(struct rtl8125_private *tp); int rtl8125_init_ring(struct net_device *dev); void rtl8125_hw_set_rx_packet_filter(struct net_device *dev); void rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp); +int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr); #ifndef ENABLE_LIB_SUPPORT static inline void rtl8125_lib_reset_prepare(struct rtl8125_private *tp) { } diff --git a/package/kernel/r8125/src/r8125_n.c b/package/kernel/r8125/src/r8125_n.c index e0f3c4c870..fd96e8f8e4 100644 --- a/package/kernel/r8125/src/r8125_n.c +++ b/package/kernel/r8125/src/r8125_n.c @@ -223,6 +223,11 @@ static int enable_ptp_master_mode = 1; #else static int enable_ptp_master_mode = 0; #endif +#ifdef DISABLE_PM_SUPPORT +static int disable_pm_support = 1; +#else +static int disable_pm_support = 0; +#endif MODULE_AUTHOR("Realtek and the Linux r8125 crew "); MODULE_DESCRIPTION("Realtek RTL8125 2.5Gigabit Ethernet driver"); @@ -272,6 +277,9 @@ MODULE_PARM_DESC(tx_no_close_enable, "Enable TX No Close."); module_param(enable_ptp_master_mode, int, 0); MODULE_PARM_DESC(enable_ptp_master_mode, "Enable PTP Master Mode."); +module_param(disable_pm_support, int, 0); +MODULE_PARM_DESC(disable_pm_support, "Disable PM support."); + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) module_param_named(debug, debug.msg_enable, int, 0); MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); @@ -285,11 +293,13 @@ MODULE_FIRMWARE(FIRMWARE_8125B_2); MODULE_VERSION(RTL8125_VERSION); +/* #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) static void rtl8125_esd_timer(unsigned long __opaque); #else static void rtl8125_esd_timer(struct timer_list *t); #endif +*/ /* #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) static void rtl8125_link_timer(unsigned long __opaque); @@ -342,9 +352,18 @@ static int rtl8125_poll(napi_ptr napi, napi_budget budget); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) static void rtl8125_reset_task(void *_data); +static void rtl8125_esd_task(void *_data); +static void rtl8125_linkchg_task(void *_data); #else static void rtl8125_reset_task(struct work_struct *work); +static void rtl8125_esd_task(struct work_struct *work); +static void rtl8125_linkchg_task(struct work_struct *work); #endif +static void rtl8125_schedule_reset_work(struct rtl8125_private *tp); +static void rtl8125_schedule_esd_work(struct rtl8125_private *tp); +static void rtl8125_schedule_linkchg_work(struct rtl8125_private *tp); +static void rtl8125_init_all_schedule_work(struct rtl8125_private *tp); +static void rtl8125_cancel_all_schedule_work(struct rtl8125_private *tp); static inline struct device *tp_to_dev(struct rtl8125_private *tp) { @@ -620,22 +639,6 @@ static inline struct mii_ioctl_data *if_mii(struct ifreq *rq) } #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) -struct rtl8125_counters { - u64 tx_packets; - u64 rx_packets; - u64 tx_errors; - u32 rx_errors; - u16 rx_missed; - u16 align_errors; - u32 tx_one_collision; - u32 tx_multi_collision; - u64 rx_unicast; - u64 rx_broadcast; - u32 rx_multicast; - u16 tx_aborted; - u16 tx_underun; -}; - static u32 rtl8125_read_thermal_sensor(struct rtl8125_private *tp) { u16 ts_digout; @@ -654,6 +657,32 @@ static u32 rtl8125_read_thermal_sensor(struct rtl8125_private *tp) return ts_digout; } +int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr) +{ + u32 cmd; + u32 WaitCnt; + int retval = -1; + + RTL_W32(tp, CounterAddrHigh, (u64)paddr >> 32); + cmd = (u64)paddr & DMA_BIT_MASK(32); + RTL_W32(tp, CounterAddrLow, cmd); + RTL_W32(tp, CounterAddrLow, cmd | CounterDump); + + WaitCnt = 0; + while (RTL_R32(tp, CounterAddrLow) & CounterDump) { + udelay(10); + + WaitCnt++; + if (WaitCnt > 20) + break; + } + + if (WaitCnt <= 20) + retval = 0; + + return retval; +} + #ifdef ENABLE_R8125_PROCFS /**************************************************************************** * -----------------------------PROCFS STUFF------------------------- @@ -668,11 +697,11 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) { struct net_device *dev = m->private; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; seq_puts(m, "\nDump Driver Variable\n"); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + seq_puts(m, "Variable\tValue\n----------\t-----\n"); seq_printf(m, "MODULENAME\t%s\n", MODULENAME); seq_printf(m, "driver version\t%s\n", RTL8125_VERSION); @@ -789,7 +818,8 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) seq_printf(m, "perm_addr\t%pM\n", dev->perm_addr); #endif seq_printf(m, "dev_addr\t%pM\n", dev->dev_addr); - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); seq_putc(m, '\n'); return 0; @@ -801,52 +831,67 @@ static int proc_get_tally_counter(struct seq_file *m, void *v) struct rtl8125_private *tp = netdev_priv(dev); struct rtl8125_counters *counters; dma_addr_t paddr; - u32 cmd; - u32 WaitCnt; - unsigned long flags; seq_puts(m, "\nDump Tally Counter\n"); - //ASSERT_RTNL(); + rtnl_lock(); counters = tp->tally_vaddr; paddr = tp->tally_paddr; if (!counters) { seq_puts(m, "\nDump Tally Counter Fail\n"); - return 0; + goto out_unlock; } - spin_lock_irqsave(&tp->lock, flags); - RTL_W32(tp, CounterAddrHigh, (u64)paddr >> 32); - cmd = (u64)paddr & DMA_BIT_MASK(32); - RTL_W32(tp, CounterAddrLow, cmd); - RTL_W32(tp, CounterAddrLow, cmd | CounterDump); - - WaitCnt = 0; - while (RTL_R32(tp, CounterAddrLow) & CounterDump) { - udelay(10); - - WaitCnt++; - if (WaitCnt > 20) - break; - } - spin_unlock_irqrestore(&tp->lock, flags); + rtl8125_dump_tally_counter(tp, paddr); seq_puts(m, "Statistics\tValue\n----------\t-----\n"); seq_printf(m, "tx_packets\t%lld\n", le64_to_cpu(counters->tx_packets)); seq_printf(m, "rx_packets\t%lld\n", le64_to_cpu(counters->rx_packets)); seq_printf(m, "tx_errors\t%lld\n", le64_to_cpu(counters->tx_errors)); - seq_printf(m, "rx_missed\t%lld\n", le64_to_cpu(counters->rx_missed)); - seq_printf(m, "align_errors\t%lld\n", le64_to_cpu(counters->align_errors)); - seq_printf(m, "tx_one_collision\t%lld\n", le64_to_cpu(counters->tx_one_collision)); - seq_printf(m, "tx_multi_collision\t%lld\n", le64_to_cpu(counters->tx_multi_collision)); + seq_printf(m, "rx_errors\t%d\n", le32_to_cpu(counters->rx_errors)); + seq_printf(m, "rx_missed\t%d\n", le16_to_cpu(counters->rx_missed)); + seq_printf(m, "align_errors\t%d\n", le16_to_cpu(counters->align_errors)); + seq_printf(m, "tx_one_collision\t%d\n", le32_to_cpu(counters->tx_one_collision)); + seq_printf(m, "tx_multi_collision\t%d\n", le32_to_cpu(counters->tx_multi_collision)); seq_printf(m, "rx_unicast\t%lld\n", le64_to_cpu(counters->rx_unicast)); seq_printf(m, "rx_broadcast\t%lld\n", le64_to_cpu(counters->rx_broadcast)); - seq_printf(m, "rx_multicast\t%lld\n", le64_to_cpu(counters->rx_multicast)); - seq_printf(m, "tx_aborted\t%lld\n", le64_to_cpu(counters->tx_aborted)); - seq_printf(m, "tx_underun\t%lld\n", le64_to_cpu(counters->tx_underun)); + seq_printf(m, "rx_multicast\t%d\n", le32_to_cpu(counters->rx_multicast)); + seq_printf(m, "tx_aborted\t%d\n", le16_to_cpu(counters->tx_aborted)); + seq_printf(m, "tx_underrun\t%d\n", le16_to_cpu(counters->tx_underrun)); + + seq_printf(m, "tx_octets\t%lld\n", le64_to_cpu(counters->tx_octets)); + seq_printf(m, "rx_octets\t%lld\n", le64_to_cpu(counters->rx_octets)); + seq_printf(m, "rx_multicast64\t%lld\n", le64_to_cpu(counters->rx_multicast64)); + seq_printf(m, "tx_unicast64\t%lld\n", le64_to_cpu(counters->tx_unicast64)); + seq_printf(m, "tx_broadcast64\t%lld\n", le64_to_cpu(counters->tx_broadcast64)); + seq_printf(m, "tx_multicast64\t%lld\n", le64_to_cpu(counters->tx_multicast64)); + seq_printf(m, "tx_pause_on\t%d\n", le32_to_cpu(counters->tx_pause_on)); + seq_printf(m, "tx_pause_off\t%d\n", le32_to_cpu(counters->tx_pause_off)); + seq_printf(m, "tx_pause_all\t%d\n", le32_to_cpu(counters->tx_pause_all)); + seq_printf(m, "tx_deferred\t%d\n", le32_to_cpu(counters->tx_deferred)); + seq_printf(m, "tx_late_collision\t%d\n", le32_to_cpu(counters->tx_late_collision)); + seq_printf(m, "tx_all_collision\t%d\n", le32_to_cpu(counters->tx_all_collision)); + seq_printf(m, "tx_aborted32\t%d\n", le32_to_cpu(counters->tx_aborted32)); + seq_printf(m, "align_errors32\t%d\n", le32_to_cpu(counters->align_errors32)); + seq_printf(m, "rx_frame_too_long\t%d\n", le32_to_cpu(counters->rx_frame_too_long)); + seq_printf(m, "rx_runt\t%d\n", le32_to_cpu(counters->rx_runt)); + seq_printf(m, "rx_pause_on\t%d\n", le32_to_cpu(counters->rx_pause_on)); + seq_printf(m, "rx_pause_off\t%d\n", le32_to_cpu(counters->rx_pause_off)); + seq_printf(m, "rx_pause_all\t%d\n", le32_to_cpu(counters->rx_pause_all)); + seq_printf(m, "rx_unknown_opcode\t%d\n", le32_to_cpu(counters->rx_unknown_opcode)); + seq_printf(m, "rx_mac_error\t%d\n", le32_to_cpu(counters->rx_mac_error)); + seq_printf(m, "tx_underrun32\t%d\n", le32_to_cpu(counters->tx_underrun32)); + seq_printf(m, "rx_mac_missed\t%d\n", le32_to_cpu(counters->rx_mac_missed)); + seq_printf(m, "rx_tcam_dropped\t%d\n", le32_to_cpu(counters->rx_tcam_dropped)); + seq_printf(m, "tdu\t%d\n", le32_to_cpu(counters->tdu)); + seq_printf(m, "rdu\t%d\n", le32_to_cpu(counters->rdu)); seq_putc(m, '\n'); + +out_unlock: + rtnl_unlock(); + return 0; } @@ -857,12 +902,12 @@ static int proc_get_registers(struct seq_file *m, void *v) u8 byte_rd; struct rtl8125_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->mmio_addr; - unsigned long flags; seq_puts(m, "\nDump MAC Registers\n"); seq_puts(m, "Offset\tValue\n------\t-----\n"); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + for (n = 0; n < max;) { seq_printf(m, "\n0x%02x:\t", n); @@ -871,7 +916,8 @@ static int proc_get_registers(struct seq_file *m, void *v) seq_printf(m, "%02x ", byte_rd); } } - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); seq_putc(m, '\n'); return 0; @@ -883,12 +929,12 @@ static int proc_get_pcie_phy(struct seq_file *m, void *v) int i, n, max = R8125_EPHY_REGS_SIZE/2; u16 word_rd; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; seq_puts(m, "\nDump PCIE PHY\n"); seq_puts(m, "\nOffset\tValue\n------\t-----\n "); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + for (n = 0; n < max;) { seq_printf(m, "\n0x%02x:\t", n); @@ -897,7 +943,8 @@ static int proc_get_pcie_phy(struct seq_file *m, void *v) seq_printf(m, "%04x ", word_rd); } } - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); seq_putc(m, '\n'); return 0; @@ -909,12 +956,12 @@ static int proc_get_eth_phy(struct seq_file *m, void *v) int i, n, max = R8125_PHY_REGS_SIZE/2; u16 word_rd; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; seq_puts(m, "\nDump Ethernet PHY\n"); seq_puts(m, "\nOffset\tValue\n------\t-----\n "); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + seq_puts(m, "\n####################page 0##################\n "); rtl8125_mdio_write(tp, 0x1f, 0x0000); for (n = 0; n < max;) { @@ -925,7 +972,8 @@ static int proc_get_eth_phy(struct seq_file *m, void *v) seq_printf(m, "%04x ", word_rd); } } - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); seq_putc(m, '\n'); return 0; @@ -937,12 +985,12 @@ static int proc_get_extended_registers(struct seq_file *m, void *v) int i, n, max = R8125_ERI_REGS_SIZE; u32 dword_rd; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; seq_puts(m, "\nDump Extended Registers\n"); seq_puts(m, "\nOffset\tValue\n------\t-----\n "); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + for (n = 0; n < max;) { seq_printf(m, "\n0x%02x:\t", n); @@ -951,7 +999,8 @@ static int proc_get_extended_registers(struct seq_file *m, void *v) seq_printf(m, "%08x ", dword_rd); } } - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); seq_putc(m, '\n'); return 0; @@ -963,12 +1012,12 @@ static int proc_get_pci_registers(struct seq_file *m, void *v) int i, n, max = R8125_PCI_REGS_SIZE; u32 dword_rd; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; seq_puts(m, "\nDump PCI Registers\n"); seq_puts(m, "\nOffset\tValue\n------\t-----\n "); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + for (n = 0; n < max;) { seq_printf(m, "\n0x%03x:\t", n); @@ -985,7 +1034,7 @@ static int proc_get_pci_registers(struct seq_file *m, void *v) pci_read_config_dword(tp->pci_dev, n, &dword_rd); seq_printf(m, "\n0x%03x:\t%08x ", n, dword_rd); - spin_unlock_irqrestore(&tp->lock, flags); + rtnl_unlock(); seq_putc(m, '\n'); return 0; @@ -996,7 +1045,6 @@ static int proc_get_temperature(struct seq_file *m, void *v) struct net_device *dev = m->private; struct rtl8125_private *tp = netdev_priv(dev); u16 ts_digout, tj, fah; - unsigned long flags; switch (tp->mcfg) { case CFG_METHOD_4: @@ -1008,9 +1056,9 @@ static int proc_get_temperature(struct seq_file *m, void *v) break; } - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); ts_digout = rtl8125_read_thermal_sensor(tp); - spin_unlock_irqrestore(&tp->lock, flags); + rtnl_unlock(); tj = ts_digout / 2; if (ts_digout <= 512) { @@ -1036,13 +1084,13 @@ static int proc_get_driver_variable(char *page, char **start, { struct net_device *dev = data; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; int len = 0; len += snprintf(page + len, count - len, "\nDump Driver Driver\n"); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + len += snprintf(page + len, count - len, "Variable\tValue\n----------\t-----\n"); @@ -1278,7 +1326,8 @@ static int proc_get_driver_variable(char *page, char **start, #endif dev->dev_addr ); - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); len += snprintf(page + len, count - len, "\n"); @@ -1294,39 +1343,22 @@ static int proc_get_tally_counter(char *page, char **start, struct rtl8125_private *tp = netdev_priv(dev); struct rtl8125_counters *counters; dma_addr_t paddr; - u32 cmd; - u32 WaitCnt; - unsigned long flags; int len = 0; len += snprintf(page + len, count - len, "\nDump Tally Counter\n"); - //ASSERT_RTNL(); + rtnl_lock(); counters = tp->tally_vaddr; paddr = tp->tally_paddr; if (!counters) { len += snprintf(page + len, count - len, "\nDump Tally Counter Fail\n"); - goto out; + goto out_unlock; } - spin_lock_irqsave(&tp->lock, flags); - RTL_W32(tp, CounterAddrHigh, (u64)paddr >> 32); - cmd = (u64)paddr & DMA_BIT_MASK(32); - RTL_W32(tp, CounterAddrLow, cmd); - RTL_W32(tp, CounterAddrLow, cmd | CounterDump); - - WaitCnt = 0; - while (RTL_R32(tp, CounterAddrLow) & CounterDump) { - udelay(10); - - WaitCnt++; - if (WaitCnt > 20) - break; - } - spin_unlock_irqrestore(&tp->lock, flags); + rtl8125_dump_tally_counter(tp, paddr); len += snprintf(page + len, count - len, "Statistics\tValue\n----------\t-----\n"); @@ -1335,31 +1367,89 @@ static int proc_get_tally_counter(char *page, char **start, "tx_packets\t%lld\n" "rx_packets\t%lld\n" "tx_errors\t%lld\n" - "rx_missed\t%lld\n" - "align_errors\t%lld\n" - "tx_one_collision\t%lld\n" - "tx_multi_collision\t%lld\n" + "rx_errors\t%d\n" + "rx_missed\t%d\n" + "align_errors\t%d\n" + "tx_one_collision\t%d\n" + "tx_multi_collision\t%d\n" "rx_unicast\t%lld\n" "rx_broadcast\t%lld\n" - "rx_multicast\t%lld\n" - "tx_aborted\t%lld\n" - "tx_underun\t%lld\n", + "rx_multicast\t%d\n" + "tx_aborted\t%d\n" + "tx_underrun\t%d\n", + + "tx_octets\t%lld\n", + "rx_octets\t%lld\n", + "rx_multicast64\t%lld\n", + "tx_unicast64\t%lld\n", + "tx_broadcast64\t%lld\n", + "tx_multicast64\t%lld\n", + "tx_pause_on\t%d\n", + "tx_pause_off\t%d\n", + "tx_pause_all\t%d\n", + "tx_deferred\t%d\n", + "tx_late_collision\t%d\n", + "tx_all_collision\t%d\n", + "tx_aborted32\t%d\n", + "align_errors32\t%d\n", + "rx_frame_too_long\t%d\n", + "rx_runt\t%d\n", + "rx_pause_on\t%d\n", + "rx_pause_off\t%d\n", + "rx_pause_all\t%d\n", + "rx_unknown_opcode\t%d\n", + "rx_mac_error\t%d\n", + "tx_underrun32\t%d\n", + "rx_mac_missed\t%d\n", + "rx_tcam_dropped\t%d\n", + "tdu\t%d\n", + "rdu\t%d\n", le64_to_cpu(counters->tx_packets), le64_to_cpu(counters->rx_packets), le64_to_cpu(counters->tx_errors), - le64_to_cpu(counters->rx_missed), - le64_to_cpu(counters->align_errors), - le64_to_cpu(counters->tx_one_collision), - le64_to_cpu(counters->tx_multi_collision), + le32_to_cpu(counters->rx_errors), + le16_to_cpu(counters->rx_missed), + le16_to_cpu(counters->align_errors), + le32_to_cpu(counters->tx_one_collision), + le32_to_cpu(counters->tx_multi_collision), le64_to_cpu(counters->rx_unicast), le64_to_cpu(counters->rx_broadcast), - le64_to_cpu(counters->rx_multicast), - le64_to_cpu(counters->tx_aborted), - le64_to_cpu(counters->tx_underun) + le32_to_cpu(counters->rx_multicast), + le16_to_cpu(counters->tx_aborted), + le16_to_cpu(counters->tx_underrun), + + le64_to_cpu(counters->tx_octets), + le64_to_cpu(counters->rx_octets), + le64_to_cpu(counters->rx_multicast64), + le64_to_cpu(counters->tx_unicast64), + le64_to_cpu(counters->tx_broadcast64), + le64_to_cpu(counters->tx_multicast64), + le32_to_cpu(counters->tx_pause_on), + le32_to_cpu(counters->tx_pause_off), + le32_to_cpu(counters->tx_pause_all), + le32_to_cpu(counters->tx_deferred), + le32_to_cpu(counters->tx_late_collision), + le32_to_cpu(counters->tx_all_collision), + le32_to_cpu(counters->tx_aborted32), + le32_to_cpu(counters->align_errors32), + le32_to_cpu(counters->rx_frame_too_long), + le32_to_cpu(counters->rx_runt), + le32_to_cpu(counters->rx_pause_on), + le32_to_cpu(counters->rx_pause_off), + le32_to_cpu(counters->rx_pause_all), + le32_to_cpu(counters->rx_unknown_opcode), + le32_to_cpu(counters->rx_mac_error), + le32_to_cpu(counters->tx_underrun32), + le32_to_cpu(counters->rx_mac_missed), + le32_to_cpu(counters->rx_tcam_dropped), + le32_to_cpu(counters->tdu), + le32_to_cpu(counters->rdu), ); len += snprintf(page + len, count - len, "\n"); -out: +out_unlock: + rtnl_unlock(); + *eof = 1; return len; } @@ -1373,14 +1463,14 @@ static int proc_get_registers(char *page, char **start, u8 byte_rd; struct rtl8125_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->mmio_addr; - unsigned long flags; int len = 0; len += snprintf(page + len, count - len, "\nDump MAC Registers\n" "Offset\tValue\n------\t-----\n"); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + for (n = 0; n < max;) { len += snprintf(page + len, count - len, "\n0x%02x:\t", @@ -1393,7 +1483,8 @@ static int proc_get_registers(char *page, char **start, byte_rd); } } - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); len += snprintf(page + len, count - len, "\n"); @@ -1409,14 +1500,14 @@ static int proc_get_pcie_phy(char *page, char **start, int i, n, max = R8125_EPHY_REGS_SIZE/2; u16 word_rd; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; int len = 0; len += snprintf(page + len, count - len, "\nDump PCIE PHY\n" "Offset\tValue\n------\t-----\n"); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + for (n = 0; n < max;) { len += snprintf(page + len, count - len, "\n0x%02x:\t", @@ -1429,7 +1520,8 @@ static int proc_get_pcie_phy(char *page, char **start, word_rd); } } - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); len += snprintf(page + len, count - len, "\n"); @@ -1445,14 +1537,14 @@ static int proc_get_eth_phy(char *page, char **start, int i, n, max = R8125_PHY_REGS_SIZE/2; u16 word_rd; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; int len = 0; len += snprintf(page + len, count - len, "\nDump Ethernet PHY\n" "Offset\tValue\n------\t-----\n"); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + len += snprintf(page + len, count - len, "\n####################page 0##################\n"); rtl8125_mdio_write(tp, 0x1f, 0x0000); @@ -1468,7 +1560,8 @@ static int proc_get_eth_phy(char *page, char **start, word_rd); } } - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); len += snprintf(page + len, count - len, "\n"); @@ -1484,14 +1577,14 @@ static int proc_get_extended_registers(char *page, char **start, int i, n, max = R8125_ERI_REGS_SIZE; u32 dword_rd; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; int len = 0; len += snprintf(page + len, count - len, "\nDump Extended Registers\n" "Offset\tValue\n------\t-----\n"); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + for (n = 0; n < max;) { len += snprintf(page + len, count - len, "\n0x%02x:\t", @@ -1504,10 +1597,11 @@ static int proc_get_extended_registers(char *page, char **start, dword_rd); } } - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); len += snprintf(page + len, count - len, "\n"); -out: + *eof = 1; return len; } @@ -1520,14 +1614,14 @@ static int proc_get_pci_registers(char *page, char **start, int i, n, max = R8125_PCI_REGS_SIZE; u32 dword_rd; struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; int len = 0; len += snprintf(page + len, count - len, "\nDump PCI Registers\n" "Offset\tValue\n------\t-----\n"); - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); + for (n = 0; n < max;) { len += snprintf(page + len, count - len, "\n0x%03x:\t", @@ -1553,7 +1647,8 @@ static int proc_get_pci_registers(char *page, char **start, "\n0x%03x:\t%08x ", n, dword_rd); - spin_unlock_irqrestore(&tp->lock, flags); + + rtnl_unlock(); len += snprintf(page + len, count - len, "\n"); @@ -1568,7 +1663,6 @@ static int proc_get_temperature(char *page, char **start, struct net_device *dev = data; struct rtl8125_private *tp = netdev_priv(dev); u16 ts_digout, tj, fah; - unsigned long flags; int len = 0; switch (tp->mcfg) { @@ -1583,9 +1677,9 @@ static int proc_get_temperature(char *page, char **start, break; } - spin_lock_irqsave(&tp->lock, flags); + rtnl_lock(); ts_digout = rtl8125_read_thermal_sensor(tp); - spin_unlock_irqrestore(&tp->lock, flags); + rtnl_unlock(); tj = ts_digout / 2; if (ts_digout <= 512) { @@ -2774,12 +2868,43 @@ rtl8125_is_in_phy_disable_mode(struct net_device *dev) return in_phy_disable_mode; } +static bool +rtl8125_stop_all_request(struct net_device *dev) +{ + struct rtl8125_private *tp = netdev_priv(dev); + int i; + + RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); + + switch (tp->mcfg) { + case CFG_METHOD_2: + case CFG_METHOD_3: + for (i = 0; i < 20; i++) { + udelay(10); + if (!(RTL_R8(tp, ChipCmd) & StopReq)) break; + } + + if (i == 20) + return 0; + break; + } + + return 1; +} + void rtl8125_wait_txrx_fifo_empty(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); int i; + switch (tp->mcfg) { + case CFG_METHOD_4: + case CFG_METHOD_5: + rtl8125_stop_all_request(dev); + break; + } + switch (tp->mcfg) { case CFG_METHOD_2: case CFG_METHOD_3: @@ -2789,7 +2914,6 @@ rtl8125_wait_txrx_fifo_empty(struct net_device *dev) udelay(50); if ((RTL_R8(tp, MCUCmd_reg) & (Txfifo_empty | Rxfifo_empty)) == (Txfifo_empty | Rxfifo_empty)) break; - } break; } @@ -2801,7 +2925,6 @@ rtl8125_wait_txrx_fifo_empty(struct net_device *dev) udelay(50); if ((RTL_R16(tp, IntrMitigate) & (BIT_0 | BIT_1 | BIT_8)) == (BIT_0 | BIT_1 | BIT_8)) break; - } break; } @@ -2838,7 +2961,7 @@ rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp) RTL_W32(tp, IMR_V2_SET_REG_8125, ISRIMR_V2_LINKCHG); break; case 1: - RTL_W32(tp, tp->imr_reg[0], LinkChg); + RTL_W32(tp, tp->imr_reg[0], LinkChg | RTL_R32(tp, tp->imr_reg[0])); break; } @@ -2966,17 +3089,11 @@ rtl8125_nic_reset(struct net_device *dev) rtl8125_enable_rxdvgate(dev); + rtl8125_stop_all_request(dev); + rtl8125_wait_txrx_fifo_empty(dev); - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - default: - mdelay(2); - break; - } + mdelay(2); /* Soft reset the chip. */ RTL_W8(tp, ChipCmd, CmdReset); @@ -3148,7 +3265,7 @@ rtl8125_init_ring_indexes(struct rtl8125_private *tp) { int i; - for (i = 0; i < tp->num_tx_rings; i++) { + for (i = 0; i < tp->HwSuppNumTxQueues; i++) { struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; ring->dirty_tx = ring->cur_tx = 0; ring->NextHwDesCloPtr = 0; @@ -3157,7 +3274,7 @@ rtl8125_init_ring_indexes(struct rtl8125_private *tp) ring->priv = tp; } - for (i = 0; i < tp->num_rx_rings; i++) { + for (i = 0; i < tp->HwSuppNumRxQueues; i++) { struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; ring->dirty_rx = ring->cur_rx = 0; ring->index = i; @@ -3254,26 +3371,6 @@ static int rtl8125_disable_eee_plus(struct rtl8125_private *tp) return ret; } -static void -rtl8125_wakeup_all_tx_queue(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - - for (i=0; inum_tx_rings; i++) - netif_start_subqueue(dev, i); -} - -static void -rtl8125_stop_all_tx_queue(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - - for (i=0; inum_tx_rings; i++) - netif_stop_subqueue(dev, i); -} - static void rtl8125_link_on_patch(struct net_device *dev) { @@ -3300,7 +3397,12 @@ rtl8125_link_on_patch(struct net_device *dev) netif_carrier_on(dev); - rtl8125_wakeup_all_tx_queue(dev); + netif_tx_wake_all_queues(dev); + + tp->phy_reg_aner = rtl8125_mdio_read(tp, MII_EXPANSION); + tp->phy_reg_anlpar = rtl8125_mdio_read(tp, MII_LPA); + tp->phy_reg_gbsr = rtl8125_mdio_read(tp, MII_STAT1000); + tp->phy_reg_status_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D6); } static void @@ -3308,13 +3410,18 @@ rtl8125_link_down_patch(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); + tp->phy_reg_aner = 0; + tp->phy_reg_anlpar = 0; + tp->phy_reg_gbsr = 0; + tp->phy_reg_status_2500 = 0; + if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3 || tp->mcfg == CFG_METHOD_4 || tp->mcfg == CFG_METHOD_5) rtl8125_disable_eee_plus(tp); - rtl8125_stop_all_tx_queue(dev); + netif_tx_stop_all_queues(dev); netif_carrier_off(dev); @@ -3496,9 +3603,9 @@ rtl8125_enable_pci_offset_99(struct rtl8125_private *tp) case CFG_METHOD_5: csi_tmp = rtl8125_mac_ocp_read(tp, 0xE032); csi_tmp &= ~(BIT_0 | BIT_1); - if (!(tp->org_pci_offset_99 & (BIT_5 | BIT_6))) + if (tp->org_pci_offset_99 & (BIT_5 | BIT_6)) csi_tmp |= BIT_1; - if (!(tp->org_pci_offset_99 & BIT_2)) + if (tp->org_pci_offset_99 & BIT_2) csi_tmp |= BIT_0; rtl8125_mac_ocp_write(tp, 0xE032, csi_tmp); break; @@ -3656,6 +3763,26 @@ rtl8125_disable_exit_l1_mask(struct rtl8125_private *tp) ClearMcuAccessRegBit(tp, 0xC0AC, (BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12)); } +static void +rtl8125_enable_extend_tally_couter(struct rtl8125_private *tp) +{ + switch (tp->HwSuppExtendTallyCounterVer) { + case 1: + SetMcuAccessRegBit(tp, 0xEA84, (BIT_1 | BIT_0)); + break; + } +} + +static void +rtl8125_disable_extend_tally_couter(struct rtl8125_private *tp) +{ + switch (tp->HwSuppExtendTallyCounterVer) { + case 1: + ClearMcuAccessRegBit(tp, 0xEA84, (BIT_1 | BIT_0)); + break; + } +} + static void rtl8125_hw_d3_para(struct net_device *dev) { @@ -3701,6 +3828,8 @@ rtl8125_hw_d3_para(struct net_device *dev) rtl8125_disable_ocp_phy_power_saving(dev); rtl8125_disable_rxdvgate(dev); + + rtl8125_disable_extend_tally_couter(tp); } static void @@ -3761,6 +3890,9 @@ rtl8125_get_hw_wol(struct rtl8125_private *tp) u32 csi_tmp; u32 wol_opts = 0; + if (disable_pm_support) + goto out; + options = RTL_R8(tp, Config1); if (!(options & PMEnable)) goto out; @@ -3942,12 +4074,10 @@ rtl8125_set_wol_link_speed(struct net_device *dev) u16 status_2500; u16 aner; - if (!tp->link_ok(dev) || tp->autoneg != AUTONEG_ENABLE) + if (tp->autoneg != AUTONEG_ENABLE) goto exit; rtl8125_mdio_write(tp, 0x1F, 0x0000); - aner = rtl8125_mdio_read(tp, MII_EXPANSION); - if (!(aner & EXPANSION_NWAY)) goto exit; auto_nego = rtl8125_mdio_read(tp, MII_ADVERTISE); auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL @@ -3959,9 +4089,39 @@ rtl8125_set_wol_link_speed(struct net_device *dev) ctrl_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D4); ctrl_2500 &= ~(RTK_ADVERTISE_2500FULL); - anlpar = rtl8125_mdio_read(tp, MII_LPA); - gbsr = rtl8125_mdio_read(tp, MII_STAT1000); - status_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D6); + aner = anlpar = gbsr = status_2500 = 0; + if (tp->link_ok(dev)) { + aner = rtl8125_mdio_read(tp, MII_EXPANSION); + anlpar = rtl8125_mdio_read(tp, MII_LPA); + gbsr = rtl8125_mdio_read(tp, MII_STAT1000); + status_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D6); + } else { + if (netif_running(dev)) { + aner = tp->phy_reg_aner; + anlpar = tp->phy_reg_anlpar; + gbsr = tp->phy_reg_gbsr; + status_2500 = tp->phy_reg_status_2500; + } + } + + if ((aner | anlpar | gbsr | status_2500) == 0) { + int auto_nego_tmp = 0; + adv = tp->advertising; + if ((adv & ADVERTISED_10baseT_Half) && (anlpar & LPA_10HALF)) + auto_nego_tmp |= ADVERTISE_10HALF; + if ((adv & ADVERTISED_10baseT_Full) && (anlpar & LPA_10FULL)) + auto_nego_tmp |= ADVERTISE_10FULL; + if ((adv & ADVERTISED_100baseT_Half) && (anlpar & LPA_100HALF)) + auto_nego_tmp |= ADVERTISE_100HALF; + if ((adv & ADVERTISED_100baseT_Full) && (anlpar & LPA_100FULL)) + auto_nego_tmp |= ADVERTISE_100FULL; + + if (auto_nego_tmp == 0) goto exit; + + auto_nego |= auto_nego_tmp; + goto skip_check_lpa; + } + if (!(aner & EXPANSION_NWAY)) goto exit; adv = tp->advertising; if ((adv & ADVERTISED_10baseT_Half) && (anlpar & LPA_10HALF)) @@ -3981,6 +4141,7 @@ rtl8125_set_wol_link_speed(struct net_device *dev) else goto exit; +skip_check_lpa: if (tp->DASH) auto_nego |= (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10HALF | ADVERTISE_10FULL); @@ -4098,27 +4259,21 @@ rtl8125_get_wol(struct net_device *dev, { struct rtl8125_private *tp = netdev_priv(dev); u8 options; - unsigned long flags; wol->wolopts = 0; - if (tp->mcfg == CFG_METHOD_DEFAULT) { + if (tp->mcfg == CFG_METHOD_DEFAULT || disable_pm_support) { wol->supported = 0; return; } else { wol->supported = WAKE_ANY; } - spin_lock_irqsave(&tp->lock, flags); - options = RTL_R8(tp, Config1); if (!(options & PMEnable)) - goto out_unlock; + return; wol->wolopts = tp->wol_opts; - -out_unlock: - spin_unlock_irqrestore(&tp->lock, flags); } static int @@ -4126,19 +4281,14 @@ rtl8125_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; - if (tp->mcfg == CFG_METHOD_DEFAULT) + if (tp->mcfg == CFG_METHOD_DEFAULT || disable_pm_support) return -EOPNOTSUPP; - spin_lock_irqsave(&tp->lock, flags); - tp->wol_opts = wol->wolopts; tp->wol_enabled = (tp->wol_opts) ? WOL_ENABLED : WOL_DISABLED; - spin_unlock_irqrestore(&tp->lock, flags); - device_set_wakeup_enable(tp_to_dev(tp), wol->wolopts); return 0; @@ -4297,9 +4447,7 @@ rtl8125_set_settings(struct net_device *dev, #endif ) { - struct rtl8125_private *tp = netdev_priv(dev); int ret; - unsigned long flags; u8 autoneg; u32 speed; u8 duplex; @@ -4320,13 +4468,17 @@ rtl8125_set_settings(struct net_device *dev, cmd->link_modes.supported); ethtool_convert_link_mode_to_legacy_u32(&advertising, cmd->link_modes.advertising); + if (test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + cmd->link_modes.supported)) + supported |= ADVERTISED_2500baseX_Full; + if (test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + cmd->link_modes.advertising)) + advertising |= ADVERTISED_2500baseX_Full; #endif if (advertising & ~supported) return -EINVAL; - spin_lock_irqsave(&tp->lock, flags); ret = rtl8125_set_speed(dev, autoneg, speed, duplex, advertising); - spin_unlock_irqrestore(&tp->lock, flags); return ret; } @@ -4337,15 +4489,12 @@ rtl8125_get_tx_csum(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); u32 ret; - unsigned long flags; - spin_lock_irqsave(&tp->lock, flags); #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) ret = ((dev->features & NETIF_F_IP_CSUM) != 0); #else ret = ((dev->features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) != 0); #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - spin_unlock_irqrestore(&tp->lock, flags); return ret; } @@ -4355,11 +4504,8 @@ rtl8125_get_rx_csum(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); u32 ret; - unsigned long flags; - spin_lock_irqsave(&tp->lock, flags); ret = tp->cp_cmd & RxChkSum; - spin_unlock_irqrestore(&tp->lock, flags); return ret; } @@ -4369,13 +4515,10 @@ rtl8125_set_tx_csum(struct net_device *dev, u32 data) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; if (tp->mcfg == CFG_METHOD_DEFAULT) return -EOPNOTSUPP; - spin_lock_irqsave(&tp->lock, flags); - #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) if (data) dev->features |= NETIF_F_IP_CSUM; @@ -4388,8 +4531,6 @@ rtl8125_set_tx_csum(struct net_device *dev, dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - spin_unlock_irqrestore(&tp->lock, flags); - return 0; } @@ -4398,13 +4539,10 @@ rtl8125_set_rx_csum(struct net_device *dev, u32 data) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; if (tp->mcfg == CFG_METHOD_DEFAULT) return -EOPNOTSUPP; - spin_lock_irqsave(&tp->lock, flags); - if (data) tp->cp_cmd |= RxChkSum; else @@ -4412,8 +4550,6 @@ rtl8125_set_rx_csum(struct net_device *dev, RTL_W16(tp, CPlusCmd, tp->cp_cmd); - spin_unlock_irqrestore(&tp->lock, flags); - return 0; } #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) @@ -4476,9 +4612,7 @@ rtl8125_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; - spin_lock_irqsave(&tp->lock, flags); tp->vlgrp = grp; if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3 || @@ -4492,7 +4626,6 @@ rtl8125_vlan_rx_register(struct net_device *dev, RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) & ~(EnableInnerVlan | EnableOuterVlan)) } } - spin_unlock_irqrestore(&tp->lock, flags); } #endif @@ -4503,16 +4636,13 @@ rtl8125_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; - spin_lock_irqsave(&tp->lock, flags); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) if (tp->vlgrp) tp->vlgrp->vlan_devices[vid] = NULL; #else vlan_group_set_device(tp->vlgrp, vid, NULL); #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) - spin_unlock_irqrestore(&tp->lock, flags); } #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) @@ -4566,10 +4696,6 @@ rtl8125_rx_vlan_skb(struct rtl8125_private *tp, static netdev_features_t rtl8125_fix_features(struct net_device *dev, netdev_features_t features) { - struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; - - spin_lock_irqsave(&tp->lock, flags); if (dev->mtu > MSS_MAX) features &= ~NETIF_F_ALL_TSO; if (dev->mtu > ETH_DATA_LEN) { @@ -4579,7 +4705,6 @@ static netdev_features_t rtl8125_fix_features(struct net_device *dev, #ifndef CONFIG_R8125_VLAN features &= ~NETIF_F_ALL_CSUM; #endif - spin_unlock_irqrestore(&tp->lock, flags); return features; } @@ -4591,15 +4716,21 @@ static int rtl8125_hw_set_features(struct net_device *dev, u32 rx_config; rx_config = RTL_R32(tp, RxConfig); - if (features & NETIF_F_RXALL) + if (features & NETIF_F_RXALL) { + tp->rtl8125_rx_config |= (AcceptErr | AcceptRunt); rx_config |= (AcceptErr | AcceptRunt); - else + } else { + tp->rtl8125_rx_config &= ~(AcceptErr | AcceptRunt); rx_config &= ~(AcceptErr | AcceptRunt); + } - if (features & NETIF_F_HW_VLAN_RX) + if (features & NETIF_F_HW_VLAN_RX) { + tp->rtl8125_rx_config |= (EnableInnerVlan | EnableOuterVlan); rx_config |= (EnableInnerVlan | EnableOuterVlan); - else + } else { + tp->rtl8125_rx_config &= ~(EnableInnerVlan | EnableOuterVlan); rx_config &= ~(EnableInnerVlan | EnableOuterVlan); + } RTL_W32(tp, RxConfig, rx_config); @@ -4617,15 +4748,9 @@ static int rtl8125_hw_set_features(struct net_device *dev, static int rtl8125_set_features(struct net_device *dev, netdev_features_t features) { - struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; - features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX; - spin_lock_irqsave(&tp->lock, flags); - if (features ^ dev->features) - rtl8125_hw_set_features(dev, features); - spin_unlock_irqrestore(&tp->lock, flags); + rtl8125_hw_set_features(dev, features); return 0; } @@ -4641,12 +4766,17 @@ static void rtl8125_gset_xmii(struct net_device *dev, ) { struct rtl8125_private *tp = netdev_priv(dev); + u16 aner = tp->phy_reg_aner; + u16 anlpar = tp->phy_reg_anlpar; + u16 gbsr = tp->phy_reg_gbsr; + u16 status_2500 = tp->phy_reg_status_2500; + u32 lpa_adv = 0; u16 status; u8 autoneg, duplex; u32 speed = 0; u16 bmcr; u32 supported, advertising; - unsigned long flags; + u8 report_lpa = 0; supported = SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | @@ -4661,10 +4791,8 @@ static void rtl8125_gset_xmii(struct net_device *dev, advertising = ADVERTISED_TP; - spin_lock_irqsave(&tp->lock, flags); rtl8125_mdio_write(tp, 0x1F, 0x0000); bmcr = rtl8125_mdio_read(tp, MII_BMCR); - spin_unlock_irqrestore(&tp->lock, flags); if (bmcr & BMCR_ANENABLE) { advertising |= ADVERTISED_Autoneg; @@ -4687,8 +4815,10 @@ static void rtl8125_gset_xmii(struct net_device *dev, } status = RTL_R16(tp, PHYstatus); + if (netif_running(dev) && (status & LinkStatus)) + report_lpa = 1; - if (status & LinkStatus) { + if (report_lpa) { /*link on*/ if (status & _2500bpsF) speed = SPEED_2500; @@ -4707,10 +4837,33 @@ static void rtl8125_gset_xmii(struct net_device *dev, duplex = ((status & (_1000bpsF | _2500bpsF)) || (status & FullDup)) ? DUPLEX_FULL : DUPLEX_HALF; + + /*link partner*/ + if (aner & EXPANSION_NWAY) + lpa_adv |= ADVERTISED_Autoneg; + if (anlpar & LPA_10HALF) + lpa_adv |= ADVERTISED_10baseT_Half; + if (anlpar & LPA_10FULL) + lpa_adv |= ADVERTISED_10baseT_Full; + if (anlpar & LPA_100HALF) + lpa_adv |= ADVERTISED_100baseT_Half; + if (anlpar & LPA_100FULL) + lpa_adv |= ADVERTISED_100baseT_Full; + if (anlpar & LPA_PAUSE_CAP) + lpa_adv |= ADVERTISED_Pause; + if (anlpar & LPA_PAUSE_ASYM) + lpa_adv |= ADVERTISED_Asym_Pause; + if (gbsr & LPA_1000HALF) + lpa_adv |= ADVERTISED_1000baseT_Half; + if (gbsr & LPA_1000FULL) + lpa_adv |= ADVERTISED_1000baseT_Full; + if (status_2500 & RTK_LPA_ADVERTISE_2500FULL) + lpa_adv |= ADVERTISED_2500baseX_Full; } else { /*link down*/ speed = SPEED_UNKNOWN; duplex = DUPLEX_UNKNOWN; + lpa_adv = 0; } #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) @@ -4720,11 +4873,42 @@ static void rtl8125_gset_xmii(struct net_device *dev, cmd->speed = speed; cmd->duplex = duplex; cmd->port = PORT_TP; + cmd->lp_advertising = lpa_adv; #else ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, supported); ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, advertising); + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.lp_advertising, + lpa_adv); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) + if (supported & SUPPORTED_2500baseX_Full) { + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, + cmd->link_modes.supported, 0); + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + cmd->link_modes.supported, 1); + } + if (advertising & ADVERTISED_2500baseX_Full) { + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, + cmd->link_modes.advertising, 0); + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + cmd->link_modes.advertising, 1); + } + if (report_lpa) { + if (lpa_adv & ADVERTISED_2500baseX_Full) { + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, + cmd->link_modes.lp_advertising, 0); + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + cmd->link_modes.lp_advertising, 1); + } + if (status_2500 & RTK_LPA_ADVERTISE_5000FULL) + linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, + cmd->link_modes.lp_advertising, 1); + if (status_2500 & RTK_LPA_ADVERTISE_10000FULL) + linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + cmd->link_modes.lp_advertising, 1); + } +#endif cmd->base.autoneg = autoneg; cmd->base.speed = speed; cmd->base.duplex = duplex; @@ -4756,14 +4940,12 @@ static void rtl8125_get_regs(struct net_device *dev, struct ethtool_regs *regs, void __iomem *ioaddr = tp->mmio_addr; unsigned int i; u8 *data = p; - unsigned long flags; if (regs->len < R8125_REGS_DUMP_SIZE) return /* -EINVAL */; memset(p, 0, regs->len); - spin_lock_irqsave(&tp->lock, flags); for (i = 0; i < R8125_MAC_REGS_SIZE; i++) *data++ = readb(ioaddr + i); data = (u8*)p + 256; @@ -4793,16 +4975,12 @@ static void rtl8125_get_regs(struct net_device *dev, struct ethtool_regs *regs, } break; } - spin_unlock_irqrestore(&tp->lock, flags); } static void rtl8125_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; - - spin_lock_irqsave(&tp->lock, flags); pause->autoneg = (tp->autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); if (tp->fcpause == rtl8125_fc_rx_pause) @@ -4813,8 +4991,6 @@ static void rtl8125_get_pauseparam(struct net_device *dev, pause->rx_pause = 1; pause->tx_pause = 1; } - - spin_unlock_irqrestore(&tp->lock, flags); } static int rtl8125_set_pauseparam(struct net_device *dev, @@ -4822,23 +4998,18 @@ static int rtl8125_set_pauseparam(struct net_device *dev, { struct rtl8125_private *tp = netdev_priv(dev); enum rtl8125_fc_mode newfc; - unsigned long flags; if (pause->tx_pause || pause->rx_pause) newfc = rtl8125_fc_full; else newfc = rtl8125_fc_none; - spin_lock_irqsave(&tp->lock, flags); - if (tp->fcpause != newfc) { tp->fcpause = newfc; rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); } - spin_unlock_irqrestore(&tp->lock, flags); - return 0; } @@ -4861,6 +5032,7 @@ rtl8125_set_msglevel(struct net_device *dev, } static const char rtl8125_gstrings[][ETH_GSTRING_LEN] = { + /* legacy */ "tx_packets", "rx_packets", "tx_errors", @@ -4874,6 +5046,34 @@ static const char rtl8125_gstrings[][ETH_GSTRING_LEN] = { "multicast", "tx_aborted", "tx_underrun", + + /* extended */ + "tx_octets", + "rx_octets", + "rx_multicast64", + "tx_unicast64", + "tx_broadcast64", + "tx_multicast64", + "tx_pause_on", + "tx_pause_off", + "tx_pause_all", + "tx_deferred", + "tx_late_collision", + "tx_all_collision", + "tx_aborted32", + "align_errors32", + "rx_frame_too_long", + "rx_runt", + "rx_pause_on", + "rx_pause_off", + "rx_pause_all", + "rx_unknown_opcode", + "rx_mac_error", + "tx_underrun32", + "rx_mac_missed", + "rx_tcam_dropped", + "tdu", + "rdu", }; #endif //#LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) @@ -4905,9 +5105,6 @@ rtl8125_get_ethtool_stats(struct net_device *dev, struct rtl8125_private *tp = netdev_priv(dev); struct rtl8125_counters *counters; dma_addr_t paddr; - u32 cmd; - u32 WaitCnt; - unsigned long flags; ASSERT_RTNL(); @@ -4916,21 +5113,7 @@ rtl8125_get_ethtool_stats(struct net_device *dev, if (!counters) return; - spin_lock_irqsave(&tp->lock, flags); - RTL_W32(tp, CounterAddrHigh, (u64)paddr >> 32); - cmd = (u64)paddr & DMA_BIT_MASK(32); - RTL_W32(tp, CounterAddrLow, cmd); - RTL_W32(tp, CounterAddrLow, cmd | CounterDump); - - WaitCnt = 0; - while (RTL_R32(tp, CounterAddrLow) & CounterDump) { - udelay(10); - - WaitCnt++; - if (WaitCnt > 20) - break; - } - spin_unlock_irqrestore(&tp->lock, flags); + rtl8125_dump_tally_counter(tp, paddr); data[0] = le64_to_cpu(counters->tx_packets); data[1] = le64_to_cpu(counters->rx_packets); @@ -4944,7 +5127,34 @@ rtl8125_get_ethtool_stats(struct net_device *dev, data[9] = le64_to_cpu(counters->rx_broadcast); data[10] = le32_to_cpu(counters->rx_multicast); data[11] = le16_to_cpu(counters->tx_aborted); - data[12] = le16_to_cpu(counters->tx_underun); + data[12] = le16_to_cpu(counters->tx_underrun); + + data[13] = le64_to_cpu(counters->tx_octets); + data[14] = le64_to_cpu(counters->rx_octets); + data[15] = le64_to_cpu(counters->rx_multicast64); + data[16] = le64_to_cpu(counters->tx_unicast64); + data[17] = le64_to_cpu(counters->tx_broadcast64); + data[18] = le64_to_cpu(counters->tx_multicast64); + data[19] = le32_to_cpu(counters->tx_pause_on); + data[20] = le32_to_cpu(counters->tx_pause_off); + data[21] = le32_to_cpu(counters->tx_pause_all); + data[22] = le32_to_cpu(counters->tx_deferred); + data[23] = le32_to_cpu(counters->tx_late_collision); + data[24] = le32_to_cpu(counters->tx_all_collision); + data[25] = le32_to_cpu(counters->tx_aborted32); + data[26] = le32_to_cpu(counters->align_errors32); + data[27] = le32_to_cpu(counters->rx_frame_too_long); + data[28] = le32_to_cpu(counters->rx_runt); + data[29] = le32_to_cpu(counters->rx_pause_on); + data[30] = le32_to_cpu(counters->rx_pause_off); + data[31] = le32_to_cpu(counters->rx_pause_all); + data[32] = le32_to_cpu(counters->rx_unknown_opcode); + data[33] = le32_to_cpu(counters->rx_mac_error); + data[34] = le32_to_cpu(counters->tx_underrun32); + data[35] = le32_to_cpu(counters->rx_mac_missed); + data[36] = le32_to_cpu(counters->rx_tcam_dropped); + data[37] = le32_to_cpu(counters->tdu); + data[38] = le32_to_cpu(counters->rdu); } static void @@ -5188,15 +5398,10 @@ static int rtl8125_disable_eee(struct rtl8125_private *tp) static int rtl_nway_reset(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; int ret, bmcr; - spin_lock_irqsave(&tp->lock, flags); - - if (unlikely(tp->rtk_enable_diag)) { - spin_unlock_irqrestore(&tp->lock, flags); + if (unlikely(tp->rtk_enable_diag)) return -EBUSY; - } /* if autoneg is off, it's an error */ rtl8125_mdio_write(tp, 0x1F, 0x0000); @@ -5210,8 +5415,6 @@ static int rtl_nway_reset(struct net_device *dev) ret = -EINVAL; } - spin_unlock_irqrestore(&tp->lock, flags); - return ret; } @@ -5247,15 +5450,10 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) struct rtl8125_private *tp = netdev_priv(net); struct ethtool_eee *eee = &tp->eee; u32 lp, adv, tx_lpi_timer, supported = 0; - unsigned long flags; u16 val; - spin_lock_irqsave(&tp->lock, flags); - - if (unlikely(tp->rtk_enable_diag)) { - spin_unlock_irqrestore(&tp->lock, flags); + if (unlikely(tp->rtk_enable_diag)) return -EBUSY; - } /* Get Supported EEE */ //val = mdio_direct_read_phy_ocp(tp, 0xA5C4); @@ -5276,8 +5474,6 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) val = rtl8125_mac_ocp_read(tp, 0xE040); val &= BIT_1 | BIT_0; - spin_unlock_irqrestore(&tp->lock, flags); - edata->eee_enabled = !!val; edata->eee_active = !!(supported & adv & lp); edata->supported = supported; @@ -5295,25 +5491,22 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) struct rtl8125_private *tp = netdev_priv(net); struct ethtool_eee *eee = &tp->eee; u32 advertising; - unsigned long flags; int rc = 0; if (!HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp) || tp->DASH) return -EOPNOTSUPP; - spin_lock_irqsave(&tp->lock, flags); - if (unlikely(tp->rtk_enable_diag)) { dev_printk(KERN_WARNING, tp_to_dev(tp), "Diag Enabled\n"); rc = -EBUSY; - goto exit_unlock; + goto out; } if (tp->autoneg != AUTONEG_ENABLE) { dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE requires autoneg\n"); rc = -EINVAL; - goto exit_unlock; + goto out; } if (edata->tx_lpi_enabled) { @@ -5322,7 +5515,7 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) dev_printk(KERN_WARNING, tp_to_dev(tp), "Valid LPI timer range is %d to %d. \n", ETH_MIN_MTU, tp->max_jumbo_frame_size); rc = -EINVAL; - goto exit_unlock; + goto out; } } @@ -5333,14 +5526,14 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of autoneg advertised speeds %x\n", edata->advertised, advertising); rc = -EINVAL; - goto exit_unlock; + goto out; } if (edata->advertised & ~eee->supported) { dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n", edata->advertised, eee->supported); rc = -EINVAL; - goto exit_unlock; + goto out; } //tp->eee.eee_enabled = edata->eee_enabled; @@ -5359,15 +5552,11 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) else rtl8125_disable_eee(tp); - spin_unlock_irqrestore(&tp->lock, flags); - rtl_nway_reset(net); return rc; -exit_unlock: - - spin_unlock_irqrestore(&tp->lock, flags); +out: return rc; } @@ -5449,7 +5638,6 @@ static const struct ethtool_ops rtl8125_ethtool_ops = { static int rtl8125_enable_green_feature(struct rtl8125_private *tp) { u16 gphy_val; - unsigned long flags; switch (tp->mcfg) { case CFG_METHOD_2: @@ -5471,7 +5659,6 @@ static int rtl8125_enable_green_feature(struct rtl8125_private *tp) static int rtl8125_disable_green_feature(struct rtl8125_private *tp) { u16 gphy_val; - unsigned long flags; switch (tp->mcfg) { case CFG_METHOD_2: @@ -5838,17 +6025,21 @@ rtl8125_set_mac_mcu_8125b_2(struct net_device *dev) struct rtl8125_private *tp = netdev_priv(dev); u16 i; static const u16 mcu_patch_code_8125b_2[] = { - 0xE008, 0xE013, 0xE01E, 0xE02F, 0xE035, 0xE04F, 0xE053, 0xE055, 0x740A, - 0x4846, 0x4847, 0x9C0A, 0xC607, 0x74C0, 0x48C6, 0x9CC0, 0xC602, 0xBE00, - 0x13F0, 0xE054, 0x72CA, 0x4826, 0x4827, 0x9ACA, 0xC607, 0x72C0, 0x48A6, - 0x9AC0, 0xC602, 0xBE00, 0x081C, 0xE054, 0xC60F, 0x74C4, 0x49CC, 0xF109, - 0xC60C, 0x74CA, 0x48C7, 0x9CCA, 0xC609, 0x74C0, 0x4846, 0x9CC0, 0xC602, - 0xBE00, 0x2494, 0xE092, 0xE0C0, 0xE054, 0x7420, 0x48C0, 0x9C20, 0x7444, - 0xC602, 0xBE00, 0x12DC, 0x733A, 0x21B5, 0x25BC, 0x1304, 0xF111, 0x1B12, - 0x1D2A, 0x3168, 0x3ADA, 0x31AB, 0x1A00, 0x9AC0, 0x1300, 0xF1FB, 0x7620, - 0x236E, 0x276F, 0x1A3C, 0x22A1, 0x41B5, 0x9EE2, 0x76E4, 0x486F, 0x9EE4, - 0xC602, 0xBE00, 0x4A26, 0x733A, 0x49BB, 0xC602, 0xBE00, 0x47A2, 0xC602, - 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000 + 0xE010, 0xE01B, 0xE026, 0xE037, 0xE03D, 0xE057, 0xE05B, 0xE05F, 0xE061, + 0xE063, 0xE065, 0xE067, 0xE069, 0xE06B, 0xE06D, 0xE06F, 0x740A, 0x4846, + 0x4847, 0x9C0A, 0xC607, 0x74C0, 0x48C6, 0x9CC0, 0xC602, 0xBE00, 0x13F0, + 0xE054, 0x72CA, 0x4826, 0x4827, 0x9ACA, 0xC607, 0x72C0, 0x48A6, 0x9AC0, + 0xC602, 0xBE00, 0x081C, 0xE054, 0xC60F, 0x74C4, 0x49CC, 0xF109, 0xC60C, + 0x74CA, 0x48C7, 0x9CCA, 0xC609, 0x74C0, 0x4846, 0x9CC0, 0xC602, 0xBE00, + 0x2494, 0xE092, 0xE0C0, 0xE054, 0x7420, 0x48C0, 0x9C20, 0x7444, 0xC602, + 0xBE00, 0x12DC, 0x733A, 0x21B5, 0x25BC, 0x1304, 0xF111, 0x1B12, 0x1D2A, + 0x3168, 0x3ADA, 0x31AB, 0x1A00, 0x9AC0, 0x1300, 0xF1FB, 0x7620, 0x236E, + 0x276F, 0x1A3C, 0x22A1, 0x41B5, 0x9EE2, 0x76E4, 0x486F, 0x9EE4, 0xC602, + 0xBE00, 0x4A26, 0x733A, 0x49BB, 0xC602, 0xBE00, 0x47A2, 0x48C1, 0x48C2, + 0xC5C3, 0xBD00, 0x0A52, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, + 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, + 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, + 0xC602, 0xBE00, 0x0000 }; rtl8125_hw_disable_mac_mcu_bps(dev); @@ -5865,8 +6056,9 @@ rtl8125_set_mac_mcu_8125b_2(struct net_device *dev) rtl8125_mac_ocp_write(tp, 0xFC2E, 0x12DA); rtl8125_mac_ocp_write(tp, 0xFC30, 0x4A20); rtl8125_mac_ocp_write(tp, 0xFC32, 0x47A0); + rtl8125_mac_ocp_write(tp, 0xFC34, 0x0A46); - rtl8125_mac_ocp_write(tp, 0xFC48, 0x003F); + rtl8125_mac_ocp_write(tp, 0xFC48, 0x007F); } static void @@ -6133,43 +6325,52 @@ rtl8125_check_hw_phy_mcu_code_ver(struct net_device *dev) return ram_code_ver_match; } -static bool -rtl8125_wait_phy_mcu_patch_request_ready(struct rtl8125_private *tp) +bool +rtl8125_set_phy_mcu_patch_request(struct rtl8125_private *tp) { u16 gphy_val; u16 WaitCount; bool bSuccess = TRUE; + SetEthPhyOcpBit(tp, 0xB820, BIT_4); + WaitCount = 0; do { gphy_val = mdio_direct_read_phy_ocp(tp, 0xB800); - gphy_val &= BIT_6; udelay(100); WaitCount++; - } while(gphy_val != BIT_6 && WaitCount < 1000); + } while (!(gphy_val & BIT_6) && (WaitCount < 1000)); - if (gphy_val != BIT_6 && WaitCount == 1000) bSuccess = FALSE; + if (!(gphy_val & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; if (!bSuccess) - dprintk("rtl8125_wait_phy_mcu_patch_request_ready fail.\n"); + dprintk("rtl8125_set_phy_mcu_patch_request fail.\n"); return bSuccess; } -bool -rtl8125_set_phy_mcu_patch_request(struct rtl8125_private *tp) -{ - SetEthPhyOcpBit(tp, 0xB820, BIT_4); - - return rtl8125_wait_phy_mcu_patch_request_ready(tp); -} - bool rtl8125_clear_phy_mcu_patch_request(struct rtl8125_private *tp) { + u16 gphy_val; + u16 WaitCount; + bool bSuccess = TRUE; + ClearEthPhyOcpBit(tp, 0xB820, BIT_4); - return rtl8125_wait_phy_mcu_patch_request_ready(tp); + WaitCount = 0; + do { + gphy_val = mdio_direct_read_phy_ocp(tp, 0xB800); + udelay(100); + WaitCount++; + } while ((gphy_val & BIT_6) && (WaitCount < 1000)); + + if ((gphy_val & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; + + if (!bSuccess) + dprintk("rtl8125_clear_phy_mcu_patch_request fail.\n"); + + return bSuccess; } #ifndef ENABLE_USE_FIRMWARE_FILE @@ -9660,6 +9861,7 @@ rtl8125_up(struct net_device *dev) rtl8125_hw_config(dev); } +/* static inline void rtl8125_delete_esd_timer(struct net_device *dev, struct timer_list *timer) { del_timer_sync(timer); @@ -9676,6 +9878,7 @@ static inline void rtl8125_request_esd_timer(struct net_device *dev) #endif mod_timer(timer, jiffies + RTL8125_ESD_TIMEOUT); } +*/ /* static inline void rtl8125_delete_link_timer(struct net_device *dev, struct timer_list *timer) @@ -9765,28 +9968,28 @@ rtl8125_setup_mqs_reg(struct rtl8125_private *tp) //tx tp->tx_ring[0].tdsar_reg = TxDescStartAddrLow; for (i = 1; i < R8125_MAX_TX_QUEUES; i++) { - tp->tx_ring[i].tdsar_reg = (u16)(TNPDS_Q1_LOW_8125 + (i - 1) * 8); + tp->tx_ring[i].tdsar_reg = (u16)(TNPDS_Q1_LOW_8125 + (i - 1) * 8); } for (i = 0; i < R8125_MAX_TX_QUEUES; i++) { - tp->tx_ring[i].hw_clo_ptr_reg = (u16)(HW_CLO_PTR0_8125 + i * 4); - tp->tx_ring[i].sw_tail_ptr_reg = (u16)(SW_TAIL_PTR0_8125 + i * 4); + tp->tx_ring[i].hw_clo_ptr_reg = (u16)(HW_CLO_PTR0_8125 + i * 4); + tp->tx_ring[i].sw_tail_ptr_reg = (u16)(SW_TAIL_PTR0_8125 + i * 4); } //rx tp->rx_ring[0].rdsar_reg = RxDescAddrLow; for (i = 1; i < R8125_MAX_RX_QUEUES; i++) { - tp->rx_ring[i].rdsar_reg = (u16)(RDSAR_Q1_LOW_8125 + (i - 1) * 8); + tp->rx_ring[i].rdsar_reg = (u16)(RDSAR_Q1_LOW_8125 + (i - 1) * 8); } tp->isr_reg[0] = ISR0_8125; for (i = 1; i < R8125_MAX_QUEUES; i++) { - tp->isr_reg[i] = (u16)(ISR1_8125 + (i - 1) * 4); + tp->isr_reg[i] = (u16)(ISR1_8125 + (i - 1) * 4); } tp->imr_reg[0] = IMR0_8125; for (i = 1; i < R8125_MAX_QUEUES; i++) { - tp->imr_reg[i] = (u16)(IMR1_8125 + (i - 1) * 4); + tp->imr_reg[i] = (u16)(IMR1_8125 + (i - 1) * 4); } } @@ -10103,8 +10306,11 @@ rtl8125_init_software_variable(struct net_device *dev) } tp->HwCurrIsrVer = tp->HwSuppIsrVer; - if (tp->HwSuppIsrVer == 2 && !(tp->features & RTL_FEATURE_MSIX)) - tp->HwCurrIsrVer = 1; + if (tp->HwSuppIsrVer == 2) { + if (!(tp->features & RTL_FEATURE_MSIX) || + tp->irq_nvecs < R8125_MIN_MSIX_VEC_8125B) + tp->HwCurrIsrVer = 1; + } if (tp->HwCurrIsrVer < 2 || tp->irq_nvecs < 19) tp->num_tx_rings = 1; @@ -10143,6 +10349,15 @@ rtl8125_init_software_variable(struct net_device *dev) break; } + switch (tp->mcfg) { + case CFG_METHOD_2: + case CFG_METHOD_3: + case CFG_METHOD_4: + case CFG_METHOD_5: + tp->HwSuppExtendTallyCounterVer = 1; + break; + } + timer_count_v2 = (timer_count / 0x100); tp->NicCustLedValue = RTL_R16(tp, CustomLED); @@ -10268,19 +10483,14 @@ rtl8125_set_mac_address(struct net_device *dev, { struct rtl8125_private *tp = netdev_priv(dev); struct sockaddr *addr = p; - unsigned long flags; if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; - spin_lock_irqsave(&tp->lock, flags); - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); rtl8125_rar_set(tp, dev->dev_addr); - spin_unlock_irqrestore(&tp->lock, flags); - return 0; } @@ -10980,7 +11190,6 @@ rtl8125_do_ioctl(struct net_device *dev, struct rtl8125_private *tp = netdev_priv(dev); struct mii_ioctl_data *data = if_mii(ifr); int ret; - unsigned long flags; ret = 0; switch (cmd) { @@ -10989,19 +11198,15 @@ rtl8125_do_ioctl(struct net_device *dev, break; case SIOCGMIIREG: - spin_lock_irqsave(&tp->lock, flags); rtl8125_mdio_write(tp, 0x1F, 0x0000); data->val_out = rtl8125_mdio_read(tp, data->reg_num); - spin_unlock_irqrestore(&tp->lock, flags); break; case SIOCSMIIREG: if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); rtl8125_mdio_write(tp, 0x1F, 0x0000); rtl8125_mdio_write(tp, data->reg_num, data->val_in); - spin_unlock_irqrestore(&tp->lock, flags); break; #ifdef ETHTOOL_OPS_COMPAT @@ -11257,24 +11462,10 @@ err_out: } static void -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) -rtl8125_esd_timer(unsigned long __opaque) -#else -rtl8125_esd_timer(struct timer_list *t) -#endif +rtl8125_esd_checker(struct rtl8125_private *tp) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - struct net_device *dev = (struct net_device *)__opaque; - struct rtl8125_private *tp = netdev_priv(dev); - struct timer_list *timer = &tp->esd_timer; -#else - struct rtl8125_private *tp = from_timer(tp, t, esd_timer); struct net_device *dev = tp->dev; - struct timer_list *timer = t; -#endif struct pci_dev *pdev = tp->pci_dev; - unsigned long timeout = RTL8125_ESD_TIMEOUT; - unsigned long flags; u8 cmd; u16 io_base_l; u16 mem_base_l; @@ -11291,8 +11482,6 @@ rtl8125_esd_timer(struct timer_list *t) u32 pci_sn_l; u32 pci_sn_h; - spin_lock_irqsave(&tp->lock, flags); - tp->esd_flag = 0; pci_read_config_byte(pdev, PCI_COMMAND, &cmd); @@ -11404,7 +11593,7 @@ rtl8125_esd_timer(struct timer_list *t) if (tp->esd_flag != 0) { printk(KERN_ERR "%s: esd_flag = 0x%04x\n.\n", dev->name, tp->esd_flag); - rtl8125_stop_all_tx_queue(dev); + netif_tx_stop_all_queues(dev); netif_carrier_off(dev); rtl8125_hw_reset(dev); rtl8125_tx_clear(tp); @@ -11415,10 +11604,29 @@ rtl8125_esd_timer(struct timer_list *t) rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); tp->esd_flag = 0; } - spin_unlock_irqrestore(&tp->lock, flags); +} +/* +static void +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +rtl8125_esd_timer(unsigned long __opaque) +#else +rtl8125_esd_timer(struct timer_list *t) +#endif +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) + struct net_device *dev = (struct net_device *)__opaque; + struct rtl8125_private *tp = netdev_priv(dev); + struct timer_list *timer = &tp->esd_timer; +#else + struct rtl8125_private *tp = from_timer(tp, t, esd_timer); + //struct net_device *dev = tp->dev; + struct timer_list *timer = t; +#endif + rtl8125_esd_checker(tp); mod_timer(timer, jiffies + timeout); } +*/ /* static void @@ -11437,11 +11645,7 @@ rtl8125_link_timer(struct timer_list *t) struct net_device *dev = tp->dev; struct timer_list *timer = t; #endif - unsigned long flags; - - spin_lock_irqsave(&tp->lock, flags); rtl8125_check_link_status(dev); - spin_unlock_irqrestore(&tp->lock, flags); mod_timer(timer, jiffies + RTL8125_LINK_TIMEOUT); } @@ -11503,17 +11707,17 @@ static int rtl8125_try_msi(struct rtl8125_private *tp) unsigned msi = 0; int nvecs = 1; + tp->max_irq_nvecs = 1; + tp->min_irq_nvecs = 1; +#ifndef DISABLE_MULTI_MSIX_VECTOR switch (tp->mcfg) { case CFG_METHOD_4: case CFG_METHOD_5: tp->max_irq_nvecs = R8125_MAX_MSIX_VEC_8125B; tp->min_irq_nvecs = R8125_MIN_MSIX_VEC_8125B; break; - default: - tp->max_irq_nvecs = 1; - tp->min_irq_nvecs = 1; - break; } +#endif #if defined(RTL_USE_NEW_INTR_API) if ((nvecs = pci_alloc_irq_vectors(pdev, tp->min_irq_nvecs, tp->max_irq_nvecs, PCI_IRQ_MSIX)) > 0) @@ -11602,28 +11806,20 @@ static int rtl8125_poll(napi_ptr napi, napi_budget budget) RTL_GET_NETDEV(tp) unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); unsigned int work_done = 0; - //unsigned long flags; int i; for (i = 0; i < tp->num_rx_rings; i++) work_done += rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[i], budget); - //spin_lock_irqsave(&tp->lock, flags); for (i = 0; i < tp->num_tx_rings; i++) rtl8125_tx_interrupt(&tp->tx_ring[i], budget); - //spin_unlock_irqrestore(&tp->lock, flags); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); if (work_done < work_to_do) { #ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) { - struct net_device *dev = tp->dev; - - spin_lock_irqsave(&tp->lock, flags); - HandleDashInterrupt(dev); - spin_unlock_irqrestore(&tp->lock, flags); - } + if (tp->DASH) + HandleDashInterrupt(tp->dev); #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) @@ -11653,26 +11849,18 @@ static int rtl8125_poll_msix_ring(napi_ptr napi, napi_budget budget) RTL_GET_NETDEV(tp) unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); unsigned int work_done = 0; - unsigned long flags; const int message_id = r8125napi->index; work_done += rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); - //spin_lock_irqsave(&tp->lock, flags); rtl8125_tx_interrupt_with_vector(tp, message_id, budget); - //spin_unlock_irqrestore(&tp->lock, flags); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); if (work_done < work_to_do) { #ifdef ENABLE_DASH_SUPPORT - if (tp->DASH && message_id == 0) { - struct net_device *dev = tp->dev; - - spin_lock_irqsave(&tp->lock, flags); - HandleDashInterrupt(dev); - spin_unlock_irqrestore(&tp->lock, flags); - } + if (tp->DASH && message_id == 0) + HandleDashInterrupt(tp->dev); #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) @@ -11702,15 +11890,12 @@ static int rtl8125_poll_msix_tx(napi_ptr napi, napi_budget budget) RTL_GET_NETDEV(tp) unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); unsigned int work_done = 0; - //unsigned long flags; const int message_id = r8125napi->index; //suppress unused variable (void)(dev); - //spin_lock_irqsave(&tp->lock, flags); rtl8125_tx_interrupt_with_vector(tp, message_id, budget); - //spin_unlock_irqrestore(&tp->lock, flags); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); @@ -11849,6 +12034,23 @@ static void rtl8125_init_napi(struct rtl8125_private *tp) } } +static int +rtl8125_set_real_num_queue(struct rtl8125_private *tp) +{ + int retval = 0; + + retval = netif_set_real_num_tx_queues(tp->dev, tp->num_tx_rings); + if (retval < 0) + goto exit; + + retval = netif_set_real_num_rx_queues(tp->dev, tp->num_rx_rings); + if (retval < 0) + goto exit; + +exit: + return retval; +} + static int __devinit rtl8125_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) @@ -11888,8 +12090,6 @@ rtl8125_init_one(struct pci_dev *pdev, goto err_out_1; } - spin_lock_init(&tp->lock); - rtl8125_init_software_variable(dev); RTL_NET_DEVICE_OPS(rtl8125_netdev_ops); @@ -11964,6 +12164,11 @@ rtl8125_init_one(struct pci_dev *pdev, #ifdef ENABLE_LIB_SUPPORT ATOMIC_INIT_NOTIFIER_HEAD(&tp->lib_nh); #endif + rtl8125_init_all_schedule_work(tp); + + rc = rtl8125_set_real_num_queue(tp); + if (rc < 0) + goto err_out; rtl8125_exit_oob(dev); @@ -12038,6 +12243,10 @@ rtl8125_remove_one(struct pci_dev *pdev) assert(dev != NULL); assert(tp != NULL); + set_bit(R8125_FLAG_DOWN, tp->task_flags); + + rtl8125_cancel_all_schedule_work(tp); + #ifdef CONFIG_R8125_NAPI rtl8125_del_napi(tp); #endif @@ -12233,22 +12442,6 @@ static void rtl8125_free_alloc_resources(struct rtl8125_private *tp) rtl8125_free_tx_desc(tp); } -int rtl8125_set_real_num_queue(struct rtl8125_private *tp) -{ - int retval = 0; - - retval = netif_set_real_num_tx_queues(tp->dev, tp->num_tx_rings); - if (retval < 0) - goto exit; - - retval = netif_set_real_num_rx_queues(tp->dev, tp->num_rx_rings); - if (retval < 0) - goto exit; - -exit: - return retval; -} - #ifdef ENABLE_USE_FIRMWARE_FILE static void rtl8125_request_firmware(struct rtl8125_private *tp) { @@ -12279,7 +12472,6 @@ static void rtl8125_request_firmware(struct rtl8125_private *tp) int rtl8125_open(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; int retval; retval = -ENOMEM; @@ -12299,10 +12491,6 @@ int rtl8125_open(struct net_device *dev) if (retval < 0) goto err_free_all_allocated_mem; - retval = rtl8125_set_real_num_queue(tp); - if (retval < 0) - goto err_free_all_allocated_mem; - retval = rtl8125_alloc_irq(tp); if (retval < 0) goto err_free_all_allocated_mem; @@ -12321,21 +12509,12 @@ int rtl8125_open(struct net_device *dev) #ifdef ENABLE_USE_FIRMWARE_FILE rtl8125_request_firmware(tp); #endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - INIT_WORK(&tp->task, rtl8125_reset_task, dev); -#else - INIT_DELAYED_WORK(&tp->task, rtl8125_reset_task); -#endif - pci_set_master(tp->pci_dev); #ifdef CONFIG_R8125_NAPI rtl8125_enable_napi(tp); #endif - spin_lock_irqsave(&tp->lock, flags); - rtl8125_exit_oob(dev); rtl8125_up(dev); @@ -12344,16 +12523,18 @@ int rtl8125_open(struct net_device *dev) if (tp->EnablePtp) rtl8125_ptp_init(tp); #endif + clear_bit(R8125_FLAG_DOWN, tp->task_flags); if (tp->resume_not_chg_speed) rtl8125_check_link_status(dev); else rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - spin_unlock_irqrestore(&tp->lock, flags); + if (tp->esd_flag == 0) { + //rtl8125_request_esd_timer(dev); - if (tp->esd_flag == 0) - rtl8125_request_esd_timer(dev); + rtl8125_schedule_esd_work(tp); + } //rtl8125_request_link_timer(dev); @@ -12464,14 +12645,7 @@ rtl8125_hw_set_rx_packet_filter(struct net_device *dev) static void rtl8125_set_rx_mode(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; - - spin_lock_irqsave(&tp->lock, flags); - rtl8125_hw_set_rx_packet_filter(dev); - - spin_unlock_irqrestore(&tp->lock, flags); } void @@ -12561,6 +12735,8 @@ rtl8125_hw_config(struct net_device *dev) rtl8125_tally_counter_addr_fill(tp); + rtl8125_enable_extend_tally_couter(tp); + rtl8125_desc_addr_fill(tp); /* Set DMA burst size and Interframe Gap Time */ @@ -12671,7 +12847,7 @@ rtl8125_hw_config(struct net_device *dev) RTL_W8(tp, 0xD0, (RTL_R8(tp, 0xD0) & ~BIT_6) | BIT_7); if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3) - RTL_W8(tp, 0xD3, RTL_R8(tp, 0xD3) | BIT_0); + RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) | BIT_0); rtl8125_disable_eee_plus(tp); @@ -12839,7 +13015,6 @@ rtl8125_change_mtu(struct net_device *dev, { struct rtl8125_private *tp = netdev_priv(dev); int ret = 0; - unsigned long flags; #if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) if (new_mtu < ETH_MIN_MTU) @@ -12848,40 +13023,32 @@ rtl8125_change_mtu(struct net_device *dev, new_mtu = tp->max_jumbo_frame_size; #endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) - spin_lock_irqsave(&tp->lock, flags); dev->mtu = new_mtu; - spin_unlock_irqrestore(&tp->lock, flags); if (!netif_running(dev)) goto out; rtl8125_down(dev); - spin_lock_irqsave(&tp->lock, flags); - rtl8125_set_rxbufsize(tp, dev); ret = rtl8125_init_ring(dev); - if (ret < 0) { - spin_unlock_irqrestore(&tp->lock, flags); + if (ret < 0) goto err_out; - } #ifdef CONFIG_R8125_NAPI rtl8125_enable_napi(tp); #endif//CONFIG_R8125_NAPI - //rtl8125_stop_all_tx_queue(dev); + //netif_tx_stop_all_queues(dev); //netif_carrier_off(dev); rtl8125_hw_config(dev); rtl8125_enable_hw_linkchg_interrupt(tp); rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - spin_unlock_irqrestore(&tp->lock, flags); - - mod_timer(&tp->esd_timer, jiffies + RTL8125_ESD_TIMEOUT); + //mod_timer(&tp->esd_timer, jiffies + RTL8125_ESD_TIMEOUT); //mod_timer(&tp->link_timer, jiffies + RTL8125_LINK_TIMEOUT); out: #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) @@ -13197,38 +13364,101 @@ rtl8125_tx_clear(struct rtl8125_private *tp) } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_schedule_work(struct net_device *dev, void (*task)(void *)) +static void rtl8125_schedule_reset_work(struct rtl8125_private *tp) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - struct rtl8125_private *tp = netdev_priv(dev); - - INIT_WORK(&tp->task, task, dev); - schedule_delayed_work(&tp->task, 4); + set_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags); + schedule_delayed_work(&tp->reset_task, 4); #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) } -#define rtl8125_cancel_schedule_work(a) - -#else -static void rtl8125_schedule_work(struct net_device *dev, work_func_t task) +static void rtl8125_schedule_esd_work(struct rtl8125_private *tp) { - struct rtl8125_private *tp = netdev_priv(dev); - - INIT_DELAYED_WORK(&tp->task, task); - schedule_delayed_work(&tp->task, 4); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + set_bit(R8125_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags); + schedule_delayed_work(&tp->esd_task, RTL8125_ESD_TIMEOUT); +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) } -static void rtl8125_cancel_schedule_work(struct net_device *dev) +static void rtl8125_schedule_linkchg_work(struct rtl8125_private *tp) { - struct rtl8125_private *tp = netdev_priv(dev); - struct work_struct *work = &tp->task.work; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + set_bit(R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags); + schedule_delayed_work(&tp->linkchg_task, 4); +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) +} + +#define rtl8125_cancel_schedule_reset_work(a) +#define rtl8125_cancel_schedule_esd_work(a) +#define rtl8125_cancel_schedule_linkchg_work(a) + +#else +static void rtl8125_schedule_reset_work(struct rtl8125_private *tp) +{ + set_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags); + schedule_delayed_work(&tp->reset_task, 4); +} + +static void rtl8125_cancel_schedule_reset_work(struct rtl8125_private *tp) +{ + struct work_struct *work = &tp->reset_task.work; if (!work->func) return; - cancel_delayed_work_sync(&tp->task); + cancel_delayed_work_sync(&tp->reset_task); +} + +static void rtl8125_schedule_esd_work(struct rtl8125_private *tp) +{ + set_bit(R8125_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags); + schedule_delayed_work(&tp->esd_task, RTL8125_ESD_TIMEOUT); +} + +static void rtl8125_cancel_schedule_esd_work(struct rtl8125_private *tp) +{ + struct work_struct *work = &tp->esd_task.work; + + if (!work->func) return; + + cancel_delayed_work_sync(&tp->esd_task); +} + +static void rtl8125_schedule_linkchg_work(struct rtl8125_private *tp) +{ + set_bit(R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags); + schedule_delayed_work(&tp->linkchg_task, RTL8125_ESD_TIMEOUT); +} + +static void rtl8125_cancel_schedule_linkchg_work(struct rtl8125_private *tp) +{ + struct work_struct *work = &tp->linkchg_task.work; + + if (!work->func) return; + + cancel_delayed_work_sync(&tp->linkchg_task); } #endif +static void rtl8125_init_all_schedule_work(struct rtl8125_private *tp) +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + INIT_WORK(&tp->reset_task, rtl8125_reset_task, dev); + INIT_WORK(&tp->esd_task, rtl8125_esd_task, dev); + INIT_WORK(&tp->linkchg_task, rtl8125_linkchg_task, dev); +#else + INIT_DELAYED_WORK(&tp->reset_task, rtl8125_reset_task); + INIT_DELAYED_WORK(&tp->esd_task, rtl8125_esd_task); + INIT_DELAYED_WORK(&tp->linkchg_task, rtl8125_linkchg_task); +#endif +} + +static void rtl8125_cancel_all_schedule_work(struct rtl8125_private *tp) +{ + rtl8125_cancel_schedule_reset_work(tp); + rtl8125_cancel_schedule_esd_work(tp); + rtl8125_cancel_schedule_linkchg_work(tp); +} + static void rtl8125_wait_for_irq_complete(struct rtl8125_private *tp) { @@ -13245,7 +13475,6 @@ static void _rtl8125_wait_for_quiescence(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; /* Wait for any pending NAPI task to complete */ #ifdef CONFIG_R8125_NAPI @@ -13256,12 +13485,9 @@ _rtl8125_wait_for_quiescence(struct net_device *dev) /* Give a racing hard_start_xmit a few cycles to complete. */ synchronize_net(); #endif - spin_lock_irqsave(&tp->lock, flags); rtl8125_irq_mask_and_ack(tp); - spin_unlock_irqrestore(&tp->lock, flags); - rtl8125_wait_for_irq_complete(tp); } @@ -13280,43 +13506,6 @@ rtl8125_wait_for_quiescence(struct net_device *dev) #endif//CONFIG_R8125_NAPI } -#if 0 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_reinit_task(void *_data) -#else -static void rtl8125_reinit_task(struct work_struct *work) -#endif -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - struct net_device *dev = _data; -#else - struct rtl8125_private *tp = - container_of(work, struct rtl8125_private, task.work); - struct net_device *dev = tp->dev; -#endif - int ret; - - if (netif_running(dev)) { - rtl8125_wait_for_quiescence(dev); - rtl8125_close(dev); - } - - ret = rtl8125_open(dev); - if (unlikely(ret < 0)) { - if (unlikely(net_ratelimit())) { - struct rtl8125_private *tp = netdev_priv(dev); - - if (netif_msg_drv(tp)) { - printk(PFX KERN_ERR - "%s: reinit failure (status = %d)." - " Rescheduling.\n", dev->name, ret); - } - } - rtl8125_schedule_work(dev, rtl8125_reinit_task); - } -} -#endif - static int rtl8125_rx_nostuck(struct rtl8125_private *tp) { int i, ret = 1; @@ -13334,15 +13523,18 @@ static void rtl8125_reset_task(void *_data) static void rtl8125_reset_task(struct work_struct *work) { struct rtl8125_private *tp = - container_of(work, struct rtl8125_private, task.work); + container_of(work, struct rtl8125_private, reset_task.work); struct net_device *dev = tp->dev; #endif u32 budget = ~(u32)0; - unsigned long flags; int i; - if (!netif_running(dev)) - return; + rtnl_lock(); + + if (!netif_running(dev) || + test_bit(R8125_FLAG_DOWN, tp->task_flags) || + !test_and_clear_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags)) + goto out_unlock; rtl8125_wait_for_quiescence(dev); @@ -13354,7 +13546,9 @@ static void rtl8125_reset_task(struct work_struct *work) #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) } - spin_lock_irqsave(&tp->lock, flags); + netif_tx_stop_all_queues(dev); + netif_carrier_off(dev); + rtl8125_hw_reset(dev); rtl8125_tx_clear(tp); @@ -13364,12 +13558,16 @@ static void rtl8125_reset_task(struct work_struct *work) #ifdef ENABLE_PTP_SUPPORT rtl8125_ptp_reset(tp); #endif - rtl8125_enable_hw_linkchg_interrupt(tp); + if (tp->resume_not_chg_speed) { + _rtl8125_check_link_status(dev); - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - spin_unlock_irqrestore(&tp->lock, flags); + tp->resume_not_chg_speed = 0; + } else { + rtl8125_enable_hw_linkchg_interrupt(tp); + + rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + } } else { - spin_unlock_irqrestore(&tp->lock, flags); if (unlikely(net_ratelimit())) { struct rtl8125_private *tp = netdev_priv(dev); @@ -13378,9 +13576,65 @@ static void rtl8125_reset_task(struct work_struct *work) "%s: Rx buffers shortage\n", dev->name); } } - rtl8125_schedule_work(dev, rtl8125_reset_task); + rtl8125_schedule_reset_work(tp); } + +out_unlock: + rtnl_unlock(); } + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void rtl8125_esd_task(void *_data) +{ + struct net_device *dev = _data; + struct rtl8125_private *tp = netdev_priv(dev); +#else +static void rtl8125_esd_task(struct work_struct *work) +{ + struct rtl8125_private *tp = + container_of(work, struct rtl8125_private, esd_task.work); + struct net_device *dev = tp->dev; +#endif + rtnl_lock(); + + if (!netif_running(dev) || + test_bit(R8125_FLAG_DOWN, tp->task_flags) || + !test_and_clear_bit(R8125_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags)) + goto out_unlock; + + rtl8125_esd_checker(tp); + + rtl8125_schedule_esd_work(tp); + +out_unlock: + rtnl_unlock(); +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void rtl8125_linkchg_task(void *_data) +{ + struct net_device *dev = _data; + //struct rtl8125_private *tp = netdev_priv(dev); +#else +static void rtl8125_linkchg_task(struct work_struct *work) +{ + struct rtl8125_private *tp = + container_of(work, struct rtl8125_private, linkchg_task.work); + struct net_device *dev = tp->dev; +#endif + rtnl_lock(); + + if (!netif_running(dev) || + test_bit(R8125_FLAG_DOWN, tp->task_flags) || + !test_and_clear_bit(R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags)) + goto out_unlock; + + rtl8125_check_link_status(dev); + +out_unlock: + rtnl_unlock(); +} + #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) static void rtl8125_tx_timeout(struct net_device *dev, unsigned int txqueue) @@ -13390,16 +13644,9 @@ rtl8125_tx_timeout(struct net_device *dev) #endif { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; - - spin_lock_irqsave(&tp->lock, flags); - rtl8125_stop_all_tx_queue(dev); - netif_carrier_off(dev); - rtl8125_hw_reset(dev); - spin_unlock_irqrestore(&tp->lock, flags); /* Let's wait a bit while any (async) irq lands on */ - rtl8125_schedule_work(dev, rtl8125_reset_task); + rtl8125_schedule_reset_work(tp); } static u32 @@ -13821,7 +14068,6 @@ rtl8125_start_xmit(struct sk_buff *skb, u32 len; u32 opts[2]; netdev_tx_t ret = NETDEV_TX_OK; - //unsigned long flags; int frags; u8 EnableTxNoClose = tp->EnableTxNoClose; const u16 queue_mapping = skb_get_queue_mapping(skb); @@ -13832,8 +14078,6 @@ rtl8125_start_xmit(struct sk_buff *skb, ring = &tp->tx_ring[queue_mapping]; - //spin_lock_irqsave(&tp->lock, flags); - if (unlikely(!rtl8125_tx_slots_avail(tp, ring))) { if (netif_msg_drv(tp)) { printk(KERN_ERR @@ -13943,8 +14187,6 @@ rtl8125_start_xmit(struct sk_buff *skb, if (rtl8125_tx_slots_avail(tp, ring)) netif_start_subqueue(dev, queue_mapping); } - - //spin_unlock_irqrestore(&tp->lock, flags); out: return ret; err_dma_1: @@ -13952,7 +14194,6 @@ err_dma_1: rtl8125_tx_clear_range(tp, ring, ring->cur_tx + 1, frags); err_dma_0: RTLDEV->stats.tx_dropped++; - //spin_unlock_irqrestore(&tp->lock, flags); dev_kfree_skb_any(skb); ret = NETDEV_TX_OK; goto out; @@ -13960,8 +14201,6 @@ err_stop: netif_stop_subqueue(dev, queue_mapping); ret = NETDEV_TX_BUSY; RTLDEV->stats.tx_dropped++; - - //spin_unlock_irqrestore(&tp->lock, flags); goto out; } @@ -13981,15 +14220,16 @@ rtl8125_tx_interrupt(struct rtl8125_tx_ring *ring, int budget) u8 EnableTxNoClose = tp->EnableTxNoClose; dirty_tx = ring->dirty_tx; + smp_rmb(); + tx_left = READ_ONCE(ring->cur_tx) - dirty_tx; if (EnableTxNoClose) { + unsigned int tx_desc_closed; u32 NextHwDesCloPtr = RTL_R16(tp, ring->hw_clo_ptr_reg); ring->NextHwDesCloPtr = NextHwDesCloPtr; smp_rmb(); - tx_left = rtl8125_fast_mod(NextHwDesCloPtr - ring->BeginHwDesCloPtr, MAX_TX_NO_CLOSE_DESC_PTR_V2); + tx_desc_closed = rtl8125_fast_mod(NextHwDesCloPtr - ring->BeginHwDesCloPtr, MAX_TX_NO_CLOSE_DESC_PTR_V2); + if(tx_left > tx_desc_closed) tx_left = tx_desc_closed; ring->BeginHwDesCloPtr = NextHwDesCloPtr; - } else { - smp_rmb(); - tx_left = READ_ONCE(ring->cur_tx) - dirty_tx; } while (tx_left > 0) { @@ -14038,10 +14278,13 @@ rtl8125_tx_interrupt_with_vector(struct rtl8125_private *tp, int budget) { int count = 0; + if (message_id == 16) count += rtl8125_tx_interrupt(&tp->tx_ring[0], budget); +#ifdef ENABLE_MULTIPLE_TX_QUEUE else if (message_id == 18) count += rtl8125_tx_interrupt(&tp->tx_ring[1], budget); +#endif return count; } @@ -14291,7 +14534,7 @@ process_pkt: else WARN_ON(1); - rx_buf_phy_addr = le64_to_cpu(ring->RxDescPhyAddr[entry_next]); + rx_buf_phy_addr = ring->RxDescPhyAddr[entry_next]; dma_unmap_single(tp_to_dev(tp), rx_buf_phy_addr, tp->rx_buf_sz, DMA_FROM_DEVICE); skb_next = ring->Rx_skbuff[entry_next]; @@ -14301,7 +14544,7 @@ process_pkt: WARN_ON(desc_type != RXDESC_TYPE_NORMAL); } #endif - rx_buf_phy_addr = le64_to_cpu(ring->RxDescPhyAddr[entry]); + rx_buf_phy_addr = ring->RxDescPhyAddr[entry]; dma_sync_single_for_cpu(tp_to_dev(tp), rx_buf_phy_addr, tp->rx_buf_sz, DMA_FROM_DEVICE); @@ -14421,7 +14664,7 @@ static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance) RTL_W32(tp, tp->isr_reg[0], status&~RxFIFOOver); if (rtl8125_linkchg_interrupt(tp, status)) - rtl8125_check_link_status(dev); + rtl8125_schedule_linkchg_work(tp); #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) { @@ -14521,7 +14764,7 @@ static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance) //link change if (message_id == 21) { - rtl8125_check_link_status(dev); + rtl8125_schedule_linkchg_work(tp); break; } @@ -14540,9 +14783,7 @@ static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance) #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) } - //spin_lock_irqsave(&tp->lock, flags); rtl8125_tx_interrupt_with_vector(tp, message_id, ~(u32)0); - //spin_unlock_irqrestore(&tp->lock, flags); rtl8125_enable_hw_interrupt_v2(tp, message_id); #endif @@ -14555,18 +14796,15 @@ static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance) static void rtl8125_down(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; - rtl8125_delete_esd_timer(dev, &tp->esd_timer); + //rtl8125_delete_esd_timer(dev, &tp->esd_timer); //rtl8125_delete_link_timer(dev, &tp->link_timer); - rtl8125_stop_all_tx_queue(dev); + netif_tx_disable(dev); _rtl8125_wait_for_quiescence(dev); - spin_lock_irqsave(&tp->lock, flags); - netif_carrier_off(dev); rtl8125_hw_reset(dev); @@ -14574,8 +14812,6 @@ static void rtl8125_down(struct net_device *dev) rtl8125_tx_clear(tp); rtl8125_rx_clear(tp); - - spin_unlock_irqrestore(&tp->lock, flags); } static int rtl8125_resource_freed(struct rtl8125_private *tp) @@ -14594,16 +14830,14 @@ static int rtl8125_resource_freed(struct rtl8125_private *tp) int rtl8125_close(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; if (!rtl8125_resource_freed(tp)) { - rtl8125_cancel_schedule_work(dev); + set_bit(R8125_FLAG_DOWN, tp->task_flags); rtl8125_down(dev); pci_clear_master(tp->pci_dev); - spin_lock_irqsave(&tp->lock, flags); #ifdef ENABLE_PTP_SUPPORT rtl8125_ptp_stop(tp); #endif @@ -14611,19 +14845,13 @@ int rtl8125_close(struct net_device *dev) rtl8125_powerdown_pll(dev, 0); - spin_unlock_irqrestore(&tp->lock, flags); - rtl8125_free_irq(tp); rtl8125_free_alloc_resources(tp); } else { - spin_lock_irqsave(&tp->lock, flags); - rtl8125_hw_d3_para(dev); rtl8125_powerdown_pll(dev, 0); - - spin_unlock_irqrestore(&tp->lock, flags); } return 0; @@ -14635,6 +14863,8 @@ static void rtl8125_shutdown(struct pci_dev *pdev) struct net_device *dev = pci_get_drvdata(pdev); struct rtl8125_private *tp = netdev_priv(dev); + rtnl_lock(); + if (tp->DASH) rtl8125_driver_stop(tp); @@ -14648,6 +14878,8 @@ static void rtl8125_shutdown(struct pci_dev *pdev) rtl8125_close(dev); rtl8125_disable_msi(pdev, tp); + rtnl_unlock(); + if (system_state == SYSTEM_POWER_OFF) { pci_clear_master(tp->pci_dev); pci_wake_from_d3(pdev, tp->wol_enabled); @@ -14668,11 +14900,6 @@ net_device_stats *rtl8125_get_stats(struct net_device *dev) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) struct rtl8125_private *tp = netdev_priv(dev); #endif - if (netif_running(dev)) { -// spin_lock_irqsave(&tp->lock, flags); -// spin_unlock_irqrestore(&tp->lock, flags); - } - return &RTLDEV->stats; } @@ -14699,25 +14926,25 @@ rtl8125_suspend(struct pci_dev *pdev, pm_message_t state) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) u32 pci_pm_state = pci_choose_state(pdev, state); #endif - unsigned long flags; - if (!netif_running(dev)) goto out; - rtl8125_cancel_schedule_work(dev); + //rtl8125_cancel_all_schedule_work(tp); - rtl8125_delete_esd_timer(dev, &tp->esd_timer); + //rtl8125_delete_esd_timer(dev, &tp->esd_timer); //rtl8125_delete_link_timer(dev, &tp->link_timer); - rtl8125_stop_all_tx_queue(dev); + rtnl_lock(); + + set_bit(R8125_FLAG_DOWN, tp->task_flags); + + netif_tx_disable(dev); netif_carrier_off(dev); netif_device_detach(dev); - spin_lock_irqsave(&tp->lock, flags); - #ifdef ENABLE_PTP_SUPPORT rtl8125_ptp_suspend(tp); #endif @@ -14729,10 +14956,10 @@ rtl8125_suspend(struct pci_dev *pdev, pm_message_t state) rtl8125_powerdown_pll(dev, 1); - spin_unlock_irqrestore(&tp->lock, flags); - if (tp->DASH) rtl8125_driver_stop(tp); + + rtnl_unlock(); out: pci_disable_device(pdev); @@ -14757,6 +14984,21 @@ rtl8125_hw_d3_not_power_off(struct net_device *dev) return rtl8125_check_hw_phy_mcu_code_ver(dev); } +static int rtl8125_wait_phy_nway_complete_sleep(struct rtl8125_private *tp) +{ + int i, val; + + for (i = 0; i < 30; i++) { + val = rtl8125_mdio_read(tp, MII_BMSR) & BMSR_ANEGCOMPLETE; + if (val) + return 0; + + msleep(100); + } + + return -1; +} + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) static int rtl8125_resume(struct pci_dev *pdev) @@ -14772,16 +15014,17 @@ rtl8125_resume(struct device *device) struct net_device *dev = pci_get_drvdata(pdev); #endif struct rtl8125_private *tp = netdev_priv(dev); - unsigned long flags; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) u32 pci_pm_state = PCI_D0; #endif u32 err; + rtnl_lock(); + err = pci_enable_device(pdev); if (err) { dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n"); - return err; + goto out_unlock; } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) pci_restore_state(pdev, &pci_pm_state); @@ -14790,48 +15033,39 @@ rtl8125_resume(struct device *device) #endif pci_enable_wake(pdev, PCI_D0, 0); - spin_lock_irqsave(&tp->lock, flags); - /* restore last modified mac address */ rtl8125_rar_set(tp, dev->dev_addr); + tp->resume_not_chg_speed = 0; if (tp->check_keep_link_speed && //tp->link_ok(dev) && - rtl8125_hw_d3_not_power_off(dev)) + rtl8125_hw_d3_not_power_off(dev) && + rtl8125_wait_phy_nway_complete_sleep(tp) == 0) tp->resume_not_chg_speed = 1; - else - tp->resume_not_chg_speed = 0; - - spin_unlock_irqrestore(&tp->lock, flags); if (!netif_running(dev)) - goto out; + goto out_unlock; pci_set_master(pdev); - spin_lock_irqsave(&tp->lock, flags); - rtl8125_exit_oob(dev); rtl8125_up(dev); - spin_unlock_irqrestore(&tp->lock, flags); + clear_bit(R8125_FLAG_DOWN, tp->task_flags); + rtl8125_schedule_reset_work(tp); + + rtl8125_schedule_esd_work(tp); + + //mod_timer(&tp->esd_timer, jiffies + RTL8125_ESD_TIMEOUT); + //mod_timer(&tp->link_timer, jiffies + RTL8125_LINK_TIMEOUT); +out_unlock: netif_device_attach(dev); - if (tp->resume_not_chg_speed) { - spin_lock_irqsave(&tp->lock, flags); + rtnl_unlock(); - _rtl8125_check_link_status(dev); - - spin_unlock_irqrestore(&tp->lock, flags); - } else - rtl8125_schedule_work(dev, rtl8125_reset_task); - - mod_timer(&tp->esd_timer, jiffies + RTL8125_ESD_TIMEOUT); - //mod_timer(&tp->link_timer, jiffies + RTL8125_LINK_TIMEOUT); -out: - return 0; + return err; } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) diff --git a/package/kernel/r8125/src/r8125_rss.c b/package/kernel/r8125/src/r8125_rss.c index a77917a938..78e53f5148 100644 --- a/package/kernel/r8125/src/r8125_rss.c +++ b/package/kernel/r8125/src/r8125_rss.c @@ -336,9 +336,6 @@ int rtl8125_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, return 0; } -#define RSS_KEY_8125 0x4600 -#define RSS_INDIRECTION_TBL_8125_V2 0x4700 - static u32 rtl8125_rss_key_reg(struct rtl8125_private *tp) { return RSS_KEY_8125; diff --git a/package/kernel/r8125/src/r8125_rss.h b/package/kernel/r8125/src/r8125_rss.h index d77752816b..90e2809027 100644 --- a/package/kernel/r8125/src/r8125_rss.h +++ b/package/kernel/r8125/src/r8125_rss.h @@ -38,6 +38,9 @@ #include #include +#define RTL8125_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ +#define RTL8125_MAX_INDIRECTION_TABLE_ENTRIES 128 + enum rtl8125_rss_flag { RTL_8125_RSS_FLAG_HASH_UDP_IPV4 = (1 << 0), RTL_8125_RSS_FLAG_HASH_UDP_IPV6 = (1 << 1), diff --git a/package/kernel/r8125/src/rtltool.c b/package/kernel/r8125/src/rtltool.c index a9c46ea74f..ace717bde3 100644 --- a/package/kernel/r8125/src/rtltool.c +++ b/package/kernel/r8125/src/rtltool.c @@ -47,7 +47,6 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) { struct rtltool_cmd my_cmd; - unsigned long flags; int ret; if (copy_from_user(&my_cmd, ifr->ifr_data, sizeof(my_cmd))) @@ -97,10 +96,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); my_cmd.data = rtl8125_mdio_prot_read(tp, my_cmd.offset); - spin_unlock_irqrestore(&tp->lock, flags); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -112,19 +108,14 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); rtl8125_mdio_prot_write(tp, my_cmd.offset, my_cmd.data); - spin_unlock_irqrestore(&tp->lock, flags); break; case RTLTOOL_READ_EPHY: if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); my_cmd.data = rtl8125_ephy_read(tp, my_cmd.offset); - spin_unlock_irqrestore(&tp->lock, flags); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -136,17 +127,13 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); rtl8125_ephy_write(tp, my_cmd.offset, my_cmd.data); - spin_unlock_irqrestore(&tp->lock, flags); break; case RTLTOOL_READ_ERI: my_cmd.data = 0; if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) { - spin_lock_irqsave(&tp->lock, flags); my_cmd.data = rtl8125_eri_read(tp, my_cmd.offset, my_cmd.len, ERIAR_ExGMAC); - spin_unlock_irqrestore(&tp->lock, flags); } else { ret = -EOPNOTSUPP; break; @@ -167,9 +154,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) return -EPERM; if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) { - spin_lock_irqsave(&tp->lock, flags); rtl8125_eri_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data, ERIAR_ExGMAC); - spin_unlock_irqrestore(&tp->lock, flags); } else { ret = -EOPNOTSUPP; break; @@ -225,10 +210,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); my_cmd.data = rtl8125_eeprom_read_sc(tp, my_cmd.offset); - spin_unlock_irqrestore(&tp->lock, flags); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -240,21 +222,16 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); rtl8125_eeprom_write_sc(tp, my_cmd.offset, my_cmd.data); - spin_unlock_irqrestore(&tp->lock, flags); break; case RTL_READ_OOB_MAC: if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); rtl8125_oob_mutex_lock(tp); my_cmd.data = rtl8125_ocp_read(tp, my_cmd.offset, 4); rtl8125_oob_mutex_unlock(tp); - spin_unlock_irqrestore(&tp->lock, flags); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -268,20 +245,16 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (my_cmd.len == 0 || my_cmd.len > 4) return -EOPNOTSUPP; - spin_lock_irqsave(&tp->lock, flags); rtl8125_oob_mutex_lock(tp); rtl8125_ocp_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data); rtl8125_oob_mutex_unlock(tp); - spin_unlock_irqrestore(&tp->lock, flags); break; case RTL_ENABLE_PCI_DIAG: if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); tp->rtk_enable_diag = 1; - spin_unlock_irqrestore(&tp->lock, flags); dprintk("enable rtk diag\n"); break; @@ -290,9 +263,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); tp->rtk_enable_diag = 0; - spin_unlock_irqrestore(&tp->lock, flags); dprintk("disable rtk diag\n"); break; @@ -304,10 +275,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (my_cmd.offset % 2) return -EOPNOTSUPP; - spin_lock_irqsave(&tp->lock, flags); my_cmd.data = rtl8125_mac_ocp_read(tp, my_cmd.offset); - spin_unlock_irqrestore(&tp->lock, flags); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -321,19 +289,14 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if ((my_cmd.offset % 2) || (my_cmd.len != 2)) return -EOPNOTSUPP; - spin_lock_irqsave(&tp->lock, flags); rtl8125_mac_ocp_write(tp, my_cmd.offset, (u16)my_cmd.data); - spin_unlock_irqrestore(&tp->lock, flags); break; case RTL_DIRECT_READ_PHY_OCP: if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); my_cmd.data = rtl8125_mdio_prot_direct_read_phy_ocp(tp, my_cmd.offset); - spin_unlock_irqrestore(&tp->lock, flags); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -345,9 +308,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (!capable(CAP_NET_ADMIN)) return -EPERM; - spin_lock_irqsave(&tp->lock, flags); rtl8125_mdio_prot_direct_write_phy_ocp(tp, my_cmd.offset, my_cmd.data); - spin_unlock_irqrestore(&tp->lock, flags); break; default: diff --git a/package/kernel/r8168/Makefile b/package/kernel/r8168/Makefile index 569fad6135..9b63e52f99 100644 --- a/package/kernel/r8168/Makefile +++ b/package/kernel/r8168/Makefile @@ -7,13 +7,14 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=r8168 -PKG_VERSION:=8.049.01 -PKG_RELEASE:=1 +PKG_VERSION:=8.049.02 +PKG_RELEASE:=$(AUTORELEAE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/BROBIRD/openwrt-r8168.git -PKG_SOURCE_VERSION:=66fdc44a1f69c4fda18e6f922a234cbaa933ede6 -PKG_MIRROR_HASH:=a480cf9c70bbc3ee5d9b967e5006ff4fc9bba2bf38638fb2b7567f10b6f41bf3 +PKG_SOURCE_DATE:=2021-10-08 +PKG_SOURCE_VERSION:=2b969c15afe403a685fc7ee069620782241e3ad6 +PKG_MIRROR_HASH:=e4632c10d460f005eff76da8a183d7ff0c8819b0d099872589b7b06a9b8d9952 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/package/kernel/r8168/patches/001-r8168-add-LED-configuration-from-OF.patch b/package/kernel/r8168/patches/001-r8168-add-LED-configuration-from-OF.patch index 1094156883..096d271ffb 100644 --- a/package/kernel/r8168/patches/001-r8168-add-LED-configuration-from-OF.patch +++ b/package/kernel/r8168/patches/001-r8168-add-LED-configuration-from-OF.patch @@ -8,7 +8,7 @@ #include #include #include -@@ -23481,6 +23482,22 @@ rtl8168_set_bios_setting(struct net_device *dev) +@@ -23482,6 +23483,22 @@ rtl8168_set_bios_setting(struct net_devi } } @@ -31,7 +31,7 @@ static void rtl8168_init_software_variable(struct net_device *dev) { -@@ -23986,6 +24003,8 @@ rtl8168_init_software_variable(struct net_device *dev) +@@ -24000,6 +24017,8 @@ rtl8168_init_software_variable(struct ne tp->NotWrMcuPatchCode = TRUE; } diff --git a/package/network/ipv6/6rd/Makefile b/package/network/ipv6/6rd/Makefile index 9836ae9361..f9c4c6f7a5 100644 --- a/package/network/ipv6/6rd/Makefile +++ b/package/network/ipv6/6rd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=6rd -PKG_RELEASE:=10 +PKG_RELEASE:=11 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/ipv6/6rd/files/6rd.sh b/package/network/ipv6/6rd/files/6rd.sh index 62a20314d9..3c913e54f1 100644 --- a/package/network/ipv6/6rd/files/6rd.sh +++ b/package/network/ipv6/6rd/files/6rd.sh @@ -82,6 +82,8 @@ proto_6rd_setup() { proto_6rd_teardown() { local cfg="$1" + local link="6rd-$cfg" + ip link del $link } proto_6rd_init_config() { diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 8b6cf00a5d..47fb5e7d56 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -241,7 +241,7 @@ dhcp_subscrid_add() { config_get subscriberid "$cfg" subscriberid [ -n "$subscriberid" ] || return 0 - xappend "--dhcp-subscrid=$networkid,$subscriberid" + xappend "--dhcp-subscrid=set:$networkid,$subscriberid" config_get_bool force "$cfg" force 0 @@ -257,7 +257,7 @@ dhcp_remoteid_add() { config_get remoteid "$cfg" remoteid [ -n "$remoteid" ] || return 0 - xappend "--dhcp-remoteid=$networkid,$remoteid" + xappend "--dhcp-remoteid=set:$networkid,$remoteid" config_get_bool force "$cfg" force 0 @@ -274,7 +274,7 @@ dhcp_circuitid_add() { config_get circuitid "$cfg" circuitid [ -n "$circuitid" ] || return 0 - xappend "--dhcp-circuitid=$networkid,$circuitid" + xappend "--dhcp-circuitid=set:$networkid,$circuitid" config_get_bool force "$cfg" force 0 @@ -290,7 +290,7 @@ dhcp_userclass_add() { config_get userclass "$cfg" userclass [ -n "$userclass" ] || return 0 - xappend "--dhcp-userclass=$networkid,$userclass" + xappend "--dhcp-userclass=set:$networkid,$userclass" config_get_bool force "$cfg" force 0 @@ -307,7 +307,7 @@ dhcp_vendorclass_add() { config_get vendorclass "$cfg" vendorclass [ -n "$vendorclass" ] || return 0 - xappend "--dhcp-vendorclass=$networkid,$vendorclass" + xappend "--dhcp-vendorclass=set:$networkid,$vendorclass" config_get_bool force "$cfg" force 0 @@ -323,7 +323,7 @@ dhcp_match_add() { config_get match "$cfg" match [ -n "$match" ] || return 0 - xappend "--dhcp-match=$networkid,$match" + xappend "--dhcp-match=set:$networkid,$match" config_get_bool force "$cfg" force 0 diff --git a/package/network/utils/bpftools/patches/006-musl-120.patch b/package/network/utils/bpftools/patches/006-musl-120.patch new file mode 100644 index 0000000000..53be466f0b --- /dev/null +++ b/package/network/utils/bpftools/patches/006-musl-120.patch @@ -0,0 +1,20 @@ +--- a/tools/bpf/bpftool/btf_dumper.c ++++ b/tools/bpf/bpftool/btf_dumper.c +@@ -5,6 +5,7 @@ + #include /* for (FILE *) used by json_writer */ + #include + #include ++#include + #include + #include + #include +--- a/tools/bpf/bpftool/map_perf_ring.c ++++ b/tools/bpf/bpftool/map_perf_ring.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/package/network/utils/wireguard-tools/Makefile b/package/network/utils/wireguard-tools/Makefile index 11372f2331..0e460e7afb 100644 --- a/package/network/utils/wireguard-tools/Makefile +++ b/package/network/utils/wireguard-tools/Makefile @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=wireguard-tools -PKG_VERSION:=1.0.20210424 +PKG_VERSION:=1.0.20210914 PKG_RELEASE:=1 PKG_SOURCE:=wireguard-tools-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-tools/snapshot/ -PKG_HASH:=b288b0c43871d919629d7e77846ef0b47f8eeaa9ebc9cedeee8233fc6cc376ad +PKG_HASH:=97ff31489217bb265b7ae850d3d0f335ab07d2652ba1feec88b734bc96bd05ac PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/system/fstools/files/fstab.init b/package/system/fstools/files/fstab.init index 5289355114..484d868950 100755 --- a/package/system/fstools/files/fstab.init +++ b/package/system/fstools/files/fstab.init @@ -1,7 +1,9 @@ #!/bin/sh /etc/rc.common -# (C) 2013 openwrt.org +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2013-2020 OpenWrt.org -START=40 +START=11 boot() { /sbin/block mount diff --git a/package/system/fstools/patches/0020-add-define-for-GLOB_ONLYDIR.patch b/package/system/fstools/patches/0020-add-define-for-GLOB_ONLYDIR.patch new file mode 100644 index 0000000000..2208f1dff1 --- /dev/null +++ b/package/system/fstools/patches/0020-add-define-for-GLOB_ONLYDIR.patch @@ -0,0 +1,32 @@ +From 5345343828df944ae247d91cc77182f87559bc9a Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Wed, 25 Mar 2020 16:27:47 -0700 +Subject: [PATCH] fstoools: add define for GLOB_ONLYDIR + +This was originally a patch for musl. It is not present in musl as it is a +GNU extension. + +Place it here where it belongs. + +Signed-off-by: Rosen Penev +--- + libfstools/overlay.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libfstools/overlay.c b/libfstools/overlay.c +index 14214a3..39215d5 100644 +--- a/libfstools/overlay.c ++++ b/libfstools/overlay.c +@@ -30,6 +30,10 @@ + #include "libfstools.h" + #include "volume.h" + ++#ifndef GLOB_ONLYDIR ++#define GLOB_ONLYDIR 0x100 ++#endif ++ + #define SWITCH_JFFS2 "/tmp/.switch_jffs2" + + static bool keep_sysupgrade; +-- +2.20.1 diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 936aea5b71..5d34abfc24 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -5,14 +5,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox -PKG_VERSION:=1.34.0 +PKG_VERSION:=1.34.1 PKG_RELEASE:=$(AUTORELEASE) PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.busybox.net/downloads \ http://sources.buildroot.net -PKG_HASH:=ec8d1615edb045b83b81966604759c4d4ac921434ab4011da604f629c06074ce +PKG_HASH:=415fbd89e5344c96acf449d94a6f956dbed62e18e835fc83e064db33a34bd549 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 diff --git a/package/utils/busybox/patches/001-backport-fix-build-breakage-on-mips.patch b/package/utils/busybox/patches/001-backport-fix-build-breakage-on-mips.patch deleted file mode 100644 index 354e3e511a..0000000000 --- a/package/utils/busybox/patches/001-backport-fix-build-breakage-on-mips.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 00adcdb64a5487f0ea6b400d912dcf7c58637696 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Fri, 20 Aug 2021 13:33:50 +0200 -Subject: udhcp: fix build breakage on MIPS - -Signed-off-by: Denys Vlasenko ---- - networking/udhcp/common.h | 12 ------------ - 1 file changed, 12 deletions(-) - -diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h -index 8c678dd32..ca778dab8 100644 ---- a/networking/udhcp/common.h -+++ b/networking/udhcp/common.h -@@ -304,18 +304,6 @@ void udhcp_dump_packet(struct dhcp_packet *packet) FAST_FUNC; - # define log3s(msg) ((void)0) - #endif - --#if defined(__mips__) --/* -- * The 'simple' message functions have a negative impact on the size of the -- * DHCP code when compiled for MIPS, so don't use them in this case. -- */ --#define bb_simple_info_msg bb_info_msg --#define bb_simple_error_msg bb_error_msg --#define bb_simple_perror_msg_and_die bb_perror_msg_and_die --#undef log1s --#define log1s log1 --#endif -- - /*** Other shared functions ***/ - - /* 2nd param is "uint32_t*" */ --- -cgit v1.2.3 - - diff --git a/package/utils/busybox/patches/002-backport-ash-process-substitution.patch b/package/utils/busybox/patches/002-backport-ash-process-substitution.patch deleted file mode 100644 index 5b348ea26b..0000000000 --- a/package/utils/busybox/patches/002-backport-ash-process-substitution.patch +++ /dev/null @@ -1,77 +0,0 @@ -Stacy Harper reports that this script: - - test() { . /tmp/bb_test; } - echo "export TEST=foo" >/tmp/bb_test - test 2>/dev/null - echo "$TEST" - -correctly prints 'foo' in BusyBox 1.33 but hangs in 1.34. - -Bisection suggested the problem was caused by commit a1b0d3856 (ash: add -process substitution in bash-compatibility mode). Removing the call to -unwindredir() in cmdloop() introduced in that commit makes the script -work again. - -Additionally, these examples of process substitution: - - while true; do cat <(echo hi); done - f() { while true; do cat <(echo hi); done } - f - -result in running out of file descriptors. This is a regression from -v5 of the process substitution patch caused by changes to evalcommand() -not being transferred to v6. - -function old new delta -static.pushredir - 99 +99 -evalcommand 1729 1750 +21 -exitreset 69 86 +17 -cmdloop 372 365 -7 -unwindredir 28 - -28 -pushredir 112 - -112 ------------------------------------------------------------------------------- -(add/remove: 1/2 grow/shrink: 2/1 up/down: 137/-147) Total: -10 bytes - -Signed-off-by: Ron Yorston ---- - shell/ash.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/shell/ash.c b/shell/ash.c -index b5947147a..53c140930 100644 ---- a/shell/ash.c -+++ b/shell/ash.c -@@ -10278,6 +10278,9 @@ evalcommand(union node *cmd, int flags) - - /* First expand the arguments. */ - TRACE(("evalcommand(0x%lx, %d) called\n", (long)cmd, flags)); -+#if BASH_PROCESS_SUBST -+ redir_stop = redirlist; -+#endif - file_stop = g_parsefile; - back_exitstatus = 0; - -@@ -10356,7 +10359,11 @@ evalcommand(union node *cmd, int flags) - lastarg = nargv[-1]; - - expredir(cmd->ncmd.redirect); -+#if !BASH_PROCESS_SUBST - redir_stop = pushredir(cmd->ncmd.redirect); -+#else -+ pushredir(cmd->ncmd.redirect); -+#endif - preverrout_fd = 2; - if (BASH_XTRACEFD && xflag) { - /* NB: bash closes fd == $BASH_XTRACEFD when it is changed. -@@ -13476,9 +13483,6 @@ cmdloop(int top) - #if JOBS - if (doing_jobctl) - showjobs(SHOW_CHANGED|SHOW_STDERR); --#endif --#if BASH_PROCESS_SUBST -- unwindredir(NULL); - #endif - inter = 0; - if (iflag && top) { --- -2.31.1 diff --git a/target/sdk/files/Config.in b/target/sdk/files/Config.in index abf5b70fae..f687992497 100644 --- a/target/sdk/files/Config.in +++ b/target/sdk/files/Config.in @@ -102,7 +102,7 @@ menu "Advanced configuration options (for developers)" config CCACHE bool "Use ccache" - default y + default n help Compiler cache; see https://ccache.samba.org/ diff --git a/toolchain/musl/common.mk b/toolchain/musl/common.mk index 68098f5c6a..0f42a9eb60 100644 --- a/toolchain/musl/common.mk +++ b/toolchain/musl/common.mk @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/target.mk PKG_NAME:=musl -PKG_VERSION:=1.1.24 -PKG_RELEASE:=3 +PKG_VERSION:=1.2.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://musl.libc.org/releases/ -PKG_HASH:=1370c9a812b2cf2a7d92802510cca0058cc37e66a7bedd70051f0a34015022a3 +PKG_HASH:=9b969322012d796dc23dda27a35866034fa67d8fb67e0e2c45c913c3d43219dd LIBC_SO_VERSION:=$(PKG_VERSION) PATCH_DIR:=$(PATH_PREFIX)/patches diff --git a/toolchain/musl/include/bits/wordsize.h b/toolchain/musl/include/bits/wordsize.h deleted file mode 100644 index 2d4cbe8317..0000000000 --- a/toolchain/musl/include/bits/wordsize.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/toolchain/musl/include/features.h b/toolchain/musl/include/features.h deleted file mode 100644 index edb8cc72d4..0000000000 --- a/toolchain/musl/include/features.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _FEATURES_H -#define _FEATURES_H - -#ifdef _ALL_SOURCE -#define _GNU_SOURCE 1 -#endif - -#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \ - && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \ - && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__) -#define _BSD_SOURCE 1 -#define _XOPEN_SOURCE 700 -#endif - -#if __STDC_VERSION__ >= 199901L -#define __restrict restrict -#elif !defined(__GNUC__) -#define __restrict -#endif - -#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) -#define __inline inline -#endif - -#if __STDC_VERSION__ >= 201112L -#elif defined(__GNUC__) -#define _Noreturn __attribute__((__noreturn__)) -#else -#define _Noreturn -#endif - -/* Convenience macros to test the versions of glibc and gcc. - Use them like this: - #if __GNUC_PREREQ (2,8) - ... code requiring gcc 2.8 or later ... - #endif - Note - they won't work for gcc1 or glibc1, since the _MINOR macros - were not defined then. */ -#if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -#else -# define __GNUC_PREREQ(maj, min) 0 -#endif - -#include - -#endif diff --git a/toolchain/musl/include/sgidefs.h b/toolchain/musl/include/sgidefs.h deleted file mode 100644 index 74509fdbd0..0000000000 --- a/toolchain/musl/include/sgidefs.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (C) 1996, 1997, 1998, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ralf Baechle . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SGIDEFS_H -#define _SGIDEFS_H 1 - -/* - * A crude hack to stop - */ -#undef __ASM_SGIDEFS_H -#define __ASM_SGIDEFS_H - -/* - * And remove any damage it might have already done - */ -#undef _MIPS_ISA_MIPS1 -#undef _MIPS_ISA_MIPS2 -#undef _MIPS_ISA_MIPS3 -#undef _MIPS_ISA_MIPS4 -#undef _MIPS_ISA_MIPS5 -#undef _MIPS_ISA_MIPS32 -#undef _MIPS_ISA_MIPS64 - -#undef _MIPS_SIM_ABI32 -#undef _MIPS_SIM_NABI32 -#undef _MIPS_SIM_ABI64 - -/* - * Definitions for the ISA level - */ -#define _MIPS_ISA_MIPS1 1 -#define _MIPS_ISA_MIPS2 2 -#define _MIPS_ISA_MIPS3 3 -#define _MIPS_ISA_MIPS4 4 -#define _MIPS_ISA_MIPS5 5 -#define _MIPS_ISA_MIPS32 6 -#define _MIPS_ISA_MIPS64 7 - -/* - * Subprogram calling convention - */ -#ifndef _ABIO32 -# define _ABIO32 1 -#endif -#define _MIPS_SIM_ABI32 _ABIO32 - -#ifndef _ABIN32 -# define _ABIN32 2 -#endif -#define _MIPS_SIM_NABI32 _ABIN32 - -#ifndef _ABI64 -# define _ABI64 3 -#endif -#define _MIPS_SIM_ABI64 _ABI64 - -#endif /* sgidefs.h */ diff --git a/toolchain/musl/include/sys/cdefs.h b/toolchain/musl/include/sys/cdefs.h deleted file mode 100644 index e9866700d0..0000000000 --- a/toolchain/musl/include/sys/cdefs.h +++ /dev/null @@ -1,378 +0,0 @@ -/* Copyright (C) 1992-2002, 2004, 2005, 2006, 2007, 2009, 2011, 2012 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_CDEFS_H -#define _SYS_CDEFS_H 1 - -/* We are almost always included from features.h. */ -#ifndef _FEATURES_H -# include -#endif - -/* The GNU libc does not support any K&R compilers or the traditional mode - of ISO C compilers anymore. Check for some of the combinations not - anymore supported. */ -#if defined __GNUC__ && !defined __STDC__ -# error "You need a ISO C conforming compiler to use the glibc headers" -#endif - -/* Some user header file might have defined this before. */ -#undef __P -#undef __PMT - -#ifdef __GNUC__ - -/* All functions, except those with callbacks or those that - synchronize memory, are leaf functions. */ -# if __GNUC_PREREQ (4, 6) && !defined _LIBC -# define __LEAF , __leaf__ -# define __LEAF_ATTR __attribute__ ((__leaf__)) -# else -# define __LEAF -# define __LEAF_ATTR -# endif - -/* GCC can always grok prototypes. For C++ programs we add throw() - to help it optimize the function calls. But this works only with - gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions - as non-throwing using a function attribute since programs can use - the -fexceptions options for C code as well. */ -# if !defined __cplusplus && __GNUC_PREREQ (3, 3) -# define __THROW __attribute__ ((__nothrow__ __LEAF)) -# define __THROWNL __attribute__ ((__nothrow__)) -# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct -# else -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# define __THROWNL throw () -# define __NTH(fct) __LEAF_ATTR fct throw () -# else -# define __THROW -# define __THROWNL -# define __NTH(fct) fct -# endif -# endif - -#else /* Not GCC. */ - -# define __inline /* No inline functions. */ - -# define __THROW -# define __THROWNL -# define __NTH(fct) fct - -#endif /* GCC. */ - -/* These two macros are not used in glibc anymore. They are kept here - only because some other projects expect the macros to be defined. */ -#define __P(args) args -#define __PMT(args) args - -/* For these things, GCC behaves the ANSI way normally, - and the non-ANSI way under -traditional. */ - -#define __CONCAT(x,y) x ## y -#define __STRING(x) #x - -/* This is not a typedef so `const __ptr_t' does the right thing. */ -#define __ptr_t void * -#define __long_double_t long double - - -/* C++ needs to know that types and declarations are C, not C++. */ -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS -# define __END_DECLS -#endif - - -/* The standard library needs the functions from the ISO C90 standard - in the std namespace. At the same time we want to be safe for - future changes and we include the ISO C99 code in the non-standard - namespace __c99. The C++ wrapper header take case of adding the - definitions to the global namespace. */ -#if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES -# define __BEGIN_NAMESPACE_STD namespace std { -# define __END_NAMESPACE_STD } -# define __USING_NAMESPACE_STD(name) using std::name; -# define __BEGIN_NAMESPACE_C99 namespace __c99 { -# define __END_NAMESPACE_C99 } -# define __USING_NAMESPACE_C99(name) using __c99::name; -#else -/* For compatibility we do not add the declarations into any - namespace. They will end up in the global namespace which is what - old code expects. */ -# define __BEGIN_NAMESPACE_STD -# define __END_NAMESPACE_STD -# define __USING_NAMESPACE_STD(name) -# define __BEGIN_NAMESPACE_C99 -# define __END_NAMESPACE_C99 -# define __USING_NAMESPACE_C99(name) -#endif - - -/* Support for bounded pointers. */ -#ifndef __BOUNDED_POINTERS__ -# define __bounded /* nothing */ -# define __unbounded /* nothing */ -# define __ptrvalue /* nothing */ -#endif - - -/* Fortify support. */ -#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) -#define __bos0(ptr) __builtin_object_size (ptr, 0) -#define __fortify_function __extern_always_inline __attribute_artificial__ - -#if __GNUC_PREREQ (4,3) -# define __warndecl(name, msg) \ - extern void name (void) __attribute__((__warning__ (msg))) -# define __warnattr(msg) __attribute__((__warning__ (msg))) -# define __errordecl(name, msg) \ - extern void name (void) __attribute__((__error__ (msg))) -#else -# define __warndecl(name, msg) extern void name (void) -# define __warnattr(msg) -# define __errordecl(name, msg) extern void name (void) -#endif - -/* Support for flexible arrays. */ -#if __GNUC_PREREQ (2,97) -/* GCC 2.97 supports C99 flexible array members. */ -# define __flexarr [] -#else -# ifdef __GNUC__ -# define __flexarr [0] -# else -# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -# define __flexarr [] -# else -/* Some other non-C99 compiler. Approximate with [1]. */ -# define __flexarr [1] -# endif -# endif -#endif - - -/* __asm__ ("xyz") is used throughout the headers to rename functions - at the assembly language level. This is wrapped by the __REDIRECT - macro, in order to support compilers that can do this some other - way. When compilers don't support asm-names at all, we have to do - preprocessor tricks instead (which don't have exactly the right - semantics, but it's the best we can do). - - Example: - int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ - -#if defined __GNUC__ && __GNUC__ >= 2 - -# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) -# ifdef __cplusplus -# define __REDIRECT_NTH(name, proto, alias) \ - name proto __THROW __asm__ (__ASMNAME (#alias)) -# define __REDIRECT_NTHNL(name, proto, alias) \ - name proto __THROWNL __asm__ (__ASMNAME (#alias)) -# else -# define __REDIRECT_NTH(name, proto, alias) \ - name proto __asm__ (__ASMNAME (#alias)) __THROW -# define __REDIRECT_NTHNL(name, proto, alias) \ - name proto __asm__ (__ASMNAME (#alias)) __THROWNL -# endif -# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) -# define __ASMNAME2(prefix, cname) __STRING (prefix) cname - -/* -#elif __SOME_OTHER_COMPILER__ - -# define __REDIRECT(name, proto, alias) name proto; \ - _Pragma("let " #name " = " #alias) -*/ -#endif - -/* GCC has various useful declarations that can be made with the - `__attribute__' syntax. All of the ways we use this do fine if - they are omitted for compilers that don't understand it. */ -#if !defined __GNUC__ || __GNUC__ < 2 -# define __attribute__(xyz) /* Ignore */ -#endif - -/* At some point during the gcc 2.96 development the `malloc' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,96) -# define __attribute_malloc__ __attribute__ ((__malloc__)) -#else -# define __attribute_malloc__ /* Ignore */ -#endif - -/* At some point during the gcc 2.96 development the `pure' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,96) -# define __attribute_pure__ __attribute__ ((__pure__)) -#else -# define __attribute_pure__ /* Ignore */ -#endif - -/* This declaration tells the compiler that the value is constant. */ -#if __GNUC_PREREQ (2,5) -# define __attribute_const__ __attribute__ ((__const__)) -#else -# define __attribute_const__ /* Ignore */ -#endif - -/* At some point during the gcc 3.1 development the `used' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (3,1) -# define __attribute_used__ __attribute__ ((__used__)) -# define __attribute_noinline__ __attribute__ ((__noinline__)) -#else -# define __attribute_used__ __attribute__ ((__unused__)) -# define __attribute_noinline__ /* Ignore */ -#endif - -/* gcc allows marking deprecated functions. */ -#if __GNUC_PREREQ (3,2) -# define __attribute_deprecated__ __attribute__ ((__deprecated__)) -#else -# define __attribute_deprecated__ /* Ignore */ -#endif - -/* At some point during the gcc 2.8 development the `format_arg' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. - If several `format_arg' attributes are given for the same function, in - gcc-3.0 and older, all but the last one are ignored. In newer gccs, - all designated arguments are considered. */ -#if __GNUC_PREREQ (2,8) -# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) -#else -# define __attribute_format_arg__(x) /* Ignore */ -#endif - -/* At some point during the gcc 2.97 development the `strfmon' format - attribute for functions was introduced. We don't want to use it - unconditionally (although this would be possible) since it - generates warnings. */ -#if __GNUC_PREREQ (2,97) -# define __attribute_format_strfmon__(a,b) \ - __attribute__ ((__format__ (__strfmon__, a, b))) -#else -# define __attribute_format_strfmon__(a,b) /* Ignore */ -#endif - -/* The nonull function attribute allows to mark pointer parameters which - must not be NULL. */ -#if __GNUC_PREREQ (3,3) -# define __nonnull(params) __attribute__ ((__nonnull__ params)) -#else -# define __nonnull(params) -#endif - -/* If fortification mode, we warn about unused results of certain - function calls which can lead to problems. */ -#if __GNUC_PREREQ (3,4) -# define __attribute_warn_unused_result__ \ - __attribute__ ((__warn_unused_result__)) -# if __USE_FORTIFY_LEVEL > 0 -# define __wur __attribute_warn_unused_result__ -# endif -#else -# define __attribute_warn_unused_result__ /* empty */ -#endif -#ifndef __wur -# define __wur /* Ignore */ -#endif - -/* Forces a function to be always inlined. */ -#if __GNUC_PREREQ (3,2) -# define __always_inline __inline __attribute__ ((__always_inline__)) -#else -# define __always_inline __inline -#endif - -/* Associate error messages with the source location of the call site rather - than with the source location inside the function. */ -#if __GNUC_PREREQ (4,3) -# define __attribute_artificial__ __attribute__ ((__artificial__)) -#else -# define __attribute_artificial__ /* Ignore */ -#endif - -/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 - inline semantics, unless -fgnu89-inline is used. */ -#if !defined __cplusplus || __GNUC_PREREQ (4,3) -# if defined __GNUC_STDC_INLINE__ || defined __cplusplus -# define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) -# define __extern_always_inline \ - extern __always_inline __attribute__ ((__gnu_inline__)) -# else -# define __extern_inline extern __inline -# define __extern_always_inline extern __always_inline -# endif -#endif - -/* GCC 4.3 and above allow passing all anonymous arguments of an - __extern_always_inline function to some other vararg function. */ -#if __GNUC_PREREQ (4,3) -# define __va_arg_pack() __builtin_va_arg_pack () -# define __va_arg_pack_len() __builtin_va_arg_pack_len () -#endif - -/* It is possible to compile containing GCC extensions even if GCC is - run in pedantic mode if the uses are carefully marked using the - `__extension__' keyword. But this is not generally available before - version 2.8. */ -#if !__GNUC_PREREQ (2,8) -# define __extension__ /* Ignore */ -#endif - -/* __restrict is known in EGCS 1.2 and above. */ -#if !__GNUC_PREREQ (2,92) -# define __restrict /* Ignore */ -#endif - -/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is - array_name[restrict] - GCC 3.1 supports this. */ -#if __GNUC_PREREQ (3,1) && !defined __GNUG__ -# define __restrict_arr __restrict -#else -# ifdef __GNUC__ -# define __restrict_arr /* Not supported in old GCC. */ -# else -# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -# define __restrict_arr restrict -# else -/* Some other non-C99 compiler. */ -# define __restrict_arr /* Not supported. */ -# endif -# endif -#endif - -#if __GNUC__ >= 3 -# define __glibc_unlikely(cond) __builtin_expect((cond), 0) -#else -# define __glibc_unlikely(cond) (cond) -#endif - -#endif /* sys/cdefs.h */ diff --git a/toolchain/musl/include/sys/glibc-types.h b/toolchain/musl/include/sys/glibc-types.h deleted file mode 100644 index fa0684ced2..0000000000 --- a/toolchain/musl/include/sys/glibc-types.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __MUSL_GLIBC_TYPES_H -#define __MUSL_GLIBC_TYPES_H - -#include - -/* Convenience types. */ -typedef unsigned char __u_char; -typedef unsigned short int __u_short; -typedef unsigned int __u_int; -typedef unsigned long int __u_long; - -/* Fixed-size types, underlying types depend on word size and compiler. */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef signed short int __int16_t; -typedef unsigned short int __uint16_t; -typedef signed int __int32_t; -typedef unsigned int __uint32_t; -#if __WORDSIZE == 64 -typedef signed long int __int64_t; -typedef unsigned long int __uint64_t; -#else -__extension__ typedef signed long long int __int64_t; -__extension__ typedef unsigned long long int __uint64_t; -#endif - -#define __off64_t off_t -#define __loff_t off_t -typedef char *__caddr_t; -#define __locale_t locale_t - -#define __gid_t gid_t -#define __uid_t uid_t - -#endif diff --git a/toolchain/musl/patches/100-add_glob_onlydir.patch b/toolchain/musl/patches/100-add_glob_onlydir.patch deleted file mode 100644 index a784e770df..0000000000 --- a/toolchain/musl/patches/100-add_glob_onlydir.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/glob.h -+++ b/include/glob.h -@@ -34,6 +34,8 @@ void globfree(glob_t *); - #define GLOB_TILDE 0x1000 - #define GLOB_TILDE_CHECK 0x4000 - -+#define GLOB_ONLYDIR 0x100 -+ - #define GLOB_NOSPACE 1 - #define GLOB_ABORTED 2 - #define GLOB_NOMATCH 3 diff --git a/toolchain/musl/patches/110-read_timezone_from_fs.patch b/toolchain/musl/patches/110-read_timezone_from_fs.patch index f92781f7ed..a1f54db551 100644 --- a/toolchain/musl/patches/110-read_timezone_from_fs.patch +++ b/toolchain/musl/patches/110-read_timezone_from_fs.patch @@ -1,6 +1,6 @@ --- a/src/time/__tz.c +++ b/src/time/__tz.c -@@ -25,6 +25,9 @@ static int r0[5], r1[5]; +@@ -31,6 +31,9 @@ static int r0[5], r1[5]; static const unsigned char *zi, *trans, *index, *types, *abbrevs, *abbrevs_end; static size_t map_size; @@ -10,7 +10,7 @@ static char old_tz_buf[32]; static char *old_tz = old_tz_buf; static size_t old_tz_size = sizeof old_tz_buf; -@@ -125,6 +128,15 @@ static void do_tzset() +@@ -132,6 +135,15 @@ static void do_tzset() "/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0"; s = getenv("TZ"); diff --git a/toolchain/musl/patches/200-add_libssp_nonshared.patch b/toolchain/musl/patches/200-add_libssp_nonshared.patch index 05bd2fe54a..26a9bfebea 100644 --- a/toolchain/musl/patches/200-add_libssp_nonshared.patch +++ b/toolchain/musl/patches/200-add_libssp_nonshared.patch @@ -7,7 +7,7 @@ Signed-off-by: Steven Barth --- a/Makefile +++ b/Makefile -@@ -66,7 +66,7 @@ CRT_LIBS = $(addprefix lib/,$(notdir $(C +@@ -67,7 +67,7 @@ CRT_LIBS = $(addprefix lib/,$(notdir $(C STATIC_LIBS = lib/libc.a SHARED_LIBS = lib/libc.so TOOL_LIBS = lib/musl-gcc.specs @@ -16,7 +16,7 @@ Signed-off-by: Steven Barth ALL_TOOLS = obj/musl-gcc WRAPCC_GCC = gcc -@@ -86,7 +86,7 @@ else +@@ -88,7 +88,7 @@ else all: $(ALL_LIBS) $(ALL_TOOLS) @@ -25,7 +25,7 @@ Signed-off-by: Steven Barth $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(ALL_OBJS:%.o=%.lo) $(GENH) $(GENH_INT): | $(OBJ_DIRS) -@@ -113,6 +113,8 @@ obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart. +@@ -115,6 +115,8 @@ obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart. obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC @@ -34,7 +34,7 @@ Signed-off-by: Steven Barth OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%)) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3 -@@ -165,6 +167,11 @@ lib/libc.a: $(AOBJS) +@@ -167,6 +169,11 @@ lib/libc.a: $(AOBJS) $(AR) rc $@ $(AOBJS) $(RANLIB) $@ diff --git a/toolchain/musl/patches/300-relative.patch b/toolchain/musl/patches/300-relative.patch index e34e60a09d..7e1eb7d6bc 100644 --- a/toolchain/musl/patches/300-relative.patch +++ b/toolchain/musl/patches/300-relative.patch @@ -1,6 +1,6 @@ --- a/Makefile +++ b/Makefile -@@ -215,7 +215,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc +@@ -217,7 +217,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc $(INSTALL) -D -m 644 $< $@ $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so diff --git a/toolchain/musl/patches/400-Add-format-attribute-to-some-function-declarations.patch b/toolchain/musl/patches/400-Add-format-attribute-to-some-function-declarations.patch deleted file mode 100644 index 06aeb34ced..0000000000 --- a/toolchain/musl/patches/400-Add-format-attribute-to-some-function-declarations.patch +++ /dev/null @@ -1,197 +0,0 @@ -From e6683d001a95d7c3d4d992496f00f77e01fcd268 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 22 Nov 2015 15:04:23 +0100 -Subject: [PATCH v2] Add format attribute to some function declarations - -GCC and Clang are able to check the format arguments given to a -function and warn the user if there is a error in the format arguments -or if there is a potential uncontrolled format string security problem -in the code. GCC does this automatically for some functions like -printf(), but it is also possible to annotate other functions in a way -that it will check them too. This feature is used by glibc for many -functions. This patch adds the attribute to the some functions of musl -expect for these functions where gcc automatically adds it. - -GCC automatically adds checks for these functions: printf, fprintf, -sprintf, scanf, fscanf, sscanf, strftime, vprintf, vfprintf and -vsprintf. - -The documentation from gcc is here: -https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html - -The documentation from Clang is here: -http://clang.llvm.org/docs/AttributeReference.html#format-gnu-format - -Signed-off-by: Hauke Mehrtens ---- - include/err.h | 26 +++++++++++++++++--------- - include/monetary.h | 12 ++++++++++-- - include/stdio.h | 29 ++++++++++++++++++++--------- - include/syslog.h | 12 ++++++++++-- - 4 files changed, 57 insertions(+), 22 deletions(-) - ---- a/include/err.h -+++ b/include/err.h -@@ -8,15 +8,23 @@ - extern "C" { - #endif - --void warn(const char *, ...); --void vwarn(const char *, va_list); --void warnx(const char *, ...); --void vwarnx(const char *, va_list); -+#if __GNUC__ >= 3 -+#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y))) -+#else -+#define __fp(x, y) -+#endif -+ -+void warn(const char *, ...) __fp(1, 2); -+void vwarn(const char *, va_list) __fp(1, 0); -+void warnx(const char *, ...) __fp(1, 2); -+void vwarnx(const char *, va_list) __fp(1, 0); -+ -+_Noreturn void err(int, const char *, ...) __fp(2, 3); -+_Noreturn void verr(int, const char *, va_list) __fp(2, 0); -+_Noreturn void errx(int, const char *, ...) __fp(2, 3); -+_Noreturn void verrx(int, const char *, va_list) __fp(2, 0); - --_Noreturn void err(int, const char *, ...); --_Noreturn void verr(int, const char *, va_list); --_Noreturn void errx(int, const char *, ...); --_Noreturn void verrx(int, const char *, va_list); -+#undef __fp - - #ifdef __cplusplus - } ---- a/include/monetary.h -+++ b/include/monetary.h -@@ -13,8 +13,16 @@ extern "C" { - - #include - --ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...); --ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...); -+#if __GNUC__ >= 3 -+#define __fsfm(x, y) __attribute__ ((__format__ (__strfmon__, x, y))) -+#else -+#define __fsfm(x, y) -+#endif -+ -+ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...) __fsfm(3, 4); -+ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...) __fsfm(4, 5); -+ -+#undef __fsfm - - #ifdef __cplusplus - } ---- a/include/stdio.h -+++ b/include/stdio.h -@@ -25,6 +25,14 @@ extern "C" { - - #include - -+#if __GNUC__ >= 3 -+#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y))) -+#define __fs(x, y) __attribute__ ((__format__ (__scanf__, x, y))) -+#else -+#define __fp(x, y) -+#define __fs(x, y) -+#endif -+ - #ifdef __cplusplus - #define NULL 0L - #else -@@ -107,19 +115,19 @@ int puts(const char *); - int printf(const char *__restrict, ...); - int fprintf(FILE *__restrict, const char *__restrict, ...); - int sprintf(char *__restrict, const char *__restrict, ...); --int snprintf(char *__restrict, size_t, const char *__restrict, ...); -+int snprintf(char *__restrict, size_t, const char *__restrict, ...) __fp(3, 4); - - int vprintf(const char *__restrict, __isoc_va_list); - int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list); - int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list); --int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list); -+int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list) __fp(3, 0); - - int scanf(const char *__restrict, ...); - int fscanf(FILE *__restrict, const char *__restrict, ...); - int sscanf(const char *__restrict, const char *__restrict, ...); --int vscanf(const char *__restrict, __isoc_va_list); --int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list); --int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list); -+int vscanf(const char *__restrict, __isoc_va_list) __fs(1, 0); -+int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list) __fs(2, 0); -+int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list) __fs(2, 0); - - void perror(const char *); - -@@ -140,8 +148,8 @@ int pclose(FILE *); - int fileno(FILE *); - int fseeko(FILE *, off_t, int); - off_t ftello(FILE *); --int dprintf(int, const char *__restrict, ...); --int vdprintf(int, const char *__restrict, __isoc_va_list); -+int dprintf(int, const char *__restrict, ...) __fp(2, 3); -+int vdprintf(int, const char *__restrict, __isoc_va_list) __fp(2, 0); - void flockfile(FILE *); - int ftrylockfile(FILE *); - void funlockfile(FILE *); -@@ -180,8 +188,8 @@ int fileno_unlocked(FILE *); - int getw(FILE *); - int putw(int, FILE *); - char *fgetln(FILE *, size_t *); --int asprintf(char **, const char *, ...); --int vasprintf(char **, const char *, __isoc_va_list); -+int asprintf(char **, const char *, ...) __fp(2, 3); -+int vasprintf(char **, const char *, __isoc_va_list) __fp(2, 0); - #endif - - #ifdef _GNU_SOURCE -@@ -203,6 +211,9 @@ typedef struct _IO_cookie_io_functions_t - FILE *fopencookie(void *, const char *, cookie_io_functions_t); - #endif - -+#undef __fp -+#undef __fs -+ - #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) - #define tmpfile64 tmpfile - #define fopen64 fopen ---- a/include/syslog.h -+++ b/include/syslog.h -@@ -56,16 +56,22 @@ extern "C" { - #define LOG_NOWAIT 0x10 - #define LOG_PERROR 0x20 - -+#if __GNUC__ >= 3 -+#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y))) -+#else -+#define __fp(x, y) -+#endif -+ - void closelog (void); - void openlog (const char *, int, int); - int setlogmask (int); --void syslog (int, const char *, ...); -+void syslog (int, const char *, ...) __fp(2, 3); - - #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) - #define _PATH_LOG "/dev/log" - #define __NEED_va_list - #include --void vsyslog (int, const char *, va_list); -+void vsyslog (int, const char *, va_list) __fp(2, 0); - #if defined(SYSLOG_NAMES) - #define INTERNAL_NOPRI 0x10 - #define INTERNAL_MARK (LOG_NFACILITIES<<3) -@@ -93,6 +99,8 @@ typedef struct { - #endif - #endif - -+#undef __fp -+ - #ifdef __cplusplus - } - #endif diff --git a/toolchain/musl/patches/500-0001-reorder-thread-list-unlink-in-pthread_exit-after-all.patch b/toolchain/musl/patches/500-0001-reorder-thread-list-unlink-in-pthread_exit-after-all.patch deleted file mode 100644 index d47f2f4108..0000000000 --- a/toolchain/musl/patches/500-0001-reorder-thread-list-unlink-in-pthread_exit-after-all.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 4d5aa20a94a2d3fae3e69289dc23ecafbd0c16c4 Mon Sep 17 00:00:00 2001 -From: Rich Felker -Date: Fri, 22 May 2020 17:35:14 -0400 -Subject: [PATCH 1/4] reorder thread list unlink in pthread_exit after all - locks - -since the backend for LOCK() skips locking if single-threaded, it's -unsafe to make the process appear single-threaded before the last use -of lock. - -this fixes potential unsynchronized access to a linked list via -__dl_thread_cleanup. ---- - src/thread/pthread_create.c | 19 +++++++++++-------- - 1 file changed, 11 insertions(+), 8 deletions(-) - ---- a/src/thread/pthread_create.c -+++ b/src/thread/pthread_create.c -@@ -90,14 +90,7 @@ _Noreturn void __pthread_exit(void *resu - exit(0); - } - -- /* At this point we are committed to thread termination. Unlink -- * the thread from the list. This change will not be visible -- * until the lock is released, which only happens after SYS_exit -- * has been called, via the exit futex address pointing at the lock. */ -- libc.threads_minus_1--; -- self->next->prev = self->prev; -- self->prev->next = self->next; -- self->prev = self->next = self; -+ /* At this point we are committed to thread termination. */ - - /* Process robust list in userspace to handle non-pshared mutexes - * and the detached thread case where the robust list head will -@@ -121,6 +114,16 @@ _Noreturn void __pthread_exit(void *resu - __do_orphaned_stdio_locks(); - __dl_thread_cleanup(); - -+ /* Last, unlink thread from the list. This change will not be visible -+ * until the lock is released, which only happens after SYS_exit -+ * has been called, via the exit futex address pointing at the lock. -+ * This needs to happen after any possible calls to LOCK() that might -+ * skip locking if libc.threads_minus_1 is zero. */ -+ libc.threads_minus_1--; -+ self->next->prev = self->prev; -+ self->prev->next = self->next; -+ self->prev = self->next = self; -+ - /* This atomic potentially competes with a concurrent pthread_detach - * call; the loser is responsible for freeing thread resources. */ - int state = a_cas(&self->detach_state, DT_JOINABLE, DT_EXITING); diff --git a/toolchain/musl/patches/500-0002-don-t-use-libc.threads_minus_1-as-relaxed-atomic-for.patch b/toolchain/musl/patches/500-0002-don-t-use-libc.threads_minus_1-as-relaxed-atomic-for.patch deleted file mode 100644 index 4ca51b0be0..0000000000 --- a/toolchain/musl/patches/500-0002-don-t-use-libc.threads_minus_1-as-relaxed-atomic-for.patch +++ /dev/null @@ -1,69 +0,0 @@ -From e01b5939b38aea5ecbe41670643199825874b26c Mon Sep 17 00:00:00 2001 -From: Rich Felker -Date: Thu, 21 May 2020 23:32:45 -0400 -Subject: [PATCH 2/4] don't use libc.threads_minus_1 as relaxed atomic for - skipping locks - -after all but the last thread exits, the next thread to observe -libc.threads_minus_1==0 and conclude that it can skip locking fails to -synchronize with any changes to memory that were made by the -last-exiting thread. this can produce data races. - -on some archs, at least x86, memory synchronization is unlikely to be -a problem; however, with the inline locks in malloc, skipping the lock -also eliminated the compiler barrier, and caused code that needed to -re-check chunk in-use bits after obtaining the lock to reuse a stale -value, possibly from before the process became single-threaded. this -in turn produced corruption of the heap state. - -some uses of libc.threads_minus_1 remain, especially for allocation of -new TLS in the dynamic linker; otherwise, it could be removed -entirely. it's made non-volatile to reflect that the remaining -accesses are only made under lock on the thread list. - -instead of libc.threads_minus_1, libc.threaded is now used for -skipping locks. the difference is that libc.threaded is permanently -true once an additional thread has been created. this will produce -some performance regression in processes that are mostly -single-threaded but occasionally creating threads. in the future it -may be possible to bring back the full lock-skipping, but more care -needs to be taken to produce a safe design. ---- - src/internal/libc.h | 2 +- - src/malloc/malloc.c | 2 +- - src/thread/__lock.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - ---- a/src/internal/libc.h -+++ b/src/internal/libc.h -@@ -21,7 +21,7 @@ struct __libc { - int can_do_threads; - int threaded; - int secure; -- volatile int threads_minus_1; -+ int threads_minus_1; - size_t *auxv; - struct tls_module *tls_head; - size_t tls_size, tls_align, tls_cnt; ---- a/src/malloc/malloc.c -+++ b/src/malloc/malloc.c -@@ -26,7 +26,7 @@ int __malloc_replaced; - - static inline void lock(volatile int *lk) - { -- if (libc.threads_minus_1) -+ if (libc.threaded) - while(a_swap(lk, 1)) __wait(lk, lk+1, 1, 1); - } - ---- a/src/thread/__lock.c -+++ b/src/thread/__lock.c -@@ -18,7 +18,7 @@ - - void __lock(volatile int *l) - { -- if (!libc.threads_minus_1) return; -+ if (!libc.threaded) return; - /* fast path: INT_MIN for the lock, +1 for the congestion */ - int current = a_cas(l, 0, INT_MIN + 1); - if (!current) return; diff --git a/toolchain/musl/patches/500-0003-cut-down-size-of-some-libc-struct-members.patch b/toolchain/musl/patches/500-0003-cut-down-size-of-some-libc-struct-members.patch deleted file mode 100644 index 6650434397..0000000000 --- a/toolchain/musl/patches/500-0003-cut-down-size-of-some-libc-struct-members.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f12888e9eb9eed60cc266b899dcafecb4752964a Mon Sep 17 00:00:00 2001 -From: Rich Felker -Date: Fri, 22 May 2020 17:25:38 -0400 -Subject: [PATCH 3/4] cut down size of some libc struct members - -these are all flags that can be single-byte values. ---- - src/internal/libc.h | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/src/internal/libc.h -+++ b/src/internal/libc.h -@@ -18,9 +18,9 @@ struct tls_module { - }; - - struct __libc { -- int can_do_threads; -- int threaded; -- int secure; -+ char can_do_threads; -+ char threaded; -+ char secure; - int threads_minus_1; - size_t *auxv; - struct tls_module *tls_head; diff --git a/toolchain/musl/patches/500-0004-restore-lock-skipping-for-processes-that-return-to-s.patch b/toolchain/musl/patches/500-0004-restore-lock-skipping-for-processes-that-return-to-s.patch deleted file mode 100644 index 83a6d0247a..0000000000 --- a/toolchain/musl/patches/500-0004-restore-lock-skipping-for-processes-that-return-to-s.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 8d81ba8c0bc6fe31136cb15c9c82ef4c24965040 Mon Sep 17 00:00:00 2001 -From: Rich Felker -Date: Fri, 22 May 2020 17:45:47 -0400 -Subject: [PATCH 4/4] restore lock-skipping for processes that return to - single-threaded state - -the design used here relies on the barrier provided by the first lock -operation after the process returns to single-threaded state to -synchronize with actions by the last thread that exited. by storing -the intent to change modes in the same object used to detect whether -locking is needed, it's possible to avoid an extra (possibly costly) -memory load after the lock is taken. ---- - src/internal/libc.h | 1 + - src/malloc/malloc.c | 5 ++++- - src/thread/__lock.c | 4 +++- - src/thread/pthread_create.c | 8 ++++---- - 4 files changed, 12 insertions(+), 6 deletions(-) - ---- a/src/internal/libc.h -+++ b/src/internal/libc.h -@@ -21,6 +21,7 @@ struct __libc { - char can_do_threads; - char threaded; - char secure; -+ volatile signed char need_locks; - int threads_minus_1; - size_t *auxv; - struct tls_module *tls_head; ---- a/src/malloc/malloc.c -+++ b/src/malloc/malloc.c -@@ -26,8 +26,11 @@ int __malloc_replaced; - - static inline void lock(volatile int *lk) - { -- if (libc.threaded) -+ int need_locks = libc.need_locks; -+ if (need_locks) { - while(a_swap(lk, 1)) __wait(lk, lk+1, 1, 1); -+ if (need_locks < 0) libc.need_locks = 0; -+ } - } - - static inline void unlock(volatile int *lk) ---- a/src/thread/__lock.c -+++ b/src/thread/__lock.c -@@ -18,9 +18,11 @@ - - void __lock(volatile int *l) - { -- if (!libc.threaded) return; -+ int need_locks = libc.need_locks; -+ if (!need_locks) return; - /* fast path: INT_MIN for the lock, +1 for the congestion */ - int current = a_cas(l, 0, INT_MIN + 1); -+ if (need_locks < 0) libc.need_locks = 0; - if (!current) return; - /* A first spin loop, for medium congestion. */ - for (unsigned i = 0; i < 10; ++i) { ---- a/src/thread/pthread_create.c -+++ b/src/thread/pthread_create.c -@@ -118,8 +118,8 @@ _Noreturn void __pthread_exit(void *resu - * until the lock is released, which only happens after SYS_exit - * has been called, via the exit futex address pointing at the lock. - * This needs to happen after any possible calls to LOCK() that might -- * skip locking if libc.threads_minus_1 is zero. */ -- libc.threads_minus_1--; -+ * skip locking if process appears single-threaded. */ -+ if (!--libc.threads_minus_1) libc.need_locks = -1; - self->next->prev = self->prev; - self->prev->next = self->next; - self->prev = self->next = self; -@@ -339,7 +339,7 @@ int __pthread_create(pthread_t *restrict - ~(1UL<<((SIGCANCEL-1)%(8*sizeof(long)))); - - __tl_lock(); -- libc.threads_minus_1++; -+ if (!libc.threads_minus_1++) libc.need_locks = 1; - ret = __clone((c11 ? start_c11 : start), stack, flags, args, &new->tid, TP_ADJ(new), &__thread_list_lock); - - /* All clone failures translate to EAGAIN. If explicit scheduling -@@ -363,7 +363,7 @@ int __pthread_create(pthread_t *restrict - new->next->prev = new; - new->prev->next = new; - } else { -- libc.threads_minus_1--; -+ if (!--libc.threads_minus_1) libc.need_locks = 0; - } - __tl_unlock(); - __restore_sigs(&set); diff --git a/toolchain/musl/patches/600-nftw-support-common-gnu-extension.patch b/toolchain/musl/patches/600-nftw-support-common-gnu-extension.patch index 81c96ad76c..2a7436cf84 100644 --- a/toolchain/musl/patches/600-nftw-support-common-gnu-extension.patch +++ b/toolchain/musl/patches/600-nftw-support-common-gnu-extension.patch @@ -32,9 +32,9 @@ Signed-off-by: Tony Ambardar +#define _GNU_SOURCE #include #include - #include -@@ -63,8 +64,20 @@ static int do_nftw(char *path, int (*fn) - lev.base = k; + #include +@@ -72,8 +73,20 @@ static int do_nftw(char *path, int (*fn) + if (!fd_limit) close(dfd); } - if (!(flags & FTW_DEPTH) && (r=fn(path, &st, type, &lev))) @@ -56,7 +56,7 @@ Signed-off-by: Tony Ambardar for (; h; h = h->chain) if (h->dev == st.st_dev && h->ino == st.st_ino) -@@ -88,7 +101,10 @@ static int do_nftw(char *path, int (*fn) +@@ -101,7 +114,10 @@ static int do_nftw(char *path, int (*fn) strcpy(path+j+1, de->d_name); if ((r=do_nftw(path, fn, fd_limit-1, flags, &new))) { closedir(d); @@ -68,7 +68,7 @@ Signed-off-by: Tony Ambardar } } closedir(d); -@@ -98,8 +114,16 @@ static int do_nftw(char *path, int (*fn) +@@ -112,8 +128,16 @@ static int do_nftw(char *path, int (*fn) } path[l] = 0; @@ -87,7 +87,7 @@ Signed-off-by: Tony Ambardar return 0; } -@@ -125,4 +149,5 @@ int nftw(const char *path, int (*fn)(con +@@ -139,4 +163,5 @@ int nftw(const char *path, int (*fn)(con return r; } diff --git a/toolchain/musl/patches/700-wcsnrtombs-cve-2020-28928.diff b/toolchain/musl/patches/700-wcsnrtombs-cve-2020-28928.diff deleted file mode 100644 index 5840dc1aac..0000000000 --- a/toolchain/musl/patches/700-wcsnrtombs-cve-2020-28928.diff +++ /dev/null @@ -1,63 +0,0 @@ ---- a/src/multibyte/wcsnrtombs.c -+++ b/src/multibyte/wcsnrtombs.c -@@ -1,41 +1,33 @@ - #include -+#include -+#include - - size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict wcs, size_t wn, size_t n, mbstate_t *restrict st) - { -- size_t l, cnt=0, n2; -- char *s, buf[256]; - const wchar_t *ws = *wcs; -- const wchar_t *tmp_ws; -- -- if (!dst) s = buf, n = sizeof buf; -- else s = dst; -- -- while ( ws && n && ( (n2=wn)>=n || n2>32 ) ) { -- if (n2>=n) n2=n; -- tmp_ws = ws; -- l = wcsrtombs(s, &ws, n2, 0); -- if (!(l+1)) { -- cnt = l; -- n = 0; -+ size_t cnt = 0; -+ if (!dst) n=0; -+ while (ws && wn) { -+ char tmp[MB_LEN_MAX]; -+ size_t l = wcrtomb(nn) break; -+ memcpy(dst, tmp, l); -+ } -+ dst += l; - n -= l; - } -- wn = ws ? wn - (ws - tmp_ws) : 0; -- cnt += l; -- } -- if (ws) while (n && wn) { -- l = wcrtomb(s, *ws, 0); -- if ((l+1)<=1) { -- if (!l) ws = 0; -- else cnt = l; -+ if (!*ws) { -+ ws = 0; - break; - } -- ws++; wn--; -- /* safe - this loop runs fewer than sizeof(buf) times */ -- s+=l; n-=l; -+ ws++; -+ wn--; - cnt += l; - } - if (dst) *wcs = ws; diff --git a/toolchain/musl/patches/901-crypt_size_hack.patch b/toolchain/musl/patches/901-crypt_size_hack.patch index 75f196abca..667894a24f 100644 --- a/toolchain/musl/patches/901-crypt_size_hack.patch +++ b/toolchain/musl/patches/901-crypt_size_hack.patch @@ -43,7 +43,7 @@ typedef uint32_t BF_word; typedef int32_t BF_word_signed; -@@ -796,3 +807,4 @@ char *__crypt_blowfish(const char *key, +@@ -804,3 +815,4 @@ char *__crypt_blowfish(const char *key, return "*"; } diff --git a/tools/bison/Makefile b/tools/bison/Makefile index ba3dd946ec..5f96463ae0 100644 --- a/tools/bison/Makefile +++ b/tools/bison/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bison -PKG_VERSION:=3.8.1 +PKG_VERSION:=3.8.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=31fc602488aad6bdecf0ccc556e0fc72fc57cdc595cf92398f020e0cf4980f15 +PKG_HASH:=9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2 HOST_BUILD_PARALLEL:=1 diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index 49dc61ee34..df61c83158 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.21.2 +PKG_VERSION:=3.21.3 PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v3.19/ -PKG_HASH:=94275e0b61c84bb42710f5320a23c6dcb2c6ee032ae7d2a616f53f68b3d21659 +PKG_HASH:=d14d06df4265134ee42c4d50f5a60cb8b471b7b6a47da8e5d914d49dd783794f HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 diff --git a/tools/libtool/Makefile b/tools/libtool/Makefile index b237884b64..2bc9db7d0d 100644 --- a/tools/libtool/Makefile +++ b/tools/libtool/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libtool PKG_CPE_ID:=cpe:/a:gnu:libtool -PKG_VERSION:=2.4.6 +PKG_VERSION:=2.4.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=7c87a8c2c8c0fc9cd5019e402bed4292462d00a718a7cd5f11218153bf28b26f +PKG_HASH:=1d7b6862c1ed162e327f083a6f78f40eae29218f0db8c38393d61dab764c4407 HOST_BUILD_PARALLEL:=1 @@ -24,12 +24,7 @@ HOST_CONFIGURE_VARS += \ define Host/Prepare $(call Host/Prepare/Default) (cd $(STAGING_DIR_HOST)/share/aclocal/ && rm -f libtool.m4 ltdl.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4) - $(if $(QUILT),,(cd $(HOST_BUILD_DIR); touch README-release; $(AM_TOOL_PATHS) ./bootstrap --skip-git --skip-po --force)) -endef - -define Host/Configure - $(if $(QUILT),(cd $(HOST_BUILD_DIR); touch README-release; $(AM_TOOL_PATHS) ./bootstrap --skip-git --skip-po --force)) - $(call Host/Configure/Default) + (cd $(HOST_BUILD_DIR); $(AM_TOOL_PATHS) ./bootstrap) endef define Host/Install diff --git a/tools/libtool/patches/000-relocatable.patch b/tools/libtool/patches/000-relocatable.patch index 88d1eaed02..6d1651be31 100644 --- a/tools/libtool/patches/000-relocatable.patch +++ b/tools/libtool/patches/000-relocatable.patch @@ -1,24 +1,17 @@ -From ca10caa502f971f90d8c041aa2476de54ef0ce2b Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Tue, 20 Jul 2021 16:41:11 -0300 -Subject: openwrt: make relocatable, search resources relative to STAGING_DIR - -This was originally commited to openwrt by Jo-Philipp Wich -. - -(adjusted to v2.4.6) -Signed-off-by: Eneas U de Queiroz - ---- a/libtoolize.in -+++ b/libtoolize.in -@@ -40,11 +40,18 @@ - - : ${AUTOCONF="autoconf"} - : ${AUTOMAKE="automake"} +--- a/libltdl/config/general.m4sh ++++ b/libltdl/config/general.m4sh +@@ -45,15 +45,22 @@ progpath="$0" + M4SH_VERBATIM([[ + : ${CP="cp -f"} + test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${EGREP="@EGREP@"} -: ${FGREP="@FGREP@"} -: ${GREP="@GREP@"} : ${LN_S="@LN_S@"} + : ${MAKE="make"} + : ${MKDIR="mkdir"} + : ${MV="mv -f"} + : ${RM="rm -f"} -: ${SED="@SED@"} +if test -n "$STAGING_DIR"; then + : ${EGREP="$STAGING_DIR/../host/bin/grep -E"} @@ -31,12 +24,87 @@ Signed-off-by: Eneas U de Queiroz + : ${GREP="@GREP@"} + : ${SED="@SED@"} +fi + : ${SHELL="${CONFIG_SHELL-/bin/sh}"} + : ${Xsed="$SED -e 1s/^X//"} +--- a/libtoolize.in ++++ b/libtoolize.in +@@ -334,15 +334,22 @@ as_unset=as_fn_unset - ## -------------------------- ## ---- a/m4/libtool.m4 -+++ b/m4/libtool.m4 -@@ -929,9 +929,8 @@ dnl AC_DEFUN([AC_LIBTOOL_RC], []) + : ${CP="cp -f"} + test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +-: ${EGREP="@EGREP@"} +-: ${FGREP="@FGREP@"} +-: ${GREP="@GREP@"} + : ${LN_S="@LN_S@"} + : ${MAKE="make"} + : ${MKDIR="mkdir"} + : ${MV="mv -f"} + : ${RM="rm -f"} +-: ${SED="@SED@"} ++if test -n "$STAGING_DIR"; then ++ : ${EGREP="$STAGING_DIR/../host/bin/grep -E"} ++ : ${FGREP="$STAGING_DIR/../host/bin/grep -F"} ++ : ${GREP="$STAGING_DIR/../host/bin/grep"} ++ : ${SED="$STAGING_DIR/../host/bin/sed"} ++else ++ : ${EGREP="@EGREP@"} ++ : ${FGREP="@FGREP@"} ++ : ${GREP="@GREP@"} ++ : ${SED="@SED@"} ++fi + : ${SHELL="${CONFIG_SHELL-/bin/sh}"} + : ${Xsed="$SED -e 1s/^X//"} + +@@ -2487,10 +2494,17 @@ func_check_macros () + + # Locations for important files: + prefix=@prefix@ +- datadir=@datadir@ +- pkgdatadir=@pkgdatadir@ +- pkgltdldir=@pkgdatadir@ +- aclocaldir=@aclocaldir@ ++ if test -n "$STAGING_DIR"; then ++ datadir="$STAGING_DIR/../host/share" ++ pkgdatadir="$STAGING_DIR/../host/share/libtool" ++ pkgltdldir="$STAGING_DIR/../host/share/libtool" ++ aclocaldir="$STAGING_DIR/../host/share/aclocal" ++ else ++ datadir=@datadir@ ++ pkgdatadir=@pkgdatadir@ ++ pkgltdldir=@pkgdatadir@ ++ aclocaldir=@aclocaldir@ ++ fi + auxdir= + macrodir= + configure_ac=configure.in +--- a/libtoolize.m4sh ++++ b/libtoolize.m4sh +@@ -1453,10 +1453,17 @@ func_check_macros () + + # Locations for important files: + prefix=@prefix@ +- datadir=@datadir@ +- pkgdatadir=@pkgdatadir@ +- pkgltdldir=@pkgdatadir@ +- aclocaldir=@aclocaldir@ ++ if test -n "$STAGING_DIR"; then ++ datadir="$STAGING_DIR/../host/share" ++ pkgdatadir="$STAGING_DIR/../host/share/libtool" ++ pkgltdldir="$STAGING_DIR/../host/share/libtool" ++ aclocaldir="$STAGING_DIR/../host/share/aclocal" ++ else ++ datadir=@datadir@ ++ pkgdatadir=@pkgdatadir@ ++ pkgltdldir=@pkgdatadir@ ++ aclocaldir=@aclocaldir@ ++ fi + auxdir= + macrodir= + configure_ac=configure.in +--- a/libltdl/m4/libtool.m4 ++++ b/libltdl/m4/libtool.m4 +@@ -907,9 +907,8 @@ dnl AC_DEFUN([AC_LIBTOOL_RC], []) # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl @@ -47,7 +115,7 @@ Signed-off-by: Eneas U de Queiroz _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl -@@ -8160,9 +8159,9 @@ m4_defun([_LT_DECL_EGREP], +@@ -7660,9 +7659,9 @@ m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep @@ -60,7 +128,7 @@ Signed-off-by: Eneas U de Queiroz dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) -@@ -8195,9 +8194,8 @@ AC_SUBST([DLLTOOL]) +@@ -7695,9 +7694,8 @@ AC_SUBST([DLLTOOL]) # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED diff --git a/tools/libtool/patches/100-libdir-fixes.patch b/tools/libtool/patches/100-libdir-fixes.patch index dd17dd97e5..3df2b14b60 100644 --- a/tools/libtool/patches/100-libdir-fixes.patch +++ b/tools/libtool/patches/100-libdir-fixes.patch @@ -1,56 +1,83 @@ -From 67ffe8e8582a7ba1f1d1307a419098e6dd88bdaf Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Tue, 20 Jul 2021 16:41:11 -0300 -Subject: openwrt: cross-compilation path adjustments - -Comments from the patch: - -Adding 'libdir' from the .la file to our library search paths -breaks crosscompilation horribly. We cheat here and don't add -it, instead adding the path where we found the .la. -CL - -OE sets installed=no in staging. We need to look in $objdir and $absdir, -preferring $objdir. RP 31/04/2008 - -This was originally commited to openwrt by Jo-Philipp Wich -. - -(adjusted to v2.4.6) -Signed-off-by: Eneas U de Queiroz - ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -6049,8 +6049,14 @@ func_mode_link () - absdir=$abs_ladir - libdir=$abs_ladir +--- a/libltdl/config/ltmain.m4sh ++++ b/libltdl/config/ltmain.m4sh +@@ -5731,8 +5731,14 @@ func_mode_link () + absdir="$abs_ladir" + libdir="$abs_ladir" else -- dir=$lt_sysroot$libdir -- absdir=$lt_sysroot$libdir +- dir="$lt_sysroot$libdir" +- absdir="$lt_sysroot$libdir" + # Adding 'libdir' from the .la file to our library search paths + # breaks crosscompilation horribly. We cheat here and don't add + # it, instead adding the path where we found the .la. -CL + dir="$lt_sysroot$abs_ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" -+ #dir=$lt_sysroot$libdir -+ #absdir=$lt_sysroot$libdir ++ #dir="$libdir" ++ #absdir="$lt_sysroot$libdir" fi - test yes = "$hardcode_automatic" && avoidtemprpath=yes + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else -@@ -6448,8 +6454,6 @@ func_mode_link () - add=$libdir/$linklib +@@ -6130,8 +6136,6 @@ func_mode_link () + add="$libdir/$linklib" fi else - # We cannot seem to hardcode it, guess we'll fake it. -- add_dir=-L$libdir +- add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in -@@ -6604,7 +6608,17 @@ func_mode_link () +@@ -6286,7 +6290,17 @@ func_mode_link () fi ;; *) -- path=-L$absdir/$objdir +- path="-L$absdir/$objdir" ++ # OE sets installed=no in staging. We need to look in $objdir and $absdir, ++ # preferring $objdir. RP 31/04/2008 ++ if test -f "$absdir/$objdir/$depdepl" ; then ++ depdepl="$absdir/$objdir/$depdepl" ++ path="-L$absdir/$objdir" ++ elif test -f "$absdir/$depdepl" ; then ++ depdepl="$absdir/$depdepl" ++ path="-L$absdir" ++ else ++ path="-L$absdir/$objdir" ++ fi + ;; + esac + else +--- a/libltdl/config/ltmain.sh ++++ b/libltdl/config/ltmain.sh +@@ -6518,8 +6518,14 @@ func_mode_link () + absdir="$abs_ladir" + libdir="$abs_ladir" + else +- dir="$lt_sysroot$libdir" +- absdir="$lt_sysroot$libdir" ++ # Adding 'libdir' from the .la file to our library search paths ++ # breaks crosscompilation horribly. We cheat here and don't add ++ # it, instead adding the path where we found the .la. -CL ++ dir="$lt_sysroot$abs_ladir" ++ absdir="$abs_ladir" ++ libdir="$abs_ladir" ++ #dir="$libdir" ++ #absdir="$lt_sysroot$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else +@@ -6917,8 +6923,6 @@ func_mode_link () + add="$libdir/$linklib" + fi + else +- # We cannot seem to hardcode it, guess we'll fake it. +- add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in +@@ -7073,7 +7077,17 @@ func_mode_link () + fi + ;; + *) +- path="-L$absdir/$objdir" + # OE sets installed=no in staging. We need to look in $objdir and $absdir, + # preferring $objdir. RP 31/04/2008 + if test -f "$absdir/$objdir/$depdepl" ; then diff --git a/tools/libtool/patches/110-dont-use-target-dir-for-relinking.patch b/tools/libtool/patches/110-dont-use-target-dir-for-relinking.patch index d613440167..bbfd125003 100644 --- a/tools/libtool/patches/110-dont-use-target-dir-for-relinking.patch +++ b/tools/libtool/patches/110-dont-use-target-dir-for-relinking.patch @@ -1,33 +1,20 @@ -From 375833af93999f8b0a747c8a1dfa3ec8d347743d Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Tue, 20 Jul 2021 16:52:37 -0300 -Subject: openwrt: don't use target dir for relinking - -This was originally commited to openwrt by Jo-Philipp Wich -. - -(adjusted to v2.4.6) -Signed-off-by: Eneas U de Queiroz - ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -6434,13 +6434,13 @@ func_mode_link () - add_dir= - add= - # Finalize command for both is simple: just hardcode it. -- if test yes = "$hardcode_direct" && -- test no = "$hardcode_direct_absolute"; then -- add=$libdir/$linklib -- elif test yes = "$hardcode_minus_L"; then -+ if test "$hardcode_direct" = yes && -+ test "$hardcode_direct_absolute" = no; then -+ add="$libdir/$linklib" -+ elif test "$hardcode_minus_L" = yes; then - add_dir=-L$libdir -- add=-l$name -- elif test yes = "$hardcode_shlibpath_var"; then -+ add="-l$name" -+ elif test "$hardcode_shlibpath_var" = yes; then +--- a/libltdl/config/ltmain.m4sh ++++ b/libltdl/config/ltmain.m4sh +@@ -6120,7 +6120,6 @@ func_mode_link () + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then +- add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in +--- a/libltdl/config/ltmain.sh ++++ b/libltdl/config/ltmain.sh +@@ -6907,7 +6907,6 @@ func_mode_link () + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then +- add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; diff --git a/tools/libtool/patches/120-strip-unsafe-dirs-for-relinking.patch b/tools/libtool/patches/120-strip-unsafe-dirs-for-relinking.patch index 715c254999..8840ee0569 100644 --- a/tools/libtool/patches/120-strip-unsafe-dirs-for-relinking.patch +++ b/tools/libtool/patches/120-strip-unsafe-dirs-for-relinking.patch @@ -1,26 +1,24 @@ -From 7f2b8a1ab4fa1475eeeddfb84eb5b92594bfce43 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Tue, 20 Jul 2021 16:54:12 -0300 -Subject: openwrt: strip unsave directories from relink command - -strip unsave directories from relink command, nuke every -L that looks -like /usr/lib or /lib - -This was originally commited to openwrt by Jo-Philipp Wich -. - -(adjusted to v2.4.6) -Signed-off-by: Eneas U de Queiroz - ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -2382,6 +2382,9 @@ func_mode_install () +--- a/libltdl/config/ltmain.m4sh ++++ b/libltdl/config/ltmain.m4sh +@@ -2183,6 +2183,9 @@ func_mode_install () relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi + relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/lib[^[:space:]]*%%"` + relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/usr/lib[^[:space:]]*%%"` + - func_warning "relinking '$file'" + func_warning "relinking \`$file'" func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' +--- a/libltdl/config/ltmain.sh ++++ b/libltdl/config/ltmain.sh +@@ -2973,6 +2973,9 @@ func_mode_install () + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + ++ relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/lib[^[:space:]]*%%"` ++ relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/usr/lib[^[:space:]]*%%"` ++ + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' diff --git a/tools/libtool/patches/140-don-t-quote-SHELL-in-Makefile.am.patch b/tools/libtool/patches/140-don-t-quote-SHELL-in-Makefile.am.patch deleted file mode 100644 index 513b521834..0000000000 --- a/tools/libtool/patches/140-don-t-quote-SHELL-in-Makefile.am.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 879578d3f4dc9bc42aa433b1fb6b584564f83617 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Wed, 21 Jul 2021 13:38:24 -0300 -Subject: openwrt: don't quote $(SHELL) in Makefile.am - -This allows to use SHELL="env bash" to get a controlled enviroment. - -Signed-off-by: Eneas U de Queiroz - ---- a/Makefile.am -+++ b/Makefile.am -@@ -46,7 +46,7 @@ EXTRA_LTLIBRARIES = - # Using 'cd' in backquotes may print the directory name, use this instead: - lt__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd - --git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '--fallback' '$(VERSION)' '.tarball-version' -+git_version_gen = $(SHELL) '$(aux_dir)/git-version-gen' '--fallback' '$(VERSION)' '.tarball-version' - rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir) && $(git_version_gen) | $(SED) 's|-.*$$||'` - - -@@ -301,7 +301,7 @@ libtool: $(ltmain_sh) $(config_status) $ - if test 0 = '$(AM_DEFAULT_VERBOSITY)' && test 1 != '$(V)'; \ - then echo " GEN " $@; \ - else echo '$(SHELL) $(top_builddir)/config.status "$@"'; fi; \ -- cd '$(top_builddir)' && '$(SHELL)' ./config.status '$@'; \ -+ cd '$(top_builddir)' && $(SHELL) ./config.status '$@'; \ - fi - - -@@ -788,13 +788,13 @@ testsuite_deps_uninstalled = $(testsuite - # Hook the test suite into the check rule - check-local: $(testsuite_deps_uninstalled) - $(AM_V_at)$(CD_TESTDIR); \ -- CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \ -+ CONFIG_SHELL=$(SHELL) $(SHELL) "$$abs_srcdir/$(TESTSUITE)" \ - $(TESTS_ENVIRONMENT) $(BUILDCHECK_ENVIRONMENT) $(TESTSUITEFLAGS) - - # Run the test suite on the *installed* tree. - installcheck-local: $(testsuite_deps) - $(AM_V_at)$(CD_TESTDIR); \ -- CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \ -+ CONFIG_SHELL=$(SHELL) $(SHELL) "$$abs_srcdir/$(TESTSUITE)" \ - $(TESTS_ENVIRONMENT) $(INSTALLCHECK_ENVIRONMENT) $(TESTSUITEFLAGS) \ - AUTOTEST_PATH='$(exec_prefix)/bin' - -@@ -806,7 +806,7 @@ check-noninteractive-old: - .PHONY: check-noninteractive-new - check-noninteractive-new: $(testsuite_deps_uninstalled) - $(AM_V_at)$(CD_TESTDIR); \ -- CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \ -+ CONFIG_SHELL=$(SHELL) $(SHELL) "$$abs_srcdir/$(TESTSUITE)" \ - $(TESTS_ENVIRONMENT) $(BUILDCHECK_ENVIRONMENT) \ - -k '!interactive' INNER_TESTSUITEFLAGS=',!interactive' \ - $(TESTSUITEFLAGS) -@@ -815,7 +815,7 @@ check-noninteractive-new: $(testsuite_de - .PHONY: check-interactive - check-interactive: $(testsuite_deps_uninstalled) - $(AM_V_at)$(CD_TESTDIR); \ -- CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \ -+ CONFIG_SHELL=$(SHELL) $(SHELL) "$$abs_srcdir/$(TESTSUITE)" \ - $(TESTS_ENVIRONMENT) $(BUILDCHECK_ENVIRONMENT) \ - -k interactive -k recursive INNER_TESTSUITEFLAGS=',interactive' \ - $(TESTSUITEFLAGS) -@@ -827,7 +827,7 @@ check-noninteractive: check-noninteracti - clean-local: - -$(CD_TESTDIR); \ - test -f "$$abs_srcdir/$(TESTSUITE)" && \ -- '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" --clean -+ $(SHELL) "$$abs_srcdir/$(TESTSUITE)" --clean - - ## An empty target to depend on when a rule needs to always run - ## whenever it is visited. diff --git a/tools/libtool/patches/150-libtool-mitigate-the-sed_quote_subst-slowdown.patch b/tools/libtool/patches/150-libtool-mitigate-the-sed_quote_subst-slowdown.patch deleted file mode 100644 index 27ea6a1d53..0000000000 --- a/tools/libtool/patches/150-libtool-mitigate-the-sed_quote_subst-slowdown.patch +++ /dev/null @@ -1,224 +0,0 @@ -From 3adadb568fbf15d952bd25a005b6a9afb7e59dc7 Mon Sep 17 00:00:00 2001 -From: Pavel Raiskup -Date: Sun, 4 Oct 2015 21:55:03 +0200 -Subject: libtool: mitigate the $sed_quote_subst slowdown - -When it is reasonably possible, use shell implementation for -quoting. - -References: -http://lists.gnu.org/archive/html/libtool/2015-03/msg00005.html -http://lists.gnu.org/archive/html/libtool/2015-02/msg00000.html -https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20006 - -* gl/build-aux/funclib.sh (func_quote): New function that can be -used as substitution for '$SED $sed_quote_subst' call. -* build-aux/ltmain.in (func_emit_wrapper): Use func_quote instead -of '$SED $sed_quote_subst'. -(func_mode_link): Likewise. -* NEWS: Document. -* bootstrap: Sync with funclib.sh. - -(cherry picked from commit 32f0df9835ac15ac17e04be57c368172c3ad1d19) -(skipping NEWS change) -Signed-off-by: Eneas U de Queiroz - ---- a/bootstrap -+++ b/bootstrap -@@ -230,7 +230,7 @@ vc_ignore= - - # Source required external libraries: - # Set a version string for this script. --scriptversion=2015-01-20.17; # UTC -+scriptversion=2015-10-04.22; # UTC - - # General shell script boiler plate, and helper functions. - # Written by Gary V. Vaughan, 2004 -@@ -1257,6 +1257,57 @@ func_relative_path () - } - - -+# func_quote ARG -+# -------------- -+# Aesthetically quote one ARG, store the result into $func_quote_result. Note -+# that we keep attention to performance here (so far O(N) complexity as long as -+# func_append is O(1)). -+func_quote () -+{ -+ $debug_cmd -+ -+ func_quote_result=$1 -+ -+ case $func_quote_result in -+ *[\\\`\"\$]*) -+ case $func_quote_result in -+ *'*'*|*'['*) -+ func_quote_result=`$ECHO "$func_quote_result" | $SED "$sed_quote_subst"` -+ return 0 -+ ;; -+ esac -+ -+ func_quote_old_IFS=$IFS -+ for _G_char in '\' '`' '"' '$' -+ do -+ # STATE($1) PREV($2) SEPARATOR($3) -+ set start "" "" -+ func_quote_result=dummy"$_G_char$func_quote_result$_G_char"dummy -+ IFS=$_G_char -+ for _G_part in $func_quote_result -+ do -+ case $1 in -+ quote) -+ func_append func_quote_result "$3$2" -+ set quote "$_G_part" "\\$_G_char" -+ ;; -+ start) -+ set first "" "" -+ func_quote_result= -+ ;; -+ first) -+ set quote "$_G_part" "" -+ ;; -+ esac -+ done -+ IFS=$func_quote_old_IFS -+ done -+ ;; -+ *) ;; -+ esac -+} -+ -+ - # func_quote_for_eval ARG... - # -------------------------- - # Aesthetically quote ARGs to be evaled later. -@@ -1273,12 +1324,8 @@ func_quote_for_eval () - func_quote_for_eval_unquoted_result= - func_quote_for_eval_result= - while test 0 -lt $#; do -- case $1 in -- *[\\\`\"\$]*) -- _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; -- *) -- _G_unquoted_arg=$1 ;; -- esac -+ func_quote "$1" -+ _G_unquoted_arg=$func_quote_result - if test -n "$func_quote_for_eval_unquoted_result"; then - func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" - else ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -3356,7 +3356,8 @@ else - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - -- qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` -+ func_quote "$ECHO" -+ qECHO=$func_quote_result - $ECHO "\ - - # A function that is used when there is no print builtin or printf. -@@ -8618,8 +8619,8 @@ EOF - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done -- relink_command="(cd `pwd`; $relink_command)" -- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` -+ func_quote "(cd `pwd`; $relink_command)" -+ relink_command=$func_quote_result - fi - - # Only actually do things if not in dry run mode. -@@ -8865,7 +8866,8 @@ EOF - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" -- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` -+ func_quote "$relink_command" -+ relink_command=$func_quote_result - if test yes = "$hardcode_automatic"; then - relink_command= - fi ---- a/build-aux/funclib.sh -+++ b/build-aux/funclib.sh -@@ -1,5 +1,5 @@ - # Set a version string for this script. --scriptversion=2015-01-20.17; # UTC -+scriptversion=2015-10-04.22; # UTC - - # General shell script boiler plate, and helper functions. - # Written by Gary V. Vaughan, 2004 -@@ -1026,6 +1026,57 @@ func_relative_path () - } - - -+# func_quote ARG -+# -------------- -+# Aesthetically quote one ARG, store the result into $func_quote_result. Note -+# that we keep attention to performance here (so far O(N) complexity as long as -+# func_append is O(1)). -+func_quote () -+{ -+ $debug_cmd -+ -+ func_quote_result=$1 -+ -+ case $func_quote_result in -+ *[\\\`\"\$]*) -+ case $func_quote_result in -+ *[\[\*\?]*) -+ func_quote_result=`$ECHO "$func_quote_result" | $SED "$sed_quote_subst"` -+ return 0 -+ ;; -+ esac -+ -+ func_quote_old_IFS=$IFS -+ for _G_char in '\' '`' '"' '$' -+ do -+ # STATE($1) PREV($2) SEPARATOR($3) -+ set start "" "" -+ func_quote_result=dummy"$_G_char$func_quote_result$_G_char"dummy -+ IFS=$_G_char -+ for _G_part in $func_quote_result -+ do -+ case $1 in -+ quote) -+ func_append func_quote_result "$3$2" -+ set quote "$_G_part" "\\$_G_char" -+ ;; -+ start) -+ set first "" "" -+ func_quote_result= -+ ;; -+ first) -+ set quote "$_G_part" "" -+ ;; -+ esac -+ done -+ IFS=$func_quote_old_IFS -+ done -+ ;; -+ *) ;; -+ esac -+} -+ -+ - # func_quote_for_eval ARG... - # -------------------------- - # Aesthetically quote ARGs to be evaled later. -@@ -1042,12 +1093,8 @@ func_quote_for_eval () - func_quote_for_eval_unquoted_result= - func_quote_for_eval_result= - while test 0 -lt $#; do -- case $1 in -- *[\\\`\"\$]*) -- _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; -- *) -- _G_unquoted_arg=$1 ;; -- esac -+ func_quote "$1" -+ _G_unquoted_arg=$func_quote_result - if test -n "$func_quote_for_eval_unquoted_result"; then - func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" - else diff --git a/tools/libtool/patches/130-trailingslash.patch b/tools/libtool/patches/150-trailingslash.patch similarity index 57% rename from tools/libtool/patches/130-trailingslash.patch rename to tools/libtool/patches/150-trailingslash.patch index fc28027a05..423911cf4b 100644 --- a/tools/libtool/patches/130-trailingslash.patch +++ b/tools/libtool/patches/150-trailingslash.patch @@ -1,8 +1,3 @@ -From 1b45c3c0d6682be7f4876b620780ee246a5acbaa Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Tue, 20 Jul 2021 16:56:16 -0300 -Subject: openwrt: remove trailing slash in install destdir - A command like /bin/sh ../../i586-poky-linux-libtool --mode=install /usr/bin/install -c gck-roots-store-standalone.la '/media/data1/builds/poky1/tmp/work/core2-poky-linux/gnome-keyring-2.26.1-r1/image/usr/lib/gnome-keyring/standalone/' fails (e.g. gnome-keyring or pulseaudio) This is because libdir has a trailing slash which breaks the comparision. @@ -14,12 +9,28 @@ Merged a patch received from Gary Thomas Date: 2010/07/12 Nitin A Kamble -(adjusted to v2.4.6) -Signed-off-by: Eneas U de Queiroz - ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -2363,8 +2363,15 @@ func_mode_install () +--- a/libltdl/config/ltmain.m4sh ++++ b/libltdl/config/ltmain.m4sh +@@ -2167,8 +2167,15 @@ func_mode_install () + func_append dir "$objdir" + + if test -n "$relink_command"; then ++ # Strip any trailing slash from the destination. ++ func_stripname '' '/' "$libdir" ++ destlibdir=$func_stripname_result ++ ++ func_stripname '' '/' "$destdir" ++ s_destdir=$func_stripname_result ++ + # Determine the prefix the user has applied to our future dir. +- inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` ++ inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that +--- a/libltdl/config/ltmain.sh ++++ b/libltdl/config/ltmain.sh +@@ -2954,8 +2954,15 @@ func_mode_install () func_append dir "$objdir" if test -n "$relink_command"; then diff --git a/tools/libtool/patches/160-passthrough-ssp.patch b/tools/libtool/patches/160-passthrough-ssp.patch new file mode 100644 index 0000000000..da44c614e3 --- /dev/null +++ b/tools/libtool/patches/160-passthrough-ssp.patch @@ -0,0 +1,12 @@ +diff -ur libtool-2.4.orig/libltdl/config/ltmain.m4sh libtool-2.4/libltdl/config/ltmain.m4sh +--- libtool-2.4.orig/libltdl/config/ltmain.m4sh 2015-06-18 10:46:15.499996979 +0200 ++++ libtool-2.4/libltdl/config/ltmain.m4sh 2015-06-18 10:48:24.686882213 +0200 +@@ -5076,7 +5076,7 @@ + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ +- -O*|-flto*|-fwhopr*|-fuse-linker-plugin) ++ -O*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" diff --git a/tools/libtool/patches/200-openwrt-branding.patch b/tools/libtool/patches/200-openwrt-branding.patch index 95fa8c0f37..3fc0afb866 100644 --- a/tools/libtool/patches/200-openwrt-branding.patch +++ b/tools/libtool/patches/200-openwrt-branding.patch @@ -1,24 +1,112 @@ -From 90707200efadc8e230635c7c204c9c272cbc8631 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Tue, 20 Jul 2021 17:01:03 -0300 -Subject: openwrt: add openwrt branding - -This prepends program name with "OpenWrt-". - -This was originally commited to openwrt by Jo-Philipp Wich -. - -(adjusted to v2.4.6) -Signed-off-by: Eneas U de Queiroz - ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -82,7 +82,7 @@ func_echo () - IFS=$nl - for _G_line in $_G_message; do - IFS=$func_echo_IFS -- $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" -+ $ECHO "OpenWrt-$progname${opt_mode+: $opt_mode}: $_G_line" - done - IFS=$func_echo_IFS +--- a/libltdl/config/general.m4sh ++++ b/libltdl/config/general.m4sh +@@ -359,7 +359,7 @@ opt_warning=: + # name if it has been set yet. + func_echo () + { +- $ECHO "$progname: ${opt_mode+$opt_mode: }$*" ++ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }$*" } + + # func_verbose arg... +@@ -385,14 +385,14 @@ func_echo_all () + # Echo program name prefixed message to standard error. + func_error () + { +- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 ++ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 + } + + # func_warning arg... + # Echo program name prefixed warning message to standard error. + func_warning () + { +- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 ++ $opt_warning && $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +--- a/libltdl/config/ltmain.sh ++++ b/libltdl/config/ltmain.sh +@@ -439,7 +439,7 @@ opt_warning=: + # name if it has been set yet. + func_echo () + { +- $ECHO "$progname: ${opt_mode+$opt_mode: }$*" ++ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }$*" + } + + # func_verbose arg... +@@ -465,14 +465,14 @@ func_echo_all () + # Echo program name prefixed message to standard error. + func_error () + { +- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 ++ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 + } + + # func_warning arg... + # Echo program name prefixed warning message to standard error. + func_warning () + { +- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 ++ $opt_warning && $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +--- a/libtoolize.in ++++ b/libtoolize.in +@@ -648,7 +648,7 @@ opt_warning=: + # name if it has been set yet. + func_echo () + { +- $ECHO "$progname: ${opt_mode+$opt_mode: }$*" ++ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }$*" + } + + # func_verbose arg... +@@ -674,14 +674,14 @@ func_echo_all () + # Echo program name prefixed message to standard error. + func_error () + { +- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 ++ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 + } + + # func_warning arg... + # Echo program name prefixed warning message to standard error. + func_warning () + { +- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 ++ $opt_warning && $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +--- a/tests/defs.in ++++ b/tests/defs.in +@@ -596,7 +596,7 @@ opt_warning=: + # name if it has been set yet. + func_echo () + { +- $ECHO "$progname: ${opt_mode+$opt_mode: }$*" ++ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }$*" + } + + # func_verbose arg... +@@ -622,14 +622,14 @@ func_echo_all () + # Echo program name prefixed message to standard error. + func_error () + { +- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 ++ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 + } + + # func_warning arg... + # Echo program name prefixed warning message to standard error. + func_warning () + { +- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 ++ $opt_warning && $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : diff --git a/tools/meson/Makefile b/tools/meson/Makefile index bae89654a5..0cf0efba47 100644 --- a/tools/meson/Makefile +++ b/tools/meson/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=meson -PKG_VERSION:=0.59.1 +PKG_VERSION:=0.59.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/mesonbuild/meson/releases/download/$(PKG_VERSION) -PKG_HASH:=db586a451650d46bbe10984a87b79d9bcdc1caebf38d8e189f8848f8d502356d +PKG_HASH:=13dee549a7ba758b7e33ce7719f28d1d337a98d10d378a4779ccc996f5a2fc49 PKG_MAINTAINER:=Andre Heider PKG_LICENSE:=Apache-2.0 @@ -20,8 +20,11 @@ define Host/Compile endef define Host/Install + $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin + $(HOST_BUILD_DIR)/packaging/create_zipapp.py $(HOST_BUILD_DIR) --interpreter $(STAGING_DIR_HOST)/bin/$(PYTHON) --outfile $(STAGING_DIR_HOST)/bin/meson $(INSTALL_DIR) $(STAGING_DIR_HOST)/lib/meson - $(CP) $(HOST_BUILD_DIR)/* $(STAGING_DIR_HOST)/lib/meson/ + $(INSTALL_CONF) files/openwrt-cross.txt.in $(STAGING_DIR_HOST)/lib/meson/ + $(INSTALL_CONF) files/openwrt-native.txt.in $(STAGING_DIR_HOST)/lib/meson/ endef define Host/Clean diff --git a/tools/meson/src/openwrt-cross.txt.in b/tools/meson/files/openwrt-cross.txt.in similarity index 100% rename from tools/meson/src/openwrt-cross.txt.in rename to tools/meson/files/openwrt-cross.txt.in diff --git a/tools/meson/src/openwrt-native.txt.in b/tools/meson/files/openwrt-native.txt.in similarity index 100% rename from tools/meson/src/openwrt-native.txt.in rename to tools/meson/files/openwrt-native.txt.in