Re: [OpenWrt-Devel] [PATCH] mpc85xx: Add T4240 sub-target

2016-04-26 Thread Helmut Schaa
Hi John,

On Tue, Apr 26, 2016 at 3:33 PM, John Crispin <blo...@openwrt.org> wrote:
>
>
> On 26/04/2016 11:48, Helmut Schaa wrote:
>> The Freescale T4240 is a 12 core (24 threads) SoC.
>> Add a sub-target to the mpc85xx target to build images for the T4240
>> Reference Design Board.
>>
>> Currently CPU thread support is only available in 64bit kernel builds,
>> hence the sub-target uses the powerpc64 feature flag.
>>
>> Using musl libc doesn't compile properly on that sub-target yet, hence
>> we'd select glibc by default for T4240.
>
> why does it not compile ? do you get an actual compile error or does it
> simply not work as expected ?

Yep, it gives an actual compile error and I did not have time to look into
that yet. Hence, I'd like to go with glibc first ... uclibc seems to
work fine as
well, that's what we use in our internal tree for now.

>>
>> Networking is not yet supported as the required fman/bman/qman/dpaa
>> drivers are not yet included in mainline.
>>
>
> can you backport them ?

Yep, I've got a mostly working backport here but wanted to get the
basic platform
code included first.

Helmut

>
>
>
>> Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
>> ---
>>  config/Config-devel.in|  2 +-
>>  target/linux/mpc85xx/Makefile |  2 +-
>>  target/linux/mpc85xx/image/Makefile   |  2 +-
>>  target/linux/mpc85xx/t4240/config-default | 82 
>> +++
>>  target/linux/mpc85xx/t4240/target.mk  | 12 +
>>  toolchain/Config.in   |  5 +-
>>  6 files changed, 100 insertions(+), 5 deletions(-)
>>  create mode 100644 target/linux/mpc85xx/t4240/config-default
>>  create mode 100644 target/linux/mpc85xx/t4240/target.mk
>>
>> diff --git a/config/Config-devel.in b/config/Config-devel.in
>> index 938f0b3..474b12f 100644
>> --- a/config/Config-devel.in
>> +++ b/config/Config-devel.in
>> @@ -106,7 +106,7 @@ menuconfig DEVEL
>>
>>   config EXTRA_OPTIMIZATION
>>   string "Additional compiler options" if DEVEL
>> - default "-fno-caller-saves -fno-plt" if 
>> !CONFIG_EXTERNAL_TOOLCHAIN && !arc
>> + default "-fno-caller-saves -fno-plt" if 
>> !CONFIG_EXTERNAL_TOOLCHAIN && !arc && !powerpc64
>>   default "-fno-caller-saves"
>>   help
>> Extra target-independent optimizations to use when building 
>> for the target.
>> diff --git a/target/linux/mpc85xx/Makefile b/target/linux/mpc85xx/Makefile
>> index a32be90..8ba739a 100644
>> --- a/target/linux/mpc85xx/Makefile
>> +++ b/target/linux/mpc85xx/Makefile
>> @@ -12,7 +12,7 @@ BOARDNAME:=Freescale MPC85xx
>>  CPU_TYPE:=8540
>>  FEATURES:=squashfs
>>  MAINTAINER:=Imre Kaloz <ka...@openwrt.org>
>> -SUBTARGETS=generic p1020
>> +SUBTARGETS=generic p1020 t4240
>>
>>  KERNEL_PATCHVER:=4.4
>>
>> diff --git a/target/linux/mpc85xx/image/Makefile 
>> b/target/linux/mpc85xx/image/Makefile
>> index 25a9b07..82035eb 100644
>> --- a/target/linux/mpc85xx/image/Makefile
>> +++ b/target/linux/mpc85xx/image/Makefile
>> @@ -21,7 +21,7 @@ endef
>>
>>  zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage
>>
>> -DTS_TARGETS = fsl/p1010rdb-pa tl-wdr4900-v1 fsl/p1020rdb
>> +DTS_TARGETS = fsl/p1010rdb-pa tl-wdr4900-v1 fsl/p1020rdb fsl/t4240rdb
>>
>>  define Image/BuildKernel
>>   cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
>> diff --git a/target/linux/mpc85xx/t4240/config-default 
>> b/target/linux/mpc85xx/t4240/config-default
>> new file mode 100644
>> index 000..18fd6d6
>> --- /dev/null
>> +++ b/target/linux/mpc85xx/t4240/config-default
>> @@ -0,0 +1,82 @@
>> +CONFIG_64BIT=y
>> +CONFIG_ALTIVEC=y
>> +CONFIG_ARCH_DMA_ADDR_T_64BIT=y
>> +CONFIG_ARCH_HAS_ILOG2_U64=y
>> +CONFIG_ARCH_HAS_TICK_BROADCAST=y
>> +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
>> +CONFIG_ARCH_SELECT_MEMORY_MODEL=y
>> +CONFIG_ARCH_SPARSEMEM_ENABLE=y
>> +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
>> +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
>> +CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y
>> +CONFIG_BLOCK_COMPAT=y
>> +CONFIG_CLKDEV_LOOKUP=y
>> +CONFIG_COMMON_CLK=y
>> +CONFIG_COMPAT=y
>> +CONFIG_COMPAT_BINFMT_ELF=y
>> +CONFIG_COMPAT_NETLINK_MESSAGES=y
>> +CONFIG_COMPAT_OLD_SIGACTION=y
>> +CONFIG_CORENET_GENERIC=y
>> +CONFIG_CPU_RMAP=y
>> +# CONFIG_E5500_CPU is not set
>> +CO

[OpenWrt-Devel] [PATCH] mpc85xx: Add T4240 sub-target

2016-04-26 Thread Helmut Schaa
The Freescale T4240 is a 12 core (24 threads) SoC.
Add a sub-target to the mpc85xx target to build images for the T4240
Reference Design Board.

Currently CPU thread support is only available in 64bit kernel builds,
hence the sub-target uses the powerpc64 feature flag.

Using musl libc doesn't compile properly on that sub-target yet, hence
we'd select glibc by default for T4240.

Networking is not yet supported as the required fman/bman/qman/dpaa
drivers are not yet included in mainline.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---
 config/Config-devel.in|  2 +-
 target/linux/mpc85xx/Makefile |  2 +-
 target/linux/mpc85xx/image/Makefile   |  2 +-
 target/linux/mpc85xx/t4240/config-default | 82 +++
 target/linux/mpc85xx/t4240/target.mk  | 12 +
 toolchain/Config.in   |  5 +-
 6 files changed, 100 insertions(+), 5 deletions(-)
 create mode 100644 target/linux/mpc85xx/t4240/config-default
 create mode 100644 target/linux/mpc85xx/t4240/target.mk

diff --git a/config/Config-devel.in b/config/Config-devel.in
index 938f0b3..474b12f 100644
--- a/config/Config-devel.in
+++ b/config/Config-devel.in
@@ -106,7 +106,7 @@ menuconfig DEVEL
 
config EXTRA_OPTIMIZATION
string "Additional compiler options" if DEVEL
-   default "-fno-caller-saves -fno-plt" if 
!CONFIG_EXTERNAL_TOOLCHAIN && !arc
+   default "-fno-caller-saves -fno-plt" if 
!CONFIG_EXTERNAL_TOOLCHAIN && !arc && !powerpc64
default "-fno-caller-saves"
help
  Extra target-independent optimizations to use when building 
for the target.
diff --git a/target/linux/mpc85xx/Makefile b/target/linux/mpc85xx/Makefile
index a32be90..8ba739a 100644
--- a/target/linux/mpc85xx/Makefile
+++ b/target/linux/mpc85xx/Makefile
@@ -12,7 +12,7 @@ BOARDNAME:=Freescale MPC85xx
 CPU_TYPE:=8540
 FEATURES:=squashfs
 MAINTAINER:=Imre Kaloz <ka...@openwrt.org>
-SUBTARGETS=generic p1020
+SUBTARGETS=generic p1020 t4240
 
 KERNEL_PATCHVER:=4.4
 
diff --git a/target/linux/mpc85xx/image/Makefile 
b/target/linux/mpc85xx/image/Makefile
index 25a9b07..82035eb 100644
--- a/target/linux/mpc85xx/image/Makefile
+++ b/target/linux/mpc85xx/image/Makefile
@@ -21,7 +21,7 @@ endef
 
 zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage
 
-DTS_TARGETS = fsl/p1010rdb-pa tl-wdr4900-v1 fsl/p1020rdb
+DTS_TARGETS = fsl/p1010rdb-pa tl-wdr4900-v1 fsl/p1020rdb fsl/t4240rdb
 
 define Image/BuildKernel
cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
diff --git a/target/linux/mpc85xx/t4240/config-default 
b/target/linux/mpc85xx/t4240/config-default
new file mode 100644
index 000..18fd6d6
--- /dev/null
+++ b/target/linux/mpc85xx/t4240/config-default
@@ -0,0 +1,82 @@
+CONFIG_64BIT=y
+CONFIG_ALTIVEC=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_HAS_ILOG2_U64=y
+CONFIG_ARCH_HAS_TICK_BROADCAST=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
+CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
+CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y
+CONFIG_BLOCK_COMPAT=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_COMMON_CLK=y
+CONFIG_COMPAT=y
+CONFIG_COMPAT_BINFMT_ELF=y
+CONFIG_COMPAT_NETLINK_MESSAGES=y
+CONFIG_COMPAT_OLD_SIGACTION=y
+CONFIG_CORENET_GENERIC=y
+CONFIG_CPU_RMAP=y
+# CONFIG_E5500_CPU is not set
+CONFIG_E6500_CPU=y
+CONFIG_EPAPR_PARAVIRT=y
+CONFIG_FORCE_MAX_ZONEORDER=13
+# CONFIG_FSL_ULI1575 is not set
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+# CONFIG_GENERIC_CPU is not set
+# CONFIG_HANGCHECK_TIMER is not set
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_CLK_PREPARE=y
+CONFIG_HAVE_PERF_EVENTS_NMI=y
+CONFIG_HAVE_RCU_TABLE_FREE=y
+CONFIG_HAVE_SETUP_PER_CPU_AREA=y
+CONFIG_HAVE_VIRT_CPU_ACCOUNTING=y
+CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
+# CONFIG_HUGETLBFS is not set
+CONFIG_IOMMU_SUPPORT=y
+CONFIG_KERNEL_START=0xc000
+# CONFIG_LIQUIDIO is not set
+CONFIG_LOCK_SPIN_ON_OWNER=y
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
+CONFIG_NET_FLOW_LIMIT=y
+CONFIG_NR_CPUS=24
+# CONFIG_NUMA is not set
+CONFIG_PAGE_OFFSET=0xc000
+CONFIG_PCI_BUS_ADDR_T_64BIT=y
+CONFIG_PGTABLE_LEVELS=4
+CONFIG_PHYS_64BIT=y
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_PPC64=y
+CONFIG_PPC_BOOK3E=y
+CONFIG_PPC_BOOK3E_64=y
+# CONFIG_PPC_BOOK3S_64 is not set
+CONFIG_PPC_E500MC=y
+CONFIG_PPC_EPAPR_HV_PIC=y
+CONFIG_PPC_FPU=y
+# CONFIG_PPC_I8259 is not set
+CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
+# CONFIG_PPC_OF_PLATFORM_PCI is not set
+CONFIG_PTE_64BIT=y
+CONFIG_RATIONAL=y
+CONFIG_RCU_STALL_COMMON=y
+# CONFIG_RELOCATABLE is not set
+CONFIG_RFS_ACCEL=y
+CONFIG_RPS=y
+CONFIG_RWSEM_SPIN_ON_OWNER=y
+CONFIG_SMP=y
+CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
+CONFIG_SYSVIPC_COMPAT=y
+CONFIG_SYS_SUPPORTS_HUGETLBFS=y
+# CONFIG_THUNDER_NIC_BGX is not set
+# CONFIG_THUNDER_NIC_PF is not set
+# CONF

[OpenWrt-Devel] [PATCH] base-files: fix __network_ifstatus with lots of interfaces

2016-03-22 Thread Helmut Schaa
Having hundrets of interfaces configured with netifd makes __network_ifstatus
go busted with "jsonfilter: Argument list too long".

Fix this by removing the __NETWORK_CACHE environment variable.

The network_flush_cache function is kept so it can be reused later for
per-interface caching or similar things.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---

FYI I've tried using a temp-file as cache but no real speed-up
could be observed. Hence, it might make sense to look into per-interface
caching instead.

 package/base-files/files/lib/functions/network.sh | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/package/base-files/files/lib/functions/network.sh 
b/package/base-files/files/lib/functions/network.sh
index 1b0c717..42057ba 100644
--- a/package/base-files/files/lib/functions/network.sh
+++ b/package/base-files/files/lib/functions/network.sh
@@ -6,10 +6,7 @@
 __network_ifstatus() {
local __tmp
 
-   [ -z "$__NETWORK_CACHE" ] && \
-   export __NETWORK_CACHE="$(ubus call network.interface dump)"
-
-   __tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "$__NETWORK_CACHE" 
-e "$1=@.interface${2:+[@.interface='$2']}$3")"
+   __tmp="$(ubus call network.interface dump | jsonfilter ${4:+-F "$4"} 
${5:+-l "$5"} -e "$1=@.interface${2:+[@.interface='$2']}$3")"
 
[ -z "$__tmp" ] && \
unset "$1" && \
@@ -265,4 +262,4 @@ network_ready_device()
 }
 
 # flush the internal value cache to force re-reading values from ubus
-network_flush_cache() { unset __NETWORK_CACHE; }
+network_flush_cache() { true; }
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] procd warning about respawn

2016-03-11 Thread Helmut Schaa
On Fri, Mar 11, 2016 at 10:58 AM, John Crispin <j...@phrozen.org> wrote:
>
>
> On 11/03/2016 10:57, John Crispin wrote:
>>
>>
>> On 11/03/2016 10:54, Helmut Schaa wrote:
>>> On Tue, Mar 8, 2016 at 9:39 PM, John Crispin <j...@phrozen.org> wrote:
>>>>
>>>>
>>>> On 08/03/2016 21:33, Ted Hess wrote:
>>>>> [ Sorry if duplicate -- first attempt was returned as spam!? ]
>>>>>
>>>>> John C. -- rather than continue this on a closed Github PR...
>>>>>
>>>>> Since changeset (https://dev.openwrt.org/changeset/48915),
>>>>> procd_close_instance issues a
>>>>> WARNING about respawn not defined if 'procd_set_param respawn' is not in
>>>>> ones startup script.
>>>>>
>>>>> Is respawn now a required parameter or is this an extraneous buglet?
>>>>>
>>>>> Example:
>>>>>
>>>>>#/etc/init.d/squeezelite start
>>>>>WARNING: Variable 'respawn' does not exist or is not an array/object
>>>>>#
>>>>>
>>>>
>>>> looks like a bug, will have a closer look tomorrow.
>>>
>>> Seems to be my fault. Looking into this as well now ...
>>> Helmut
>>
>> fixed the warning last night. please verify that the code is correct though.

Thanks John, fix looks good to me.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] procd warning about respawn

2016-03-11 Thread Helmut Schaa
On Tue, Mar 8, 2016 at 9:39 PM, John Crispin  wrote:
>
>
> On 08/03/2016 21:33, Ted Hess wrote:
>> [ Sorry if duplicate -- first attempt was returned as spam!? ]
>>
>> John C. -- rather than continue this on a closed Github PR...
>>
>> Since changeset (https://dev.openwrt.org/changeset/48915),
>> procd_close_instance issues a
>> WARNING about respawn not defined if 'procd_set_param respawn' is not in
>> ones startup script.
>>
>> Is respawn now a required parameter or is this an extraneous buglet?
>>
>> Example:
>>
>>#/etc/init.d/squeezelite start
>>WARNING: Variable 'respawn' does not exist or is not an array/object
>>#
>>
>
> looks like a bug, will have a closer look tomorrow.

Seems to be my fault. Looking into this as well now ...
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] kernel: fix building RTC drivers

2015-11-09 Thread Helmut Schaa
All RTC drivers require the kernel to be built with CONFIG_RTC_CLASS=y.
Set it accordingly.

Tested only with DS1307.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---
 package/kernel/linux/modules/other.mk | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index 55fb6f1..93051e5 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -522,7 +522,8 @@ define KernelPackage/rtc-ds1307
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Dallas/Maxim DS1307 (and compatible) RTC support
   DEPENDS:=@RTC_SUPPORT +kmod-i2c-core
-  KCONFIG:=CONFIG_RTC_DRV_DS1307
+  KCONFIG:=CONFIG_RTC_DRV_DS1307 \
+   CONFIG_RTC_CLASS=y
   FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ds1307.ko
   AUTOLOAD:=$(call AutoProbe,rtc-ds1307)
 endef
@@ -539,7 +540,8 @@ define KernelPackage/rtc-ds1672
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Dallas/Maxim DS1672 RTC support
   DEPENDS:=@RTC_SUPPORT +kmod-i2c-core
-  KCONFIG:=CONFIG_RTC_DRV_DS1672
+  KCONFIG:=CONFIG_RTC_DRV_DS1672 \
+   CONFIG_RTC_CLASS=y
   FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ds1672.ko
   AUTOLOAD:=$(call AutoProbe,rtc-ds1672)
 endef
@@ -555,7 +557,8 @@ define KernelPackage/rtc-isl1208
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Intersil ISL1208 RTC support
   DEPENDS:=@RTC_SUPPORT +kmod-i2c-core
-  KCONFIG:=CONFIG_RTC_DRV_ISL1208
+  KCONFIG:=CONFIG_RTC_DRV_ISL1208 \
+   CONFIG_RTC_CLASS=y
   FILES:=$(LINUX_DIR)/drivers/rtc/rtc-isl1208.ko
   AUTOLOAD:=$(call AutoProbe,rtc-isl1208)
 endef
@@ -571,7 +574,8 @@ define KernelPackage/rtc-marvell
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Marvell SoC built-in RTC support
   DEPENDS:=@RTC_SUPPORT @TARGET_kirkwood||TARGET_orion||TARGET_mvebu
-  KCONFIG:=CONFIG_RTC_DRV_MV
+  KCONFIG:=CONFIG_RTC_DRV_MV \
+   CONFIG_RTC_CLASS=y
   FILES:=$(LINUX_DIR)/drivers/rtc/rtc-mv.ko
   AUTOLOAD:=$(call AutoProbe,rtc-mv)
 endef
@@ -587,7 +591,8 @@ define KernelPackage/rtc-armada38x
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Marvell Armada 38x SoC built-in RTC support
   DEPENDS:=@RTC_SUPPORT @TARGET_mvebu
-  KCONFIG:=CONFIG_RTC_DRV_ARMADA38X
+  KCONFIG:=CONFIG_RTC_DRV_ARMADA38X \
+   CONFIG_RTC_CLASS=y
   FILES:=$(LINUX_DIR)/drivers/rtc/rtc-armada38x.ko
   AUTOLOAD:=$(call AutoProbe,rtc-armada38x)
 endef
@@ -603,7 +608,8 @@ define KernelPackage/rtc-pcf8563
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Philips PCF8563/Epson RTC8564 RTC support
   DEPENDS:=@RTC_SUPPORT +kmod-i2c-core
-  KCONFIG:=CONFIG_RTC_DRV_PCF8563
+  KCONFIG:=CONFIG_RTC_DRV_PCF8563 \
+   CONFIG_RTC_CLASS=y
   FILES:=$(LINUX_DIR)/drivers/rtc/rtc-pcf8563.ko
   AUTOLOAD:=$(call AutoProbe,rtc-pcf8563)
 endef
@@ -620,7 +626,8 @@ define KernelPackage/rtc-pcf2123
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Philips PCF2123 RTC support
   DEPENDS:=@RTC_SUPPORT
-  KCONFIG:=CONFIG_RTC_DRV_PCF2123
+  KCONFIG:=CONFIG_RTC_DRV_PCF2123 \
+   CONFIG_RTC_CLASS=y
   FILES:=$(LINUX_DIR)/drivers/rtc/rtc-pcf2123.ko
   AUTOLOAD:=$(call AutoProbe,rtc-pcf2123)
 endef
@@ -635,7 +642,8 @@ define KernelPackage/rtc-pt7c4338
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Pericom PT7C4338 RTC support
   DEPENDS:=@RTC_SUPPORT +kmod-i2c-core
-  KCONFIG:=CONFIG_RTC_DRV_PT7C4338
+  KCONFIG:=CONFIG_RTC_DRV_PT7C4338 \
+   CONFIG_RTC_CLASS=y
   FILES:=$(LINUX_DIR)/drivers/rtc/rtc-pt7c4338.ko
   AUTOLOAD:=$(call AutoProbe,rtc-pt7c4338)
 endef
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Enable BPF JIT by default?

2015-11-06 Thread Helmut Schaa
On Thu, Nov 5, 2015 at 5:56 PM, John Crispin <blo...@openwrt.org> wrote:
> On 05/11/2015 17:54, Helmut Schaa wrote:
>> Since lots of architectures now support BPF JIT would it make sense to
>> enable it by default for all openwrt builds?
>> Any opinions on that?
>
> can you grab some stats so we can compare kernel size on a few targets ?

Just quickly tried mips and x86_64:

On mips:

openwrt-ar71xx-generic-uImage-gzip.bin +4.605 bytes
openwrt-ar71xx-generic-uImage-lzma.bin +2.836 bytes

On x86_64:

openwrt-x86_64-vmlinuz +3.168 Bytes

So kernel size increase is in the ~5K range.
Not sure if this would justify an extra config option or enabling it
by default makes sense.

Performance-wise this change would only matter for BPF usage but on some archs
even BPF JIT for seccomp filters gets accelerated ...

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Enable BPF JIT by default?

2015-11-05 Thread Helmut Schaa
Hi,

Since lots of architectures now support BPF JIT would it make sense to
enable it by default for all openwrt builds?
Any opinions on that?

Thanks,
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] mac80211: restricted automatic channel selection

2015-10-27 Thread Helmut Schaa
Add a new config option "channels" for mac80211 wifi devices. It's only
valid if automatic channel selection is used and restricts the channel
selection to one of the given channels.

config wifi-device
list channels   1
list channels   6
list channels   11

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---
 package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 2a8d2f9..7fc7d92 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
config_add_int rxantenna txantenna antenna_gain txpower distance
config_add_boolean noscan ht_coex
config_add_array ht_capab
+   config_add_array channels
config_add_boolean \
rxldpc \
short_gi_80 \
@@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
json_select config
 
[ "$auto_channel" -gt 0 ] && channel=acs_survey
+   [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
 
json_get_vars noscan ht_coex
json_get_values ht_capab_list ht_capab
@@ -301,6 +303,7 @@ mac80211_hostapd_setup_base() {
hostapd_prepare_device_config "$hostapd_conf_file" nl80211
cat >> "$hostapd_conf_file" <https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] mac80211: restricted automatic channel selection

2015-10-27 Thread Helmut Schaa
On Tue, Oct 27, 2015 at 5:58 PM, Karl Palsson <ka...@tweak.net.au> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Helmut Schaa <helmut.sc...@googlemail.com> wrote:
>> Add a new config option "channels" for mac80211 wifi devices.
>> It's only valid if automatic channel selection is used and
>> restricts the channel selection to one of the given channels.
>
> Why is auto required explicitly? Isn't that implied if you have
> multiple "channels" listed?

Sort of, yes. This part only enforces that the channel list is not
handed to hostapd if a fixed channel is used.

> Your example below then isn't complete? you need "option channel
> auto" as well?

Default in netifd is "auto" even if you don't provide it in the config.

Helmut

>>
>> config wifi-device
>>   list channels   1
>>   list channels   6
>>   list channels   11
>>
>> Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
>> ---
>>  package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git
>> a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
>> b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
>> index 2a8d2f9..7fc7d92 100644
>> --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
>> +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
>> @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
>>   config_add_int rxantenna txantenna antenna_gain txpower distance
>>   config_add_boolean noscan ht_coex
>>   config_add_array ht_capab
>> + config_add_array channels
>>   config_add_boolean \
>>   rxldpc \
>>   short_gi_80 \
>> @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
>>   json_select config
>>
>>   [ "$auto_channel" -gt 0 ] && channel=acs_survey
>> + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
>>
>>   json_get_vars noscan ht_coex
>>   json_get_values ht_capab_list ht_capab
>> @@ -301,6 +303,7 @@ mac80211_hostapd_setup_base() {
>>   hostapd_prepare_device_config "$hostapd_conf_file" nl80211
>>   cat >> "$hostapd_conf_file" <>  ${channel:+channel=$channel}
>> +${channel_list:+chanlist=$channel_list}
>>  ${noscan:+noscan=$noscan}
>>  $base_cfg
>>
>> --
>> 1.8.4.5
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
> - --
> Sent using Mailpile, Free Software from www.mailpile.is
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
>
> iQIcBAEBAgAGBQJWL60hAAoJEBmotQ/U1cr2pcQQAItADyz+iVHcaUZTD4e/fI2E
> Gs4M7UFF0KZbixE19GRWI0bEmOrMEUtlRF5xLFISGhw4BhKiDlY4K/pGTT2Cf6I3
> 1mdHGbx+rJ8KbwF2DjgUODHB47LyFvMi48GmgaEQMAgbIRgAN8W5fLUrF6JfYrTx
> zUkYgpZJ0PVSHBbbjdhIVS4mfbdHJjsdIsyj1GR9X6hxKvLwv8s+m2PGR6OFJJKG
> HNLarViM1cXwLotoTbEkTTPaSNuaU/ccVthQueCYooSjP0WqM2JDBXdYceT0HOjf
> DM6wiAm+vQQ94RtObtp6/0Nh+ADUeFP0NE7UATpUfbcwjmnzrJK5mdT0iXlAula0
> pFQfTemQe5sjW7rhfAMwyKIWAhcTNm9sS22k+iq9dXOoTZB7QdXAvbE+iRsfgPHL
> 1rOsgXXKOy42yiu+SNUREUNR44momxOlI+/yttaxEJGzyg2bROQXtPxnEHJkBBp0
> OJ0Y1F/Yv2fdagQ9CceVxVzL4rDL9icklJmnB8sVVhEUHGk35CpQeQ4X2un6PMgj
> PGT4a92lF16sMhvJEloeBtuQhnpCZglAIiW4hQ3ErQmrvmK+52LDm0En9MkoyxtO
> 49LSQgvm/XnZMkyAK10e58B37hfZSZLUl7e6WN70EXPf3/s6yHquDxvVu6oMsj9q
> ztAlT9mIcj4S++IR7QPE
> =g14m
> -END PGP SIGNATURE-
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH procd] watchdog: shutdown the kernel watchdog when stopping

2015-09-28 Thread Helmut Schaa
On Mon, Sep 28, 2015 at 12:58 AM, Alexander Couzens  wrote:
> The kernel wdt counting down even when not pinged.
> Shutdown the filehandler to /dev/watchdog with magic cookie
> to prevent this.
>
> Signed-off-by: Alexander Couzens 
> ---
>  watchdog.c | 17 ++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
>
> I'm not certainly clear, the previous behaviour was a bug or feature.
> If stop=True should really only stop the pinging thread, I really would like
> to shutdown the watchdog gracefully on another way. E.g. with another argument
> shutdown.
>

I've always interpreted the call that it just stops triggering the
watchdog and might
force a hw reset. So IMO it would make sense to add a parameter to specify the
exact action that should be taken.

Helmut

> Best lynxis
>
> diff --git a/watchdog.c b/watchdog.c
> index 592ae7e..025942b 100644
> --- a/watchdog.c
> +++ b/watchdog.c
> @@ -45,11 +45,23 @@ static void watchdog_timeout_cb(struct uloop_timeout *t)
> uloop_timeout_set(t, wdt_frequency * 1000);
>  }
>
> +static void watchdog_stop()
> +{
> +   if (wdt_fd >= 0 && write(wdt_fd, "V", 1) < 0)
> +   ERROR("WDT failed to write magic close sequence: %s\n"
> + "WDT may not stopped properly.\n", strerror(errno));
> +   if (close(wdt_fd) < 0)
> +   ERROR("WDT failed to close watchdog fd: %s\n"
> + "WDT may not stopped properly.\n", strerror(errno));
> +   wdt_fd = -1;
> +}
> +
>  void watchdog_set_stopped(bool val)
>  {
> -   if (val)
> +   if (val) {
> uloop_timeout_cancel(_timeout);
> -   else
> +   watchdog_stop();
> +   } else
> watchdog_timeout_cb(_timeout);
>  }
>
> @@ -125,7 +137,6 @@ void watchdog_init(int preinit)
> DEBUG(4, "Opened watchdog with timeout %ds\n", watchdog_timeout(0));
>  }
>
> -
>  void watchdog_no_cloexec(void)
>  {
> if (wdt_fd < 0)
> --
> 2.5.3
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC] procd: Allow to enable endless respawning of services

2015-09-22 Thread Helmut Schaa
On Mon, Sep 21, 2015 at 6:14 PM, Yousong Zhou <yszhou4t...@gmail.com> wrote:
> Hi, Helmut
>
> On 21 September 2015 at 23:26, Helmut Schaa <helmut.sc...@googlemail.com> 
> wrote:
>> Extend /etc/config/system with a parameter to enable
>> infinite respawn mode:
>>
>> config system
>> option service_endless_respawn 1
>>
>> All services that don't specify specific respawn parameters
>> will get their defaults added by procd.sh and if service_endless_respawn
>> is set respawn_retry will be set to -1. This makes procd to
>> respawn the service forever.
>
> How about making it a separate section like "config service", then we
> can later add other default service options, e.g. "limits
> core=unlimited".

Makes sense I guess.

>>
>> Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
>> ---
>>  package/system/procd/files/procd.sh | 12 
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/package/system/procd/files/procd.sh 
>> b/package/system/procd/files/procd.sh
>> index e83e75c..04111b9 100644
>> --- a/package/system/procd/files/procd.sh
>> +++ b/package/system/procd/files/procd.sh
>> @@ -316,6 +316,18 @@ _procd_append_param() {
>>  }
>>
>>  _procd_close_instance() {
>> +   local respawn_vals
>> +   if json_select respawn ; then
>> +   json_get_values respawn_vals
>> +   if [ -z "$respawn_vals" ]; then
>> +   # Set respawn defaults
>> +   local respawn_retry
>> +   [[ -n "$(uci_get 
>> system.@system[0].service_endless_respawn)" ]] && respawn_retry=-1
>
> I think the convention here is to use "[ ]" instead of "[[ ]]".  also
> please use something like "$(uci -q get ...)" or "$(uci get ...
> 2>/dev/null)" to squash the possible "Entry not found" error there.

uci_get from /lib/config/uci.sh handles that just fine.

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [RFC] procd: Allow to enable endless respawning of services

2015-09-21 Thread Helmut Schaa
Extend /etc/config/system with a parameter to enable
infinite respawn mode:

config system
option service_endless_respawn 1

All services that don't specify specific respawn parameters
will get their defaults added by procd.sh and if service_endless_respawn
is set respawn_retry will be set to -1. This makes procd to
respawn the service forever.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---
 package/system/procd/files/procd.sh | 12 
 1 file changed, 12 insertions(+)

diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index e83e75c..04111b9 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -316,6 +316,18 @@ _procd_append_param() {
 }
 
 _procd_close_instance() {
+   local respawn_vals
+   if json_select respawn ; then
+   json_get_values respawn_vals
+   if [ -z "$respawn_vals" ]; then
+   # Set respawn defaults
+   local respawn_retry
+   [[ -n "$(uci_get 
system.@system[0].service_endless_respawn)" ]] && respawn_retry=-1
+   _procd_add_array_data 3600 5 ${respawn_retry:-5}
+   fi
+   json_select ..
+   fi
+
json_close_object
 }
 
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] procd: Allow override of default respawn parameters

2015-09-18 Thread Helmut Schaa
Hi John,

On Fri, Sep 18, 2015 at 10:18 AM, John Crispin <blo...@openwrt.org> wrote:
> Hi
>
> On 18/09/2015 09:59, Helmut Schaa wrote:
>> Allow to pass RESPAWN_THESHOLD_DEFAULT, DRESPAWN_TIMEOUT_DEFAULT
>> and RESPAWN_RETRY_DEFAULT as parameters to cmake to change the
>> default respawn behavior.
>>
>
> technically ok but why cant you tweak them in your packages initd script
> ? i am wondering what the use case is and if there are other possible
> solutions

In our tree we've patched most (maybe even all) services to respawn forever
(respawn_retry=-1). Including all OpenWrt provided services. Instead of keeping
these local modifications to several packages it's easier to just
override procds
default behavior.

I think there might be other people around running OpenWrt on headless boxes
where the respawn retry should not be limited by default. However,
this is of course
not suitable for a default OpenWrt box.

If there are good reasons not to include this in procd feel free to
drop this patch.
However, it causes zero runtime overhead and is quite simple.

As a followup I'd add a config flag for procd "respawn_forver_mode" or so that
just sets respawn_retry to -1.

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] procd: Allow override of default respawn parameters

2015-09-18 Thread Helmut Schaa
Allow to pass RESPAWN_THESHOLD_DEFAULT, DRESPAWN_TIMEOUT_DEFAULT
and RESPAWN_RETRY_DEFAULT as parameters to cmake to change the
default respawn behavior.

This can be used to set the default respawn mode to infinite retries
for example.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---
 CMakeLists.txt | 12 
 service/instance.c |  4 +++-
 service/instance.h | 12 +++-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6af17a3..721a381 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,18 @@ SET(SOURCES procd.c signal.c watchdog.c state.c  
inittab.c rcS.c ubus.c system.c
 
 SET(LIBS ubox ubus json-c blobmsg_json json_script)
 
+IF(RESPAWN_THESHOLD_DEFAULT)
+  ADD_DEFINITIONS(-DRESPAWN_THESHOLD_DEFAULT=${RESPAWN_THESHOLD_DEFAULT})
+ENDIF()
+
+IF(RESPAWN_TIMEOUT_DEFAULT)
+  ADD_DEFINITIONS(-DRESPAWN_TIMEOUT_DEFAULT=${RESPAWN_TIMEOUT_DEFAULT})
+ENDIF()
+
+IF(RESPAWN_RETRY_DEFAULT)
+  ADD_DEFINITIONS(-DRESPAWN_RETRY_DEFAULT=${RESPAWN_RETRY_DEFAULT})
+ENDIF()
+
 IF(DEBUG)
   ADD_DEFINITIONS(-DDEBUG -g3)
 ENDIF()
diff --git a/service/instance.c b/service/instance.c
index 40ff021..9d4df7c 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -709,7 +709,9 @@ instance_config_parse(struct service_instance *in)
 
if (tb[INSTANCE_ATTR_RESPAWN]) {
int i = 0;
-   uint32_t vals[3] = { 3600, 5, 5};
+   uint32_t vals[3] = { RESPAWN_THRESHOLD_DEFAULT,
+RESPAWN_TIMEOUT_DEFAULT,
+RESPAWN_RETRY_DEFAULT };
 
blobmsg_for_each_attr(cur2, tb[INSTANCE_ATTR_RESPAWN], rem) {
if ((i >= 3) && (blobmsg_type(cur2) == 
BLOBMSG_TYPE_STRING))
diff --git a/service/instance.h b/service/instance.h
index 3fb33e9..ab05f20 100644
--- a/service/instance.h
+++ b/service/instance.h
@@ -20,7 +20,17 @@
 #include 
 #include "../utils/utils.h"
 
-#define RESPAWN_ERROR  (5 * 60)
+#ifndef RESPAWN_THRESHOLD_DEFAULT
+#define RESPAWN_THRESHOLD_DEFAULT 3600
+#endif
+
+#ifndef RESPAWN_TIMEOUT_DEFAULT
+#define RESPAWN_TIMEOUT_DEFAULT 5
+#endif
+
+#ifndef RESPAWN_RETRY_DEFAULT
+#define RESPAWN_RETRY_DEFAULT 5
+#endif
 
 struct jail {
bool procfs;
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] procd: Allow override of default respawn parameters

2015-09-18 Thread Helmut Schaa
On Fri, Sep 18, 2015 at 11:52 AM, John Crispin <blo...@openwrt.org> wrote:
>
>
> On 18/09/2015 11:40, Etienne Champetier wrote:
>> Hi,
>>
>> 2015-09-18 11:03 GMT+02:00 Helmut Schaa <helmut.sc...@googlemail.com
>> <mailto:helmut.sc...@googlemail.com>>:
>>
>> Hi John,
>>
>> On Fri, Sep 18, 2015 at 10:18 AM, John Crispin <blo...@openwrt.org
>> <mailto:blo...@openwrt.org>> wrote:
>> > Hi
>> >
>> > On 18/09/2015 09:59, Helmut Schaa wrote:
>> >> Allow to pass RESPAWN_THESHOLD_DEFAULT, DRESPAWN_TIMEOUT_DEFAULT
>> >> and RESPAWN_RETRY_DEFAULT as parameters to cmake to change the
>> >> default respawn behavior.
>> >>
>> >
>> > technically ok but why cant you tweak them in your packages initd 
>> script
>> > ? i am wondering what the use case is and if there are other possible
>> > solutions
>>
>> In our tree we've patched most (maybe even all) services to respawn
>> forever
>> (respawn_retry=-1). Including all OpenWrt provided services. Instead
>> of keeping
>> these local modifications to several packages it's easier to just
>> override procds
>> default behavior.
>>
>> I think there might be other people around running OpenWrt on
>> headless boxes
>> where the respawn retry should not be limited by default. However,
>> this is of course
>> not suitable for a default OpenWrt box.
>>
>> If there are good reasons not to include this in procd feel free to
>> drop this patch.
>> However, it causes zero runtime overhead and is quite simple.
>>
>> As a followup I'd add a config flag for procd "respawn_forver_mode"
>> or so that
>> just sets respawn_retry to -1.
>>
>> Helmut
>>
>> It would be great to be able to configure these settings at runtime (ie
>> in an uci file)
>>
>> Etienne
>>
>
> agreed, i think the best would be to add support for -1 == endless
> respawn and then change procd.sh to use current values as default but
> allow overriding them vom /etc/config/system or similar. would that
> solve your use case ?

Hmm, could work. However, changing the setting in /etc/config/system would
only affect all services started after the config file change. In our case we'd
just add it to the default /etc/config/system ...

Let me look into it next week.

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] base-files: fix ramoverlay function with kernels 3.18+

2015-09-17 Thread Helmut Schaa
Even though there are not many users left within the OpenWrt tree it seems
this function broke during the kernel 3.18 transition.

Fix it by providing a workdir as required by overlayfs.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---
 package/base-files/files/lib/functions/preinit.sh | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/package/base-files/files/lib/functions/preinit.sh 
b/package/base-files/files/lib/functions/preinit.sh
index db1f298..57862a1 100644
--- a/package/base-files/files/lib/functions/preinit.sh
+++ b/package/base-files/files/lib/functions/preinit.sh
@@ -75,13 +75,14 @@ pivot() { #  
}
 }
 
-fopivot() { #   <dupe?>
-   /bin/mount -o noatime,lowerdir=/,upperdir=$1 -t overlayfs 
"overlayfs:$1" /mnt
-   pivot /mnt $2
+fopivot() { #<dupe?>
+   /bin/mount -o noatime,lowerdir=/,upperdir=$1,workdir=$2 -t overlay 
"overlayfs:$1" /mnt
+   pivot /mnt $3
 }
 
 ramoverlay() {
mkdir -p /tmp/root
/bin/mount -t tmpfs -o noatime,mode=0755 root /tmp/root
-   fopivot /tmp/root /rom 1
+   mkdir -p /tmp/root/root /tmp/root/work
+   fopivot /tmp/root/root /tmp/root/work /rom 1
 }
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] openwrt/hardening: Fix CFLAGS usage for -D_FORTIFY_SOURCE

2015-09-08 Thread Helmut Schaa
On Mon, Sep 7, 2015 at 6:19 PM, Steven Barth  wrote:
> NAK.
> Not many package build systems honors CPPFLAGS so this solution is 
> impractical,
> since it effectively disables fortification for many of them.
>
> To my knowledge c-ares is the only package enforcing this kind of behavior
> so it should be fixed to work with our buildsystem instead.

Thanks for the info. Please drop this patch then ...
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] openwrt/hardening: Fix CFLAGS usage for -D_FORTIFY_SOURCE

2015-09-08 Thread Helmut Schaa
On Tue, Sep 8, 2015 at 9:03 AM, Stefan Peter <st3fanp3...@gmail.com> wrote:
> Hi
> Am 07.09.2015 um 17:32 schrieb Helmut Schaa:
>> Fix the following configure error with c-ares by using CPPFLAGS for 
>> -D_FORTIFY_SOURCE.
>> Not sure if any other packages suffer from the same issue.
>>
>> configure: using CFLAGS: -Os -pipe -march=74kc -fno-caller-saves 
>> -mno-branch-likely -g3 -fno-caller-saves -fhonour-copts 
>> -Wno-error=unused-but-set-variable -msoft-float -D_FORTIFY_SOURCE=1 
>> -Wl,-z,now -Wl,-z,relro
>> configure: CFLAGS error: CFLAGS may only be used to specify C compiler 
>> flags, not macro definitions. Use CPPFLAGS for: -D_FORTIFY_SOURCE=1
>> configure: error: Can not continue. Fix errors mentioned immediately above 
>> this line.
>
> Did you get this in the CC branch?
>
> According to
> https://github.com/openwrt/packages/pull/1464
> this should be fixed in master and applying this patch on top of the CC
> branch worked for me.

I came up with a similar patch now :) but good to know it's fixed in
master already.
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] openwrt/hardening: Fix CFLAGS usage for -D_FORTIFY_SOURCE

2015-09-07 Thread Helmut Schaa
Fix the following configure error with c-ares by using CPPFLAGS for 
-D_FORTIFY_SOURCE.
Not sure if any other packages suffer from the same issue.

configure: using CFLAGS: -Os -pipe -march=74kc -fno-caller-saves 
-mno-branch-likely -g3 -fno-caller-saves -fhonour-copts 
-Wno-error=unused-but-set-variable -msoft-float -D_FORTIFY_SOURCE=1 -Wl,-z,now 
-Wl,-z,relro
configure: CFLAGS error: CFLAGS may only be used to specify C compiler flags, 
not macro definitions. Use CPPFLAGS for: -D_FORTIFY_SOURCE=1
configure: error: Can not continue. Fix errors mentioned immediately above this 
line.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---
 include/hardening.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/hardening.mk b/include/hardening.mk
index c277081..4de9cfc 100644
--- a/include/hardening.mk
+++ b/include/hardening.mk
@@ -27,12 +27,12 @@ ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
 endif
 ifdef CONFIG_PKG_FORTIFY_SOURCE_1
   ifeq ($(strip $(PKG_FORTIFY_SOURCE)),1)
-TARGET_CFLAGS += -D_FORTIFY_SOURCE=1
+TARGET_CPPFLAGS += -D_FORTIFY_SOURCE=1
   endif
 endif
 ifdef CONFIG_PKG_FORTIFY_SOURCE_2
   ifeq ($(strip $(PKG_FORTIFY_SOURCE)),1)
-TARGET_CFLAGS += -D_FORTIFY_SOURCE=2
+TARGET_CPPFLAGS += -D_FORTIFY_SOURCE=2
   endif
 endif
 ifdef CONFIG_PKG_RELRO_PARTIAL
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] hostapd: Add eapol_version config option

2015-09-01 Thread Helmut Schaa
Add eapol_version to the openwrt wireless config ssid section.
Only eapol_version=1 and 2 will get passed to hostapd, the default
in hostapd is 2.

This is only useful for really old client devices that don't
accept eapol_version=2.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---
 package/network/services/hostapd/files/netifd.sh | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/package/network/services/hostapd/files/netifd.sh 
b/package/network/services/hostapd/files/netifd.sh
index d90ff9b..bdfcbb2 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -120,6 +120,7 @@ hostapd_common_add_bss_config() {
 
config_add_boolean rsn_preauth auth_cache
config_add_int ieee80211w
+   config_add_int eapol_version
 
config_add_string 'auth_server:host' 'server:host'
config_add_string auth_secret
@@ -183,7 +184,7 @@ hostapd_set_bss_options() {
wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
wps_device_type wps_device_name wps_manufacturer wps_pin \
macfilter ssid wmm uapsd hidden short_preamble rsn_preauth \
-   iapp_interface
+   iapp_interface eapol_version
 
set_default isolate 0
set_default maxassoc 0
@@ -238,6 +239,8 @@ hostapd_set_bss_options() {
[ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
append bss_conf "wpa_psk_file=$wpa_psk_file" 
"$N"
}
+   [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" 
] && append bss_conf "eapol_version=$eapol_version" "$N"
+
wps_possible=1
append wpa_key_mgmt "WPA-PSK"
;;
@@ -297,6 +300,8 @@ hostapd_set_bss_options() {
append bss_conf "vlan_file=$vlan_file" 
"$N"
}
}
+
+   [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" 
] && append bss_conf "eapol_version=$eapol_version" "$N"
;;
wep)
local wep_keyidx=0
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] [RESEND] swconfig: swlib.c: Fix another memleak

2015-07-08 Thread Helmut Schaa
On Wed, Jul 8, 2015 at 2:05 PM, Felix Fietkau n...@openwrt.org wrote:
 On 2015-07-08 08:37, Alexandru Ardelean wrote:
 From: Helmut Schaa h...@ocedo.com

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 Erm... The author is supposed to add the Signed-off-by himself, as
 described in https://dev.openwrt.org/wiki/SubmittingPatches

Sorry, should have used my googlemail address ...

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] kernel: watchdog modules should be loaded on boot

2015-04-02 Thread Helmut Schaa
Otherwise procd cannot initialize the watchdog since the module will
be loaded later.

Tested with booke_wdt.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 package/kernel/linux/modules/other.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index 20964f5..36d3ef9 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -468,7 +468,7 @@ define KernelPackage/wdt-omap
   DEPENDS:=@(TARGET_omap24xx||TARGET_omap35xx)
   KCONFIG:=CONFIG_OMAP_WATCHDOG
   FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/omap_wdt.ko
-  AUTOLOAD:=$(call AutoLoad,50,omap_wdt.ko)
+  AUTOLOAD:=$(call AutoLoad,50,omap_wdt.ko,1)
 endef
 
 define KernelPackage/wdt-omap/description
@@ -484,7 +484,7 @@ define KernelPackage/wdt-orion
   DEPENDS:=@TARGET_orion||TARGET_kirkwood||TARGET_mvebu
   KCONFIG:=CONFIG_ORION_WATCHDOG
   FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/orion_wdt.ko
-  AUTOLOAD:=$(call AutoLoad,50,orion_wdt)
+  AUTOLOAD:=$(call AutoLoad,50,orion_wdt,1)
 endef
 
 define KernelPackage/wdt-orion/description
@@ -500,7 +500,7 @@ define KernelPackage/booke-wdt
   DEPENDS:=@(TARGET_mpc85xx||TARGET_ppc40x||TARGET_ppc44x)
   KCONFIG:=CONFIG_BOOKE_WDT
   FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/booke_wdt.ko
-  AUTOLOAD:=$(call AutoLoad,50,booke_wdt)
+  AUTOLOAD:=$(call AutoLoad,50,booke_wdt,1)
 endef
 
 define KernelPackage/booke-wdt/description
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] elfutils with external toolchain uClibc

2015-02-02 Thread Helmut Schaa
Hi,

elfutils fails to build with an external toolchain using
uClibc due to the following dependency:

PKG_BUILD_DEPENDS:=USE_UCLIBC:argp-standalone

I tried to select USE_UCLIBC as part of the external
toolchain settings but that is used at quite some points
within the toolchain config.

Any ideas how to enable UCLIBC specific package
dependencies for external toolchains?

Thanks,
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] toolchain: Add libatomic when using external toolchain

2015-01-13 Thread Helmut Schaa
Otherwise libatomic cannot be used in conjunction with external toolchains.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 package/libs/toolchain/Makefile | 9 +
 1 file changed, 9 insertions(+)

diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile
index 1a75e90..42b9935 100644
--- a/package/libs/toolchain/Makefile
+++ b/package/libs/toolchain/Makefile
@@ -604,6 +604,15 @@ else
exit 0
   endef
 
+  define Package/libatomic/install
+   for file in $(call qstrip,$(CONFIG_LIBATOMIC_FILE_SPEC)); do \
+   dir=`dirname file` ; \
+   $(INSTALL_DIR) $(1)/dir ; \
+   $(CP) $(call qstrip,$(CONFIG_LIBATOMIC_ROOT_DIR))/file 
$(1)/dir/ ; \
+   done ; \
+   exit 0
+  endef
+
   define Package/ldd/install
for file in $(call qstrip,$(CONFIG_LDD_FILE_SPEC)); do \
dir=`dirname file` ; \
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] AR9344 pcie fails to start (sometimes)

2014-12-10 Thread Helmut Schaa
Hi,

Did anyone else see issues with ar9344 PCIe not coming up sometimes
(it is really rare in my case)?

Good boot dmesg:

[0.07] registering PCI controller with io_map_base unset
[0.28] bio: create slab bio-0 at 0
[0.28] PCI host bridge to bus :00
[0.28] pci_bus :00: root bus resource [mem
0x1000-0x13ff]
[0.28] pci_bus :00: root bus resource [io  0x]
[0.28] pci_bus :00: No busn resource found for root bus,
will use [bus 00-ff]
[0.28] pci :00:00.0: [168c:0030] type 00 class 0x028000
[0.28] pci :00:00.0: invalid calibration data
[0.29] pci :00:00.0: reg 10: [mem 0x-0x0001
64bit]
[0.29] pci :00:00.0: reg 30: [mem 0x-0x
pref]
[0.29] pci :00:00.0: supports D1
[0.29] pci :00:00.0: PME# supported from D0 D1 D3hot
[0.29] pci_bus :00: busn_res: [bus 00-ff] end is updated to 00
[0.29] pci :00:00.0: BAR 0: assigned [mem
0x1000-0x1001 64bit]
[0.29] pci :00:00.0: BAR 6: assigned [mem
0x1002-0x1002 pref]
[0.29] pci :00:00.0: using irq 40 for pin 1

Bad boot dmesg:

[0.07] ar724x-pci ar724x-pci: PCIe link is down
[0.07] registering PCI controller with io_map_base unset
[0.28] bio: create slab bio-0 at 0
[0.28] PCI host bridge to bus :00
[0.28] pci_bus :00: root bus resource [mem
0x1000-0x13ff]
[0.28] pci_bus :00: root bus resource [io  0x]
[0.28] pci_bus :00: No busn resource found for root bus,
will use [bus 00-ff]
[0.28] pci_bus :00: busn_res: [bus 00-ff] end is updated to 00

In this state no device is detected on the PCI bus.

Any ideas?

Thanks,
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Status of ACS survey with rt2x00 driver using hostapd

2014-08-21 Thread Helmut Schaa
Hi,
On Mon, Aug 18, 2014 at 3:27 PM, Yousong Zhou yszhou4t...@gmail.com wrote:
 Hi,

 I am trying to get ACS working on my available devices.

 What I have noticed is that the command `iw phy phy0 survey dump`
 returned different result between HiWiFi HC6361 which uses ath9k
 driver and a MT7620A based device using rt2x00 driver.   On HC6361,
 the command displayed statistics for all 11 channels, while only 1
 channel's statistics was fetched on the MT7620A device.

 I checked with related code of hostapd, ath9k, rt2x00, and found the
 cause in `rt2800_get_survey()`.  Is this behaviour determined by
 hardware that hostapd's current ACS implementation is not expected to
 work with rt2x00 driver?

 Hmm, how about the solution of adding a function akin to
 `ath_update_survey_stats()` for rt2x00?

Your observation is correct, rt2x00 only returns survey data for the current
channel. I also thought about doing the same approach as ath9k but duplicating
the code seems not reasonable. It might make more sense to move the
survey data buffering to mac80211 and use it from ath9k and rt2x00.

However, as a first start you could emulate ath9k's behavior in rt2x00.
Furthermore rt2x00 does not report noise floor in its survey data which
is also use by hostapd's ACS implementation. Not sure what hostapd
does if that is not present.

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC] openwrt: Allow extraction of debuginfo from all binaries

2014-08-04 Thread Helmut Schaa
Hi Felix,

On Fri, Aug 1, 2014 at 1:27 PM, Felix Fietkau n...@openwrt.org wrote:
 On 2014-07-24 17:26, Helmut Schaa wrote:
 Introduce a new config symbol EXTRACT_DEBUGINFO to extract debuginfo
 from all binaries. This depends on USE_STRIP and DEBUG.

 The debuginfo of all packages will be extracted from the binary
 and copied into bin/$platform/debuginfo.

 This allows better debugging of coredumps by loading the debuginfo
 into gdb.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 How does this patch help with debugging? Debug info is already staged in
 staging_dir/target-*/root-*. This path is used by scripts/remote-gdb,
 which also accepts corefiles.

Hmm, didn't know about this till now :(

So, the staging root contains all non-stripped binaries, correct?
Hence building with -g3 and strip should create a staging root with
full debuginfo
but the resulting image will still have stripped binaries without debuginfo?

If this is the case my patch is superfluous :)

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [RFC] openwrt: Allow extraction of debuginfo from all binaries

2014-07-24 Thread Helmut Schaa
Introduce a new config symbol EXTRACT_DEBUGINFO to extract debuginfo
from all binaries. This depends on USE_STRIP and DEBUG.

The debuginfo of all packages will be extracted from the binary
and copied into bin/$platform/debuginfo.

This allows better debugging of coredumps by loading the debuginfo
into gdb.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---

Any comments?
Helmut

 config/Config-build.in   | 10 ++
 include/package-ipkg.mk  |  5 -
 rules.mk |  9 +
 scripts/extract-debug.sh | 41 +
 4 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 scripts/extract-debug.sh

diff --git a/config/Config-build.in b/config/Config-build.in
index 371ae76..60b0975 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -165,6 +165,16 @@ menu Global build settings
  This will install binaries stripped using sstrip
endchoice
 
+   config EXTRACT_DEBUGINFO
+   bool
+   prompt Extract debug info from binaries
+   depends on USE_STRIP
+   depends on DEBUG
+   default n
+   help
+   Extract debuginfo from binaries for better cross 
debugging without
+   wasting space on the target device.
+
config STRIP_ARGS
string
prompt Strip arguments
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 9783a63..b64775e 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -76,6 +76,7 @@ ifeq ($(DUMP),)
   define BuildTarget/ipkg
 IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
+DDIR_$(1):=$(PKG_BUILD_DIR)/debuginfo-$(PKGARCH)
 KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
 
 ifeq ($(BUILD_VARIANT),$$(if $$(VARIANT),$$(VARIANT),$(BUILD_VARIANT)))
@@ -134,7 +135,7 @@ ifeq ($(DUMP),)
 $(PKG_INFO_DIR)/$(1).provides: $$(IPKG_$(1))
 $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk
@rm -rf $(PACKAGE_DIR)/$(1)_* $$(IDIR_$(1))
-   mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
+   mkdir -p $(PACKAGE_DIR) $(DEBUGINFO_DIR) $$(IDIR_$(1))/CONTROL 
$(PKG_INFO_DIR) $$(DDIR_$(1))
$(call Package/$(1)/install,$$(IDIR_$(1)))
-find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name 
'*~'| $(XARGS) rm -rf
@( \
@@ -148,6 +149,7 @@ ifeq ($(DUMP),)
$(if $(PROVIDES),@for pkg in $(PROVIDES); do cp 
$(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/pkg.provides; done)
$(CheckDependencies)
 
+   $(EXTRACT_DEBUG) $$(DDIR_$(1)) $$(IDIR_$(1))
$(RSTRIP) $$(IDIR_$(1))
( \
echo Package: $(1); \
@@ -187,6 +189,7 @@ ifeq ($(DUMP),)
)
 endif
 
+   if [ -e $$(DDIR_$(1))/* ]; then cp -r $$(DDIR_$(1))/* $(DEBUGINFO_DIR)/ 
; fi
$(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
@[ -f $$(IPKG_$(1)) ]
 
diff --git a/rules.mk b/rules.mk
index a84636a..6d01c76 100644
--- a/rules.mk
+++ b/rules.mk
@@ -98,6 +98,7 @@ else
 endif
 
 PACKAGE_DIR:=$(BIN_DIR)/packages
+DEBUGINFO_DIR:=$(BIN_DIR)/debuginfo
 BUILD_DIR:=$(BUILD_DIR_BASE)/$(TARGET_DIR_NAME)
 STAGING_DIR:=$(TOPDIR)/staging_dir/$(TARGET_DIR_NAME)
 BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/$(TOOLCHAIN_DIR_NAME)
@@ -257,6 +258,14 @@ else
 $(SCRIPT_DIR)/rstrip.sh
 endif
 
+ifeq ($(CONFIG_EXTRACT_DEBUGINFO),y)
+  EXTRACT_DEBUG:= \
+OBJCOPY=$(TARGET_CROSS)objcopy \
+$(SCRIPT_DIR)/extract-debug.sh
+else
+  EXTRACT_DEBUG:=:
+endif
+
 ifeq ($(CONFIG_IPV6),y)
   DISABLE_IPV6:=
 else
diff --git a/scripts/extract-debug.sh b/scripts/extract-debug.sh
new file mode 100644
index 000..188be2d
--- /dev/null
+++ b/scripts/extract-debug.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+# 
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+SELF=${0##*/}
+
+[ -z $OBJCOPY ]  {
+  echo $SELF: objcopy command not defined (OBJCOPY variable not set)
+  exit 1
+}
+
+DESTDIR=$1
+
+[ -z $DESTDIR ]  {
+  echo $SELF: no destdir specified
+  exit 1
+}
+
+TARGET=$2
+
+[ -z $TARGET ]  {
+  echo $SELF: no directories / files specified
+  echo usage: $SELF [PATH...]
+  exit 1
+}
+
+find $TARGET -type f -a -exec file {} \; | \
+  sed -n -e 's/^\(.*\):.*ELF.*\(executable\|shared object\).*,.* 
stripped/\1:\2/p' | \
+(
+  IFS=:
+  while read F S; do
+echo $SELF: $F:$S
+eval mkdir -p $DESTDIR/`echo ${F%/*} | sed s#$TARGET##`
+eval $OBJCOPY --only-keep-debug $F $DESTDIR/`echo $F | sed 
s#$TARGET##`.debug
+eval $OBJCOPY --add-gnu-debuglink=$DESTDIR/`echo $F | sed 
s#$TARGET##`.debug $F
+  done
+  true
+)
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman

Re: [OpenWrt-Devel] [PATCH] AA: OpenSSL: fix CVE-2014-0160

2014-04-08 Thread Helmut Schaa
On Tue, Apr 8, 2014 at 4:47 AM, Stijn Tintel st...@linux-ipv6.be wrote:
 This patch, taken from upstream commit
 96db9023b881d7cd9f379b0c154650d6c108e9a3, fixes the Heartbleed bug
 (CVE-2014-0160).

IMHO it would make sense to update to 1.0.1g instead. At least I've done that
in my local tree ...
Helmut

 Signed-off-by: Stijn Tintel st...@linux-ipv6.be
 ---
  package/openssl/Makefile|  2 +-
  package/openssl/patches/210-CVE-2014-0160.patch | 87 
 +
  2 files changed, 88 insertions(+), 1 deletion(-)
  create mode 100644 package/openssl/patches/210-CVE-2014-0160.patch

 diff --git a/package/openssl/Makefile b/package/openssl/Makefile
 index fa08774..fc3d1cf 100644
 --- a/package/openssl/Makefile
 +++ b/package/openssl/Makefile
 @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

  PKG_NAME:=openssl
  PKG_VERSION:=1.0.1e
 -PKG_RELEASE:=1
 +PKG_RELEASE:=2

  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  PKG_SOURCE_URL:=http://www.openssl.org/source/ \
 diff --git a/package/openssl/patches/210-CVE-2014-0160.patch 
 b/package/openssl/patches/210-CVE-2014-0160.patch
 new file mode 100644
 index 000..245de18
 --- /dev/null
 +++ b/package/openssl/patches/210-CVE-2014-0160.patch
 @@ -0,0 +1,87 @@
 +--- a/ssl/d1_both.c
  b/ssl/d1_both.c
 +@@ -1452,26 +1452,36 @@ dtls1_process_heartbeat(SSL *s)
 +   unsigned int payload;
 +   unsigned int padding = 16; /* Use minimum padding */
 +
 +-  /* Read type and payload length first */
 +-  hbtype = *p++;
 +-  n2s(p, payload);
 +-  pl = p;
 +-
 +   if (s-msg_callback)
 +   s-msg_callback(0, s-version, TLS1_RT_HEARTBEAT,
 +   s-s3-rrec.data[0], s-s3-rrec.length,
 +   s, s-msg_callback_arg);
 +
 ++  /* Read type and payload length first */
 ++  if (1 + 2 + 16  s-s3-rrec.length)
 ++  return 0; /* silently discard */
 ++  hbtype = *p++;
 ++  n2s(p, payload);
 ++  if (1 + 2 + payload + 16  s-s3-rrec.length)
 ++  return 0; /* silently discard per RFC 6520 sec. 4 */
 ++  pl = p;
 ++
 +   if (hbtype == TLS1_HB_REQUEST)
 +   {
 +   unsigned char *buffer, *bp;
 ++  unsigned int write_length = 1 /* heartbeat type */ +
 ++  2 /* heartbeat length */ +
 ++  payload + padding;
 +   int r;
 +
 ++  if (write_length  SSL3_RT_MAX_PLAIN_LENGTH)
 ++  return 0;
 ++
 +   /* Allocate memory for the response, size is 1 byte
 +* message type, plus 2 bytes payload length, plus
 +* payload, plus padding
 +*/
 +-  buffer = OPENSSL_malloc(1 + 2 + payload + padding);
 ++  buffer = OPENSSL_malloc(write_length);
 +   bp = buffer;
 +
 +   /* Enter response type, length and copy payload */
 +@@ -1482,11 +1492,11 @@ dtls1_process_heartbeat(SSL *s)
 +   /* Random padding */
 +   RAND_pseudo_bytes(bp, padding);
 +
 +-  r = dtls1_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + 
 payload + padding);
 ++  r = dtls1_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 
 write_length);
 +
 +   if (r = 0  s-msg_callback)
 +   s-msg_callback(1, s-version, TLS1_RT_HEARTBEAT,
 +-  buffer, 3 + payload + padding,
 ++  buffer, write_length,
 +   s, s-msg_callback_arg);
 +
 +   OPENSSL_free(buffer);
 +--- a/ssl/t1_lib.c
  b/ssl/t1_lib.c
 +@@ -2486,16 +2486,20 @@ tls1_process_heartbeat(SSL *s)
 +   unsigned int payload;
 +   unsigned int padding = 16; /* Use minimum padding */
 +
 +-  /* Read type and payload length first */
 +-  hbtype = *p++;
 +-  n2s(p, payload);
 +-  pl = p;
 +-
 +   if (s-msg_callback)
 +   s-msg_callback(0, s-version, TLS1_RT_HEARTBEAT,
 +   s-s3-rrec.data[0], s-s3-rrec.length,
 +   s, s-msg_callback_arg);
 +
 ++  /* Read type and payload length first */
 ++  if (1 + 2 + 16  s-s3-rrec.length)
 ++  return 0; /* silently discard */
 ++  hbtype = *p++;
 ++  n2s(p, payload);
 ++  if (1 + 2 + payload + 16  s-s3-rrec.length)
 ++  return 0; /* silently discard per RFC 6520 sec. 4 */
 ++  pl = p;
 ++
 +   if (hbtype == TLS1_HB_REQUEST)
 +   {
 +   unsigned char *buffer, *bp;
 --
 1.8.3.2
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] AA: OpenSSL: fix CVE-2014-0160

2014-04-08 Thread Helmut Schaa
On Tue, Apr 8, 2014 at 2:14 PM, Helmut Schaa
helmut.sc...@googlemail.com wrote:
 On Tue, Apr 8, 2014 at 4:47 AM, Stijn Tintel st...@linux-ipv6.be wrote:
 This patch, taken from upstream commit
 96db9023b881d7cd9f379b0c154650d6c108e9a3, fixes the Heartbleed bug
 (CVE-2014-0160).

 IMHO it would make sense to update to 1.0.1g instead. At least I've done that
 in my local tree ...

Hmm, you already did that in a second patch :) Sorry for the noise.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv2 2/2] odhcp6c: Add renew handler for proto dhcpv6

2014-03-27 Thread Helmut Schaa
On Wed, Mar 26, 2014 at 8:25 PM, Bastian Bittorf bitt...@bluebottle.com wrote:
 * Jonas Gorski j...@openwrt.org [26.03.2014 20:18]:
  +proto_dhcpv6_renew() {
  +   local interface=$1
  +   # SIGUSR1 forces odhcp6c to renew its lease
  +   proto_kill_command $interface 16

 SIGUSR1 is 16 only for mips; other arches use different values (see
 e.g. 
 http://de.wikipedia.org/wiki/Signal_(Computer)#G.C3.A4ngige_UNIX-Signale).


 yes, have this on my todo-list:
 the signal should be humanreadable e.g. 'SIGUSR1' and
 then translated to the specific value, e.g. in
 /lib/netifd/netifd-proto.sh

 proto_kill_command()
 {
 local signal=$2   # e.g. USR1
 local code=$( kill -l | grep  $signal | cut -d')' -f1 )

 ...
 }

 can i send a patch or is this a bad idea?

I have a new version already in my local repo. Will send out later ...
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv3 2/2] odhcp6c: Add renew handler for proto dhcpv6

2014-03-27 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
Changes in v2: Tell netifd core that we have a renew handler
Changes in v3: Translate signal numbers using kill -l 

 package/network/ipv6/odhcp6c/files/dhcpv6.sh | 9 +
 1 file changed, 9 insertions(+)

diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh 
b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
index 9b6275e..90a8371 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
@@ -5,6 +5,8 @@
 init_proto $@
 
 proto_dhcpv6_init_config() {
+   renew_handler=1
+
proto_config_add_string 'reqaddress:or(try,force,none)'
proto_config_add_string 'reqprefix:or(auto,no,range(0, 64))'
proto_config_add_string clientid
@@ -67,6 +69,13 @@ proto_dhcpv6_setup() {
$opts $iface
 }
 
+proto_dhcpv6_renew() {
+   local interface=$1
+   # SIGUSR1 forces odhcp6c to renew its lease
+   local sigusr1=$(kill -l SIGUSR1)
+   [ -n $sigusr1 ]  proto_kill_command $interface $sigusr1
+}
+
 proto_dhcpv6_teardown() {
local interface=$1
proto_kill_command $interface
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv3 1/2] netifd: Add renew handler for proto dhcp

2014-03-27 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
Changes in v2: Tell netifd core that we have a renew handler
Changes in v3: Translate signal numbers using kill -l 

 package/network/config/netifd/files/lib/netifd/proto/dhcp.sh | 9 +
 1 file changed, 9 insertions(+)

diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh 
b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 93f4a5e..0530f0f 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -5,6 +5,8 @@
 init_proto $@
 
 proto_dhcp_init_config() {
+   renew_handler=1 
+
proto_config_add_string 'ipaddr:ipaddr'
proto_config_add_string 'netmask:ipaddr'
proto_config_add_string 'hostname:hostname'
@@ -52,6 +54,13 @@ proto_dhcp_setup() {
$clientid $broadcast $dhcpopts
 }
 
+proto_dhcp_renew() {
+   local interface=$1
+   # SIGUSR1 forces udhcpc to renew its lease
+   local sigusr1=$(kill -l SIGUSR1)
+   [ -n $sigusr1 ]  proto_kill_command $interface $sigusr1
+}
+
 proto_dhcp_teardown() {
local interface=$1
proto_kill_command $interface
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv2] netifd: Reload proto on topology change

2014-03-26 Thread Helmut Schaa
On Tue, Mar 25, 2014 at 4:50 PM, Felix Fietkau n...@openwrt.org wrote:
 On 2014-03-25 16:44, Helmut Schaa wrote:
 On Thu, Mar 20, 2014 at 4:26 PM, Helmut Schaa
 helmut.sc...@googlemail.com wrote:
 Introduce a new device event topology change that gets signaled
 by bridges on adding/removing members.

 On topology changes the proto handlers are requested to renew
 which is most useful for DHCP.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 ---

 Changes in v2:
 - Only run renew handler if registered during proto init

 Felix, did you have a chance to review this yet?
 Sorry, I forgot to ping you back. I merged this one a few days ago.


Thanks, I'll send patches for the dhcp and dhcpv6 proto scripts then ...
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv2 2/2] odhcp6c: Add renew handler for proto dhcpv6

2014-03-26 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---

Changes in v2: Tell netifd core that we have a renew handler


 package/network/ipv6/odhcp6c/files/dhcpv6.sh | 8 
 1 file changed, 8 insertions(+)

diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh 
b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
index 9b6275e..cd03c25 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
@@ -5,6 +5,8 @@
 init_proto $@
 
 proto_dhcpv6_init_config() {
+   renew_handler=1
+
proto_config_add_string 'reqaddress:or(try,force,none)'
proto_config_add_string 'reqprefix:or(auto,no,range(0, 64))'
proto_config_add_string clientid
@@ -67,6 +69,12 @@ proto_dhcpv6_setup() {
$opts $iface
 }
 
+proto_dhcpv6_renew() {
+   local interface=$1
+   # SIGUSR1 forces odhcp6c to renew its lease
+   proto_kill_command $interface 16
+}
+
 proto_dhcpv6_teardown() {
local interface=$1
proto_kill_command $interface
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv2 1/2] netifd: Add renew handler for proto dhcp

2014-03-26 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
Changes in v2: Tell netifd core that we have a renew handler

 package/network/config/netifd/files/lib/netifd/proto/dhcp.sh | 8 
 1 file changed, 8 insertions(+)

diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh 
b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 93f4a5e..4c03403 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -5,6 +5,8 @@
 init_proto $@
 
 proto_dhcp_init_config() {
+   renew_handler=1 
+
proto_config_add_string 'ipaddr:ipaddr'
proto_config_add_string 'netmask:ipaddr'
proto_config_add_string 'hostname:hostname'
@@ -52,6 +54,12 @@ proto_dhcp_setup() {
$clientid $broadcast $dhcpopts
 }
 
+proto_dhcp_renew() {
+   local interface=$1
+   # SIGUSR1 forces udhcpc to renew its lease
+   proto_kill_command $interface 16
+}
+
 proto_dhcp_teardown() {
local interface=$1
proto_kill_command $interface
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv2 2/2] odhcp6c: Add renew handler for proto dhcpv6

2014-03-26 Thread Helmut Schaa
On Wed, Mar 26, 2014 at 5:41 PM, Jonas Gorski j...@openwrt.org wrote:
 On Wed, Mar 26, 2014 at 5:11 PM, Helmut Schaa
 helmut.sc...@googlemail.com wrote:

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 ---

 Changes in v2: Tell netifd core that we have a renew handler


  package/network/ipv6/odhcp6c/files/dhcpv6.sh | 8 
  1 file changed, 8 insertions(+)

 diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh 
 b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
 index 9b6275e..cd03c25 100755
 --- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
 +++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
 @@ -5,6 +5,8 @@
  init_proto $@

  proto_dhcpv6_init_config() {
 +   renew_handler=1
 +
 proto_config_add_string 'reqaddress:or(try,force,none)'
 proto_config_add_string 'reqprefix:or(auto,no,range(0, 64))'
 proto_config_add_string clientid
 @@ -67,6 +69,12 @@ proto_dhcpv6_setup() {
 $opts $iface
  }

 +proto_dhcpv6_renew() {
 +   local interface=$1
 +   # SIGUSR1 forces odhcp6c to renew its lease
 +   proto_kill_command $interface 16

 SIGUSR1 is 16 only for mips; other arches use different values (see
 e.g. 
 http://de.wikipedia.org/wiki/Signal_(Computer)#G.C3.A4ngige_UNIX-Signale).

Ouch, thanks for catching that!
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv2] netifd: Reload proto on topology change

2014-03-25 Thread Helmut Schaa
On Thu, Mar 20, 2014 at 4:26 PM, Helmut Schaa
helmut.sc...@googlemail.com wrote:
 Introduce a new device event topology change that gets signaled
 by bridges on adding/removing members.

 On topology changes the proto handlers are requested to renew
 which is most useful for DHCP.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 ---

 Changes in v2:
 - Only run renew handler if registered during proto init

Felix, did you have a chance to review this yet?

Thanks,
Helmut

  bridge.c|  4 
  device.h|  3 +++
  interface.c |  5 +
  proto-shell.c   |  8 
  proto-static.c  |  1 +
  proto.c |  3 +++
  proto.h |  3 +++
  scripts/netifd-proto.sh | 10 +-
  vlan.c  |  4 
  9 files changed, 40 insertions(+), 1 deletion(-)

 diff --git a/bridge.c b/bridge.c
 index 147fe0a..6baef29 100644
 --- a/bridge.c
 +++ b/bridge.c
 @@ -140,6 +140,8 @@ bridge_disable_member(struct bridge_member *bm)
 system_bridge_delif(bst-dev, bm-dev.dev);
 device_release(bm-dev);

 +   device_broadcast_event(bst-dev, DEV_EVENT_TOPO_CHANGE);
 +
 return 0;
  }

 @@ -162,6 +164,8 @@ bridge_enable_member(struct bridge_member *bm)
 goto error;
 }

 +   device_broadcast_event(bst-dev, DEV_EVENT_TOPO_CHANGE);
 +
 return 0;

  error:
 diff --git a/device.h b/device.h
 index dd57927..8d2aca6 100644
 --- a/device.h
 +++ b/device.h
 @@ -78,6 +78,9 @@ enum device_event {
 DEV_EVENT_LINK_UP,
 DEV_EVENT_LINK_DOWN,

 +   /* Topology changed (i.e. bridge member added) */
 +   DEV_EVENT_TOPO_CHANGE,
 +
 __DEV_EVENT_MAX
  };

 diff --git a/interface.c b/interface.c
 index 4a3a725..fa8e55e 100644
 --- a/interface.c
 +++ b/interface.c
 @@ -328,6 +328,9 @@ interface_cb(struct device_user *dep, enum device_event 
 ev)
  case DEV_EVENT_LINK_DOWN:
 interface_set_link_state(iface, new_state);
 break;
 +   case DEV_EVENT_TOPO_CHANGE:
 +   interface_proto_event(iface-proto, PROTO_CMD_RENEW, false);
 +   return;
 default:
 break;
 }
 @@ -599,6 +602,8 @@ interface_proto_cb(struct interface_proto_state *state, 
 enum interface_proto_eve
 mark_interface_down(iface);
 iface-state = IFS_SETUP;
 break;
 +   default:
 +   return;
 }

 interface_write_resolv_conf();
 diff --git a/proto-shell.c b/proto-shell.c
 index 9041045..de1b084 100644
 --- a/proto-shell.c
 +++ b/proto-shell.c
 @@ -159,6 +159,10 @@ proto_shell_handler(struct interface_proto_state *proto,
 state-last_error = -1;
 proto_shell_clear_host_dep(state);
 state-sm = S_SETUP;
 +   } else if (cmd == PROTO_CMD_RENEW) {
 +   if (!(handler-proto.flags  PROTO_FLAG_RENEW_AVAILABLE))
 +   return 0;
 +   action = renew;
 } else {
 if (state-sm == S_TEARDOWN)
 return 0;
 @@ -761,6 +765,10 @@ proto_shell_add_handler(const char *script, const char 
 *name, json_object *obj)
 if (tmp  json_object_get_boolean(tmp))
 handler-proto.flags |= PROTO_FLAG_INIT_AVAILABLE;

 +   tmp = json_get_field(obj, renew-handler, json_type_boolean);
 +   if (tmp  json_object_get_boolean(tmp))
 +   handler-proto.flags |= PROTO_FLAG_RENEW_AVAILABLE;
 +
 config = json_get_field(obj, config, json_type_array);
 if (config)
 handler-config_buf = 
 netifd_handler_parse_config(handler-config, config);
 diff --git a/proto-static.c b/proto-static.c
 index 77a536a..b492d92 100644
 --- a/proto-static.c
 +++ b/proto-static.c
 @@ -52,6 +52,7 @@ static_handler(struct interface_proto_state *proto,

 break;
 case PROTO_CMD_TEARDOWN:
 +   case PROTO_CMD_RENEW:
 break;
 }

 diff --git a/proto.c b/proto.c
 index 64be308..3a7b2a8 100644
 --- a/proto.c
 +++ b/proto.c
 @@ -615,6 +615,9 @@ interface_proto_event(struct interface_proto_state *proto,
 case PROTO_CMD_TEARDOWN:
 ev = IFPEV_DOWN;
 break;
 +   case PROTO_CMD_RENEW:
 +   ev = IFPEV_RENEW;
 +   break;
 default:
 return -EINVAL;
 }
 diff --git a/proto.h b/proto.h
 index e402a91..e7d84ac 100644
 --- a/proto.h
 +++ b/proto.h
 @@ -22,17 +22,20 @@ enum interface_proto_event {
 IFPEV_UP,
 IFPEV_DOWN,
 IFPEV_LINK_LOST,
 +   IFPEV_RENEW,
  };

  enum interface_proto_cmd {
 PROTO_CMD_SETUP,
 PROTO_CMD_TEARDOWN,
 +   PROTO_CMD_RENEW,
  };

  enum {
 PROTO_FLAG_IMMEDIATE = (1  0),
 PROTO_FLAG_NODEV = (1  1),
 PROTO_FLAG_INIT_AVAILABLE = (1  2

Re: [OpenWrt-Devel] ubus_invoke interruptions

2014-03-20 Thread Helmut Schaa
On Tue, Mar 18, 2014 at 4:06 PM, Felix Fietkau n...@openwrt.org wrote:
 On 2014-03-17 16:49, Helmut Schaa wrote:
 On Mon, Mar 17, 2014 at 4:26 PM, Felix Fietkau n...@openwrt.org wrote:
 On 2014-03-17 09:18, Helmut Schaa wrote:
 just realized that using ubus_invoke can get interrupted by other 
 uloop-events
 happening while executing a ubus method.

 Is this intended? Would it make sense to at least postpone all piled up 
 events
 to be executed later?
 Yes, this is intended. Postponing events in uloop would be a lot more
 complex than doing the same in the application using it.

 Fair enough. Being unaware of this can cause funny effects :D

 uloop would have to handle blocking level-trigger events until they can
 be handled again, it would have to know which events are needed by
 libubus for internal processing of the pending request, etc.

 I though about adding something like a block_all_events_except_bla
 to libubox and use it in libubus while waiting for the ubus method status
 (if called with a special flag or so).
 I thought about this some more, and I think i'll rework libubus to no
 longer call uloop_run() for blocking calls. I'll make it use poll() instead.

Nice, you've committed that already, thanks!

Just one more comment regarding the current approach:

If an application calls ubus_invoke I'd argue that it does not
expect to get any ubus calls of its own methods during that time.
ubus_invoke however will process all pending ubus messages
within the ubus_invoke call.

Wouldn't it make sense to process the pending messages from
a uloop timeout instead (timeout=0)?

That way we allow the application to finish its work after ubus_invoke
while all pending events are processed once control is handed back to
the mainloop.

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv2] netifd: Reload proto on topology change

2014-03-20 Thread Helmut Schaa
Introduce a new device event topology change that gets signaled
by bridges on adding/removing members.

On topology changes the proto handlers are requested to renew
which is most useful for DHCP.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---

Changes in v2:
- Only run renew handler if registered during proto init

 bridge.c|  4 
 device.h|  3 +++
 interface.c |  5 +
 proto-shell.c   |  8 
 proto-static.c  |  1 +
 proto.c |  3 +++
 proto.h |  3 +++
 scripts/netifd-proto.sh | 10 +-
 vlan.c  |  4 
 9 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/bridge.c b/bridge.c
index 147fe0a..6baef29 100644
--- a/bridge.c
+++ b/bridge.c
@@ -140,6 +140,8 @@ bridge_disable_member(struct bridge_member *bm)
system_bridge_delif(bst-dev, bm-dev.dev);
device_release(bm-dev);
 
+   device_broadcast_event(bst-dev, DEV_EVENT_TOPO_CHANGE);
+
return 0;
 }
 
@@ -162,6 +164,8 @@ bridge_enable_member(struct bridge_member *bm)
goto error;
}
 
+   device_broadcast_event(bst-dev, DEV_EVENT_TOPO_CHANGE);
+
return 0;
 
 error:
diff --git a/device.h b/device.h
index dd57927..8d2aca6 100644
--- a/device.h
+++ b/device.h
@@ -78,6 +78,9 @@ enum device_event {
DEV_EVENT_LINK_UP,
DEV_EVENT_LINK_DOWN,
 
+   /* Topology changed (i.e. bridge member added) */
+   DEV_EVENT_TOPO_CHANGE, 
+
__DEV_EVENT_MAX
 };
 
diff --git a/interface.c b/interface.c
index 4a3a725..fa8e55e 100644
--- a/interface.c
+++ b/interface.c
@@ -328,6 +328,9 @@ interface_cb(struct device_user *dep, enum device_event ev)
 case DEV_EVENT_LINK_DOWN:
interface_set_link_state(iface, new_state);
break;
+   case DEV_EVENT_TOPO_CHANGE:
+   interface_proto_event(iface-proto, PROTO_CMD_RENEW, false);
+   return;
default:
break;
}
@@ -599,6 +602,8 @@ interface_proto_cb(struct interface_proto_state *state, 
enum interface_proto_eve
mark_interface_down(iface);
iface-state = IFS_SETUP;
break;
+   default:
+   return;
}
 
interface_write_resolv_conf();
diff --git a/proto-shell.c b/proto-shell.c
index 9041045..de1b084 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -159,6 +159,10 @@ proto_shell_handler(struct interface_proto_state *proto,
state-last_error = -1;
proto_shell_clear_host_dep(state);
state-sm = S_SETUP;
+   } else if (cmd == PROTO_CMD_RENEW) {
+   if (!(handler-proto.flags  PROTO_FLAG_RENEW_AVAILABLE))
+   return 0;
+   action = renew;
} else {
if (state-sm == S_TEARDOWN)
return 0;
@@ -761,6 +765,10 @@ proto_shell_add_handler(const char *script, const char 
*name, json_object *obj)
if (tmp  json_object_get_boolean(tmp))
handler-proto.flags |= PROTO_FLAG_INIT_AVAILABLE;
 
+   tmp = json_get_field(obj, renew-handler, json_type_boolean);
+   if (tmp  json_object_get_boolean(tmp))
+   handler-proto.flags |= PROTO_FLAG_RENEW_AVAILABLE;
+
config = json_get_field(obj, config, json_type_array);
if (config)
handler-config_buf = 
netifd_handler_parse_config(handler-config, config);
diff --git a/proto-static.c b/proto-static.c
index 77a536a..b492d92 100644
--- a/proto-static.c
+++ b/proto-static.c
@@ -52,6 +52,7 @@ static_handler(struct interface_proto_state *proto,
 
break;
case PROTO_CMD_TEARDOWN:
+   case PROTO_CMD_RENEW:
break;
}
 
diff --git a/proto.c b/proto.c
index 64be308..3a7b2a8 100644
--- a/proto.c
+++ b/proto.c
@@ -615,6 +615,9 @@ interface_proto_event(struct interface_proto_state *proto,
case PROTO_CMD_TEARDOWN:
ev = IFPEV_DOWN;
break;
+   case PROTO_CMD_RENEW:
+   ev = IFPEV_RENEW;
+   break;
default:
return -EINVAL;
}
diff --git a/proto.h b/proto.h
index e402a91..e7d84ac 100644
--- a/proto.h
+++ b/proto.h
@@ -22,17 +22,20 @@ enum interface_proto_event {
IFPEV_UP,
IFPEV_DOWN,
IFPEV_LINK_LOST,
+   IFPEV_RENEW,
 };
 
 enum interface_proto_cmd {
PROTO_CMD_SETUP,
PROTO_CMD_TEARDOWN,
+   PROTO_CMD_RENEW,
 };
 
 enum {
PROTO_FLAG_IMMEDIATE = (1  0),
PROTO_FLAG_NODEV = (1  1),
PROTO_FLAG_INIT_AVAILABLE = (1  2),
+   PROTO_FLAG_RENEW_AVAILABLE = (1  3),
 };
 
 struct interface_proto_state {
diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
index 7f08b1d..ce316c4 100644
--- a/scripts/netifd-proto.sh
+++ b/scripts/netifd-proto.sh
@@ -20,6 +20,11 @@ _proto_do_teardown() {
eval proto_$1_teardown

Re: [OpenWrt-Devel] [PATCH] netifd: Reload proto on topology change

2014-03-19 Thread Helmut Schaa
On Wed, Mar 19, 2014 at 3:15 PM, Felix Fietkau n...@openwrt.org wrote:
 On 2014-03-14 10:14, Helmut Schaa wrote:
 Introduce a new device event topology change that gets signaled
 by bridges on adding/removing members.

 On topology changes the proto handlers are requested to renew
 which is most useful for DHCP.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 [...]
 diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
 index 7f08b1d..debfaa7 100644
 --- a/scripts/netifd-proto.sh
 +++ b/scripts/netifd-proto.sh
 @@ -20,6 +20,11 @@ _proto_do_teardown() {
   eval proto_$1_teardown \$interface\ \$ifname\
  }

 +_proto_do_renew() {
 + json_load $data
 + eval proto_$1_renew \$interface\ \$ifname\
 +}
 +
  _proto_do_setup() {
   json_load $data
   _EXPORT_VAR=0
 The code should check if proto_*_renew exists (or add a default handler
 for it) to avoid error logspam. Maybe it would even be useful for
 proto-shell.c to check if renew is supported at init time (to avoid
 useless shell callouts for proto handlers that don't support renew).

Good point. Let me respin ...
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] ubus_invoke interruptions

2014-03-17 Thread Helmut Schaa
Hi All,

just realized that using ubus_invoke can get interrupted by other uloop-events
happening while executing a ubus method.

Is this intended? Would it make sense to at least postpone all piled up events
to be executed later?

Thanks,
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] kernel: Allow building xen kvm modules for x86 and x86_64

2014-03-17 Thread Helmut Schaa
On Mon, Mar 17, 2014 at 1:59 PM, Stefan Hellermann
ste...@the2masters.de wrote:


 2014-03-14 13:12 GMT+01:00 Helmut Schaa helmut.sc...@googlemail.com:

 Building a x86 or x86_64 kernel image supporting both, xen and kvm
 was not possible before.

 Allow building xen  kvm modules for standard x86 and x86_64 targets.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 ---
  package/kernel/linux/modules/virtual.mk | 19 ++-
  1 file changed, 10 insertions(+), 9 deletions(-)

 diff --git a/package/kernel/linux/modules/virtual.mk
 b/package/kernel/linux/modules/virtual.mk
 index e1bbe3f..e34aa03 100644
 --- a/package/kernel/linux/modules/virtual.mk
 +++ b/package/kernel/linux/modules/virtual.mk
 @@ -10,7 +10,7 @@ VIRTUAL_MENU:=Virtualization Support
  define KernelPackage/virtio-balloon
SUBMENU:=$(VIRTUAL_MENU)
TITLE:=VirtIO balloon driver
 -  DEPENDS:=@TARGET_x86_kvm_guest
 +  DEPENDS:=@(TARGET_x86_kvm_guest||TARGET_x86||TARGET_x86_64)


 Wouldn't it be enough to depend on TARGET_x86||TARGET_x86_64 ?

Uh, yes, I guess so :D
Thanks!


KCONFIG:=CONFIG_VIRTIO_BALLOON
FILES:=$(LINUX_DIR)/drivers/virtio/virtio_balloon.ko
AUTOLOAD:=$(call AutoLoad,06,virtio-balloon)
 @@ -26,7 +26,7 @@ $(eval $(call KernelPackage,virtio-balloon))
  define KernelPackage/virtio-net
SUBMENU:=$(VIRTUAL_MENU)
TITLE:=VirtIO network driver
 -  DEPENDS:=@TARGET_x86_kvm_guest
 +  DEPENDS:=@(TARGET_x86_kvm_guest||TARGET_x86||TARGET_x86_64)
KCONFIG:=CONFIG_VIRTIO_NET
FILES:=$(LINUX_DIR)/drivers/net/virtio_net.ko
AUTOLOAD:=$(call AutoLoad,50,virtio_net)
 @@ -42,7 +42,7 @@ $(eval $(call KernelPackage,virtio-net))
  define KernelPackage/virtio-random
SUBMENU:=$(VIRTUAL_MENU)
TITLE:=VirtIO Random Number Generator support
 -  DEPENDS:=@TARGET_x86_kvm_guest
 +  DEPENDS:=@(TARGET_x86_kvm_guest||TARGET_x86||TARGET_x86_64)
KCONFIG:=CONFIG_HW_RANDOM_VIRTIO
FILES:=$(LINUX_DIR)/drivers/char/hw_random/virtio-rng.ko
AUTOLOAD:=$(call AutoLoad,09,virtio-rng)
 @@ -74,7 +74,7 @@ $(eval $(call KernelPackage,xen-privcmd))
  define KernelPackage/xen-fs
SUBMENU:=$(VIRTUAL_MENU)
TITLE:=Xen filesystem
 -  DEPENDS:=@TARGET_x86_xen_domu +kmod-xen-privcmd
 +  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64)
 +kmod-xen-privcmd
KCONFIG:= \
 CONFIG_XENFS \
 CONFIG_XEN_COMPAT_XENFS=y
 @@ -92,7 +92,7 @@ $(eval $(call KernelPackage,xen-fs))
  define KernelPackage/xen-evtchn
SUBMENU:=$(VIRTUAL_MENU)
TITLE:=Xen event channels
 -  DEPENDS:=@TARGET_x86_xen_domu
 +  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64)
KCONFIG:=CONFIG_XEN_DEV_EVTCHN
FILES:=$(LINUX_DIR)/drivers/xen/xen-evtchn.ko
AUTOLOAD:=$(call AutoLoad,06,xen-evtchn)
 @@ -107,7 +107,8 @@ $(eval $(call KernelPackage,xen-evtchn))
  define KernelPackage/xen-fbdev
SUBMENU:=$(VIRTUAL_MENU)
TITLE:=Xen virtual frame buffer
 -  DEPENDS:=@TARGET_x86_xen_domu +kmod-fb
 +  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64) +kmod-fb
 +
KCONFIG:= \
 CONFIG_XEN_FBDEV_FRONTEND \
 CONFIG_FB_DEFERRED_IO=y \
 @@ -142,7 +143,7 @@ $(eval $(call KernelPackage,xen-fbdev))
  define KernelPackage/xen-kbddev
SUBMENU:=$(VIRTUAL_MENU)
TITLE:=Xen virtual keyboard and mouse
 -  DEPENDS:=@TARGET_x86_xen_domu
 +  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64)
KCONFIG:=CONFIG_XEN_KBDDEV_FRONTEND
FILES:=$(LINUX_DIR)/drivers/input/xen-kbdfront.ko
AUTOLOAD:=$(call AutoLoad,08,xen-kbdfront)
 @@ -158,7 +159,7 @@ $(eval $(call KernelPackage,xen-kbddev))
  define KernelPackage/xen-netdev
SUBMENU:=$(VIRTUAL_MENU)
TITLE:=Xen network device frontend
 -  DEPENDS:=@TARGET_x86_xen_domu
 +  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64)
KCONFIG:=CONFIG_XEN_NETDEV_FRONTEND
FILES:=$(LINUX_DIR)/drivers/net/xen-netfront.ko
AUTOLOAD:=$(call AutoLoad,09,xen-netfront)
 @@ -174,7 +175,7 @@ $(eval $(call KernelPackage,xen-netdev))
  define KernelPackage/xen-pcidev
SUBMENU:=$(VIRTUAL_MENU)
TITLE:=Xen PCI device frontend
 -  DEPENDS:=@TARGET_x86_xen_domu
 +  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64)
KCONFIG:=CONFIG_XEN_PCIDEV_FRONTEND
FILES:=$(LINUX_DIR)/drivers/pci/xen-pcifront.ko
AUTOLOAD:=$(call AutoLoad,10,xen-pcifront)
 --
 1.8.1.4
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] hostadp/netifd Full Dynamic VLAN support

2014-03-17 Thread Helmut Schaa
Hi Joe,

On Sat, Mar 15, 2014 at 2:59 AM, Joseph CG Walker
joe+open...@chubbypenguin.net wrote:
 Are there any other steps / edits required to get this patch committed?

Just a quick comment:

Wouldn't it be nicer to add a new wifi interface type ap_vlan so netifd
would be aware of interface bringup/bridging instad of just passing plain
config options to hostapd.

Something like:

config wifi-iface iface0
option device   'radio0'
option mode 'ap'
option network  'lan'

config wifi-iface iface0vlan65
option iface  'iface0'
option mode 'ap_vlan'
option network  'lan2'
option vlan   65

config wifi-iface iface0vlan67
option iface  'iface0'
option mode 'ap_vlan'
option network  'other'
option vlan   67


Just an idea ...
Helmut

 Thanks,
  Joe

 On Mon, Mar 3, 2014 at 2:50 PM, Joseph CG Walker
 joe+open...@chubbypenguin.net wrote:
 On 03/03/2014 01:14 PM, Felix Fietkau wrote:
 On 2014-03-03 17:59, Joseph CG Walker wrote:

 This patch brings full dynamic vlan support to netifd that existed in 
 hostapd.sh in Attitude Adjustment.

 This email was originally sent to n...@openwrt.org, but the CC to the 
 devel list was rejected, this email is another attempt at a CC.

 Signed-off-by: Joseph CG Walker j...@chubbypenguin.net
 Sorry, I've been AFK most of the time during the last days.
 About your use of /etc/config/hostpad.vlan: Please use /etc/config only
 for UCI files, not for custom-format config files.

 Why is that file needed anyway?

 - Felix


 No need for apologies, the email error was mine not yours.

 My including hostapd.vlan was mostly an attempt to follow the structure of 
 http://patchwork.openwrt.org/patch/2761/ however from the hostapd 
 documentation and from just testing it, if the file isn't changed from the 
 default (it wasn't) then it isn't necessary.  I have removed it from my 
 patch.

 Thanks,
  Joe

 Signed-off-by: Joseph CG Walker j...@chubbypenguin.net

 diff --git a/package/network/services/hostapd/files/netifd.sh 
 b/package/network/services/hostapd/files/netifd.sh
 index f06b2ac..e587d05 100644
 --- a/package/network/services/hostapd/files/netifd.sh
 +++ b/package/network/services/hostapd/files/netifd.sh
 @@ -118,6 +118,9 @@ hostapd_common_add_bss_config() {
 config_add_string iapp_interface
 config_add_string eap_type ca_cert client_cert identity auth 
 priv_key priv_key_pwd

 +   config_add_int dynamic_vlan vlan_naming
 +   config_add_string vlan_tagged_interface
 +
 config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 
 'key4:wepkey' 'password:wpakey'

 config_add_boolean wps_pushbutton wps_label ext_registrar
 @@ -204,7 +207,8 @@ hostapd_set_bss_options() {
 acct_server acct_secret acct_port \
 dae_client dae_secret dae_port \
 nasid rsn_preauth iapp_interface \
 -   eap_reauth_period
 +   eap_reauth_period dynamic_vlan \
 +   vlan_tagged_interface

 # legacy compatibility
 [ -n $auth_server ] || json_get_var auth_server 
 server
 @@ -215,6 +219,8 @@ hostapd_set_bss_options() {
 set_default acct_port 1813
 set_default dae_port 3799

 +   set_default vlan_naming 1
 +
 append bss_conf auth_server_addr=$auth_server $N
 append bss_conf auth_server_port=$auth_port $N
 append bss_conf 
 auth_server_shared_secret=$auth_secret $N
 @@ -237,6 +243,13 @@ hostapd_set_bss_options() {
 append bss_conf eapol_key_index_workaround=1 $N
 append bss_conf ieee8021x=1 $N
 append bss_conf wpa_key_mgmt=WPA-EAP $N
 +
 +   [ -n $dynamic_vlan ]  {
 +   append bss_conf dynamic_vlan=$dynamic_vlan 
 $N
 +   append bss_conf vlan_naming=$vlan_naming 
 $N
 +   [ -n $vlan_tagged_interface ]  \
 +   append bss_conf 
 vlan_tagged_interface=$vlan_tagged_interface $N
 +   }
 ;;
 wep)
 local wep_keyidx=0

 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] ubus_invoke interruptions

2014-03-17 Thread Helmut Schaa
On Mon, Mar 17, 2014 at 4:26 PM, Felix Fietkau n...@openwrt.org wrote:
 On 2014-03-17 09:18, Helmut Schaa wrote:
 just realized that using ubus_invoke can get interrupted by other 
 uloop-events
 happening while executing a ubus method.

 Is this intended? Would it make sense to at least postpone all piled up 
 events
 to be executed later?
 Yes, this is intended. Postponing events in uloop would be a lot more
 complex than doing the same in the application using it.

Fair enough. Being unaware of this can cause funny effects :D

 uloop would have to handle blocking level-trigger events until they can
 be handled again, it would have to know which events are needed by
 libubus for internal processing of the pending request, etc.

I though about adding something like a block_all_events_except_bla
to libubox and use it in libubus while waiting for the ubus method status
(if called with a special flag or so).

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] netifd: Reload proto on topology change

2014-03-14 Thread Helmut Schaa
Introduce a new device event topology change that gets signaled
by bridges on adding/removing members.

On topology changes the proto handlers are requested to renew
which is most useful for DHCP.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 bridge.c| 4 
 device.h| 3 +++
 interface.c | 5 +
 proto-shell.c   | 2 ++
 proto-static.c  | 1 +
 proto.c | 3 +++
 proto.h | 2 ++
 scripts/netifd-proto.sh | 8 +++-
 vlan.c  | 4 
 9 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/bridge.c b/bridge.c
index 147fe0a..6baef29 100644
--- a/bridge.c
+++ b/bridge.c
@@ -140,6 +140,8 @@ bridge_disable_member(struct bridge_member *bm)
system_bridge_delif(bst-dev, bm-dev.dev);
device_release(bm-dev);
 
+   device_broadcast_event(bst-dev, DEV_EVENT_TOPO_CHANGE);
+
return 0;
 }
 
@@ -162,6 +164,8 @@ bridge_enable_member(struct bridge_member *bm)
goto error;
}
 
+   device_broadcast_event(bst-dev, DEV_EVENT_TOPO_CHANGE);
+
return 0;
 
 error:
diff --git a/device.h b/device.h
index dd57927..8d2aca6 100644
--- a/device.h
+++ b/device.h
@@ -78,6 +78,9 @@ enum device_event {
DEV_EVENT_LINK_UP,
DEV_EVENT_LINK_DOWN,
 
+   /* Topology changed (i.e. bridge member added) */
+   DEV_EVENT_TOPO_CHANGE, 
+
__DEV_EVENT_MAX
 };
 
diff --git a/interface.c b/interface.c
index 39460e4..ad60298 100644
--- a/interface.c
+++ b/interface.c
@@ -328,6 +328,9 @@ interface_cb(struct device_user *dep, enum device_event ev)
 case DEV_EVENT_LINK_DOWN:
interface_set_link_state(iface, new_state);
break;
+   case DEV_EVENT_TOPO_CHANGE:
+   interface_proto_event(iface-proto, PROTO_CMD_RENEW, false);
+   return;
default:
break;
}
@@ -599,6 +602,8 @@ interface_proto_cb(struct interface_proto_state *state, 
enum interface_proto_eve
mark_interface_down(iface);
iface-state = IFS_SETUP;
break;
+   default:
+   return;
}
 
interface_write_resolv_conf();
diff --git a/proto-shell.c b/proto-shell.c
index 9041045..a8c6f0b 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -159,6 +159,8 @@ proto_shell_handler(struct interface_proto_state *proto,
state-last_error = -1;
proto_shell_clear_host_dep(state);
state-sm = S_SETUP;
+   } else if (cmd == PROTO_CMD_RENEW) {
+   action = renew;
} else {
if (state-sm == S_TEARDOWN)
return 0;
diff --git a/proto-static.c b/proto-static.c
index 77a536a..b492d92 100644
--- a/proto-static.c
+++ b/proto-static.c
@@ -52,6 +52,7 @@ static_handler(struct interface_proto_state *proto,
 
break;
case PROTO_CMD_TEARDOWN:
+   case PROTO_CMD_RENEW:
break;
}
 
diff --git a/proto.c b/proto.c
index 64be308..3a7b2a8 100644
--- a/proto.c
+++ b/proto.c
@@ -615,6 +615,9 @@ interface_proto_event(struct interface_proto_state *proto,
case PROTO_CMD_TEARDOWN:
ev = IFPEV_DOWN;
break;
+   case PROTO_CMD_RENEW:
+   ev = IFPEV_RENEW;
+   break;
default:
return -EINVAL;
}
diff --git a/proto.h b/proto.h
index e402a91..c3264fb 100644
--- a/proto.h
+++ b/proto.h
@@ -22,11 +22,13 @@ enum interface_proto_event {
IFPEV_UP,
IFPEV_DOWN,
IFPEV_LINK_LOST,
+   IFPEV_RENEW,
 };
 
 enum interface_proto_cmd {
PROTO_CMD_SETUP,
PROTO_CMD_TEARDOWN,
+   PROTO_CMD_RENEW,
 };
 
 enum {
diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
index 7f08b1d..debfaa7 100644
--- a/scripts/netifd-proto.sh
+++ b/scripts/netifd-proto.sh
@@ -20,6 +20,11 @@ _proto_do_teardown() {
eval proto_$1_teardown \$interface\ \$ifname\
 }
 
+_proto_do_renew() {
+   json_load $data
+   eval proto_$1_renew \$interface\ \$ifname\
+}
+
 _proto_do_setup() {
json_load $data
_EXPORT_VAR=0
@@ -365,7 +370,7 @@ init_proto() {
json_dump
}
;;
-   setup|teardown)
+   setup|teardown|renew)
interface=$1; shift
data=$1; shift
ifname=$1; shift
@@ -376,6 +381,7 @@ init_proto() {
case $cmd in
setup) _proto_do_setup $1;;
teardown) _proto_do_teardown $1 ;;
+   renew) _proto_do_renew $1 ;;
*) return 1 ;;
esac
}
diff --git a/vlan.c b/vlan.c
index 9201979..ce7e8cf

[OpenWrt-Devel] [PATCH 2/2] odhcp6c: Add renew handler for proto dhcpv6

2014-03-14 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 package/network/ipv6/odhcp6c/files/dhcpv6.sh | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh 
b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
index aa7a2e1..e68eeb5 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
@@ -65,6 +65,12 @@ proto_dhcpv6_setup() {
$opts $iface
 }
 
+proto_dhcpv6_renew() {
+   local interface=$1
+   # SIGUSR1 forces odhcp6c to renew its lease
+   proto_kill_command $interface 16
+}
+
 proto_dhcpv6_teardown() {
local interface=$1
proto_kill_command $interface
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] netifd: Add renew handler for proto dhcp

2014-03-14 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 package/network/config/netifd/files/lib/netifd/proto/dhcp.sh | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh 
b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 0481d05..99247ae 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -49,6 +49,12 @@ proto_dhcp_setup() {
$clientid $broadcast $dhcpopts
 }
 
+proto_dhcp_renew() {
+   local interface=$1
+   # SIGUSR1 forces udhcpc to renew its lease
+   proto_kill_command $interface 16
+}
+
 proto_dhcp_teardown() {
local interface=$1
proto_kill_command $interface
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] kernel: Allow building xen kvm modules for x86 and x86_64

2014-03-14 Thread Helmut Schaa
Building a x86 or x86_64 kernel image supporting both, xen and kvm
was not possible before.

Allow building xen  kvm modules for standard x86 and x86_64 targets.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 package/kernel/linux/modules/virtual.mk | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/package/kernel/linux/modules/virtual.mk 
b/package/kernel/linux/modules/virtual.mk
index e1bbe3f..e34aa03 100644
--- a/package/kernel/linux/modules/virtual.mk
+++ b/package/kernel/linux/modules/virtual.mk
@@ -10,7 +10,7 @@ VIRTUAL_MENU:=Virtualization Support
 define KernelPackage/virtio-balloon
   SUBMENU:=$(VIRTUAL_MENU)
   TITLE:=VirtIO balloon driver
-  DEPENDS:=@TARGET_x86_kvm_guest
+  DEPENDS:=@(TARGET_x86_kvm_guest||TARGET_x86||TARGET_x86_64)
   KCONFIG:=CONFIG_VIRTIO_BALLOON
   FILES:=$(LINUX_DIR)/drivers/virtio/virtio_balloon.ko
   AUTOLOAD:=$(call AutoLoad,06,virtio-balloon)
@@ -26,7 +26,7 @@ $(eval $(call KernelPackage,virtio-balloon))
 define KernelPackage/virtio-net
   SUBMENU:=$(VIRTUAL_MENU)
   TITLE:=VirtIO network driver
-  DEPENDS:=@TARGET_x86_kvm_guest
+  DEPENDS:=@(TARGET_x86_kvm_guest||TARGET_x86||TARGET_x86_64)
   KCONFIG:=CONFIG_VIRTIO_NET
   FILES:=$(LINUX_DIR)/drivers/net/virtio_net.ko
   AUTOLOAD:=$(call AutoLoad,50,virtio_net)
@@ -42,7 +42,7 @@ $(eval $(call KernelPackage,virtio-net))
 define KernelPackage/virtio-random
   SUBMENU:=$(VIRTUAL_MENU)
   TITLE:=VirtIO Random Number Generator support
-  DEPENDS:=@TARGET_x86_kvm_guest
+  DEPENDS:=@(TARGET_x86_kvm_guest||TARGET_x86||TARGET_x86_64)
   KCONFIG:=CONFIG_HW_RANDOM_VIRTIO
   FILES:=$(LINUX_DIR)/drivers/char/hw_random/virtio-rng.ko
   AUTOLOAD:=$(call AutoLoad,09,virtio-rng)
@@ -74,7 +74,7 @@ $(eval $(call KernelPackage,xen-privcmd))
 define KernelPackage/xen-fs
   SUBMENU:=$(VIRTUAL_MENU)
   TITLE:=Xen filesystem
-  DEPENDS:=@TARGET_x86_xen_domu +kmod-xen-privcmd
+  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64) +kmod-xen-privcmd
   KCONFIG:= \
CONFIG_XENFS \
CONFIG_XEN_COMPAT_XENFS=y
@@ -92,7 +92,7 @@ $(eval $(call KernelPackage,xen-fs))
 define KernelPackage/xen-evtchn
   SUBMENU:=$(VIRTUAL_MENU)
   TITLE:=Xen event channels
-  DEPENDS:=@TARGET_x86_xen_domu
+  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64)
   KCONFIG:=CONFIG_XEN_DEV_EVTCHN
   FILES:=$(LINUX_DIR)/drivers/xen/xen-evtchn.ko
   AUTOLOAD:=$(call AutoLoad,06,xen-evtchn)
@@ -107,7 +107,8 @@ $(eval $(call KernelPackage,xen-evtchn))
 define KernelPackage/xen-fbdev
   SUBMENU:=$(VIRTUAL_MENU)
   TITLE:=Xen virtual frame buffer
-  DEPENDS:=@TARGET_x86_xen_domu +kmod-fb
+  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64) +kmod-fb
+
   KCONFIG:= \
CONFIG_XEN_FBDEV_FRONTEND \
CONFIG_FB_DEFERRED_IO=y \
@@ -142,7 +143,7 @@ $(eval $(call KernelPackage,xen-fbdev))
 define KernelPackage/xen-kbddev
   SUBMENU:=$(VIRTUAL_MENU)
   TITLE:=Xen virtual keyboard and mouse
-  DEPENDS:=@TARGET_x86_xen_domu
+  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64)
   KCONFIG:=CONFIG_XEN_KBDDEV_FRONTEND
   FILES:=$(LINUX_DIR)/drivers/input/xen-kbdfront.ko
   AUTOLOAD:=$(call AutoLoad,08,xen-kbdfront)
@@ -158,7 +159,7 @@ $(eval $(call KernelPackage,xen-kbddev))
 define KernelPackage/xen-netdev
   SUBMENU:=$(VIRTUAL_MENU)
   TITLE:=Xen network device frontend
-  DEPENDS:=@TARGET_x86_xen_domu
+  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64)
   KCONFIG:=CONFIG_XEN_NETDEV_FRONTEND
   FILES:=$(LINUX_DIR)/drivers/net/xen-netfront.ko
   AUTOLOAD:=$(call AutoLoad,09,xen-netfront)
@@ -174,7 +175,7 @@ $(eval $(call KernelPackage,xen-netdev))
 define KernelPackage/xen-pcidev
   SUBMENU:=$(VIRTUAL_MENU)
   TITLE:=Xen PCI device frontend
-  DEPENDS:=@TARGET_x86_xen_domu
+  DEPENDS:=@(TARGET_x86_xen_domu||TARGET_x86||TARGET_x86_64)
   KCONFIG:=CONFIG_XEN_PCIDEV_FRONTEND
   FILES:=$(LINUX_DIR)/drivers/pci/xen-pcifront.ko
   AUTOLOAD:=$(call AutoLoad,10,xen-pcifront)
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [RFC] netifd: Reload proto on bridge member add/remove

2014-03-12 Thread Helmut Schaa
Main use-case is to renew/restart DHCP if a bridge member is added/removed.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---

Maybe it is worth to add another PROTO_CMD_RENEW or something that is more
lightweight instead of running a full setup again?

 bridge.c| 4 
 device.h| 3 +++
 interface.c | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/bridge.c b/bridge.c
index 4ef0d7e..db403c5 100644
--- a/bridge.c
+++ b/bridge.c
@@ -140,6 +140,8 @@ bridge_disable_member(struct bridge_member *bm)
system_bridge_delif(bst-dev, bm-dev.dev);
device_release(bm-dev);
 
+   device_broadcast_event(bst-dev, DEV_EVENT_TOPO_CHANGE);
+
return 0;
 }
 
@@ -162,6 +164,8 @@ bridge_enable_member(struct bridge_member *bm)
goto error;
}
 
+   device_broadcast_event(bst-dev, DEV_EVENT_TOPO_CHANGE);
+
return 0;
 
 error:
diff --git a/device.h b/device.h
index 8d3efa3..e96a4c4 100644
--- a/device.h
+++ b/device.h
@@ -77,6 +77,9 @@ enum device_event {
DEV_EVENT_LINK_UP,
DEV_EVENT_LINK_DOWN,
 
+   /* Topology changed (i.e. bridge member added) */
+   DEV_EVENT_TOPO_CHANGE, 
+
__DEV_EVENT_MAX
 };
 
diff --git a/interface.c b/interface.c
index b2c8baf..7fcc8a0 100644
--- a/interface.c
+++ b/interface.c
@@ -248,6 +248,9 @@ interface_cb(struct device_user *dep, enum device_event ev)
case DEV_EVENT_REMOVE:
new_state = false;
break;
+   case DEV_EVENT_TOPO_CHANGE:
+   interface_proto_event(iface-proto, PROTO_CMD_SETUP, false);
+   return;
default:
return;
}
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv2] openssl: Fix x86_64 build on some 64bit host systems

2014-03-11 Thread Helmut Schaa
On some build hosts openssl fails to install since openssl installs itself into
lib64 while the openwrt Makefile expects the libs to end up in lib.

install -m0644 
.../openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/openssl-1.0.1e/ipkg-install/usr/lib/libcrypto.so.*
 
.../openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/openssl-1.0.1e/ipkg-x86_64/libopenssl/usr/lib/
install: cannot stat 
'.../openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/openssl-1.0.1e/ipkg-install/usr/lib/libcrypto.so.*':
 No such file or directory
make[2]: *** [/openwrt/bin/x86_64/packages/libopenssl_1.0.1e-2_x86_64.ipk] 
Error 1
make[2]: Leaving directory `/openwrt/package/libs/openssl'
make[1]: *** [package/libs/openssl/compile] Error 2
make[1]: Leaving directory `/openwrt'

Set LIBDIR accordingly to fix this.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
Changes in v2: Use OPENSSL_MAKEFLAGS instead of passing LIBDIR=lib to all make 
calls

 package/libs/openssl/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 19863fb..19199ff 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -100,6 +100,7 @@ endif
 
 ifeq ($(CONFIG_x86_64),y)
   OPENSSL_TARGET:=linux-x86_64
+  OPENSSL_MAKEFLAGS += LIBDIR=lib
 else
   OPENSSL_OPTIONS+=no-sse2
   ifeq ($(CONFIG_mips)$(CONFIG_mipsel),y)
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] openssl: Fix x86_64 build on some 64bit host systems

2014-03-11 Thread Helmut Schaa
On Sun, Mar 9, 2014 at 2:26 PM, Felix Fietkau n...@openwrt.org wrote:
 On 2014-02-28 10:38, Helmut Schaa wrote:
 On some build hosts openssl fails to install since openssl installs itself 
 into
 lib64 while the openwrt Makefile expects the libs to end up in lib.

 install -m0644 
 .../openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/openssl-1.0.1e/ipkg-install/usr/lib/libcrypto.so.*
  
 .../openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/openssl-1.0.1e/ipkg-x86_64/libopenssl/usr/lib/
 install: cannot stat 
 '.../openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/openssl-1.0.1e/ipkg-install/usr/lib/libcrypto.so.*':
  No such file or directory
 make[2]: *** [/openwrt/bin/x86_64/packages/libopenssl_1.0.1e-2_x86_64.ipk] 
 Error 1
 make[2]: Leaving directory `/openwrt/package/libs/openssl'
 make[1]: *** [package/libs/openssl/compile] Error 2
 make[1]: Leaving directory `/openwrt'

 Set LIBDIR accordingly to fix this.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 How about adding it to OPENSSL_MAKEFLAGS?

Just sent a v2.
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] openssl: Fix x86_64 build on some 64bit host systems

2014-02-28 Thread Helmut Schaa
On some build hosts openssl fails to install since openssl installs itself into
lib64 while the openwrt Makefile expects the libs to end up in lib.

install -m0644 
.../openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/openssl-1.0.1e/ipkg-install/usr/lib/libcrypto.so.*
 
.../openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/openssl-1.0.1e/ipkg-x86_64/libopenssl/usr/lib/
install: cannot stat 
'.../openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/openssl-1.0.1e/ipkg-install/usr/lib/libcrypto.so.*':
 No such file or directory
make[2]: *** [/openwrt/bin/x86_64/packages/libopenssl_1.0.1e-2_x86_64.ipk] 
Error 1
make[2]: Leaving directory `/openwrt/package/libs/openssl'
make[1]: *** [package/libs/openssl/compile] Error 2
make[1]: Leaving directory `/openwrt'

Set LIBDIR accordingly to fix this.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 package/libs/openssl/Makefile | 5 +
 1 file changed, 5 insertions(+)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 19863fb..a086450 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -132,6 +132,7 @@ define Build/Compile
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
MAKEDEPPROG=$(TARGET_CROSS)gcc \
OPENWRT_OPTIMIZATION_FLAGS=$(TARGET_CFLAGS) \
+   LIBDIR=lib \
$(OPENSSL_MAKEFLAGS) \
depend
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
@@ -140,6 +141,7 @@ define Build/Compile
AR=$(TARGET_CROSS)ar r \
RANLIB=$(TARGET_CROSS)ranlib \
OPENWRT_OPTIMIZATION_FLAGS=$(TARGET_CFLAGS) \
+   LIBDIR=lib \
$(OPENSSL_MAKEFLAGS) \
all
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
@@ -148,6 +150,7 @@ define Build/Compile
AR=$(TARGET_CROSS)ar r \
RANLIB=$(TARGET_CROSS)ranlib \
OPENWRT_OPTIMIZATION_FLAGS=$(TARGET_CFLAGS) \
+   LIBDIR=lib \
$(OPENSSL_MAKEFLAGS) \
build-shared
# Work around openssl build bug to link libssl.so with libcrypto.so.
@@ -155,11 +158,13 @@ define Build/Compile
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
CC=$(TARGET_CC) \
OPENWRT_OPTIMIZATION_FLAGS=$(TARGET_CFLAGS) \
+   LIBDIR=lib \
$(OPENSSL_MAKEFLAGS) \
do_linux-shared
$(MAKE) -C $(PKG_BUILD_DIR) \
CC=$(TARGET_CC) \
INSTALL_PREFIX=$(PKG_INSTALL_DIR) \
+   LIBDIR=lib \
$(OPENSSL_MAKEFLAGS) \
install
 endef
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv3 3/3] b53: mdio: Avoid re-registering the same switch device

2014-02-28 Thread Helmut Schaa
Hi Jonas,

On Tue, Feb 18, 2014 at 11:16 AM, Jonas Gorski j...@openwrt.org wrote:
 On Tue, Feb 18, 2014 at 10:52 AM, Helmut Schaa
 helmut.sc...@googlemail.com wrote:
 On Tue, Feb 18, 2014 at 10:46 AM, Helmut Schaa
 helmut.sc...@googlemail.com wrote:
 On Mon, Feb 17, 2014 at 5:37 PM, Jonas Gorski j...@openwrt.org wrote:
 On Thu, Feb 13, 2014 at 5:00 PM, Helmut Schaa
 helmut.sc...@googlemail.com wrote:
 When setting the associated interface down and up again a new
 switch device will be registered due to b53_phy_config_init
 doing the necessary allocations and registrations.

 Instead, register the switch device already in b53_phy_probe.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 ---

 It would be good to have some changelog here to know what changed
 between v1, v2 and v3.

 Right, sorry bout that ...

 As far as I can tell you are now dropping the
 ethX alias completely?

 Correct, since the netdev is only known when attaching to the phy
 which caused the problem I wanted to fix in the first place ...

 And I agree with your previous comment that it is not safe to
 replace the phy name on attaching the netdev to the phy (for various
 reasons) ...

 Now, the name is consistent, but the dev_name of the actual switch
 is used. Which means you will get a switch device called bcm53018
 or bcm53125 (would be bad if you have multiple switches).

 Actually, this is what the mmap and spi versions do as far as I can see.
 Helmut

 You are thinking too complicated here, all switches are also available
 under a generic switchX name, so usually you only need to do ethX =
 switch0 replacement (unless there are two switches, but I never saw
 such a device yet on bcm47xx or bcm63xx).

Indeed, didn't notice the switchX alias yet. I haven't found any time
to update the patch yet. Might take some more time, until then I carry
this patch in my tree ...

 The bigger problem is the conversion from the old kmod-switch
 standard, where you had to explicitly untag the cpu if you wanted it
 untagged with 'u', and the cpu was always implicitly tagged.

This seems unrelated or did I miss anything?
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv3 3/3] b53: mdio: Avoid re-registering the same switch device

2014-02-18 Thread Helmut Schaa
On Mon, Feb 17, 2014 at 5:37 PM, Jonas Gorski j...@openwrt.org wrote:
 On Thu, Feb 13, 2014 at 5:00 PM, Helmut Schaa
 helmut.sc...@googlemail.com wrote:
 When setting the associated interface down and up again a new
 switch device will be registered due to b53_phy_config_init
 doing the necessary allocations and registrations.

 Instead, register the switch device already in b53_phy_probe.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 ---

 It would be good to have some changelog here to know what changed
 between v1, v2 and v3.

Right, sorry bout that ...

 As far as I can tell you are now dropping the
 ethX alias completely?

Correct, since the netdev is only known when attaching to the phy
which caused the problem I wanted to fix in the first place ...

And I agree with your previous comment that it is not safe to
replace the phy name on attaching the netdev to the phy (for various
reasons) ...

Now, the name is consistent, but the dev_name of the actual switch
is used. Which means you will get a switch device called bcm53018
or bcm53125 (would be bad if you have multiple switches).

 This will cause a lot of config breakage
 because bcm47xx and bcm63xx use ethX as the default switch name for
 most switch configs. We need to add a migration script first before
 this can be applied (it would be good to have one anyway for the
 kmod-switch - swconfig migration.

Damn, didn't think about that :/
Due to the different names for different switch chips this will be
difficult I guess.

Any other ideas?
Add a mechanism to update the device name on phy_attach?

 The first two look good, and I will commit them as soon as I have
 time, so no need to resend them.

Thanks.
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv3 1/3] b53: Add BCM53128 switch support

2014-02-13 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 .../linux/generic/files/drivers/net/phy/b53/b53_common.c   | 14 ++
 target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c  |  2 +-
 target/linux/generic/files/drivers/net/phy/b53/b53_priv.h  |  4 +++-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index f6a5418..72b08e1 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -1130,6 +1130,19 @@ static const struct b53_chip_data b53_switch_chips[] = {
.sw_ops = b53_switch_ops,
},
{
+   .chip_id = BCM53128_DEVICE_ID,
+   .dev_name = BCM53128,
+   .alias = bcm53128,
+   .vlans = 4096,
+   .enabled_ports = 0x1ff,
+   .cpu_port = B53_CPU_PORT,
+   .vta_regs = B53_VTA_REGS,
+   .duplex_reg = B53_DUPLEX_STAT_GE,
+   .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+   .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+   .sw_ops = b53_switch_ops,
+   },
+   {
.chip_id = BCM63XX_DEVICE_ID,
.dev_name = BCM63xx,
.alias = bcm63xx,
@@ -1363,6 +1376,7 @@ int b53_switch_detect(struct b53_device *dev)
switch (id32) {
case BCM53115_DEVICE_ID:
case BCM53125_DEVICE_ID:
+   case BCM53128_DEVICE_ID:
case BCM53010_DEVICE_ID:
case BCM53011_DEVICE_ID:
case BCM53012_DEVICE_ID:
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
index cacf32b..3c25f0e 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
@@ -357,7 +357,7 @@ static struct phy_driver b53_phy_driver_id1 = {
},
 };
 
-/* BCM53125 */
+/* BCM53125, BCM53128 */
 static struct phy_driver b53_phy_driver_id2 = {
.phy_id = 0x03625c00,
.name   = Broadcom B53 (2),
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h 
b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
index d9881a1..ce5b530 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
@@ -46,6 +46,7 @@ enum {
BCM5398_DEVICE_ID = 0x98,
BCM53115_DEVICE_ID = 0x53115,
BCM53125_DEVICE_ID = 0x53125,
+   BCM53128_DEVICE_ID = 0x53128,
BCM63XX_DEVICE_ID = 0x6300,
BCM53010_DEVICE_ID = 0x53010,
BCM53011_DEVICE_ID = 0x53011,
@@ -137,7 +138,8 @@ static inline int is539x(struct b53_device *dev)
 static inline int is531x5(struct b53_device *dev)
 {
return dev-chip_id == BCM53115_DEVICE_ID ||
-   dev-chip_id == BCM53125_DEVICE_ID;
+   dev-chip_id == BCM53125_DEVICE_ID ||
+   dev-chip_id == BCM53128_DEVICE_ID;
 }
 
 static inline int is63xx(struct b53_device *dev)
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv3 2/3] b53: Make b53_switch_init static

2014-02-13 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 target/linux/generic/files/drivers/net/phy/b53/b53_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index 72b08e1..b82bc93 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -1222,7 +1222,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
},
 };
 
-int b53_switch_init(struct b53_device *dev)
+static int b53_switch_init(struct b53_device *dev)
 {
struct switch_dev *sw_dev = dev-sw_dev;
unsigned i;
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv3 3/3] b53: mdio: Avoid re-registering the same switch device

2014-02-13 Thread Helmut Schaa
When setting the associated interface down and up again a new
switch device will be registered due to b53_phy_config_init
doing the necessary allocations and registrations.

Instead, register the switch device already in b53_phy_probe.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 .../generic/files/drivers/net/phy/b53/b53_common.c |  2 +-
 .../generic/files/drivers/net/phy/b53/b53_mdio.c   | 39 ++
 .../generic/files/drivers/net/phy/b53/b53_priv.h   |  2 ++
 3 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index b82bc93..37f520d 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -478,7 +478,7 @@ static void b53_switch_reset_gpio(struct b53_device *dev)
dev-current_page = 0xff;
 }
 
-static int b53_switch_reset(struct b53_device *dev)
+int b53_switch_reset(struct b53_device *dev)
 {
u8 mgmt;
 
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
index 3c25f0e..5df2f9c 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
@@ -253,56 +253,37 @@ static struct b53_io_ops b53_mdio_ops = {
 
 static int b53_phy_probe(struct phy_device *phydev)
 {
-   struct b53_device dev;
+   struct b53_device *dev;
int ret;
 
/* allow the generic phy driver to take over */
if (phydev-addr != B53_PSEUDO_PHY  phydev-addr != 0)
return -ENODEV;
 
-   dev.current_page = 0xff;
-   dev.priv = phydev-bus;
-   dev.ops = b53_mdio_ops;
-   dev.pdata = NULL;
-   mutex_init(dev.reg_mutex);
+   dev = b53_switch_alloc(phydev-dev, b53_mdio_ops, phydev-bus);
+   if (!dev)
+   return -ENOMEM;
+
+   dev-current_page = 0xff;
 
-   ret = b53_switch_detect(dev);
+   ret = b53_switch_register(dev);
if (ret)
return ret;
 
-   if (is5325(dev) || is5365(dev))
+   if (is5325(dev) || is5365(dev))
phydev-supported = SUPPORTED_100baseT_Full;
else
phydev-supported = SUPPORTED_1000baseT_Full;
 
phydev-advertising = phydev-supported;
+   phydev-priv = dev;
 
return 0;
 }
 
 static int b53_phy_config_init(struct phy_device *phydev)
 {
-   struct b53_device *dev;
-   int ret;
-
-   dev = b53_switch_alloc(phydev-dev, b53_mdio_ops, phydev-bus);
-   if (!dev)
-   return -ENOMEM;
-
-   /* we don't use page 0xff, so force a page set */
-   dev-current_page = 0xff;
-   /* force the ethX as alias */
-   dev-sw_dev.alias = phydev-attached_dev-name;
-
-   ret = b53_switch_register(dev);
-   if (ret) {
-   dev_err(dev-dev, failed to register switch: %i\n, ret);
-   return ret;
-   }
-
-   phydev-priv = dev;
-
-   return 0;
+   return b53_switch_reset((struct b53_device *)phydev-priv);
 }
 
 static void b53_phy_remove(struct phy_device *phydev)
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h 
b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
index ce5b530..75b86dc 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
@@ -180,6 +180,8 @@ int b53_switch_detect(struct b53_device *dev);
 
 int b53_switch_register(struct b53_device *dev);
 
+int b53_switch_reset(struct b53_device *dev);
+
 static inline void b53_switch_remove(struct b53_device *dev)
 {
unregister_switch(dev-sw_dev);
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC/RFT] netifd: Initial OpenVSwitch support

2014-02-10 Thread Helmut Schaa
On Fri, Feb 7, 2014 at 4:45 PM, Roberto Riggio
roberto.rig...@create-net.org wrote:
 On 29/11/13 16:24, Helmut Schaa wrote:
 I'd appreciate any testing beside my own :D

 Hi, I did some testing on some alix boards. The config
 I'm using is the following:

 config device
 option name br-ovs
 option type ovs
 list ifname eth0

 config interface wan
 option ifname br-ovs
 option proto dhcp

 Everything seems to work fine, the bridge is created
 and the interface is added to it.

 The only problem I;ve found is that if I change the device
 name from br-ovs to (for example) ovs at the next reboot
 the change is not applied.

Ok, not sure why this is 

What did you change to get this working now?

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC/RFT] netifd: Initial OpenVSwitch support

2014-02-10 Thread Helmut Schaa
On Mon, Feb 10, 2014 at 2:32 PM, Roberto Riggio
roberto.rig...@create-net.org wrote:
 On 10/02/14 11:49, Helmut Schaa wrote:
 What did you change to get this working now?

 I started from a clean build. In the previous version I played
 a little bit with verious version of OVS and some hack to the
 netidf script. Everything worked as expected on new image built
 from scratch.

 BTW the netifd was built from the upstream repo with your
 patch (generated from your git branch).

 Is the possibility to set the controller an option you are
 considering?

This is untested but feel free to give it a try:

diff --git a/ovs.c b/ovs.c
index 29db26c..21056cb 100644
--- a/ovs.c
+++ b/ovs.c
@@ -35,6 +35,7 @@ static const struct blobmsg_policy
ovs_attrs[__OVS_ATTR_MAX] = {
 [OVS_ATTR_BASE] = { ovs_base, BLOBMSG_TYPE_STRING },
 [OVS_ATTR_TAG] = { ovs_tag, BLOBMSG_TYPE_INT32 },
 [OVS_ATTR_EMPTY] = { ovs_empty, BLOBMSG_TYPE_BOOL },
+[OVS_ATTR_CONTROLLER] = { ovs_controller, BLOBMSG_TYPE_STRING},
 };

 static const struct uci_blob_param_info ovs_attr_info[__OVS_ATTR_MAX] = {
@@ -581,6 +582,8 @@ ovs_apply_settings(struct ovs_state *ost, struct
blob_attr **tb)
 if (tb[OVS_ATTR_TAG]  tb[OVS_ATTR_BASE] ) {
 cfg-tag = blobmsg_get_u32(tb[OVS_ATTR_TAG]);
 cfg-base = blobmsg_get_string(tb[OVS_ATTR_BASE]);
+} else if (tb[OVS_ATTR_CONTROLLER]) {
+cfg-controller = blobmsg_get_string(tb[OVS_ATTR_CONTROLLER]);
 }

 if (tb[OVS_ATTR_EMPTY])
diff --git a/system-ovs.c b/system-ovs.c
index 92f0f43..25a42b5 100644
--- a/system-ovs.c
+++ b/system-ovs.c
@@ -92,6 +92,12 @@ int system_ovs_addbr(struct device *ovs, struct
ovs_config *cfg)
 return -1;
 return 0;
 }
+if (cfg-controller) {
+if (run_prog(/usr/bin/ovs-vsctl, add-br, ovs-ifname,
--, set-controller, ovs-ifname, cfg-controller))
+return -1;
+return 0;
+}
+
 if (run_prog(/usr/bin/ovs-vsctl, add-br, ovs-ifname))
 return -1;
 return 0;
diff --git a/system-ovs.h b/system-ovs.h
index ad018d4..f39ac44 100644
--- a/system-ovs.h
+++ b/system-ovs.h
@@ -20,6 +20,7 @@ struct ovs_config {
 bool empty;
 int tag;
 char *base;
+char *controller;
 };

 void system_ovs_if_clear_state(struct device *dev);
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC] mt7620 wifi

2014-02-06 Thread Helmut Schaa
On Thu, Feb 6, 2014 at 11:40 AM, Roman Yeryomin leroi.li...@gmail.com wrote:
 On 5 February 2014 09:21, Helmut Schaa helmut.sc...@googlemail.com wrote:
 So, you ported the code from the ralink rt2860 driver, right?
 I haven't looked into newer ralink chips at all. Did you check if any MAC
 layer changes regarding RX and TX rings exist?

 Yes, from rt2860v2 2.7.1.6 to be precise.
 Yes I did the mac registers init too. There are several new registers
 they initialize. I tried to integrate mac init to the existing
 function. Do you think I should try to do it separately?

 No, should be fine that way (for testing) I guess.

 Did you check if the interrupt handler is called after setting the
 device up (/proc/interrupts)?
 Just as a first evidence of life?

 Hmm..
 If I configure it as ap, yes:
CPU0
   5: 28  MIPS  1010.ethernet
   6:  38912  MIPS  rt2800_wmac
   7: 204558  MIPS  timer
   9:  0  INTC  1100.timer
  20:521  INTC  serial
  25:  2  INTC  gsw
 ERR:  0

 Good, so at least something happens :D
 Might make sense to add some code to the interrupt handler to see
 which interrupts get fired.

 Do you mean plat_irq_dispatch() from arch/mips/ralink/irq.c ?

I thought about rt2800mmio_interrupt.

 But if I put it in monitor mode (either via config or iw command)
 interrupt counter remains zero. What does it mean?

 So, it seems as if the RX path is not working at all. But that can have
 several reasons ...

 Did you check with a second wifi device if the card transmits any
 frames in AP mode?
 Beacons?

 Only with android tablet with wifi scanner. Do you think I should try
 a better scanner (kismet?) ?

Just use a second linux machine with a reasonable wifi card (ath9k
will do for example),
put it into monitor mode and run tcpdump/wireshark on it ...

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC/RFT] netifd: Initial OpenVSwitch support

2014-02-04 Thread Helmut Schaa
On Mon, Feb 3, 2014 at 6:53 PM, Roberto Riggio
roberto.rig...@create-net.org wrote:
 On 03/02/14 16:57, Helmut Schaa wrote:
 What if you write the config file after boot and run /etc/init.d/network 
 reload?
 Does it also end up in a loop?

 Just tried, no, it does not loop.

Ok, this helps a lot I guess.
Maybe OVS is not up and running yet during boot or not yet initialized?

 However I noticed that by running

 /etc/init.d.network restart

 I get:

 Command failed: not found

 and in the logread there is an error from ovs-vsctl about a missing interface
 eth0.

Yeah, this is a bit unfortunate but should not cause any harm ...

 The interface is there of course (down) if I run ifconfig eth0

 What version of ovs do you use?

 OVS 2.0 adapted from:

 https://github.com/schuza/openvswitch

Should be fine I guess, I pushed a modified version of the OVS package
to my github repo at [1]. Just in case you wanna look at it.
This version is much smaller due to dynamic linking (which is fixed in
openvswitch trunk but not in the 2.0 branch) and uses procd for
service setup.

Thanks for testing,
Helmut

[1] https://github.com/hschaa/openvswitch-feed
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC/RFT] netifd: Initial OpenVSwitch support

2014-02-04 Thread Helmut Schaa
On Tue, Feb 4, 2014 at 9:16 AM, Roberto Riggio
roberto.rig...@create-net.org wrote:
 On 04/02/14 09:09, Helmut Schaa wrote:
 What if you write the config file after boot and run /etc/init.d/network 
 reload?
 Does it also end up in a loop?

 Just tried, no, it does not loop.

 Ok, this helps a lot I guess.
 Maybe OVS is not up and running yet during boot or not yet initialized?

 Forgot to point out that it does not loop but it also does not work as
 expected. basically the bridge is not created.


But it works if you create it manually with ovs-vsctl?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC] mt7620 wifi

2014-02-04 Thread Helmut Schaa
On Tue, Feb 4, 2014 at 4:40 PM, Roman Yeryomin leroi.li...@gmail.com wrote:
 Thanks for answer, Helmut!

 On 3 February 2014 18:01, Helmut Schaa helmut.sc...@googlemail.com wrote:
 On Sat, Feb 1, 2014 at 1:08 AM, Roman Yeryomin leroi.li...@gmail.com wrote:
 Unfortunately I have no experience in wifi drivers and this is my
 first one. Even worse I don't know what those register (rfcsr and bbp)
 writes _should_ do because they are not in datasheet (I suppose the
 earlier chips rf registers are not documented also).

 Yep, there are no documents out there as far as I know :/

 So it's mostly just magic and assumptions...

 Attaching the patches hoping somebody with more experience could help
 or at least give an advise. The patches are not very clean and
 probably some things can be done in a different way but that's not the
 point right now.

 Currently wifi interface appears in the system and can be enabled but
 `iw dev wlan0 scan' gives no result and wlan0 transmits one packet
 roughly in 10 minutes as per ifconfig (ssid doesn't appear in the
 air).
 `iw phy' output looks like this:

 Maybe you should start with a simple monitor interface to get the RX
 path working (iw phy phy0 interface add mon0 type monitor).
 Just run a tcpdump on mon0 and see if you can receive something (with
 your patches applied).

 Unfortunately it doesn't give any results.
 Also rx counter was always zero - I forgot to mention that.
 What I thought was suspicious is Available Antennas: TX 0 RX 0 in iw
 phy output, but I've checked other chips which do work and they all
 have the same record.

Yeah, rt2x00 does not initialize these AFAIK.

So, you ported the code from the ralink rt2860 driver, right?
I haven't looked into newer ralink chips at all. Did you check if any MAC
layer changes regarding RX and TX rings exist?

helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC] mt7620 wifi

2014-02-04 Thread Helmut Schaa
On Tue, Feb 4, 2014 at 5:19 PM, Roman Yeryomin leroi.li...@gmail.com wrote:
 On 4 February 2014 17:56, Helmut Schaa helmut.sc...@googlemail.com wrote:
 Currently wifi interface appears in the system and can be enabled but
 `iw dev wlan0 scan' gives no result and wlan0 transmits one packet
 roughly in 10 minutes as per ifconfig (ssid doesn't appear in the
 air).
 `iw phy' output looks like this:

 Maybe you should start with a simple monitor interface to get the RX
 path working (iw phy phy0 interface add mon0 type monitor).
 Just run a tcpdump on mon0 and see if you can receive something (with
 your patches applied).

 Unfortunately it doesn't give any results.
 Also rx counter was always zero - I forgot to mention that.
 What I thought was suspicious is Available Antennas: TX 0 RX 0 in iw
 phy output, but I've checked other chips which do work and they all
 have the same record.

 Yeah, rt2x00 does not initialize these AFAIK.

 So, you ported the code from the ralink rt2860 driver, right?
 I haven't looked into newer ralink chips at all. Did you check if any MAC
 layer changes regarding RX and TX rings exist?

 Yes, from rt2860v2 2.7.1.6 to be precise.
 Yes I did the mac registers init too. There are several new registers
 they initialize. I tried to integrate mac init to the existing
 function. Do you think I should try to do it separately?

No, should be fine that way (for testing) I guess.

Did you check if the interrupt handler is called after setting the
device up (/proc/interrupts)?
Just as a first evidence of life?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC] mt7620 wifi

2014-02-04 Thread Helmut Schaa
On Tue, Feb 4, 2014 at 8:24 PM, Roman Yeryomin leroi.li...@gmail.com wrote:
 On 4 February 2014 19:58, Helmut Schaa helmut.sc...@googlemail.com wrote:
 On Tue, Feb 4, 2014 at 5:19 PM, Roman Yeryomin leroi.li...@gmail.com wrote:
 On 4 February 2014 17:56, Helmut Schaa helmut.sc...@googlemail.com wrote:
 Currently wifi interface appears in the system and can be enabled but
 `iw dev wlan0 scan' gives no result and wlan0 transmits one packet
 roughly in 10 minutes as per ifconfig (ssid doesn't appear in the
 air).
 `iw phy' output looks like this:

 Maybe you should start with a simple monitor interface to get the RX
 path working (iw phy phy0 interface add mon0 type monitor).
 Just run a tcpdump on mon0 and see if you can receive something (with
 your patches applied).

 Unfortunately it doesn't give any results.
 Also rx counter was always zero - I forgot to mention that.
 What I thought was suspicious is Available Antennas: TX 0 RX 0 in iw
 phy output, but I've checked other chips which do work and they all
 have the same record.

 Yeah, rt2x00 does not initialize these AFAIK.

 So, you ported the code from the ralink rt2860 driver, right?
 I haven't looked into newer ralink chips at all. Did you check if any MAC
 layer changes regarding RX and TX rings exist?

 Yes, from rt2860v2 2.7.1.6 to be precise.
 Yes I did the mac registers init too. There are several new registers
 they initialize. I tried to integrate mac init to the existing
 function. Do you think I should try to do it separately?

 No, should be fine that way (for testing) I guess.

 Did you check if the interrupt handler is called after setting the
 device up (/proc/interrupts)?
 Just as a first evidence of life?

 Hmm..
 If I configure it as ap, yes:
CPU0
   5: 28  MIPS  1010.ethernet
   6:  38912  MIPS  rt2800_wmac
   7: 204558  MIPS  timer
   9:  0  INTC  1100.timer
  20:521  INTC  serial
  25:  2  INTC  gsw
 ERR:  0

Good, so at least something happens :D
Might make sense to add some code to the interrupt handler to see
which interrupts get fired.

 But if I put it in monitor mode (either via config or iw command)
 interrupt counter remains zero. What does it mean?

So, it seems as if the RX path is not working at all. But that can have
several reasons ...

Did you check with a second wifi device if the card transmits any
frames in AP mode?
Beacons?

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC/RFT] netifd: Initial OpenVSwitch support

2014-02-03 Thread Helmut Schaa
Hi Roberto,

On Sun, Feb 2, 2014 at 9:01 PM, Roberto Riggio
roberto.rig...@create-net.org wrote:
 Hi,

 I'm testing your patch with this configuration in /etc/config/network

 config device
 option name 'ovs'
 option type 'ovs'
 list ifname 'eth0'

 config interface
 option ifname 'ovs'
 option proto 'dhcp'

 However at boot the router enters in an infinite loop:

What if you write the config file after boot and run /etc/init.d/network reload?
Does it also end up in a loop?
What version of ovs do you use?

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC] mt7620 wifi

2014-02-03 Thread Helmut Schaa
Hi,

On Sat, Feb 1, 2014 at 1:08 AM, Roman Yeryomin leroi.li...@gmail.com wrote:
 Hello everybody!
 I'm trying to get mt7620 (ramips target, rt-n14u board) wifi working
 but no luck. I have ported init functions and channel setup from the
 original (known to be working) driver. The original driver (and
 datasheet) is available in the web.
 Unfortunately I have no experience in wifi drivers and this is my
 first one. Even worse I don't know what those register (rfcsr and bbp)
 writes _should_ do because they are not in datasheet (I suppose the
 earlier chips rf registers are not documented also).

Yep, there are no documents out there as far as I know :/

 Attaching the patches hoping somebody with more experience could help
 or at least give an advise. The patches are not very clean and
 probably some things can be done in a different way but that's not the
 point right now.

 Currently wifi interface appears in the system and can be enabled but
 `iw dev wlan0 scan' gives no result and wlan0 transmits one packet
 roughly in 10 minutes as per ifconfig (ssid doesn't appear in the
 air).
 `iw phy' output looks like this:

Maybe you should start with a simple monitor interface to get the RX
path working (iw phy phy0 interface add mon0 type monitor).
Just run a tcpdump on mon0 and see if you can receive something (with
your patches applied).
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] hostapd: fix basic_rate list format

2014-01-29 Thread Helmut Schaa
On Wed, Jan 29, 2014 at 2:33 PM, Daniel dan...@makrotopia.org wrote:
 hostapd expects basic_rates list to be space separated and in
 100kbit/s units.

Yep, I had a similar patch in my local tree. Thanks for fixing!

 ---
  package/network/services/hostapd/files/netifd.sh | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)

 diff --git a/package/network/services/hostapd/files/netifd.sh 
 b/package/network/services/hostapd/files/netifd.sh
 index c8518b4..2e8e045 100644
 --- a/package/network/services/hostapd/files/netifd.sh
 +++ b/package/network/services/hostapd/files/netifd.sh
 @@ -1,9 +1,7 @@
  hostapd_add_rate() {
 local var=$1
 -   local val=$(($2 / 1000))
 -   local sub=$((($2 / 100) % 10))
 -   append $var $val ,
 -   [ $sub -gt 0 ]  append $var .
 +   local val=$(($2 / 100))
 +   append $var $val  
  }

  hostapd_append_wep_key() {
 --
 1.8.5.3

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/4] b53: Use phy_drivers_register to register multiple phy drivers at once

2014-01-26 Thread Helmut Schaa




Jonas Gorski j...@openwrt.org schrieb:
On Fri, Jan 24, 2014 at 12:57 PM, Helmut Schaa
helmut.sc...@googlemail.com wrote:

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 ---
  .../generic/files/drivers/net/phy/b53/b53_mdio.c   | 44
++
  1 file changed, 12 insertions(+), 32 deletions(-)

 diff --git
a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
 index 3c25f0e..b86ea1a 100644
 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
 +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
 @@ -341,8 +341,9 @@ static int b53_phy_read_status(struct phy_device
*phydev)
 return 0;
  }

 -/* BCM5325, BCM539x */
 -static struct phy_driver b53_phy_driver_id1 = {
 +static struct phy_driver b53_phy_drivers[] = {
 +{
 +   /* BCM5325, BCM539x */
 .phy_id = 0x0143bc00,
 .name   = Broadcom B53 (1),
 .phy_id_mask= 0x1c00,
 @@ -355,10 +356,8 @@ static struct phy_driver b53_phy_driver_id1 = {
 .driver = {
 .owner = THIS_MODULE,
 },
 -};
 -
 -/* BCM53125, BCM53128 */
 -static struct phy_driver b53_phy_driver_id2 = {
 +}, {
 +   /* BCM53125, BCM53128 */
 .phy_id = 0x03625c00,
 .name   = Broadcom B53 (2),
 .phy_id_mask= 0x1c00,
 @@ -371,10 +370,8 @@ static struct phy_driver b53_phy_driver_id2 = {
 .driver = {
 .owner = THIS_MODULE,
 },
 -};
 -
 -/* BCM5365 */
 -static struct phy_driver b53_phy_driver_id3 = {
 +}, {
 +   /* BCM5365 */
 .phy_id = 0x00406000,
 .name   = Broadcom B53 (3),
 .phy_id_mask= 0x1c00,
 @@ -387,35 +384,18 @@ static struct phy_driver b53_phy_driver_id3 = {
 .driver = {
 .owner = THIS_MODULE,
 },
 -};
 +} };
 +

  int __init b53_phy_driver_register(void)
  {
 -   int ret;
 -
 -   ret = phy_driver_register(b53_phy_driver_id1);
 -   if (ret)
 -   return ret;
 -
 -   ret = phy_driver_register(b53_phy_driver_id2);
 -   if (ret)
 -   goto err1;
 -
 -   ret = phy_driver_register(b53_phy_driver_id3);
 -   if (!ret)
 -   return 0;
 -
 -   phy_driver_unregister(b53_phy_driver_id2);
 -err1:
 -   phy_driver_unregister(b53_phy_driver_id1);
 -   return ret;
 +   return phy_drivers_register(b53_phy_drivers,
 +   ARRAY_SIZE(b53_phy_drivers));
  }

  void __exit b53_phy_driver_unregister(void)
  {
 -   phy_driver_unregister(b53_phy_driver_id3);
 -   phy_driver_unregister(b53_phy_driver_id2);
 -   phy_driver_unregister(b53_phy_driver_id1);
 +   phy_drivers_unregister(b53_phy_drivers,
ARRAY_SIZE(b53_phy_drivers));

AFAICT phy_drivers_{un,}register is only available in 3.6+, so I would
like to hold this off until all targets are in appropriate version to
not risk breaking the older targets.

OK, let's drop this patch then ...
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 4/4] b53: mdio: Avoid re-registering the same switch device

2014-01-26 Thread Helmut Schaa




Jonas Gorski j...@openwrt.org schrieb:
On Fri, Jan 24, 2014 at 12:57 PM, Helmut Schaa
helmut.sc...@googlemail.com wrote:
 When setting the associated interface down and up again a new
 switch device will be registered due to b53_phy_config_init
 doing the necessary allocations and registrations.

 Instead, register the switch device already in b53_phy_probe.

Generally I'm fine with it, but two issues I saw ...


 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 ---
  .../generic/files/drivers/net/phy/b53/b53_common.c |  2 +-
  .../generic/files/drivers/net/phy/b53/b53_mdio.c   | 40
--
  .../generic/files/drivers/net/phy/b53/b53_priv.h   |  2 ++
  3 files changed, 17 insertions(+), 27 deletions(-)

 diff --git
a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 index b82bc93..37f520d 100644
 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 @@ -478,7 +478,7 @@ static void b53_switch_reset_gpio(struct
b53_device *dev)
 dev-current_page = 0xff;
  }

 -static int b53_switch_reset(struct b53_device *dev)
 +int b53_switch_reset(struct b53_device *dev)
  {
 u8 mgmt;

 diff --git
a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
 index b86ea1a..e626217 100644
 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
 +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
 @@ -253,56 +253,44 @@ static struct b53_io_ops b53_mdio_ops = {

  static int b53_phy_probe(struct phy_device *phydev)
  {
 -   struct b53_device dev;
 +   struct b53_device *dev;
 int ret;

 /* allow the generic phy driver to take over */
 if (phydev-addr != B53_PSEUDO_PHY  phydev-addr != 0)
 return -ENODEV;

 -   dev.current_page = 0xff;
 -   dev.priv = phydev-bus;
 -   dev.ops = b53_mdio_ops;
 -   dev.pdata = NULL;
 -   mutex_init(dev.reg_mutex);
 +   dev = b53_switch_alloc(phydev-dev, b53_mdio_ops,
phydev-bus);
 +   if (!dev)
 +   return -ENOMEM;

 -   ret = b53_switch_detect(dev);
 -   if (ret)
 +   dev-current_page = 0xff;
 +
 +   ret = b53_switch_register(dev);
 +   if (ret) {
 +   kfree(dev);

The b53_device is allocated with devm_kzalloc and automatically free'd
on exit/failure, so this would cause a double free.

Thanks for the review, I'll fix in the next version.

 return ret;
 +   }

 -   if (is5325(dev) || is5365(dev))
 +   if (is5325(dev) || is5365(dev))
 phydev-supported = SUPPORTED_100baseT_Full;
 else
 phydev-supported = SUPPORTED_1000baseT_Full;

 phydev-advertising = phydev-supported;
 +   phydev-priv = dev;

 return 0;
  }

  static int b53_phy_config_init(struct phy_device *phydev)
  {
 -   struct b53_device *dev;
 -   int ret;
 +   struct b53_device *dev = phydev-priv;

 -   dev = b53_switch_alloc(phydev-dev, b53_mdio_ops,
phydev-bus);
 -   if (!dev)
 -   return -ENOMEM;
 -
 -   /* we don't use page 0xff, so force a page set */
 -   dev-current_page = 0xff;
 /* force the ethX as alias */
 dev-sw_dev.alias = phydev-attached_dev-name;

I'm not sure it is safe to modify sw_dev after registration. We should
probably either drop the ethX alias or set it in _probe() (IIRC
phydev-attached_dev-name wasn't set yet in _probe(), which was the
reason for doing it in _config_init(), but I might misremember).

Hmm, that could habe been the reason. However, using probe to register the 
switch device sounds way more sane to me then using config_init. 

Let me check next week ...

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] hostapd: Fix 80211w setup with netifd

2014-01-24 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 package/network/services/hostapd/files/netifd.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/hostapd/files/netifd.sh 
b/package/network/services/hostapd/files/netifd.sh
index 43cc99b..c8518b4 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -295,7 +295,7 @@ hostapd_set_bss_options() {
[ $auth_cache = 0 ]  append bss_conf 
disable_pmksa_caching=1 $N
 
# RSN - allow management frame protection
-   json_get_var ieee80211w
+   json_get_var ieee80211w ieee80211w
case $ieee80211w in
[012])
json_get_vars ieee80211w_max_timeout 
ieee80211w_retry_timeout
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] hostapd: Fix basic_rate setup with netifd

2014-01-24 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 package/network/services/hostapd/files/netifd.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/services/hostapd/files/netifd.sh 
b/package/network/services/hostapd/files/netifd.sh
index 930755f..43cc99b 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -69,6 +69,7 @@ hostapd_prepare_device_config() {
[ -n $hwmode ]  append base_cfg hw_mode=$hwmode $N
 
local brlist= br
+   json_get_values basic_rate_list basic_rate
for br in $basic_rate_list; do
hostapd_add_rate brlist $br
done
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] procd: reboot sometimes hangs

2014-01-24 Thread Helmut Schaa
Hi John,

On Wed, Jan 15, 2014 at 5:39 PM, John Crispin j...@phrozen.org wrote:

 On 15/01/2014 17:12, Helmut Schaa wrote:
 On Wed, Jan 15, 2014 at 4:57 PM, Helmut Schaa
 helmut.sc...@googlemail.com wrote:
 On Wed, Jan 15, 2014 at 2:57 PM, John Crispin j...@phrozen.org wrote:
 Hi

 i had a look at this last night and have the same fix in my local tree
 already. i need to think about it to see if it is enough, however seeing
 that you came up with the same fix tells me it must be correct :)
 However, it makes my procd crash :(
 Fixed by the libubox patch I've sent two minutes ago.
 Helmut
 __

 Hi Helmut,

 just saw it, hope i have time after dinner to fix it tonight ...

Any update on this? I'm running procd with the proposed change without
problems so far ...

Thanks,
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/4] b53: Add BCM53128 switch support

2014-01-24 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 .../linux/generic/files/drivers/net/phy/b53/b53_common.c   | 14 ++
 target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c  |  2 +-
 target/linux/generic/files/drivers/net/phy/b53/b53_priv.h  |  4 +++-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index f6a5418..72b08e1 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -1130,6 +1130,19 @@ static const struct b53_chip_data b53_switch_chips[] = {
.sw_ops = b53_switch_ops,
},
{
+   .chip_id = BCM53128_DEVICE_ID,
+   .dev_name = BCM53128,
+   .alias = bcm53128,
+   .vlans = 4096,
+   .enabled_ports = 0x1ff,
+   .cpu_port = B53_CPU_PORT,
+   .vta_regs = B53_VTA_REGS,
+   .duplex_reg = B53_DUPLEX_STAT_GE,
+   .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+   .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+   .sw_ops = b53_switch_ops,
+   },
+   {
.chip_id = BCM63XX_DEVICE_ID,
.dev_name = BCM63xx,
.alias = bcm63xx,
@@ -1363,6 +1376,7 @@ int b53_switch_detect(struct b53_device *dev)
switch (id32) {
case BCM53115_DEVICE_ID:
case BCM53125_DEVICE_ID:
+   case BCM53128_DEVICE_ID:
case BCM53010_DEVICE_ID:
case BCM53011_DEVICE_ID:
case BCM53012_DEVICE_ID:
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
index cacf32b..3c25f0e 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
@@ -357,7 +357,7 @@ static struct phy_driver b53_phy_driver_id1 = {
},
 };
 
-/* BCM53125 */
+/* BCM53125, BCM53128 */
 static struct phy_driver b53_phy_driver_id2 = {
.phy_id = 0x03625c00,
.name   = Broadcom B53 (2),
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h 
b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
index d9881a1..ce5b530 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
@@ -46,6 +46,7 @@ enum {
BCM5398_DEVICE_ID = 0x98,
BCM53115_DEVICE_ID = 0x53115,
BCM53125_DEVICE_ID = 0x53125,
+   BCM53128_DEVICE_ID = 0x53128,
BCM63XX_DEVICE_ID = 0x6300,
BCM53010_DEVICE_ID = 0x53010,
BCM53011_DEVICE_ID = 0x53011,
@@ -137,7 +138,8 @@ static inline int is539x(struct b53_device *dev)
 static inline int is531x5(struct b53_device *dev)
 {
return dev-chip_id == BCM53115_DEVICE_ID ||
-   dev-chip_id == BCM53125_DEVICE_ID;
+   dev-chip_id == BCM53125_DEVICE_ID ||
+   dev-chip_id == BCM53128_DEVICE_ID;
 }
 
 static inline int is63xx(struct b53_device *dev)
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/4] b53: Use phy_drivers_register to register multiple phy drivers at once

2014-01-24 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 .../generic/files/drivers/net/phy/b53/b53_mdio.c   | 44 ++
 1 file changed, 12 insertions(+), 32 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
index 3c25f0e..b86ea1a 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
@@ -341,8 +341,9 @@ static int b53_phy_read_status(struct phy_device *phydev)
return 0;
 }
 
-/* BCM5325, BCM539x */
-static struct phy_driver b53_phy_driver_id1 = {
+static struct phy_driver b53_phy_drivers[] = {
+{
+   /* BCM5325, BCM539x */
.phy_id = 0x0143bc00,
.name   = Broadcom B53 (1),
.phy_id_mask= 0x1c00,
@@ -355,10 +356,8 @@ static struct phy_driver b53_phy_driver_id1 = {
.driver = {
.owner = THIS_MODULE,
},
-};
-
-/* BCM53125, BCM53128 */
-static struct phy_driver b53_phy_driver_id2 = {
+}, {
+   /* BCM53125, BCM53128 */
.phy_id = 0x03625c00,
.name   = Broadcom B53 (2),
.phy_id_mask= 0x1c00,
@@ -371,10 +370,8 @@ static struct phy_driver b53_phy_driver_id2 = {
.driver = {
.owner = THIS_MODULE,
},
-};
-
-/* BCM5365 */
-static struct phy_driver b53_phy_driver_id3 = {
+}, {
+   /* BCM5365 */
.phy_id = 0x00406000,
.name   = Broadcom B53 (3),
.phy_id_mask= 0x1c00,
@@ -387,35 +384,18 @@ static struct phy_driver b53_phy_driver_id3 = {
.driver = {
.owner = THIS_MODULE,
},
-};
+} };
+
 
 int __init b53_phy_driver_register(void)
 {
-   int ret;
-
-   ret = phy_driver_register(b53_phy_driver_id1);
-   if (ret)
-   return ret;
-
-   ret = phy_driver_register(b53_phy_driver_id2);
-   if (ret)
-   goto err1;
-
-   ret = phy_driver_register(b53_phy_driver_id3);
-   if (!ret)
-   return 0;
-
-   phy_driver_unregister(b53_phy_driver_id2);
-err1:
-   phy_driver_unregister(b53_phy_driver_id1);
-   return ret;
+   return phy_drivers_register(b53_phy_drivers,
+   ARRAY_SIZE(b53_phy_drivers));
 }
 
 void __exit b53_phy_driver_unregister(void)
 {
-   phy_driver_unregister(b53_phy_driver_id3);
-   phy_driver_unregister(b53_phy_driver_id2);
-   phy_driver_unregister(b53_phy_driver_id1);
+   phy_drivers_unregister(b53_phy_drivers, ARRAY_SIZE(b53_phy_drivers));
 }
 
 module_init(b53_phy_driver_register);
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/4] b53: Make b53_switch_init static

2014-01-24 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 target/linux/generic/files/drivers/net/phy/b53/b53_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index 72b08e1..b82bc93 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -1222,7 +1222,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
},
 };
 
-int b53_switch_init(struct b53_device *dev)
+static int b53_switch_init(struct b53_device *dev)
 {
struct switch_dev *sw_dev = dev-sw_dev;
unsigned i;
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/4] b53: mdio: Avoid re-registering the same switch device

2014-01-24 Thread Helmut Schaa
When setting the associated interface down and up again a new
switch device will be registered due to b53_phy_config_init
doing the necessary allocations and registrations.

Instead, register the switch device already in b53_phy_probe.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 .../generic/files/drivers/net/phy/b53/b53_common.c |  2 +-
 .../generic/files/drivers/net/phy/b53/b53_mdio.c   | 40 --
 .../generic/files/drivers/net/phy/b53/b53_priv.h   |  2 ++
 3 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index b82bc93..37f520d 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -478,7 +478,7 @@ static void b53_switch_reset_gpio(struct b53_device *dev)
dev-current_page = 0xff;
 }
 
-static int b53_switch_reset(struct b53_device *dev)
+int b53_switch_reset(struct b53_device *dev)
 {
u8 mgmt;
 
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
index b86ea1a..e626217 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
@@ -253,56 +253,44 @@ static struct b53_io_ops b53_mdio_ops = {
 
 static int b53_phy_probe(struct phy_device *phydev)
 {
-   struct b53_device dev;
+   struct b53_device *dev;
int ret;
 
/* allow the generic phy driver to take over */
if (phydev-addr != B53_PSEUDO_PHY  phydev-addr != 0)
return -ENODEV;
 
-   dev.current_page = 0xff;
-   dev.priv = phydev-bus;
-   dev.ops = b53_mdio_ops;
-   dev.pdata = NULL;
-   mutex_init(dev.reg_mutex);
+   dev = b53_switch_alloc(phydev-dev, b53_mdio_ops, phydev-bus);
+   if (!dev)
+   return -ENOMEM;
 
-   ret = b53_switch_detect(dev);
-   if (ret)
+   dev-current_page = 0xff;
+
+   ret = b53_switch_register(dev);
+   if (ret) {
+   kfree(dev);
return ret;
+   }
 
-   if (is5325(dev) || is5365(dev))
+   if (is5325(dev) || is5365(dev))
phydev-supported = SUPPORTED_100baseT_Full;
else
phydev-supported = SUPPORTED_1000baseT_Full;
 
phydev-advertising = phydev-supported;
+   phydev-priv = dev;
 
return 0;
 }
 
 static int b53_phy_config_init(struct phy_device *phydev)
 {
-   struct b53_device *dev;
-   int ret;
+   struct b53_device *dev = phydev-priv;
 
-   dev = b53_switch_alloc(phydev-dev, b53_mdio_ops, phydev-bus);
-   if (!dev)
-   return -ENOMEM;
-
-   /* we don't use page 0xff, so force a page set */
-   dev-current_page = 0xff;
/* force the ethX as alias */
dev-sw_dev.alias = phydev-attached_dev-name;
 
-   ret = b53_switch_register(dev);
-   if (ret) {
-   dev_err(dev-dev, failed to register switch: %i\n, ret);
-   return ret;
-   }
-
-   phydev-priv = dev;
-
-   return 0;
+   return b53_switch_reset(dev);
 }
 
 static void b53_phy_remove(struct phy_device *phydev)
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h 
b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
index ce5b530..75b86dc 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
@@ -180,6 +180,8 @@ int b53_switch_detect(struct b53_device *dev);
 
 int b53_switch_register(struct b53_device *dev);
 
+int b53_switch_reset(struct b53_device *dev);
+
 static inline void b53_switch_remove(struct b53_device *dev)
 {
unregister_switch(dev-sw_dev);
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] procd: reboot sometimes hangs

2014-01-24 Thread Helmut Schaa
On Fri, Jan 24, 2014 at 1:27 PM, John Crispin j...@phrozen.org wrote:

 On 24/01/2014 12:45, Helmut Schaa wrote:
 Hi John,

 On Wed, Jan 15, 2014 at 5:39 PM, John Crispin j...@phrozen.org wrote:
 On 15/01/2014 17:12, Helmut Schaa wrote:
 On Wed, Jan 15, 2014 at 4:57 PM, Helmut Schaa
 helmut.sc...@googlemail.com wrote:
 On Wed, Jan 15, 2014 at 2:57 PM, John Crispin j...@phrozen.org wrote:
 Hi

 i had a look at this last night and have the same fix in my local tree
 already. i need to think about it to see if it is enough, however seeing
 that you came up with the same fix tells me it must be correct :)
 However, it makes my procd crash :(
 Fixed by the libubox patch I've sent two minutes ago.
 Helmut
 __
 Hi Helmut,

 just saw it, hope i have time after dinner to fix it tonight ...
 Any update on this? I'm running procd with the proposed change without
 problems so far ...

 Thanks,
 Helmut
 Hi Helmut,

 i had to help out with the linux-mips 3.14 release which ate all my time
 the last 2 weeks. the chore is still on my list, just not got round to
 looking into it yet ...

Ok, no worries. Take your time :D
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] mpc85xx: Fix building ramdisk images

2014-01-22 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 target/linux/mpc85xx/image/Makefile | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/target/linux/mpc85xx/image/Makefile 
b/target/linux/mpc85xx/image/Makefile
index 4c80bb7..5ecd100 100644
--- a/target/linux/mpc85xx/image/Makefile
+++ b/target/linux/mpc85xx/image/Makefile
@@ -19,11 +19,7 @@ define factoryname
 $(call imgname,$(1),$(2))-factory.bin
 endef
 
-ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
-  IMAGE_SUFFIX=-initramfs
-endif
-
-zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage$(IMAGE_SUFFIX)
+zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage
 
 DTS_TARGETS = mpc8548cds_32b p1010rdb tl-wdr4900-v1 p1020rdb
 BOOT_IMAGES:=zImage cuImage.tl-wdr4900-v1
@@ -35,7 +31,7 @@ define Image/Prepare
 endef
 
 define Image/BuildKernel
-   cp $(KDIR)/zImage$(IMAGE_SUFFIX) $(zImage)
+   cp $(KDIR)/zImage $(zImage)
$(foreach dts,$(DTS_TARGETS),
$(LINUX_DIR)/scripts/dtc/dtc -I dts -O dtb 
$(LINUX_DIR)/arch/powerpc/boot/dts/$(dts).dts  
$(BIN_DIR)/$(IMG_PREFIX)-$(dts).fdt
)
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] mpc85xx: Remove inittab workaround

2014-01-22 Thread Helmut Schaa
The default inittab uses askconsole which is implemented by procd
and uses the console provided by the kernel command line.

Hence, this platform specific workaround is not necessary anymore.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 target/linux/mpc85xx/base-files/etc/inittab|  2 --
 .../etc/uci-defaults/00_inittab-console-fixup  | 27 --
 2 files changed, 29 deletions(-)
 delete mode 100644 target/linux/mpc85xx/base-files/etc/inittab
 delete mode 100755 
target/linux/mpc85xx/base-files/etc/uci-defaults/00_inittab-console-fixup

diff --git a/target/linux/mpc85xx/base-files/etc/inittab 
b/target/linux/mpc85xx/base-files/etc/inittab
deleted file mode 100644
index 17f829f..000
--- a/target/linux/mpc85xx/base-files/etc/inittab
+++ /dev/null
@@ -1,2 +0,0 @@
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K shutdown
diff --git 
a/target/linux/mpc85xx/base-files/etc/uci-defaults/00_inittab-console-fixup 
b/target/linux/mpc85xx/base-files/etc/uci-defaults/00_inittab-console-fixup
deleted file mode 100755
index 9d7b2ae..000
--- a/target/linux/mpc85xx/base-files/etc/uci-defaults/00_inittab-console-fixup
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2011 OpenWrt.org
-#
-
-enable_console_login() {
-   local cons=$1
-   local initline=$cons::askfirst:/bin/ash --login
-
-   grep -qs ^$initline /etc/inittab || {
-   echo $initline  /etc/inittab
-   sync
-   kill -HUP 1
-   }
-}
-
-inittab_console_fixup() {
-   for cons in ttyS0 ttyS1; do
-   grep -qs console=$cons /proc/cmdline  {
-   enable_console_login $cons
-   }
-   done
-}
-
-inittab_console_fixup
-
-exit 0
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] b53: Add BCM53128 switch support

2014-01-22 Thread Helmut Schaa
The BCM53128 seems to be very similar to the BCM53125 but has some more ports.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 .../generic/files/drivers/net/phy/b53/b53_common.c | 14 +
 .../generic/files/drivers/net/phy/b53/b53_mdio.c   | 24 ++
 .../generic/files/drivers/net/phy/b53/b53_priv.h   |  4 +++-
 3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index f6a5418..72b08e1 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -1130,6 +1130,19 @@ static const struct b53_chip_data b53_switch_chips[] = {
.sw_ops = b53_switch_ops,
},
{
+   .chip_id = BCM53128_DEVICE_ID,
+   .dev_name = BCM53128,
+   .alias = bcm53128,
+   .vlans = 4096,
+   .enabled_ports = 0x1ff,
+   .cpu_port = B53_CPU_PORT,
+   .vta_regs = B53_VTA_REGS,
+   .duplex_reg = B53_DUPLEX_STAT_GE,
+   .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+   .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+   .sw_ops = b53_switch_ops,
+   },
+   {
.chip_id = BCM63XX_DEVICE_ID,
.dev_name = BCM63xx,
.alias = bcm63xx,
@@ -1363,6 +1376,7 @@ int b53_switch_detect(struct b53_device *dev)
switch (id32) {
case BCM53115_DEVICE_ID:
case BCM53125_DEVICE_ID:
+   case BCM53128_DEVICE_ID:
case BCM53010_DEVICE_ID:
case BCM53011_DEVICE_ID:
case BCM53012_DEVICE_ID:
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
index cacf32b..b7e6b59 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
@@ -389,6 +389,23 @@ static struct phy_driver b53_phy_driver_id3 = {
},
 };
 
+/* BCM53128 */
+static struct phy_driver b53_phy_driver_id4 = {
+   .phy_id = 0x03625e14,
+   .name   = Broadcom B53 (4),
+   .phy_id_mask= 0x1c00,
+   .features   = 0,
+   .probe  = b53_phy_probe,
+   .remove = b53_phy_remove,
+   .config_aneg= b53_phy_config_aneg,
+   .config_init= b53_phy_config_init,
+   .read_status= b53_phy_read_status,
+   .driver = {
+   .owner = THIS_MODULE,
+   },
+};
+
+
 int __init b53_phy_driver_register(void)
 {
int ret;
@@ -402,9 +419,15 @@ int __init b53_phy_driver_register(void)
goto err1;
 
ret = phy_driver_register(b53_phy_driver_id3);
+   if (ret)
+   goto err2;
+
+   ret = phy_driver_register(b53_phy_driver_id4);
if (!ret)
return 0;
 
+   phy_driver_unregister(b53_phy_driver_id3);
+err2:
phy_driver_unregister(b53_phy_driver_id2);
 err1:
phy_driver_unregister(b53_phy_driver_id1);
@@ -413,6 +436,7 @@ err1:
 
 void __exit b53_phy_driver_unregister(void)
 {
+   phy_driver_unregister(b53_phy_driver_id4);
phy_driver_unregister(b53_phy_driver_id3);
phy_driver_unregister(b53_phy_driver_id2);
phy_driver_unregister(b53_phy_driver_id1);
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h 
b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
index d9881a1..ce5b530 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
@@ -46,6 +46,7 @@ enum {
BCM5398_DEVICE_ID = 0x98,
BCM53115_DEVICE_ID = 0x53115,
BCM53125_DEVICE_ID = 0x53125,
+   BCM53128_DEVICE_ID = 0x53128,
BCM63XX_DEVICE_ID = 0x6300,
BCM53010_DEVICE_ID = 0x53010,
BCM53011_DEVICE_ID = 0x53011,
@@ -137,7 +138,8 @@ static inline int is539x(struct b53_device *dev)
 static inline int is531x5(struct b53_device *dev)
 {
return dev-chip_id == BCM53115_DEVICE_ID ||
-   dev-chip_id == BCM53125_DEVICE_ID;
+   dev-chip_id == BCM53125_DEVICE_ID ||
+   dev-chip_id == BCM53128_DEVICE_ID;
 }
 
 static inline int is63xx(struct b53_device *dev)
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] b53: Use phy_drivers_register

2014-01-22 Thread Helmut Schaa
Using phy_drivers_register multiple phy drivers can be registered at once
which makes the code easier to read.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 .../generic/files/drivers/net/phy/b53/b53_mdio.c   | 56 +-
 1 file changed, 13 insertions(+), 43 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
index b7e6b59..3257acd 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
@@ -341,8 +341,9 @@ static int b53_phy_read_status(struct phy_device *phydev)
return 0;
 }
 
-/* BCM5325, BCM539x */
-static struct phy_driver b53_phy_driver_id1 = {
+static struct phy_driver b53_phy_drivers[] = {
+{
+   /* BCM5325, BCM539x */
.phy_id = 0x0143bc00,
.name   = Broadcom B53 (1),
.phy_id_mask= 0x1c00,
@@ -355,10 +356,8 @@ static struct phy_driver b53_phy_driver_id1 = {
.driver = {
.owner = THIS_MODULE,
},
-};
-
-/* BCM53125 */
-static struct phy_driver b53_phy_driver_id2 = {
+}, {
+   /* BCM53125 */
.phy_id = 0x03625c00,
.name   = Broadcom B53 (2),
.phy_id_mask= 0x1c00,
@@ -371,10 +370,8 @@ static struct phy_driver b53_phy_driver_id2 = {
.driver = {
.owner = THIS_MODULE,
},
-};
-
-/* BCM5365 */
-static struct phy_driver b53_phy_driver_id3 = {
+}, {
+   /* BCM5365 */
.phy_id = 0x00406000,
.name   = Broadcom B53 (3),
.phy_id_mask= 0x1c00,
@@ -387,10 +384,8 @@ static struct phy_driver b53_phy_driver_id3 = {
.driver = {
.owner = THIS_MODULE,
},
-};
-
-/* BCM53128 */
-static struct phy_driver b53_phy_driver_id4 = {
+}, {
+   /* BCM53128 */
.phy_id = 0x03625e14,
.name   = Broadcom B53 (4),
.phy_id_mask= 0x1c00,
@@ -403,43 +398,18 @@ static struct phy_driver b53_phy_driver_id4 = {
.driver = {
.owner = THIS_MODULE,
},
-};
+} };
 
 
 int __init b53_phy_driver_register(void)
 {
-   int ret;
-
-   ret = phy_driver_register(b53_phy_driver_id1);
-   if (ret)
-   return ret;
-
-   ret = phy_driver_register(b53_phy_driver_id2);
-   if (ret)
-   goto err1;
-
-   ret = phy_driver_register(b53_phy_driver_id3);
-   if (ret)
-   goto err2;
-
-   ret = phy_driver_register(b53_phy_driver_id4);
-   if (!ret)
-   return 0;
-
-   phy_driver_unregister(b53_phy_driver_id3);
-err2:
-   phy_driver_unregister(b53_phy_driver_id2);
-err1:
-   phy_driver_unregister(b53_phy_driver_id1);
-   return ret;
+   return phy_drivers_register(b53_phy_drivers,
+   ARRAY_SIZE(b53_phy_drivers));
 }
 
 void __exit b53_phy_driver_unregister(void)
 {
-   phy_driver_unregister(b53_phy_driver_id4);
-   phy_driver_unregister(b53_phy_driver_id3);
-   phy_driver_unregister(b53_phy_driver_id2);
-   phy_driver_unregister(b53_phy_driver_id1);
+   phy_drivers_unregister(b53_phy_drivers, ARRAY_SIZE(b53_phy_drivers));
 }
 
 module_init(b53_phy_driver_register);
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/2] b53: Add BCM53128 switch support

2014-01-22 Thread Helmut Schaa
On Wed, Jan 22, 2014 at 9:40 PM, Jonas Gorski j...@openwrt.org wrote:
 Hi,

 On Wed, Jan 22, 2014 at 4:58 PM, Helmut Schaa
 helmut.sc...@googlemail.com wrote:
 The BCM53128 seems to be very similar to the BCM53125 but has some more 
 ports.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 ---
  .../generic/files/drivers/net/phy/b53/b53_common.c | 14 +
  .../generic/files/drivers/net/phy/b53/b53_mdio.c   | 24 
 ++
  .../generic/files/drivers/net/phy/b53/b53_priv.h   |  4 +++-
  3 files changed, 41 insertions(+), 1 deletion(-)

 diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
 b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 index f6a5418..72b08e1 100644
 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 @@ -1130,6 +1130,19 @@ static const struct b53_chip_data b53_switch_chips[] 
 = {
 .sw_ops = b53_switch_ops,
 },
 {
 +   .chip_id = BCM53128_DEVICE_ID,
 +   .dev_name = BCM53128,
 +   .alias = bcm53128,
 +   .vlans = 4096,
 +   .enabled_ports = 0x1ff,
 +   .cpu_port = B53_CPU_PORT,
 +   .vta_regs = B53_VTA_REGS,
 +   .duplex_reg = B53_DUPLEX_STAT_GE,
 +   .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
 +   .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
 +   .sw_ops = b53_switch_ops,
 +   },
 +   {
 .chip_id = BCM63XX_DEVICE_ID,
 .dev_name = BCM63xx,
 .alias = bcm63xx,
 @@ -1363,6 +1376,7 @@ int b53_switch_detect(struct b53_device *dev)
 switch (id32) {
 case BCM53115_DEVICE_ID:
 case BCM53125_DEVICE_ID:
 +   case BCM53128_DEVICE_ID:
 case BCM53010_DEVICE_ID:
 case BCM53011_DEVICE_ID:
 case BCM53012_DEVICE_ID:
 diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c 
 b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
 index cacf32b..b7e6b59 100644
 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
 +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
 @@ -389,6 +389,23 @@ static struct phy_driver b53_phy_driver_id3 = {
 },
  };

 +/* BCM53128 */
 +static struct phy_driver b53_phy_driver_id4 = {
 +   .phy_id = 0x03625e14,
 +   .name   = Broadcom B53 (4),
 +   .phy_id_mask= 0x1c00,
 +   .features   = 0,
 +   .probe  = b53_phy_probe,
 +   .remove = b53_phy_remove,
 +   .config_aneg= b53_phy_config_aneg,
 +   .config_init= b53_phy_config_init,
 +   .read_status= b53_phy_read_status,
 +   .driver = {
 +   .owner = THIS_MODULE,
 +   },
 +};

 This one should be completely unnecessary:

 0x03625e14  0x1c00 == 0x3625c00, which is the phy_id of
 driver_id2, so I don't see how it could ever match (or how id2 then
 could match, depending on in which order linux probes).

Indeed, you're right. Let me fix this up ...

 Apart from that I don't see any issues (adding support for BCM53118 is
 probably analogue).

I'd guess so as well but I only have access to a BCM53128.

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] procd: reboot sometimes hangs

2014-01-15 Thread Helmut Schaa
On Tue, Jan 14, 2014 at 6:36 PM, John Crispin j...@phrozen.org wrote:
 Hi Helmut,

 i have not seen this happen, do you have a reliable testcase or is this
 just an observation you made ?

Unfortunately not, however I have several non-default services running (in
particular openvswitch).

 yes, a forced shutdown would make sense, i need to look at the code to
 make a better judgement though.

 any ideas on what a good timeout would be ? i guess we are shutting down
 so a forced quit after 15s seems legit to me

Makes sense I guess.
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] procd: reboot sometimes hangs

2014-01-15 Thread Helmut Schaa
On Tue, Jan 14, 2014 at 8:19 PM, Bastian Bittorf bitt...@bluebottle.com wrote:
 * John Crispin j...@phrozen.org [14.01.2014 19:55]:
  sometimes I experience hangs when rebooting.

 there are already some bugs on tra open regarding this.

  As far as I can see procd does not try to kill any
  started services but relies on them to exit gracefully.
 
  Would it make sense to kill the services after a
  reasonable timeout?

 i have not seen this happen, do you have a reliable testcase or is this
 just an observation you made ?

 yes, a forced shutdown would make sense, i need to look at the code to
 make a better judgement though.

 any ideas on what a good timeout would be ? i guess we are shutting down
 so a forced quit after 15s seems legit to me

 difficult! at least we must make sure that sync has enough time,
 this can last longer - keep in mind that OpenWrt also runs on big
 boxes...if you ask me: just wait 600 sec 8-) at least it is important
 that the box _does_ reboot and hangs not forever.

procd already runs sync before triggering the final reboot (after
stopping all services).
So, maybe its enough to just add a generic timeout for
procd_inittab_run(shutdown).

Or instead we could use a timeout for every init script that needs to
be stopped.
As far as I can see it might be enough to add a timeout for all runqueue tasks:

diff --git a/rcS.c b/rcS.c
index 395d992..332201e 100644
--- a/rcS.c
+++ b/rcS.c
@@ -115,6 +115,7 @@ static void add_initd(struct runqueue *q, char
*file, char *param)
s = calloc_a(sizeof(*s), f, strlen(file) + 1, p, strlen(param) + 1);
s-proc.task.type = initd_type;
s-proc.task.complete = q_initd_complete;
+   s-proc.task.run_timeout = 1;
s-param = p;
s-file = f;
strcpy(s-param, param);


 the same applies
 for bootup which also can hang. (but the underlying netifd(?)-bug must
 be found...)

Not sure if it is netifd in my case ...
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] procd: reboot sometimes hangs

2014-01-15 Thread Helmut Schaa
On Wed, Jan 15, 2014 at 2:57 PM, John Crispin j...@phrozen.org wrote:
 Hi

 i had a look at this last night and have the same fix in my local tree
 already. i need to think about it to see if it is enough, however seeing
 that you came up with the same fix tells me it must be correct :)

However, it makes my procd crash :(
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] procd: reboot sometimes hangs

2014-01-15 Thread Helmut Schaa
On Wed, Jan 15, 2014 at 4:57 PM, Helmut Schaa
helmut.sc...@googlemail.com wrote:
 On Wed, Jan 15, 2014 at 2:57 PM, John Crispin j...@phrozen.org wrote:
 Hi

 i had a look at this last night and have the same fix in my local tree
 already. i need to think about it to see if it is enough, however seeing
 that you came up with the same fix tells me it must be correct :)

 However, it makes my procd crash :(

Fixed by the libubox patch I've sent two minutes ago.
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] libubox: runqueue: Cancel task timeout when completeing task

2014-01-15 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 runqueue.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/runqueue.c b/runqueue.c
index 1784e30..1d9fa4b 100644
--- a/runqueue.c
+++ b/runqueue.c
@@ -224,6 +224,8 @@ void runqueue_task_complete(struct runqueue_task *t)
if (t-running)
t-q-running_tasks--;
 
+   uloop_timeout_cancel(t-timeout);
+
safe_list_del(t-list);
t-queued = false;
t-running = false;
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] procd: reboot sometimes hangs

2014-01-14 Thread Helmut Schaa
Hi All,

sometimes I experience hangs when rebooting.
As far as I can see procd does not try to kill any
started services but relies on them to exit gracefully.

Would it make sense to kill the services after a
reasonable timeout?

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [OpenWRT-Devel][PATCH] add openvswitch 2.0.0 package

2013-12-20 Thread Helmut Schaa
On Fri, Dec 20, 2013 at 2:43 PM, Roberto Riggio
roberto.rig...@create-net.org wrote:
 On 11/08/2013 11:42 PM, Pete Holland wrote:
 This is a patch for the most recent stable build of OpenvSwitch (2.0.0).  It 
 supports kernels 2.6.32 - 3.10.x

 It was taken and updated from Julius Shulz-Zander's work: 
 https://github.com/schuza/openvswitch

 Very interesting work. I'm currently using ovs 1.9
 mostly because i like the features enabled by netifd
 unfortunatelly this needs the brcompat module which
 was dropped.

 But I also saw another patch for adding support ovs
 support to netifd.

Yep, that was me. I'm using the patch on openwrt since
some time now and am quite happy.

I've got another similar patch for hostapd.

 Btw I'm having some alignment issues with ovs on
 the ixp4xx platform. Basically some OpenFlow field
 are reported with error to the controller. For
 example an ip 192.168.9.56 is reported as 9.56.129.168.

 Anybody using ovs on a non-x86 target?

I'm using ovs on mips (BE) but only with a local controller and
haven't noticed any problems yet.

Is your controller running a different architecture then the
openwrt device?

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [OpenWRT-Devel][PATCH] add openvswitch 2.0.0 package

2013-12-20 Thread Helmut Schaa
On Fri, Dec 20, 2013 at 3:09 PM, Roberto Riggio
roberto.rig...@create-net.org wrote:
 On 12/20/2013 03:02 PM, Helmut Schaa wrote:
 Yep, that was me. I'm using the patch on openwrt since
 some time now and am quite happy.

 I looked at it and I;m not sure if you can define a device
 as bridge and add other interfaces to it. At the moment it
 seems to me that you define another type for the device
 insteead I liked brcompt because i could completelly replace
 the linux bridge with OVS.

True. However, using the current patch you can just replace a
type bridge with type ovs, specifying option iface eth0 eth1
and you will get an ovs containing eth0 and eth1 as ports.

However, if you want to have a more complex port configuration
I thought about how to integrate port specific setup. But this is
still WIP.

 I've got another similar patch for hostapd.

 What is the purpose of the integration?

Letting hostapd automatically add wifi devices to openvswitches
when they come up without the need for brcompat.

 I'm using ovs on mips (BE) but only with a local controller and
 haven't noticed any problems yet.

 Is your controller running a different architecture then the
 openwrt device?

 I tried all of them :) Pox chokes itself, beacon and floodlight
 parse the packet but with the messed up fields (link level
 fields are ok, only the network fields are messed up).

 I run the controllers on my laptop (x86).

Maybe its worth asking on the ovs list?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] packages: strongswan: Add second download mirror

2013-12-13 Thread Helmut Schaa

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 net/strongswan/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/strongswan/Makefile b/net/strongswan/Makefile
index 07253be..de8bcca 100644
--- a/net/strongswan/Makefile
+++ b/net/strongswan/Makefile
@@ -12,7 +12,7 @@ PKG_VERSION:=5.0.4
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=http://download.strongswan.org/
+PKG_SOURCE_URL:=http://download.strongswan.org/ 
http://download2.strongswan.org/
 PKG_MD5SUM:=0ab0397b44b197febfd0f89148344035
 
 PKG_MOD_AVAILABLE:= \
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] libevent2: Configure with --disable-debug-mode

2013-12-09 Thread Helmut Schaa
Saves around 10K.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 package/libs/libevent2/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/libs/libevent2/Makefile b/package/libs/libevent2/Makefile
index e260e12..42ec94d 100644
--- a/package/libs/libevent2/Makefile
+++ b/package/libs/libevent2/Makefile
@@ -109,7 +109,8 @@ TARGET_CFLAGS += $(FPIC)
 
 CONFIGURE_ARGS += \
--enable-shared \
-   --enable-static
+   --enable-static \
+   --disable-debug-mode
 
 MAKE_FLAGS += \
CFLAGS=$(TARGET_CFLAGS)
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] netifd: Fix possible segfault in bridge code

2013-11-29 Thread Helmut Schaa
Need to check calloc result. In case of failure the bridge member will be 
missing.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 bridge.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bridge.c b/bridge.c
index 0e06cc2..4ef0d7e 100644
--- a/bridge.c
+++ b/bridge.c
@@ -318,6 +318,9 @@ bridge_create_member(struct bridge_state *bst, struct 
device *dev, bool hotplug)
struct bridge_member *bm;
 
bm = calloc(1, sizeof(*bm) + strlen(dev-ifname) + 1);
+   if (!bm)
+   return NULL;
+
bm-bst = bst;
bm-dev.cb = bridge_member_cb;
bm-dev.hotplug = hotplug;
-- 
1.8.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] netifd: Fix possible segfault in bridge code

2013-11-29 Thread Helmut Schaa
On Fri, Nov 29, 2013 at 3:34 PM, Felix Fietkau n...@openwrt.org wrote:
 On 2013-11-29 15:22, Helmut Schaa wrote:
 Need to check calloc result. In case of failure the bridge member will be 
 missing.

 Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
 Pushed to git, thanks.
 It will be committed to OpenWrt once I'm done with the integration of
 the new wireless code.

Thanks Felix.
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [RFC/RFT] netifd: Initial OpenVSwitch support

2013-11-29 Thread Helmut Schaa
Add a new device type ovs to define openvswitch (pseudo-) bridges.
For setting up oppenvswitch bridges the ovs-vsctl utility is used
within system-ovs.* and might be replaced with plain JSON-RPC in the
future.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---

This is a first RFC of openvswitch integration in netifd based on
netifd trunk. In parts its quite similar to the bridge code but due
to pseudo bridge support there's not much code to share.

I'd appreciate any testing beside my own :D

I don't really like calling the ovs-vsctl utility (see system-ovs.c)
but using JSON-RPC would add much more code  complexity and there is
no easy-to-use library yet that we could utilize. In the long term
all these forks should be replaced by proper IPC but for now it seems
good enough.

As next step I'd add another device-type ovs-port or similar to allow
definition of internal ovs ports and more complex port configurations
(for example adding eth0 as trunk port for vlan 1,2 and 3).

Thoughts?

Thanks,
Helmut

 CMakeLists.txt |   2 +-
 config.c   |   2 +
 config/network |  15 ++
 device.h   |   1 +
 ovs.c  | 664 +
 system-linux.c |   6 +-
 system-ovs.c   | 115 ++
 system-ovs.h   |  31 +++
 system.h   |   2 +
 9 files changed, 836 insertions(+), 2 deletions(-)
 create mode 100644 ovs.c
 create mode 100644 system-ovs.c
 create mode 100644 system-ovs.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 65da3cf..e4190a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,7 +15,7 @@ SET(SOURCES
interface.c interface-ip.c interface-event.c
iprule.c proto.c proto-static.c proto-shell.c
config.c device.c bridge.c vlan.c alias.c
-   macvlan.c ubus.c wireless.c)
+   macvlan.c ubus.c wireless.c ovs.c system-ovs.c)
 
 
 find_library(json NAMES json-c json)
diff --git a/config.c b/config.c
index bb0cd05..132817d 100644
--- a/config.c
+++ b/config.c
@@ -169,6 +169,8 @@ config_init_devices(void)
devtype = tunnel_device_type;
else if (!strcmp(type, macvlan))
devtype = macvlan_device_type;
+   else if (!strcmp(type, ovs))
+   devtype = ovs_device_type;
}
 
if (!devtype)
diff --git a/config/network b/config/network
index b2985d3..aee4851 100644
--- a/config/network
+++ b/config/network
@@ -72,3 +72,18 @@ config route
option gateway  192.168.5.2
option interface wan
 
+# Basic OpenVSwitch
+config device
+option typeovs
+option namebr-ovs
+option ifname  eth0
+option ovs_empty 1
+
+# Pseudo bridge on top of br-ovs (vlan 1000)
+config device
+option type ovs
+option name br-ovs1000
+option ovs_tag 1000
+option ovs_base br-ovs
+option ifname eth1
+
diff --git a/device.h b/device.h
index dbcaf77..24299a1 100644
--- a/device.h
+++ b/device.h
@@ -153,6 +153,7 @@ extern const struct device_type simple_device_type;
 extern const struct device_type bridge_device_type;
 extern const struct device_type tunnel_device_type;
 extern const struct device_type macvlan_device_type;
+extern const struct device_type ovs_device_type;
 
 void device_lock(void);
 void device_unlock(void);
diff --git a/ovs.c b/ovs.c
new file mode 100644
index 000..29db26c
--- /dev/null
+++ b/ovs.c
@@ -0,0 +1,664 @@
+/*
+ * netifd - network interface daemon
+ * Copyright (C) 2013 Helmut Schaa helmut.sc...@googlemail.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ */
+#include string.h
+#include stdlib.h
+#include stdio.h
+#include assert.h
+#include errno.h
+
+#include netifd.h
+#include device.h
+#include interface.h
+#include system-ovs.h
+
+enum {
+   OVS_ATTR_IFNAME,
+   OVS_ATTR_BASE,
+   OVS_ATTR_TAG,
+   OVS_ATTR_EMPTY,
+   __OVS_ATTR_MAX
+};
+
+static const struct blobmsg_policy ovs_attrs[__OVS_ATTR_MAX] = {
+   [OVS_ATTR_IFNAME] = { ifname, BLOBMSG_TYPE_ARRAY },
+   [OVS_ATTR_BASE] = { ovs_base, BLOBMSG_TYPE_STRING },
+   [OVS_ATTR_TAG] = { ovs_tag, BLOBMSG_TYPE_INT32 },
+   [OVS_ATTR_EMPTY] = { ovs_empty, BLOBMSG_TYPE_BOOL },
+};
+
+static const struct uci_blob_param_info ovs_attr_info[__OVS_ATTR_MAX] = {
+   [OVS_ATTR_IFNAME] = { .type = BLOBMSG_TYPE_STRING },
+};
+
+static const struct uci_blob_param_list ovs_attr_list = {
+   .n_params = __OVS_ATTR_MAX,
+   .params = ovs_attrs,
+   .info = ovs_attr_info,
+
+   .n_next

Re: [OpenWrt-Devel] [PATCH] procd: Allow process respawning forever

2013-11-20 Thread Helmut Schaa
On Tue, Nov 19, 2013 at 5:33 PM, John Crispin j...@phrozen.org wrote:
 i just pushed this fix. I also pushed  a fix for the running trigger bug you
 reported.

Nice, haven't found time to fix it myself yet!

Thanks,
Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] procd: Allow process respawning forever

2013-11-15 Thread Helmut Schaa
Use respawn_retry==0 as indication to respawn a process forever.

Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 instance.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/instance.c b/instance.c
index 05b0f99..2db1ded 100644
--- a/instance.c
+++ b/instance.c
@@ -162,7 +162,7 @@ instance_exit(struct uloop_process *p, int ret)
in-respawn_count++;
else
in-respawn_count = 0;
-   if (in-respawn_count  in-respawn_retry) {
+   if (in-respawn_count  in-respawn_retry  in-respawn_retry 
 0 ) {
LOG(Instance %s::%s s in a crash loop %d crashes, %ld 
seconds since last crash\n,
in-srv-name, 
in-name, in-respawn_count, runtime);
in-restart = in-respawn = 0;
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


  1   2   >