Netdev List
 help / color / mirror / Atom feed
* RE: [PATCH] ath6kl: sdio: fix system panic when doing wifi stress test
From: Hui Liu @ 2013-11-29  6:02 UTC (permalink / raw)
  To: Kalle Valo
  Cc: linux-arm-kernel@lists.infradead.org, linville@tuxdriver.com,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, ath6kl-devel@qca.qualcomm.com
In-Reply-To: <87k3fvjvjg.fsf@kamboji.qca.qualcomm.com>

> -----Original Message-----
> From: Kalle Valo [mailto:kvalo@qca.qualcomm.com]
> Sent: Tuesday, November 26, 2013 6:40 PM
> To: Liu Hui-R64343
> Cc: linux-arm-kernel@lists.infradead.org; linville@tuxdriver.com; linux-
> wireless@vger.kernel.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; ath6kl-devel@qca.qualcomm.com
> Subject: Re: [PATCH] ath6kl: sdio: fix system panic when doing wifi
> stress test
> 
> Hi Jason,
> 
> Jason Liu <r64343@freescale.com> writes:
> 
> > When did the wifi iperf test, meet one following kernel panic:
> > command: iperf -c $TARGET_IP -i 5 -t 50 -w 1M
> >
> > Unable to handle kernel paging request at virtual address 1a480000 pgd
> > = 80004000 [1a480000] *pgd=00000000 Internal error: Oops: 805 [#1] SMP
> > ARM
> 
> [...]
> 
> > The kernel panic is caused by the sg_buf is not set correctly with the
> > following code when compiled with Yocto GCC 4.8.1:
> >
> > drivers/net/wireless/ath/ath6kl/hif.h:
> > struct hif_scatter_req {
> >         struct list_head list;
> >         /* address for the read/write operation */
> >         u32 addr;
> > 	...
> >
> >         /* bounce buffer for upper layers to copy to/from */
> >         u8 *virt_dma_buf;
> >
> >         struct hif_scatter_item scat_list[1];
> >
> >         u32 scat_q_depth;
> > };
> >
> > (Note: the scat_req.scat_list[] will dynamiclly grow with run-time)
> 
> There's actually a major bug right there, scat_list can corrupt
> scat_q_depth.
> 
> > The GCC 4.8.1 compiler will not do the for-loop till scat_entries,
> > instead, it only run one round loop. This may be caused by that the
> > GCC 4.8.1 thought that the scat_list only have one item and then no
> > need to do full iteration, but this is simply wrong by looking at the
> > assebly code. This will cause the sg buffer not get set when
> scat_entries > 1 and thus lead to kernel panic.
> >
> > This patch is a workaround to the GCC 4.8.1 complier issue by passing
> > the entry address of the scat_req->scat_list to the for-loop and
> > interate it, then, GCC 4.8.1 will do the full for-loop correctly.
> > (Note: This issue not observed with GCC 4.7.2, only found on the GCC
> > 4.8.1)
> >
> > This patch does not change any function logic and no any performance
> downgrade.
> 
> [...]
> 
> > +	scat_list = &scat_req->scat_list[0];
> > +
> >  	/* assemble SG list */
> > -	for (i = 0; i < scat_req->scat_entries; i++, sg++) {
> > +	for (i = 0; i < scat_req->scat_entries; i++, sg++, scat_list++) {
> >  		ath6kl_dbg(ATH6KL_DBG_SCATTER, "%d: addr:0x%p, len:%d\n",
> > -			   i, scat_req->scat_list[i].buf,
> > -			   scat_req->scat_list[i].len);
> > +			   i, scat_list->buf, scat_list->len);
> >
> > -		sg_set_buf(sg, scat_req->scat_list[i].buf,
> > -			   scat_req->scat_list[i].len);
> > +		sg_set_buf(sg, scat_list->buf, scat_list->len);
> >  	}
> 
> Working around the problem by adding a temporary variable makes me a bit
> worried, I would rather fix the root cause. Is the root cause by that we
> define the field with scat_list[1]?

Yes, this is what I assumed. 

> 
> Does the patch below help? It would also fix the corruption with
> scat_q_depth. Please note that I have only compile tested it. And I might
> have also missed something important, so please review it carefully.

Yes, Firstly, I have looked at the asm code and the compiler(gcc 4.8.1) works correctly after applying
the following patch. Secondly, I have tested the patch with compiler(gcc 4.8.1) on the real HW, and it
works fine too. Without the patch, the kernel crash will happen 100%.

Thus, for the patch:

Acked-by: Jason Liu <r64343@freescale.com>
Tested-by: Jason Liu <r64343@freescale.com>

Jason Liu

> 
> --- a/drivers/net/wireless/ath/ath6kl/hif.h
> +++ b/drivers/net/wireless/ath/ath6kl/hif.h
> @@ -197,9 +197,9 @@ struct hif_scatter_req {
>  	/* bounce buffer for upper layers to copy to/from */
>  	u8 *virt_dma_buf;
> 
> -	struct hif_scatter_item scat_list[1];
> -
>  	u32 scat_q_depth;
> +
> +	struct hif_scatter_item scat_list[0];
>  };
> 
>  struct ath6kl_irq_proc_registers {
> diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c
> b/drivers/net/wireless/ath/ath6kl/sdio.c
> index 7126bdd..6bf15a3 100644
> --- a/drivers/net/wireless/ath/ath6kl/sdio.c
> +++ b/drivers/net/wireless/ath/ath6kl/sdio.c
> @@ -348,7 +348,7 @@ static int ath6kl_sdio_alloc_prep_scat_req(struct
> ath6kl_sdio *ar_sdio,
>  	int i, scat_req_sz, scat_list_sz, size;
>  	u8 *virt_buf;
> 
> -	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
> +	scat_list_sz = n_scat_entry * sizeof(struct hif_scatter_item);
>  	scat_req_sz = sizeof(*s_req) + scat_list_sz;
> 
>  	if (!virt_scat)
> 
> 
> --
> Kalle Valo

^ permalink raw reply

* [PATCH 5/6][v3] phylib: Support attaching to generic 10g driver
From: shh.xie @ 2013-11-29  5:47 UTC (permalink / raw)
  To: davem, jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel
  Cc: Shaohui.Xie

From: Andy Fleming <afleming@freescale.com>

phy_attach_direct() may now attach to a generic 10G driver. It can
also be used exactly as phy_connect_direct(), which will be useful
when using of_mdio, as phy_connect (and therefore of_phy_connect)
start the PHY state machine, which is currently irrelevant for 10G
PHYs.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
---
v3 changes: use constant indices.

 drivers/net/phy/phy_device.c | 20 ++++++++------------
 include/linux/phy.h          |  2 ++
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 79142de..7fb9935 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -67,9 +67,6 @@ extern void mdio_bus_exit(void);
 static LIST_HEAD(phy_fixup_list);
 static DEFINE_MUTEX(phy_fixup_lock);
 
-static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
-			     u32 flags, phy_interface_t interface);
-
 /*
  * Creates a new phy_fixup and adds it to the list
  * @bus_id: A string which matches phydev->dev.bus_id (or PHY_ANY_ID)
@@ -527,12 +524,12 @@ int phy_init_hw(struct phy_device *phydev)
  *
  * Description: Called by drivers to attach to a particular PHY
  *     device. The phy_device is found, and properly hooked up
- *     to the phy_driver.  If no driver is attached, then the
- *     genphy_driver is used.  The phy_device is given a ptr to
+ *     to the phy_driver.  If no driver is attached, then a
+ *     generic driver is used.  The phy_device is given a ptr to
  *     the attaching device, and given a callback for link status
  *     change.  The phy_device is returned to the attaching driver.
  */
-static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
+int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
 			     u32 flags, phy_interface_t interface)
 {
 	struct device *d = &phydev->dev;
@@ -541,12 +538,10 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
 	/* Assume that if there is no driver, that it doesn't
 	 * exist, and we should use the genphy driver. */
 	if (NULL == d->driver) {
-		if (phydev->is_c45) {
-			pr_err("No driver for phy %x\n", phydev->phy_id);
-			return -ENODEV;
-		}
-
-		d->driver = &genphy_driver[GENPHY_DRV_1G].driver;
+		if (phydev->is_c45)
+			d->driver = &genphy_driver[GENPHY_DRV_10G].driver;
+		else
+			d->driver = &genphy_driver[GENPHY_DRV_1G].driver;
 
 		err = d->driver->probe(d);
 		if (err >= 0)
@@ -579,6 +574,7 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
 
 	return err;
 }
+EXPORT_SYMBOL(phy_attach_direct);
 
 /**
  * phy_attach - attach a network device to a particular PHY device
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9144061..61dcafd 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -581,6 +581,8 @@ int phy_init_hw(struct phy_device *phydev);
 struct phy_device * phy_attach(struct net_device *dev,
 		const char *bus_id, phy_interface_t interface);
 struct phy_device *phy_find_first(struct mii_bus *bus);
+int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
+		     u32 flags, phy_interface_t interface);
 int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
 		void (*handler)(struct net_device *),
 		phy_interface_t interface);
-- 
1.8.4.1

^ permalink raw reply related

* [PATCH 4/6][v3] phylib: Add generic 10G driver
From: shh.xie @ 2013-11-29  5:47 UTC (permalink / raw)
  To: davem, jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel
  Cc: Shaohui.Xie

From: Andy Fleming <afleming@freescale.com>

Very incomplete, but will allow for binding an ethernet controller
to it.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
v3 changes: splitted from v2 patch 3/5.

 drivers/net/phy/phy_device.c | 80 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index a5926a6..79142de 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -33,6 +33,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/phy.h>
+#include <linux/mdio.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -55,6 +56,7 @@ static void phy_device_release(struct device *dev)
 
 enum genphy_driver {
 	GENPHY_DRV_1G,
+	GENPHY_DRV_10G,
 	GENPHY_DRV_MAX
 };
 
@@ -697,6 +699,12 @@ static int genphy_config_advert(struct phy_device *phydev)
 	return changed;
 }
 
+int gen10g_config_advert(struct phy_device *dev)
+{
+	return 0;
+}
+EXPORT_SYMBOL(gen10g_config_advert);
+
 /**
  * genphy_setup_forced - configures/forces speed/duplex from @phydev
  * @phydev: target phy_device struct
@@ -750,6 +758,11 @@ int genphy_restart_aneg(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(genphy_restart_aneg);
 
+int gen10g_restart_aneg(struct phy_device *phydev)
+{
+	return 0;
+}
+EXPORT_SYMBOL(gen10g_restart_aneg);
 
 /**
  * genphy_config_aneg - restart auto-negotiation or write BMCR
@@ -792,6 +805,12 @@ int genphy_config_aneg(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(genphy_config_aneg);
 
+int gen10g_config_aneg(struct phy_device *phydev)
+{
+	return 0;
+}
+EXPORT_SYMBOL(gen10g_config_aneg);
+
 /**
  * genphy_update_link - update link status in @phydev
  * @phydev: target phy_device struct
@@ -921,6 +940,34 @@ int genphy_read_status(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(genphy_read_status);
 
+int gen10g_read_status(struct phy_device *phydev)
+{
+	int devad, reg;
+	u32 mmd_mask = phydev->c45_ids.devices_in_package;
+
+	phydev->link = 1;
+
+	/* For now just lie and say it's 10G all the time */
+	phydev->speed = SPEED_10000;
+	phydev->duplex = DUPLEX_FULL;
+
+	for (devad = 0; mmd_mask; devad++, mmd_mask = mmd_mask >> 1) {
+		if (!(mmd_mask & 1))
+			continue;
+
+		/* Read twice because link state is latched and a
+		 * read moves the current state into the register
+		 */
+		phy_read_mmd(phydev, devad, MDIO_STAT1);
+		reg = phy_read_mmd(phydev, devad, MDIO_STAT1);
+		if (reg < 0 || !(reg & MDIO_STAT1_LSTATUS))
+			phydev->link = 0;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(gen10g_read_status);
+
 static int genphy_config_init(struct phy_device *phydev)
 {
 	int val;
@@ -967,6 +1014,16 @@ static int genphy_config_init(struct phy_device *phydev)
 
 	return 0;
 }
+
+static int gen10g_config_init(struct phy_device *phydev)
+{
+	/* Temporarily just say we support everything */
+	phydev->supported = SUPPORTED_10000baseT_Full;
+	phydev->advertising = SUPPORTED_10000baseT_Full;
+
+	return 0;
+}
+
 int genphy_suspend(struct phy_device *phydev)
 {
 	int value;
@@ -982,6 +1039,12 @@ int genphy_suspend(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(genphy_suspend);
 
+int gen10g_suspend(struct phy_device *phydev)
+{
+	return 0;
+}
+EXPORT_SYMBOL(gen10g_suspend);
+
 int genphy_resume(struct phy_device *phydev)
 {
 	int value;
@@ -997,6 +1060,12 @@ int genphy_resume(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(genphy_resume);
 
+int gen10g_resume(struct phy_device *phydev)
+{
+	return 0;
+}
+EXPORT_SYMBOL(gen10g_resume);
+
 /**
  * phy_probe - probe and init a PHY device
  * @dev: device to probe and init
@@ -1136,6 +1205,17 @@ static struct phy_driver genphy_driver[] = {
 	.suspend	= genphy_suspend,
 	.resume		= genphy_resume,
 	.driver		= {.owner= THIS_MODULE, },
+}, {
+	.phy_id         = 0xffffffff,
+	.phy_id_mask    = 0xffffffff,
+	.name           = "Generic 10G PHY",
+	.config_init    = gen10g_config_init,
+	.features       = 0,
+	.config_aneg    = gen10g_config_aneg,
+	.read_status    = gen10g_read_status,
+	.suspend        = gen10g_suspend,
+	.resume         = gen10g_resume,
+	.driver         = {.owner = THIS_MODULE, },
 } };
 
 static int __init phy_init(void)
-- 
1.8.4.1

^ permalink raw reply related

* Re: [PATCH] update consumers of MSG_MORE to recognize MSG_SENDPAGE_NOTLAST
From: Hannes Frederic Sowa @ 2013-11-29  5:47 UTC (permalink / raw)
  To: Shawn Landden
  Cc: Eric Dumazet, linux-kernel, linux-fsdevel, viro, linux-crypto,
	netdev, Herbert Xu, Tom Herbert, David S. Miller, stable,
	richard.weinberger
In-Reply-To: <1385361388-2175-1-git-send-email-shawn@churchofgit.com>

On Sun, Nov 24, 2013 at 10:36:28PM -0800, Shawn Landden wrote:
> Commit 35f9c09fe (tcp: tcp_sendpages() should call tcp_push() once)
> added an internal flag MSG_SENDPAGE_NOTLAST, similar to
> MSG_MORE.
> 
> algif_hash, algif_skcipher, and udp used MSG_MORE from tcp_sendpages()
> and need to see the new flag as identical to MSG_MORE.
> 
> This fixes sendfile() on AF_ALG.
> 
> v3: also fix udp

The UDP bits look fine to me.

Greetings,

  Hannes


^ permalink raw reply

* [PATCH 3/6] phylib: turn genphy_driver to an array
From: shh.xie @ 2013-11-29  5:46 UTC (permalink / raw)
  To: davem, jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel
  Cc: Shaohui.Xie

From: Shaohui Xie <Shaohui.Xie@freescale.com>

Then other generic phy driver such as generic 10g phy driver can join it.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
Splitted from previous v2 patch 3/5.

 drivers/net/phy/phy_device.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index d6447b3..a5926a6 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -53,7 +53,12 @@ static void phy_device_release(struct device *dev)
 	kfree(to_phy_device(dev));
 }
 
-static struct phy_driver genphy_driver;
+enum genphy_driver {
+	GENPHY_DRV_1G,
+	GENPHY_DRV_MAX
+};
+
+static struct phy_driver genphy_driver[GENPHY_DRV_MAX];
 extern int mdio_bus_init(void);
 extern void mdio_bus_exit(void);
 
@@ -539,7 +544,7 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
 			return -ENODEV;
 		}
 
-		d->driver = &genphy_driver.driver;
+		d->driver = &genphy_driver[GENPHY_DRV_1G].driver;
 
 		err = d->driver->probe(d);
 		if (err >= 0)
@@ -613,6 +618,7 @@ EXPORT_SYMBOL(phy_attach);
  */
 void phy_detach(struct phy_device *phydev)
 {
+	int i;
 	phydev->attached_dev->phydev = NULL;
 	phydev->attached_dev = NULL;
 
@@ -620,8 +626,10 @@ void phy_detach(struct phy_device *phydev)
 	 * was using the generic driver), we unbind the device
 	 * from the generic driver so that there's a chance a
 	 * real driver could be loaded */
-	if (phydev->dev.driver == &genphy_driver.driver)
-		device_release_driver(&phydev->dev);
+	for (i = 0; i < ARRAY_SIZE(genphy_driver); i++) {
+		if (phydev->dev.driver == &genphy_driver[i].driver)
+			device_release_driver(&phydev->dev);
+	}
 }
 EXPORT_SYMBOL(phy_detach);
 
@@ -1116,7 +1124,8 @@ void phy_drivers_unregister(struct phy_driver *drv, int n)
 }
 EXPORT_SYMBOL(phy_drivers_unregister);
 
-static struct phy_driver genphy_driver = {
+static struct phy_driver genphy_driver[] = {
+{
 	.phy_id		= 0xffffffff,
 	.phy_id_mask	= 0xffffffff,
 	.name		= "Generic PHY",
@@ -1127,7 +1136,7 @@ static struct phy_driver genphy_driver = {
 	.suspend	= genphy_suspend,
 	.resume		= genphy_resume,
 	.driver		= {.owner= THIS_MODULE, },
-};
+} };
 
 static int __init phy_init(void)
 {
@@ -1137,7 +1146,8 @@ static int __init phy_init(void)
 	if (rc)
 		return rc;
 
-	rc = phy_driver_register(&genphy_driver);
+	rc = phy_drivers_register(genphy_driver,
+				  ARRAY_SIZE(genphy_driver));
 	if (rc)
 		mdio_bus_exit();
 
@@ -1146,7 +1156,8 @@ static int __init phy_init(void)
 
 static void __exit phy_exit(void)
 {
-	phy_driver_unregister(&genphy_driver);
+	phy_drivers_unregister(genphy_driver,
+			       ARRAY_SIZE(genphy_driver));
 	mdio_bus_exit();
 }
 
-- 
1.8.4.1

^ permalink raw reply related

* [PATCH 2/6][v3] phylib: introduce PHY_INTERFACE_MODE_XGMII for 10G PHY
From: shh.xie @ 2013-11-29  5:46 UTC (permalink / raw)
  To: davem, jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel
  Cc: Shaohui.Xie

From: Shaohui Xie <Shaohui.Xie@freescale.com>

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
---
v3: no changes.

 drivers/of/of_net.c | 1 +
 include/linux/phy.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
index 8f9be2e..a208a45 100644
--- a/drivers/of/of_net.c
+++ b/drivers/of/of_net.c
@@ -30,6 +30,7 @@ static const char *phy_modes[] = {
 	[PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid",
 	[PHY_INTERFACE_MODE_RTBI]	= "rtbi",
 	[PHY_INTERFACE_MODE_SMII]	= "smii",
+	[PHY_INTERFACE_MODE_XGMII]	= "xgmii",
 };
 
 /**
diff --git a/include/linux/phy.h b/include/linux/phy.h
index fbe334d..9144061 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -66,6 +66,7 @@ typedef enum {
 	PHY_INTERFACE_MODE_RGMII_TXID,
 	PHY_INTERFACE_MODE_RTBI,
 	PHY_INTERFACE_MODE_SMII,
+	PHY_INTERFACE_MODE_XGMII,
 } phy_interface_t;
 
 
-- 
1.8.4.1

^ permalink raw reply related

* [PATCH] ipv6: fix possible seqlock deadlock in ip6_finish_output2
From: Hannes Frederic Sowa @ 2013-11-29  5:39 UTC (permalink / raw)
  To: Eric Dumazet, jongman.heo, David Miller, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <20131128192231.GE24171@order.stressinduktion.org>

IPv6 stats are 64 bits and thus are protected with a seqlock. By not
disabling bottom-half we could deadlock here if we don't disable bh and
a softirq reentrantly updates the same mib.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
 net/ipv6/ip6_output.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 59df872..4acdb63 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -116,8 +116,8 @@ static int ip6_finish_output2(struct sk_buff *skb)
 	}
 	rcu_read_unlock_bh();
 
-	IP6_INC_STATS_BH(dev_net(dst->dev),
-			 ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
+	IP6_INC_STATS(dev_net(dst->dev),
+		      ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
 	kfree_skb(skb);
 	return -EINVAL;
 }
-- 
1.8.3.1

^ permalink raw reply related

* Re: [PATCH net v2] xen-netback: fix fragment detection in checksum setup
From: annie li @ 2013-11-29  5:35 UTC (permalink / raw)
  To: Paul Durrant; +Cc: xen-devel, netdev, Wei Liu, Ian Campbell, David Vrabel
In-Reply-To: <1385645032-29848-1-git-send-email-paul.durrant@citrix.com>


On 2013/11/28 21:23, Paul Durrant wrote:
> The code to detect fragments in checksum_setup() was missing for IPv4 and
> too eager for IPv6. (It transpires that Windows seems to send IPv6 packets
> with a fragment header even if they are not a fragment - i.e. offset is zero,
> and M bit is not set).
>
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> ---
> v2
>
> - Added comments noting what fragment/offset masks mean
>    
>   drivers/net/xen-netback/netback.c |   33 ++++++++++++++++++++++++++++++---
>   1 file changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index 919b650..c7464d8 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -1165,15 +1165,28 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb,
>   	struct iphdr *iph = (void *)skb->data;
>   	unsigned int header_size;
>   	unsigned int off;
> +	bool fragment;
>   	int err = -EPROTO;
>   
> +	fragment = false;

Is it better to initialize fragment directly as following?
bool fragment = false;

> +
>   	off = sizeof(struct iphdr);
>   
>   	header_size = skb->network_header + off + MAX_IPOPTLEN;
>   	maybe_pull_tail(skb, header_size);
>   
> +	/* 3fff -> fragment offset != 0 OR more fragments */
> +	if (ntohs(iph->frag_off) & 0x3fff)
> +		fragment = true;
> +
>   	off = iph->ihl * 4;
>   
> +	if (fragment) {
> +		if (net_ratelimit())
> +			netdev_err(vif->dev, "Packet is a fragment!\n");
> +		goto out;
> +	}
> +
>   	switch (iph->protocol) {
>   	case IPPROTO_TCP:
>   		if (!skb_partial_csum_set(skb, off,
> @@ -1237,6 +1250,7 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
>   	bool fragment;
>   	bool done;
>   
> +	fragment = false;
>   	done = false;

Same as above for "done" and "fragment"...

Thanks
Annie

^ permalink raw reply

* [PATCH net] {pktgen, xfrm} re-caculate IPv4 checksum after transformation
From: Fan Du @ 2013-11-29  2:59 UTC (permalink / raw)
  To: steffen.klassert; +Cc: davem, netdev

I accidently observed incorrect IPv4 checksum by wireshark
when armming pktgen with IPsec by ESP transport mode with
following pktgen configuration:

pgset "flag IPSEC"
pgset "flows 1"

It seems that after transformation, IPv4 checksum remains the
origianl checksum as before, so encrypted packet will never
reach receiver's upper layer because of wrong IPv4 checksum
value.

Fix this by re-caculate checksum value.

Signed-off-by: Fan Du <fan.du@windriver.com>
---
 net/core/pktgen.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 261357a..8d13b41 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2786,6 +2786,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
 #ifdef CONFIG_XFRM
 	if (!process_ipsec(pkt_dev, skb, protocol))
 		return NULL;
+	iph = ip_hdr(skb);
+	ip_send_check(iph);
 #endif
 
 	return skb;
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH v2] inet: fix possible seqlock deadlocks
From: Jongman Heo @ 2013-11-29  2:08 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Hannes Frederic Sowa

 
------ Original Message -------
Sender : Eric Dumazet<eric.dumazet@gmail.com>
Date : 2013-11-29 02:51 (GMT+09:00)
Title : [PATCH v2] inet: fix possible seqlock deadlocks
> 
> From: Eric Dumazet 
> 
> In commit c9e9042994d3 ("ipv4: fix possible seqlock deadlock") I left
> another places where IP_INC_STATS_BH() were improperly used.
> 
> udp_sendmsg(), ping_v4_sendmsg() and tcp_v4_connect() are called from
> process context, not from softirq context.
> 
> This was detected by lockdep seqlock support.
> 
> Reported-by: jongman heo 
> Fixes: 584bdf8cbdf6 ("[IPV4]: Fix "ipOutNoRoutes" counter error for TCP and UDP")
> Fixes: c319b4d76b9e ("net: ipv4: add IPPROTO_ICMP socket kind")
> Signed-off-by: Eric Dumazet 
> Cc: Hannes Frederic Sowa 
> ---
> net/ipv4/ping.c     |    2 +-
> net/ipv4/tcp_ipv4.c |    2 +-
> net/ipv4/udp.c      |    2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
> index 840cf1b9e6ee..242e7f4ed6f4 100644
> --- a/net/ipv4/ping.c
> +++ b/net/ipv4/ping.c
> @@ -772,7 +772,7 @@ int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
> err = PTR_ERR(rt);
> rt = NULL;
> if (err == -ENETUNREACH)
> - IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES);
> + IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
> goto out;
> }
> 
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 59a6f8b90cd9..067213924751 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -177,7 +177,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
> if (IS_ERR(rt)) {
> err = PTR_ERR(rt);
> if (err == -ENETUNREACH)
> - IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES);
> + IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES);
> return err;
> }
> 
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 44dfaa09b584..44e3884f9e4c 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -999,7 +999,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
> err = PTR_ERR(rt);
> rt = NULL;
> if (err == -ENETUNREACH)
> - IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES);
> + IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
> goto out;
> }
> 

Hi, Eric,

I've applied your patch, and will let you know the result, after a full day or half day test.
Usually the issue happens within 10 minutes after boot, but to be sure...

Regards,
Jongman Heo.

^ permalink raw reply

* Re: [PATCH 1/5] net: sfc: remove unnecessary pci_set_drvdata()
From: Jingoo Han @ 2013-11-28 23:54 UTC (permalink / raw)
  To: 'David Miller'
  Cc: netdev, linux-net-drivers, bhutchings, 'Jingoo Han'
In-Reply-To: <20131128.181137.2129415290144555685.davem@davemloft.net>

On Friday, November 29, 2013 8:12 AM, David Miller wrote:
> 
> Can you please resubmit these pci_set_drvdata() patches (the IRDA,
> WAN, hippi, fiddi ones too) when I open the net-next tree back up?

I see. :-)
I will resubmit these patches, when you open the net-next tree.
Thank you for your guidance.

Best regards,
Jingoo Han

^ permalink raw reply

* Re: [PATCH net v2] be2net: call napi_disable() for all event queues
From: David Miller @ 2013-11-28 23:51 UTC (permalink / raw)
  To: ivecera; +Cc: netdev, sathya.perla, subbu.seetharaman, ajit.khaparde
In-Reply-To: <1385539172-4744-1-git-send-email-ivecera@redhat.com>

From: Ivan Vecera <ivecera@redhat.com>
Date: Wed, 27 Nov 2013 08:59:32 +0100

> The recent be2net commit 6384a4d (adds a support for busy polling)
> introduces a regression that results in kernel crash. It incorrectly
> modified be_close() so napi_disable() is called only for the first queue.
> This breaks a correct pairing of napi_enable/_disable for the rest
> of event queues and causes a crash in subsequent be_open() call.
> 
> v2: Applied suggestions from Sathya
> 
> Fixes: 6384a4d ("be2net: add support for ndo_busy_poll")
> Cc: Sathya Perla <sathya.perla@emulex.com>
> Cc: Subbu Seetharaman <subbu.seetharaman@emulex.com>
> Cc: Ajit Khaparde <ajit.khaparde@emulex.com>
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next v3] xen-netfront: Add support for IPv6 offloads
From: David Miller @ 2013-11-28 23:50 UTC (permalink / raw)
  To: paul.durrant
  Cc: xen-devel, netdev, konrad.wilk, boris.ostrovsky, david.vrabel,
	ian.campbell, wei.liu2, annie.li
In-Reply-To: <1385484112-12975-1-git-send-email-paul.durrant@citrix.com>

From: Paul Durrant <paul.durrant@citrix.com>
Date: Tue, 26 Nov 2013 16:41:52 +0000

> This patch adds support for IPv6 checksum offload and GSO when those
> features are available in the backend.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>

Please resubmit this when the net-next tree opens back up, thank you.

^ permalink raw reply

* Re: [PATCH v2 net-next] net: remove outdated comment for ipv4 and ipv6 protocol handler
From: David Miller @ 2013-11-28 23:48 UTC (permalink / raw)
  To: baker.kernel; +Cc: sergei.shtylyov, netdev
In-Reply-To: <1385429355-21442-1-git-send-email-baker.kernel@gmail.com>

From: baker.kernel@gmail.com
Date: Tue, 26 Nov 2013 09:29:15 +0800

> From: Baker Zhang <Baker.kernel@gmail.com>
> 
> since f9242b6b28d61295f2bf7e8adfb1060b382e5381
> inet: Sanitize inet{,6} protocol demux.
> 
> there are not pretended hash tables for ipv4 or
> ipv6 protocol handler.
> 
> Signed-off-by: Baker Zhang <Baker.kernel@gmail.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net 1/1] via-velocity: fix netif_receive_skb use in irq disabled section.
From: David Miller @ 2013-11-28 23:45 UTC (permalink / raw)
  To: romieu; +Cc: netdev, aaschmidt1, michele, jamie, Julia.Lawall
In-Reply-To: <20131125234058.GA12566@electric-eye.fr.zoreil.com>

From: Francois Romieu <romieu@fr.zoreil.com>
Date: Tue, 26 Nov 2013 00:40:58 +0100

> 2fdac010bdcf10a30711b6924612dfc40daf19b8 ("via-velocity.c: update napi
> implementation") overlooked an irq disabling spinlock when the Rx part
> of the NAPI poll handler was converted from netif_rx to netif_receive_skb.
> 
> NAPI Rx processing can be taken out of the locked section with a pair of
> napi_{disable / enable} since it only races with the MTU change function.
> 
> An heavier rework of the NAPI locking would be able to perform NAPI Tx
> before Rx where I simply removed one of velocity_tx_srv calls.
> 
> References: https://bugzilla.redhat.com/show_bug.cgi?id=1022733
> Fixes: 2fdac010bdcf (via-velocity.c: update napi implementation)
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> Tested-by: Alex A. Schmidt <aaschmidt1@gmail.com>

Applied and queued up for -stable, thanks.

Just a note that we usually recommend to people to do TX processing
before RX in NAPI, because the TX work can liberate packets and make
them available to RX reclaim.  But that would be quite hard with the
approach you took to fix this bug simply.

^ permalink raw reply

* Re: pull-request: can 2013-11-27
From: David Miller @ 2013-11-28 23:42 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, kernel
In-Reply-To: <1385586695-11134-1-git-send-email-mkl@pengutronix.de>

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed, 27 Nov 2013 22:11:31 +0100

> this is an extention of my pull request from 2013-11-25, it includes an
> additional patch.
> 
> This series consists of a patch by Oliver Hartkopp which fixes some corner
> cases in the interrupt handler of the sja1000 driver. Then there are two
> patches for the c_can dirver. One by me, which fixes a runtime pm related
> "scheduling while atomic" error and patch by Holger Bechtold that fixes the
> calculation of the transmitted bytes.
> 
> The fourth patch (the additional one) is by me, it corrects the clock usage in
> the flexcan driver.

Pulled, thanks Marc.

^ permalink raw reply

* Re: [PATCH 1/1] xen-netback: include definition of csum_ipv6_magic
From: David Miller @ 2013-11-28 23:38 UTC (permalink / raw)
  To: apw; +Cc: ian.campbell, wei.liu2, xen-devel, netdev, linux-kernel
In-Reply-To: <1385398354-21636-1-git-send-email-apw@canonical.com>

From: Andy Whitcroft <apw@canonical.com>
Date: Mon, 25 Nov 2013 16:52:34 +0000

> We are now using csum_ipv6_magic, include the appropriate header.
> Avoids the following error:
> 
>     drivers/net/xen-netback/netback.c:1313:4: error: implicit declaration of function 'csum_ipv6_magic' [-Werror=implicit-function-declaration]
>         tcph->check = ~csum_ipv6_magic(&ipv6h->saddr,
> 
> Signed-off-by: Andy Whitcroft <apw@canonical.com>

Applied, thank you.

^ permalink raw reply

* Re: [PATCH v2 1/6] net: MOXA ART: clear TX descriptor length bits between sends
From: David Miller @ 2013-11-28 23:36 UTC (permalink / raw)
  To: jonas.jensen
  Cc: netdev, linux-arm-kernel, linux-kernel, f.fainelli, bhutchings
In-Reply-To: <1385393228-22416-1-git-send-email-jonas.jensen@gmail.com>


Some of the patches in this series add new features, therefore please this
series when the net-next tree opens back up.

Thank you.

^ permalink raw reply

* Re: [PATCH net] macvtap: fix tx_dropped counting error
From: David Miller @ 2013-11-28 23:32 UTC (permalink / raw)
  To: jasowang; +Cc: netdev, linux-kernel, mst, vyasevic, edumazet
In-Reply-To: <1385371144-11071-1-git-send-email-jasowang@redhat.com>

From: Jason Wang <jasowang@redhat.com>
Date: Mon, 25 Nov 2013 17:19:04 +0800

> After commit 8ffab51b3dfc54876f145f15b351c41f3f703195
> (macvlan: lockless tx path), tx stat counter were converted to percpu stat
> structure. So we need use to this also for tx_dropped in macvtap. Otherwise, the
> management won't notice the dropping packet in macvtap tx path.
> 
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Vlad Yasevich <vyasevic@redhat.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Applied, thanks Jason.

^ permalink raw reply

* Re: [PATCH] phy: Add Vitesse 8514 phy ID
From: David Miller @ 2013-11-28 23:31 UTC (permalink / raw)
  To: shh.xie; +Cc: linux-kernel, linuxppc-dev, netdev, Shaohui.Xie
In-Reply-To: <1385354449-2943-1-git-send-email-shh.xie@gmail.com>

From: <shh.xie@gmail.com>
Date: Mon, 25 Nov 2013 12:40:49 +0800

> From: Shaohui Xie <Shaohui.Xie@freescale.com>
> 
> Phy is compatible with Vitesse 82xx
> 
> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>

Applied, thank you.

^ permalink raw reply

* Re: [V2 PATCH] sctp: Restore 'resent' bit to avoid retransmitted chunks for RTT measurements
From: David Miller @ 2013-11-28 23:30 UTC (permalink / raw)
  To: xufeng.zhang; +Cc: vyasevich, nhorman, linux-sctp, netdev, linux-kernel
In-Reply-To: <1385350017-11324-1-git-send-email-xufeng.zhang@windriver.com>

From: Xufeng Zhang <xufeng.zhang@windriver.com>
Date: Mon, 25 Nov 2013 11:26:57 +0800

> Currently retransmitted DATA chunks could also be used for
> RTT measurements since there are no flag to identify whether
> the transmitted DATA chunk is a new one or a retransmitted one.
> This problem is introduced by commit ae19c5486 ("sctp: remove
> 'resent' bit from the chunk") which inappropriately removed the
> 'resent' bit completely, instead of doing this, we should set
> the resent bit only for the retransmitted DATA chunks.
> 
> Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
> ---
> v1->v2:
> Rmoved initialization for resent bit.
> Combined two if clause

Applied, thanks.

^ permalink raw reply

* Re: [PATCH 3.13] genetlink/pmcraid: use proper genetlink multicast API
From: David Miller @ 2013-11-28 23:27 UTC (permalink / raw)
  To: johannes; +Cc: netdev, anil_ravindranath, JBottomley, linux-scsi, johannes.berg
In-Reply-To: <1385323766-30356-1-git-send-email-johannes@sipsolutions.net>

From: Johannes Berg <johannes@sipsolutions.net>
Date: Sun, 24 Nov 2013 21:09:26 +0100

> From: Johannes Berg <johannes.berg@intel.com>
> 
> The pmcraid driver is abusing the genetlink API and is using its
> family ID as the multicast group ID, which is invalid and may
> belong to somebody else (and likely will.)
> 
> Make it use the correct API, but since this may already be used
> as-is by userspace, reserve a family ID for this code and also
> reserve that group ID to not break userspace assumptions.
> 
> My previous patch broke event delivery in the driver as I missed
> that it wasn't using the right API and forgot to update it later
> in my series.
> 
> While changing this, I noticed that the genetlink code could use
> the static group ID instead of a strcmp(), so also do that for
> the VFS_DQUOT family.
> 
> Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>
> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Applied, thanks Johannes.

^ permalink raw reply

* Re: [PATCH] genetlink: Fix uninitialized variable in genl_validate_assign_mc_groups()
From: David Miller @ 2013-11-28 23:25 UTC (permalink / raw)
  To: geert; +Cc: johannes.berg, netdev, linux-kernel
In-Reply-To: <1385208110-17120-1-git-send-email-geert@linux-m68k.org>

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Sat, 23 Nov 2013 13:01:50 +0100

> net/netlink/genetlink.c: In function ‘genl_validate_assign_mc_groups’:
> net/netlink/genetlink.c:217: warning: ‘err’ may be used uninitialized in this
> function
> 
> Commit 2a94fe48f32ccf7321450a2cc07f2b724a444e5b ("genetlink: make multicast
> groups const, prevent abuse") split genl_register_mc_group() in multiple
> functions, but dropped the initialization of err.
> 
> Initialize err to zero to fix this.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> Question: Is the for_each_net_rcu() loop in genl_validate_assign_mc_groups()
>           guaranteed to loop at least once?
> 	  If yes, this is a false positive.

Applied, but yes it's a false positive.  There is always &init_net so the
loop always iterates at least once.

^ permalink raw reply

* Re: [PATCH 1/5] tg3: Convert to use hwmon_device_register_with_groups
From: David Miller @ 2013-11-28 23:22 UTC (permalink / raw)
  To: linux
  Cc: netdev, jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
	carolyn.wyborny, donald.c.skidmore, gregory.v.rose, nsujir, mchan,
	e1000-devel, lm-sensors
In-Reply-To: <1385186881-7931-2-git-send-email-linux@roeck-us.net>

From: Guenter Roeck <linux@roeck-us.net>
Date: Fri, 22 Nov 2013 22:07:57 -0800

> Use new hwmon API to simplify code, provide missing mandatory 'name'
> sysfs attribute, and attach hwmon attributes to hwmon device instead
> of pci device.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Applied, thanks.

Jeff Kirsher will pull the rest of this series in via his Intel ethernet
driver tree.

^ permalink raw reply

* Re: [PATCH net v3] bonding: disable arp and enable mii monitoring when bond change to no uses arp mode
From: David Miller @ 2013-11-28 23:20 UTC (permalink / raw)
  To: dingtianhong; +Cc: andy, dcbw, fubar, nikolay, vfalico, netdev
In-Reply-To: <528F6A1B.70904@huawei.com>

From: Ding Tianhong <dingtianhong@huawei.com>
Date: Fri, 22 Nov 2013 22:28:43 +0800

> Because the ARP monitoring is not support for 802.3ad, but I still
> could change the mode to 802.3ad from ab mode while ARP monitoring
> is running, it is incorrect.
> 
> So add a check for 802.3ad in bonding_store_mode to fix the problem,
> and make a new macro BOND_NO_USES_ARP() to simplify the code.
> 
> v2: according to the Dan Williams's suggestion, bond mode is the most
>     important bond option, it should override any of the other sub-options.
>     So when the mode is changed, the conficting values should be cleared
>     or reset, otherwise the user has to duplicate more operations to modify
>     the logic. I disable the arp and enable mii monitoring when the bond mode
>     is changed to AB, TB and 8023AD if the arp interval is true.
> 
> v3: according to the Nik's suggestion, the default value of miimon should need
>     a name, there is several place to use it, and the bond_store_arp_interval()
>     could use micro BOND_NO_USES_ARP to make the code more simpify.
> 
> Suggested-by: Dan Williams <dcbw@redhat.com>
> Suggested-by: Nikolay Aleksandrov <nikolay@redhat.com>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>

Applied, thanks for following up on this Ding.

^ 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