* Re: [PATCH V3 0/8] can: mcp251x: fix and optimize driver
From: David Miller @ 2010-10-18 14:12 UTC (permalink / raw)
To: mkl-bIcnvbaLZ9MEGnE8C9+IrQ
Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1287408674-15412-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
From: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Date: Mon, 18 Oct 2010 15:31:06 +0200
> Moin,
>
> this series of patches improves the mcp251x driver. It first fixes the
> local_softirq_pending problem. Then the amount of SPI transfers is reduced
> in order to optimise the driver. A further patch cleans up the chip model
> selection.
>
> This series has been tested with a mcp2515 on i.MX35.
>
> Please review, test and consider to apply.
...
> git://git.pengutronix.de/git/mkl/linux-2.6.git can/mcp251x-for-net-next
Pulled, thanks.
^ permalink raw reply
* Re: [PATCH 6/8] can: mcp251x: Don't use pdata->model for chip selection anymore
From: Marc Zyngier @ 2010-10-18 13:49 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: socketcan-core, netdev, Christian Pellegrin
In-Reply-To: <1287408674-15412-7-git-send-email-mkl@pengutronix.de>
On Mon, 18 Oct 2010 15:31:12 +0200, Marc Kleine-Budde <mkl@pengutronix.de>
wrote:
> Since commit e446630c960946b5c1762e4eadb618becef599e7, i.e. v2.6.35-rc1,
> the mcp251x chip model can be selected via the modalias member in the
> struct spi_board_info. The driver stores the actual model in the
> struct mcp251x_platform_data.
>
> From the driver point of view the platform_data should be read only.
> Since all in-tree users of the mcp251x have already been converted to
> the modalias method, this patch moves the "model" member from the
> struct mcp251x_platform_data to the driver's private data structure.
>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Cc: Christian Pellegrin <chripell@fsfe.org>
> Cc: Marc Zyngier <maz@misterjones.org>
Acked-by: Marc Zyngier <maz@misterjones.org>
--
Who you jivin' with that Cosmik Debris?
^ permalink raw reply
* [PATCH 2/2] drivers/net/ax88796.c: Return error code in failure
From: Julia Lawall @ 2010-10-18 14:11 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: kernel-janitors, netdev, linux-kernel
In this code, 0 is returned on failure, even though other
failures return -ENOMEM or other similar values.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@a@
identifier alloc;
identifier ret;
constant C;
expression x;
@@
x = alloc(...);
if (x == NULL) { <+... \(ret = -C; \| return -C; \) ...+> }
@@
identifier f, a.alloc;
expression ret;
expression x,e1,e2,e3;
@@
ret = 0
... when != ret = e1
*x = alloc(...)
... when != ret = e2
if (x == NULL) { ... when != ret = e3
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
Another call to platform_get_resource in the same function uses -ENXIO, so
I have used the same value here.
drivers/net/ax88796.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 20e946b..b6da4cf 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -864,6 +864,7 @@ static int ax_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL) {
dev_err(&pdev->dev, "no IRQ specified\n");
+ ret = -ENXIO;
goto exit_mem;
}
^ permalink raw reply related
* Re: [PATCH net-next 0/6] bnx2x: patch series
From: David Miller @ 2010-10-18 14:01 UTC (permalink / raw)
To: dmitry; +Cc: netdev, eilong, vladz
In-Reply-To: <1287392355.11597.16.camel@lb-tlvb-dmitry>
From: "Dmitry Kravkov" <dmitry@broadcom.com>
Date: Mon, 18 Oct 2010 10:59:15 +0200
> This is the respin of previous series with following changes:
> 1. removed patch with gso_size
> 2. removed FUNC_FLG_RSS flag and appropriate "if"s (as suggested by Joe Perches)
> 3. update version
>
> Please, consider applying to net-next
All applied, thanks.
^ permalink raw reply
* [PATCH 8/8] can: mcp251x: optimize 2515, rx int gets cleared automatically
From: Marc Kleine-Budde @ 2010-10-18 13:31 UTC (permalink / raw)
To: socketcan-core; +Cc: netdev, Marc Kleine-Budde
In-Reply-To: <1287408674-15412-1-git-send-email-mkl@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
---
drivers/net/can/mcp251x.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 7f8aa4c..c664be2 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -793,15 +793,20 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
/* receive buffer 0 */
if (intf & CANINTF_RX0IF) {
mcp251x_hw_rx(spi, 0);
- /* Free one buffer ASAP */
- mcp251x_write_bits(spi, CANINTF, intf & CANINTF_RX0IF,
- 0x00);
+ /*
+ * Free one buffer ASAP
+ * (The MCP2515 does this automatically.)
+ */
+ if (mcp251x_is_2510(spi))
+ mcp251x_write_bits(spi, CANINTF, CANINTF_RX0IF, 0x00);
}
/* receive buffer 1 */
if (intf & CANINTF_RX1IF) {
mcp251x_hw_rx(spi, 1);
- clear_intf |= CANINTF_RX1IF;
+ /* the MCP2515 does this automatically */
+ if (mcp251x_is_2510(spi))
+ clear_intf |= CANINTF_RX1IF;
}
/* any error or tx interrupt we need to clear? */
--
1.7.0.4
^ permalink raw reply related
* [PATCH 7/8] can: mcp251x: define helper functions mcp251x_is_2510, mcp251x_is_2515
From: Marc Kleine-Budde @ 2010-10-18 13:31 UTC (permalink / raw)
To: socketcan-core; +Cc: netdev, Marc Kleine-Budde
In-Reply-To: <1287408674-15412-1-git-send-email-mkl@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
---
drivers/net/can/mcp251x.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 0386bed..7f8aa4c 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -258,6 +258,16 @@ struct mcp251x_priv {
int restart_tx;
};
+#define MCP251X_IS(_model) \
+static inline int mcp251x_is_##_model(struct spi_device *spi) \
+{ \
+ struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); \
+ return priv->model == CAN_MCP251X_MCP##_model; \
+}
+
+MCP251X_IS(2510);
+MCP251X_IS(2515);
+
static void mcp251x_clean(struct net_device *net)
{
struct mcp251x_priv *priv = netdev_priv(net);
@@ -370,7 +380,7 @@ static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf,
{
struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
- if (priv->model == CAN_MCP251X_MCP2510) {
+ if (mcp251x_is_2510(spi)) {
int i;
for (i = 1; i < TXBDAT_OFF + len; i++)
@@ -414,7 +424,7 @@ static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf,
{
struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
- if (priv->model == CAN_MCP251X_MCP2510) {
+ if (mcp251x_is_2510(spi)) {
int i, len;
for (i = 1; i < RXBDAT_OFF; i++)
--
1.7.0.4
^ permalink raw reply related
* [PATCH 6/8] can: mcp251x: Don't use pdata->model for chip selection anymore
From: Marc Kleine-Budde @ 2010-10-18 13:31 UTC (permalink / raw)
To: socketcan-core
Cc: netdev, Marc Kleine-Budde, Christian Pellegrin, Marc Zyngier
In-Reply-To: <1287408674-15412-1-git-send-email-mkl@pengutronix.de>
Since commit e446630c960946b5c1762e4eadb618becef599e7, i.e. v2.6.35-rc1,
the mcp251x chip model can be selected via the modalias member in the
struct spi_board_info. The driver stores the actual model in the
struct mcp251x_platform_data.
>From the driver point of view the platform_data should be read only.
Since all in-tree users of the mcp251x have already been converted to
the modalias method, this patch moves the "model" member from the
struct mcp251x_platform_data to the driver's private data structure.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Christian Pellegrin <chripell@fsfe.org>
Cc: Marc Zyngier <maz@misterjones.org>
---
drivers/net/can/mcp251x.c | 24 ++++++++++++------------
include/linux/can/platform/mcp251x.h | 4 ----
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index f5e2edd..0386bed 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -38,14 +38,14 @@
* static struct mcp251x_platform_data mcp251x_info = {
* .oscillator_frequency = 8000000,
* .board_specific_setup = &mcp251x_setup,
- * .model = CAN_MCP251X_MCP2510,
* .power_enable = mcp251x_power_enable,
* .transceiver_enable = NULL,
* };
*
* static struct spi_board_info spi_board_info[] = {
* {
- * .modalias = "mcp251x",
+ * .modalias = "mcp2510",
+ * // or "mcp2515" depending on your controller
* .platform_data = &mcp251x_info,
* .irq = IRQ_EINT13,
* .max_speed_hz = 2*1000*1000,
@@ -224,10 +224,16 @@ static struct can_bittiming_const mcp251x_bittiming_const = {
.brp_inc = 1,
};
+enum mcp251x_model {
+ CAN_MCP251X_MCP2510 = 0x2510,
+ CAN_MCP251X_MCP2515 = 0x2515,
+};
+
struct mcp251x_priv {
struct can_priv can;
struct net_device *net;
struct spi_device *spi;
+ enum mcp251x_model model;
struct mutex mcp_lock; /* SPI device lock */
@@ -362,10 +368,9 @@ static void mcp251x_write_bits(struct spi_device *spi, u8 reg,
static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf,
int len, int tx_buf_idx)
{
- struct mcp251x_platform_data *pdata = spi->dev.platform_data;
struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
- if (pdata->model == CAN_MCP251X_MCP2510) {
+ if (priv->model == CAN_MCP251X_MCP2510) {
int i;
for (i = 1; i < TXBDAT_OFF + len; i++)
@@ -408,9 +413,8 @@ static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf,
int buf_idx)
{
struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
- struct mcp251x_platform_data *pdata = spi->dev.platform_data;
- if (pdata->model == CAN_MCP251X_MCP2510) {
+ if (priv->model == CAN_MCP251X_MCP2510) {
int i, len;
for (i = 1; i < RXBDAT_OFF; i++)
@@ -951,16 +955,12 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi)
struct net_device *net;
struct mcp251x_priv *priv;
struct mcp251x_platform_data *pdata = spi->dev.platform_data;
- int model = spi_get_device_id(spi)->driver_data;
int ret = -ENODEV;
if (!pdata)
/* Platform data is required for osc freq */
goto error_out;
- if (model)
- pdata->model = model;
-
/* Allocate can/net device */
net = alloc_candev(sizeof(struct mcp251x_priv), TX_ECHO_SKB_MAX);
if (!net) {
@@ -977,6 +977,7 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi)
priv->can.clock.freq = pdata->oscillator_frequency / 2;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
CAN_CTRLMODE_LOOPBACK | CAN_CTRLMODE_LISTENONLY;
+ priv->model = spi_get_device_id(spi)->driver_data;
priv->net = net;
dev_set_drvdata(&spi->dev, priv);
@@ -1150,8 +1151,7 @@ static int mcp251x_can_resume(struct spi_device *spi)
#define mcp251x_can_resume NULL
#endif
-static struct spi_device_id mcp251x_id_table[] = {
- { "mcp251x", 0 /* Use pdata.model */ },
+static const struct spi_device_id mcp251x_id_table[] = {
{ "mcp2510", CAN_MCP251X_MCP2510 },
{ "mcp2515", CAN_MCP251X_MCP2515 },
{ },
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index dba2826..8e20540 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -12,7 +12,6 @@
/**
* struct mcp251x_platform_data - MCP251X SPI CAN controller platform data
* @oscillator_frequency: - oscillator frequency in Hz
- * @model: - actual type of chip
* @board_specific_setup: - called before probing the chip (power,reset)
* @transceiver_enable: - called to power on/off the transceiver
* @power_enable: - called to power on/off the mcp *and* the
@@ -25,9 +24,6 @@
struct mcp251x_platform_data {
unsigned long oscillator_frequency;
- int model;
-#define CAN_MCP251X_MCP2510 0x2510
-#define CAN_MCP251X_MCP2515 0x2515
int (*board_specific_setup)(struct spi_device *spi);
int (*transceiver_enable)(int enable);
int (*power_enable) (int enable);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 5/8] can: mcp251x: write intf only when needed
From: Marc Kleine-Budde @ 2010-10-18 13:31 UTC (permalink / raw)
To: socketcan-core; +Cc: netdev, Marc Kleine-Budde
In-Reply-To: <1287408674-15412-1-git-send-email-mkl@pengutronix.de>
This patch introduces a variable "clear_intf" that hold the bits that
should be cleared. Only read-modify-write register if "clear_intf"
is set.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
---
drivers/net/can/mcp251x.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 7e2f951..f5e2edd 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -125,6 +125,8 @@
# define CANINTF_TX0IF 0x04
# define CANINTF_RX1IF 0x02
# define CANINTF_RX0IF 0x01
+# define CANINTF_ERR_TX \
+ (CANINTF_ERRIF | CANINTF_TX2IF | CANINTF_TX1IF | CANINTF_TX0IF)
#define EFLG 0x2d
# define EFLG_EWARN 0x01
# define EFLG_RXWAR 0x02
@@ -769,10 +771,12 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
while (!priv->force_quit) {
enum can_state new_state;
u8 intf, eflag;
+ u8 clear_intf = 0;
int can_id = 0, data1 = 0;
mcp251x_read_2regs(spi, CANINTF, &intf, &eflag);
+ /* receive buffer 0 */
if (intf & CANINTF_RX0IF) {
mcp251x_hw_rx(spi, 0);
/* Free one buffer ASAP */
@@ -780,10 +784,17 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
0x00);
}
- if (intf & CANINTF_RX1IF)
+ /* receive buffer 1 */
+ if (intf & CANINTF_RX1IF) {
mcp251x_hw_rx(spi, 1);
+ clear_intf |= CANINTF_RX1IF;
+ }
- mcp251x_write_bits(spi, CANINTF, intf, 0x00);
+ /* any error or tx interrupt we need to clear? */
+ if (intf & CANINTF_ERR_TX)
+ clear_intf |= intf & CANINTF_ERR_TX;
+ if (clear_intf)
+ mcp251x_write_bits(spi, CANINTF, clear_intf, 0x00);
if (eflag)
mcp251x_write_bits(spi, EFLG, eflag, 0x00);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 4/8] can: mcp251x: read-modify-write eflag only when needed
From: Marc Kleine-Budde @ 2010-10-18 13:31 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Marc Kleine-Budde
In-Reply-To: <1287408674-15412-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Use read-modify-write instead of a simple write to change the register
contents, to close existing the race window between the original manual
read and write.
Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Acked-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
---
drivers/net/can/mcp251x.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 9b3466a..7e2f951 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -785,7 +785,8 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
mcp251x_write_bits(spi, CANINTF, intf, 0x00);
- mcp251x_write_reg(spi, EFLG, 0x00);
+ if (eflag)
+ mcp251x_write_bits(spi, EFLG, eflag, 0x00);
/* Update can state */
if (eflag & EFLG_TXBO) {
--
1.7.0.4
^ permalink raw reply related
* [PATCH 3/8] can: mcp251x: allow to read two registers in one spi transfer
From: Marc Kleine-Budde @ 2010-10-18 13:31 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Marc Kleine-Budde,
Uwe Kleine-König
In-Reply-To: <1287408674-15412-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
From: Sascha Hauer <s.hauer@pengutronix.de>
This patch bases on work done earlier by David Jander.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: David Jander <david@protonic.nl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
---
drivers/net/can/mcp251x.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index fdea752..9b3466a 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -319,6 +319,20 @@ static u8 mcp251x_read_reg(struct spi_device *spi, uint8_t reg)
return val;
}
+static void mcp251x_read_2regs(struct spi_device *spi, uint8_t reg,
+ uint8_t *v1, uint8_t *v2)
+{
+ struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
+
+ priv->spi_tx_buf[0] = INSTRUCTION_READ;
+ priv->spi_tx_buf[1] = reg;
+
+ mcp251x_spi_trans(spi, 4);
+
+ *v1 = priv->spi_rx_buf[2];
+ *v2 = priv->spi_rx_buf[3];
+}
+
static void mcp251x_write_reg(struct spi_device *spi, u8 reg, uint8_t val)
{
struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
@@ -754,10 +768,11 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
mutex_lock(&priv->mcp_lock);
while (!priv->force_quit) {
enum can_state new_state;
- u8 intf = mcp251x_read_reg(spi, CANINTF);
- u8 eflag;
+ u8 intf, eflag;
int can_id = 0, data1 = 0;
+ mcp251x_read_2regs(spi, CANINTF, &intf, &eflag);
+
if (intf & CANINTF_RX0IF) {
mcp251x_hw_rx(spi, 0);
/* Free one buffer ASAP */
@@ -770,7 +785,6 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
mcp251x_write_bits(spi, CANINTF, intf, 0x00);
- eflag = mcp251x_read_reg(spi, EFLG);
mcp251x_write_reg(spi, EFLG, 0x00);
/* Update can state */
--
1.7.0.4
_______________________________________________
Socketcan-core mailing list
Socketcan-core@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/socketcan-core
^ permalink raw reply related
* [PATCH 2/8] can: mcp251x: increase rx_errors on overflow, not only rx_over_errors
From: Marc Kleine-Budde @ 2010-10-18 13:31 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Marc Kleine-Budde
In-Reply-To: <1287408674-15412-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Acked-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
---
drivers/net/can/mcp251x.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index c06e023..fdea752 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -816,10 +816,14 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
if (intf & CANINTF_ERRIF) {
/* Handle overflow counters */
if (eflag & (EFLG_RX0OVR | EFLG_RX1OVR)) {
- if (eflag & EFLG_RX0OVR)
+ if (eflag & EFLG_RX0OVR) {
net->stats.rx_over_errors++;
- if (eflag & EFLG_RX1OVR)
+ net->stats.rx_errors++;
+ }
+ if (eflag & EFLG_RX1OVR) {
net->stats.rx_over_errors++;
+ net->stats.rx_errors++;
+ }
can_id |= CAN_ERR_CRTL;
data1 |= CAN_ERR_CRTL_RX_OVERFLOW;
}
--
1.7.0.4
^ permalink raw reply related
* [PATCH 1/8] can: mcp251x: fix NOHZ local_softirq_pending 08 warning
From: Marc Kleine-Budde @ 2010-10-18 13:31 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Marc Kleine-Budde
In-Reply-To: <1287408674-15412-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
This patch replaces netif_rx() with netif_rx_ni() which has to be used
from the threaded interrupt i.e. process context context.
Thanks to Christian Pellegrin for pointing at the right fix:
481a8199142c050b72bff8a1956a49fd0a75bbe0 by Oliver Hartkopp.
Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Acked-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
---
drivers/net/can/mcp251x.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index b11a0cb..c06e023 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -451,7 +451,7 @@ static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx)
priv->net->stats.rx_packets++;
priv->net->stats.rx_bytes += frame->can_dlc;
- netif_rx(skb);
+ netif_rx_ni(skb);
}
static void mcp251x_hw_sleep(struct spi_device *spi)
@@ -676,7 +676,7 @@ static void mcp251x_error_skb(struct net_device *net, int can_id, int data1)
if (skb) {
frame->can_id = can_id;
frame->data[1] = data1;
- netif_rx(skb);
+ netif_rx_ni(skb);
} else {
dev_err(&net->dev,
"cannot allocate error skb\n");
--
1.7.0.4
^ permalink raw reply related
* [PATCH V3 0/8] can: mcp251x: fix and optimize driver
From: Marc Kleine-Budde @ 2010-10-18 13:31 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w; +Cc: netdev-u79uwXL29TY76Z2rM5mHXA
Moin,
this series of patches improves the mcp251x driver. It first fixes the
local_softirq_pending problem. Then the amount of SPI transfers is reduced
in order to optimise the driver. A further patch cleans up the chip model
selection.
This series has been tested with a mcp2515 on i.MX35.
Please review, test and consider to apply.
regards, Marc
--
The following changes since commit 724829b3ad8e8aeb0aec46de383d35bfa1ad3875:
David S. Miller (1):
tipc: Kill tipc_get_mode() completely.
are available in the git repository at:
git://git.pengutronix.de/git/mkl/linux-2.6.git can/mcp251x-for-net-next
Marc Kleine-Budde (5):
can: mcp251x: fix NOHZ local_softirq_pending 08 warning
can: mcp251x: write intf only when needed
can: mcp251x: Don't use pdata->model for chip selection anymore
can: mcp251x: define helper functions mcp251x_is_2510, mcp251x_is_2515
can: mcp251x: optimize 2515, rx int gets cleared automatically
Sascha Hauer (3):
can: mcp251x: increase rx_errors on overflow, not only rx_over_errors
can: mcp251x: allow to read two registers in one spi transfer
can: mcp251x: read-modify-write eflag only when needed
drivers/net/can/mcp251x.c | 95 +++++++++++++++++++++++++---------
include/linux/can/platform/mcp251x.h | 4 --
2 files changed, 70 insertions(+), 29 deletions(-)
^ permalink raw reply
* Re: [RFC PATCH 1/9] ipvs network name space aware
From: Hans Schillstrom @ 2010-10-18 13:23 UTC (permalink / raw)
To: Daniel Lezcano
Cc: lvs-devel@vger.kernel.org, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org, horms@verge.net.au, ja@ssi.bg,
wensong@linux-vs.org
In-Reply-To: <4CBC3182.80605@free.fr>
On Monday 18 October 2010 13:37:38 Daniel Lezcano wrote:
> On 10/18/2010 11:54 AM, Hans Schillstrom wrote:
> > On Monday 18 October 2010 10:59:25 Daniel Lezcano wrote:
> >
> >> On 10/08/2010 01:16 PM, Hans Schillstrom wrote:
> >>
> >>> This part contains the include files
> >>> where include/net/netns/ip_vs.h is new and contains all moved vars.
> >>>
> >>> SUMMARY
> >>>
> >>> include/net/ip_vs.h | 136 ++++---
> >>> include/net/net_namespace.h | 2 +
> >>> include/net/netns/ip_vs.h | 112 +++++
> >>>
> >>> Signed-off-by:Hans Schillstrom<hans.schillstrom@ericsson.com>
> >>> ---
> >>>
> >>>
> >>>
> >> [ ... ]
> >>
> >>
> >>> #ifdef CONFIG_IP_VS_IPV6
> >>> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
> >>> index bd10a79..b59cdc5 100644
> >>> --- a/include/net/net_namespace.h
> >>> +++ b/include/net/net_namespace.h
> >>> @@ -15,6 +15,7 @@
> >>> #include<net/netns/ipv4.h>
> >>> #include<net/netns/ipv6.h>
> >>> #include<net/netns/dccp.h>
> >>> +#include<net/netns/ip_vs.h>
> >>> #include<net/netns/x_tables.h>
> >>> #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
> >>> #include<net/netns/conntrack.h>
> >>> @@ -91,6 +92,7 @@ struct net {
> >>> struct sk_buff_head wext_nlevents;
> >>> #endif
> >>> struct net_generic *gen;
> >>> + struct netns_ipvs *ipvs;
> >>> };
> >>>
> >>>
> >> IMHO, it would be better to use the net_generic infra-structure instead
> >> of adding a new field in the netns structure.
> >>
> >>
> >>
> > I realized that to, but the performance penalty is quite high with net_generic :-(
> > But on the other hand if you are going to backport it, (without recompiling the kernel)
> > you gonna need it!
> >
>
> Hmm, yes. We don't want to have the init_net_ns performances to be impacted.
>
> You use here a pointer which will be dereferenced like the net_generic,
> I don't think there will be
> a big difference between using net_generic and using a pointer in the
> net namespace structure.
>
> The difference is the id usage, but this one is based on the idr which
> is quite fast.
>
I'm not so sure about that, have a look at net_generic and rcu_read_lock
and compare
ipvs = net->ipvs;
vs.
ipvs = net_generic(net, id)
static inline void *net_generic(struct net *net, int id)
{
struct net_generic *ng;
void *ptr;
rcu_read_lock();
ng = rcu_dereference(net->gen);
BUG_ON(id == 0 || id > ng->len);
ptr = ng->ptr[id - 1];
rcu_read_unlock();
return ptr;
}
...
static inline void rcu_read_lock(void)
{
__rcu_read_lock();
__acquire(RCU);
rcu_read_acquire();
}
Another way of doing it is to pass the ipvs ptr instead of the net ptr,
and add *net to the ipvs struct.
> We should experiment a bit here to compare both solutions.
Agre
>
I single stepped through the rcu_read_lock() on a x86_64
and it's quite many "stepi" that you need to enter :-(
> IMHO, we can (1) create a non-pointer netns_ipvs field in the net
> namespace structure or (2) use a pointer [with net_generic].
>
> (1) is the faster but with the drawback of having a bigger memory
> footprint even if the ipvs module is not loaded.
> In this case we have to take care of what we store in the netns_ipvs
> structure, that is reduce the per namespace table and so. At the first
> glance, I think we can reduce this to the sysctls and a very few data,
> for example using global tables tagged with the namespace and we don't
> break the cacheline alignment optimization.
>
> (2) is slower but as the memory is allocated and freed when the module
> is loaded/unloaded. What I don't like with this approach is we add some
> overhead even if the netns is not compiled in the kernel.
>
or (3)
Like (1) with data that needs to be cache aligned in "struct net"
and the rest in an ipvs struct.
Global hash tables or not ?
> > My sugestion, take both with a configuration switch like:
> > (i.e. avoid the rcu locking)
> >
> > --- net/ip_vs.h ---
> > ...
> > extern int ip_vs_net_id; /* net id for ip_vs */
> >
> >
> > static inline struct netns_ipvs * net_ipvs(struct net* net, int id) {
> > #ifdef CONFIG_IP_VS_FAST_NETNS
> > return net->ipvs;
> > #else
> > return (struct netns_ipvs *)net_generic(net, id);
> > #endif
> > }
> > ...
> >
> > and where you need the netns_ipvs struct ptr,
> > [snip]
> > struct ip_vs_conn *ip_vs_conn_in_get(struct net *net, ....
> > {
> > struct netns_ipvs *ipvs = net_ipvs(net, ip_vs_net_id);
> > ...
> >
>
> It is a nice way to wrap both solutions but at this point I don't think
> it is worth to add a 3rd option to compile ipvs.
>
>
--
Regards
Hans Schillstrom <hans.schillstrom@ericsson.com>
^ permalink raw reply
* Re: [PATCH] net_sched: remove the unused parameter of qdisc_create_dflt()
From: jamal @ 2010-10-18 12:20 UTC (permalink / raw)
To: Changli Gao; +Cc: David S. Miller, Stephen Hemminger, netdev, netem
In-Reply-To: <1287270248-13190-1-git-send-email-xiaosuo@gmail.com>
On Sun, 2010-10-17 at 07:04 +0800, Changli Gao wrote:
> The first parameter dev isn't in use in qdisc_create_dflt().
And we can derive it from netdev_queue if ever needed in the future.
Acked-by: Jamal Hadi Salim <hadi@cyberus.ca>
cheers,
jamal
^ permalink raw reply
* Re: openvswitch/flow WAS ( Re: [rfc] Merging the Open vSwitch datapath
From: jamal @ 2010-10-18 12:16 UTC (permalink / raw)
To: Jesse Gross; +Cc: Ben Pfaff, netdev, ovs-team
In-Reply-To: <AANLkTin-zmQdMC_nRvgRr5KdWQvee5xga5sjOfRN2McN@mail.gmail.com>
On Sat, 2010-10-16 at 12:33 -0700, Jesse Gross wrote:
> On Sat, Oct 16, 2010 at 4:35 AM, jamal <hadi@cyberus.ca> wrote:
> Yes, Open vSwitch supports the OpenFlow protocol. However, the Open
> vSwitch kernel portion is completely different from the OpenFlow
> reference implementation datapath and in fact does not speak OpenFlow
> at the kernel level.
Excellent.
Sorry - I may have misread the openflow code to be openvswitch.
> You brought up the point of keeping the kernel
> simple and making policy decisions in userspace. I completely agree
> and, in fact, that is the reason why Open vSwitch is designed the way
> it is.
>
> I think it might be helpful if I gave a high level overview of packet
> processing:
>
> When a packet is received it, the relevant fields from the packet are
> extracted and matched against a hash table. The most interesting part
> is actually what happens when the packets don't match a hash entry:
> they get sent up to userspace. It is userspace that makes a policy
> decision about the traffic and then pushes down a flow entry for
> future packets to match. Some of the things that those decisions can
> be based on include: OpenFlow rules, wildcarded entries, normal L2
> learning, etc. From then on, packets in that flow can be processed on
> the fast path in the kernel with minimal overhead, while still getting
> the benefit of the knowledge of userspace.
Ok, pretty classical stuff - exception handling in control path, update
policy to data path based on exception, subsequent stuff happens in data
path.
> So I think that we are actually in agreement on quite a number of
> points: the kernel should be kept as simple as possible, the control
> plane should be abstracted out and handled in userspace, and it should
> be possible to map the control rules (from OpenFlow or anywhere
> really) onto a simpler set of primitives for handling packets.
>
> So with those goals in mind, here's what is needed:
> 1. Packet field extraction and classification. Realistically speaking
> a new, specialized classifier would probably be needed, as you
> mention.
I think a new classifier would make life simpler here.
> 2. A mechanism to send/receive packets to/from userspace. This is an
> important component that Open vSwitch adds to the pipeline. This will
> probably expand in the future to suit different applications, like the
> security processing that I talked about.
There are many ways to skin that proverbial cat. I guess it will depend
on whether you are redirecting or merely copying a whole packet, or part
of it (while storing a part in the kernel) etc. Example for a scheme
that works using netlink look at the netfilter examples. You could use
pf_packet if merely requiring copies. One simple scheme i have used is
to have the mirred action redirect to a tun device on which a user space
daemon is listening. If you look at the mirred action - there is an
option to redirect to a named socket which was never implemented because
workarounds exist.
> 3. Output actions. A few exist today, at least some new ones will
> need to be added.
Agreed.
> So in reality, all of major components of Open vSwitch are actually
> not present in the kernel today. I know the argument could be made
> that certains parts can be replicated in different ways but that's
> back to the simplicity point that I was making earlier. The u32
> classifier isn't well suited for these types of rules and neither is
> pedit. If we're going to add the needed components either way, let's
> not make everyone's lives more complicated by mixing everything
> together.
I have to say it is a pleasant suprise that we agree. When i looked at
the openflow code i was worried. I always believe in improving what we
have in Linux than trying to add parallel competing interfaces.
[You'd be suprised for example on the number of vendors who put forward
the claim that they can route faster on Linux[1] by writing a little
barebone driver which ignores 99% of reality.]
cheers,
jamal
[1] I am forgiving on academics
^ permalink raw reply
* Re: [RFC PATCH 0/9] ipvs network name space (netns) aware
From: Daniel Lezcano @ 2010-10-18 12:16 UTC (permalink / raw)
To: Hans Schillstrom
Cc: Simon Horman, lvs-devel@vger.kernel.org, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org, ja@ssi.bg, wensong@linux-vs.org
In-Reply-To: <201010181355.59763.hans.schillstrom@ericsson.com>
On 10/18/2010 01:55 PM, Hans Schillstrom wrote:
> On Sunday 17 October 2010 08:47:31 Simon Horman wrote:
>
>> On Fri, Oct 08, 2010 at 01:16:36PM +0200, Hans Schillstrom wrote:
>>
>>> This patch series adds network name space (netns) support to the LVS.
>>>
>>> REVISION
>>>
>>> This is version 1
>>>
>>> OVERVIEW
>>>
>>> The patch doesn't remove or add any functionality except for netns.
>>> For users that don't use network name space (netns) this patch is
>>> completely transparent.
>>>
>>> No it's possible to run LVS in a Linux container (see lxc-tools)
>>> i.e. a light weight virtualization. For example it's possible to run
>>> one or several lvs on a real server in their own network name spaces.
>>> > From the LVS point of view it looks like it runs on it's own machine.
>>>
>>> IMPLEMENTATION
>>> Basic requirements for netns awareness
>>> - Global variables has to be moved to dyn. allocated memory.
>>>
>>> Most global variables now resides in a struct ipvs { } in netns/ip_vs.h.
>>> What is moved and what is not ?
>>>
>>> Some cache aligned locks are still in global, module init params and some debug_level.
>>>
>>> Algorithm files they are untouched.
>>>
>>> QUESTIONS
>>> Drop rate in ip_vs_ctl per netns or grand total ?
>>>
> This is a tricky one (I think),
> if the interface is shared with root name-space and/or other name-spaces
> - use grand total
> if it's an "own interface"
> - drop rate can/should be in netns...
>
>
>> My gut-feeling is that per netns makes more sense.
>>
>>
>>> Should more lock variables be moved (or less) ?
>>>
>> I'm unsure what you are asking here but I will make a general statement
>> about locking in IPVS: it needs work.
>>
> Some locks still resides as global variables, and others in netns_ipvs struct.
> Since you have a lot of experience with IPVS locks,
> you might have ideas what to move and what to not move.
>
>
>>
>>> PATCH SET
>>> This patch set is based upon net-next-2.6 (2.6.36-rc3) from 4 oct 2010
>>> and [patch v4] ipvs: IPv6 tunnel mode
>>>
>>> Note: ip_vs_xmit.c will not work without "[patch v4] ipvs: IPv6 tunnel mode"
>>>
>> Unfortunately the patches don't apply with the persistence engine
>> patches which were recently merged into nf-next-2.6 (although
>> "[patch v4.1 ]ipvs: IPv6 tunnel mode" is still unmerged).
>>
>>
> I do have a patch based on the nf-next without the SIP/PE patch
>
>
>> I'm happy to work with you to make the required changes there.
>>
> I would appreciate that.
>
>
>> (I realise those patches weren't merged when you made your post.
>> But regardless, either your or me will need to update the patches).
>>
>> Another issue is that your patches seem to be split in a way
>> where the build breaks along the way. E.g. after applying
>> patch 1, the build breaks. Could you please split things up
>> in a manner such that this doesn't happen. The reason being
>> that it breaks bisection.
>>
>>
> Hmm, Daniel also pointed at this,
> The Patch is quite large, and will become even larger with pe and sip.
> My Idea was to review the patch in pieces and put it together in one or two large patches when submitting it.
> I don't know that might be a stupid ?
> It's hard to break it up, making the code reentrant causes changes every where.
>
> Daniel L, had another approach break it into many many tiny patches.
>
These patches can be folded if the result is an acceptable patch size.
The more important is to not break the init_net. Introducing the
namespace concept step by step, from the bottom-up in the call stack is
good because we focus first on making the namespace available in the
code while keeping the init_net functional. The small patches help to
git bisect and spot the patch which lead to a regression. As the patches
are small, it is easy to quickly find the culprit and fix it, especially
for the people who are not author of these patches.
During this step of namespace introduction, we prevent to unshare the
network for ipvs, with a non-op when the namespace is not init_net.
When everything is ready and the init_net is running without problem, we
remove the non-op and consolidate the namespace part of ipvs.
This is how I am used to do, but that does not imply it is the best way
to do that :)
>> Lastly, could you provide a unique subject for each patch.
>> I know its a bit tedious, but it does make a difference when
>> browsing the changelog.
>>
>>
> Yepp, no problem
>
>
>> --
>> To unsubscribe from this list: send the line "unsubscribe lvs-devel" 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
* [PATCH NEXT 2/2] netxen: mask correctable error
From: Amit Kumar Salecha @ 2010-10-18 12:03 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty
In-Reply-To: <1287403422-10431-1-git-send-email-amit.salecha@qlogic.com>
HW workaround:
Disable logging of correctable error for some NX3031 based adapter.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/netxen/netxen_nic_hw.c | 4 ++--
drivers/net/netxen/netxen_nic_main.c | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 10e2f13..4b4ac71 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -1822,14 +1822,14 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
if (netxen_rom_fast_read(adapter, offset, &board_type))
return -EIO;
- adapter->ahw.board_type = board_type;
-
if (board_type == NETXEN_BRDTYPE_P3_4_GB_MM) {
u32 gpio = NXRD32(adapter, NETXEN_ROMUSB_GLB_PAD_GPIO_I);
if ((gpio & 0x8000) == 0)
board_type = NETXEN_BRDTYPE_P3_10G_TP;
}
+ adapter->ahw.board_type = board_type;
+
switch (board_type) {
case NETXEN_BRDTYPE_P2_SB35_4G:
adapter->ahw.port_type = NETXEN_NIC_GBE;
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 83ee554..6f11169 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -1249,6 +1249,28 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
return 0;
}
+#ifdef CONFIG_PCIEAER
+static void netxen_mask_aer_correctable(struct netxen_adapter *adapter)
+{
+ struct pci_dev *pdev = adapter->pdev;
+ struct pci_dev *root = pdev->bus->self;
+ u32 aer_pos;
+
+ if (adapter->ahw.board_type != NETXEN_BRDTYPE_P3_4_GB_MM &&
+ adapter->ahw.board_type != NETXEN_BRDTYPE_P3_10G_TP)
+ return;
+
+ if (root->pcie_type != PCI_EXP_TYPE_ROOT_PORT)
+ return;
+
+ aer_pos = pci_find_ext_capability(root, PCI_EXT_CAP_ID_ERR);
+ if (!aer_pos)
+ return;
+
+ pci_write_config_dword(root, aer_pos + PCI_ERR_COR_MASK, 0xffff);
+}
+#endif
+
static int __devinit
netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
@@ -1317,6 +1339,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_out_iounmap;
}
+#ifdef CONFIG_PCIEAER
+ netxen_mask_aer_correctable(adapter);
+#endif
+
/* Mezz cards have PCI function 0,2,3 enabled */
switch (adapter->ahw.board_type) {
case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ:
--
1.6.0.2
^ permalink raw reply related
* [PATCH NEXT 1/2] netxen: fix race in tx stop queue
From: Amit Kumar Salecha @ 2010-10-18 12:03 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty, Rajesh Borundia
From: Rajesh Borundia <rajesh.borundia@qlogic.com>
There is race between netif_stop_queue and netif_stopped_queue
check.So check once again if buffers are available to avoid race.
With above logic we can also get rid of tx lock in process_cmd_ring.
Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/netxen/netxen_nic.h | 5 ++++-
drivers/net/netxen/netxen_nic_hw.c | 10 ++++++++--
drivers/net/netxen/netxen_nic_init.c | 10 +++-------
drivers/net/netxen/netxen_nic_main.c | 15 +++++++--------
4 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 6dca357..92f89af 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -175,7 +175,10 @@
#define MAX_NUM_CARDS 4
#define MAX_BUFFERS_PER_CMD 32
-#define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + 4)
+#define MAX_TSO_HEADER_DESC 2
+#define MGMT_CMD_DESC_RESV 4
+#define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \
+ + MGMT_CMD_DESC_RESV)
#define NX_MAX_TX_TIMEOUTS 2
/*
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 29d7b93..10e2f13 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -598,8 +598,14 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
if (nr_desc >= netxen_tx_avail(tx_ring)) {
netif_tx_stop_queue(tx_ring->txq);
- __netif_tx_unlock_bh(tx_ring->txq);
- return -EBUSY;
+ smp_mb();
+ if (netxen_tx_avail(tx_ring) > nr_desc) {
+ if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH)
+ netif_tx_wake_queue(tx_ring->txq);
+ } else {
+ __netif_tx_unlock_bh(tx_ring->txq);
+ return -EBUSY;
+ }
}
do {
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index a2d805a..95fe552 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1763,14 +1763,10 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
smp_mb();
- if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) {
- __netif_tx_lock(tx_ring->txq, smp_processor_id());
- if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH) {
+ if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev))
+ if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH)
netif_wake_queue(netdev);
- adapter->tx_timeo_cnt = 0;
- }
- __netif_tx_unlock(tx_ring->txq);
- }
+ adapter->tx_timeo_cnt = 0;
}
/*
* If everything is freed up to consumer then check if the ring is full
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 2c6ceeb..83ee554 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -125,11 +125,6 @@ netxen_nic_update_cmd_producer(struct netxen_adapter *adapter,
struct nx_host_tx_ring *tx_ring)
{
NXWRIO(adapter, tx_ring->crb_cmd_producer, tx_ring->producer);
-
- if (netxen_tx_avail(tx_ring) <= TX_STOP_THRESH) {
- netif_stop_queue(adapter->netdev);
- smp_mb();
- }
}
static uint32_t crb_cmd_consumer[4] = {
@@ -1209,7 +1204,7 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
adapter->max_mc_count = 16;
netdev->netdev_ops = &netxen_netdev_ops;
- netdev->watchdog_timeo = 2*HZ;
+ netdev->watchdog_timeo = 5*HZ;
netxen_nic_change_mtu(netdev, netdev->mtu);
@@ -1825,9 +1820,13 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
/* 4 fragments per cmd des */
no_of_desc = (frag_count + 3) >> 2;
- if (unlikely(no_of_desc + 2 > netxen_tx_avail(tx_ring))) {
+ if (unlikely(netxen_tx_avail(tx_ring) <= TX_STOP_THRESH)) {
netif_stop_queue(netdev);
- return NETDEV_TX_BUSY;
+ smp_mb();
+ if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH)
+ netif_start_queue(netdev);
+ else
+ return NETDEV_TX_BUSY;
}
producer = tx_ring->producer;
--
1.6.0.2
^ permalink raw reply related
* Re: [RFC PATCH 0/9] ipvs network name space (netns) aware
From: Hans Schillstrom @ 2010-10-18 11:55 UTC (permalink / raw)
To: Simon Horman
Cc: lvs-devel@vger.kernel.org, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org, ja@ssi.bg, wensong@linux-vs.org,
daniel.lezcano@free.fr
In-Reply-To: <20101017064731.GA8152@verge.net.au>
On Sunday 17 October 2010 08:47:31 Simon Horman wrote:
> On Fri, Oct 08, 2010 at 01:16:36PM +0200, Hans Schillstrom wrote:
> > This patch series adds network name space (netns) support to the LVS.
> >
> > REVISION
> >
> > This is version 1
> >
> > OVERVIEW
> >
> > The patch doesn't remove or add any functionality except for netns.
> > For users that don't use network name space (netns) this patch is
> > completely transparent.
> >
> > No it's possible to run LVS in a Linux container (see lxc-tools)
> > i.e. a light weight virtualization. For example it's possible to run
> > one or several lvs on a real server in their own network name spaces.
> > >From the LVS point of view it looks like it runs on it's own machine.
> >
> > IMPLEMENTATION
> > Basic requirements for netns awareness
> > - Global variables has to be moved to dyn. allocated memory.
> >
> > Most global variables now resides in a struct ipvs { } in netns/ip_vs.h.
> > What is moved and what is not ?
> >
> > Some cache aligned locks are still in global, module init params and some debug_level.
> >
> > Algorithm files they are untouched.
> >
> > QUESTIONS
> > Drop rate in ip_vs_ctl per netns or grand total ?
This is a tricky one (I think),
if the interface is shared with root name-space and/or other name-spaces
- use grand total
if it's an "own interface"
- drop rate can/should be in netns...
>
> My gut-feeling is that per netns makes more sense.
>
> > Should more lock variables be moved (or less) ?
>
> I'm unsure what you are asking here but I will make a general statement
> about locking in IPVS: it needs work.
Some locks still resides as global variables, and others in netns_ipvs struct.
Since you have a lot of experience with IPVS locks,
you might have ideas what to move and what to not move.
>
> >
> > PATCH SET
> > This patch set is based upon net-next-2.6 (2.6.36-rc3) from 4 oct 2010
> > and [patch v4] ipvs: IPv6 tunnel mode
> >
> > Note: ip_vs_xmit.c will not work without "[patch v4] ipvs: IPv6 tunnel mode"
>
> Unfortunately the patches don't apply with the persistence engine
> patches which were recently merged into nf-next-2.6 (although
> "[patch v4.1 ]ipvs: IPv6 tunnel mode" is still unmerged).
>
I do have a patch based on the nf-next without the SIP/PE patch
> I'm happy to work with you to make the required changes there.
I would appreciate that.
>
> (I realise those patches weren't merged when you made your post.
> But regardless, either your or me will need to update the patches).
>
> Another issue is that your patches seem to be split in a way
> where the build breaks along the way. E.g. after applying
> patch 1, the build breaks. Could you please split things up
> in a manner such that this doesn't happen. The reason being
> that it breaks bisection.
>
Hmm, Daniel also pointed at this,
The Patch is quite large, and will become even larger with pe and sip.
My Idea was to review the patch in pieces and put it together in one or two large patches when submitting it.
I don't know that might be a stupid ?
It's hard to break it up, making the code reentrant causes changes every where.
Daniel L, had another approach break it into many many tiny patches.
> Lastly, could you provide a unique subject for each patch.
> I know its a bit tedious, but it does make a difference when
> browsing the changelog.
>
Yepp, no problem
> --
> To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Regards
Hans Schillstrom <hans.schillstrom@ericsson.com>
^ permalink raw reply
* __bad_udelay in network driver breaks build
From: Andi Kleen @ 2010-10-18 11:52 UTC (permalink / raw)
To: netdev
Current Linus master x86-64 allyesconfig fails with
drivers/built-in.o: In function `tms380tr_chipset_init':
tms380tr.c:(.text+0x10f02de): undefined reference to `__bad_udelay'
tms380tr.c:(.text+0x10f03ab): undefined reference to `__bad_udelay'
tms380tr.c:(.text+0x10f0400): undefined reference to `__bad_udelay'
tms380tr.c:(.text+0x10f07b2): undefined reference to `__bad_udelay'
tms380tr.c:(.text+0x10f08ed): undefined reference to `__bad_udelay'
make[2]: *** [.tmp_vmlinux1] Error 1
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply
* [PATCH] qlcnic: update ethtool stats
From: Amit Kumar Salecha @ 2010-10-18 11:47 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty
Added statistics for Nic Partition supported adapter.
These statistics are maintined in device.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic_ethtool.c | 73 +++++++++++++++++++++++++++++++++-
1 files changed, 70 insertions(+), 3 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 2568aa6..25e93a5 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -78,7 +78,25 @@ static const struct qlcnic_stats qlcnic_gstrings_stats[] = {
};
+static const char qlcnic_device_gstrings_stats[][ETH_GSTRING_LEN] = {
+ "rx unicast frames",
+ "rx multicast frames",
+ "rx broadcast frames",
+ "rx dropped frames",
+ "rx errors",
+ "rx local frames",
+ "rx numbytes",
+ "tx unicast frames",
+ "tx multicast frames",
+ "tx broadcast frames",
+ "tx dropped frames",
+ "tx errors",
+ "tx local frames",
+ "tx numbytes",
+};
+
#define QLCNIC_STATS_LEN ARRAY_SIZE(qlcnic_gstrings_stats)
+#define QLCNIC_DEVICE_STATS_LEN ARRAY_SIZE(qlcnic_device_gstrings_stats)
static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = {
"Register_Test_on_offline",
@@ -625,10 +643,13 @@ static int qlcnic_reg_test(struct net_device *dev)
static int qlcnic_get_sset_count(struct net_device *dev, int sset)
{
+ struct qlcnic_adapter *adapter = netdev_priv(dev);
switch (sset) {
case ETH_SS_TEST:
return QLCNIC_TEST_LEN;
case ETH_SS_STATS:
+ if (adapter->flags & QLCNIC_ESWITCH_ENABLED)
+ return QLCNIC_STATS_LEN + QLCNIC_DEVICE_STATS_LEN;
return QLCNIC_STATS_LEN;
default:
return -EOPNOTSUPP;
@@ -795,7 +816,8 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
static void
qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 * data)
{
- int index;
+ struct qlcnic_adapter *adapter = netdev_priv(dev);
+ int index, i;
switch (stringset) {
case ETH_SS_TEST:
@@ -808,16 +830,43 @@ qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 * data)
qlcnic_gstrings_stats[index].stat_string,
ETH_GSTRING_LEN);
}
- break;
+ if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED))
+ return;
+ for (i = 0; i < QLCNIC_DEVICE_STATS_LEN; index++, i++) {
+ memcpy(data + index * ETH_GSTRING_LEN,
+ qlcnic_device_gstrings_stats[i],
+ ETH_GSTRING_LEN);
+ }
}
}
+#define QLCNIC_FILL_ESWITCH_STATS(VAL1) \
+ (((VAL1) == QLCNIC_ESW_STATS_NOT_AVAIL) ? 0 : VAL1)
+
+static void
+qlcnic_fill_device_stats(int *index, u64 *data,
+ struct __qlcnic_esw_statistics *stats)
+{
+ int ind = *index;
+
+ data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->unicast_frames);
+ data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->multicast_frames);
+ data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->broadcast_frames);
+ data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->dropped_frames);
+ data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->errors);
+ data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->local_frames);
+ data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->numbytes);
+
+ *index = ind;
+}
+
static void
qlcnic_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 * data)
{
struct qlcnic_adapter *adapter = netdev_priv(dev);
- int index;
+ struct qlcnic_esw_statistics port_stats;
+ int index, ret;
for (index = 0; index < QLCNIC_STATS_LEN; index++) {
char *p =
@@ -827,6 +876,24 @@ qlcnic_get_ethtool_stats(struct net_device *dev,
(qlcnic_gstrings_stats[index].sizeof_stat ==
sizeof(u64)) ? *(u64 *)p:(*(u32 *)p);
}
+
+ if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED))
+ return;
+
+ memset(&port_stats, 0, sizeof(struct qlcnic_esw_statistics));
+ ret = qlcnic_get_port_stats(adapter, adapter->ahw.pci_func,
+ QLCNIC_QUERY_RX_COUNTER, &port_stats.rx);
+ if (ret)
+ return;
+
+ qlcnic_fill_device_stats(&index, data, &port_stats.rx);
+
+ ret = qlcnic_get_port_stats(adapter, adapter->ahw.pci_func,
+ QLCNIC_QUERY_TX_COUNTER, &port_stats.tx);
+ if (ret)
+ return;
+
+ qlcnic_fill_device_stats(&index, data, &port_stats.tx);
}
static int qlcnic_set_tx_csum(struct net_device *dev, u32 data)
--
1.6.0.2
^ permalink raw reply related
* Re: [RFC PATCH 1/9] ipvs network name space aware
From: Daniel Lezcano @ 2010-10-18 11:37 UTC (permalink / raw)
To: Hans Schillstrom
Cc: lvs-devel@vger.kernel.org, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org, horms@verge.net.au, ja@ssi.bg,
wensong@linux-vs.org
In-Reply-To: <201010181154.35792.hans.schillstrom@ericsson.com>
On 10/18/2010 11:54 AM, Hans Schillstrom wrote:
> On Monday 18 October 2010 10:59:25 Daniel Lezcano wrote:
>
>> On 10/08/2010 01:16 PM, Hans Schillstrom wrote:
>>
>>> This part contains the include files
>>> where include/net/netns/ip_vs.h is new and contains all moved vars.
>>>
>>> SUMMARY
>>>
>>> include/net/ip_vs.h | 136 ++++---
>>> include/net/net_namespace.h | 2 +
>>> include/net/netns/ip_vs.h | 112 +++++
>>>
>>> Signed-off-by:Hans Schillstrom<hans.schillstrom@ericsson.com>
>>> ---
>>>
>>>
>>>
>> [ ... ]
>>
>>
>>> #ifdef CONFIG_IP_VS_IPV6
>>> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
>>> index bd10a79..b59cdc5 100644
>>> --- a/include/net/net_namespace.h
>>> +++ b/include/net/net_namespace.h
>>> @@ -15,6 +15,7 @@
>>> #include<net/netns/ipv4.h>
>>> #include<net/netns/ipv6.h>
>>> #include<net/netns/dccp.h>
>>> +#include<net/netns/ip_vs.h>
>>> #include<net/netns/x_tables.h>
>>> #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
>>> #include<net/netns/conntrack.h>
>>> @@ -91,6 +92,7 @@ struct net {
>>> struct sk_buff_head wext_nlevents;
>>> #endif
>>> struct net_generic *gen;
>>> + struct netns_ipvs *ipvs;
>>> };
>>>
>>>
>> IMHO, it would be better to use the net_generic infra-structure instead
>> of adding a new field in the netns structure.
>>
>>
>>
> I realized that to, but the performance penalty is quite high with net_generic :-(
> But on the other hand if you are going to backport it, (without recompiling the kernel)
> you gonna need it!
>
Hmm, yes. We don't want to have the init_net_ns performances to be impacted.
You use here a pointer which will be dereferenced like the net_generic,
I don't think there will be
a big difference between using net_generic and using a pointer in the
net namespace structure.
The difference is the id usage, but this one is based on the idr which
is quite fast.
We should experiment a bit here to compare both solutions.
IMHO, we can (1) create a non-pointer netns_ipvs field in the net
namespace structure or (2) use a pointer [with net_generic].
(1) is the faster but with the drawback of having a bigger memory
footprint even if the ipvs module is not loaded.
In this case we have to take care of what we store in the netns_ipvs
structure, that is reduce the per namespace table and so. At the first
glance, I think we can reduce this to the sysctls and a very few data,
for example using global tables tagged with the namespace and we don't
break the cacheline alignment optimization.
(2) is slower but as the memory is allocated and freed when the module
is loaded/unloaded. What I don't like with this approach is we add some
overhead even if the netns is not compiled in the kernel.
> My sugestion, take both with a configuration switch like:
> (i.e. avoid the rcu locking)
>
> --- net/ip_vs.h ---
> ...
> extern int ip_vs_net_id; /* net id for ip_vs */
>
>
> static inline struct netns_ipvs * net_ipvs(struct net* net, int id) {
> #ifdef CONFIG_IP_VS_FAST_NETNS
> return net->ipvs;
> #else
> return (struct netns_ipvs *)net_generic(net, id);
> #endif
> }
> ...
>
> and where you need the netns_ipvs struct ptr,
> [snip]
> struct ip_vs_conn *ip_vs_conn_in_get(struct net *net, ....
> {
> struct netns_ipvs *ipvs = net_ipvs(net, ip_vs_net_id);
> ...
>
It is a nice way to wrap both solutions but at this point I don't think
it is worth to add a 3rd option to compile ipvs.
^ permalink raw reply
* Requesting For Your Partnersip!!!
From: Wen Lee @ 2010-10-18 11:06 UTC (permalink / raw)
--
My name is Mr. Wen Lee an account officer with the Bank of Taipei, I am requesting for your partnership in re-profiling funds and you will be paid 30% for your management fees; Contact me for details.
^ permalink raw reply
* Re: [MeeGo-Dev] can: How to set bitrate
From: Wolfgang Grandegger @ 2010-10-18 11:05 UTC (permalink / raw)
To: Masayuki Ohtake
Cc: andrew.chih.howe.khor-ral2JQCrhuEAvxtiuMwx3w, Samuel Ortiz,
Foster, Margie, ML netdev, ML linux-kernel,
socketcan-core-0fE9KPoRgkgATYTw5x5z8w, Wang, Yong Y,
Ewe, Kok Howg, Intel OTC, Tomoya MORINAGA, David S. Miller,
Christian Pellegrin, Wang, Qi
In-Reply-To: <000b01cb6eb3$1afcfd60$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
On 10/18/2010 12:56 PM, Masayuki Ohtake wrote:
> I want to test our Socket CAN driver(for Topcliff) on Meego1.0.
>
> For setting bitrate, I tried to install "iproute2". But the build failed.
>
> ================================================
> [root@localhost iproute2-2.6.33]# make
> sh configure
> TC schedulers
> ATM no
> IPT using iptables
> make[1]: Entering directory `/root/iproute2-2.6.33/lib'
>
> <omission>
>
> ude -o arpd arpd.c ../lib/libnetlink.a ../lib/libutil.a -ldb -lpthread
> arpd.c:19:20: error: db_185.h: No such file or directory
> arpd.c:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
> arpd.c: In function 'do_one_request':
> arpd.c:304: error: 'DBT' undeclared (first use in this function)
> arpd.c:304: error: (Each undeclared identifier is reported only once
> arpd.c:304: error: for each function it appears in.)
> arpd.c:304: error: expected ';' before 'dbkey'
> arpd.c:308: error: 'dbase' undeclared (first use in this function)
> arpd.c:338: error: 'dbkey' undeclared (first use in this function)
> arpd.c:341: error: 'dbdat' undeclared (first use in this function)
> arpd.c: In function 'get_arp_pkt':
> arpd.c:485: error: 'DBT' undeclared (first use in this function)
> arpd.c:485: error: expected ';' before 'dbkey'
> arpd.c:517: error: 'dbkey' undeclared (first use in this function)
> arpd.c:520: error: 'dbase' undeclared (first use in this function)
> arpd.c:520: error: 'dbdat' undeclared (first use in this function)
> arpd.c: In function 'main':
> arpd.c:670: error: 'dbase' undeclared (first use in this function)
> arpd.c:670: warning: implicit declaration of function 'dbopen'
> arpd.c:670: error: 'DB_HASH' undeclared (first use in this function)
> arpd.c:680: error: 'DBT' undeclared (first use in this function)
> arpd.c:680: error: expected ';' before 'dbkey'
> arpd.c:682: error: 'dbkey' undeclared (first use in this function)
> arpd.c:712: error: 'dbdat' undeclared (first use in this function)
> arpd.c:728: error: expected ';' before 'dbkey'
> arpd.c:730: error: 'R_NEXT' undeclared (first use in this function)
> make[1]: *** [arpd] Error 1
> make[1]: Leaving directory `/root/iproute2/misc'
> make: *** [all] Error 2
> [root@localhost iproute2]#
> ================================================
On my system I get:
~$ rpm -qf /usr/include/db_185.h
db4-devel-4.7.25-13.fc12.i686
Which means you need db4 devel to fully build iproute2.
> Do you know how to set bitrate on Meego?
ip from iproute2 is the right tool.
Wolfgang.
^ 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