Re: [OpenWrt-Devel] mediatek mt7601u?

2014-09-20 Thread Luca Olivetti
El 19/09/14 21:58, Luca Olivetti ha escrit:
> El 19/09/14 19:24, Luca Olivetti ha escrit:
>> I made an openwrt recipe but it doesn't work (I see the interface but as
>> soon as I try to ifconfig up it segfaults), I guess it's an endianness
>> problem (I also tried without the second patch, just in case).
> 
> I'm almost sure it's an endianness issue.
> In the laptop dmesg I see
> 
>  MAC[Ver:Rev=0x76010500]
> 
> while in the router
> 
> 
>  MAC[Ver:Rev=0x00050176]

OK, it's a matter of adding -DRT_BIG_ENDIAN to WFLAGS *but* it still
doesn't work: it progresses further (it reads most of the eeprom values
correctly, including the mac, but a couple of values are still different
from the laptop), but then it doesn't recognize the received frames and
eventually the router reboots.

I suspect that the driver hasn't been tested with RT_BIG_ENDIAN (in fact
it hadn't even been compiled, since one of the structures was missing a
;) but it's too big a mess for me to follow.

Maybe I should ask on the linux-wireless list?

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


[OpenWrt-Devel] [PATCH][BB]Backport essential fixes for ad799x

2014-09-20 Thread Hartmut Knaack
This patch ports back some fixes of the ad799x driver, which were
committed between 3.10 and 3.15.

Signed-off-by: Hartmut Knaack 
---
This is the patch out of the series, which got committed to trunk lately, which 
is appropriate for Barrier Breaker.
http://patchwork.openwrt.org/patch/5771/

diff --git 
a/target/linux/generic/patches-3.10/065-iio_ad799x_backport_fixes.patch 
b/target/linux/generic/patches-3.10/065-iio_ad799x_backport_fixes.patch
new file mode 100644
index 000..4368ec7
--- /dev/null
+++ b/target/linux/generic/patches-3.10/065-iio_ad799x_backport_fixes.patch
@@ -0,0 +1,159 @@
+Backport essential fixes from 3.15
+
+From Linux 3.10 on this driver required platform data to load, which makes it
+unusable in OpenWRT. This commit backports the following fixes:
+  * Move to regulator framework for scaling
+  * Set endianness of the ADC to Big endian
+  * Fix device-removal path
+This commit should not be moved to newer kernel versions!
+
+Signed-off-by: Hartmut Knaack 
+---
+diff -uprN a/drivers/staging/iio/adc/ad799x_core.c 
b/drivers/staging/iio/adc/ad799x_core.c
+--- a/drivers/staging/iio/adc/ad799x_core.c
 b/drivers/staging/iio/adc/ad799x_core.c
+@@ -163,7 +163,6 @@ static int ad799x_read_raw(struct iio_de
+ {
+   int ret;
+   struct ad799x_state *st = iio_priv(indio_dev);
+-  unsigned int scale_uv;
+ 
+   switch (m) {
+   case IIO_CHAN_INFO_RAW:
+@@ -180,10 +179,12 @@ static int ad799x_read_raw(struct iio_de
+   RES_MASK(chan->scan_type.realbits);
+   return IIO_VAL_INT;
+   case IIO_CHAN_INFO_SCALE:
+-  scale_uv = (st->int_vref_mv * 1000) >> chan->scan_type.realbits;
+-  *val =  scale_uv / 1000;
+-  *val2 = (scale_uv % 1000) * 1000;
+-  return IIO_VAL_INT_PLUS_MICRO;
++  ret = regulator_get_voltage(st->vref);
++  if (ret < 0)
++  return ret;
++  *val =  ret / 1000;
++  *val2 = chan->scan_type.realbits;
++  return IIO_VAL_FRACTIONAL_LOG2;
+   }
+   return -EINVAL;
+ }
+@@ -474,7 +475,13 @@ static const struct iio_info ad7993_4_7_
+   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
+   .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
+   .scan_index = (_index), \
+-  .scan_type = IIO_ST('u', _realbits, 16, 12 - (_realbits)), \
++  .scan_type = { \
++  .sign = 'u', \
++  .realbits = (_realbits), \
++  .storagebits = 16, \
++  .shift = 12 - (_realbits), \
++  .endianness = IIO_BE, \
++  }, \
+   .event_mask = (_evmask), \
+ }
+ 
+@@ -584,7 +591,6 @@ static int ad799x_probe(struct i2c_clien
+  const struct i2c_device_id *id)
+ {
+   int ret;
+-  struct ad799x_platform_data *pdata = client->dev.platform_data;
+   struct ad799x_state *st;
+   struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
+ 
+@@ -601,17 +607,21 @@ static int ad799x_probe(struct i2c_clien
+ 
+   /* TODO: Add pdata options for filtering and bit delay */
+ 
+-  if (!pdata)
+-  return -EINVAL;
+-
+-  st->int_vref_mv = pdata->vref_mv;
+-
+-  st->reg = regulator_get(&client->dev, "vcc");
+-  if (!IS_ERR(st->reg)) {
+-  ret = regulator_enable(st->reg);
+-  if (ret)
+-  goto error_put_reg;
++  st->reg = devm_regulator_get(&client->dev, "vcc");
++  if (IS_ERR(st->reg))
++  return PTR_ERR(st->reg);
++  ret = regulator_enable(st->reg);
++  if (ret)
++  return ret;
++  st->vref = devm_regulator_get(&client->dev, "vref");
++  if (IS_ERR(st->vref)) {
++  ret = PTR_ERR(st->vref);
++  goto error_disable_reg;
+   }
++  ret = regulator_enable(st->vref);
++  if (ret)
++  goto error_disable_reg;
++
+   st->client = client;
+ 
+   indio_dev->dev.parent = &client->dev;
+@@ -624,7 +634,7 @@ static int ad799x_probe(struct i2c_clien
+ 
+   ret = ad799x_register_ring_funcs_and_init(indio_dev);
+   if (ret)
+-  goto error_disable_reg;
++  goto error_disable_vref;
+ 
+   if (client->irq > 0) {
+   ret = request_threaded_irq(client->irq,
+@@ -648,12 +658,10 @@ error_free_irq:
+   free_irq(client->irq, indio_dev);
+ error_cleanup_ring:
+   ad799x_ring_cleanup(indio_dev);
++error_disable_vref:
++  regulator_disable(st->vref);
+ error_disable_reg:
+-  if (!IS_ERR(st->reg))
+-  regulator_disable(st->reg);
+-error_put_reg:
+-  if (!IS_ERR(st->reg))
+-  regulator_put(st->reg);
++  regulator_disable(st->reg);
+   iio_device_free(indio_dev);
+ 
+   return ret;
+@@ -669,10 +677,8 @@ static int ad799x_remove(struct i2c_clie
+   free_irq(client->irq, indio_dev);
+ 
+   ad799x_ring_cleanup(indio_dev);
+-  if (

[OpenWrt-Devel] [PATCH] kernel: add ledtrig-transient module support

2014-09-20 Thread Michael Heimpold
Signed-off-by: Michael Heimpold 
---
 package/kernel/linux/modules/leds.mk |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/package/kernel/linux/modules/leds.mk 
b/package/kernel/linux/modules/leds.mk
index 24a03dd..9c54c78 100644
--- a/package/kernel/linux/modules/leds.mk
+++ b/package/kernel/linux/modules/leds.mk
@@ -151,6 +151,21 @@ endef
 $(eval $(call KernelPackage,ledtrig-timer))
 
 
+define KernelPackage/ledtrig-transient
+  SUBMENU:=$(LEDS_MENU)
+  TITLE:=LED Transient Trigger
+  KCONFIG:=CONFIG_LEDS_TRIGGER_TRANSIENT
+  FILES:=$(LINUX_DIR)/drivers/leds/$(if $(call 
kernel_patchver_ge,3.10),trigger/)ledtrig-transient.ko
+  AUTOLOAD:=$(call AutoLoad,50,ledtrig-transient,1)
+endef
+
+define KernelPackage/ledtrig-transient/description
+ Kernel module that allows LEDs one time activation of a transient state.
+endef
+
+$(eval $(call KernelPackage,ledtrig-transient))
+
+
 define KernelPackage/ledtrig-oneshot
   SUBMENU:=$(LEDS_MENU)
   TITLE:=LED One-Shot Trigger
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] kernel: add rtc-ds1307 module support

2014-09-20 Thread Michael Heimpold
Signed-off-by: Michael Heimpold 
---
 package/kernel/linux/modules/other.mk |   18 ++
 1 file changed, 18 insertions(+)

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index 199e457..6861224 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -505,6 +505,24 @@ endef
 $(eval $(call KernelPackage,pwm-gpio))
 
 
+define KernelPackage/rtc-ds1307
+  SUBMENU:=$(OTHER_MENU)
+  TITLE:=Dallas/Maxim DS1307 (and compatible) RTC support
+  $(call AddDepends/rtc)
+  DEPENDS+=+kmod-i2c-core
+  KCONFIG:=CONFIG_RTC_DRV_DS1307
+  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ds1307.ko
+  AUTOLOAD:=$(call AutoProbe,rtc-ds1307)
+endef
+
+define KernelPackage/rtc-ds1307/description
+ Kernel module for Dallas/Maxim DS1307/DS1337/DS1338/DS1340/DS1388/DS3231,
+ Epson RX-8025 and various other compatible RTC chips connected via I2C.
+endef
+
+$(eval $(call KernelPackage,rtc-ds1307))
+
+
 define KernelPackage/rtc-ds1672
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Dallas/Maxim DS1672 RTC support
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH][RESEND.3] ar71xx:stops qihoo c301 booting into backup firmware

2014-09-20 Thread swigger
thanks. I have done.

On Sat, Sep 20, 2014 at 5:39 PM, Weijie Gao  wrote:
> Hi,
>
> You need to register a account at patchwork.openwrt.org, and mark your 
> previous patches Superseded.
>
> Weijie Gao
>
>
> On 2014/9/20 17:18, swigger wrote:
>> Openwrt recently adds Qihoo [NYSE:QIHU] C301 router support.
>> However, this router has a backup firmware in the second flash and the
>> current trunk can only boot 3 times before u-boot boots into that backup
>> firmware. This is a stratgy for unbricking.
>>
>> This patch makes u-boot happy.
>>
>> Signed-off-by: Xungneg li 
>> ---
>>  .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c |   87 
>> 
>>  1 file changed, 87 insertions(+)
>>
>> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c 
>> b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
>> index 08a602f..816a433 100644
>> --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
>> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
>> @@ -14,6 +14,8 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>>
>>  #include 
>>
>> @@ -79,6 +81,7 @@ static struct gpio_keys_button qihoo_c301_gpio_keys[] 
>> __initdata = {
>>   },
>>  };
>>
>> +static int qihoo_c301_board = 0;
>>  struct flash_platform_data flash __initdata = {NULL, NULL, 0};
>>
>>  static void qihoo_c301_get_mac(const char *name, char *mac)
>> @@ -98,6 +101,7 @@ static void __init qihoo_c301_setup(void)
>>   u8 tmpmac[ETH_ALEN];
>>
>>   ath79_register_m25p80_multi(&flash);
>> + qihoo_c301_board = 1;
>>
>>   ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
>>
>> @@ -164,3 +168,86 @@ static void __init qihoo_c301_setup(void)
>>
>>  MIPS_MACHINE(ATH79_MACH_QIHOO_C301, "QIHOO-C301", "Qihoo 360 C301",
>>qihoo_c301_setup);
>> +
>> +
>> +//the following code stops qihoo's uboot booting into the backup system.
>> +static void erase_callback(struct erase_info *erase)
>> +{
>> + char * buf = (char*) erase->priv;
>> + int ret;
>> + size_t nb=0;
>> +
>> + if (erase->state == MTD_ERASE_DONE)
>> + {
>> + ret = mtd_write(erase->mtd, 0, 0x1, &nb, buf);
>> + }
>> + kfree(erase);
>> + kfree(buf);
>> +}
>> +
>> +static int qihoo_reset_trynum(void)
>> +{
>> + size_t nb = 0;
>> + char *buf=0, *p;
>> + const char * match = "image1trynum=";
>> + size_t matchlen = strlen(match);
>> + struct erase_info *erase;
>> + struct mtd_info * mtd;
>> + unsigned int newcrc;
>> + int ret;
>> +
>> + if (! qihoo_c301_board)
>> + return 0;
>> +
>> + mtd = get_mtd_device_nm("action_image_config");
>> + if (IS_ERR(mtd))
>> + {
>> + return PTR_ERR(mtd);
>> + }
>> + if (mtd->size!=0x1)
>> + {
>> + return -1;
>> + }
>> + buf = kzalloc(0x1+4, GFP_KERNEL);
>> + ret = mtd_read(mtd, 0, 0x1, &nb, buf);
>> + if (nb != 0x1)
>> + {
>> + kfree(buf);
>> + return -1;
>> + }
>> + for (p=buf+4; *p; p+=strlen(p)+1)
>> + {
>> + if (strncmp(p, match, matchlen)==0)
>> + {
>> + p += matchlen;
>> + while (*p)
>> + *p++ = '0';
>> + break;
>> + }
>> + }
>> +
>> + newcrc = crc32(~0, buf+4, 0xfffc)^0x;
>> + memcpy(buf, &newcrc, 4);
>> +
>> + erase = kzalloc(sizeof(struct erase_info), GFP_KERNEL);
>> + if (!erase)
>> + {
>> + kfree(buf);
>> + return -1;
>> + }
>> + erase->mtd  = mtd;
>> + erase->callback = erase_callback;
>> + erase->addr = 0;
>> + erase->len  = 0x1;
>> + erase->priv = (u_long) buf;
>> + ret = mtd_erase(mtd, erase);
>> +
>> + if (ret) {
>> + kfree(buf);
>> + kfree(erase);
>> + return ret;
>> + }
>> +
>> + return 0;
>> +}
>> +late_initcall(qihoo_reset_trynum);
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH][RESEND.3] ar71xx:stops qihoo c301 booting into backup firmware

2014-09-20 Thread Weijie Gao
Hi,

You need to register a account at patchwork.openwrt.org, and mark your previous 
patches Superseded.

Weijie Gao


On 2014/9/20 17:18, swigger wrote:
> Openwrt recently adds Qihoo [NYSE:QIHU] C301 router support.
> However, this router has a backup firmware in the second flash and the
> current trunk can only boot 3 times before u-boot boots into that backup
> firmware. This is a stratgy for unbricking.
>
> This patch makes u-boot happy.
>
> Signed-off-by: Xungneg li 
> ---
>  .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c |   87 
> 
>  1 file changed, 87 insertions(+)
>
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c 
> b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
> index 08a602f..816a433 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
> @@ -14,6 +14,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  
>  #include 
>  
> @@ -79,6 +81,7 @@ static struct gpio_keys_button qihoo_c301_gpio_keys[] 
> __initdata = {
>   },
>  };
>  
> +static int qihoo_c301_board = 0;
>  struct flash_platform_data flash __initdata = {NULL, NULL, 0};
>  
>  static void qihoo_c301_get_mac(const char *name, char *mac)
> @@ -98,6 +101,7 @@ static void __init qihoo_c301_setup(void)
>   u8 tmpmac[ETH_ALEN];
>  
>   ath79_register_m25p80_multi(&flash);
> + qihoo_c301_board = 1;
>  
>   ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
>  
> @@ -164,3 +168,86 @@ static void __init qihoo_c301_setup(void)
>  
>  MIPS_MACHINE(ATH79_MACH_QIHOO_C301, "QIHOO-C301", "Qihoo 360 C301",
>qihoo_c301_setup);
> +
> +
> +//the following code stops qihoo's uboot booting into the backup system.
> +static void erase_callback(struct erase_info *erase)
> +{
> + char * buf = (char*) erase->priv;
> + int ret;
> + size_t nb=0;
> +
> + if (erase->state == MTD_ERASE_DONE)
> + {
> + ret = mtd_write(erase->mtd, 0, 0x1, &nb, buf);
> + }
> + kfree(erase);
> + kfree(buf);
> +}
> +
> +static int qihoo_reset_trynum(void)
> +{
> + size_t nb = 0;
> + char *buf=0, *p;
> + const char * match = "image1trynum=";
> + size_t matchlen = strlen(match);
> + struct erase_info *erase;
> + struct mtd_info * mtd;
> + unsigned int newcrc;
> + int ret;
> +
> + if (! qihoo_c301_board)
> + return 0;
> +
> + mtd = get_mtd_device_nm("action_image_config");
> + if (IS_ERR(mtd))
> + {
> + return PTR_ERR(mtd);
> + }
> + if (mtd->size!=0x1)
> + {
> + return -1;
> + }
> + buf = kzalloc(0x1+4, GFP_KERNEL);
> + ret = mtd_read(mtd, 0, 0x1, &nb, buf);
> + if (nb != 0x1)
> + {
> + kfree(buf);
> + return -1;
> + }
> + for (p=buf+4; *p; p+=strlen(p)+1)
> + {
> + if (strncmp(p, match, matchlen)==0)
> + {
> + p += matchlen;
> + while (*p)
> + *p++ = '0';
> + break;
> + }
> + }
> +
> + newcrc = crc32(~0, buf+4, 0xfffc)^0x;
> + memcpy(buf, &newcrc, 4);
> +
> + erase = kzalloc(sizeof(struct erase_info), GFP_KERNEL);
> + if (!erase)
> + {
> + kfree(buf);
> + return -1;
> + }
> + erase->mtd  = mtd;
> + erase->callback = erase_callback;
> + erase->addr = 0;
> + erase->len  = 0x1;
> + erase->priv = (u_long) buf;
> + ret = mtd_erase(mtd, erase);
> +
> + if (ret) {
> + kfree(buf);
> + kfree(erase);
> + return ret;
> + }
> +
> + return 0;
> +}
> +late_initcall(qihoo_reset_trynum);
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH][RESEND.3] ar71xx:stops qihoo c301 booting into backup firmware

2014-09-20 Thread swigger
Openwrt recently adds Qihoo [NYSE:QIHU] C301 router support.
However, this router has a backup firmware in the second flash and the
current trunk can only boot 3 times before u-boot boots into that backup
firmware. This is a stratgy for unbricking.

This patch makes u-boot happy.

Signed-off-by: Xungneg li 
---
 .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c |   87 
 1 file changed, 87 insertions(+)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
index 08a602f..816a433 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
@@ -14,6 +14,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -79,6 +81,7 @@ static struct gpio_keys_button qihoo_c301_gpio_keys[] 
__initdata = {
},
 };
 
+static int qihoo_c301_board = 0;
 struct flash_platform_data flash __initdata = {NULL, NULL, 0};
 
 static void qihoo_c301_get_mac(const char *name, char *mac)
@@ -98,6 +101,7 @@ static void __init qihoo_c301_setup(void)
u8 tmpmac[ETH_ALEN];
 
ath79_register_m25p80_multi(&flash);
+   qihoo_c301_board = 1;
 
ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
 
@@ -164,3 +168,86 @@ static void __init qihoo_c301_setup(void)
 
 MIPS_MACHINE(ATH79_MACH_QIHOO_C301, "QIHOO-C301", "Qihoo 360 C301",
 qihoo_c301_setup);
+
+
+//the following code stops qihoo's uboot booting into the backup system.
+static void erase_callback(struct erase_info *erase)
+{
+   char * buf = (char*) erase->priv;
+   int ret;
+   size_t nb=0;
+
+   if (erase->state == MTD_ERASE_DONE)
+   {
+   ret = mtd_write(erase->mtd, 0, 0x1, &nb, buf);
+   }
+   kfree(erase);
+   kfree(buf);
+}
+
+static int qihoo_reset_trynum(void)
+{
+   size_t nb = 0;
+   char *buf=0, *p;
+   const char * match = "image1trynum=";
+   size_t matchlen = strlen(match);
+   struct erase_info *erase;
+   struct mtd_info * mtd;
+   unsigned int newcrc;
+   int ret;
+
+   if (! qihoo_c301_board)
+   return 0;
+
+   mtd = get_mtd_device_nm("action_image_config");
+   if (IS_ERR(mtd))
+   {
+   return PTR_ERR(mtd);
+   }
+   if (mtd->size!=0x1)
+   {
+   return -1;
+   }
+   buf = kzalloc(0x1+4, GFP_KERNEL);
+   ret = mtd_read(mtd, 0, 0x1, &nb, buf);
+   if (nb != 0x1)
+   {
+   kfree(buf);
+   return -1;
+   }
+   for (p=buf+4; *p; p+=strlen(p)+1)
+   {
+   if (strncmp(p, match, matchlen)==0)
+   {
+   p += matchlen;
+   while (*p)
+   *p++ = '0';
+   break;
+   }
+   }
+
+   newcrc = crc32(~0, buf+4, 0xfffc)^0x;
+   memcpy(buf, &newcrc, 4);
+
+   erase = kzalloc(sizeof(struct erase_info), GFP_KERNEL);
+   if (!erase)
+   {
+   kfree(buf);
+   return -1;
+   }
+   erase->mtd  = mtd;
+   erase->callback = erase_callback;
+   erase->addr = 0;
+   erase->len  = 0x1;
+   erase->priv = (u_long) buf;
+   ret = mtd_erase(mtd, erase);
+
+   if (ret) {
+   kfree(buf);
+   kfree(erase);
+   return ret;
+   }
+
+   return 0;
+}
+late_initcall(qihoo_reset_trynum);
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] overcommit memory/ratio

2014-09-20 Thread David Lang

On Sat, 20 Sep 2014, Nikos Mavrogiannopoulos wrote:


On Fri, 2014-09-19 at 18:39 -0700, David Lang wrote


Well being used to something bad, doesn't mean things cannot get better.
Routers (to which I have some experience at), rarely have processes
running that wouldn't matter if they are randomly killed; on a desktop
system you immediately notice an issue, and you can reboot, a router is
typically running unattended. Being locked out of such a system because
another process had a memory leak, can be an issue.


Turning off overcommit so that a program that wants to spawn a child will end up
requiring double it's memory (for the time between the fork and the exec) is
likely to cause programs to fail when they don't need to.


I'd be surprised if fork and exec worked that way. After a fork the two
processes share the same physical pages (see the notes on fork()
manpage), and overcommit applies to physical ram, not virtual.


No, Overcommit says that you can have more virtual RAM than physical RAM + swap. 
That's what overcommit is.


So when you fork a process, it takes double the memory with overcommit off than 
it does with overcommit on.



And unlike desktops, you can't just say "allocate a lot of swap" to
cover this up.


The same argument works the other way as well. A process using more
memory than the available in the router will force some other
(arbitrary) process to be killed. Unlike desktops you can't just say
"allocate a lot of swap" to cover this up.

What you _can_ do, is tell to the process that uses more memory than the
existing one, that there is no memory left.


But turning overcommit off doesn't tell a process that uses more memory than the 
existing one that there is no memory left, it tells the first process that tries 
to allocate memory after it runs out that there is no memory left.


This could be the process that's using an unusual amount of memory, or it could 
be sshd allocating a buffer to use to log.


Even if it gets the right process, you are assuming that the programs properly 
check for errors after anything that allocates memory. This is very commonly not 
the case, so you still get random failures.


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


[OpenWrt-Devel] [PATCH] This patch adds support for Tenda A6 device.

2014-09-20 Thread agusti
From: Agustí Moll 

---
 target/linux/ramips/base-files/etc/board.d/02_network  |6 ++
 target/linux/ramips/base-files/lib/ramips.sh   |3 +++
 target/linux/ramips/base-files/lib/upgrade/platform.sh |1 +
 target/linux/ramips/image/Makefile |3 +++
 target/linux/ramips/rt305x/profiles/tenda.mk   |   12 
 5 files changed, 25 insertions(+)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index e027b3b..3cca281 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -128,6 +128,12 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch0" "2" "0 6t"
;;
 
+   a6)
+   ucidef_set_interface_lan "eth0.1"
+   ucidef_add_switch "switch0" "1" "1"
+   ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
+   ;;
+
ur-336un)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index bb42ace..77926e3 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -277,6 +277,9 @@ ramips_board_detect() {
*"Tenda W150M")
name="w150m"
;;
+   *"Tenda A6")
+   name="a6"
+   ;;
*"TEW-691GR")
name="tew-691gr"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 407c218..323d7d7 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -18,6 +18,7 @@ platform_check_image() {
3g-6200nl | \
3g300m | \
w150m | \
+   a6 | \
air3gii | \
all0239-3g | \
all0256n | \
diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 35057e4..be65028 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -560,8 +560,11 @@ Image/Build/Profile/X8=$(call 
BuildFirmware/Poray8M/$(1),$(1),x8,X8)
 
 Image/Build/Profile/XDXRN502J=$(call 
BuildFirmware/Default4M/$(1),$(1),xdxrn502j,XDXRN502J)
 
+Image/Build/Profile/A6=$(call BuildFirmware/Default4M/$(1),$(1),a6,A6)
+
 ifeq ($(SUBTARGET),rt305x)
 define Image/Build/Profile/Default
+   $(call Image/Build/Profile/A6,$(1))
$(call Image/Build/Profile/3G6200N,$(1))
$(call Image/Build/Profile/3G6200NL,$(1))
$(call Image/Build/Profile/3G300M,$(1))
diff --git a/target/linux/ramips/rt305x/profiles/tenda.mk 
b/target/linux/ramips/rt305x/profiles/tenda.mk
index d9d94cf..d0ee8e4 100644
--- a/target/linux/ramips/rt305x/profiles/tenda.mk
+++ b/target/linux/ramips/rt305x/profiles/tenda.mk
@@ -28,3 +28,15 @@ define Profile/W306R_V20/Description
 endef
 
 $(eval $(call Profile,W306R_V20))
+
+define Profile/A6
+   NAME:=Tenda A6
+   PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev \
+   kmod-i2c-core kmod-i2c-gpio
+endef
+
+define Profile/A6/Description
+   Package set for Tenda A6
+endef
+
+$(eval $(call Profile,A6))
\ No newline at end of file
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] ramips: add support for Tenda A6

2014-09-20 Thread agusti
This patch adds support for Tenda A6 device.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] overcommit memory/ratio

2014-09-20 Thread Nikos Mavrogiannopoulos
On Fri, 2014-09-19 at 18:39 -0700, David Lang wrote

> > Well being used to something bad, doesn't mean things cannot get better.
> > Routers (to which I have some experience at), rarely have processes
> > running that wouldn't matter if they are randomly killed; on a desktop
> > system you immediately notice an issue, and you can reboot, a router is
> > typically running unattended. Being locked out of such a system because
> > another process had a memory leak, can be an issue.
> 
> Turning off overcommit so that a program that wants to spawn a child will end 
> up 
> requiring double it's memory (for the time between the fork and the exec) is 
> likely to cause programs to fail when they don't need to.

I'd be surprised if fork and exec worked that way. After a fork the two
processes share the same physical pages (see the notes on fork()
manpage), and overcommit applies to physical ram, not virtual.

> And unlike desktops, you can't just say "allocate a lot of swap" to
> cover this up.

The same argument works the other way as well. A process using more
memory than the available in the router will force some other
(arbitrary) process to be killed. Unlike desktops you can't just say
"allocate a lot of swap" to cover this up.

What you _can_ do, is tell to the process that uses more memory than the
existing one, that there is no memory left.

> In spite of what some people say, it's far from a clear-cut win to
> disable overcommit.

I don't think anyone claims that.

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