Re: [OpenWrt-Devel] [OpenWrt-Users] Problem of connectivity with adhoc using wpa

2013-11-19 Thread Felix Fietkau
On 2013-11-21 00:09, cmsv wrote:
> I updated  to DISTRIB_REVISION="r38863" which applied
> target/linux/generic/patches-3.3/890-8250_optional_sysrq.patch and the
> the freezes only apply now to serial connection which after  afew hours
> i have to reboot the router if i want to connect through serial. (i use
> a usb to serial converter).
> 
> The network keeps working and so far i see no issues. I have tested with
> AR9xxx and AR7xxx.
> Although this patch seemed to solve the network freeze problem i still get:
> 
> [  169.77] net_ratelimit: 4598 callbacks suppressed
> [ 1864.61] net_ratelimit: 6 callbacks suppressed
> [ 1869.62] net_ratelimit: 4639 callbacks suppressed
> [39448.09] net_ratelimit: 4997 callbacks suppressed
> [41383.60] net_ratelimit: 16 callbacks suppressed
That message itself is meaningless without knowing what message was
suppressed. There should be something above one of these messages (maybe
the first instance of it).

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


Re: [OpenWrt-Devel] AA (3.3.8) and AR9XXX Kernel bug ? (Emergency Thaw)

2013-11-19 Thread cmsv
Here is an update to the previous described problem which happens only
with AR9xxx

> [12891.19] net_ratelimit: 23 callbacks suppressed
> [12896.20] net_ratelimit: 4608 callbacks suppressed
> [46741.06] net_ratelimit: 3 callbacks suppressed

It seems to be iptables related. When adding to  /etc/sysctl.conf the
following:

net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.tcp_synack_retries = 3

The router does not freeze anymore.
Some research:
http://www.evanjones.ca/tcp-stuck-connection-mystery.html
http://zszsit.blogspot.ca/2012/10/ratelimit-callbacks-suppressed.html
http://www.gargoyle-router.com/phpbb/viewtopic.php?f=3&t=3203&start=20#p14512

On 11/07/2013 10:44 PM, cmsv wrote:
> AA DISTRIB_REVISION="r38621"
> 
> In the past few days i may have stumble on a possible kernel bug that
> has effect on AR9xxx
> 
> From all routers that i have been using to test the compiled images
> only 3 fully works apparently without  problems while the others end
> up by freezing after some time. The difference between the working ones
> and the malfunctioning ones is the chip.
> 
> Routers affected :
> DIR-615-C1 (Atheros AR9130) and TL-WR841N 8.3 (AR9341 SoC)
> 
> Router NOT affected:
> Dir 601 A1 (Atheros AR7240 rev 2)
> Dir 615 E1 ((Atheros AR7240)
> Dir 615 E3 ((Atheros AR7240)
> Tp-link tl wr703
> 
> The only errors i can obtain from any logs before i completely lose
> serial console access and the router freezes are:
> 
>  395.83] SysRq : HELP : loglevel(0-9) reBoot Crash
> terminate-all-tasks(E) memory-full-oom-kill(F) kill-all-tasks(I)
> thaw-filesystems(J) show-memory-usage(M) nice-all-RT-tasks(N) powerOff
> show-registers(P) show-all-timers(Q) Sync show-task-states(T) Unmount
> show-blocked-tasks(W)
> [  395.86] SysRq : Show Regs
> [  395.86] Cpu 0
> [  395.86] $ 0   :  8032 80063340 802c8000
> [  395.86] $ 4   :   1000f400 00fe
> [  395.86] $ 8   :  f400  81ab
> [  395.86] $12   : 80e3a1e4 0001 0001 0047
> [  395.86] $16   : 8032 8032 8031 80311ca1
> [  395.86] $20   : 802d  81ff 
> [  395.86] $24   : 004764b8 80095220
> [  395.86] $28   : 802c8000 802c9ed0 81ff 80064ba8
> [  395.86] Hi: 005c
> [  395.86] Lo: 2b183d00
> [  395.86] epc   : 80063360 0x80063360
> [  395.86] Tainted: G   O
> [  395.86] ra: 80064ba8 0x80064ba8
> [  395.86] Status: 1000f403KERNEL EXL IE
> [  395.86] Cause : 00804000
> [  395.86] PrId  : 00019374 (MIPS 24Kc)
> [  396.08] SysRq : HELP : loglevel(0-9) reBoot Crash
> terminate-all-tasks(E) memory-full-oom-kill(F) kill-all-tasks(I)
> thaw-filesystems(J) show-memory-usage(M) nice-all-RT-tasks(N) powerOff
> show-registers(P) show-all-timers(Q) Sync show-task-states(T) Unmount
> show-blocked-tasks(W)

DISTRIB_REVISION="r38863" which applied
target/linux/generic/patches-3.3/890-8250_optional_sysrq.patch seems to
resolve this issue.
> 
> Related links:
> https://bugzilla.kernel.org/show_bug.cgi?id=47741
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/984273
> 
> Just like this one:
> https://forums.gentoo.org/viewtopic-t-801565-view-previous.html?sid=cf2b78f9e57bf60c9e80057332a367ad
> 
> Also get these:
> 
> [12891.19] net_ratelimit: 23 callbacks suppressed
> [12896.20] net_ratelimit: 4608 callbacks suppressed
> [46741.06] net_ratelimit: 3 callbacks suppressed
> 
> 
> I am willing to test patches and or fixes for this issue if anyone has
> any feedback regarding this problem.
> I was not able to find much helpful information about it.
> I would also like to know if anyone else is using the same AA revision
> (or close) with the same atheros chip and gets the same problem.
> 
> 
> 




signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [OpenWrt-Users] Problem of connectivity with adhoc using wpa

2013-11-19 Thread cmsv
Hello Felix

(reply inline)

On 11/18/2013 07:15 PM, Felix Fietkau wrote:
> On 2013-11-20 00:49, cmsv wrote:
>> I have not seen this issue but i have another issue in hands which
>> forces me to cold reboot some routers.
>> It is described here:
>> http://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg20575.html
>>
>> The causes the ath9k 9 router to freeze but i do believe that it is
>> related to tcp traffic and iptables since i have found a work around to
>> prevent the router to freeze. I will post later my conclusions regarding
>> this issue.
>>
>>
>> I also noticed another very strange occurrence related to the freezes.
>>
>> # ls
>> %
>> 77000
>> 770?H?H?H?H?H?H?H?H?H?H?H?H$
>> 9?}
>> Enter
>> Z^B{[2]+:
>> bin
>> dev
>> etc
>> lib
>> mnt
>> overlay
>> proc
>> rom
>> root
>> r?[J??[J[12Du
>> r?[J??[J?
>> sbin
>> sys
>> tmp
>> usr
>> var
>> www
>> ?^@^@^@^@^@^A[
>> ?^@^@^??1000]
>> ?
>> ?
>> ?0?s
>> ?&L?00] ?[
>> ?&L?00] ?[ ` 1w>s>?
>> ???z
>> ?}i???~??kX??^@^@~@^B^@^H!B?^H^H
>> ?j?j?j?j?j??i??%R?
>>
>> I have not found out why i get these files in /
>> Al this only happens with AR9***
> I'm pretty sure your serial console is picking up garbage input. The
> freezes themselves are probably caused by the sysrq magic sequence
> appearing in that garbage. A while back I've committed a patch to trunk
> that makes it stop processing the sysrq sequence from the serial port. I
> have now backported this to AA in r38863. 

I updated  to DISTRIB_REVISION="r38863" which applied
target/linux/generic/patches-3.3/890-8250_optional_sysrq.patch and the
the freezes only apply now to serial connection which after  afew hours
i have to reboot the router if i want to connect through serial. (i use
a usb to serial converter).

The network keeps working and so far i see no issues. I have tested with
AR9xxx and AR7xxx.
Although this patch seemed to solve the network freeze problem i still get:

[  169.77] net_ratelimit: 4598 callbacks suppressed
[ 1864.61] net_ratelimit: 6 callbacks suppressed
[ 1869.62] net_ratelimit: 4639 callbacks suppressed
[39448.09] net_ratelimit: 4997 callbacks suppressed
[41383.60] net_ratelimit: 16 callbacks suppressed

Adding the following to /etc/sysctl.conf

net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.tcp_synack_retries = 3

eliminates "net_ratelimit callbacks suppressed" messages and it when do
bandwidth tests with iperf; i seem to get better results with 5mbit more.

> Please test if this resolves
> your freezes (although you will probably still get garbage files in /).
As for "garbage files" and serial support the only options i have
selected when make kernel_config are:
<*> 8250/16550 and compatible serial support
[*]   Console on 8250/16550 and compatible serial port
[*] AR933X serial port support
[*]   Console on AR933X serial port

$ cat .config| grep serial
# CONFIG_PACKAGE_kmod-serial-8250 is not set
# CONFIG_PACKAGE_kmod-usb-serial is not set
# CONFIG_PACKAGE_boost-serialization is not set
# CONFIG_PACKAGE_serialoverip is not set
# CONFIG_PACKAGE_setserial is not set
# CONFIG_PACKAGE_mbus-serial is not set
# CONFIG_PACKAGE_pyserial is not set


Even tho i did not remove this from building the image; i also did not
get garbage files so far as before. It does seem that the patch also
took care of it.


> If you want to make sure that this doesn't happen, build an image with
> serial console support disabled - I don't think this is a software bug.

I will update my other report regarding my bug conclusions later on.
> 
> - Felix
> 
@ Ben
with this revision and patch i get a lot of IBSS-RSN splits and more
frequent.




signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH, v2] lantiq: fix etop registers

2013-11-19 Thread John Crispin

On 14/11/13 08:59, Matti Laakso wrote:

At the moment the MII/RMII setting in the lantiq .dts-files has no
effect, since wrong registers are written. Once this patch is applied,
it is necessary to make sure that the MII/RMII setting in the .dts-file
is correct.


i have not merged this yet. i am wondering if we should rename th 
property in all relevant dts files and print a warning during boot if 
the real option is not set that way there is a migration path that 
wont break lots of boards for people

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


[OpenWrt-Devel] Postfix on OpenWRT

2013-11-19 Thread Denis Shulyaka
Hi all,

In case anyone is interested, I've packaged Postfix for OpenWRT (see
attached, if the list won't remove it).

Currently builds for Trunk (Barrier Breaker r38823). Requires ~8.5M of free
disk space (or ~2.5M compressed). RAM usage about 3M, CPU usage about zero.

Works well on my DIR-825 with extroot, which proves it is possible to have
a full-featured MTA on your home router. Especially useful if you are
paranoid about NSA watching you ;).

Some measurements:

root@shulyaka:~# postfix status
postfix/postfix-script: the Postfix mail system is not running
root@shulyaka:~# free
 total used free   shared  buffers
Mem: 6154854148 74000 2176
-/+ buffers:  51972 9576
Swap:000
root@shulyaka:~# postfix start
postfix/postfix-script: starting the Postfix mail system

[Now I sent a message to myself]

root@shulyaka:~# postfix status
postfix/postfix-script: the Postfix mail system is running: PID: 23665
root@shulyaka:~# free
 total used free   shared  buffers
Mem: 6154857700 38480 2280
-/+ buffers:  55420 6128
Swap:000
root@shulyaka:~# top
Load average: 0.00 0.03 0.07 1/44 23684
  PID  PPID USER STAT   VSZ %VSZ %CPU COMMAND
 1014 1 root S 2060   3%   0% /usr/sbin/uhttpd -f -h /www -r
shulya
 1682 1 root S 1672   3%   0% hostapd -P /var/run/wifi-phy0.pid
-B
 1135 1 root S 1648   3%   0% {dynamic_dns_upd} /bin/sh
/usr/lib/dd
19577 19576 root S 1508   2%   0% -ash
  839 1 root S 1492   2%   0% /sbin/netifd
23684 19577 root R 1492   2%   0% top
23586  1135 root S 1484   2%   0% sleep 600
23667 23665 postfix  S 1372   2%   0% qmgr -l -t unix -u
  826 1 root S 1356   2%   0% /sbin/logd
1 0 root S 1344   2%   0% /sbin/procd
23666 23665 postfix  S 1276   2%   0% pickup -l -t unix -u
23678 23665 postfix  S 1272   2%   0% anvil -l -t unix -u
19576   944 root S 1228   2%   0% /usr/sbin/dropbear -F -P
/var/run/dro
23665 1 root S 1224   2%   0% /usr/libexec/postfix/master -w
  944 1 root S 1160   2%   0% /usr/sbin/dropbear -F -P
/var/run/dro
 1042 1 root S 1100   2%   0% /usr/sbin/ntpclient -i 600 -s -l
-D -
 1808 1 nobody   S 1008   2%   0% /usr/sbin/dnsmasq -C
/var/etc/dnsmasq
  561 1 root S  908   1%   0% /sbin/ubusd
 1101 1 root S  820   1%   0% /usr/sbin/6relayd
-l/tmp/hosts/6relay
  562 1 root S  768   1%   0% /sbin/askfirst ttyS0 /bin/ash
--login
root@shulyaka:~# cat /etc/banner
  ___ __
 |   |.-.-.-.|  |  |  |..|  |_
 |   -   ||  _  |  -__| ||  |  |  ||   _||   _|
 |___||   __|_|__|__||||__|  ||
  |__| W I R E L E S S   F R E E D O M
 -
 BARRIER BREAKER (Bleeding Edge, r38823)
 -
  * 1/2 oz Galliano Pour all ingredients into
  * 4 oz cold Coffeean irish coffee mug filled
  * 1 1/2 oz Dark Rum   with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
 -
root@shulyaka:~# uname -r
3.10.18

BTW I have also packaged Mailman, so please advise if anyone is interested.
However its disk requirements are much bigger (~38M, but ~26M of which are
the localization files, so I believe it can be dramatically reduced in the
future).

Best regards,
Denis Shulyaka


postfix.tar.gz
Description: GNU Zip compressed data
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] To get wifi work on mt7260n with rt2860v2_ap driver 2715.

2013-11-19 Thread John Crispin

On 19/11/13 17:44, mtk mtk wrote:

I just got this driver from almighty Google.Maybe it can help solving no
wifi on mt7620 boards.
https://app.box.com/s/letycub363oryirw1vd5


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


Hi,

please do not post links to material covered by an NDA on the mailing list.

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


[OpenWrt-Devel] To get wifi work on mt7260n with rt2860v2_ap driver 2715.

2013-11-19 Thread mtk mtk
I just got this driver from almighty Google.Maybe it can help solving no wifi 
on mt7620 boards.

https://app.box.com/s/letycub363oryirw1vd5
___
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 process respawning forever

2013-11-19 Thread John Crispin

On 15/11/13 16:11, Helmut Schaa wrote:

Use respawn_retry==0 as indication to respawn a process forever.

Signed-off-by: Helmut Schaa
---
  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;



Hi Helmut,

i just pushed this fix. I also pushed  a fix for the running trigger bug 
you reported.


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


Re: [OpenWrt-Devel] [OpenWrt-Users] Problem of connectivity with adhoc using wpa

2013-11-19 Thread Ben West
Sorry for not including this explicitly.  My setup:

For all interfaces involved: option encryption 'psk2'
wpad - 20130807-1
DISTRIB_REVISION="r38347"
DISTRIB_CODENAME="attitude_adjustment"
DISTRIB_TARGET="ar71xx/generic"

Again, I've compiled in the mac80211 and hostapd packages Felix provided
here:
http://nbd.name/gitweb.cgi?p=aa-mac80211.git;a=summary

I don't see any significant-looking updates made to hostapd in trunk since
last month, but I can update my firmware images to the AA r38863 revision
that Felix mentions.

For the instance where wpa_supplicant crashed on one of my nodes, killing
its IBSS-RSN interface, here are the log entries retrieved from the crash
file:

LOAD:77EF1000 0FFA C WPA: Key negotiation completed with
06:02:6f:76:13:5d [PTK=CCMP GTK=CCMP]
wlan0-2: WPA: Key negotiation completed with 06:02:6f:76:13:5d [PTK=CCMP
GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:6f:76:13:5d [GTK=CCMP]
wlan0-2: WPA: Group rekeying completed with 06:02:
LOAD:77EF2010 0021 C Resource temporarily unavailable

This was on a node in a 2-node mesh, and those log entries show the
crashing node renegotiating keys with its neighboring node.  Of interest is
that wpa_supplicant / wpad may have been renegotiating keys repeatedly
before crashing.  Not sure if this is normal for IBSS-RSN, or if it
suggests wpa_supplicat was stuck in a loop.



On Tue, Nov 19, 2013 at 5:49 PM, cmsv  wrote:

> Hello Ben
> Right now i am using:
>
> AA r38621
> wpad - 20130807-1
> horst - git-1http://nbd.name/gitweb.cgi?p=aa-mac80211.git;a=summary from
> http://nbd.name/gitweb.cgi?p=aa-mac80211.git;a=summary which replaced
> all files from AA mac80211 and hostapd directories.
>
> On 11/18/2013 12:56 PM, Ben West wrote:
> > Hi cmsv,
> >
> > Are still having problems with the recurring "IBSS split detected" issue?
>
> Not at the moment. Horst is not detecting IBSS splits and i have ran
> several iperf tests in order to abuse all the avalable bandwidth between
> routers. I am however still running tests.
>
> > I'm operating a couple dozen UBNT Nanostation Loco M2 units as nodes in
> > several WPA2-encrypted adhoc meshes (with each node additionally
> > broadcasting a public AP and private WPA2 AP as virtual interfaces, for
> > 3 VIFs total).  Meshes range from 2 to 4 nodes each.
>
> I am using tp-link and d-link routers all atheros.
> Only adhoc is encrypted with wpa2 (pks2)
> 2 to 4 routers.
>
> >
> > I'm not seeing the IBSS split problem you describe, although I am having
> > issues with wpad crashing sporadically, either taking out the node's
> > IBSS-RSN interface or its private AP, either way requiring reboot to
> > recover.  That is, in my instances where a node drops off a mesh, it is
> > because that node's wpa_supplicant process crashed, killing its adhoc
> VIF.
> I have not seen this issue but i have another issue in hands which
> forces me to cold reboot some routers.
> It is described here:
> http://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg20575.html
>
> The causes the ath9k 9 router to freeze but i do believe that it is
> related to tcp traffic and iptables since i have found a work around to
> prevent the router to freeze. I will post later my conclusions regarding
> this issue.
>
>
> I also noticed another very strange occurrence related to the freezes.
>
> # ls
> %
> 77000
> 770?H?H?H?H?H?H?H?H?H?H?H?H$
> 9?}
> Enter
> Z^B{[2]+:
> bin
> dev
> etc
> lib
> mnt
> overlay
> proc
> rom
> root
> r?[J??[J[12Du
> r?[J??[J?
> sbin
> sys
> tmp
> usr
> var
> www
> ?^@^@^@^@^@^A[
> ?^@^@^??1000]
> ?
> ?
> ?0?s
> ?&L?00] ?[
> ?&L?00] ?[ ` 1w>s>?
> ???z
> ?}i???~??kX??^@^@~@^B^@^H!B?^H^H
> ?j?j?j?j?j??i??%R?
>
> I have not found out why i get these files in /
> Al this only happens with AR9***
>
> > You might look for crash files files from wpa_supplicant or hostapd in
> > /tmp on problems nodes.  The two crash files I've recovered thus far
> > seem to suggest a buffer overflow in wpad, although I do not know if
> > that actually triggered by other processes consuming all available RAM,
> > or something in wpad itself.
>
> What wpad release are you using ?
> >
> > My nodes are running AA r38347, patche

Re: [OpenWrt-Devel] [PATCH v2] gianfar: Fix NAPI poll mechanism in GIANFAR ethernet driver

2013-11-19 Thread Martijn Zilverschoon
This patch would be a great addition, and works wonderfully :) I have
it running for some time now from when I found it in the thread
https://forum.openwrt.org/viewtopic.php?id=42062&p=15
Tested-by: Martijn Zilverschoon 

2013/11/19 Thomas Huehn :
> This patch fixes the NAPI poll mechanism in the GIANFAR ethernet driver, which
> was not properly working since Linus Kernel Version 3,8.
> Therefore the workaround patch to downgrade the GIANFAR ethernet driver to
> Kernelversion v3.8 is obsoete.
> This patch was extensivly testes with different network loads and types of
> traffic. There is quite a substantial user base that reports proper Ethernet
> function with TPlink-4900. This patch is based on the fixes from GINAFAR
> maintainer Claudiu Manoli.
> ---
> v2: add the deletion of the former workaround 
> 200-gianfar_napi_poll_revert.patch
>
> Signed-off-by: Thomas Huehn 
> ---
>  .../200-gianfar_napi_poll_revert.patch |  162 
> 
>  .../patches-3.10/201-fix_gianfar_napi_poll.patch   |  111 ++
>  2 files changed, 111 insertions(+), 162 deletions(-)
>  delete mode 100644 
> target/linux/mpc85xx/patches-3.10/200-gianfar_napi_poll_revert.patch
>  create mode 100644 
> target/linux/mpc85xx/patches-3.10/201-fix_gianfar_napi_poll.patch
>
> diff --git 
> a/target/linux/mpc85xx/patches-3.10/200-gianfar_napi_poll_revert.patch 
> b/target/linux/mpc85xx/patches-3.10/200-gianfar_napi_poll_revert.patch
> deleted file mode 100644
> index 7b0e6c9..000
> --- a/target/linux/mpc85xx/patches-3.10/200-gianfar_napi_poll_revert.patch
> +++ /dev/null
> @@ -1,162 +0,0 @@
>  a/drivers/net/ethernet/freescale/gianfar.c
> -+++ b/drivers/net/ethernet/freescale/gianfar.c
> -@@ -132,7 +132,7 @@ static int gfar_poll(struct napi_struct
> - static void gfar_netpoll(struct net_device *dev);
> - #endif
> - int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit);
> --static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue);
> -+static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue);
> - static void gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
> -  int amount_pull, struct napi_struct *napi);
> - void gfar_halt(struct net_device *dev);
> -@@ -2475,7 +2475,7 @@ static void gfar_align_skb(struct sk_buf
> - }
> -
> - /* Interrupt Handler for Transmit complete */
> --static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
> -+static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
> - {
> -   struct net_device *dev = tx_queue->dev;
> -   struct netdev_queue *txq;
> -@@ -2575,6 +2575,8 @@ static void gfar_clean_tx_ring(struct gf
> -   tx_queue->dirty_tx = bdp;
> -
> -   netdev_tx_completed_queue(txq, howmany, bytes_sent);
> -+
> -+  return howmany;
> - }
> -
> - static void gfar_schedule_cleanup(struct gfar_priv_grp *gfargrp)
> -@@ -2833,82 +2835,62 @@ static int gfar_poll(struct napi_struct
> -   struct gfar __iomem *regs = gfargrp->regs;
> -   struct gfar_priv_tx_q *tx_queue = NULL;
> -   struct gfar_priv_rx_q *rx_queue = NULL;
> --  int work_done = 0, work_done_per_q = 0;
> --  int i, budget_per_q = 0;
> --  int has_tx_work;
> --  unsigned long rstat_rxf;
> --  int num_act_queues;
> -+  int rx_cleaned = 0, budget_per_queue = 0, rx_cleaned_per_queue = 0;
> -+  int tx_cleaned = 0, i, left_over_budget = budget;
> -+  unsigned long serviced_queues = 0;
> -+  int num_queues = 0;
> -+
> -+  num_queues = gfargrp->num_rx_queues;
> -+  budget_per_queue = budget/num_queues;
> -
> -   /* Clear IEVENT, so interrupts aren't called again
> -* because of the packets that have already arrived
> -*/
> -   gfar_write(®s->ievent, IEVENT_RTX_MASK);
> -
> --  rstat_rxf = gfar_read(®s->rstat) & RSTAT_RXF_MASK;
> --
> --  num_act_queues = bitmap_weight(&rstat_rxf, MAX_RX_QS);
> --  if (num_act_queues)
> --  budget_per_q = budget/num_act_queues;
> --
> --  while (1) {
> --  has_tx_work = 0;
> --  for_each_set_bit(i, &gfargrp->tx_bit_map, 
> priv->num_tx_queues) {
> --  tx_queue = priv->tx_queue[i];
> --  /* run Tx cleanup to completion */
> --  if (tx_queue->tx_skbuff[tx_queue->skb_dirtytx]) {
> --  gfar_clean_tx_ring(tx_queue);
> --  has_tx_work = 1;
> --  }
> --  }
> -+  while (num_queues && left_over_budget) {
> -+  budget_per_queue = left_over_budget/num_queues;
> -+  left_over_budget = 0;
> -
> -   for_each_set_bit(i, &gfargrp->rx_bit_map, 
> priv->num_rx_queues) {
> --  /* skip queue if not active */
> --  if (!(rstat_rxf & (RSTAT_CLEAR_RXF0 >> i)))
> -+  if (test_bit(i, &serviced_queues))
> -   contin

Re: [OpenWrt-Devel] [PATCH 0/2]netifd: Check routing table parameter when updating route

2013-11-19 Thread Felix Fietkau
On 2013-11-19 12:29, Hans Dedecker wrote:
> Hi Felix,
> 
> I just resubmitted the patches as smaller ones. Functional wise patch 7
> and patch8 belong together; but to make the code review easier I
> splitted it up in link layer state awareness on device level (patch 7)
> and interface level (patch8).
Thanks. At a first glance it looks much better now. I will review the
patches in detail soon.

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


Re: [OpenWrt-Devel] [PATCH v2] gianfar: Fix NAPI poll mechanism in GIANFAR ethernet driver

2013-11-19 Thread Felix Fietkau
On 2013-11-19 13:53, Thomas Huehn wrote:
> This patch fixes the NAPI poll mechanism in the GIANFAR ethernet driver, which
> was not properly working since Linus Kernel Version 3,8.
> Therefore the workaround patch to downgrade the GIANFAR ethernet driver to
> Kernelversion v3.8 is obsoete.
> This patch was extensivly testes with different network loads and types of
> traffic. There is quite a substantial user base that reports proper Ethernet
> function with TPlink-4900. This patch is based on the fixes from GINAFAR
> maintainer Claudiu Manoli.
Patch committed (and properly refreshed and renamed) in r38865

Thanks,

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


[OpenWrt-Devel] [PATCH v2] gianfar: Fix NAPI poll mechanism in GIANFAR ethernet driver

2013-11-19 Thread Thomas Huehn
This patch fixes the NAPI poll mechanism in the GIANFAR ethernet driver, which
was not properly working since Linus Kernel Version 3,8.
Therefore the workaround patch to downgrade the GIANFAR ethernet driver to
Kernelversion v3.8 is obsoete.
This patch was extensivly testes with different network loads and types of
traffic. There is quite a substantial user base that reports proper Ethernet
function with TPlink-4900. This patch is based on the fixes from GINAFAR
maintainer Claudiu Manoli.
---
v2: add the deletion of the former workaround 200-gianfar_napi_poll_revert.patch

Signed-off-by: Thomas Huehn 
---
 .../200-gianfar_napi_poll_revert.patch |  162 
 .../patches-3.10/201-fix_gianfar_napi_poll.patch   |  111 ++
 2 files changed, 111 insertions(+), 162 deletions(-)
 delete mode 100644 
target/linux/mpc85xx/patches-3.10/200-gianfar_napi_poll_revert.patch
 create mode 100644 
target/linux/mpc85xx/patches-3.10/201-fix_gianfar_napi_poll.patch

diff --git 
a/target/linux/mpc85xx/patches-3.10/200-gianfar_napi_poll_revert.patch 
b/target/linux/mpc85xx/patches-3.10/200-gianfar_napi_poll_revert.patch
deleted file mode 100644
index 7b0e6c9..000
--- a/target/linux/mpc85xx/patches-3.10/200-gianfar_napi_poll_revert.patch
+++ /dev/null
@@ -1,162 +0,0 @@
 a/drivers/net/ethernet/freescale/gianfar.c
-+++ b/drivers/net/ethernet/freescale/gianfar.c
-@@ -132,7 +132,7 @@ static int gfar_poll(struct napi_struct
- static void gfar_netpoll(struct net_device *dev);
- #endif
- int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit);
--static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue);
-+static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue);
- static void gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
-  int amount_pull, struct napi_struct *napi);
- void gfar_halt(struct net_device *dev);
-@@ -2475,7 +2475,7 @@ static void gfar_align_skb(struct sk_buf
- }
- 
- /* Interrupt Handler for Transmit complete */
--static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
-+static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
- {
-   struct net_device *dev = tx_queue->dev;
-   struct netdev_queue *txq;
-@@ -2575,6 +2575,8 @@ static void gfar_clean_tx_ring(struct gf
-   tx_queue->dirty_tx = bdp;
- 
-   netdev_tx_completed_queue(txq, howmany, bytes_sent);
-+
-+  return howmany;
- }
- 
- static void gfar_schedule_cleanup(struct gfar_priv_grp *gfargrp)
-@@ -2833,82 +2835,62 @@ static int gfar_poll(struct napi_struct
-   struct gfar __iomem *regs = gfargrp->regs;
-   struct gfar_priv_tx_q *tx_queue = NULL;
-   struct gfar_priv_rx_q *rx_queue = NULL;
--  int work_done = 0, work_done_per_q = 0;
--  int i, budget_per_q = 0;
--  int has_tx_work;
--  unsigned long rstat_rxf;
--  int num_act_queues;
-+  int rx_cleaned = 0, budget_per_queue = 0, rx_cleaned_per_queue = 0;
-+  int tx_cleaned = 0, i, left_over_budget = budget;
-+  unsigned long serviced_queues = 0;
-+  int num_queues = 0;
-+
-+  num_queues = gfargrp->num_rx_queues;
-+  budget_per_queue = budget/num_queues;
- 
-   /* Clear IEVENT, so interrupts aren't called again
-* because of the packets that have already arrived
-*/
-   gfar_write(®s->ievent, IEVENT_RTX_MASK);
- 
--  rstat_rxf = gfar_read(®s->rstat) & RSTAT_RXF_MASK;
--
--  num_act_queues = bitmap_weight(&rstat_rxf, MAX_RX_QS);
--  if (num_act_queues)
--  budget_per_q = budget/num_act_queues;
--
--  while (1) {
--  has_tx_work = 0;
--  for_each_set_bit(i, &gfargrp->tx_bit_map, priv->num_tx_queues) {
--  tx_queue = priv->tx_queue[i];
--  /* run Tx cleanup to completion */
--  if (tx_queue->tx_skbuff[tx_queue->skb_dirtytx]) {
--  gfar_clean_tx_ring(tx_queue);
--  has_tx_work = 1;
--  }
--  }
-+  while (num_queues && left_over_budget) {
-+  budget_per_queue = left_over_budget/num_queues;
-+  left_over_budget = 0;
- 
-   for_each_set_bit(i, &gfargrp->rx_bit_map, priv->num_rx_queues) {
--  /* skip queue if not active */
--  if (!(rstat_rxf & (RSTAT_CLEAR_RXF0 >> i)))
-+  if (test_bit(i, &serviced_queues))
-   continue;
--
-   rx_queue = priv->rx_queue[i];
--  work_done_per_q =
--  gfar_clean_rx_ring(rx_queue, budget_per_q);
--  work_done += work_done_per_q;
--
--  /* finished processing this queue */
--  if (work_done_per_q < budget_per_q) {
--  /* clear active queue hw indication */
--  

Re: [OpenWrt-Devel] [PATCH 2/2] ar71xx: Use KEY_RESTART key code for the reset button on WD My Net N600 boards

2013-11-19 Thread Christian Lamparter
On Monday, November 11, 2013 09:14:23 AM Gabor Juhos wrote:
> 2013.11.08. 22:21 keltezéssel, Christian Lamparter írta:
> > Signed-off-by: Christian Lamparter 
> 
> Applied.

Thanks.

On a related note: Are there any news about [PATCH 1/2]? Or should this
topic be discussed in the ticked ?

Regards

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


Re: [OpenWrt-Devel] [PATCH 0/2]netifd: Check routing table parameter when updating route

2013-11-19 Thread Hans Dedecker
Hi Felix,

I just resubmitted the patches as smaller ones. Functional wise patch 7 and
patch8 belong together; but to make the code review easier I splitted it up
in link layer state awareness on device level (patch 7) and interface level
(patch8).

Bye,
Hans

On Fri, Nov 15, 2013 at 3:07 PM, Felix Fietkau  wrote:

> On 2013-11-14 17:13, Hans Dedecker wrote:
> > The route table parameter needs to be checked in
> interface_update_proto_route; a route which has
> > an identical nexthop but a different routing table needs to be deleted
> and added in the correct
> > routing table.
> > While dumping the route list via ubus; don't display the default route
> when no default route is enabled.
> > Additonal make the ip4table and ip6table parameters visible when
> displaying the interface status.
> >
> > Signed-off-by: Hans Dedecker 
> Please split your patches into smaller ones to separate unrelated
> changes. This will make review much easier.
>
> Thanks,
>
> - Felix
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 7/8]netifd: Link layer state support on device level

2013-11-19 Thread Hans Dedecker
Patch implements link layer state awareness (aka carrier detection) in
netifd on device level.

Signed-off-by: Hans Dedecker 
---
 alias.c|   16 ++--
 device.c   |   29 +-
 device.h   |4 ++
 macvlan.c  |6 +++
 system-linux.c |  117 ++--
 vlan.c |   13 +-
 6 files changed, 155 insertions(+), 30 deletions(-)

diff --git a/alias.c b/alias.c
index 4e0a6be..cef125f 100644
--- a/alias.c
+++ b/alias.c
@@ -51,7 +51,7 @@ static void alias_set_device(struct alias_device *alias, 
struct device *dev)
device_remove_user(&alias->dep);
alias->dev.hidden = !dev;
if (dev) {
-   alias->dev.ifindex = dev->ifindex;
+   device_set_ifindex(&alias->dev, dev->ifindex);
strcpy(alias->dev.ifname, dev->ifname);
device_broadcast_event(&alias->dev, DEV_EVENT_UPDATE_IFNAME);
device_add_user(&alias->dep, dev);
@@ -83,14 +83,22 @@ alias_device_set_state(struct device *dev, bool state)
 static void alias_device_cb(struct device_user *dep, enum device_event ev)
 {
struct alias_device *alias;
-   bool present = false;
+   bool new_state = false;
 
alias = container_of(dep, struct alias_device, dep);
switch (ev) {
case DEV_EVENT_ADD:
-   present = true;
+   new_state = true;
case DEV_EVENT_REMOVE:
-   device_set_present(&alias->dev, present);
+   device_set_present(&alias->dev, new_state);
+   break;
+   case DEV_EVENT_LINK_UP:
+   new_state = true;
+   case DEV_EVENT_LINK_DOWN:
+   device_set_link(&alias->dev, new_state);
+   break;
+   case DEV_EVENT_UPDATE_IFINDEX:
+   device_set_ifindex(&alias->dev, dep->dev->ifindex);
break;
default:
device_broadcast_event(&alias->dev, ev);
diff --git a/device.c b/device.c
index 56fc3f7..f8834f0 100644
--- a/device.c
+++ b/device.c
@@ -207,7 +207,7 @@ int device_claim(struct device_user *dep)
return 0;
 
dep->claimed = true;
-   D(DEVICE, "Claim %s %s, new refcount: %d\n", dev->type->name, 
dev->ifname, dev->active + 1);
+   D(DEVICE, "Claim %s %s, new active count: %d\n", dev->type->name, 
dev->ifname, dev->active + 1);
if (++dev->active != 1)
return 0;
 
@@ -233,7 +233,7 @@ void device_release(struct device_user *dep)
 
dep->claimed = false;
dev->active--;
-   D(DEVICE, "Release %s %s, new refcount: %d\n", dev->type->name, 
dev->ifname, dev->active);
+   D(DEVICE, "Release %s %s, new active count: %d\n", dev->type->name, 
dev->ifname, dev->active);
assert(dev->active >= 0);
 
if (dev->active)
@@ -390,6 +390,26 @@ void device_set_present(struct device *dev, bool state)
device_refresh_present(dev);
 }
 
+void device_set_link(struct device *dev, bool state)
+{
+   if (dev->link_active == state)
+   return;
+
+   netifd_log_message(L_NOTICE, "%s '%s' link is %s\n", dev->type->name, 
dev->ifname, state ? "up" : "down" );
+
+   dev->link_active = state;
+   device_broadcast_event(dev, state ? DEV_EVENT_LINK_UP : 
DEV_EVENT_LINK_DOWN);
+}
+
+void device_set_ifindex(struct device *dev, int ifindex)
+{
+   if (dev->ifindex == ifindex)
+   return;
+
+   dev->ifindex = ifindex;
+   device_broadcast_event(dev, DEV_EVENT_UPDATE_IFINDEX);
+}
+
 static int device_refcount(struct device *dev)
 {
struct list_head *list;
@@ -431,6 +451,9 @@ void device_add_user(struct device_user *dep, struct device 
*dev)
dep->cb(dep, DEV_EVENT_ADD);
if (dev->active)
dep->cb(dep, DEV_EVENT_UP);
+
+   if (dev->link_active)
+   dep->cb(dep, DEV_EVENT_LINK_UP);
}
 }
 
@@ -663,6 +686,8 @@ device_dump_status(struct blob_buf *b, struct device *dev)
return;
 
blobmsg_add_u8(b, "up", !!dev->active);
+   blobmsg_add_u8(b, "carrier", !!dev->link_active);
+
if (dev->type->dump_info)
dev->type->dump_info(dev, b);
else
diff --git a/device.h b/device.h
index d63ffe3..dd57927 100644
--- a/device.h
+++ b/device.h
@@ -68,6 +68,7 @@ enum device_event {
DEV_EVENT_REMOVE,
 
DEV_EVENT_UPDATE_IFNAME,
+   DEV_EVENT_UPDATE_IFINDEX,
 
DEV_EVENT_SETUP,
DEV_EVENT_TEARDOWN,
@@ -122,6 +123,7 @@ struct device {
bool sys_present;
bool present;
int active;
+   bool link_active;
 
bool external;
bool disabled;
@@ -178,6 +180,8 @@ void device_remove_user(struct device_user *dep);
 void device_broadcast_event(struct device *dev, enum device_event ev);
 
 void device_set_present(struct device *dev, bool state);
+void device_set_link(struct device *dev, bool state);
+void de

[OpenWrt-Devel] [PATCH 8/8]netifd: Link layer state support on interface level

2013-11-19 Thread Hans Dedecker
Patch implements handling of link layer support on interface level.
An interface will go into the setup state when it's enabled and the
underlying link state is enabled. Vice versa an interface will go to
the down state when it's either disabled or underlying link state is
disabled.
Testing has been done with PPP, IPoE, tunnel and static interfaces

Signed-off-by: Hans Dedecker 
---
 interface.c   |  130 +++-
 interface.h   |2 +
 proto-shell.c |1 +
 3 files changed, 103 insertions(+), 30 deletions(-)

diff --git a/interface.c b/interface.c
index 9c208a2..4b381a4 100644
--- a/interface.c
+++ b/interface.c
@@ -200,6 +200,9 @@ mark_interface_down(struct interface *iface)
 {
enum interface_state state = iface->state;
 
+   if (state == IFS_DOWN)
+   return;
+
iface->state = IFS_DOWN;
if (state == IFS_UP)
interface_event(iface, IFEV_DOWN);
@@ -212,42 +215,112 @@ mark_interface_down(struct interface *iface)
 void
 __interface_set_down(struct interface *iface, bool force)
 {
-   if (iface->state == IFS_DOWN ||
-   iface->state == IFS_TEARDOWN)
+   switch (iface->state) {
+   case IFS_UP:
+   interface_event(iface, IFEV_DOWN);
+   case IFS_SETUP:
+   iface->state = IFS_TEARDOWN;
+   interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, force);
+   if (force)
+   interface_flush_state(iface);
+
+   if (iface->dynamic)
+   vlist_delete(&interfaces, &iface->node);
+   break;
+
+   case IFS_DOWN:
+   if (iface->main_dev.dev)
+   device_release(&iface->main_dev);
+   case IFS_TEARDOWN:
+   default:
+   break;
+   }
+}
+
+static int
+__interface_set_up(struct interface *iface)
+{
+   int ret;
+
+   netifd_log_message(L_NOTICE, "Interface '%s' is setting up now\n", 
iface->name);
+
+   iface->state = IFS_SETUP;
+   ret = interface_proto_event(iface->proto, PROTO_CMD_SETUP, false);
+   if (ret)
+   mark_interface_down(iface);
+
+   return ret;
+}
+
+static void
+interface_check_state(struct interface *iface)
+{
+   switch (iface->state) {
+   case IFS_UP:
+   if (!iface->enabled || !iface->link_state) {
+   mark_interface_down(iface);
+   interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, 
false);
+   }
+   break;
+   case IFS_DOWN:
+   if (iface->enabled && iface->link_state && !config_init)
+   __interface_set_up(iface);
+   break;
+   default:
+   break;
+   }
+}
+
+static void
+interface_set_enabled(struct interface *iface, bool new_state)
+{
+   if (iface->enabled == new_state)
return;
 
-   if (iface->state == IFS_UP)
-   interface_event(iface, IFEV_DOWN);
-   iface->state = IFS_TEARDOWN;
-   interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, force);
-   if (force)
-   interface_flush_state(iface);
+   netifd_log_message(L_NOTICE, "Interface '%s' is %s\n", iface->name, 
new_state ? "enabled" : "disabled");
+   iface->enabled = new_state;
+   interface_check_state(iface);
+}
 
-   if (iface->dynamic)
-   vlist_delete(&interfaces, &iface->node);
+static void
+interface_set_link_state(struct interface *iface, bool new_state)
+{
+   if (iface->link_state == new_state)
+   return;
+
+   netifd_log_message(L_NOTICE, "Interface '%s' has link connectivity 
%s\n", iface->name, new_state ? "" : "loss");
+   iface->link_state = new_state;
+   interface_check_state(iface);
 }
 
 static void
 interface_cb(struct device_user *dep, enum device_event ev)
 {
struct interface *iface;
-   bool new_state;
+   bool new_state = false;
 
iface = container_of(dep, struct interface, main_dev);
switch (ev) {
case DEV_EVENT_ADD:
new_state = true;
-   break;
case DEV_EVENT_REMOVE:
-   new_state = false;
+   interface_set_available(iface, new_state);
+   if (!new_state && dep->dev->external)
+   interface_set_main_dev(iface, NULL);
+   break;
+   case DEV_EVENT_UP:
+   new_state = true;
+   case DEV_EVENT_DOWN:
+   interface_set_enabled(iface, new_state);
+   break;
+   case DEV_EVENT_LINK_UP:
+   new_state = true;
+case DEV_EVENT_LINK_DOWN:
+   interface_set_link_state(iface, new_state);
break;
default:
-   return;
+   break;
}
-
-   interface_set_available(iface, new_state);
-   if (!new_state && dep->dev->external)
-   interfac

[OpenWrt-Devel] [PATCH 6/8]netifd: Code style line/clean up

2013-11-19 Thread Hans Dedecker

Signed-off-by: Hans Dedecker 
---
 device.c|   12 ++--
 device.h|2 +-
 interface.c |2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/device.c b/device.c
index c30650a..56fc3f7 100644
--- a/device.c
+++ b/device.c
@@ -31,12 +31,12 @@
 static struct avl_tree devices;
 
 static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = {
-   [DEV_ATTR_TYPE] = { "type", BLOBMSG_TYPE_STRING },
-   [DEV_ATTR_IFNAME] = { "ifname", BLOBMSG_TYPE_ARRAY },
-   [DEV_ATTR_MTU] = { "mtu", BLOBMSG_TYPE_INT32 },
-   [DEV_ATTR_MACADDR] = { "macaddr", BLOBMSG_TYPE_STRING },
-   [DEV_ATTR_TXQUEUELEN] = { "txqueuelen", BLOBMSG_TYPE_INT32 },
-   [DEV_ATTR_ENABLED] = { "enabled", BLOBMSG_TYPE_BOOL },
+   [DEV_ATTR_TYPE] = { .name = "type", .type = BLOBMSG_TYPE_STRING },
+   [DEV_ATTR_IFNAME] = { .name = "ifname", .type = BLOBMSG_TYPE_ARRAY },
+   [DEV_ATTR_MTU] = { .name = "mtu", .type = BLOBMSG_TYPE_INT32 },
+   [DEV_ATTR_MACADDR] = { .name = "macaddr", .type = BLOBMSG_TYPE_STRING },
+   [DEV_ATTR_TXQUEUELEN] = { .name = "txqueuelen", .type = 
BLOBMSG_TYPE_INT32 },
+   [DEV_ATTR_ENABLED] = { .name = "enabled", .type = BLOBMSG_TYPE_BOOL },
 };
 
 const struct uci_blob_param_list device_attr_list = {
diff --git a/device.h b/device.h
index dbcaf77..d63ffe3 100644
--- a/device.h
+++ b/device.h
@@ -59,7 +59,7 @@ struct device_type {
 enum {
DEV_OPT_MTU = (1 << 0),
DEV_OPT_MACADDR = (1 << 1),
-   DEV_OPT_TXQUEUELEN  = (1 << 2)
+   DEV_OPT_TXQUEUELEN  = (1 << 2),
 };
 
 /* events broadcasted to all users of a device */
diff --git a/interface.c b/interface.c
index 23c7032..9c208a2 100644
--- a/interface.c
+++ b/interface.c
@@ -918,7 +918,7 @@ interface_change_config(struct interface *if_old, struct 
interface *if_new)
 #undef UPDATE
 
if (reload) {
-   D(INTERFACE, "Reload interface '%s because of config changes\n",
+   D(INTERFACE, "Reload interface '%s' because of config 
changes\n",
  if_old->name);
interface_clear_errors(if_old);
set_config_state(if_old, IFC_RELOAD);
-- 
1.7.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/8]netifd: Export ip4table/ip6table via UBUS

2013-11-19 Thread Hans Dedecker
Export ip4table/ip6table parameters via UBUS to facilitate
route inspection and usage by other applications

Signed-off-by: Hans Dedecker 
---
 ubus.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ubus.c b/ubus.c
index 9063680..a20be15 100644
--- a/ubus.c
+++ b/ubus.c
@@ -655,6 +655,10 @@ netifd_dump_status(struct interface *iface)
blobmsg_add_string(&b, "device", dev->ifname);
 
if (iface->state == IFS_UP) {
+   if (iface->ip4table)
+   blobmsg_add_u32(&b, "ip4table", iface->ip4table);
+   if (iface->ip6table)
+   blobmsg_add_u32(&b, "ip6table", iface->ip6table);   
  
blobmsg_add_u32(&b, "metric", iface->metric);
blobmsg_add_u8(&b, "delegation", 
!iface->proto_ip.no_delegation);
a = blobmsg_open_array(&b, "ipv4-address");
-- 
1.7.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/8] Tunnel don't fragment bit configurable

2013-11-19 Thread Hans Dedecker
Make tunnel don't fragment bit configurable via UCI

Signed-off-by: Hans Dedecker 
---
 system-linux.c |   10 ++
 system.c   |1 +
 system.h   |1 +
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/system-linux.c b/system-linux.c
index 58210a6..dae98b0 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -1418,11 +1418,11 @@ out:
return ret;
 }
 
-
 int system_add_ip_tunnel(const char *name, struct blob_attr *attr)
 {
struct blob_attr *tb[__TUNNEL_ATTR_MAX];
struct blob_attr *cur;
+   bool set_df = true;
const char *str;
 
system_del_ip_tunnel(name);
@@ -1434,10 +1434,13 @@ int system_add_ip_tunnel(const char *name, struct 
blob_attr *attr)
return -EINVAL;
str = blobmsg_data(cur);
 
+   if ((cur = tb[TUNNEL_ATTR_DF]))
+   set_df = blobmsg_get_bool(cur);
+
unsigned int ttl = 0;
if ((cur = tb[TUNNEL_ATTR_TTL])) {
ttl = blobmsg_get_u32(cur);
-   if (ttl > 255)
+   if (ttl > 255 || (!set_df && ttl))
return -EINVAL;
}
 
@@ -1451,14 +1454,13 @@ int system_add_ip_tunnel(const char *name, struct 
blob_attr *attr)
link = iface->l3_dev.dev->ifindex;
}
 
-
if (!strcmp(str, "sit")) {
struct ip_tunnel_parm p = {
.link = link,
.iph = {
.version = 4,
.ihl = 5,
-   .frag_off = htons(IP_DF),
+   .frag_off = set_df ? htons(IP_DF) : 0,
.protocol = IPPROTO_IPV6,
.ttl = ttl
}
diff --git a/system.c b/system.c
index 1452f05..3dd90b4 100644
--- a/system.c
+++ b/system.c
@@ -20,6 +20,7 @@ static const struct blobmsg_policy 
tunnel_attrs[__TUNNEL_ATTR_MAX] = {
[TUNNEL_ATTR_LOCAL] = { .name = "local", .type = BLOBMSG_TYPE_STRING },
[TUNNEL_ATTR_REMOTE] = { .name = "remote", .type = BLOBMSG_TYPE_STRING 
},
[TUNNEL_ATTR_MTU] = { .name = "mtu", .type = BLOBMSG_TYPE_INT32 },
+   [TUNNEL_ATTR_DF] = { .name = "df", .type = BLOBMSG_TYPE_BOOL },
[TUNNEL_ATTR_TTL] = { .name = "ttl", .type = BLOBMSG_TYPE_INT32 },
[TUNNEL_ATTR_6RD_PREFIX] = {.name =  "6rd-prefix", .type = 
BLOBMSG_TYPE_STRING },
[TUNNEL_ATTR_6RD_RELAY_PREFIX] = { .name = "6rd-relay-prefix", .type = 
BLOBMSG_TYPE_STRING },
diff --git a/system.h b/system.h
index e1d35c9..ff83a1c 100644
--- a/system.h
+++ b/system.h
@@ -26,6 +26,7 @@ enum tunnel_param {
TUNNEL_ATTR_REMOTE,
TUNNEL_ATTR_LOCAL,
TUNNEL_ATTR_MTU,
+   TUNNEL_ATTR_DF,
TUNNEL_ATTR_TTL,
TUNNEL_ATTR_6RD_PREFIX,
TUNNEL_ATTR_6RD_RELAY_PREFIX,
-- 
1.7.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/8]netifd: Don't export default route via UBUS when disabled

2013-11-19 Thread Hans Dedecker

Signed-off-by: Hans Dedecker 
---
 ubus.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/ubus.c b/ubus.c
index a20be15..1b90594 100644
--- a/ubus.c
+++ b/ubus.c
@@ -459,6 +459,9 @@ interface_ip_dump_route_list(struct interface_ip_settings 
*ip, bool enabled)
if (route->enabled != enabled)
continue;
 
+   if ((ip->no_defaultroute == enabled) && !route->mask)
+   continue;
+
if ((route->flags & DEVADDR_FAMILY) == DEVADDR_INET4)
af = AF_INET;
else
-- 
1.7.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/8]netifd: Routing table parameter needs to be checked in route update

2013-11-19 Thread Hans Dedecker
Routing table parameter needs to be checked in interface_update_proto_route; a 
route which
has an identical nexthop but a different routing table needs to be deleted and 
added in the
correct routing table.

Signed-off-by: Hans Dedecker 
---
 interface-ip.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/interface-ip.c b/interface-ip.c
index 084688c..fb1163c 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -632,7 +632,8 @@ interface_update_proto_route(struct vlist_tree *tree,
route_new = container_of(node_new, struct device_route, node);
 
if (node_old && node_new)
-   keep = !memcmp(&route_old->nexthop, &route_new->nexthop, 
sizeof(route_old->nexthop));
+   keep = !memcmp(&route_old->nexthop, &route_new->nexthop, 
sizeof(route_old->nexthop)) &&
+   (route_old->table == route_new->table);
 
if (node_old) {
if (!(route_old->flags & DEVADDR_EXTERNAL) && 
route_old->enabled && !keep)
-- 
1.7.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/8]netifd: Apply tunnel MTU

2013-11-19 Thread Hans Dedecker
Tunnel MTU is applied according to the tunnel MTU UCI parameter

Signed-off-by: Hans Dedecker 
---
 system-linux.c |7 +--
 system.c   |   15 ---
 system.h   |1 +
 tunnel.c   |   24 +++-
 4 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/system-linux.c b/system-linux.c
index d01d7e3..58210a6 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -1435,8 +1435,11 @@ int system_add_ip_tunnel(const char *name, struct 
blob_attr *attr)
str = blobmsg_data(cur);
 
unsigned int ttl = 0;
-   if ((cur = tb[TUNNEL_ATTR_TTL]) && (ttl = blobmsg_get_u32(cur)) > 255)
-   return -EINVAL;
+   if ((cur = tb[TUNNEL_ATTR_TTL])) {
+   ttl = blobmsg_get_u32(cur);
+   if (ttl > 255)
+   return -EINVAL;
+   }
 
unsigned int link = 0;
if ((cur = tb[TUNNEL_ATTR_LINK])) {
diff --git a/system.c b/system.c
index 8e866da..1452f05 100644
--- a/system.c
+++ b/system.c
@@ -16,13 +16,14 @@
 #include 
 
 static const struct blobmsg_policy tunnel_attrs[__TUNNEL_ATTR_MAX] = {
-   [TUNNEL_ATTR_TYPE] = { "mode", BLOBMSG_TYPE_STRING },
-   [TUNNEL_ATTR_LOCAL] = { "local", BLOBMSG_TYPE_STRING },
-   [TUNNEL_ATTR_REMOTE] = { "remote", BLOBMSG_TYPE_STRING },
-   [TUNNEL_ATTR_TTL] = { "ttl", BLOBMSG_TYPE_INT32 },
-   [TUNNEL_ATTR_6RD_PREFIX] = { "6rd-prefix", BLOBMSG_TYPE_STRING },
-   [TUNNEL_ATTR_6RD_RELAY_PREFIX] = { "6rd-relay-prefix", 
BLOBMSG_TYPE_STRING },
-   [TUNNEL_ATTR_LINK] = { "link", BLOBMSG_TYPE_STRING },
+   [TUNNEL_ATTR_TYPE] = { .name = "mode", .type = BLOBMSG_TYPE_STRING },
+   [TUNNEL_ATTR_LOCAL] = { .name = "local", .type = BLOBMSG_TYPE_STRING },
+   [TUNNEL_ATTR_REMOTE] = { .name = "remote", .type = BLOBMSG_TYPE_STRING 
},
+   [TUNNEL_ATTR_MTU] = { .name = "mtu", .type = BLOBMSG_TYPE_INT32 },
+   [TUNNEL_ATTR_TTL] = { .name = "ttl", .type = BLOBMSG_TYPE_INT32 },
+   [TUNNEL_ATTR_6RD_PREFIX] = {.name =  "6rd-prefix", .type = 
BLOBMSG_TYPE_STRING },
+   [TUNNEL_ATTR_6RD_RELAY_PREFIX] = { .name = "6rd-relay-prefix", .type = 
BLOBMSG_TYPE_STRING },
+   [TUNNEL_ATTR_LINK] = { .name = "link", .type = BLOBMSG_TYPE_STRING },
 };
 
 const struct uci_blob_param_list tunnel_attr_list = {
diff --git a/system.h b/system.h
index ad74156..e1d35c9 100644
--- a/system.h
+++ b/system.h
@@ -25,6 +25,7 @@ enum tunnel_param {
TUNNEL_ATTR_TYPE,
TUNNEL_ATTR_REMOTE,
TUNNEL_ATTR_LOCAL,
+   TUNNEL_ATTR_MTU,
TUNNEL_ATTR_TTL,
TUNNEL_ATTR_6RD_PREFIX,
TUNNEL_ATTR_6RD_RELAY_PREFIX,
diff --git a/tunnel.c b/tunnel.c
index 3ef5086..aa60019 100644
--- a/tunnel.c
+++ b/tunnel.c
@@ -40,6 +40,27 @@ tunnel_set_state(struct device *dev, bool up)
return ret;
 }
 
+static enum dev_change_type
+tunnel_reload(struct device *dev, struct blob_attr *attr)
+{
+   struct blob_attr *tb_dev[__DEV_ATTR_MAX];
+   const struct uci_blob_param_list *cfg = dev->type->config_params;
+
+   if (uci_blob_check_equal(dev->config, attr, cfg))
+   return DEV_CONFIG_NO_CHANGE;
+
+   if (attr) {
+   memset(tb_dev, 0, sizeof(tb_dev));
+
+   blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, tb_dev,
+   blob_data(attr), blob_len(attr));
+   }
+
+   device_init_settings(dev, tb_dev);
+
+   return DEV_CONFIG_RESTART;
+}
+
 static struct device *
 tunnel_create(const char *name, struct blob_attr *attr)
 {
@@ -51,6 +72,7 @@ tunnel_create(const char *name, struct blob_attr *attr)
device_init(dev, &tunnel_device_type, name);
tun->set_state = dev->set_state;
dev->set_state = tunnel_set_state;
+   device_set_config(dev, &tunnel_device_type, attr);
device_set_present(dev, true);
 
return dev;
@@ -67,7 +89,7 @@ tunnel_free(struct device *dev)
 const struct device_type tunnel_device_type = {
.name = "IP tunnel",
.config_params = &tunnel_attr_list,
-
+   .reload = tunnel_reload,
.create = tunnel_create,
.free = tunnel_free,
 };
-- 
1.7.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel