* [PATCH 07/11] net/can/mpc52xx_can: refactor clock-get routine
From: Wolfram Sang @ 2009-11-16 22:57 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Grant Likely, socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, David Miller,
wg-5Yr1BZd7O62+XT7JhA+gdA
In-Reply-To: <1258412274-14686-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Merge two functions into one. The result is smaller as they can now share some
variables.
Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
drivers/net/can/mscan/mpc52xx_can.c | 45 ++++++++++++----------------------
1 files changed, 16 insertions(+), 29 deletions(-)
diff --git a/drivers/net/can/mscan/mpc52xx_can.c b/drivers/net/can/mscan/mpc52xx_can.c
index 34ae2ba..a915959 100644
--- a/drivers/net/can/mscan/mpc52xx_can.c
+++ b/drivers/net/can/mscan/mpc52xx_can.c
@@ -38,28 +38,37 @@
static struct of_device_id mpc52xx_cdm_ids[] __devinitdata = {
{ .compatible = "fsl,mpc5200-cdm", },
- { .compatible = "fsl,mpc5200b-cdm", },
{}
};
/*
- * Get the frequency of the external oscillator clock connected
- * to the SYS_XTAL_IN pin, or return 0 if it cannot be determined.
+ * Get frequency of the MSCAN clock source
+ *
+ * Either the oscillator clock (SYS_XTAL_IN) or the IP bus clock (IP_CLK)
+ * can be selected. According to the MPC5200 user's manual, the oscillator
+ * clock is the better choice as it has less jitter but due to a hardware
+ * bug, it can not be selected for the old MPC5200 Rev. A chips.
*/
-static unsigned int __devinit mpc52xx_can_xtal_freq(struct of_device *of)
+
+static unsigned int __devinit mpc52xx_can_clock_freq(struct of_device *of,
+ int clock_src)
{
+ unsigned int pvr;
struct mpc52xx_cdm __iomem *cdm;
struct device_node *np_cdm;
unsigned int freq;
u32 val;
+ pvr = mfspr(SPRN_PVR);
+
freq = mpc5xxx_get_bus_frequency(of->node);
if (!freq)
return 0;
- /*
- * Determine SYS_XTAL_IN frequency from the clock domain settings
- */
+ if (clock_src == MSCAN_CLKSRC_BUS || pvr == 0x80822011)
+ return freq;
+
+ /* Determine SYS_XTAL_IN frequency from the clock domain settings */
np_cdm = of_find_matching_node(NULL, mpc52xx_cdm_ids);
if (!np_cdm) {
dev_err(&of->dev, "can't get clock node!\n");
@@ -80,28 +89,6 @@ static unsigned int __devinit mpc52xx_can_xtal_freq(struct of_device *of)
return freq;
}
-/*
- * Get frequency of the MSCAN clock source
- *
- * Either the oscillator clock (SYS_XTAL_IN) or the IP bus clock (IP_CLK)
- * can be selected. According to the MPC5200 user's manual, the oscillator
- * clock is the better choice as it has less jitter but due to a hardware
- * bug, it can not be selected for the old MPC5200 Rev. A chips.
- */
-
-static unsigned int __devinit mpc52xx_can_clock_freq(struct of_device *of,
- int clock_src)
-{
- unsigned int pvr;
-
- pvr = mfspr(SPRN_PVR);
-
- if (clock_src == MSCAN_CLKSRC_BUS || pvr == 0x80822011)
- return mpc5xxx_get_bus_frequency(of->node);
-
- return mpc52xx_can_xtal_freq(of);
-}
-
static int __devinit mpc5xxx_can_probe(struct of_device *ofdev,
const struct of_device_id *id)
{
--
1.6.3.3
^ permalink raw reply related
* [PATCH 08/11] net/can/mpc52xx_can: improve properties and their description
From: Wolfram Sang @ 2009-11-16 22:57 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Grant Likely, devicetree-discuss-mnsaURCQ41sdnm+yROfE0A,
socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, David Miller,
wg-5Yr1BZd7O62+XT7JhA+gdA
In-Reply-To: <1258412274-14686-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
---
Documentation/powerpc/dts-bindings/fsl/mpc5200.txt | 9 +++++----
drivers/net/can/mscan/mpc52xx_can.c | 3 +--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Documentation/powerpc/dts-bindings/fsl/mpc5200.txt b/Documentation/powerpc/dts-bindings/fsl/mpc5200.txt
index b151fb1..cabc780 100644
--- a/Documentation/powerpc/dts-bindings/fsl/mpc5200.txt
+++ b/Documentation/powerpc/dts-bindings/fsl/mpc5200.txt
@@ -181,9 +181,10 @@ External interrupts:
fsl,mpc5200-mscan nodes
-----------------------
In addition to the required compatible-, reg- and interrupt-properites, you can
-also specify which clock shall be used for the bus:
+also specify which clock source shall be used for the controller:
-- fsl,mscan-clk-src - a string describing the clock source. Valid values
- are "ip" for IP_CLK and "sys" for SYS_XTAL.
- "sys" is the default in case the property is not
+- fsl,mscan-clock-source- a string describing the clock source. Valid values
+ are: "ip" for ip bus clock
+ "ref" for reference clock (XTAL)
+ "ref" is default in case this property is not
present.
diff --git a/drivers/net/can/mscan/mpc52xx_can.c b/drivers/net/can/mscan/mpc52xx_can.c
index a915959..1de6f63 100644
--- a/drivers/net/can/mscan/mpc52xx_can.c
+++ b/drivers/net/can/mscan/mpc52xx_can.c
@@ -130,7 +130,7 @@ static int __devinit mpc5xxx_can_probe(struct of_device *ofdev,
* choice as it has less jitter. For this reason, it is selected
* by default.
*/
- clk_src = of_get_property(np, "fsl,mscan-clk-src", NULL);
+ clk_src = of_get_property(np, "fsl,mscan-clock-source", NULL);
if (clk_src && strcmp(clk_src, "ip") == 0)
clock_src = MSCAN_CLKSRC_BUS;
else
@@ -227,7 +227,6 @@ static int mpc5xxx_can_resume(struct of_device *ofdev)
static struct of_device_id __devinitdata mpc5xxx_can_table[] = {
{.compatible = "fsl,mpc5200-mscan"},
- {.compatible = "fsl,mpc5200b-mscan"},
{},
};
--
1.6.3.3
^ permalink raw reply related
* [PATCH 09/11] net/can/mscan: replace hardcoded values with defines
From: Wolfram Sang @ 2009-11-16 22:57 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Grant Likely, socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, David Miller,
wg-5Yr1BZd7O62+XT7JhA+gdA
In-Reply-To: <1258412274-14686-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Not all hardcoded values have been replaced as this made the code quite
unreadable. IMHO this compromise serves the purpose of readability.
Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
drivers/net/can/mscan/mscan.c | 15 ++++++++++-----
drivers/net/can/mscan/mscan.h | 5 +++++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
index 20d1991..263d1a9 100644
--- a/drivers/net/can/mscan/mscan.c
+++ b/drivers/net/can/mscan/mscan.c
@@ -211,18 +211,23 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
rtr = frame->can_id & CAN_RTR_FLAG;
+ /* RTR is always the lowest bit of interest, then IDs follow */
if (frame->can_id & CAN_EFF_FLAG) {
- can_id = (frame->can_id & CAN_EFF_MASK) << 1;
+ can_id = (frame->can_id & CAN_EFF_MASK)
+ << (MSCAN_EFF_RTR_SHIFT + 1);
if (rtr)
- can_id |= 1;
+ can_id |= 1 << MSCAN_EFF_RTR_SHIFT;
out_be16(®s->tx.idr3_2, can_id);
can_id >>= 16;
- can_id = (can_id & 0x7) | ((can_id << 2) & 0xffe0) | (3 << 3);
+ /* EFF_FLAGS are inbetween the IDs :( */
+ can_id = (can_id & 0x7) | ((can_id << 2) & 0xffe0)
+ | MSCAN_EFF_FLAGS;
} else {
- can_id = (frame->can_id & CAN_SFF_MASK) << 5;
+ can_id = (frame->can_id & CAN_SFF_MASK)
+ << (MSCAN_SFF_RTR_SHIFT + 1);
if (rtr)
- can_id |= 1 << 4;
+ can_id |= 1 << MSCAN_SFF_RTR_SHIFT;
}
out_be16(®s->tx.idr1_0, can_id);
diff --git a/drivers/net/can/mscan/mscan.h b/drivers/net/can/mscan/mscan.h
index 2018000..00fc4aa 100644
--- a/drivers/net/can/mscan/mscan.h
+++ b/drivers/net/can/mscan/mscan.h
@@ -131,6 +131,11 @@
/* MSCAN Miscellaneous Register (CANMISC) bits */
#define MSCAN_BOHOLD 0x01
+/* MSCAN Identifier Register (IDR) bits */
+#define MSCAN_SFF_RTR_SHIFT 4
+#define MSCAN_EFF_RTR_SHIFT 0
+#define MSCAN_EFF_FLAGS 0x18 /* IDE + SRR */
+
#ifdef MSCAN_FOR_MPC5200
#define _MSCAN_RESERVED_(n, num) u8 _res##n[num]
#define _MSCAN_RESERVED_DSR_SIZE 2
--
1.6.3.3
^ permalink raw reply related
* [PATCH 10/11] net/can/mscan: add error path to mscan_open()
From: Wolfram Sang @ 2009-11-16 22:57 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Grant Likely, socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, David Miller,
wg-5Yr1BZd7O62+XT7JhA+gdA
In-Reply-To: <1258412274-14686-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
drivers/net/can/mscan/mscan.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
index 263d1a9..bb06dfb 100644
--- a/drivers/net/can/mscan/mscan.c
+++ b/drivers/net/can/mscan/mscan.c
@@ -542,10 +542,8 @@ static int mscan_open(struct net_device *dev)
ret = request_irq(dev->irq, mscan_isr, 0, dev->name, dev);
if (ret < 0) {
- napi_disable(&priv->napi);
- printk(KERN_ERR "%s - failed to attach interrupt\n",
- dev->name);
- return ret;
+ dev_err(dev->dev.parent, "failed to attach interrupt\n");
+ goto exit_napi_disable;
}
priv->open_time = jiffies;
@@ -554,11 +552,19 @@ static int mscan_open(struct net_device *dev)
ret = mscan_start(dev);
if (ret)
- return ret;
+ goto exit_free_irq;
netif_start_queue(dev);
return 0;
+
+exit_free_irq:
+ priv->open_time = 0;
+ free_irq(dev->irq, dev);
+exit_napi_disable:
+ napi_disable(&priv->napi);
+ close_candev(dev);
+ return ret;
}
static int mscan_close(struct net_device *dev)
--
1.6.3.3
^ permalink raw reply related
* [PATCH 11/11] net/can/mscan: improve build
From: Wolfram Sang @ 2009-11-16 22:57 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Grant Likely, socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, David Miller,
wg-5Yr1BZd7O62+XT7JhA+gdA
In-Reply-To: <1258412274-14686-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
- move Kconfig entries to the subdirectory
- do remaining renames of mpc52xx to mpc5xxx
Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
drivers/net/can/Kconfig | 19 +---
drivers/net/can/mscan/Kconfig | 23 +++
drivers/net/can/mscan/Makefile | 4 +-
drivers/net/can/mscan/mpc52xx_can.c | 259 -----------------------------------
drivers/net/can/mscan/mpc5xxx_can.c | 259 +++++++++++++++++++++++++++++++++++
5 files changed, 285 insertions(+), 279 deletions(-)
create mode 100644 drivers/net/can/mscan/Kconfig
delete mode 100644 drivers/net/can/mscan/mpc52xx_can.c
create mode 100644 drivers/net/can/mscan/mpc5xxx_can.c
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
index c16e6ff..c1cfe2e 100644
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@ -108,24 +108,7 @@ config CAN_MCP251X
---help---
Driver for the Microchip MCP251x SPI CAN controllers.
-config CAN_MSCAN
- depends on CAN_DEV && (PPC || M68K || M68KNOMMU)
- tristate "Support for Freescale MSCAN based chips"
- ---help---
- The Motorola Scalable Controller Area Network (MSCAN) definition
- is based on the MSCAN12 definition which is the specific
- implementation of the Motorola Scalable CAN concept targeted for
- the Motorola MC68HC12 Microcontroller Family.
-
-config CAN_MPC52XX
- tristate "Freescale MPC5xxx onboard CAN controller"
- depends on CAN_MSCAN && PPC_MPC52xx
- ---help---
- If you say yes here you get support for Freescale's MPC52xx
- onboard dualCAN controller.
-
- This driver can also be built as a module. If so, the module
- will be called mpc5xxx_can.
+source "drivers/net/can/mscan/Kconfig"
config CAN_DEBUG_DEVICES
bool "CAN devices debugging messages"
diff --git a/drivers/net/can/mscan/Kconfig b/drivers/net/can/mscan/Kconfig
new file mode 100644
index 0000000..cd0f2d6
--- /dev/null
+++ b/drivers/net/can/mscan/Kconfig
@@ -0,0 +1,23 @@
+config CAN_MSCAN
+ depends on CAN_DEV && (PPC || M68K || M68KNOMMU)
+ tristate "Support for Freescale MSCAN based chips"
+ ---help---
+ The Motorola Scalable Controller Area Network (MSCAN) definition
+ is based on the MSCAN12 definition which is the specific
+ implementation of the Motorola Scalable CAN concept targeted for
+ the Motorola MC68HC12 Microcontroller Family.
+
+if CAN_MSCAN
+
+config CAN_MPC5XXX
+ tristate "Freescale MPC5xxx onboard CAN controller"
+ depends on PPC_MPC52xx
+ ---help---
+ If you say yes here you get support for Freescale's MPC5xxx
+ onboard CAN controller.
+
+ This driver can also be built as a module. If so, the module
+ will be called mscan-mpc5xxx.ko.
+
+endif
+
diff --git a/drivers/net/can/mscan/Makefile b/drivers/net/can/mscan/Makefile
index 2bd9f04..c9fab17 100644
--- a/drivers/net/can/mscan/Makefile
+++ b/drivers/net/can/mscan/Makefile
@@ -1,5 +1,5 @@
-obj-$(CONFIG_CAN_MPC52XX) += mscan-mpc52xx.o
-mscan-mpc52xx-objs := mscan.o mpc52xx_can.o
+obj-$(CONFIG_CAN_MPC5XXX) += mscan-mpc5xxx.o
+mscan-mpc5xxx-objs := mscan.o mpc5xxx_can.o
ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG
diff --git a/drivers/net/can/mscan/mpc52xx_can.c b/drivers/net/can/mscan/mpc52xx_can.c
deleted file mode 100644
index 1de6f63..0000000
--- a/drivers/net/can/mscan/mpc52xx_can.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * CAN bus driver for the Freescale MPC5xxx embedded CPU.
- *
- * Copyright (C) 2004-2005 Andrey Volkov <avolkov-ppI4tVfbJvJWk0Htik3J/w@public.gmane.org>,
- * Varma Electronics Oy
- * Copyright (C) 2008-2009 Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
- * Copyright (C) 2009 Wolfram Sang, Pengutronix <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the version 2 of the GNU General Public License
- * as published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/netdevice.h>
-#include <linux/can.h>
-#include <linux/can/dev.h>
-#include <linux/of_platform.h>
-#include <sysdev/fsl_soc.h>
-#include <linux/io.h>
-#include <asm/mpc52xx.h>
-
-#include "mscan.h"
-
-#define DRV_NAME "mpc5xxx_can"
-
-static struct of_device_id mpc52xx_cdm_ids[] __devinitdata = {
- { .compatible = "fsl,mpc5200-cdm", },
- {}
-};
-
-/*
- * Get frequency of the MSCAN clock source
- *
- * Either the oscillator clock (SYS_XTAL_IN) or the IP bus clock (IP_CLK)
- * can be selected. According to the MPC5200 user's manual, the oscillator
- * clock is the better choice as it has less jitter but due to a hardware
- * bug, it can not be selected for the old MPC5200 Rev. A chips.
- */
-
-static unsigned int __devinit mpc52xx_can_clock_freq(struct of_device *of,
- int clock_src)
-{
- unsigned int pvr;
- struct mpc52xx_cdm __iomem *cdm;
- struct device_node *np_cdm;
- unsigned int freq;
- u32 val;
-
- pvr = mfspr(SPRN_PVR);
-
- freq = mpc5xxx_get_bus_frequency(of->node);
- if (!freq)
- return 0;
-
- if (clock_src == MSCAN_CLKSRC_BUS || pvr == 0x80822011)
- return freq;
-
- /* Determine SYS_XTAL_IN frequency from the clock domain settings */
- np_cdm = of_find_matching_node(NULL, mpc52xx_cdm_ids);
- if (!np_cdm) {
- dev_err(&of->dev, "can't get clock node!\n");
- return 0;
- }
- cdm = of_iomap(np_cdm, 0);
- of_node_put(np_cdm);
-
- if (in_8(&cdm->ipb_clk_sel) & 0x1)
- freq *= 2;
- val = in_be32(&cdm->rstcfg);
-
- freq *= (val & (1 << 5)) ? 8 : 4;
- freq /= (val & (1 << 6)) ? 12 : 16;
-
- iounmap(cdm);
-
- return freq;
-}
-
-static int __devinit mpc5xxx_can_probe(struct of_device *ofdev,
- const struct of_device_id *id)
-{
- struct device_node *np = ofdev->node;
- struct net_device *dev;
- struct mscan_priv *priv;
- void __iomem *base;
- const char *clk_src;
- int err, irq, clock_src;
-
- base = of_iomap(ofdev->node, 0);
- if (!base) {
- dev_err(&ofdev->dev, "couldn't ioremap\n");
- err = -ENOMEM;
- goto exit_release_mem;
- }
-
- irq = irq_of_parse_and_map(np, 0);
- if (!irq) {
- dev_err(&ofdev->dev, "no irq found\n");
- err = -ENODEV;
- goto exit_unmap_mem;
- }
-
- dev = alloc_mscandev();
- if (!dev) {
- err = -ENOMEM;
- goto exit_dispose_irq;
- }
-
- priv = netdev_priv(dev);
- priv->reg_base = base;
- dev->irq = irq;
-
- /*
- * Either the oscillator clock (SYS_XTAL_IN) or the IP bus clock
- * (IP_CLK) can be selected as MSCAN clock source. According to
- * the MPC5200 user's manual, the oscillator clock is the better
- * choice as it has less jitter. For this reason, it is selected
- * by default.
- */
- clk_src = of_get_property(np, "fsl,mscan-clock-source", NULL);
- if (clk_src && strcmp(clk_src, "ip") == 0)
- clock_src = MSCAN_CLKSRC_BUS;
- else
- clock_src = MSCAN_CLKSRC_XTAL;
- priv->can.clock.freq = mpc52xx_can_clock_freq(ofdev, clock_src);
- if (!priv->can.clock.freq) {
- dev_err(&ofdev->dev, "couldn't get MSCAN clock frequency\n");
- err = -ENODEV;
- goto exit_free_mscan;
- }
-
- SET_NETDEV_DEV(dev, &ofdev->dev);
-
- err = register_mscandev(dev, clock_src);
- if (err) {
- dev_err(&ofdev->dev, "registering %s failed (err=%d)\n",
- DRV_NAME, err);
- goto exit_free_mscan;
- }
-
- dev_set_drvdata(&ofdev->dev, dev);
-
- dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
- priv->reg_base, dev->irq, priv->can.clock.freq);
-
- return 0;
-
-exit_free_mscan:
- free_candev(dev);
-exit_dispose_irq:
- irq_dispose_mapping(irq);
-exit_unmap_mem:
- iounmap(base);
-exit_release_mem:
- return err;
-}
-
-static int __devexit mpc5xxx_can_remove(struct of_device *ofdev)
-{
- struct net_device *dev = dev_get_drvdata(&ofdev->dev);
- struct mscan_priv *priv = netdev_priv(dev);
-
- dev_set_drvdata(&ofdev->dev, NULL);
-
- unregister_mscandev(dev);
- iounmap(priv->reg_base);
- irq_dispose_mapping(dev->irq);
- free_candev(dev);
-
- return 0;
-}
-
-#ifdef CONFIG_PM
-static struct mscan_regs saved_regs;
-static int mpc5xxx_can_suspend(struct of_device *ofdev, pm_message_t state)
-{
- struct net_device *dev = dev_get_drvdata(&ofdev->dev);
- struct mscan_priv *priv = netdev_priv(dev);
- struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
-
- _memcpy_fromio(&saved_regs, regs, sizeof(*regs));
-
- return 0;
-}
-
-static int mpc5xxx_can_resume(struct of_device *ofdev)
-{
- struct net_device *dev = dev_get_drvdata(&ofdev->dev);
- struct mscan_priv *priv = netdev_priv(dev);
- struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
-
- regs->canctl0 |= MSCAN_INITRQ;
- while (!(regs->canctl1 & MSCAN_INITAK))
- udelay(10);
-
- regs->canctl1 = saved_regs.canctl1;
- regs->canbtr0 = saved_regs.canbtr0;
- regs->canbtr1 = saved_regs.canbtr1;
- regs->canidac = saved_regs.canidac;
-
- /* restore masks, buffers etc. */
- _memcpy_toio(®s->canidar1_0, (void *)&saved_regs.canidar1_0,
- sizeof(*regs) - offsetof(struct mscan_regs, canidar1_0));
-
- regs->canctl0 &= ~MSCAN_INITRQ;
- regs->cantbsel = saved_regs.cantbsel;
- regs->canrier = saved_regs.canrier;
- regs->cantier = saved_regs.cantier;
- regs->canctl0 = saved_regs.canctl0;
-
- return 0;
-}
-#endif
-
-static struct of_device_id __devinitdata mpc5xxx_can_table[] = {
- {.compatible = "fsl,mpc5200-mscan"},
- {},
-};
-
-static struct of_platform_driver mpc5xxx_can_driver = {
- .owner = THIS_MODULE,
- .name = "mpc5xxx_can",
- .probe = mpc5xxx_can_probe,
- .remove = __devexit_p(mpc5xxx_can_remove),
-#ifdef CONFIG_PM
- .suspend = mpc5xxx_can_suspend,
- .resume = mpc5xxx_can_resume,
-#endif
- .match_table = mpc5xxx_can_table,
-};
-
-static int __init mpc5xxx_can_init(void)
-{
- return of_register_platform_driver(&mpc5xxx_can_driver);
-}
-module_init(mpc5xxx_can_init);
-
-static void __exit mpc5xxx_can_exit(void)
-{
- return of_unregister_platform_driver(&mpc5xxx_can_driver);
-};
-module_exit(mpc5xxx_can_exit);
-
-MODULE_AUTHOR("Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>");
-MODULE_DESCRIPTION("Freescale MPC5200 CAN driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
new file mode 100644
index 0000000..1de6f63
--- /dev/null
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -0,0 +1,259 @@
+/*
+ * CAN bus driver for the Freescale MPC5xxx embedded CPU.
+ *
+ * Copyright (C) 2004-2005 Andrey Volkov <avolkov-ppI4tVfbJvJWk0Htik3J/w@public.gmane.org>,
+ * Varma Electronics Oy
+ * Copyright (C) 2008-2009 Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
+ * Copyright (C) 2009 Wolfram Sang, Pengutronix <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the version 2 of the GNU General Public License
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/netdevice.h>
+#include <linux/can.h>
+#include <linux/can/dev.h>
+#include <linux/of_platform.h>
+#include <sysdev/fsl_soc.h>
+#include <linux/io.h>
+#include <asm/mpc52xx.h>
+
+#include "mscan.h"
+
+#define DRV_NAME "mpc5xxx_can"
+
+static struct of_device_id mpc52xx_cdm_ids[] __devinitdata = {
+ { .compatible = "fsl,mpc5200-cdm", },
+ {}
+};
+
+/*
+ * Get frequency of the MSCAN clock source
+ *
+ * Either the oscillator clock (SYS_XTAL_IN) or the IP bus clock (IP_CLK)
+ * can be selected. According to the MPC5200 user's manual, the oscillator
+ * clock is the better choice as it has less jitter but due to a hardware
+ * bug, it can not be selected for the old MPC5200 Rev. A chips.
+ */
+
+static unsigned int __devinit mpc52xx_can_clock_freq(struct of_device *of,
+ int clock_src)
+{
+ unsigned int pvr;
+ struct mpc52xx_cdm __iomem *cdm;
+ struct device_node *np_cdm;
+ unsigned int freq;
+ u32 val;
+
+ pvr = mfspr(SPRN_PVR);
+
+ freq = mpc5xxx_get_bus_frequency(of->node);
+ if (!freq)
+ return 0;
+
+ if (clock_src == MSCAN_CLKSRC_BUS || pvr == 0x80822011)
+ return freq;
+
+ /* Determine SYS_XTAL_IN frequency from the clock domain settings */
+ np_cdm = of_find_matching_node(NULL, mpc52xx_cdm_ids);
+ if (!np_cdm) {
+ dev_err(&of->dev, "can't get clock node!\n");
+ return 0;
+ }
+ cdm = of_iomap(np_cdm, 0);
+ of_node_put(np_cdm);
+
+ if (in_8(&cdm->ipb_clk_sel) & 0x1)
+ freq *= 2;
+ val = in_be32(&cdm->rstcfg);
+
+ freq *= (val & (1 << 5)) ? 8 : 4;
+ freq /= (val & (1 << 6)) ? 12 : 16;
+
+ iounmap(cdm);
+
+ return freq;
+}
+
+static int __devinit mpc5xxx_can_probe(struct of_device *ofdev,
+ const struct of_device_id *id)
+{
+ struct device_node *np = ofdev->node;
+ struct net_device *dev;
+ struct mscan_priv *priv;
+ void __iomem *base;
+ const char *clk_src;
+ int err, irq, clock_src;
+
+ base = of_iomap(ofdev->node, 0);
+ if (!base) {
+ dev_err(&ofdev->dev, "couldn't ioremap\n");
+ err = -ENOMEM;
+ goto exit_release_mem;
+ }
+
+ irq = irq_of_parse_and_map(np, 0);
+ if (!irq) {
+ dev_err(&ofdev->dev, "no irq found\n");
+ err = -ENODEV;
+ goto exit_unmap_mem;
+ }
+
+ dev = alloc_mscandev();
+ if (!dev) {
+ err = -ENOMEM;
+ goto exit_dispose_irq;
+ }
+
+ priv = netdev_priv(dev);
+ priv->reg_base = base;
+ dev->irq = irq;
+
+ /*
+ * Either the oscillator clock (SYS_XTAL_IN) or the IP bus clock
+ * (IP_CLK) can be selected as MSCAN clock source. According to
+ * the MPC5200 user's manual, the oscillator clock is the better
+ * choice as it has less jitter. For this reason, it is selected
+ * by default.
+ */
+ clk_src = of_get_property(np, "fsl,mscan-clock-source", NULL);
+ if (clk_src && strcmp(clk_src, "ip") == 0)
+ clock_src = MSCAN_CLKSRC_BUS;
+ else
+ clock_src = MSCAN_CLKSRC_XTAL;
+ priv->can.clock.freq = mpc52xx_can_clock_freq(ofdev, clock_src);
+ if (!priv->can.clock.freq) {
+ dev_err(&ofdev->dev, "couldn't get MSCAN clock frequency\n");
+ err = -ENODEV;
+ goto exit_free_mscan;
+ }
+
+ SET_NETDEV_DEV(dev, &ofdev->dev);
+
+ err = register_mscandev(dev, clock_src);
+ if (err) {
+ dev_err(&ofdev->dev, "registering %s failed (err=%d)\n",
+ DRV_NAME, err);
+ goto exit_free_mscan;
+ }
+
+ dev_set_drvdata(&ofdev->dev, dev);
+
+ dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
+ priv->reg_base, dev->irq, priv->can.clock.freq);
+
+ return 0;
+
+exit_free_mscan:
+ free_candev(dev);
+exit_dispose_irq:
+ irq_dispose_mapping(irq);
+exit_unmap_mem:
+ iounmap(base);
+exit_release_mem:
+ return err;
+}
+
+static int __devexit mpc5xxx_can_remove(struct of_device *ofdev)
+{
+ struct net_device *dev = dev_get_drvdata(&ofdev->dev);
+ struct mscan_priv *priv = netdev_priv(dev);
+
+ dev_set_drvdata(&ofdev->dev, NULL);
+
+ unregister_mscandev(dev);
+ iounmap(priv->reg_base);
+ irq_dispose_mapping(dev->irq);
+ free_candev(dev);
+
+ return 0;
+}
+
+#ifdef CONFIG_PM
+static struct mscan_regs saved_regs;
+static int mpc5xxx_can_suspend(struct of_device *ofdev, pm_message_t state)
+{
+ struct net_device *dev = dev_get_drvdata(&ofdev->dev);
+ struct mscan_priv *priv = netdev_priv(dev);
+ struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
+
+ _memcpy_fromio(&saved_regs, regs, sizeof(*regs));
+
+ return 0;
+}
+
+static int mpc5xxx_can_resume(struct of_device *ofdev)
+{
+ struct net_device *dev = dev_get_drvdata(&ofdev->dev);
+ struct mscan_priv *priv = netdev_priv(dev);
+ struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
+
+ regs->canctl0 |= MSCAN_INITRQ;
+ while (!(regs->canctl1 & MSCAN_INITAK))
+ udelay(10);
+
+ regs->canctl1 = saved_regs.canctl1;
+ regs->canbtr0 = saved_regs.canbtr0;
+ regs->canbtr1 = saved_regs.canbtr1;
+ regs->canidac = saved_regs.canidac;
+
+ /* restore masks, buffers etc. */
+ _memcpy_toio(®s->canidar1_0, (void *)&saved_regs.canidar1_0,
+ sizeof(*regs) - offsetof(struct mscan_regs, canidar1_0));
+
+ regs->canctl0 &= ~MSCAN_INITRQ;
+ regs->cantbsel = saved_regs.cantbsel;
+ regs->canrier = saved_regs.canrier;
+ regs->cantier = saved_regs.cantier;
+ regs->canctl0 = saved_regs.canctl0;
+
+ return 0;
+}
+#endif
+
+static struct of_device_id __devinitdata mpc5xxx_can_table[] = {
+ {.compatible = "fsl,mpc5200-mscan"},
+ {},
+};
+
+static struct of_platform_driver mpc5xxx_can_driver = {
+ .owner = THIS_MODULE,
+ .name = "mpc5xxx_can",
+ .probe = mpc5xxx_can_probe,
+ .remove = __devexit_p(mpc5xxx_can_remove),
+#ifdef CONFIG_PM
+ .suspend = mpc5xxx_can_suspend,
+ .resume = mpc5xxx_can_resume,
+#endif
+ .match_table = mpc5xxx_can_table,
+};
+
+static int __init mpc5xxx_can_init(void)
+{
+ return of_register_platform_driver(&mpc5xxx_can_driver);
+}
+module_init(mpc5xxx_can_init);
+
+static void __exit mpc5xxx_can_exit(void)
+{
+ return of_unregister_platform_driver(&mpc5xxx_can_driver);
+};
+module_exit(mpc5xxx_can_exit);
+
+MODULE_AUTHOR("Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>");
+MODULE_DESCRIPTION("Freescale MPC5200 CAN driver");
+MODULE_LICENSE("GPL v2");
--
1.6.3.3
^ permalink raw reply related
* 2.6.32-rc7-git1: Reported regressions 2.6.30 -> 2.6.31
From: Rafael J. Wysocki @ 2009-11-16 22:58 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Andrew Morton, Linus Torvalds, Natalie Protasevich,
Kernel Testers List, Network Development, Linux ACPI,
Linux PM List, Linux SCSI List, Linux Wireless List, DRI
This message contains a list of some regressions introduced between 2.6.30 and
2.6.31, for which there are no fixes in the mainline I know of. If any of them
have been fixed already, please let me know.
If you know of any other unresolved regressions introduced between 2.6.30
and 2.6.31, please let me know either and I'll add them to the list.
Also, please let me know if any of the entries below are invalid.
Each entry from the list will be sent additionally in an automatic reply to
this message with CCs to the people involved in reporting and handling the
issue.
Listed regressions statistics:
Date Total Pending Unresolved
----------------------------------------
2009-11-17 176 34 30
2009-10-26 170 37 32
2009-10-12 161 45 35
2009-10-02 151 49 42
2009-09-06 123 34 27
2009-08-26 108 33 26
2009-08-20 102 32 29
2009-08-10 89 27 24
2009-08-02 76 36 28
2009-07-27 70 51 43
2009-07-07 35 25 21
2009-06-29 22 22 15
Unresolved regressions
----------------------
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14623
Subject : Mount -o sync regression in 2.6.31
Submitter : Stephen Hemminger <shemminger@vyatta.com>
Date : 2009-11-11 20:33 (6 days old)
References : http://marc.info/?l=linux-kernel&m=125797165709131&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14588
Subject : Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ccccb5b0
Submitter : Hideki Yamane <henrich@debian.or.jp>
Date : 2009-11-12 02:25 (5 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14484
Subject : no video output after suspend
Submitter : Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Date : 2009-10-25 20:57 (23 days old)
References : http://marc.info/?l=linux-kernel&m=125650430123713&w=4
Handled-By : Jesse Barnes <jbarnes@virtuousgeek.org>
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14476
Subject : Unable to handle kernel paging request in nfs_write_mapping
Submitter : Stephan von Krawczynski <skraw@ithnet.com>
Date : 2009-10-14 9:53 (34 days old)
References : http://marc.info/?l=linux-kernel&m=125551421405656&w=4
Handled-By : Trond Myklebust <Trond.Myklebust@netapp.com>
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14474
Subject : restorecond going crazy on 2.6.31.4 - inotify regression?
Submitter : Robert Hancock <hancockrwd@gmail.com>
Date : 2009-10-16 0:03 (32 days old)
References : http://marc.info/?l=linux-kernel&m=125565159520489&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14460
Subject : No wireless connection with Ralink RT2500 since update to kernel 2.6.31
Submitter : Filipp Andjelo <andjelo@gmx.net>
Date : 2009-10-24 21:18 (24 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14450
Subject : [2.6.31] Network interfaces are dead with 2.6.31 (iwlagn and sky2)
Submitter : A. G. <orion.linbug@gmail.com>
Date : 2009-10-21 07:30 (27 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14448
Subject : PAT cpu feature is absent but detected by Xorg and others, cuses video driver problems
Submitter : Aleksei Lukin <lukin@stu.cn.ua>
Date : 2009-10-20 17:54 (28 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14417
Subject : [Regression] Wireless driver iwlagn+iwlcore doesn't work after resume (needs reloading)
Submitter : Eddy Petrișor <eddy.petrisor+linbug@gmail.com>
Date : 2009-10-16 11:07 (32 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14400
Subject : disable/enable wlan broken with ath5k
Submitter : Daniel Bumke <danielbumke@gmail.com>
Date : 2009-10-13 12:35 (35 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14391
Subject : use after free of struct powernow_k8_data
Submitter : Michal Schmidt <mschmidt@redhat.com>
Date : 2009-09-24 14:51 (54 days old)
References : http://marc.info/?l=linux-kernel&m=125380383515615&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14385
Subject : DMAR regression in 2.6.31 leads to ext4 corruption?
Submitter : Andy Isaacson <adi@hexapodia.org>
Date : 2009-10-08 23:56 (40 days old)
References : http://marc.info/?l=linux-kernel&m=125504643703877&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14294
Subject : kernel BUG at drivers/ide/ide-disk.c:187
Submitter : Santiago Garcia Mantinan <manty@manty.net>
Date : 2009-09-30 11:05 (48 days old)
References : http://marc.info/?l=linux-kernel&m=125430926311466&w=4
Handled-By : David Miller <davem@davemloft.net>
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14267
Subject : Disassociating atheros wlan
Submitter : Kristoffer Ericson <kristoffer.ericson@gmail.com>
Date : 2009-09-24 10:16 (54 days old)
References : http://marc.info/?l=linux-kernel&m=125378723723384&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14265
Subject : ifconfig: page allocation failure. order:5, mode:0x8020 w/ e100
Submitter : Karol Lewandowski <karol.k.lewandowski@gmail.com>
Date : 2009-09-15 12:05 (63 days old)
References : http://marc.info/?l=linux-kernel&m=125301636509517&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14257
Subject : Not able to boot on 32 bit System
Submitter : Rishikesh <risrajak@linux.vnet.ibm.com>
Date : 2009-09-21 15:25 (57 days old)
References : http://marc.info/?l=linux-kernel&m=125354604314412&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14256
Subject : kernel BUG at fs/ext3/super.c:435
Submitter : Mikael Pettersson <mikpe@it.uu.se>
Date : 2009-09-21 7:29 (57 days old)
References : http://marc.info/?l=linux-kernel&m=125351816109264&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14252
Subject : WARNING: at include/linux/skbuff.h:1382 w/ e1000
Submitter : Stephan von Krawczynski <skraw@ithnet.com>
Date : 2009-09-20 11:26 (58 days old)
References : http://marc.info/?l=linux-kernel&m=125344599006033&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14204
Subject : MCE prevent booting on my computer(pentium iii @500Mhz)
Submitter : GNUtoo <GNUtoo@no-log.org>
Date : 2009-09-21 20:36 (57 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14181
Subject : b43 causes panic at ifconfig down / shutdown
Submitter : Jeremy Huddleston <jeremyhu@freedesktop.org>
Date : 2009-09-15 18:34 (63 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14157
Subject : end_request: I/O error, dev cciss/cXdX, sector 0
Submitter : <jiri.harcarik@gmail.com>
Date : 2009-09-11 07:42 (67 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14141
Subject : order 2 page allocation failures in iwlagn
Submitter : Frans Pop <elendil@planet.nl>
Date : 2009-09-06 7:40 (72 days old)
First-Bad-Commit: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2ff05b2b4eac2e63d345fc731ea151a060247f53
References : http://marc.info/?l=linux-kernel&m=125222287419691&w=4
http://lkml.org/lkml/2009/10/2/86
http://lkml.org/lkml/2009/10/5/24
http://lkml.indiana.edu/hypermail/linux/kernel/0910.1/01395.html
Handled-By : Pekka Enberg <penberg@cs.helsinki.fi>
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14114
Subject : Tuning a saa7134 based card is broken in kernel 2.6.31-rc7
Submitter : Tsvety Petrov <Tsvetoslav.Petrov@itron.com>
Date : 2009-09-03 21:06 (75 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=13987
Subject : Received NMI interrupt at resume
Submitter : Christian Casteyde <casteyde.christian@free.fr>
Date : 2009-08-15 07:55 (94 days old)
First-Bad-Commit: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f41f3f373dd72344c65d801d6381fe83ef3a2c54
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=13943
Subject : WARNING: at net/mac80211/mlme.c:2292 with ath5k
Submitter : Fabio Comolli <fabio.comolli@gmail.com>
Date : 2009-08-06 20:15 (103 days old)
References : http://marc.info/?l=linux-kernel&m=124958978600600&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=13941
Subject : x86 Geode issue
Submitter : Martin-Éric Racine <q-funk@iki.fi>
Date : 2009-08-03 12:58 (106 days old)
References : http://marc.info/?l=linux-kernel&m=124930434732481&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=13836
Subject : suspend script fails, related to stdout?
Submitter : Tomas M. <tmezzadra@gmail.com>
Date : 2009-07-17 21:24 (123 days old)
References : http://marc.info/?l=linux-kernel&m=124785853811667&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=13809
Subject : oprofile: possible circular locking dependency detected
Submitter : Jerome Marchand <jmarchan@redhat.com>
Date : 2009-07-22 13:35 (118 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=13733
Subject : 2.6.31-rc2: irq 16: nobody cared
Submitter : Niel Lambrechts <niel.lambrechts@gmail.com>
Date : 2009-07-06 18:32 (134 days old)
References : http://marc.info/?l=linux-kernel&m=124690524027166&w=4
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=13645
Subject : NULL pointer dereference at (null) (level2_spare_pgt)
Submitter : poornima nayak <mpnayak@linux.vnet.ibm.com>
Date : 2009-06-17 17:56 (153 days old)
References : http://lkml.org/lkml/2009/6/17/194
Regressions with patches
------------------------
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14340
Subject : speedstep-ich driver not working in 2.6.31
Submitter : <dave.mueller@gmx.ch>
Date : 2009-10-07 08:16 (41 days old)
Handled-By : Eric Pielbug <e.a.b.piel@tudelft.nl>
Rusty Russell <rusty@rustcorp.com.au>
Patch : http://patchwork.kernel.org/patch/54672/
http://patchwork.kernel.org/patch/54671/
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14253
Subject : Oops in driversbasefirmware_class
Submitter : Lars Ericsson <Lars_Ericsson@telia.com>
Date : 2009-09-16 20:44 (62 days old)
References : http://lkml.org/lkml/2009/9/16/461
Handled-By : Frederik Deweerdt <frederik.deweerdt@xprog.eu>
Patch : http://patchwork.kernel.org/patch/49914/
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14137
Subject : usb console regressions
Submitter : Jason Wessel <jason.wessel@windriver.com>
Date : 2009-09-05 21:08 (73 days old)
References : http://marc.info/?l=linux-kernel&m=125218501310512&w=4
Handled-By : Jason Wessel <jason.wessel@windriver.com>
Patch : http://patchwork.kernel.org/patch/45953/
http://patchwork.kernel.org/patch/45952/
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14017
Subject : _end symbol missing from Symbol.map
Submitter : Hannes Reinecke <hare@suse.de>
Date : 2009-08-13 6:45 (96 days old)
First-Bad-Commit: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=091e52c3551d3031343df24b573b770b4c6c72b6
References : http://marc.info/?l=linux-kernel&m=125014649102253&w=4
Handled-By : Hannes Reinecke <hare@suse.de>
Patch : http://marc.info/?l=linux-kernel&m=125014649102253&w=4
For details, please visit the bug entries and follow the links given in
references.
As you can see, there is a Bugzilla entry for each of the listed regressions.
There also is a Bugzilla entry used for tracking the regressions introduced
between 2.6.30 and 2.6.31, unresolved as well as resolved, at:
http://bugzilla.kernel.org/show_bug.cgi?id=13615
Please let me know if there are any Bugzilla entries that should be added to
the list in there.
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: 2.6.32-rc7-git1: Reported regressions 2.6.30 -> 2.6.31
From: Larry Finger @ 2009-11-16 23:30 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux Kernel Mailing List, Andrew Morton, Linus Torvalds,
Natalie Protasevich, Kernel Testers List, Network Development,
Linux ACPI, Linux PM List, Linux SCSI List, Linux Wireless List,
DRI
In-Reply-To: <ipicVA1QUFF.A.zWB.1mdALB@chimera>
On 11/16/2009 04:58 PM, Rafael J. Wysocki wrote:
> This message contains a list of some regressions introduced between 2.6.30 and
> 2.6.31, for which there are no fixes in the mainline I know of. If any of them
> have been fixed already, please let me know.
>
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14181
> Subject : b43 causes panic at ifconfig down / shutdown
> Submitter : Jeremy Huddleston <jeremyhu@freedesktop.org>
> Date : 2009-09-15 18:34 (63 days old)
This one is fixed by commit d50bae33d1358b909ade05ae121d83d3a60ab63f in
mainline. The patch was also sent to stable.
Larry
^ permalink raw reply
* Re: 2.6.32-rc7-git1: Reported regressions 2.6.30 -> 2.6.31
From: Rafael J. Wysocki @ 2009-11-16 23:35 UTC (permalink / raw)
To: Larry Finger
Cc: Linux Kernel Mailing List, Andrew Morton, Linus Torvalds,
Natalie Protasevich, Kernel Testers List, Network Development,
Linux ACPI, Linux PM List, Linux SCSI List, Linux Wireless List,
DRI
In-Reply-To: <4B01E09D.3020608-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
On Tuesday 17 November 2009, Larry Finger wrote:
> On 11/16/2009 04:58 PM, Rafael J. Wysocki wrote:
> > This message contains a list of some regressions introduced between 2.6.30 and
> > 2.6.31, for which there are no fixes in the mainline I know of. If any of them
> > have been fixed already, please let me know.
> >
> > Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14181
> > Subject : b43 causes panic at ifconfig down / shutdown
> > Submitter : Jeremy Huddleston <jeremyhu-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org>
> > Date : 2009-09-15 18:34 (63 days old)
>
> This one is fixed by commit d50bae33d1358b909ade05ae121d83d3a60ab63f in
> mainline. The patch was also sent to stable.
Thanks, closed.
Rafael
^ permalink raw reply
* [PATCH 2.6.32-rc3] net: Getting rid of the x86 dependency to built vmxnet3
From: Shreyas Bhatewara @ 2009-11-16 23:41 UTC (permalink / raw)
To: netdev; +Cc: pv-drivers, linux-kernel
In-Reply-To: <alpine.LRH.2.00.0910280910250.24555@sbhatewara-dev1.eng.vmware.com>
Getting rid of the x86 dependency to built vmxnet3
From: Shreyas Bhatewara <sbhatewara@vmware.com>
This patch removes config dependency on x86 to build vmxnet3 driver. Thus
the driver can be built on big endian architectures now. Although vmxnet3
is not supported on VMs other than x86 architecture, all this code goes in
to ensure correctness. If the code is not dependent on x86, it should not
assume little endian architecture in any of its operations.
Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>
---
Folks,
Device emulation for vmxnet3 expects all the data written in shared space
to be little endian. Current vmxnet3 driver assumes X86 architecture underneath
and hence writes to the shared space directly. This patch uses cpu_to_le and
le_to_cpu calls to access data shared between device and driver, ensuring that
anything written there is little endian irrespective of CPU byte ordering. The
dependency on X86 or assumption that underlying architecture is X86 is thus
removed.
I have used the conversion macros (cpu_to_le32 etc.) for accessing all multibyte
data fields. Bitfields, have been revesered in order if the code is compiled
under big endian architecture. Further if driver is running in big endian,
cpu_to_le and le_to_cpu are used after writing and before reading bitfields
respectively. Also, temporary descriptors are used while writing into
bitfields so that the shared bits are not touched twice (once while actual
writing and secondly while converting to le format).
Please consider for inclusion in the net-next-2.6 tree.
Thanking you.
->Shreyas
---
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e012c2e..6399abb 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -3235,7 +3235,7 @@ config VIRTIO_NET
config VMXNET3
tristate "VMware VMXNET3 ethernet driver"
- depends on PCI && X86 && INET
+ depends on PCI && INET
help
This driver supports VMware's vmxnet3 virtual ethernet NIC.
To compile this driver as a module, choose M here: the
diff --git a/drivers/net/vmxnet3/vmxnet3_defs.h b/drivers/net/vmxnet3/vmxnet3_defs.h
index dc8ee44..b4889e6 100644
--- a/drivers/net/vmxnet3/vmxnet3_defs.h
+++ b/drivers/net/vmxnet3/vmxnet3_defs.h
@@ -90,23 +90,60 @@ enum {
VMXNET3_CMD_GET_CONF_INTR
};
-struct Vmxnet3_TxDesc {
- u64 addr;
+/*
+ * Little Endian layout of bitfields -
+ * Byte 0 : 7.....len.....0
+ * Byte 1 : rsvd gen 13.len.8
+ * Byte 2 : 5.msscof.0 ext1 dtype
+ * Byte 3 : 13...msscof...6
+ *
+ * Big Endian layout of bitfields -
+ * Byte 0: 13...msscof...6
+ * Byte 1 : 5.msscof.0 ext1 dtype
+ * Byte 2 : rsvd gen 13.len.8
+ * Byte 3 : 7.....len.....0
+ *
+ * Thus, le32_to_cpu on the dword will allow the big endian driver to read
+ * the bit fields correctly. And cpu_to_le32 will convert bitfields
+ * bit fields written by big endian driver to format required by device.
+ */
- u32 len:14;
- u32 gen:1; /* generation bit */
- u32 rsvd:1;
- u32 dtype:1; /* descriptor type */
- u32 ext1:1;
- u32 msscof:14; /* MSS, checksum offset, flags */
-
- u32 hlen:10; /* header len */
- u32 om:2; /* offload mode */
- u32 eop:1; /* End Of Packet */
- u32 cq:1; /* completion request */
- u32 ext2:1;
- u32 ti:1; /* VLAN Tag Insertion */
- u32 tci:16; /* Tag to Insert */
+struct Vmxnet3_TxDesc {
+ __le64 addr;
+
+#ifdef __BIG_ENDIAN_BITFIELD
+ u32 msscof:14; /* MSS, checksum offset, flags */
+ u32 ext1:1;
+ u32 dtype:1; /* descriptor type */
+ u32 rsvd:1;
+ u32 gen:1; /* generation bit */
+ u32 len:14;
+#else
+ u32 len:14;
+ u32 gen:1; /* generation bit */
+ u32 rsvd:1;
+ u32 dtype:1; /* descriptor type */
+ u32 ext1:1;
+ u32 msscof:14; /* MSS, checksum offset, flags */
+#endif /* __BIG_ENDIAN_BITFIELD */
+
+#ifdef __BIG_ENDIAN_BITFIELD
+ u32 tci:16; /* Tag to Insert */
+ u32 ti:1; /* VLAN Tag Insertion */
+ u32 ext2:1;
+ u32 cq:1; /* completion request */
+ u32 eop:1; /* End Of Packet */
+ u32 om:2; /* offload mode */
+ u32 hlen:10; /* header len */
+#else
+ u32 hlen:10; /* header len */
+ u32 om:2; /* offload mode */
+ u32 eop:1; /* End Of Packet */
+ u32 cq:1; /* completion request */
+ u32 ext2:1;
+ u32 ti:1; /* VLAN Tag Insertion */
+ u32 tci:16; /* Tag to Insert */
+#endif /* __BIG_ENDIAN_BITFIELD */
};
/* TxDesc.OM values */
@@ -118,6 +155,8 @@ struct Vmxnet3_TxDesc {
#define VMXNET3_TXD_EOP_SHIFT 12
#define VMXNET3_TXD_CQ_SHIFT 13
#define VMXNET3_TXD_GEN_SHIFT 14
+#define VMXNET3_TXD_EOP_DWORD_SHIFT 3
+#define VMXNET3_TXD_GEN_DWORD_SHIFT 2
#define VMXNET3_TXD_CQ (1 << VMXNET3_TXD_CQ_SHIFT)
#define VMXNET3_TXD_EOP (1 << VMXNET3_TXD_EOP_SHIFT)
@@ -130,29 +169,40 @@ struct Vmxnet3_TxDataDesc {
u8 data[VMXNET3_HDR_COPY_SIZE];
};
+#define VMXNET3_TCD_GEN_SHIFT 31
+#define VMXNET3_TCD_GEN_SIZE 1
+#define VMXNET3_TCD_TXIDX_SHIFT 0
+#define VMXNET3_TCD_TXIDX_SIZE 12
+#define VMXNET3_TCD_GEN_DWORD_SHIFT 3
struct Vmxnet3_TxCompDesc {
u32 txdIdx:12; /* Index of the EOP TxDesc */
u32 ext1:20;
- u32 ext2;
- u32 ext3;
+ __le32 ext2;
+ __le32 ext3;
u32 rsvd:24;
u32 type:7; /* completion type */
u32 gen:1; /* generation bit */
};
-
struct Vmxnet3_RxDesc {
- u64 addr;
+ __le64 addr;
+#ifdef __BIG_ENDIAN_BITFIELD
+ u32 gen:1; /* Generation bit */
+ u32 rsvd:15;
+ u32 dtype:1; /* Descriptor type */
+ u32 btype:1; /* Buffer Type */
+ u32 len:14;
+#else
u32 len:14;
u32 btype:1; /* Buffer Type */
u32 dtype:1; /* Descriptor type */
u32 rsvd:15;
u32 gen:1; /* Generation bit */
-
+#endif
u32 ext1;
};
@@ -164,8 +214,17 @@ struct Vmxnet3_RxDesc {
#define VMXNET3_RXD_BTYPE_SHIFT 14
#define VMXNET3_RXD_GEN_SHIFT 31
-
struct Vmxnet3_RxCompDesc {
+#ifdef __BIG_ENDIAN_BITFIELD
+ u32 ext2:1;
+ u32 cnc:1; /* Checksum Not Calculated */
+ u32 rssType:4; /* RSS hash type used */
+ u32 rqID:10; /* rx queue/ring ID */
+ u32 sop:1; /* Start of Packet */
+ u32 eop:1; /* End of Packet */
+ u32 ext1:2;
+ u32 rxdIdx:12; /* Index of the RxDesc */
+#else
u32 rxdIdx:12; /* Index of the RxDesc */
u32 ext1:2;
u32 eop:1; /* End of Packet */
@@ -174,14 +233,36 @@ struct Vmxnet3_RxCompDesc {
u32 rssType:4; /* RSS hash type used */
u32 cnc:1; /* Checksum Not Calculated */
u32 ext2:1;
+#endif /* __BIG_ENDIAN_BITFIELD */
- u32 rssHash; /* RSS hash value */
+ __le32 rssHash; /* RSS hash value */
+#ifdef __BIG_ENDIAN_BITFIELD
+ u32 tci:16; /* Tag stripped */
+ u32 ts:1; /* Tag is stripped */
+ u32 err:1; /* Error */
+ u32 len:14; /* data length */
+#else
u32 len:14; /* data length */
u32 err:1; /* Error */
u32 ts:1; /* Tag is stripped */
u32 tci:16; /* Tag stripped */
+#endif /* __BIG_ENDIAN_BITFIELD */
+
+#ifdef __BIG_ENDIAN_BITFIELD
+ u32 gen:1; /* generation bit */
+ u32 type:7; /* completion type */
+ u32 fcs:1; /* Frame CRC correct */
+ u32 frg:1; /* IP Fragment */
+ u32 v4:1; /* IPv4 */
+ u32 v6:1; /* IPv6 */
+ u32 ipc:1; /* IP Checksum Correct */
+ u32 tcp:1; /* TCP packet */
+ u32 udp:1; /* UDP packet */
+ u32 tuc:1; /* TCP/UDP Checksum Correct */
+ u32 csum:16;
+#else
u32 csum:16;
u32 tuc:1; /* TCP/UDP Checksum Correct */
u32 udp:1; /* UDP packet */
@@ -193,6 +274,7 @@ struct Vmxnet3_RxCompDesc {
u32 fcs:1; /* Frame CRC correct */
u32 type:7; /* completion type */
u32 gen:1; /* generation bit */
+#endif /* __BIG_ENDIAN_BITFIELD */
};
/* fields in RxCompDesc we access via Vmxnet3_GenericDesc.dword[3] */
@@ -206,6 +288,8 @@ struct Vmxnet3_RxCompDesc {
/* csum OK for TCP/UDP pkts over IP */
#define VMXNET3_RCD_CSUM_OK (1 << VMXNET3_RCD_TUC_SHIFT | \
1 << VMXNET3_RCD_IPC_SHIFT)
+#define VMXNET3_TXD_GEN_SIZE 1
+#define VMXNET3_TXD_EOP_SIZE 1
/* value of RxCompDesc.rssType */
enum {
@@ -219,9 +303,9 @@ enum {
/* a union for accessing all cmd/completion descriptors */
union Vmxnet3_GenericDesc {
- u64 qword[2];
- u32 dword[4];
- u16 word[8];
+ __le64 qword[2];
+ __le32 dword[4];
+ __le16 word[8];
struct Vmxnet3_TxDesc txd;
struct Vmxnet3_RxDesc rxd;
struct Vmxnet3_TxCompDesc tcd;
@@ -287,18 +371,24 @@ enum {
struct Vmxnet3_GOSInfo {
- u32 gosBits:2; /* 32-bit or 64-bit? */
- u32 gosType:4; /* which guest */
- u32 gosVer:16; /* gos version */
- u32 gosMisc:10; /* other info about gos */
+#ifdef __BIG_ENDIAN_BITFIELD
+ u32 gosMisc:10; /* other info about gos */
+ u32 gosVer:16; /* gos version */
+ u32 gosType:4; /* which guest */
+ u32 gosBits:2; /* 32-bit or 64-bit? */
+#else
+ u32 gosBits:2; /* 32-bit or 64-bit? */
+ u32 gosType:4; /* which guest */
+ u32 gosVer:16; /* gos version */
+ u32 gosMisc:10; /* other info about gos */
+#endif /* __BIG_ENDIAN_BITFIELD */
};
-
struct Vmxnet3_DriverInfo {
- u32 version;
+ __le32 version;
struct Vmxnet3_GOSInfo gos;
- u32 vmxnet3RevSpt;
- u32 uptVerSpt;
+ __le32 vmxnet3RevSpt;
+ __le32 uptVerSpt;
};
@@ -315,42 +405,42 @@ struct Vmxnet3_DriverInfo {
struct Vmxnet3_MiscConf {
struct Vmxnet3_DriverInfo driverInfo;
- u64 uptFeatures;
- u64 ddPA; /* driver data PA */
- u64 queueDescPA; /* queue descriptor table PA */
- u32 ddLen; /* driver data len */
- u32 queueDescLen; /* queue desc. table len in bytes */
- u32 mtu;
- u16 maxNumRxSG;
+ __le64 uptFeatures;
+ __le64 ddPA; /* driver data PA */
+ __le64 queueDescPA; /* queue descriptor table PA */
+ __le32 ddLen; /* driver data len */
+ __le32 queueDescLen; /* queue desc. table len in bytes */
+ __le32 mtu;
+ __le16 maxNumRxSG;
u8 numTxQueues;
u8 numRxQueues;
- u32 reserved[4];
+ __le32 reserved[4];
};
struct Vmxnet3_TxQueueConf {
- u64 txRingBasePA;
- u64 dataRingBasePA;
- u64 compRingBasePA;
- u64 ddPA; /* driver data */
- u64 reserved;
- u32 txRingSize; /* # of tx desc */
- u32 dataRingSize; /* # of data desc */
- u32 compRingSize; /* # of comp desc */
- u32 ddLen; /* size of driver data */
+ __le64 txRingBasePA;
+ __le64 dataRingBasePA;
+ __le64 compRingBasePA;
+ __le64 ddPA; /* driver data */
+ __le64 reserved;
+ __le32 txRingSize; /* # of tx desc */
+ __le32 dataRingSize; /* # of data desc */
+ __le32 compRingSize; /* # of comp desc */
+ __le32 ddLen; /* size of driver data */
u8 intrIdx;
u8 _pad[7];
};
struct Vmxnet3_RxQueueConf {
- u64 rxRingBasePA[2];
- u64 compRingBasePA;
- u64 ddPA; /* driver data */
- u64 reserved;
- u32 rxRingSize[2]; /* # of rx desc */
- u32 compRingSize; /* # of rx comp desc */
- u32 ddLen; /* size of driver data */
+ __le64 rxRingBasePA[2];
+ __le64 compRingBasePA;
+ __le64 ddPA; /* driver data */
+ __le64 reserved;
+ __le32 rxRingSize[2]; /* # of rx desc */
+ __le32 compRingSize; /* # of rx comp desc */
+ __le32 ddLen; /* size of driver data */
u8 intrIdx;
u8 _pad[7];
};
@@ -381,7 +471,7 @@ struct Vmxnet3_IntrConf {
u8 eventIntrIdx;
u8 modLevels[VMXNET3_MAX_INTRS]; /* moderation level for
* each intr */
- u32 reserved[3];
+ __le32 reserved[3];
};
/* one bit per VLAN ID, the size is in the units of u32 */
@@ -391,21 +481,21 @@ struct Vmxnet3_IntrConf {
struct Vmxnet3_QueueStatus {
bool stopped;
u8 _pad[3];
- u32 error;
+ __le32 error;
};
struct Vmxnet3_TxQueueCtrl {
- u32 txNumDeferred;
- u32 txThreshold;
- u64 reserved;
+ __le32 txNumDeferred;
+ __le32 txThreshold;
+ __le64 reserved;
};
struct Vmxnet3_RxQueueCtrl {
bool updateRxProd;
u8 _pad[7];
- u64 reserved;
+ __le64 reserved;
};
enum {
@@ -417,11 +507,11 @@ enum {
};
struct Vmxnet3_RxFilterConf {
- u32 rxMode; /* VMXNET3_RXM_xxx */
- u16 mfTableLen; /* size of the multicast filter table */
- u16 _pad1;
- u64 mfTablePA; /* PA of the multicast filters table */
- u32 vfTable[VMXNET3_VFT_SIZE]; /* vlan filter */
+ __le32 rxMode; /* VMXNET3_RXM_xxx */
+ __le16 mfTableLen; /* size of the multicast filter table */
+ __le16 _pad1;
+ __le64 mfTablePA; /* PA of the multicast filters table */
+ __le32 vfTable[VMXNET3_VFT_SIZE]; /* vlan filter */
};
@@ -444,7 +534,7 @@ struct Vmxnet3_PM_PktFilter {
struct Vmxnet3_PMConf {
- u16 wakeUpEvents; /* VMXNET3_PM_WAKEUP_xxx */
+ __le16 wakeUpEvents; /* VMXNET3_PM_WAKEUP_xxx */
u8 numFilters;
u8 pad[5];
struct Vmxnet3_PM_PktFilter filters[VMXNET3_PM_MAX_FILTERS];
@@ -452,9 +542,9 @@ struct Vmxnet3_PMConf {
struct Vmxnet3_VariableLenConfDesc {
- u32 confVer;
- u32 confLen;
- u64 confPA;
+ __le32 confVer;
+ __le32 confLen;
+ __le64 confPA;
};
@@ -491,12 +581,12 @@ struct Vmxnet3_DSDevRead {
/* All structures in DriverShared are padded to multiples of 8 bytes */
struct Vmxnet3_DriverShared {
- u32 magic;
+ __le32 magic;
/* make devRead start at 64bit boundaries */
- u32 pad;
- struct Vmxnet3_DSDevRead devRead;
- u32 ecr;
- u32 reserved[5];
+ __le32 pad;
+ struct Vmxnet3_DSDevRead devRead;
+ __le32 ecr;
+ __le32 reserved[5];
};
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 004353a..8f24fe5 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -29,7 +29,6 @@
char vmxnet3_driver_name[] = "vmxnet3";
#define VMXNET3_DRIVER_DESC "VMware vmxnet3 virtual NIC driver"
-
/*
* PCI Device ID Table
* Last entry must be all 0s
@@ -151,11 +150,10 @@ vmxnet3_check_link(struct vmxnet3_adapter *adapter)
}
}
-
static void
vmxnet3_process_events(struct vmxnet3_adapter *adapter)
{
- u32 events = adapter->shared->ecr;
+ u32 events = le32_to_cpu(adapter->shared->ecr);
if (!events)
return;
@@ -173,7 +171,7 @@ vmxnet3_process_events(struct vmxnet3_adapter *adapter)
if (adapter->tqd_start->status.stopped) {
printk(KERN_ERR "%s: tq error 0x%x\n",
adapter->netdev->name,
- adapter->tqd_start->status.error);
+ le32_to_cpu(adapter->tqd_start->status.error));
}
if (adapter->rqd_start->status.stopped) {
printk(KERN_ERR "%s: rq error 0x%x\n",
@@ -185,6 +183,106 @@ vmxnet3_process_events(struct vmxnet3_adapter *adapter)
}
}
+#ifdef __BIG_ENDIAN_BITFIELD
+/*
+ * The device expects the bitfields in shared structures to be written in
+ * little endian. When CPU is big endian, the following routines are used to
+ * correctly read and write into ABI.
+ * The general technique used here is : double word bitfields are defined in
+ * opposite order for big endian architecture. Then before reading them in
+ * driver the complete double word is translated using le32_to_cpu. Similarly
+ * After the driver writes into bitfields, cpu_to_le32 is used to translate the
+ * double words into required format.
+ * In order to avoid touching bits in shared structure more than once, temporary
+ * descriptors are used. These are passed as srcDesc to following functions.
+ */
+static void vmxnet3_RxDescToCPU(const struct Vmxnet3_RxDesc *srcDesc,
+ struct Vmxnet3_RxDesc *dstDesc)
+{
+ u32 *src = (u32 *)srcDesc + 2;
+ u32 *dst = (u32 *)dstDesc + 2;
+ dstDesc->addr = le64_to_cpu(srcDesc->addr);
+ *dst = le32_to_cpu(*src);
+ dstDesc->ext1 = le32_to_cpu(srcDesc->ext1);
+}
+
+static void vmxnet3_TxDescToLe(const struct Vmxnet3_TxDesc *srcDesc,
+ struct Vmxnet3_TxDesc *dstDesc)
+{
+ int i;
+ u32 *src = (u32 *)(srcDesc + 1);
+ u32 *dst = (u32 *)(dstDesc + 1);
+
+ /* Working backwards so that the gen bit is set at the end. */
+ for (i = 2; i > 0; i--) {
+ src--;
+ dst--;
+ *dst = cpu_to_le32(*src);
+ }
+}
+
+
+static void vmxnet3_RxCompToCPU(const struct Vmxnet3_RxCompDesc *srcDesc,
+ struct Vmxnet3_RxCompDesc *dstDesc)
+{
+ int i = 0;
+ u32 *src = (u32 *)srcDesc;
+ u32 *dst = (u32 *)dstDesc;
+ for (i = 0; i < sizeof(struct Vmxnet3_RxCompDesc) / sizeof(u32); i++) {
+ *dst = le32_to_cpu(*src);
+ src++;
+ dst++;
+ }
+}
+
+
+/* Used to read bitfield values from double words. */
+static u32 get_bitfield32(const __le32 *bitfield, u32 pos, u32 size)
+{
+ u32 temp = le32_to_cpu(*bitfield);
+ u32 mask = ((1 << size) - 1) << pos;
+ temp &= mask;
+ temp >>= pos;
+ return temp;
+}
+
+
+
+#endif /* __BIG_ENDIAN_BITFIELD */
+
+#ifdef __BIG_ENDIAN_BITFIELD
+
+# define VMXNET3_TXDESC_GET_GEN(txdesc) get_bitfield32(((const __le32 *) \
+ txdesc) + VMXNET3_TXD_GEN_DWORD_SHIFT, \
+ VMXNET3_TXD_GEN_SHIFT, VMXNET3_TXD_GEN_SIZE)
+# define VMXNET3_TXDESC_GET_EOP(txdesc) get_bitfield32(((const __le32 *) \
+ txdesc) + VMXNET3_TXD_EOP_DWORD_SHIFT, \
+ VMXNET3_TXD_EOP_SHIFT, VMXNET3_TXD_EOP_SIZE)
+# define VMXNET3_TCD_GET_GEN(tcd) get_bitfield32(((const __le32 *)tcd) + \
+ VMXNET3_TCD_GEN_DWORD_SHIFT, VMXNET3_TCD_GEN_SHIFT, \
+ VMXNET3_TCD_GEN_SIZE)
+# define VMXNET3_TCD_GET_TXIDX(tcd) get_bitfield32((const __le32 *)tcd, \
+ VMXNET3_TCD_TXIDX_SHIFT, VMXNET3_TCD_TXIDX_SIZE)
+# define vmxnet3_getRxComp(dstrcd, rcd, tmp) do { \
+ (dstrcd) = (tmp); \
+ vmxnet3_RxCompToCPU((rcd), (tmp)); \
+ } while (0)
+# define vmxnet3_getRxDesc(dstrxd, rxd, tmp) do { \
+ (dstrxd) = (tmp); \
+ vmxnet3_RxDescToCPU((rxd), (tmp)); \
+ } while (0)
+
+#else
+
+# define VMXNET3_TXDESC_GET_GEN(txdesc) ((txdesc)->gen)
+# define VMXNET3_TXDESC_GET_EOP(txdesc) ((txdesc)->eop)
+# define VMXNET3_TCD_GET_GEN(tcd) ((tcd)->gen)
+# define VMXNET3_TCD_GET_TXIDX(tcd) ((tcd)->txdIdx)
+# define vmxnet3_getRxComp(dstrcd, rcd, tmp) (dstrcd) = (rcd)
+# define vmxnet3_getRxDesc(dstrxd, rxd, tmp) (dstrxd) = (rxd)
+
+#endif /* __BIG_ENDIAN_BITFIELD */
+
static void
vmxnet3_unmap_tx_buf(struct vmxnet3_tx_buf_info *tbi,
@@ -212,7 +310,7 @@ vmxnet3_unmap_pkt(u32 eop_idx, struct vmxnet3_tx_queue *tq,
/* no out of order completion */
BUG_ON(tq->buf_info[eop_idx].sop_idx != tq->tx_ring.next2comp);
- BUG_ON(tq->tx_ring.base[eop_idx].txd.eop != 1);
+ BUG_ON(VMXNET3_TXDESC_GET_EOP(&(tq->tx_ring.base[eop_idx].txd)) != 1);
skb = tq->buf_info[eop_idx].skb;
BUG_ON(skb == NULL);
@@ -246,9 +344,10 @@ vmxnet3_tq_tx_complete(struct vmxnet3_tx_queue *tq,
union Vmxnet3_GenericDesc *gdesc;
gdesc = tq->comp_ring.base + tq->comp_ring.next2proc;
- while (gdesc->tcd.gen == tq->comp_ring.gen) {
- completed += vmxnet3_unmap_pkt(gdesc->tcd.txdIdx, tq,
- adapter->pdev, adapter);
+ while (VMXNET3_TCD_GET_GEN(&gdesc->tcd) == tq->comp_ring.gen) {
+ completed += vmxnet3_unmap_pkt(VMXNET3_TCD_GET_TXIDX(
+ &gdesc->tcd), tq, adapter->pdev,
+ adapter);
vmxnet3_comp_ring_adv_next2proc(&tq->comp_ring);
gdesc = tq->comp_ring.base + tq->comp_ring.next2proc;
@@ -472,9 +571,9 @@ vmxnet3_rq_alloc_rx_buf(struct vmxnet3_rx_queue *rq, u32 ring_idx,
}
BUG_ON(rbi->dma_addr == 0);
- gd->rxd.addr = rbi->dma_addr;
- gd->dword[2] = (ring->gen << VMXNET3_RXD_GEN_SHIFT) | val |
- rbi->len;
+ gd->rxd.addr = cpu_to_le64(rbi->dma_addr);
+ gd->dword[2] = cpu_to_le32((ring->gen << VMXNET3_RXD_GEN_SHIFT)
+ | val | rbi->len);
num_allocated++;
vmxnet3_cmd_ring_adv_next2fill(ring);
@@ -531,10 +630,10 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
/* no need to map the buffer if headers are copied */
if (ctx->copy_size) {
- ctx->sop_txd->txd.addr = tq->data_ring.basePA +
+ ctx->sop_txd->txd.addr = cpu_to_le64(tq->data_ring.basePA +
tq->tx_ring.next2fill *
- sizeof(struct Vmxnet3_TxDataDesc);
- ctx->sop_txd->dword[2] = dw2 | ctx->copy_size;
+ sizeof(struct Vmxnet3_TxDataDesc));
+ ctx->sop_txd->dword[2] = cpu_to_le32(dw2 | ctx->copy_size);
ctx->sop_txd->dword[3] = 0;
tbi = tq->buf_info + tq->tx_ring.next2fill;
@@ -542,7 +641,8 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
dev_dbg(&adapter->netdev->dev,
"txd[%u]: 0x%Lx 0x%x 0x%x\n",
- tq->tx_ring.next2fill, ctx->sop_txd->txd.addr,
+ tq->tx_ring.next2fill,
+ le64_to_cpu(ctx->sop_txd->txd.addr),
ctx->sop_txd->dword[2], ctx->sop_txd->dword[3]);
vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
@@ -570,14 +670,14 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
- gdesc->txd.addr = tbi->dma_addr;
- gdesc->dword[2] = dw2 | buf_size;
+ gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
+ gdesc->dword[2] = cpu_to_le32(dw2 | buf_size);
gdesc->dword[3] = 0;
dev_dbg(&adapter->netdev->dev,
"txd[%u]: 0x%Lx 0x%x 0x%x\n",
- tq->tx_ring.next2fill, gdesc->txd.addr,
- gdesc->dword[2], gdesc->dword[3]);
+ tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
+ le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
@@ -599,14 +699,14 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
- gdesc->txd.addr = tbi->dma_addr;
- gdesc->dword[2] = dw2 | frag->size;
+ gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
+ gdesc->dword[2] = cpu_to_le32(dw2 | frag->size);
gdesc->dword[3] = 0;
dev_dbg(&adapter->netdev->dev,
"txd[%u]: 0x%llu %u %u\n",
- tq->tx_ring.next2fill, gdesc->txd.addr,
- gdesc->dword[2], gdesc->dword[3]);
+ tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
+ le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
}
@@ -751,6 +851,10 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
unsigned long flags;
struct vmxnet3_tx_ctx ctx;
union Vmxnet3_GenericDesc *gdesc;
+#ifdef __BIG_ENDIAN_BITFIELD
+ /* Use temporary descriptor to avoid touching bits multiple times */
+ union Vmxnet3_GenericDesc tempTxDesc;
+#endif
/* conservatively estimate # of descriptors to use */
count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +
@@ -827,16 +931,22 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
vmxnet3_map_pkt(skb, &ctx, tq, adapter->pdev, adapter);
/* setup the EOP desc */
- ctx.eop_txd->dword[3] = VMXNET3_TXD_CQ | VMXNET3_TXD_EOP;
+ ctx.eop_txd->dword[3] = cpu_to_le32(VMXNET3_TXD_CQ | VMXNET3_TXD_EOP);
/* setup the SOP desc */
+#ifdef __BIG_ENDIAN_BITFIELD
+ gdesc = &tempTxDesc;
+ gdesc->dword[2] = ctx.sop_txd->dword[2];
+ gdesc->dword[3] = ctx.sop_txd->dword[3];
+#else
gdesc = ctx.sop_txd;
+#endif
if (ctx.mss) {
gdesc->txd.hlen = ctx.eth_ip_hdr_size + ctx.l4_hdr_size;
gdesc->txd.om = VMXNET3_OM_TSO;
gdesc->txd.msscof = ctx.mss;
- tq->shared->txNumDeferred += (skb->len - gdesc->txd.hlen +
- ctx.mss - 1) / ctx.mss;
+ le32_add_cpu(&tq->shared->txNumDeferred, (skb->len -
+ gdesc->txd.hlen + ctx.mss - 1) / ctx.mss);
} else {
if (skb->ip_summed == CHECKSUM_PARTIAL) {
gdesc->txd.hlen = ctx.eth_ip_hdr_size;
@@ -847,7 +957,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
gdesc->txd.om = 0;
gdesc->txd.msscof = 0;
}
- tq->shared->txNumDeferred++;
+ le32_add_cpu(&tq->shared->txNumDeferred, 1);
}
if (vlan_tx_tag_present(skb)) {
@@ -855,19 +965,27 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
gdesc->txd.tci = vlan_tx_tag_get(skb);
}
- wmb();
-
- /* finally flips the GEN bit of the SOP desc */
- gdesc->dword[2] ^= VMXNET3_TXD_GEN;
+ /* finally flips the GEN bit of the SOP desc. */
+ gdesc->dword[2] = cpu_to_le32(le32_to_cpu(gdesc->dword[2]) ^
+ VMXNET3_TXD_GEN);
+#ifdef __BIG_ENDIAN_BITFIELD
+ /* Finished updating in bitfields of Tx Desc, so write them in original
+ * place.
+ */
+ vmxnet3_TxDescToLe((struct Vmxnet3_TxDesc *)gdesc,
+ (struct Vmxnet3_TxDesc *)ctx.sop_txd);
+ gdesc = ctx.sop_txd;
+#endif
dev_dbg(&adapter->netdev->dev,
"txd[%u]: SOP 0x%Lx 0x%x 0x%x\n",
(u32)((union Vmxnet3_GenericDesc *)ctx.sop_txd -
- tq->tx_ring.base), gdesc->txd.addr, gdesc->dword[2],
- gdesc->dword[3]);
+ tq->tx_ring.base), le64_to_cpu(gdesc->txd.addr),
+ le32_to_cpu(gdesc->dword[2]), le32_to_cpu(gdesc->dword[3]));
spin_unlock_irqrestore(&tq->tx_lock, flags);
- if (tq->shared->txNumDeferred >= tq->shared->txThreshold) {
+ if (le32_to_cpu(tq->shared->txNumDeferred) >=
+ le32_to_cpu(tq->shared->txThreshold)) {
tq->shared->txNumDeferred = 0;
VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_TXPROD,
tq->tx_ring.next2fill);
@@ -889,9 +1007,8 @@ static netdev_tx_t
vmxnet3_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
{
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
- struct vmxnet3_tx_queue *tq = &adapter->tx_queue;
- return vmxnet3_tq_xmit(skb, tq, adapter, netdev);
+ return vmxnet3_tq_xmit(skb, &adapter->tx_queue, adapter, netdev);
}
@@ -902,7 +1019,7 @@ vmxnet3_rx_csum(struct vmxnet3_adapter *adapter,
{
if (!gdesc->rcd.cnc && adapter->rxcsum) {
/* typical case: TCP/UDP over IP and both csums are correct */
- if ((gdesc->dword[3] & VMXNET3_RCD_CSUM_OK) ==
+ if ((le32_to_cpu(gdesc->dword[3]) & VMXNET3_RCD_CSUM_OK) ==
VMXNET3_RCD_CSUM_OK) {
skb->ip_summed = CHECKSUM_UNNECESSARY;
BUG_ON(!(gdesc->rcd.tcp || gdesc->rcd.udp));
@@ -957,8 +1074,12 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
u32 num_rxd = 0;
struct Vmxnet3_RxCompDesc *rcd;
struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx;
-
- rcd = &rq->comp_ring.base[rq->comp_ring.next2proc].rcd;
+#ifdef __BIG_ENDIAN_BITFIELD
+ struct Vmxnet3_RxDesc rxCmdDesc;
+ struct Vmxnet3_RxCompDesc rxComp;
+#endif
+ vmxnet3_getRxComp(rcd, &rq->comp_ring.base[rq->comp_ring.next2proc].rcd,
+ &rxComp);
while (rcd->gen == rq->comp_ring.gen) {
struct vmxnet3_rx_buf_info *rbi;
struct sk_buff *skb;
@@ -976,11 +1097,12 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
idx = rcd->rxdIdx;
ring_idx = rcd->rqID == rq->qid ? 0 : 1;
-
- rxd = &rq->rx_ring[ring_idx].base[idx].rxd;
+ vmxnet3_getRxDesc(rxd, &rq->rx_ring[ring_idx].base[idx].rxd,
+ &rxCmdDesc);
rbi = rq->buf_info[ring_idx] + idx;
- BUG_ON(rxd->addr != rbi->dma_addr || rxd->len != rbi->len);
+ BUG_ON(rxd->addr != rbi->dma_addr ||
+ rxd->len != rbi->len);
if (unlikely(rcd->eop && rcd->err)) {
vmxnet3_rx_error(rq, rcd, ctx, adapter);
@@ -1078,7 +1200,8 @@ rcd_done:
}
vmxnet3_comp_ring_adv_next2proc(&rq->comp_ring);
- rcd = &rq->comp_ring.base[rq->comp_ring.next2proc].rcd;
+ vmxnet3_getRxComp(rcd,
+ &rq->comp_ring.base[rq->comp_ring.next2proc].rcd, &rxComp);
}
return num_rxd;
@@ -1094,7 +1217,11 @@ vmxnet3_rq_cleanup(struct vmxnet3_rx_queue *rq,
for (ring_idx = 0; ring_idx < 2; ring_idx++) {
for (i = 0; i < rq->rx_ring[ring_idx].size; i++) {
- rxd = &rq->rx_ring[ring_idx].base[i].rxd;
+#ifdef __BIG_ENDIAN_BITFIELD
+ struct Vmxnet3_RxDesc rxDesc;
+#endif
+ vmxnet3_getRxDesc(rxd,
+ &rq->rx_ring[ring_idx].base[i].rxd, &rxDesc);
if (rxd->btype == VMXNET3_RXD_BTYPE_HEAD &&
rq->buf_info[ring_idx][i].skb) {
@@ -1346,12 +1473,12 @@ vmxnet3_request_irqs(struct vmxnet3_adapter *adapter)
err = request_irq(adapter->intr.msix_entries[0].vector,
vmxnet3_intr, 0, adapter->netdev->name,
adapter->netdev);
- } else
-#endif
- if (adapter->intr.type == VMXNET3_IT_MSI) {
+ } else if (adapter->intr.type == VMXNET3_IT_MSI) {
err = request_irq(adapter->pdev->irq, vmxnet3_intr, 0,
adapter->netdev->name, adapter->netdev);
- } else {
+ } else
+#endif
+ {
err = request_irq(adapter->pdev->irq, vmxnet3_intr,
IRQF_SHARED, adapter->netdev->name,
adapter->netdev);
@@ -1412,6 +1539,22 @@ vmxnet3_free_irqs(struct vmxnet3_adapter *adapter)
}
+inline void set_flag_le16(__le16 *data, u16 flag)
+{
+ *data = cpu_to_le16(le16_to_cpu(*data) | flag);
+}
+
+inline void set_flag_le64(__le64 *data, u64 flag)
+{
+ *data = cpu_to_le64(le64_to_cpu(*data) | flag);
+}
+
+inline void reset_flag_le64(__le64 *data, u64 flag)
+{
+ *data = cpu_to_le64(le64_to_cpu(*data) & ~flag);
+}
+
+
static void
vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
{
@@ -1427,7 +1570,8 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
adapter->vlan_grp = grp;
/* update FEATURES to device */
- devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
+ set_flag_le64(&devRead->misc.uptFeatures,
+ UPT1_F_RXVLAN);
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
VMXNET3_CMD_UPDATE_FEATURE);
/*
@@ -1450,7 +1594,7 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
struct Vmxnet3_DSDevRead *devRead = &shared->devRead;
adapter->vlan_grp = NULL;
- if (devRead->misc.uptFeatures & UPT1_F_RXVLAN) {
+ if (le64_to_cpu(devRead->misc.uptFeatures) & UPT1_F_RXVLAN) {
int i;
for (i = 0; i < VMXNET3_VFT_SIZE; i++) {
@@ -1463,7 +1607,8 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
VMXNET3_CMD_UPDATE_VLAN_FILTERS);
/* update FEATURES to device */
- devRead->misc.uptFeatures &= ~UPT1_F_RXVLAN;
+ reset_flag_le64(&devRead->misc.uptFeatures,
+ UPT1_F_RXVLAN);
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
VMXNET3_CMD_UPDATE_FEATURE);
}
@@ -1565,9 +1710,10 @@ vmxnet3_set_mc(struct net_device *netdev)
new_table = vmxnet3_copy_mc(netdev);
if (new_table) {
new_mode |= VMXNET3_RXM_MCAST;
- rxConf->mfTableLen = netdev->mc_count *
- ETH_ALEN;
- rxConf->mfTablePA = virt_to_phys(new_table);
+ rxConf->mfTableLen = cpu_to_le16(
+ netdev->mc_count * ETH_ALEN);
+ rxConf->mfTablePA = cpu_to_le64(virt_to_phys(
+ new_table));
} else {
printk(KERN_INFO "%s: failed to copy mcast list"
", setting ALL_MULTI\n", netdev->name);
@@ -1582,7 +1728,7 @@ vmxnet3_set_mc(struct net_device *netdev)
}
if (new_mode != rxConf->rxMode) {
- rxConf->rxMode = new_mode;
+ rxConf->rxMode = cpu_to_le32(new_mode);
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
VMXNET3_CMD_UPDATE_RX_MODE);
}
@@ -1610,63 +1756,69 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter)
memset(shared, 0, sizeof(*shared));
/* driver settings */
- shared->magic = VMXNET3_REV1_MAGIC;
- devRead->misc.driverInfo.version = VMXNET3_DRIVER_VERSION_NUM;
+ shared->magic = cpu_to_le32(VMXNET3_REV1_MAGIC);
+ devRead->misc.driverInfo.version = cpu_to_le32(
+ VMXNET3_DRIVER_VERSION_NUM);
devRead->misc.driverInfo.gos.gosBits = (sizeof(void *) == 4 ?
VMXNET3_GOS_BITS_32 : VMXNET3_GOS_BITS_64);
devRead->misc.driverInfo.gos.gosType = VMXNET3_GOS_TYPE_LINUX;
- devRead->misc.driverInfo.vmxnet3RevSpt = 1;
- devRead->misc.driverInfo.uptVerSpt = 1;
+ *((u32 *)&devRead->misc.driverInfo.gos) = cpu_to_le32(
+ *((u32 *)&devRead->misc.driverInfo.gos));
+ devRead->misc.driverInfo.vmxnet3RevSpt = cpu_to_le32(1);
+ devRead->misc.driverInfo.uptVerSpt = cpu_to_le32(1);
- devRead->misc.ddPA = virt_to_phys(adapter);
- devRead->misc.ddLen = sizeof(struct vmxnet3_adapter);
+ devRead->misc.ddPA = cpu_to_le64(virt_to_phys(adapter));
+ devRead->misc.ddLen = cpu_to_le32(sizeof(struct vmxnet3_adapter));
/* set up feature flags */
if (adapter->rxcsum)
- devRead->misc.uptFeatures |= UPT1_F_RXCSUM;
+ set_flag_le64(&devRead->misc.uptFeatures, UPT1_F_RXCSUM);
if (adapter->lro) {
- devRead->misc.uptFeatures |= UPT1_F_LRO;
- devRead->misc.maxNumRxSG = 1 + MAX_SKB_FRAGS;
+ set_flag_le64(&devRead->misc.uptFeatures, UPT1_F_LRO);
+ devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS);
}
if ((adapter->netdev->features & NETIF_F_HW_VLAN_RX)
&& adapter->vlan_grp) {
- devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
+ set_flag_le64(&devRead->misc.uptFeatures, UPT1_F_RXVLAN);
}
- devRead->misc.mtu = adapter->netdev->mtu;
- devRead->misc.queueDescPA = adapter->queue_desc_pa;
- devRead->misc.queueDescLen = sizeof(struct Vmxnet3_TxQueueDesc) +
- sizeof(struct Vmxnet3_RxQueueDesc);
+ devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu);
+ devRead->misc.queueDescPA = cpu_to_le64(adapter->queue_desc_pa);
+ devRead->misc.queueDescLen = cpu_to_le32(
+ sizeof(struct Vmxnet3_TxQueueDesc) +
+ sizeof(struct Vmxnet3_RxQueueDesc));
/* tx queue settings */
BUG_ON(adapter->tx_queue.tx_ring.base == NULL);
devRead->misc.numTxQueues = 1;
tqc = &adapter->tqd_start->conf;
- tqc->txRingBasePA = adapter->tx_queue.tx_ring.basePA;
- tqc->dataRingBasePA = adapter->tx_queue.data_ring.basePA;
- tqc->compRingBasePA = adapter->tx_queue.comp_ring.basePA;
- tqc->ddPA = virt_to_phys(adapter->tx_queue.buf_info);
- tqc->txRingSize = adapter->tx_queue.tx_ring.size;
- tqc->dataRingSize = adapter->tx_queue.data_ring.size;
- tqc->compRingSize = adapter->tx_queue.comp_ring.size;
- tqc->ddLen = sizeof(struct vmxnet3_tx_buf_info) *
- tqc->txRingSize;
+ tqc->txRingBasePA = cpu_to_le64(adapter->tx_queue.tx_ring.basePA);
+ tqc->dataRingBasePA = cpu_to_le64(adapter->tx_queue.data_ring.basePA);
+ tqc->compRingBasePA = cpu_to_le64(adapter->tx_queue.comp_ring.basePA);
+ tqc->ddPA = cpu_to_le64(virt_to_phys(
+ adapter->tx_queue.buf_info));
+ tqc->txRingSize = cpu_to_le32(adapter->tx_queue.tx_ring.size);
+ tqc->dataRingSize = cpu_to_le32(adapter->tx_queue.data_ring.size);
+ tqc->compRingSize = cpu_to_le32(adapter->tx_queue.comp_ring.size);
+ tqc->ddLen = cpu_to_le32(sizeof(struct vmxnet3_tx_buf_info) *
+ tqc->txRingSize);
tqc->intrIdx = adapter->tx_queue.comp_ring.intr_idx;
/* rx queue settings */
devRead->misc.numRxQueues = 1;
rqc = &adapter->rqd_start->conf;
- rqc->rxRingBasePA[0] = adapter->rx_queue.rx_ring[0].basePA;
- rqc->rxRingBasePA[1] = adapter->rx_queue.rx_ring[1].basePA;
- rqc->compRingBasePA = adapter->rx_queue.comp_ring.basePA;
- rqc->ddPA = virt_to_phys(adapter->rx_queue.buf_info);
- rqc->rxRingSize[0] = adapter->rx_queue.rx_ring[0].size;
- rqc->rxRingSize[1] = adapter->rx_queue.rx_ring[1].size;
- rqc->compRingSize = adapter->rx_queue.comp_ring.size;
- rqc->ddLen = sizeof(struct vmxnet3_rx_buf_info) *
- (rqc->rxRingSize[0] + rqc->rxRingSize[1]);
+ rqc->rxRingBasePA[0] = cpu_to_le64(adapter->rx_queue.rx_ring[0].basePA);
+ rqc->rxRingBasePA[1] = cpu_to_le64(adapter->rx_queue.rx_ring[1].basePA);
+ rqc->compRingBasePA = cpu_to_le64(adapter->rx_queue.comp_ring.basePA);
+ rqc->ddPA = cpu_to_le64(virt_to_phys(
+ adapter->rx_queue.buf_info));
+ rqc->rxRingSize[0] = cpu_to_le32(adapter->rx_queue.rx_ring[0].size);
+ rqc->rxRingSize[1] = cpu_to_le32(adapter->rx_queue.rx_ring[1].size);
+ rqc->compRingSize = cpu_to_le32(adapter->rx_queue.comp_ring.size);
+ rqc->ddLen = cpu_to_le32(sizeof(struct vmxnet3_rx_buf_info) *
+ (rqc->rxRingSize[0] + rqc->rxRingSize[1]));
rqc->intrIdx = adapter->rx_queue.comp_ring.intr_idx;
/* intr settings */
@@ -1715,11 +1867,10 @@ vmxnet3_activate_dev(struct vmxnet3_adapter *adapter)
vmxnet3_setup_driver_shared(adapter);
- VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAL,
- VMXNET3_GET_ADDR_LO(adapter->shared_pa));
- VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAH,
- VMXNET3_GET_ADDR_HI(adapter->shared_pa));
-
+ VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAL, VMXNET3_GET_ADDR_LO(
+ adapter->shared_pa));
+ VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAH, VMXNET3_GET_ADDR_HI(
+ adapter->shared_pa));
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
VMXNET3_CMD_ACTIVATE_DEV);
ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
@@ -2425,7 +2576,7 @@ vmxnet3_suspend(struct device *device)
memcpy(pmConf->filters[i].pattern, netdev->dev_addr, ETH_ALEN);
pmConf->filters[i].mask[0] = 0x3F; /* LSB ETH_ALEN bits */
- pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER;
+ set_flag_le16(&pmConf->wakeUpEvents, VMXNET3_PM_WAKEUP_FILTER);
i++;
}
@@ -2467,19 +2618,21 @@ vmxnet3_suspend(struct device *device)
pmConf->filters[i].mask[5] = 0x03; /* IPv4 TIP */
in_dev_put(in_dev);
- pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER;
+ set_flag_le16(&pmConf->wakeUpEvents, VMXNET3_PM_WAKEUP_FILTER);
i++;
}
skip_arp:
if (adapter->wol & WAKE_MAGIC)
- pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_MAGIC;
+ set_flag_le16(&pmConf->wakeUpEvents, VMXNET3_PM_WAKEUP_MAGIC);
pmConf->numFilters = i;
- adapter->shared->devRead.pmConfDesc.confVer = 1;
- adapter->shared->devRead.pmConfDesc.confLen = sizeof(*pmConf);
- adapter->shared->devRead.pmConfDesc.confPA = virt_to_phys(pmConf);
+ adapter->shared->devRead.pmConfDesc.confVer = cpu_to_le32(1);
+ adapter->shared->devRead.pmConfDesc.confLen = cpu_to_le32(sizeof(
+ *pmConf));
+ adapter->shared->devRead.pmConfDesc.confPA = cpu_to_le64(virt_to_phys(
+ pmConf));
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
VMXNET3_CMD_UPDATE_PMCFG);
@@ -2510,9 +2663,11 @@ vmxnet3_resume(struct device *device)
pmConf = adapter->pm_conf;
memset(pmConf, 0, sizeof(*pmConf));
- adapter->shared->devRead.pmConfDesc.confVer = 1;
- adapter->shared->devRead.pmConfDesc.confLen = sizeof(*pmConf);
- adapter->shared->devRead.pmConfDesc.confPA = virt_to_phys(pmConf);
+ adapter->shared->devRead.pmConfDesc.confVer = cpu_to_le32(1);
+ adapter->shared->devRead.pmConfDesc.confLen = cpu_to_le32(sizeof(
+ *pmConf));
+ adapter->shared->devRead.pmConfDesc.confPA = cpu_to_le32(virt_to_phys(
+ pmConf));
netif_device_attach(netdev);
pci_set_power_state(pdev, PCI_D0);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index c2c15e4..3935c44 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -50,11 +50,13 @@ vmxnet3_set_rx_csum(struct net_device *netdev, u32 val)
adapter->rxcsum = val;
if (netif_running(netdev)) {
if (val)
- adapter->shared->devRead.misc.uptFeatures |=
- UPT1_F_RXCSUM;
+ set_flag_le64(
+ &adapter->shared->devRead.misc.uptFeatures,
+ UPT1_F_RXCSUM);
else
- adapter->shared->devRead.misc.uptFeatures &=
- ~UPT1_F_RXCSUM;
+ reset_flag_le64(
+ &adapter->shared->devRead.misc.uptFeatures,
+ UPT1_F_RXCSUM);
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
VMXNET3_CMD_UPDATE_FEATURE);
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 4450816..34f392f 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -330,14 +330,14 @@ struct vmxnet3_adapter {
};
#define VMXNET3_WRITE_BAR0_REG(adapter, reg, val) \
- writel((val), (adapter)->hw_addr0 + (reg))
+ writel(cpu_to_le32(val), (adapter)->hw_addr0 + (reg))
#define VMXNET3_READ_BAR0_REG(adapter, reg) \
- readl((adapter)->hw_addr0 + (reg))
+ le32_to_cpu(readl((adapter)->hw_addr0 + (reg)))
#define VMXNET3_WRITE_BAR1_REG(adapter, reg, val) \
- writel((val), (adapter)->hw_addr1 + (reg))
+ writel(cpu_to_le32(val), (adapter)->hw_addr1 + (reg))
#define VMXNET3_READ_BAR1_REG(adapter, reg) \
- readl((adapter)->hw_addr1 + (reg))
+ le32_to_cpu(readl((adapter)->hw_addr1 + (reg)))
#define VMXNET3_WAKE_QUEUE_THRESHOLD(tq) (5)
#define VMXNET3_RX_ALLOC_THRESHOLD(rq, ring_idx, adapter) \
@@ -353,6 +353,10 @@ struct vmxnet3_adapter {
#define VMXNET3_MAX_ETH_HDR_SIZE 22
#define VMXNET3_MAX_SKB_BUF_SIZE (3*1024)
+void set_flag_le16(__le16 *data, u16 flag);
+void set_flag_le64(__le64 *data, u64 flag);
+void reset_flag_le64(__le64 *data, u64 flag);
+
int
vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter);
^ permalink raw reply related
* Re: [PATCH 1/4] drivers/net/enic: decrement sizeof size in strncmp
From: Scott Feldman @ 2009-11-16 23:46 UTC (permalink / raw)
To: Julia Lawall, Joe Eykholt, netdev, linux-kernel, kernel-janitors
In-Reply-To: <Pine.LNX.4.64.0911120848100.16627@ask.diku.dk>
Thanks Julia/Jorg. We'll pick up change in next enic patch series.
-scott
On 11/11/09 11:48 PM, "Julia Lawall" <julia@diku.dk> wrote:
> From: Julia Lawall <julia@diku.dk>
>
> As observed by Joe Perches, sizeof of a constant string includes the
> trailing 0. If what is wanted is to check the initial characters of
> another string, this trailing 0 should not be taken into account. If an
> exact match is wanted, strcmp should be used instead.
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression foo;
> constant char *abc;
> @@
>
> strncmp(foo, abc,
> - sizeof(abc)
> + sizeof(abc)-1
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
>
> ---
> drivers/net/enic/vnic_dev.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff -u -p a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c
> --- a/drivers/net/enic/vnic_dev.c
> +++ b/drivers/net/enic/vnic_dev.c
> @@ -358,9 +358,9 @@ int vnic_dev_hw_version(struct vnic_dev
> if (err)
> return err;
>
> - if (strncmp(fw_info->hw_version, "A1", sizeof("A1")) == 0)
> + if (strncmp(fw_info->hw_version, "A1", sizeof("A1") - 1) == 0)
> *hw_ver = VNIC_DEV_HW_VER_A1;
> - else if (strncmp(fw_info->hw_version, "A2", sizeof("A2")) == 0)
> + else if (strncmp(fw_info->hw_version, "A2", sizeof("A2") - 1) == 0)
> *hw_ver = VNIC_DEV_HW_VER_A2;
> else
> *hw_ver = VNIC_DEV_HW_VER_UNKNOWN;
^ permalink raw reply
* [PATCH 1/2] net: introduce NETDEV_UNREGISTER_PERNET
From: Octavian Purdila @ 2009-11-16 23:49 UTC (permalink / raw)
To: netdev; +Cc: Eric Dumazet
This new event is called once for each unique net namespace in batched
unregister operations (with the argument set to a random device from
that namespace) and once per device in non-batched unregister
operations.
It allows us to factorize some device unregister work such as clearing the
routing cache.
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
---
include/linux/notifier.h | 1 +
net/core/dev.c | 29 +++++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 29714b8..b0c3671 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -202,6 +202,7 @@ static inline int notifier_to_errno(int ret)
#define NETDEV_BONDING_OLDTYPE 0x000E
#define NETDEV_BONDING_NEWTYPE 0x000F
#define NETDEV_POST_INIT 0x0010
+#define NETDEV_UNREGISTER_PERNET 0x0011
#define SYS_DOWN 0x0001 /* Notify of system down */
#define SYS_RESTART SYS_DOWN
diff --git a/net/core/dev.c b/net/core/dev.c
index 4b24d79..2bd357a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1343,6 +1343,7 @@ rollback:
nb->notifier_call(nb, NETDEV_DOWN, dev);
}
nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
+ nb->notifier_call(nb, NETDEV_UNREGISTER_PERNET, dev);
}
}
@@ -4720,7 +4721,8 @@ static void net_set_todo(struct net_device *dev)
static void rollback_registered_many(struct list_head *head)
{
- struct net_device *dev;
+ struct net_device *dev, *aux, *fdev;
+ LIST_HEAD(pernet_list);
BUG_ON(dev_boot_phase);
ASSERT_RTNL();
@@ -4778,8 +4780,24 @@ static void rollback_registered_many(struct list_head *head)
synchronize_net();
- list_for_each_entry(dev, head, unreg_list)
+ list_for_each_entry_safe(dev, aux, head, unreg_list) {
+ int new_net = 1;
+ list_for_each_entry(fdev, &pernet_list, unreg_list) {
+ if (dev_net(dev) == dev_net(fdev)) {
+ new_net = 0;
+ dev_put(dev);
+ break;
+ }
+ }
+ if (new_net)
+ list_move(&dev->unreg_list, &pernet_list);
+ }
+
+ list_for_each_entry_safe(dev, aux, &pernet_list, unreg_list) {
+ call_netdevice_notifiers(NETDEV_UNREGISTER_PERNET, dev);
+ list_move(&dev->unreg_list, head);
dev_put(dev);
+ }
}
static void rollback_registered(struct net_device *dev)
@@ -5073,6 +5091,8 @@ static void netdev_wait_allrefs(struct net_device *dev)
/* Rebroadcast unregister notification */
call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
+ /* don't resend NETDEV_UNREGISTER_PERNET, _PERNET users
+ * should have already handle it the first time */
if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
&dev->state)) {
@@ -5374,6 +5394,10 @@ EXPORT_SYMBOL(unregister_netdevice_queue);
* unregister_netdevice_many - unregister many devices
* @head: list of devices
*
+ * WARNING: Calling this modifies the given list
+ * (in rollback_registered_many). It may change the order of the elements
+ * in the list. However, you can assume it does not add or delete elements
+ * to/from the list.
*/
void unregister_netdevice_many(struct list_head *head)
{
@@ -5493,6 +5517,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
this device. They should clean all the things.
*/
call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
+ call_netdevice_notifiers(NETDEV_UNREGISTER_PERNET, dev);
/*
* Flush the unicast and multicast chains
--
1.5.6.5
^ permalink raw reply related
* [PATCH 2/2] ipv4: factorize cache clearing for batched unregister operations
From: Octavian Purdila @ 2009-11-16 23:49 UTC (permalink / raw)
To: netdev; +Cc: Eric Dumazet
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
---
net/ipv4/fib_frontend.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 816e218..6c1e56a 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -895,11 +895,11 @@ static void nl_fib_lookup_exit(struct net *net)
net->ipv4.fibnl = NULL;
}
-static void fib_disable_ip(struct net_device *dev, int force)
+static void fib_disable_ip(struct net_device *dev, int force, int delay)
{
if (fib_sync_down_dev(dev, force))
fib_flush(dev_net(dev));
- rt_cache_flush(dev_net(dev), 0);
+ rt_cache_flush(dev_net(dev), delay);
arp_ifdown(dev);
}
@@ -922,7 +922,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
/* Last address was deleted from this interface.
Disable IP.
*/
- fib_disable_ip(dev, 1);
+ fib_disable_ip(dev, 1, 0);
} else {
rt_cache_flush(dev_net(dev), -1);
}
@@ -937,7 +937,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
struct in_device *in_dev = __in_dev_get_rtnl(dev);
if (event == NETDEV_UNREGISTER) {
- fib_disable_ip(dev, 2);
+ fib_disable_ip(dev, 2, -1);
return NOTIFY_DONE;
}
@@ -955,10 +955,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
rt_cache_flush(dev_net(dev), -1);
break;
case NETDEV_DOWN:
- fib_disable_ip(dev, 0);
+ fib_disable_ip(dev, 0, 0);
break;
case NETDEV_CHANGEMTU:
case NETDEV_CHANGE:
+ case NETDEV_UNREGISTER_PERNET:
rt_cache_flush(dev_net(dev), 0);
break;
}
--
1.5.6.5
^ permalink raw reply related
* Re: [PATCH 2/2] ipv4: factorize cache clearing for batched unregister operations
From: Stephen Hemminger @ 2009-11-17 0:06 UTC (permalink / raw)
To: Octavian Purdila; +Cc: netdev, Eric Dumazet
In-Reply-To: <200911170149.50011.opurdila@ixiacom.com>
On Tue, 17 Nov 2009 01:49:49 +0200
Octavian Purdila <opurdila@ixiacom.com> wrote:
> Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
> ---
> net/ipv4/fib_frontend.c | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
And what about IPV6?
--
^ permalink raw reply
* Re: Using netconsole and getting double prints
From: Luis R. Rodriguez @ 2009-11-17 0:18 UTC (permalink / raw)
To: Andre Naujoks; +Cc: Matt Mackall, linux-kernel, netdev
In-Reply-To: <43e72e890911060914i6233b71dgd68e228074869096@mail.gmail.com>
On Fri, Nov 6, 2009 at 9:14 AM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
> On Fri, Nov 6, 2009 at 8:45 AM, Andre Naujoks <nautsch2@googlemail.com> wrote:
>
>> I think the intention behind this is for you to check if they are double
>> prints on your end or double sends on the other end.
>
> Ah yeah, good point :)
Sniffed and saw the issue. My local router was echo'ing the message,
solution was to simply add the destination mac address on netconsole
module parameters passed.
Luis
^ permalink raw reply
* Re: [PATCH 2/2] ipv4: factorize cache clearing for batched unregister operations
From: Benjamin LaHaise @ 2009-11-17 0:22 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Octavian Purdila, netdev, Eric Dumazet
In-Reply-To: <20091116160646.39c0a1ac@nehalam>
On Mon, Nov 16, 2009 at 04:06:46PM -0800, Stephen Hemminger wrote:
> And what about IPV6?
It's not possible to create more than a few thousand IPv6 interfaces in
my tests with a 4GB vm. The culprit seems to be the per-cpu arrays for
statistics using vmalloc() and wasting gobs of memory as a result (memory
usage seems to be 10x per interface vs what IPv4 is using), but I haven't
dug too deeply yet.
-ben
^ permalink raw reply
* Re: [RFC PATCH] net: add dataref destructor to sk_buff
From: Herbert Xu @ 2009-11-17 1:02 UTC (permalink / raw)
To: Gregory Haskins
Cc: David Miller, ghaskins, mst, alacrityvm-devel, linux-kernel,
netdev
In-Reply-To: <4B016041.5030000@gmail.com>
On Mon, Nov 16, 2009 at 09:22:57AM -0500, Gregory Haskins wrote:
>
> But really, this is somewhat orthogonal to the original problem, so let
> me see if we can bring it back on topic. Michael stated that this patch
> in question may be problematic because there are places in the stack
> that can get_page() without also maintaining a reference to the shinfo
> object. Evgeniy seems to say the opposite. I am not sure who is right,
> or if I misunderstood one or both of them. Any thoughts?
There are loads of places where this can happen. Start with
pskb_expand_head.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* linux-next: manual merge of the net tree with the net-current tree
From: Stephen Rothwell @ 2009-11-17 2:16 UTC (permalink / raw)
To: David Miller, netdev
Cc: linux-next, linux-kernel, Wolfram Sang, Christian Pellegrin,
Wolfgang Grandegger, Anant Gole, Oliver Hartkopp
Hi all,
Today's linux-next merge of the net tree got a conflict in
drivers/net/can/Kconfig between commit
b93cf3f0bb45560d2ce62bdcc2181c40660cfdbf ("can: Fix driver Kconfig
structure") from the net-current tree and commits
3758bf25db8caeec667e4e56e030da0ec3060529 ("can: add TI CAN (HECC)
driver"), e0000163e30eeb112b41486ea113fd54f64e1f17 ("can: Driver for the
Microchip MCP251x SPI CAN controllers") and
afa17a500a3667f66df450100538d06769529bba ("net/can: add driver for mscan
family & mpc52xx_mscan") from the net tree.
I fixed it up (see below) and can carry the fix for a while. (I am not
sure the fix is entirely correct.)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc drivers/net/can/Kconfig
index 772f6d2,c16e6ff..0000000
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@@ -41,10 -95,38 +41,42 @@@ config CAN_AT9
---help---
This is a driver for the SoC CAN controller in Atmel's AT91SAM9263.
+ config CAN_TI_HECC
+ depends on CAN_DEV && ARCH_OMAP3
+ tristate "TI High End CAN Controller"
+ ---help---
+ Driver for TI HECC (High End CAN Controller) module found on many
+ TI devices. The device specifications are available from www.ti.com
+
+ config CAN_MCP251X
+ tristate "Microchip MCP251x SPI CAN controllers"
+ depends on CAN_DEV && SPI
+ ---help---
+ Driver for the Microchip MCP251x SPI CAN controllers.
+
+ config CAN_MSCAN
+ depends on CAN_DEV && (PPC || M68K || M68KNOMMU)
+ tristate "Support for Freescale MSCAN based chips"
+ ---help---
+ The Motorola Scalable Controller Area Network (MSCAN) definition
+ is based on the MSCAN12 definition which is the specific
+ implementation of the Motorola Scalable CAN concept targeted for
+ the Motorola MC68HC12 Microcontroller Family.
+
+ config CAN_MPC52XX
+ tristate "Freescale MPC5xxx onboard CAN controller"
+ depends on CAN_MSCAN && PPC_MPC52xx
+ ---help---
+ If you say yes here you get support for Freescale's MPC52xx
+ onboard dualCAN controller.
+
+ This driver can also be built as a module. If so, the module
+ will be called mpc5xxx_can.
+
+source "drivers/net/can/sja1000/Kconfig"
+
+source "drivers/net/can/usb/Kconfig"
+
config CAN_DEBUG_DEVICES
bool "CAN devices debugging messages"
depends on CAN
^ permalink raw reply
* Re: [PATCH] ifb: add multi-queue support
From: David Miller @ 2009-11-17 3:10 UTC (permalink / raw)
To: shemminger; +Cc: xiaosuo, kaber, eric.dumazet, therbert, netdev
In-Reply-To: <20091116083905.634b8f56@nehalam>
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 16 Nov 2009 08:39:05 -0800
> My $.02 is that receive packet steering RPS should be done generically at
> receive layer. Then all the CPU, mapping and configuration issues can be
> done once, not just for IFB, Bridge, VLAN, ... The number of users of IFB
> is small, and setup is complex. Steering packets in IFB is optimizing only
> a rarely used corner.
>
> Layered link services like IFB need to be multi-threaded lockless to maintain
> the advantages of multi-queue and RPS.
You're probably right.
^ permalink raw reply
* Re: [net-next-2.6 PATCH v6 4/7 RFC] TCPCT part 1d: define TCP cookie option, extend existing struct's
From: David Miller @ 2009-11-17 3:15 UTC (permalink / raw)
To: eric.dumazet; +Cc: william.allen.simpson, netdev, joe
In-Reply-To: <4B01D17C.4010407@gmail.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 16 Nov 2009 23:26:04 +0100
> So adding DATA to SYN packets might be problematic for part of our tcp stack.
I can almost guarentee it won't work. For one thing getting a SACK
response to a SYN+DATA packet will explode quite nicely for one thing.
A lot of the other retransmit queue handling would need to be audited
as well. So much code assumes that if we see sent data in the
retransmit queue, there won't be SYN or SYN+ACK things in there to
contend with.
^ permalink raw reply
* Re: [PATCH 1/2 v2] KS8695: fix ks8695_rx_irq() bug.
From: zeal @ 2009-11-17 4:28 UTC (permalink / raw)
To: Figo.zhang; +Cc: netdev, ben, davem
In-Reply-To: <1258045910.1931.16.camel@myhost>
On Fri, Nov 13, 2009 at 1:11 AM, Figo.zhang <figo1802@gmail.com> wrote:
> On Mon, 2009-11-16 at 23:18 +0800, zeal wrote:
>> On Fri, Nov 13, 2009 at 12:24 AM, Figo.zhang <figo1802@gmail.com> wrote:
>> > On Mon, 2009-11-16 at 22:58 +0800, zeal wrote:
>> >> From: zeal <zealcook@gmail.com>
>> >>
>> >> Sorry for the previously patches. THEY'RE NOT RIGHT. It's my mistake.
>> >> Please forgive my noise.
>> >> Please review the following patches and ignore the last (v1).
>> >>
>> >> ks8695 rx irq is edge-level. Before arriving at irq handler, the
>> >> corresponding status bit has been clear(irq's ack).
>> >> So we should not check it after that.
>> >
>> > see <KS8695X Integrated Multi-Port Gateway Solution Register
>> > Description> Version 1.00
>> >
>> > Interrupt Status Register(INTST Offset 0xE208)
>> >
>> > it has said: This edge-triggered interrupt status is cleared by writting
>> > 1 , so we should write 1 to clear status bit manually.
>> >
>> Yeah, but irq_chip's ack has done that.
>> Please check arch/arm/mach-ks8695/irq.c ks8695_irq_edge_chip->ack()
>
> yes, you are right, but you have better add this description at commit
> log.
'the corresponding status bit has been clear(irq's ack)' is not enough?
[snip]
--
Thanks & Regards
zeal
^ permalink raw reply
* Re: [PATCH] ifb: add multi-queue support
From: Changli Gao @ 2009-11-17 5:38 UTC (permalink / raw)
To: David Miller; +Cc: shemminger, kaber, eric.dumazet, therbert, netdev
In-Reply-To: <20091116.191054.131722163.davem@davemloft.net>
On Tue, Nov 17, 2009 at 11:10 AM, David Miller <davem@davemloft.net> wrote:
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Mon, 16 Nov 2009 08:39:05 -0800
>
>> My $.02 is that receive packet steering RPS should be done generically at
>> receive layer. Then all the CPU, mapping and configuration issues can be
>> done once, not just for IFB, Bridge, VLAN, ... The number of users of IFB
>> is small, and setup is complex. Steering packets in IFB is optimizing only
>> a rarely used corner.
>>
>> Layered link services like IFB need to be multi-threaded lockless to maintain
>> the advantages of multi-queue and RPS.
>
> You're probably right.
>
So I have to wait RPS, and after it gets merged, I'll back with
multi-threaded lockless IFB.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
^ permalink raw reply
* Re: [PATCH 1/2] act_mirred: cleanup
From: Changli Gao @ 2009-11-17 5:48 UTC (permalink / raw)
To: David Miller; +Cc: hadi, shemminger, netdev
In-Reply-To: <20091116.024824.267061616.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 602 bytes --]
On Mon, Nov 16, 2009 at 6:48 PM, David Miller <davem@davemloft.net> wrote:
> From: jamal <hadi@cyberus.ca>
> Date: Mon, 16 Nov 2009 04:24:39 -0500
>
>> On Mon, 2009-11-16 at 16:33 +0800, Changli Gao wrote:
>>> act_mirred: cleanup
>>>
>>> 1. don't let go back using goto.
>>> 2. don't call skb_act_clone() until it is necessary.
>>> 3. one exit of the critical context.
>>>
>>> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
>>
>> Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
>
> Applied.
>
Patch is resubmitted as attachment.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
[-- Attachment #2: act_mirred_cleanup.diff --]
[-- Type: application/octet-stream, Size: 2433 bytes --]
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index b9aaab4..b812c20 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -148,47 +148,39 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
{
struct tcf_mirred *m = a->priv;
struct net_device *dev;
- struct sk_buff *skb2 = NULL;
- u32 at = G_TC_AT(skb->tc_verd);
+ struct sk_buff *skb2;
+ u32 at;
+ int retval, err = 1;
spin_lock(&m->tcf_lock);
-
- dev = m->tcfm_dev;
m->tcf_tm.lastuse = jiffies;
+ if (m->tcfm_eaction != TCA_EGRESS_MIRROR &&
+ m->tcfm_eaction != TCA_EGRESS_REDIR) {
+ if (net_ratelimit())
+ printk("tcf_mirred unknown action %d\n",
+ m->tcfm_eaction);
+ goto out;
+ }
- if (!(dev->flags&IFF_UP) ) {
+ dev = m->tcfm_dev;
+ if (!(dev->flags & IFF_UP)) {
if (net_ratelimit())
printk("mirred to Houston: device %s is gone!\n",
dev->name);
-bad_mirred:
- if (skb2 != NULL)
- kfree_skb(skb2);
- m->tcf_qstats.overlimits++;
- m->tcf_bstats.bytes += qdisc_pkt_len(skb);
- m->tcf_bstats.packets++;
- spin_unlock(&m->tcf_lock);
- /* should we be asking for packet to be dropped?
- * may make sense for redirect case only
- */
- return TC_ACT_SHOT;
+ goto out;
}
skb2 = skb_act_clone(skb, GFP_ATOMIC);
if (skb2 == NULL)
- goto bad_mirred;
- if (m->tcfm_eaction != TCA_EGRESS_MIRROR &&
- m->tcfm_eaction != TCA_EGRESS_REDIR) {
- if (net_ratelimit())
- printk("tcf_mirred unknown action %d\n",
- m->tcfm_eaction);
- goto bad_mirred;
- }
+ goto out;
m->tcf_bstats.bytes += qdisc_pkt_len(skb2);
m->tcf_bstats.packets++;
- if (!(at & AT_EGRESS))
+ at = G_TC_AT(skb->tc_verd);
+ if (!(at & AT_EGRESS)) {
if (m->tcfm_ok_push)
skb_push(skb2, skb2->dev->hard_header_len);
+ }
/* mirror is always swallowed */
if (m->tcfm_eaction != TCA_EGRESS_MIRROR)
@@ -197,8 +189,23 @@ bad_mirred:
skb2->dev = dev;
skb2->iif = skb->dev->ifindex;
dev_queue_xmit(skb2);
+ err = 0;
+
+out:
+ if (err) {
+ m->tcf_qstats.overlimits++;
+ m->tcf_bstats.bytes += qdisc_pkt_len(skb);
+ m->tcf_bstats.packets++;
+ /* should we be asking for packet to be dropped?
+ * may make sense for redirect case only
+ */
+ retval = TC_ACT_SHOT;
+ } else {
+ retval = m->tcf_action;
+ }
spin_unlock(&m->tcf_lock);
- return m->tcf_action;
+
+ return retval;
}
static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
^ permalink raw reply related
* Re: [PATCH 2/2] act_mirred: optimization
From: Changli Gao @ 2009-11-17 5:49 UTC (permalink / raw)
To: David Miller; +Cc: hadi, shemminger, netdev
In-Reply-To: <20091116.053329.215126585.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 405 bytes --]
On Mon, Nov 16, 2009 at 9:33 PM, David Miller <davem@davemloft.net> wrote:
> From: Changli Gao <xiaosuo@gmail.com>
> Date: Mon, 16 Nov 2009 21:22:46 +0800
>
>> I am working against linux-next. I'll check if there is any
>> difference. BTW: were these patches applied in order, 1 - 2?
>
> Yes, they were.
>
Patch is resubmitted as attachment.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
[-- Attachment #2: act_mirred_opt.diff --]
[-- Type: application/octet-stream, Size: 2485 bytes --]
--- a/net/sched/act_mirred.c 2009-11-16 16:21:21.000000000 +0800
+++ b/net/sched/act_mirred.c 2009-11-16 17:43:37.000000000 +0800
@@ -65,48 +65,53 @@
struct tc_mirred *parm;
struct tcf_mirred *m;
struct tcf_common *pc;
- struct net_device *dev = NULL;
- int ret = 0, err;
- int ok_push = 0;
+ struct net_device *dev;
+ int ret, ok_push = 0;
if (nla == NULL)
return -EINVAL;
-
- err = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy);
- if (err < 0)
- return err;
-
+ ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy);
+ if (ret < 0)
+ return ret;
if (tb[TCA_MIRRED_PARMS] == NULL)
return -EINVAL;
parm = nla_data(tb[TCA_MIRRED_PARMS]);
-
+ switch (parm->eaction) {
+ case TCA_EGRESS_MIRROR:
+ case TCA_EGRESS_REDIR:
+ break;
+ default:
+ return -EINVAL;
+ }
if (parm->ifindex) {
dev = __dev_get_by_index(&init_net, parm->ifindex);
if (dev == NULL)
return -ENODEV;
switch (dev->type) {
- case ARPHRD_TUNNEL:
- case ARPHRD_TUNNEL6:
- case ARPHRD_SIT:
- case ARPHRD_IPGRE:
- case ARPHRD_VOID:
- case ARPHRD_NONE:
- ok_push = 0;
- break;
- default:
- ok_push = 1;
- break;
+ case ARPHRD_TUNNEL:
+ case ARPHRD_TUNNEL6:
+ case ARPHRD_SIT:
+ case ARPHRD_IPGRE:
+ case ARPHRD_VOID:
+ case ARPHRD_NONE:
+ ok_push = 0;
+ break;
+ default:
+ ok_push = 1;
+ break;
}
+ } else {
+ dev = NULL;
}
pc = tcf_hash_check(parm->index, a, bind, &mirred_hash_info);
if (!pc) {
- if (!parm->ifindex)
+ if (dev == NULL)
return -EINVAL;
pc = tcf_hash_create(parm->index, est, a, sizeof(*m), bind,
&mirred_idx_gen, &mirred_hash_info);
if (IS_ERR(pc))
- return PTR_ERR(pc);
+ return PTR_ERR(pc);
ret = ACT_P_CREATED;
} else {
if (!ovr) {
@@ -119,12 +124,12 @@
spin_lock_bh(&m->tcf_lock);
m->tcf_action = parm->action;
m->tcfm_eaction = parm->eaction;
- if (parm->ifindex) {
+ if (dev != NULL) {
m->tcfm_ifindex = parm->ifindex;
if (ret != ACT_P_CREATED)
dev_put(m->tcfm_dev);
- m->tcfm_dev = dev;
dev_hold(dev);
+ m->tcfm_dev = dev;
m->tcfm_ok_push = ok_push;
}
spin_unlock_bh(&m->tcf_lock);
@@ -154,13 +159,6 @@
spin_lock(&m->tcf_lock);
m->tcf_tm.lastuse = jiffies;
- if (m->tcfm_eaction != TCA_EGRESS_MIRROR &&
- m->tcfm_eaction != TCA_EGRESS_REDIR) {
- if (net_ratelimit())
- printk("tcf_mirred unknown action %d\n",
- m->tcfm_eaction);
- goto out;
- }
dev = m->tcfm_dev;
if (!(dev->flags & IFF_UP)) {
^ permalink raw reply
* Re: [PATCH] ifb: add multi-queue support
From: Stephen Hemminger @ 2009-11-17 6:02 UTC (permalink / raw)
To: Changli Gao; +Cc: David Miller, kaber, eric.dumazet, therbert, netdev
In-Reply-To: <412e6f7f0911162138k6537afd1l5f8eeeaa6c636289@mail.gmail.com>
On Tue, 17 Nov 2009 13:38:29 +0800
Changli Gao <xiaosuo@gmail.com> wrote:
> On Tue, Nov 17, 2009 at 11:10 AM, David Miller <davem@davemloft.net> wrote:
> > From: Stephen Hemminger <shemminger@vyatta.com>
> > Date: Mon, 16 Nov 2009 08:39:05 -0800
> >
> >> My $.02 is that receive packet steering RPS should be done generically at
> >> receive layer. Then all the CPU, mapping and configuration issues can be
> >> done once, not just for IFB, Bridge, VLAN, ... The number of users of IFB
> >> is small, and setup is complex. Steering packets in IFB is optimizing only
> >> a rarely used corner.
> >>
> >> Layered link services like IFB need to be multi-threaded lockless to maintain
> >> the advantages of multi-queue and RPS.
> >
> > You're probably right.
> >
>
> So I have to wait RPS, and after it gets merged, I'll back with
> multi-threaded lockless IFB.
Please don't wait... Help, test it make sure it works.
^ permalink raw reply
* Re: 2.6.32-rc7-git1: Reported regressions from 2.6.31
From: Eric W. Biederman @ 2009-11-17 7:14 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Network Development
In-Reply-To: <GUZt44bIwCE.A.vLF.pSdALB@chimera>
"Rafael J. Wysocki" <rjw@sisk.pl> writes:
> This message contains a list of some regressions from 2.6.31, for which there
> are no fixes in the mainline I know of. If any of them have been fixed already,
> please let me know.
>
> If you know of any other unresolved regressions from 2.6.31, please let me know
> either and I'll add them to the list. Also, please let me know if any of the
> entries below are invalid.
>
> Each entry from the list will be sent additionally in an automatic reply to
> this message with CCs to the people involved in reporting and handling the
> issue.
Not in 2.6.31 but in 2.6.32-rc5 I get a firmware hang from my netxen
nic when I try to bring the link up. I have reported and was working
with the developer for a while. I haven't heard anything in the last
week or so.
Eric
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox