Netdev List
 help / color / mirror / Atom feed
* Re: bonding xmit_policy
From: Simon Chen @ 2011-11-15  6:20 UTC (permalink / raw)
  To: Nicolas de Pesloüan; +Cc: netdev
In-Reply-To: <4EC0280A.3060100@gmail.com>

Thanks, my bad.

It is pretty strange that when I use 802.3ad mode, all my packets
(from different TCP flows) egress the same NIC even though I choose
xmit_policy to be layer3+4. That's why I wasn't quite sure whether the
policy is indeed in place.

When I switch to balance-xor mode, the packets are roughly evenly
distributed across two NICs.

-Simon

On Sun, Nov 13, 2011 at 3:26 PM, Nicolas de Pesloüan
<nicolas.2p.debian@gmail.com> wrote:
> Le 13/11/2011 03:55, Simon Chen a écrit :
>>
>> Hi folks,
>>
>> It looks like that there are three entries in xmit_policy (hashing for
>> deciding egress phy int) for bonded interfaces:
>>
>> const struct bond_parm_tbl xmit_hashtype_tbl[] = {
>> {       "layer2",               BOND_XMIT_POLICY_LAYER2},
>> {       "layer3+4",             BOND_XMIT_POLICY_LAYER34},
>> {       "layer2+3",             BOND_XMIT_POLICY_LAYER23},
>> {       NULL,                   -1},
>> };
>>
>>
>> We can set the xmit_policy either at module initiation, or later via
>> /sys. However, this xmit_policy isn't really read anywhere. Are
>> different policies really implemented?
>
> The table is used in two different locations:
>
> In drivers/net/bonding/bond_main.c:
>
>        xmit_hashtype = bond_parse_parm(xmit_hash_policy, xmit_hashtype_tbl);
>        [...]
>        params->xmit_policy = xmit_hashtype;
>
> In drivers/net/bonding/bond_sysfs.c:
>
>        new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
>        [...]
>        bonds->params.xmit_policy = new_value;
>
> Then, in drivers/net/bonding/bond_main.c, the value in
> bonds->params.xmit_policy is used to setup a callback into
> bond->xmit_hash_policy.
>
>        static void bond_set_xmit_hash_policy(struct bonding *bond)
>        {
>                switch (bond->params.xmit_policy) {
>                case BOND_XMIT_POLICY_LAYER23:
>                        bond->xmit_hash_policy = bond_xmit_hash_policy_l23;
>                        break;
>                case BOND_XMIT_POLICY_LAYER34:
>                        bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
>                        break;
>                case BOND_XMIT_POLICY_LAYER2:
>                default:
>                        bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
>                        break;
>                }
>        }
>
> Then, in drivers/net/bonding/bond_3ad.c and in
> drivers/net/bonding/bond_main.c, the callback is used to select a slave for
> xmit, for the two modes where xmit_hash_policy have a meaning:
>
>        slave_agg_no = bond->xmit_hash_policy(skb, slaves_in_agg);
>
>        slave_no = bond->xmit_hash_policy(skb, bond->slave_cnt);
>
>
> So, yes, those policies are really implemented.
>
>        Nicolas.
>

^ permalink raw reply

* Re: [PATCH] ipv4: fix for ip_options_rcv_srr() daddr update.
From: David Miller @ 2011-11-15  6:35 UTC (permalink / raw)
  To: lw; +Cc: netdev
In-Reply-To: <4EC1FB5D.80705@cn.fujitsu.com>

From: Li Wei <lw@cn.fujitsu.com>
Date: Tue, 15 Nov 2011 13:40:45 +0800

> These days i am doing some ICMP tests and sadly found that wen can't update
> iph->daddr in ip_options_rcv_srr(), It's too early. When some exception
> ocurred later (eg. in ip_forward() when goto sr_failed) we need the ip header
> be identical to the original one as ICMP need it.
> 
> It seems we need rt->rt_dst in ip_forward_options() and ip_forward() instead
> of iph->daddr.

An alternative is to store the calculated destination address somewhere
in the IPCB(skb).

^ permalink raw reply

* [PATCH V4 00/14] add clk_prepare/clk_unprepare to imx drivers
From: Richard Zhao @ 2011-11-15  6:47 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
	richard.zhao

Changes since V3:
 - add more comments

Changes since V2:
 - fix clk_prepare_enable bug

Changes since V1:
 - Add common helper functions clk_prepare_enable/clk_disable_unprepare
 - serial/imx: move clk_disable_unprepare before clk_put


Richard Zhao (14):
      clk: add helper functions clk_prepare_enable and clk_disable_unprepare
      ARM: mxc: time: add clk_prepare/clk_unprepare
      ARM: mxc: ahci: add clk_prepare/clk_unprepare
      ARM: mxc: pwm: add clk_prepare/clk_unprepare
      ARM: mxc: epit: add clk_prepare/clk_unprepare
      ARM: mxc: arch_reset: add clk_prepare/clk_unprepare
      ARM: mxc: audmux-v2: add clk_prepare/clk_unprepare
      ARM: pm-imx5: add clk_prepare/clk_unprepare
      ARM: mx31moboard: add clk_prepare/clk_unprepare
      ARM: mxs: add clk_prepare/clk_unprepare
      serial: imx: add clk_prepare/clk_unprepare
      net: fec: add clk_prepare/clk_unprepare
      i2c: imx: add clk_prepare/clk_unprepare
      mmc: sdhci-esdhc-imx: add clk_prepare/clk_unprepare

 arch/arm/mach-imx/mach-mx31moboard.c          |    2 +-
 arch/arm/mach-mx5/pm-imx5.c                   |    4 ++--
 arch/arm/mach-mxs/system.c                    |    2 +-
 arch/arm/mach-mxs/timer.c                     |    2 +-
 arch/arm/plat-mxc/audmux-v2.c                 |    8 ++++----
 arch/arm/plat-mxc/devices/platform-ahci-imx.c |   16 ++++++++--------
 arch/arm/plat-mxc/epit.c                      |    2 +-
 arch/arm/plat-mxc/pwm.c                       |    4 ++--
 arch/arm/plat-mxc/system.c                    |    2 +-
 arch/arm/plat-mxc/time.c                      |    2 +-
 drivers/i2c/busses/i2c-imx.c                  |    4 ++--
 drivers/mmc/host/sdhci-esdhc-imx.c            |    6 +++---
 drivers/net/ethernet/freescale/fec.c          |   10 +++++-----
 drivers/tty/serial/imx.c                      |    7 +++----
 include/linux/clk.h                           |   22 ++++++++++++++++++++++
 15 files changed, 57 insertions(+), 36 deletions(-)


Thanks
Richard



^ permalink raw reply

* [PATCH V4 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare
From: Richard Zhao @ 2011-11-15  6:47 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
	richard.zhao
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao@linaro.org>

It's for migrating to generic clk framework API.

The helper functions  help cases clk_enable/clk_disable is used
in non-atomic context.
For example, Call clk_enable in probe and clk_disable in remove.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 include/linux/clk.h |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/linux/clk.h b/include/linux/clk.h
index 7213b52..b9d46fa 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -107,6 +107,28 @@ static inline void clk_unprepare(struct clk *clk)
 }
 #endif
 
+/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
+static inline int clk_prepare_enable(struct clk *clk)
+{
+	int ret;
+
+	ret = clk_prepare(clk);
+	if (ret)
+		return ret;
+	ret = clk_enable(clk);
+	if (ret)
+		clk_unprepare(clk);
+
+	return ret;
+}
+
+/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
+static inline void clk_disable_unprepare(struct clk *clk)
+{
+	clk_disable(clk);
+	clk_unprepare(clk);
+}
+
 /**
  * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
  *		  This is only valid once the clock source has been enabled.
-- 
1.7.5.4



^ permalink raw reply related

* [PATCH V4 02/14] ARM: mxc: time: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:47 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
	richard.zhao
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao@linaro.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/time.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 4b0fe28..b4e8b18 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -292,7 +292,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
 {
 	uint32_t tctl_val;
 
-	clk_enable(timer_clk);
+	clk_prepare_enable(timer_clk);
 
 	timer_base = base;
 
-- 
1.7.5.4



^ permalink raw reply related

* [PATCH V4 03/14] ARM: mxc: ahci: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:47 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: amit.kucheria, linux, kernel, eric.miao, ben-linux, cjb,
	richard.zhao, alan
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao@linaro.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/devices/platform-ahci-imx.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/plat-mxc/devices/platform-ahci-imx.c b/arch/arm/plat-mxc/devices/platform-ahci-imx.c
index d8a56ae..ade4a1c 100644
--- a/arch/arm/plat-mxc/devices/platform-ahci-imx.c
+++ b/arch/arm/plat-mxc/devices/platform-ahci-imx.c
@@ -60,9 +60,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
 		dev_err(dev, "no sata clock.\n");
 		return PTR_ERR(sata_clk);
 	}
-	ret = clk_enable(sata_clk);
+	ret = clk_prepare_enable(sata_clk);
 	if (ret) {
-		dev_err(dev, "can't enable sata clock.\n");
+		dev_err(dev, "can't prepare/enable sata clock.\n");
 		goto put_sata_clk;
 	}
 
@@ -73,9 +73,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
 		ret = PTR_ERR(sata_ref_clk);
 		goto release_sata_clk;
 	}
-	ret = clk_enable(sata_ref_clk);
+	ret = clk_prepare_enable(sata_ref_clk);
 	if (ret) {
-		dev_err(dev, "can't enable sata ref clock.\n");
+		dev_err(dev, "can't prepare/enable sata ref clock.\n");
 		goto put_sata_ref_clk;
 	}
 
@@ -104,11 +104,11 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
 	return 0;
 
 release_sata_ref_clk:
-	clk_disable(sata_ref_clk);
+	clk_disable_unprepare(sata_ref_clk);
 put_sata_ref_clk:
 	clk_put(sata_ref_clk);
 release_sata_clk:
-	clk_disable(sata_clk);
+	clk_disable_unprepare(sata_clk);
 put_sata_clk:
 	clk_put(sata_clk);
 
@@ -117,10 +117,10 @@ put_sata_clk:
 
 static void imx_sata_exit(struct device *dev)
 {
-	clk_disable(sata_ref_clk);
+	clk_disable_unprepare(sata_ref_clk);
 	clk_put(sata_ref_clk);
 
-	clk_disable(sata_clk);
+	clk_disable_unprepare(sata_clk);
 	clk_put(sata_clk);
 
 }
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH V4 04/14] ARM: mxc: pwm: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:47 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
	amit.kucheria-Z7WLFzj8eWMS+FvcfC7Uqw,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	cjb-2X9k7bc8m7Mdnm+yROfE0A, alan-VuQAYsv1563Yd54FQh9/CA,
	eric.miao-QSEj5FYQhm4dnm+yROfE0A,
	richard.zhao-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 arch/arm/plat-mxc/pwm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index 42d74ea..68c7199b 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -118,7 +118,7 @@ int pwm_enable(struct pwm_device *pwm)
 	int rc = 0;
 
 	if (!pwm->clk_enabled) {
-		rc = clk_enable(pwm->clk);
+		rc = clk_prepare_enable(pwm->clk);
 		if (!rc)
 			pwm->clk_enabled = 1;
 	}
@@ -131,7 +131,7 @@ void pwm_disable(struct pwm_device *pwm)
 	writel(0, pwm->mmio_base + MX3_PWMCR);
 
 	if (pwm->clk_enabled) {
-		clk_disable(pwm->clk);
+		clk_disable_unprepare(pwm->clk);
 		pwm->clk_enabled = 0;
 	}
 }
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH V4 06/14] ARM: mxc: arch_reset: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
	amit.kucheria-Z7WLFzj8eWMS+FvcfC7Uqw,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	cjb-2X9k7bc8m7Mdnm+yROfE0A, alan-VuQAYsv1563Yd54FQh9/CA,
	eric.miao-QSEj5FYQhm4dnm+yROfE0A,
	richard.zhao-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 arch/arm/plat-mxc/system.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index 9dad8dc..a667adc 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -54,7 +54,7 @@ void arch_reset(char mode, const char *cmd)
 
 		clk = clk_get_sys("imx2-wdt.0", NULL);
 		if (!IS_ERR(clk))
-			clk_enable(clk);
+			clk_prepare_enable(clk);
 		wcr_enable = (1 << 2);
 	}
 
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH V4 07/14] ARM: mxc: audmux-v2: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
	amit.kucheria-Z7WLFzj8eWMS+FvcfC7Uqw,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	cjb-2X9k7bc8m7Mdnm+yROfE0A, alan-VuQAYsv1563Yd54FQh9/CA,
	eric.miao-QSEj5FYQhm4dnm+yROfE0A,
	richard.zhao-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 arch/arm/plat-mxc/audmux-v2.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index 8cced35..0e51fc3 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -73,13 +73,13 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
 		return -ENOMEM;
 
 	if (audmux_clk)
-		clk_enable(audmux_clk);
+		clk_prepare_enable(audmux_clk);
 
 	ptcr = readl(audmux_base + MXC_AUDMUX_V2_PTCR(port));
 	pdcr = readl(audmux_base + MXC_AUDMUX_V2_PDCR(port));
 
 	if (audmux_clk)
-		clk_disable(audmux_clk);
+		clk_disable_unprepare(audmux_clk);
 
 	ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
 		       pdcr, ptcr);
@@ -172,13 +172,13 @@ int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
 		return -ENOSYS;
 
 	if (audmux_clk)
-		clk_enable(audmux_clk);
+		clk_prepare_enable(audmux_clk);
 
 	writel(ptcr, audmux_base + MXC_AUDMUX_V2_PTCR(port));
 	writel(pdcr, audmux_base + MXC_AUDMUX_V2_PDCR(port));
 
 	if (audmux_clk)
-		clk_disable(audmux_clk);
+		clk_disable_unprepare(audmux_clk);
 
 	return 0;
 }
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH V4 08/14] ARM: pm-imx5: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
	richard.zhao
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao@linaro.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/mach-mx5/pm-imx5.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mx5/pm-imx5.c b/arch/arm/mach-mx5/pm-imx5.c
index 98052fc..2bdc85f 100644
--- a/arch/arm/mach-mx5/pm-imx5.c
+++ b/arch/arm/mach-mx5/pm-imx5.c
@@ -22,7 +22,7 @@ static struct clk *gpc_dvfs_clk;
 
 static int mx5_suspend_prepare(void)
 {
-	return clk_enable(gpc_dvfs_clk);
+	return clk_prepare_enable(gpc_dvfs_clk);
 }
 
 static int mx5_suspend_enter(suspend_state_t state)
@@ -52,7 +52,7 @@ static int mx5_suspend_enter(suspend_state_t state)
 
 static void mx5_suspend_finish(void)
 {
-	clk_disable(gpc_dvfs_clk);
+	clk_disable_unprepare(gpc_dvfs_clk);
 }
 
 static int mx5_pm_valid(suspend_state_t state)
-- 
1.7.5.4



^ permalink raw reply related

* [PATCH V4 09/14] ARM: mx31moboard: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
	richard.zhao
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao@linaro.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/mach-imx/mach-mx31moboard.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 07034f4..d1a9337 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -505,7 +505,7 @@ static void mx31moboard_poweroff(void)
 	struct clk *clk = clk_get_sys("imx2-wdt.0", NULL);
 
 	if (!IS_ERR(clk))
-		clk_enable(clk);
+		clk_prepare_enable(clk);
 
 	mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST);
 
-- 
1.7.5.4



^ permalink raw reply related

* [PATCH V4 10/14] ARM: mxs: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
	amit.kucheria-Z7WLFzj8eWMS+FvcfC7Uqw,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	cjb-2X9k7bc8m7Mdnm+yROfE0A, alan-VuQAYsv1563Yd54FQh9/CA,
	eric.miao-QSEj5FYQhm4dnm+yROfE0A,
	richard.zhao-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 arch/arm/mach-mxs/system.c |    2 +-
 arch/arm/mach-mxs/timer.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
index 20ec3bd..9760a12 100644
--- a/arch/arm/mach-mxs/system.c
+++ b/arch/arm/mach-mxs/system.c
@@ -66,7 +66,7 @@ static int __init mxs_arch_reset_init(void)
 
 	clk = clk_get_sys("rtc", NULL);
 	if (!IS_ERR(clk))
-		clk_enable(clk);
+		clk_prepare_enable(clk);
 
 	return 0;
 }
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index cace0d2..564a632 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -245,7 +245,7 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
 
 void __init mxs_timer_init(struct clk *timer_clk, int irq)
 {
-	clk_enable(timer_clk);
+	clk_prepare_enable(timer_clk);
 
 	/*
 	 * Initialize timers to a known state
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH V4 11/14] serial: imx: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
	richard.zhao
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao@linaro.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 drivers/tty/serial/imx.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 163fc90..8f3709f 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1390,7 +1390,7 @@ static int serial_imx_probe(struct platform_device *pdev)
 		ret = PTR_ERR(sport->clk);
 		goto unmap;
 	}
-	clk_enable(sport->clk);
+	clk_prepare_enable(sport->clk);
 
 	sport->port.uartclk = clk_get_rate(sport->clk);
 
@@ -1413,8 +1413,8 @@ deinit:
 	if (pdata && pdata->exit)
 		pdata->exit(pdev);
 clkput:
+	clk_disable_unprepare(sport->clk);
 	clk_put(sport->clk);
-	clk_disable(sport->clk);
 unmap:
 	iounmap(sport->port.membase);
 free:
@@ -1434,11 +1434,10 @@ static int serial_imx_remove(struct platform_device *pdev)
 
 	if (sport) {
 		uart_remove_one_port(&imx_reg, &sport->port);
+		clk_disable_unprepare(sport->clk);
 		clk_put(sport->clk);
 	}
 
-	clk_disable(sport->clk);
-
 	if (pdata && pdata->exit)
 		pdata->exit(pdev);
 
-- 
1.7.5.4



^ permalink raw reply related

* [PATCH V4 12/14] net: fec: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
	richard.zhao
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao@linaro.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 drivers/net/ethernet/freescale/fec.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 1124ce0..e96fa44 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1588,7 +1588,7 @@ fec_probe(struct platform_device *pdev)
 		ret = PTR_ERR(fep->clk);
 		goto failed_clk;
 	}
-	clk_enable(fep->clk);
+	clk_prepare_enable(fep->clk);
 
 	ret = fec_enet_init(ndev);
 	if (ret)
@@ -1611,7 +1611,7 @@ failed_register:
 	fec_enet_mii_remove(fep);
 failed_mii_init:
 failed_init:
-	clk_disable(fep->clk);
+	clk_disable_unprepare(fep->clk);
 	clk_put(fep->clk);
 failed_clk:
 	for (i = 0; i < FEC_IRQ_NUM; i++) {
@@ -1638,7 +1638,7 @@ fec_drv_remove(struct platform_device *pdev)
 
 	fec_stop(ndev);
 	fec_enet_mii_remove(fep);
-	clk_disable(fep->clk);
+	clk_disable_unprepare(fep->clk);
 	clk_put(fep->clk);
 	iounmap(fep->hwp);
 	unregister_netdev(ndev);
@@ -1664,7 +1664,7 @@ fec_suspend(struct device *dev)
 		fec_stop(ndev);
 		netif_device_detach(ndev);
 	}
-	clk_disable(fep->clk);
+	clk_disable_unprepare(fep->clk);
 
 	return 0;
 }
@@ -1675,7 +1675,7 @@ fec_resume(struct device *dev)
 	struct net_device *ndev = dev_get_drvdata(dev);
 	struct fec_enet_private *fep = netdev_priv(ndev);
 
-	clk_enable(fep->clk);
+	clk_prepare_enable(fep->clk);
 	if (netif_running(ndev)) {
 		fec_restart(ndev, fep->full_duplex);
 		netif_device_attach(ndev);
-- 
1.7.5.4



^ permalink raw reply related

* [PATCH V4 14/14] mmc: sdhci-esdhc-imx: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
	amit.kucheria-Z7WLFzj8eWMS+FvcfC7Uqw,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	cjb-2X9k7bc8m7Mdnm+yROfE0A, alan-VuQAYsv1563Yd54FQh9/CA,
	eric.miao-QSEj5FYQhm4dnm+yROfE0A,
	richard.zhao-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index ae57769..f1ae37e 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -462,7 +462,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		err = PTR_ERR(clk);
 		goto err_clk_get;
 	}
-	clk_enable(clk);
+	clk_prepare_enable(clk);
 	pltfm_host->clk = clk;
 
 	if (!is_imx25_esdhc(imx_data))
@@ -550,7 +550,7 @@ no_card_detect_irq:
 		gpio_free(boarddata->wp_gpio);
 no_card_detect_pin:
 no_board_data:
-	clk_disable(pltfm_host->clk);
+	clk_disable_unprepare(pltfm_host->clk);
 	clk_put(pltfm_host->clk);
 err_clk_get:
 	kfree(imx_data);
@@ -577,7 +577,7 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev)
 		gpio_free(boarddata->cd_gpio);
 	}
 
-	clk_disable(pltfm_host->clk);
+	clk_disable_unprepare(pltfm_host->clk);
 	clk_put(pltfm_host->clk);
 	kfree(imx_data);
 
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH V4 05/14] ARM: mxc: epit: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
	richard.zhao
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao@linaro.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/epit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/plat-mxc/epit.c
index d3467f8..9129c9e 100644
--- a/arch/arm/plat-mxc/epit.c
+++ b/arch/arm/plat-mxc/epit.c
@@ -203,7 +203,7 @@ static int __init epit_clockevent_init(struct clk *timer_clk)
 
 void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
 {
-	clk_enable(timer_clk);
+	clk_prepare_enable(timer_clk);
 
 	timer_base = base;
 
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH V4 13/14] i2c: imx: add clk_prepare/clk_unprepare
From: Richard Zhao @ 2011-11-15  6:48 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
  Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
	richard.zhao
In-Reply-To: <1321339689-25256-1-git-send-email-richard.zhao@linaro.org>

It's for migrating to generic clk framework API.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 drivers/i2c/busses/i2c-imx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 58832e5..8d1ab6f 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -196,7 +196,7 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx)
 
 	dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
 
-	clk_enable(i2c_imx->clk);
+	clk_prepare_enable(i2c_imx->clk);
 	writeb(i2c_imx->ifdr, i2c_imx->base + IMX_I2C_IFDR);
 	/* Enable I2C controller */
 	writeb(0, i2c_imx->base + IMX_I2C_I2SR);
@@ -245,7 +245,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
 
 	/* Disable I2C controller */
 	writeb(0, i2c_imx->base + IMX_I2C_I2CR);
-	clk_disable(i2c_imx->clk);
+	clk_disable_unprepare(i2c_imx->clk);
 }
 
 static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
-- 
1.7.5.4

^ permalink raw reply related

* Re: bonding xmit_policy
From: Eric Dumazet @ 2011-11-15  7:12 UTC (permalink / raw)
  To: Simon Chen; +Cc: Nicolas de Pesloüan, netdev
In-Reply-To: <CANj2EbfM+5+AFYkU+erMZBtf0cCXkoDGRrXLGQFHYVL_6qvWFw@mail.gmail.com>

Le mardi 15 novembre 2011 à 01:20 -0500, Simon Chen a écrit :
> Thanks, my bad.
> 
> It is pretty strange that when I use 802.3ad mode, all my packets
> (from different TCP flows) egress the same NIC even though I choose
> xmit_policy to be layer3+4. That's why I wasn't quite sure whether the
> policy is indeed in place.
> 
> When I switch to balance-xor mode, the packets are roughly evenly
> distributed across two NICs.

AFAIK, layer4 information (soure/dst ports) is limited to ipv4 TCP/UDP
trafic.

Moreover, if your bond has 2 ports, only low order bit of source and dst
port is used.

layer4_xor = ntohs((*layer4hdr ^ *(layer4hdr + 1)));

So if your trafic is RTP, it probably use only even ports, (RTCP using
odd ports), and uses a single slave.

 

^ permalink raw reply

* Re: [PATCH] ipv4: fix for ip_options_rcv_srr() daddr update.
From: Li Wei @ 2011-11-15  7:26 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20111115.013527.2095109012737872896.davem@davemloft.net>

> From: Li Wei <lw@cn.fujitsu.com>
> Date: Tue, 15 Nov 2011 13:40:45 +0800
> 
>> These days i am doing some ICMP tests and sadly found that wen can't update
>> iph->daddr in ip_options_rcv_srr(), It's too early. When some exception
>> ocurred later (eg. in ip_forward() when goto sr_failed) we need the ip header
>> be identical to the original one as ICMP need it.
>>
>> It seems we need rt->rt_dst in ip_forward_options() and ip_forward() instead
>> of iph->daddr.
> 
> An alternative is to store the calculated destination address somewhere
> in the IPCB(skb).
> 
> 

You mean modify struct inet_skb_parm add some field to store the calculated 
destination address?

My question, in ip_forward() and ip_forward_options() rt is there, why not
we just use it?

^ permalink raw reply

* Re: [PATCH] ipv4: fix for ip_options_rcv_srr() daddr update.
From: David Miller @ 2011-11-15  7:28 UTC (permalink / raw)
  To: lw; +Cc: netdev
In-Reply-To: <4EC21427.9080008@cn.fujitsu.com>

From: Li Wei <lw@cn.fujitsu.com>
Date: Tue, 15 Nov 2011 15:26:31 +0800

> My question, in ip_forward() and ip_forward_options() rt is there, why not
> we just use it?

Because I'm trying to eliminate all accesses to rt->rt_dst because
when I remove the routing cache, routes will be shared.  One 'rt'
will refer to many specific destination addresses.

^ permalink raw reply

* Re: [PATCH] ipv4: fix for ip_options_rcv_srr() daddr update.
From: Li Wei @ 2011-11-15  7:51 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20111115.022835.551127337110017182.davem@davemloft.net>

> From: Li Wei <lw@cn.fujitsu.com>
> Date: Tue, 15 Nov 2011 15:26:31 +0800
> 
>> My question, in ip_forward() and ip_forward_options() rt is there, why not
>> we just use it?
> 
> Because I'm trying to eliminate all accesses to rt->rt_dst because
> when I remove the routing cache, routes will be shared.  One 'rt'
> will refer to many specific destination addresses.
> 
> 
Sorry, I can't understand what you said, can you make it more clear?

I think in ip_forward(), we need 'rt' to forward skb, until this skb has been 
forwarded we hold a reference to it in skb, We can use rt->rt_dst safely, It
is an ordinary __be32 not a reference.

^ permalink raw reply

* Re: [PATCH] ipv4: fix for ip_options_rcv_srr() daddr update.
From: David Miller @ 2011-11-15  8:23 UTC (permalink / raw)
  To: lw; +Cc: netdev
In-Reply-To: <4EC21A01.90702@cn.fujitsu.com>

From: Li Wei <lw@cn.fujitsu.com>
Date: Tue, 15 Nov 2011 15:51:29 +0800

>> From: Li Wei <lw@cn.fujitsu.com>
>> Date: Tue, 15 Nov 2011 15:26:31 +0800
>> 
>>> My question, in ip_forward() and ip_forward_options() rt is there, why not
>>> we just use it?
>> 
>> Because I'm trying to eliminate all accesses to rt->rt_dst because
>> when I remove the routing cache, routes will be shared.  One 'rt'
>> will refer to many specific destination addresses.
>> 
>> 
> Sorry, I can't understand what you said, can you make it more clear?
> 
> I think in ip_forward(), we need 'rt' to forward skb, until this skb has been 
> forwarded we hold a reference to it in skb, We can use rt->rt_dst safely, It
> is an ordinary __be32 not a reference.

My long term plan is to eliminate cached routes, we will directly use
routing table entries instead.

In such a scheme, the member rt->rt_dst will no longer even exist.

This is what I've been working towards for more than a year, it is a
slow and very difficult transformation.

If you starting adding rt->rt_dst references back, we are taking
steps backwards.

^ permalink raw reply

* Re: [PATCH] ipv4: fix for ip_options_rcv_srr() daddr update.
From: Li Wei @ 2011-11-15  8:29 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20111115.032343.1203870624086709786.davem@davemloft.net>

> My long term plan is to eliminate cached routes, we will directly use
> routing table entries instead.
> 
> In such a scheme, the member rt->rt_dst will no longer even exist.
> 
> This is what I've been working towards for more than a year, it is a
> slow and very difficult transformation.
> 
> If you starting adding rt->rt_dst references back, we are taking
> steps backwards.
> 
> 

Thank you, I got it. 

I'll do my best to fix it but without any promise, because i am a kernel
newbie :D

^ permalink raw reply

* [PATCH] vlan:return error when real dev is enslaved
From: Weiping Pan @ 2011-11-15  8:36 UTC (permalink / raw)
  Cc: Weiping Pan, Patrick McHardy, David S. Miller,
	open list:VLAN (802.1Q), open list

Qinhuibin reported a kernel panic when he do some operation about vlan.
https://lkml.org/lkml/2011/11/6/218

The operation is as below:
ifconfig eth2 up
modprobe bonding
modprobe 8021q
ifconfig bond0 up
ifenslave bond0 eth2
vconfig add eth2 3300
vconfig add bond0 33
vconfig rem eth2.3300

the panic stack is as below:
[<ffffffffa002f1c9>] panic_event+0x49/0x70 [ipmi_msghandler]
[<ffffffff80378917>] notifier_call_chain+0x37/0x70
[<ffffffff80372122>] panic+0xa2/0x195
[<ffffffff80376ed8>] oops_end+0xd8/0x140
[<ffffffff8001bea7>] no_context+0xf7/0x280
[<ffffffff8001c1a5>] __bad_area_nosemaphore+0x175/0x250
[<ffffffff80376318>] page_fault+0x28/0x30
[<ffffffffa039dabd>] igb_vlan_rx_kill_vid+0x4d/0x100 [igb]
[<ffffffffa044045f>] bond_vlan_rx_kill_vid+0x9f/0x290 [bonding]
[<ffffffffa047e636>] unregister_vlan_dev+0x136/0x180 [8021q]
[<ffffffffa047ed20>] vlan_ioctl_handler+0x170/0x3f0 [8021q]
[<ffffffff802c1d3f>] sock_ioctl+0x21f/0x280
[<ffffffff800e6d7f>] vfs_ioctl+0x2f/0xb0
[<ffffffff800e726b>] do_vfs_ioctl+0x3cb/0x5a0
[<ffffffff800e74e1>] sys_ioctl+0xa1/0xb0
[<ffffffff80007388>] system_call_fastpath+0x16/0x1b
[<00007f108a2b8bd7>] 0x7f108a2b8bd7
And the nic is as below:
[root@localhost ~]# ethtool -i eth2
driver: igb
version: 3.0.6-k2
firmware-version: 1.2-1
bus-info: 0000:04:00.0
kernel version:
2.6.32.12-0.7 also happen in 2.6.32-131

For kernel 2.6.32, the reason of this bug is that when we do "vconfig add bond0 33",
adapter->vlgrp is overwritten in igb_vlan_rx_register. So when we do "vconfig rem
eth2.3300", it can't find the correct vlgrp.

And this bug is avoided by vlan cleanup patchset from Jiri Pirko
<jpirko@redhat.com>, especially commit b2cb09b1a772(igb: do vlan cleanup).

But it is not a correct operation to creat a vlan interface on eth2
when it have been enslaved by bond0, so this patch is to return error
when the real dev is already enslaved.

Signed-off-by: Weiping Pan <wpan@redhat.com>
---
 net/8021q/vlan.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 5471628..8ba9226 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -148,6 +148,11 @@ int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id)
 	const char *name = real_dev->name;
 	const struct net_device_ops *ops = real_dev->netdev_ops;
 
+	if (real_dev->flags & IFF_SLAVE) {
+		pr_info("Error, %s was already enslaved\n", name);
+		return -EOPNOTSUPP;
+	}
+
 	if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
 		pr_info("VLANs not supported on %s\n", name);
 		return -EOPNOTSUPP;
-- 
1.7.4

^ permalink raw reply related

* Re: [PATCH] vlan:return error when real dev is enslaved
From: Américo Wang @ 2011-11-15  8:46 UTC (permalink / raw)
  To: Weiping Pan
  Cc: Patrick McHardy, David S. Miller, open list:VLAN (802.1Q),
	open list
In-Reply-To: <c897fa89d5ea94c6624e8cdab9787aa83526f994.1321343212.git.wpan@redhat.com>

On Tue, Nov 15, 2011 at 4:36 PM, Weiping Pan <wpan@redhat.com> wrote:
> +       if (real_dev->flags & IFF_SLAVE) {
> +               pr_info("Error, %s was already enslaved\n", name);
> +               return -EOPNOTSUPP;
> +       }

Use pr_err() then.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox