Re: [OpenWrt-Devel] [PATCHv2] ppp : Unnumbered support

2015-06-12 Thread Steven Barth
Applied, thanks.

On 12.06.2015 09:26, Hans Dedecker wrote:
 Adds PPP unnumbered support via the parameter unnumbered which points to a 
 logical OpenWRT interface.
 The PPP proto shell handler will borrow an IP address from the unnumbered 
 interface (if multiple
 IP addresses are present the longest prefix different from 32 will be 
 borrowed) for which a host
 interface dependency will be created. Due to the host interface dependency 
 the PPP unnumbered interface
 will only borrow an IP address from an interface which is up.
 The borrowed IP address will be shared as local IP address by the PPP daemon 
 and no other local IP
 will be accepted from the peer in the IPCP negotiation.

 A typical use case is the usage of a public IP subnet on the Lan interface 
 which will be shared
 by the PPP interface as local IP address.

 Signed-off-by: Hans Dedecker dedec...@gmail.com
 ---
  package/network/services/ppp/files/ppp.sh | 40 
 ++-
  1 file changed, 39 insertions(+), 1 deletion(-)

 diff --git a/package/network/services/ppp/files/ppp.sh 
 b/package/network/services/ppp/files/ppp.sh
 index 1a72a1e..a6389a8 100755
 --- a/package/network/services/ppp/files/ppp.sh
 +++ b/package/network/services/ppp/files/ppp.sh
 @@ -4,10 +4,35 @@
  
  [ -n $INCLUDE_ONLY ] || {
   . /lib/functions.sh
 + . /lib/functions/network.sh
   . ../netifd-proto.sh
   init_proto $@
  }
  
 +ppp_select_ipaddr()
 +{
 + local subnets=$1
 + local res
 + local res_mask
 +
 + for subnet in $subnets; do
 + local addr=${subnet%%/*}
 + local mask=${subnet#*/}
 +
 + if [ -n $res_mask -a $mask != 32 ]; then
 + [ $mask -gt $res_mask ] || [ $res_mask = 32 ]  {
 + res=$addr
 + res_mask=$mask
 + }
 + elif [ -z $res_mask ]; then
 + res=$addr
 + res_mask=$mask
 + fi
 + done
 +
 + echo $res
 +}
 +
  ppp_exitcode_tostring()
  {
   local errorcode=$1
 @@ -53,12 +78,14 @@ ppp_generic_init_config() {
   proto_config_add_boolean authfail
   proto_config_add_int mtu
   proto_config_add_string pppname
 + proto_config_add_string unnumbered
  }
  
  ppp_generic_setup() {
   local config=$1; shift
 + local localip
  
 - json_get_vars ipv6 demand keepalive keepalive_adaptive username 
 password pppd_options pppname
 + json_get_vars ipv6 demand keepalive keepalive_adaptive username 
 password pppd_options pppname unnumbered
   if [ $ipv6 = 0 ]; then
   ipv6=
   elif [ -z $ipv6 -o $ipv6 = auto ]; then
 @@ -73,6 +100,16 @@ ppp_generic_setup() {
   fi
   [ -n $mtu ] || json_get_var mtu mtu
   [ -n $pppname ] || pppname=${proto:-ppp}-$config
 + [ -n $unnumbered ]  {
 + local subnets
 + ( proto_add_host_dependency $config  $unnumbered )
 + network_get_subnets subnets $unnumbered
 + localip=$(ppp_select_ipaddr $subnets)
 + [ -n $localip ] || {
 + proto_block_restart $config
 + return
 + }
 + }
  
   local lcp_failure=${keepalive%%[, ]*}
   local lcp_interval=${keepalive##*[, ]}
 @@ -86,6 +123,7 @@ ppp_generic_setup() {
   proto_run_command $config /usr/sbin/pppd \
   nodetach ipparam $config \
   ifname $pppname \
 + ${localip:+$localip:} \
   ${lcp_failure:+lcp-echo-interval $lcp_interval lcp-echo-failure 
 $lcp_failure $lcp_adaptive} \
   ${ipv6:++ipv6} \
   nodefaultroute \
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Combine CA-certificates in one file

2015-06-12 Thread Cristian Morales Vega
On 12 June 2015 at 08:30,  micke.p...@telldus.se wrote:
 Some packages or libraries cannot use split ca cetificates in a folder. This
 adds a config to combine all certificates into one file.

I have nothing against this patch. But do you have a list of such
packages? I may be interested in patching them.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Combine CA-certificates in one file

2015-06-12 Thread micke . prag

From: Micke Prag micke.p...@telldus.se

Some packages or libraries cannot use split ca cetificates in a folder. 
This adds a config to combine all certificates into one file.


Since this adds another ~300 Kb to the image this can be enabled by a 
config

which is disabled by default.

This also allows for packes to require this option in the DEPENDS 
section.


Signed-off-by: Micke Prag micke.p...@telldus.se
---
 package/system/ca-certificates/Config.in | 7 +++
 package/system/ca-certificates/Makefile  | 7 +++
 2 files changed, 14 insertions(+)
 create mode 100644 package/system/ca-certificates/Config.in

diff --git a/package/system/ca-certificates/Config.in 
b/package/system/ca-certificates/Config.in

new file mode 100644
index 000..36ebdc3
--- /dev/null
+++ b/package/system/ca-certificates/Config.in
@@ -0,0 +1,7 @@
+config CA_CERTIFICATES_COMBINE_CERTIFICATES
+   bool Combine certificates
+   depends on PACKAGE_ca-certificates
+   help
+   Combine all CA-certificates in 
/etc/ssl/certs/ca-certificates.crt
+		This might be required by some applications and adds ~300 Kb to the 
image

+   default n
diff --git a/package/system/ca-certificates/Makefile 
b/package/system/ca-certificates/Makefile

index 9c50fef..9fd1632 100644
--- a/package/system/ca-certificates/Makefile
+++ b/package/system/ca-certificates/Makefile
@@ -23,6 +23,10 @@ define Package/ca-certificates
   TITLE:=System CA certificates
 endef

+define Package/ca-certificates/config
+   source $(SOURCE)/Config.in
+endef
+
 define Build/Install
mkdir -p \
$(PKG_INSTALL_DIR)/usr/sbin \
@@ -41,6 +45,9 @@ define Package/ca-certificates/install
let SUFFIX += 1 ; \
done ; \
$(LN) CERTFILE $(1)/etc/ssl/certs/HASH.SUFFIX ; 
\
+		if [ $(CONFIG_CA_CERTIFICATES_COMBINE_CERTIFICATES) == y ]; then 
\
+			cat $(1)/etc/ssl/certs/CERTFILE  
$(1)/etc/ssl/certs/ca-certificates.crt ; \

+   fi ; \
done
 endef

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


Re: [OpenWrt-Devel] Ralink MT76228 port to Linux 4.0, set new IP address fail

2015-06-12 Thread Baptiste Clenet
2015-06-11 16:31 GMT+02:00 Roman Yeryomin leroi.li...@gmail.com:
 On 11 June 2015 at 16:36, Baptiste Clenet bapcle...@gmail.com wrote:
 Hi,

 I've edited patches from Linux 3.18 to make the MT7628 work with Linux 4.0.
 OpenWRT launches, I have access to the shell.
 Next step, I configure the IP address with /etc/config/network and
 /etc/init.d/network reload. Ifconfig shows me my new address IP.

 But, I can't connect via ssh to my board and if I reboot the board, I
 get errors at boot:
 [   10.23] jffs2: jffs2_scan_inode_node(): CRC failed on node at
 0x004725bc: Read 0x, calculated 0x149094b5
 I would say it appears one hundred times with different calculated CRC.
 and finally the last line is:
 [   11.00] jffs2: notice: (305) jffs2_build_xattr_subsystem:
 complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan)
 and 0 of xref (0 dead, 0 orphan) found.


 Then, I'm able to access to the shell but I still can't connect via
 ssh. The board constantly reports:

 [ 2410.01] ralink_soc_eth 1010.ethernet eth0: transmit timed out
 [ 2410.02] ralink_soc_eth 1010.ethernet eth0: dma_cfg:0055
 [ 2410.03] ralink_soc_eth 1010.ethernet eth0: tx_ring=0,
 base=00dce000, max=128, ctx=126, dtx=126, fdx=123
 [ 2410.05] ralink_soc_eth 1010.ethernet eth0: rx_ring=0,
 base=01a36000, max=128, calc=121, drx=54
 [ 2415.01] ralink_soc_eth 1010.ethernet eth0: transmit timed out
 [ 2415.02] ralink_soc_eth 1010.ethernet eth0: dma_cfg:0055
 [ 2415.03] ralink_soc_eth 1010.ethernet eth0: tx_ring=0,
 base=00dce000, max=128, ctx=126, dtx=126, fdx=123
 [ 2415.05] ralink_soc_eth 1010.ethernet eth0: rx_ring=0,
 base=01a36000, max=128, calc=121, drx=60

 It seems to be related to ethernet driver. Does anyone know those errors?


 I have the transmit queue time out error on ar71xx with 4.0.5 also.
 Situation is very similar because ralink and ar71xx ethernet drivers
 are maintained in OpenWrt only.
 I believe it is related to recent timer/clock changes in kernel (in
 3.19 AFAIK). But I don't know neither timers nor network Linux stack
 so well to tell what/where is the problem exactly.

 If somebody with more experience could point to a possible place to
 look at that would be awesome.


 Regards,
 Roman

Ok, let's see if someone can bring his knowledge on those parts and help us.
Thanks

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


Re: [OpenWrt-Devel] [PATCH] Combine CA-certificates in one file

2015-06-12 Thread micke . prag

2015-06-12 09:39 skrev Cristian Morales Vega:


On 12 June 2015 at 08:30, micke.p...@telldus.se wrote:

Some packages or libraries cannot use split ca cetificates in a 
folder.

This adds a config to combine all certificates into one file.


I have nothing against this patch. But do you have a list of such
packages? I may be interested in patching them.


Any application using Python should have this issue. I am not aware of 
any application in OpenWRT currently that have this issue but my company 
are developing some python software intended to run on OpenWRT boards.


The function ssl.wrap_socket() has one parameter called ca_certs which 
takes only one file. The documentations says:
The ca_certs file contains a set of concatenated “certification 
authority‚ÄĚ certificates, which are used to validate certificates passed 
from the other end of the connection. See the discussion of Certificates 
for more information about how to arrange the certificates in this file.

https://docs.python.org/2/library/ssl.html
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv2] ppp : Unnumbered support

2015-06-12 Thread Hans Dedecker
Adds PPP unnumbered support via the parameter unnumbered which points to a 
logical OpenWRT interface.
The PPP proto shell handler will borrow an IP address from the unnumbered 
interface (if multiple
IP addresses are present the longest prefix different from 32 will be 
borrowed) for which a host
interface dependency will be created. Due to the host interface dependency the 
PPP unnumbered interface
will only borrow an IP address from an interface which is up.
The borrowed IP address will be shared as local IP address by the PPP daemon 
and no other local IP
will be accepted from the peer in the IPCP negotiation.

A typical use case is the usage of a public IP subnet on the Lan interface 
which will be shared
by the PPP interface as local IP address.

Signed-off-by: Hans Dedecker dedec...@gmail.com
---
 package/network/services/ppp/files/ppp.sh | 40 ++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/package/network/services/ppp/files/ppp.sh 
b/package/network/services/ppp/files/ppp.sh
index 1a72a1e..a6389a8 100755
--- a/package/network/services/ppp/files/ppp.sh
+++ b/package/network/services/ppp/files/ppp.sh
@@ -4,10 +4,35 @@
 
 [ -n $INCLUDE_ONLY ] || {
. /lib/functions.sh
+   . /lib/functions/network.sh
. ../netifd-proto.sh
init_proto $@
 }
 
+ppp_select_ipaddr()
+{
+   local subnets=$1
+   local res
+   local res_mask
+
+   for subnet in $subnets; do
+   local addr=${subnet%%/*}
+   local mask=${subnet#*/}
+
+   if [ -n $res_mask -a $mask != 32 ]; then
+   [ $mask -gt $res_mask ] || [ $res_mask = 32 ]  {
+   res=$addr
+   res_mask=$mask
+   }
+   elif [ -z $res_mask ]; then
+   res=$addr
+   res_mask=$mask
+   fi
+   done
+
+   echo $res
+}
+
 ppp_exitcode_tostring()
 {
local errorcode=$1
@@ -53,12 +78,14 @@ ppp_generic_init_config() {
proto_config_add_boolean authfail
proto_config_add_int mtu
proto_config_add_string pppname
+   proto_config_add_string unnumbered
 }
 
 ppp_generic_setup() {
local config=$1; shift
+   local localip
 
-   json_get_vars ipv6 demand keepalive keepalive_adaptive username 
password pppd_options pppname
+   json_get_vars ipv6 demand keepalive keepalive_adaptive username 
password pppd_options pppname unnumbered
if [ $ipv6 = 0 ]; then
ipv6=
elif [ -z $ipv6 -o $ipv6 = auto ]; then
@@ -73,6 +100,16 @@ ppp_generic_setup() {
fi
[ -n $mtu ] || json_get_var mtu mtu
[ -n $pppname ] || pppname=${proto:-ppp}-$config
+   [ -n $unnumbered ]  {
+   local subnets
+   ( proto_add_host_dependency $config  $unnumbered )
+   network_get_subnets subnets $unnumbered
+   localip=$(ppp_select_ipaddr $subnets)
+   [ -n $localip ] || {
+   proto_block_restart $config
+   return
+   }
+   }
 
local lcp_failure=${keepalive%%[, ]*}
local lcp_interval=${keepalive##*[, ]}
@@ -86,6 +123,7 @@ ppp_generic_setup() {
proto_run_command $config /usr/sbin/pppd \
nodetach ipparam $config \
ifname $pppname \
+   ${localip:+$localip:} \
${lcp_failure:+lcp-echo-interval $lcp_interval lcp-echo-failure 
$lcp_failure $lcp_adaptive} \
${ipv6:++ipv6} \
nodefaultroute \
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ar71xx: fix 100/10mbps ethernet link issues on mynet range extender

2015-06-12 Thread Christian Lamparter
On Tuesday, June 09, 2015 09:24:41 PM Christian Lamparter wrote:
 On Tuesday, June 09, 2015 09:05:46 AM Florian Fainelli wrote:
  On Jun 9, 2015 7:36 AM, Christian Lamparter chunk...@googlemail.com 
  wrote:
   On Wednesday, June 03, 2015 05:20:22 PM Christian Lamparter wrote:
  
  Actually, I have one question, most PHY s should disable these kinds of
  delays when linking at 10/100Mbits/sec. Is not that working here because
  the registers used have a special behavior (force or override), or is it
  broken at the hardware level?
 
 = The problem with the mynet device is that the tx delay needs to be
 enabled for 100mbps/10mbps speed and disabled for 1000mbps. Not doing
 so results in an unusable ethernet link (verified by Pascal and me).
 This is why I think this is a hardware problem. (Furthermore, Sven 
 Eckelmann (CC'd, he wrote the support for the OM5P-AN - which also uses
 the AT8035) doesn't mention any workaround in his commits.

No further comments so far (but also: no merge). Ping?

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


Re: [OpenWrt-Devel] [PATCH] Combine CA-certificates in one file

2015-06-12 Thread micke . prag

2015-06-12 09:39 skrev Cristian Morales Vega:


On 12 June 2015 at 08:30, micke.p...@telldus.se wrote:

Some packages or libraries cannot use split ca cetificates in a 
folder.

This adds a config to combine all certificates into one file.


I have nothing against this patch. But do you have a list of such
packages? I may be interested in patching them.


In python 2.7.9 there is a new class SSLContext that can load the 
system certificates. This was not available previously. OpenWRT 
currently ships 2.7.10. I have modified our code to use this instead.


My patch can be discarded, I think.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Ralink MT76228 port to Linux 4.0, set new IP address fail

2015-06-12 Thread Roman Yeryomin
On 12 June 2015 at 14:30, Baptiste Clenet bapcle...@gmail.com wrote:
 2015-06-12 11:12 GMT+02:00 Baptiste Clenet bapcle...@gmail.com:
 2015-06-11 16:31 GMT+02:00 Roman Yeryomin leroi.li...@gmail.com:
 On 11 June 2015 at 16:36, Baptiste Clenet bapcle...@gmail.com wrote:
 Hi,

 I've edited patches from Linux 3.18 to make the MT7628 work with Linux 4.0.
 OpenWRT launches, I have access to the shell.
 Next step, I configure the IP address with /etc/config/network and
 /etc/init.d/network reload. Ifconfig shows me my new address IP.

 But, I can't connect via ssh to my board and if I reboot the board, I
 get errors at boot:
 [   10.23] jffs2: jffs2_scan_inode_node(): CRC failed on node at
 0x004725bc: Read 0x, calculated 0x149094b5
 I would say it appears one hundred times with different calculated CRC.
 and finally the last line is:
 [   11.00] jffs2: notice: (305) jffs2_build_xattr_subsystem:
 complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan)
 and 0 of xref (0 dead, 0 orphan) found.


 Then, I'm able to access to the shell but I still can't connect via
 ssh. The board constantly reports:

 [ 2410.01] ralink_soc_eth 1010.ethernet eth0: transmit timed out
 [ 2410.02] ralink_soc_eth 1010.ethernet eth0: dma_cfg:0055
 [ 2410.03] ralink_soc_eth 1010.ethernet eth0: tx_ring=0,
 base=00dce000, max=128, ctx=126, dtx=126, fdx=123
 [ 2410.05] ralink_soc_eth 1010.ethernet eth0: rx_ring=0,
 base=01a36000, max=128, calc=121, drx=54
 [ 2415.01] ralink_soc_eth 1010.ethernet eth0: transmit timed out
 [ 2415.02] ralink_soc_eth 1010.ethernet eth0: dma_cfg:0055
 [ 2415.03] ralink_soc_eth 1010.ethernet eth0: tx_ring=0,
 base=00dce000, max=128, ctx=126, dtx=126, fdx=123
 [ 2415.05] ralink_soc_eth 1010.ethernet eth0: rx_ring=0,
 base=01a36000, max=128, calc=121, drx=60

 It seems to be related to ethernet driver. Does anyone know those errors?


 I have the transmit queue time out error on ar71xx with 4.0.5 also.
 Situation is very similar because ralink and ar71xx ethernet drivers
 are maintained in OpenWrt only.
 I believe it is related to recent timer/clock changes in kernel (in
 3.19 AFAIK). But I don't know neither timers nor network Linux stack
 so well to tell what/where is the problem exactly.

 If somebody with more experience could point to a possible place to
 look at that would be awesome.


 Regards,
 Roman

 Ok, let's see if someone can bring his knowledge on those parts and help us.
 Thanks

 Baptiste


 I'm adding some details about the bug. after reloading
 /etc/init.d/network (with an IP modified), WATCHDOG raises an error:

 root@OpenWrt:/# [ 6426.01] [ cut here ]
 [ 6426.01] WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:303
 dev_watchdog+0x1d8/0x25c()
 [ 6426.03] NETDEV WATCHDOG: eth0 (ralink_soc_eth): transmit queue
 0 timed out

yes, exactly the same issue here with ar71xx:
http://p.tet.rtu.lv/pbzn5sspm/wvtsep/raw
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv2] ppp : Unnumbered support

2015-06-12 Thread Bastian Bittorf
* Hans Dedecker dedec...@gmail.com [12.06.2015 12:15]:
 + if [ -n $res_mask -a $mask != 32 ]; then
 + [ $mask -gt $res_mask ] || [ $res_mask = 32 ]  {

if you send a v3, please use here:
[ $mask -gt $res_mask -o $res_mask = 32 ]  {
...
}

 + [ -n $localip ] || {

here please use (dont use negation of negation):

[ -z $localip ]  {
...
}

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


Re: [OpenWrt-Devel] [PATCH v2] sysctl: read settings from /etc/sysctl.d/*.conf

2015-06-12 Thread Stefan Tomanek
Dies schrieb Stefan Tomanek (stefan.tomanek+open...@wertarbyte.de):

 This changes makes it possible to store custom settings
 in individual files inside the directory /etc/sysctl.d/.

Anything new here? :-D
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] downloads.openwrt.org looks down

2015-06-12 Thread valent.turko...@gmail.com
Found about this mirror so helping to spread the word -
http://bo.mirror.garr.it/pub/1/openwrt/

On 12 June 2015 at 12:29, valent.turko...@gmail.com
valent.turko...@gmail.com wrote:
 It's not just you! http://downloads.openwrt.org looks down from here

 http://www.downforeveryoneorjustme.com/http://downloads.openwrt.org/
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [ar71xx] ar934x-nfc: allow ECC to be configured in software BCH mode

2015-06-12 Thread Thomas Hebb
Some devices ship with NAND images that use BCH ECC. Let the driver know
about that ECC mode so that it can be selected by machine files.

Signed-off-by: Thomas Hebb tommyh...@gmail.com
---
 target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c   | 4 
 target/linux/ar71xx/files/include/linux/platform/ar934x_nfc.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c
b/target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c
index 9231251..8968129 100644
--- a/target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c
+++ b/target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c
@@ -1437,6 +1437,10 @@ ar934x_nfc_probe(struct platform_device *pdev)
nand-ecc.mode = NAND_ECC_SOFT;
break;

+   case AR934X_NFC_ECC_SOFT_BCH:
+   nand-ecc.mode = NAND_ECC_SOFT_BCH;
+   break;
+
case AR934X_NFC_ECC_HW:
ret = ar934x_nfc_setup_hwecc(nfc);
if (ret)
diff --git
a/target/linux/ar71xx/files/include/linux/platform/ar934x_nfc.h
b/target/linux/ar71xx/files/include/linux/platform/ar934x_nfc.h
index 4a4e751..371aaee 100644
--- a/target/linux/ar71xx/files/include/linux/platform/ar934x_nfc.h
+++ b/target/linux/ar71xx/files/include/linux/platform/ar934x_nfc.h
@@ -20,6 +20,7 @@ struct mtd_partition;
 enum ar934x_nfc_ecc_mode {
AR934X_NFC_ECC_SOFT = 0,
AR934X_NFC_ECC_HW,
+   AR934X_NFC_ECC_SOFT_BCH,
 };

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


[OpenWrt-Devel] Possible Fix for broken hwsim on UML target

2015-06-12 Thread Martin Tippmann
Hi,

there is also a ticket about the problem here[1].

The problem is a missing include for barrier.h that is caused by a
duplicate header guard - I guess it might be this commit that introduced
the problem: [2]

The problem seems to be that both barrier.h header  files are included when
compiling mac80211 for UML, however the identical header guard prevents the
inclusion of the original asm-generic/barrier.h hat therefore barrier.h
is never included[3]. Missing definitions are the cause for the failing
build.

The fix is simple:

Changing the header guard for backports-generic/asm/barrier.h to something
different like __BACKPORT_ASM_BARRIER_H fixes the problem for me.


Unfortunately I'm not sure how to create a patch for this or where to send
it.

This fixes the build issue and mac80211 hwsim could be activated again for
the UML targets.



thanksregards
Martin

1: https://dev.openwrt.org/ticket/19146
2:
https://git.kernel.org/cgit/linux/kernel/git/backports/backports.git/commit/?id=2d7d4083a7a418c1682d289920683f8b159d16c7
3:
https://gist.githubusercontent.com/anonymous/32f08ca5b5c12e46b8d7/raw/347509635de4f30034eb79dc9860fb90f61ab479/gistfile1.txt
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Ralink MT76228 port to Linux 4.0, set new IP address fail

2015-06-12 Thread Baptiste Clenet
2015-06-12 11:12 GMT+02:00 Baptiste Clenet bapcle...@gmail.com:
 2015-06-11 16:31 GMT+02:00 Roman Yeryomin leroi.li...@gmail.com:
 On 11 June 2015 at 16:36, Baptiste Clenet bapcle...@gmail.com wrote:
 Hi,

 I've edited patches from Linux 3.18 to make the MT7628 work with Linux 4.0.
 OpenWRT launches, I have access to the shell.
 Next step, I configure the IP address with /etc/config/network and
 /etc/init.d/network reload. Ifconfig shows me my new address IP.

 But, I can't connect via ssh to my board and if I reboot the board, I
 get errors at boot:
 [   10.23] jffs2: jffs2_scan_inode_node(): CRC failed on node at
 0x004725bc: Read 0x, calculated 0x149094b5
 I would say it appears one hundred times with different calculated CRC.
 and finally the last line is:
 [   11.00] jffs2: notice: (305) jffs2_build_xattr_subsystem:
 complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan)
 and 0 of xref (0 dead, 0 orphan) found.


 Then, I'm able to access to the shell but I still can't connect via
 ssh. The board constantly reports:

 [ 2410.01] ralink_soc_eth 1010.ethernet eth0: transmit timed out
 [ 2410.02] ralink_soc_eth 1010.ethernet eth0: dma_cfg:0055
 [ 2410.03] ralink_soc_eth 1010.ethernet eth0: tx_ring=0,
 base=00dce000, max=128, ctx=126, dtx=126, fdx=123
 [ 2410.05] ralink_soc_eth 1010.ethernet eth0: rx_ring=0,
 base=01a36000, max=128, calc=121, drx=54
 [ 2415.01] ralink_soc_eth 1010.ethernet eth0: transmit timed out
 [ 2415.02] ralink_soc_eth 1010.ethernet eth0: dma_cfg:0055
 [ 2415.03] ralink_soc_eth 1010.ethernet eth0: tx_ring=0,
 base=00dce000, max=128, ctx=126, dtx=126, fdx=123
 [ 2415.05] ralink_soc_eth 1010.ethernet eth0: rx_ring=0,
 base=01a36000, max=128, calc=121, drx=60

 It seems to be related to ethernet driver. Does anyone know those errors?


 I have the transmit queue time out error on ar71xx with 4.0.5 also.
 Situation is very similar because ralink and ar71xx ethernet drivers
 are maintained in OpenWrt only.
 I believe it is related to recent timer/clock changes in kernel (in
 3.19 AFAIK). But I don't know neither timers nor network Linux stack
 so well to tell what/where is the problem exactly.

 If somebody with more experience could point to a possible place to
 look at that would be awesome.


 Regards,
 Roman

 Ok, let's see if someone can bring his knowledge on those parts and help us.
 Thanks

 Baptiste


I'm adding some details about the bug. after reloading
/etc/init.d/network (with an IP modified), WATCHDOG raises an error:

root@OpenWrt:/# [ 6426.01] [ cut here ]
[ 6426.01] WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:303
dev_watchdog+0x1d8/0x25c()
[ 6426.03] NETDEV WATCHDOG: eth0 (ralink_soc_eth): transmit queue
0 timed out
[ 6426.05] Modules linked in: pppoe ppp_async iptable_nat pppox
ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4 ipt_REJECT
ipt_MASQUERADE xt_time xt_tcpudp xt_state xt_recent xt_nat
xt_multiport xt_mark xt_mac xt_limit xt_id xt_helper xt_conntrack
xt_connmark xt_connlimit xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT
xt_LOG xt_CT spidev slhc rfcomm nf_reject_ipv4 nf_nat_redirect
nf_nat_masquerade_ipv4 nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6
nf_defrag_ipv4 nf_conntrack_rtcache nf_conntrack_ftp iptable_raw
iptable_mangle iptable_filter ip_tables hidp hci_uart btusb bnep
bluetooth mac802154 crc_ccitt aead ieee802154_socket ieee802154
act_connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32
cls_tcindex cls_flow cls_route cls_fw sch_hfsc sch_ingress 6lowpan hid
evdev input_core i2c_ralink i2c_dev ledtrig_usbdev ip6t_REJECT
nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle
ip6table_filter ip6_tables x_tables regmap_spi regmap_i2c i2c_core
regmap_core lzo_decompress lzo_compress ipv6 ecb crypto_blkcipher
leds_gpio ohci_platform ohci_hcd ehci_platform ehci_hcd
gpio_button_hotplug usbcore nls_base usb_common crc16 crypto_hash
[ 6426.25] CPU: 0 PID: 0 Comm: swapper Not tainted 4.0.4 #1
[ 6426.26] Stack :   0001  802b86a4
80311de3  8035342c
  80312148 00f9 0002 0001 0004 80049318
0003 802bd644
  012f 00f9 802bbc48 8030dc6c 0004 8004785c
0006 80fa5240
       
 
       
 
  ...
[ 6426.33] Call Trace:
[ 6426.34] [8001475c] show_stack+0x48/0x70
[ 6426.34] [80025260] warn_slowpath_common+0xa0/0xd0
[ 6426.36] [800252bc] warn_slowpath_fmt+0x2c/0x38
[ 6426.37] [802021d4] dev_watchdog+0x1d8/0x25c
[ 6426.37] [80050558] call_timer_fn.isra.39+0x24/0x84
[ 6426.38] [80050d70] run_timer_softirq+0x1bc/0x1f8
[ 6426.40] [80027794] __do_softirq+0x150/0x288
[ 6426.40] [80027af0] irq_exit+0x54/0x70
[ 6426.41] 

[OpenWrt-Devel] [PATCH] openssl: bump to 1.0.2c

2015-06-12 Thread Magnus Kroken
Fix HMAC ABI incompatibility. The previous version introduced an ABI
incompatibility in the handling of HMAC. The previous ABI has now been
restored.

Signed-off-by: Magnus Kroken mkro...@gmail.com
---
 package/libs/openssl/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index de71033..2d69417 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssl
-PKG_VERSION:=1.0.2b
+PKG_VERSION:=1.0.2c
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
@@ -18,7 +18,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.openssl.org/source/ \
ftp://ftp.funet.fi/pub/crypt/mirrors/ftp.openssl.org/source \
ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
-PKG_MD5SUM:=7729b259e2dea7d60b32fc3934d6984b
+PKG_MD5SUM:=8c8d81a9ae7005276e486702edbcd4b6
 
 PKG_LICENSE:=OpenSSL
 PKG_LICENSE_FILES:=LICENSE
-- 
2.1.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] openssl: bump to 1.0.2c

2015-06-12 Thread Hannu Nyman

Openssl has received a version bump from one-day old 1.0.2b to 1.0.2c...

https://mta.openssl.org/pipermail/openssl-announce/2015-June/35.html
http://www.openssl.org/news/openssl-1.0.2-notes.html
Changes between 1.0.2b and 1.0.2c [12 Jun 2015]
 Fix HMAC ABI incompatibility. The previous version introduced an ABI
 incompatibility in the handling of HMAC. The previous ABI has now been
 restored.

signed-off-by: Hannu Nyman hannu.ny...@iki.fi

Index: package/libs/openssl/Makefile
===
--- package/libs/openssl/Makefile   (revision 45949)
+++ package/libs/openssl/Makefile   (working copy)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssl
-PKG_VERSION:=1.0.2b
+PKG_VERSION:=1.0.2c
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
@@ -18,7 +18,7 @@
 PKG_SOURCE_URL:=http://www.openssl.org/source/ \
ftp://ftp.funet.fi/pub/crypt/mirrors/ftp.openssl.org/source \
ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
-PKG_MD5SUM:=7729b259e2dea7d60b32fc3934d6984b
+PKG_MD5SUM:=8c8d81a9ae7005276e486702edbcd4b6
 
 PKG_LICENSE:=OpenSSL
 PKG_LICENSE_FILES:=LICENSE
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] downloads.openwrt.org looks down

2015-06-12 Thread valent.turko...@gmail.com
It's not just you! http://downloads.openwrt.org looks down from here

http://www.downforeveryoneorjustme.com/http://downloads.openwrt.org/
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 0/2] Support Ubiquiti Unifi Outdoor Plus HSR filter

2015-06-12 Thread Stefan Rompf
Hi,

this is the third iteration of the patchset to support the HSR filter of the 
Ubiquiti Unifi Outdoor Plus access point.

The HSR is a configurable RF filter in the receive path that must be tuned 
according to the selected Wifi channel for the access point to work.

Patch 1 adds a channel set helper callback to the ath9k driver and 
exports the ath9k kernel API for other packages. The registered function is 
called whenever ath9k changes the channel.

Patch 2 adds the actual tuner as a self contained kmod package. When loaded, 
it registers with ath9k as a channel set helper and tunes the HSR on every 
channel change.

The patchset is based on work of Kirill Berezin and me.

Changes since last version:
-Add debug module parameter to dump all IO from and to the HSR
-Explicitely load ath9k before ubnt_hsr as dependencies from external kmod to 
another external kmod are not detected during the build process
-Maintainer entry for kmod package
-Description updates

I'm running the driver compiled against chaos calmer RC1 right now and compile 
test it against trunk.

Not yet solved is how to add the kmod to the outdoor plus image only, but I'd 
really like to push these changes before -rc2.

Please apply

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


[OpenWrt-Devel] [PATCH] b53 switch driver memory leak and reset gpio pin initialization fix

2015-06-12 Thread Fedor Konstantinov
Memory and switch reset gpio pin must be allocated on switch/module init and 
freed on removal. At least they should not be allocated 2 or more times in a 
row.

Signed-off-by: Fedor Konstantinov blm...@mink.su
---
Comments:

Following cmd sequence calls b53_switch_init() twice, so causes leak of memory.
Last ifconfig will fail also on targets which support switch reset gpio pin, 
because devm_gpio_request_one() will be called twice in a row.
ifconfig eth0 up
ifconfig eth0 down
ifconfig eth0 up

mmap/spi/srab drivers were not tested yet because I don't have such hardware.
---
 .../generic/files/drivers/net/phy/b53/b53_common.c | 19 +++
 .../generic/files/drivers/net/phy/b53/b53_mdio.c   |  6 +
 .../generic/files/drivers/net/phy/b53/b53_mmap.c   | 28 +-
 .../generic/files/drivers/net/phy/b53/b53_priv.h   |  7 +++---
 .../generic/files/drivers/net/phy/b53/b53_spi.c| 20 
 .../generic/files/drivers/net/phy/b53/b53_srab.c   | 28 +-
 6 files changed, 88 insertions(+), 20 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 47b5a8b..2e2f6aa 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
@@ -1362,6 +1362,12 @@ struct b53_device *b53_switch_alloc(struct device *base, 
struct b53_io_ops *ops,
 }
 EXPORT_SYMBOL(b53_switch_alloc);
 
+void b53_switch_free(struct device *dev, struct b53_device *priv)
+{
+   devm_kfree(dev, priv);
+}
+EXPORT_SYMBOL(b53_switch_free);
+
 int b53_switch_detect(struct b53_device *dev)
 {
u32 id32;
@@ -1452,6 +1458,19 @@ int b53_switch_register(struct b53_device *dev)
 }
 EXPORT_SYMBOL(b53_switch_register);
 
+void b53_switch_remove(struct b53_device *dev)
+{
+   unregister_switch(dev-sw_dev);
+
+   if (dev-reset_gpio = 0)
+   devm_gpio_free(dev-dev, dev-reset_gpio);
+
+   devm_kfree(dev-dev, dev-buf);
+   devm_kfree(dev-dev, dev-vlans);
+   devm_kfree(dev-dev, dev-ports);
+}
+EXPORT_SYMBOL(b53_switch_remove);
+
 MODULE_AUTHOR(Jonas Gorski j...@openwrt.org);
 MODULE_DESCRIPTION(B53 switch library);
 MODULE_LICENSE(Dual BSD/GPL);
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..9a5f058 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
@@ -285,6 +285,10 @@ static int b53_phy_config_init(struct phy_device *phydev)
struct b53_device *dev;
int ret;
 
+   /* check if already initialized */
+   if (phydev-priv)
+   return 0;
+
dev = b53_switch_alloc(phydev-dev, b53_mdio_ops, phydev-bus);
if (!dev)
return -ENOMEM;
@@ -314,6 +318,8 @@ static void b53_phy_remove(struct phy_device *phydev)
 
b53_switch_remove(priv);
 
+   b53_switch_free(phydev-dev, priv);
+
phydev-priv = NULL;
 }
 
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
index ab1895e..7c83758 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
@@ -200,7 +200,12 @@ static struct b53_io_ops b53_mmap_ops = {
 static int b53_mmap_probe(struct platform_device *pdev)
 {
struct b53_platform_data *pdata = pdev-dev.platform_data;
-   struct b53_device *dev;
+   struct b53_device *dev = platform_get_drvdata(pdev);
+   int ret;
+
+   /* check if already initialized */
+   if (dev)
+   return 0;
 
if (!pdata)
return -EINVAL;
@@ -209,20 +214,31 @@ static int b53_mmap_probe(struct platform_device *pdev)
if (!dev)
return -ENOMEM;
 
-   if (pdata)
-   dev-pdata = pdata;
+   dev-pdata = pdata;
+
+   ret = b53_switch_register(dev);
+   if (ret) {
+   dev_err(dev-dev, failed to register switch: %i\n, ret);
+   return ret;
+   }
 
platform_set_drvdata(pdev, dev);
 
-   return b53_switch_register(dev);
+   return 0;
 }
 
 static int b53_mmap_remove(struct platform_device *pdev)
 {
struct b53_device *dev = platform_get_drvdata(pdev);
 
-   if (dev)
-   b53_switch_remove(dev);
+   if (!dev)
+   return 0;
+
+   b53_switch_remove(dev);
+
+   b53_switch_free(pdev-dev, dev);
+
+   platform_set_drvdata(pdev, NULL);
 
return 0;
 }
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 4336fdb..8ef68a1 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

[OpenWrt-Devel] [PATCH v3 2/2] Add kmod-ubnt-hsr tuner for the UBNT HSR filter

2015-06-12 Thread Stefan Rompf
Add the tuner for the Ubiquiti Outdoor Plus HSR filter as a self contained
kmod package. When loaded, it registers with ath9k as a channel set helper and
tunes the HSR on every channel change.

Signed-off-by: Stefan Rompf ste...@loplof.de
---
Index: package/kernel/ubnt-hsr/Makefile
===
--- package/kernel/ubnt-hsr/Makefile(Revision 0)
+++ package/kernel/ubnt-hsr/Makefile(Arbeitskopie)
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=ubnt_hsr
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+PKG_BUILD_DEPENDS:=mac80211
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/ubnt-hsr
+  $(call KernelPackage/mac80211/Default)
+  SUBMENU:=Wireless Drivers
+  TITLE:=Driver for Ubiquiti UniFi Outdoor Plus HSR filter
+  URL:=http://wiki.openwrt.org/toh/ubiquiti/unifi_outdoorplus
+  DEPENDS:=@PCI_SUPPORT||TARGET_ar71xx kmod-ath9k
+  FILES:= $(PKG_BUILD_DIR)/ubnt_hsr.ko
+  AUTOLOAD:=$(call AutoProbe,ubnt_hsr)
+endef
+
+define KernelPackage/ubnt-hsr/description
+ubnt-hsr adds support for the 'High-Selectivity Receiver'
+RF filter built into the receive path of the Ubiquiti
+UniFi Outdoor Plus access point. It is required for this and
+only for this access point.
+endef
+
+include $(INCLUDE_DIR)/kernel-defaults.mk
+
+define Build/Prepare
+   mkdir -p $(PKG_BUILD_DIR)
+   cp src/Makefile src/ubnt_hsr.c $(PKG_BUILD_DIR)/
+endef
+
+define Build/Compile
+   $(MAKE) $(KERNEL_MAKEOPTS) SUBDIRS=$(PKG_BUILD_DIR) \
+   
LINUXINCLUDE=-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi 
-I$(STAGING_DIR)/usr/include/mac80211-backport \
+   -I$(STAGING_DIR)/usr/include/mac80211/uapi 
-I$(STAGING_DIR)/usr/include/mac80211 \
+   -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) 
\
+   -I$(LINUX_DIR)/include/generated/uapi/ 
-Iarch/$(LINUX_KARCH)/include \
+   -Iarch/$(LINUX_KARCH)/include/$(LINUX_UAPI_DIR) \
+   -Iarch/$(LINUX_KARCH)/include/generated \
+   -Iarch/$(LINUX_KARCH)/include/generated/$(LINUX_UAPI_DIR) \
+   -include generated/autoconf.h \
+   -include backport/backport.h  \
+   V=${V} modules
+endef
+
+$(eval $(call KernelPackage,ubnt-hsr))
Index: package/kernel/ubnt-hsr/src/Makefile
===
--- package/kernel/ubnt-hsr/src/Makefile(Revision 0)
+++ package/kernel/ubnt-hsr/src/Makefile(Arbeitskopie)
@@ -0,0 +1 @@
+obj-m   := ubnt_hsr.o
Index: package/kernel/ubnt-hsr/src/ubnt_hsr.c
===
--- package/kernel/ubnt-hsr/src/ubnt_hsr.c  (Revision 0)
+++ package/kernel/ubnt-hsr/src/ubnt_hsr.c  (Arbeitskopie)
@@ -0,0 +1,283 @@
+/*
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015 Kirill Berezin
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in 
all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
+ * SOFTWARE.
+ *
+ */
+
+#include linux/io.h
+#include linux/slab.h
+#include linux/module.h
+#include linux/time.h
+#include linux/bitops.h
+#include linux/etherdevice.h
+#include linux/rtnetlink.h
+#include asm/unaligned.h
+
+#include ath/ath9k/hw.h
+#include ath/ath9k/ath9k.h
+
+#define HSR_GPIO_CSN 8
+#define HSR_GPIO_CLK 6
+#define HSR_GPIO_DOUT 7
+#define HSR_GPIO_DIN 5
+
+/* delays are in useconds */
+#define HSR_DELAY_HALF_TICK 100
+#define HSR_DELAY_PRE_WRITE 75
+#define HSR_DELAY_FINAL 2
+#define HSR_DELAY_TRAILING 200
+
+static void hsr_init(struct ath_hw* ah);
+static int hsr_disable(struct ath_hw* ah);
+static int hsr_enable(struct ath_hw* ah, int bw, int fq);
+static int hsr_status(struct ath_hw* ah);
+
+static void hsr_init(struct ath_hw* ah) {
+   ath9k_hw_cfg_gpio_input(ah, HSR_GPIO_DIN);
+   

[OpenWrt-Devel] [PATCH v3 1/2] [mac80211] Add channel set helper callback to ath9k

2015-06-12 Thread Stefan Rompf
This patch adds a channel set helper callback to the ath9k driver and 
exports the ath9k kernel API for other packages. The registered function
is called whenever ath9k changes the channel. 

Signed-off-by: Stefan Rompf ste...@loplof.de
---
Index: package/kernel/mac80211/Makefile
===
--- package/kernel/mac80211/Makefile(Revision 45695)
+++ package/kernel/mac80211/Makefile(Arbeitskopie)
@@ -1737,11 +1737,13 @@
$(1)/usr/include/mac80211 \
$(1)/usr/include/mac80211-backport \
$(1)/usr/include/mac80211/ath \
+   $(1)/usr/include/mac80211/ath/ath9k \
$(1)/usr/include/net/mac80211
$(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* 
$(1)/usr/include/mac80211/
$(CP) $(PKG_BUILD_DIR)/backport-include/* 
$(1)/usr/include/mac80211-backport/
$(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h 
$(1)/usr/include/net/mac80211/
$(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h 
$(1)/usr/include/mac80211/ath/
+   $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/*.h 
$(1)/usr/include/mac80211/ath/ath9k/
rm -f $(1)/usr/include/mac80211-backport/linux/module.h
 endef
 
Index: package/kernel/mac80211/patches/930-ath9k_add_channel_set_helper.patch
===
--- package/kernel/mac80211/patches/930-ath9k_add_channel_set_helper.patch  
(Revision 0)
+++ package/kernel/mac80211/patches/930-ath9k_add_channel_set_helper.patch  
(Arbeitskopie)
@@ -0,0 +1,46 @@
+diff -X diffign -Npur kernel/drivers/net/wireless/ath/ath9k.orig/ath9k.h 
kernel/drivers/net/wireless/ath/ath9k/ath9k.h
+--- kernel/drivers/net/wireless/ath/ath9k.orig/ath9k.h 2015-06-04 
21:19:11.0 +0200
 kernel/drivers/net/wireless/ath/ath9k/ath9k.h  2015-06-06 
10:23:05.0 +0200
+@@ -1110,4 +1110,10 @@ static inline int ath_ahb_init(void) { r
+ static inline void ath_ahb_exit(void) {};
+ #endif
+ 
++/*
++ * OpenWrt channel set helper, needed f.e. for Ubiquiti UniFi Outdoor Plus
++ */
++typedef void (set_channel_helper_fn)(struct ath_hw* ah, int bw, int fq);
++void ath9k_register_set_channel_helper(set_channel_helper_fn *); /* call 
inside RTNL lock to guard against parallel channel change */
++
+ #endif /* ATH9K_H */
+diff -X diffign -Npur kernel/drivers/net/wireless/ath/ath9k.orig/channel.c 
kernel/drivers/net/wireless/ath/ath9k/channel.c
+--- kernel/drivers/net/wireless/ath/ath9k.orig/channel.c   2015-03-10 
04:37:15.0 +0100
 kernel/drivers/net/wireless/ath/ath9k/channel.c2015-06-06 
10:23:05.0 +0200
+@@ -16,6 +16,18 @@
+ 
+ #include ath9k.h
+ 
++/*
++ * OpenWrt channel set helper
++ */
++static set_channel_helper_fn *ath9k_set_channel_helper;
++
++void ath9k_register_set_channel_helper(set_channel_helper_fn *chanfn)
++{
++  ath9k_set_channel_helper = chanfn;
++}
++EXPORT_SYMBOL(ath9k_register_set_channel_helper);
++
++
+ /* Set/change channels.  If the channel is really being changed, it's done
+  * by reseting the chip.  To accomplish this we must first cleanup any pending
+  * DMA, then restart stuff.
+@@ -41,6 +53,9 @@ static int ath_set_channel(struct ath_so
+   ath_dbg(common, CONFIG, Set channel: %d MHz width: %d\n,
+   chan-center_freq, chandef-width);
+ 
++  if (ath9k_set_channel_helper)
++  ath9k_set_channel_helper(ah, chandef-width, chan-center_freq);
++
+   /* update survey stats for the old channel before switching */
+   spin_lock_bh(common-cc_lock);
+   ath_update_survey_stats(sc);
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] b53 switch driver memory leak and reset gpio pin initialization fix

2015-06-12 Thread Jonas Gorski
Hi,

On Fri, Jun 12, 2015 at 8:16 PM, Fedor Konstantinov blm...@mink.su wrote:
 Memory and switch reset gpio pin must be allocated on switch/module init and 
 freed on removal. At least they should not be allocated 2 or more times in a 
 row.

 Signed-off-by: Fedor Konstantinov blm...@mink.su
 ---
 Comments:

 Following cmd sequence calls b53_switch_init() twice, so causes leak of 
 memory.
 Last ifconfig will fail also on targets which support switch reset gpio pin, 
 because devm_gpio_request_one() will be called twice in a row.
 ifconfig eth0 up
 ifconfig eth0 down
 ifconfig eth0 up

On what platform? This also requires a better explanation why this is
the correct fix.

 mmap/spi/srab drivers were not tested yet because I don't have such hardware.
 ---
  .../generic/files/drivers/net/phy/b53/b53_common.c | 19 +++
  .../generic/files/drivers/net/phy/b53/b53_mdio.c   |  6 +
  .../generic/files/drivers/net/phy/b53/b53_mmap.c   | 28 
 +-
  .../generic/files/drivers/net/phy/b53/b53_priv.h   |  7 +++---
  .../generic/files/drivers/net/phy/b53/b53_spi.c| 20 
  .../generic/files/drivers/net/phy/b53/b53_srab.c   | 28 
 +-
  6 files changed, 88 insertions(+), 20 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 47b5a8b..2e2f6aa 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
 @@ -1362,6 +1362,12 @@ struct b53_device *b53_switch_alloc(struct device 
 *base, struct b53_io_ops *ops,
  }
  EXPORT_SYMBOL(b53_switch_alloc);

 +void b53_switch_free(struct device *dev, struct b53_device *priv)
 +{
 +   devm_kfree(dev, priv);
 +}
 +EXPORT_SYMBOL(b53_switch_free);
 +
  int b53_switch_detect(struct b53_device *dev)
  {
 u32 id32;
 @@ -1452,6 +1458,19 @@ int b53_switch_register(struct b53_device *dev)
  }
  EXPORT_SYMBOL(b53_switch_register);

 +void b53_switch_remove(struct b53_device *dev)
 +{
 +   unregister_switch(dev-sw_dev);
 +
 +   if (dev-reset_gpio = 0)
 +   devm_gpio_free(dev-dev, dev-reset_gpio);
 +
 +   devm_kfree(dev-dev, dev-buf);
 +   devm_kfree(dev-dev, dev-vlans);
 +   devm_kfree(dev-dev, dev-ports);
 +}
 +EXPORT_SYMBOL(b53_switch_remove);

These look wrong, the whole point of using devm_* is that you do *not*
need to free the resources manually and it will be automatically done
on removal or probe failure.

 +
  MODULE_AUTHOR(Jonas Gorski j...@openwrt.org);
  MODULE_DESCRIPTION(B53 switch library);
  MODULE_LICENSE(Dual BSD/GPL);
 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..9a5f058 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
 @@ -285,6 +285,10 @@ static int b53_phy_config_init(struct phy_device *phydev)
 struct b53_device *dev;
 int ret;

 +   /* check if already initialized */
 +   if (phydev-priv)
 +   return 0;
 +

This is the only thing that looks somewhat valid, but needs a better
explanation why this might happen.

 dev = b53_switch_alloc(phydev-dev, b53_mdio_ops, phydev-bus);
 if (!dev)
 return -ENOMEM;
 @@ -314,6 +318,8 @@ static void b53_phy_remove(struct phy_device *phydev)

 b53_switch_remove(priv);

 +   b53_switch_free(phydev-dev, priv);
 +

See the above comment regarding devm_*free

 phydev-priv = NULL;
  }

 diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c 
 b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
 index ab1895e..7c83758 100644
 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
 +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
 @@ -200,7 +200,12 @@ static struct b53_io_ops b53_mmap_ops = {
  static int b53_mmap_probe(struct platform_device *pdev)
  {
 struct b53_platform_data *pdata = pdev-dev.platform_data;
 -   struct b53_device *dev;
 +   struct b53_device *dev = platform_get_drvdata(pdev);
 +   int ret;
 +
 +   /* check if already initialized */
 +   if (dev)
 +   return 0;

This shouldn't be possible. The probe shouldn't have been run twice,
and a remove should have unregistered the switch.


 if (!pdata)
 return -EINVAL;
 @@ -209,20 +214,31 @@ static int b53_mmap_probe(struct platform_device *pdev)
 if (!dev)
 return -ENOMEM;

 -   if (pdata)
 -   dev-pdata = pdata;
 +   dev-pdata = pdata;
 +
 +   ret = b53_switch_register(dev);
 +   if (ret) {
 +   dev_err(dev-dev, failed to register switch: %i\n, ret);

If anything b53_switch_register should complain if it fails, not each
and every user of