Netdev List
 help / color / mirror / Atom feed
* [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 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 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 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

* 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 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 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

* 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 Kleine-Budde @ 2010-10-18 14:14 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <d4c9d3f3d2843bd9cdb4cbb6a75236ce@localhost>


[-- Attachment #1.1: Type: text/plain, Size: 1349 bytes --]

On 10/18/2010 03:49 PM, Marc Zyngier wrote:
> 
> 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-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>> Cc: Christian Pellegrin <chripell-VaTbYqLCNhc@public.gmane.org>
>> Cc: Marc Zyngier <maz-20xNzvSXLT6hUMvJH42dtQ@public.gmane.org>
> 
> Acked-by: Marc Zyngier <maz-20xNzvSXLT6hUMvJH42dtQ@public.gmane.org>

Thanks, but I was to slow to push your Ack, David has pulled already.

cheers, Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 188 bytes --]

_______________________________________________
Socketcan-core mailing list
Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-core

^ permalink raw reply

* Re: [PATCH] qlcnic: update ethtool stats
From: David Miller @ 2010-10-18 14:23 UTC (permalink / raw)
  To: amit.salecha; +Cc: netdev, ameen.rahman, anirban.chakraborty
In-Reply-To: <1287402468-10249-1-git-send-email-amit.salecha@qlogic.com>

From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Mon, 18 Oct 2010 04:47:48 -0700

> Added statistics for Nic Partition supported adapter.
> These statistics are maintined in device.
> 
> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>

Applied.

^ permalink raw reply

* Re: [PATCH NEXT 1/2] netxen: fix race in tx stop queue
From: David Miller @ 2010-10-18 14:23 UTC (permalink / raw)
  To: amit.salecha; +Cc: netdev, ameen.rahman, anirban.chakraborty, rajesh.borundia
In-Reply-To: <1287403422-10431-1-git-send-email-amit.salecha@qlogic.com>

From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Mon, 18 Oct 2010 05:03:41 -0700

> 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>

Applied.

^ permalink raw reply

* Re: [PATCH NEXT 2/2] netxen: mask correctable error
From: David Miller @ 2010-10-18 14:23 UTC (permalink / raw)
  To: amit.salecha; +Cc: netdev, ameen.rahman, anirban.chakraborty
In-Reply-To: <1287403422-10431-2-git-send-email-amit.salecha@qlogic.com>

From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Mon, 18 Oct 2010 05:03:42 -0700

> HW workaround:
> Disable logging of correctable error for some NX3031 based adapter.
> 
> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>

Applied.

^ permalink raw reply

* Re: [PATCH] IPv4: route.c: Change checks against 0xffffffff to ipv4_is_lbcast()
From: David Miller @ 2010-10-18 14:23 UTC (permalink / raw)
  To: awalls; +Cc: netdev, linux-kernel, kuznet, jmorris, kaber
In-Reply-To: <1287364282.2320.20.camel@morgan.silverblock.net>

From: Andy Walls <awalls@md.metrocast.net>
Date: Sun, 17 Oct 2010 21:11:22 -0400

> 
> Change a few checks against the hardcoded broadcast address,
> 0xffffffff, to ipv4_is_lbcast().  Remove some existing checks
> using ipv4_is_lbcast() that are now obviously superfluous.
> 
> Signed-off-by: Andy Walls <awalls@md.metrocast.net>

Applied.

^ permalink raw reply

* Re: [RFC PATCH 1/9] ipvs network name space aware
From: Daniel Lezcano @ 2010-10-18 14:26 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: <201010181523.49568.hans.schillstrom@ericsson.com>

On 10/18/2010 03:23 PM, Hans Schillstrom wrote:
> 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();
> }
>    

Yep, right. In fact I don't really like the net_generic and an ipvs ptr. 
I am not sure it is adequate for this component.

> 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.
>    

Ah, right. That could be a nice solution.


>   Global hash tables or not ?
>    

In the past, we used global hash tables because of the cacheline miss.

^ permalink raw reply

* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2)
From: David Miller @ 2010-10-18 14:31 UTC (permalink / raw)
  To: swise; +Cc: dm, shemminger, divy, leedom, netdev
In-Reply-To: <4CBA6DC8.4010104@opengridcomputing.com>

From: Steve Wise <swise@opengridcomputing.com>
Date: Sat, 16 Oct 2010 22:30:16 -0500

> I'll add a patch this week to utilize the tcp stats.


Ok, thanks Steve.

Stephen, please respin the two cxgb4 patches without the
tcp stat function removal.

^ permalink raw reply

* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2)
From: Stephen Hemminger @ 2010-10-18 14:47 UTC (permalink / raw)
  To: Steve Wise
  Cc: Dimitris Michailidis, Divy Le Ray, David S. Miller, Casey Leedom,
	netdev
In-Reply-To: <4CBA6DC8.4010104@opengridcomputing.com>

On Sat, 16 Oct 2010 22:30:16 -0500
Steve Wise <swise@opengridcomputing.com> wrote:

> 
> On 10/16/2010 1:16 AM, Dimitris Michailidis wrote:
> > Stephen Hemminger wrote:
> >> On Fri, 15 Oct 2010 18:11:42 -0700
> >> Dimitris Michailidis <dm@chelsio.com> wrote:
> >>
> >>> Stephen Hemminger wrote:
> >>>> Make functions only used in one file local.
> >>>> Remove lots of dead code, relating to unsupported functions
> >>>> in mainline driver like RSS, IPv6, and TCP offload.
> >>> Thanks, this looks OK.  One exception, cxgb4_get_tcp_stats was 
> >>> intended to be used by the rdma driver.  I see that driver doesn't 
> >>> call it presently but if you don't mind can we give Steve a few 
> >>> hours to tell us if he has any imminent plans to use it.  If he 
> >>> doesn't offer to do something to use it for .37 it goes.
> >>
> >> The kernel source tree is not your development place holder tree.
> >> At least #ifdef the code out for now.
> >
> > I am trying to protect Stephen Rothwell's time by checking that the IB 
> > folks don't plan to add a call to this in their tree while we remove 
> > the function in net-next.  There's supposed to be a call in the IB 
> > driver.  I don't know why there isn't one or whether they are planning 
> > to fix it for .37.  I see the potential for a linux-next conflict and 
> > I am trying to avoid it.  #ifdef doesn't help, if it's not needed we 
> > can remove it for good.
> 
> I'll add a patch this week to utilize the tcp stats.

In cxgb4 only or both cxgb3 and cxgb4?

^ permalink raw reply

* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2)
From: Steve Wise @ 2010-10-18 14:53 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Dimitris Michailidis, Divy Le Ray, David S. Miller, Casey Leedom,
	netdev
In-Reply-To: <20101018074713.0d0b91fd@nehalam>

On 10/18/2010 09:47 AM, Stephen Hemminger wrote:
> On Sat, 16 Oct 2010 22:30:16 -0500
> Steve Wise<swise@opengridcomputing.com>  wrote:
>
>    
>> On 10/16/2010 1:16 AM, Dimitris Michailidis wrote:
>>      
>>> Stephen Hemminger wrote:
>>>        
>>>> On Fri, 15 Oct 2010 18:11:42 -0700
>>>> Dimitris Michailidis<dm@chelsio.com>  wrote:
>>>>
>>>>          
>>>>> Stephen Hemminger wrote:
>>>>>            
>>>>>> Make functions only used in one file local.
>>>>>> Remove lots of dead code, relating to unsupported functions
>>>>>> in mainline driver like RSS, IPv6, and TCP offload.
>>>>>>              
>>>>> Thanks, this looks OK.  One exception, cxgb4_get_tcp_stats was
>>>>> intended to be used by the rdma driver.  I see that driver doesn't
>>>>> call it presently but if you don't mind can we give Steve a few
>>>>> hours to tell us if he has any imminent plans to use it.  If he
>>>>> doesn't offer to do something to use it for .37 it goes.
>>>>>            
>>>> The kernel source tree is not your development place holder tree.
>>>> At least #ifdef the code out for now.
>>>>          
>>> I am trying to protect Stephen Rothwell's time by checking that the IB
>>> folks don't plan to add a call to this in their tree while we remove
>>> the function in net-next.  There's supposed to be a call in the IB
>>> driver.  I don't know why there isn't one or whether they are planning
>>> to fix it for .37.  I see the potential for a linux-next conflict and
>>> I am trying to avoid it.  #ifdef doesn't help, if it's not needed we
>>> can remove it for good.
>>>        
>> I'll add a patch this week to utilize the tcp stats.
>>      
> In cxgb4 only or both cxgb3 and cxgb4?
>    

iw_cxgb3 already uses the cxgb3 TCP MIB.


Steve.


^ permalink raw reply

* Re: [net-next-2.6 PATCH] igbvf: Remove unneeded pm_qos* calls
From: David Miller @ 2010-10-18 15:12 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips, gregory.v.rose
In-Reply-To: <20101016032547.1925.27290.stgit@localhost.localdomain>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 15 Oct 2010 20:26:47 -0700

> From: Greg Rose <gregory.v.rose@intel.com>
> 
> Power Management Quality of Service is not supported or used by the VF
> driver.
> 
> Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply

* Re: [net-next-2.6 PATCH] igb: fix stats handling
From: David Miller @ 2010-10-18 15:12 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips, eric.dumazet
In-Reply-To: <20101016032707.1925.10161.stgit@localhost.localdomain>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 15 Oct 2010 20:27:10 -0700

> From: Eric Dumazet <eric.dumazet@gmail.com>
> 
> There are currently some problems with igb.
> 
> - On 32bit arches, maintaining 64bit counters without proper
> synchronization between writers and readers.
> 
> - Stats updated every two seconds, as reported by Jesper.
>    (Jesper provided a patch for this)
> 
> - Potential problem between worker thread and ethtool -S
> 
> This patch uses u64_stats_sync, and convert everything to be 64bit safe,
> SMP safe, even on 32bit arches. It integrates Jesper idea of providing
> accurate stats at the time user reads them.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Tested-by: Emil Tantilov <emil.s.tantilov@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply

* Re: [net-next-2.6 PATCH] e1000e: Fix for offline diag test failure at first call
From: David Miller @ 2010-10-18 15:12 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips, carolyn.wyborny, bruce.w.allan
In-Reply-To: <20101016033452.2174.51928.stgit@localhost.localdomain>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 15 Oct 2010 20:35:31 -0700

> From: Carolyn Wyborny <carolyn.wyborny@intel.com>
> 
> Move link test call to later in the offline sequence, move the
> restore settings block to afterwards and add another reset to ensure
> the hardware is in a known state afterwards.
> 
> Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
> Acked-by: Bruce Allan <bruce.w.allan@intel.com>
> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply

* Re: openvswitch/flow WAS ( Re: [rfc] Merging the Open vSwitch datapath
From: Simon Horman @ 2010-10-18 15:20 UTC (permalink / raw)
  To: jamal; +Cc: Jesse Gross, Ben Pfaff, netdev, ovs-team
In-Reply-To: <1287404217.3664.182.camel@bigi>

On Mon, Oct 18, 2010 at 08:16:57AM -0400, jamal wrote:
> 
> 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:

[ snip ]

> > 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.

As I understand things, the packet goes from the kernel to userspace
and then (typically) comes back again.

I guess that it would be possible to send a copy of the headers
to user-sapce while the packet is quarantined in the kernel pending
a response from user-space. I say only the headers, as typically
that is all user-space needs to make a decision, though I guess it
may need the body to make some types of decisions. I have no idea
if such a scheme would be desirable in any circumstances.


^ permalink raw reply

* Re: [PATCH] bonding: various fixes for bonding, netpoll & netconsole (v3)
From: David Miller @ 2010-10-18 15:25 UTC (permalink / raw)
  To: nhorman; +Cc: netdev, bonding-devel, fubar, andy, amwang
In-Reply-To: <1287021713-1750-1-git-send-email-nhorman@tuxdriver.com>

From: nhorman@tuxdriver.com
Date: Wed, 13 Oct 2010 22:01:48 -0400

> Version 3, taking the following changes into account:
 ...
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>

Applied, thanks Neil.

^ permalink raw reply

* Re: [PATCH] bonding: various fixes for bonding, netpoll & netconsole (v3)
From: David Miller @ 2010-10-18 15:27 UTC (permalink / raw)
  To: nhorman; +Cc: netdev, bonding-devel, fubar, andy, amwang
In-Reply-To: <20101018.082529.115920035.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Mon, 18 Oct 2010 08:25:29 -0700 (PDT)

> From: nhorman@tuxdriver.com
> Date: Wed, 13 Oct 2010 22:01:48 -0400
> 
>> Version 3, taking the following changes into account:
>  ...
>> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> 
> Applied, thanks Neil.

This doesn't build with netpoll disable:

drivers/net/bonding/bond_main.c: In function ‘bond_start_xmit’:
drivers/net/bonding/bond_main.c:4578: error: expected expression before ‘)’ token

I'll fix this up but please properly build test your
changes next time.

^ permalink raw reply

* [PATCH net-next] sfc: make functions static
From: Stephen Hemminger @ 2010-10-18 15:27 UTC (permalink / raw)
  To: David Miller, Ben Hutchings, Steve Hodgson
  Cc: Solarflare linux maintainers, netdev

Make local functions and variable static. Do some rearrangement
of the string table stuff to put it where it gets used.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---

 drivers/net/sfc/efx.c         |   16 +++-------------
 drivers/net/sfc/efx.h         |   10 +---------
 drivers/net/sfc/ethtool.c     |   10 +++++-----
 drivers/net/sfc/falcon_xmac.c |    2 +-
 drivers/net/sfc/mac.h         |    1 -
 drivers/net/sfc/mcdi.c        |    4 ++--
 drivers/net/sfc/mcdi.h        |    2 --
 drivers/net/sfc/mcdi_phy.c    |    3 ++-
 drivers/net/sfc/net_driver.h  |    5 -----
 drivers/net/sfc/nic.c         |    2 +-
 drivers/net/sfc/selftest.c    |   10 ++++++++++
 drivers/net/sfc/siena.c       |    2 +-
 12 files changed, 26 insertions(+), 41 deletions(-)

--- a/drivers/net/sfc/efx.c	2010-10-15 16:26:45.752054196 -0700
+++ b/drivers/net/sfc/efx.c	2010-10-15 16:41:10.902928754 -0700
@@ -68,14 +68,6 @@ const char *efx_loopback_mode_names[] =
 	[LOOPBACK_PHYXS_WS]  	= "PHYXS_WS",
 };
 
-/* Interrupt mode names (see INT_MODE())) */
-const unsigned int efx_interrupt_mode_max = EFX_INT_MODE_MAX;
-const char *efx_interrupt_mode_names[] = {
-	[EFX_INT_MODE_MSIX]   = "MSI-X",
-	[EFX_INT_MODE_MSI]    = "MSI",
-	[EFX_INT_MODE_LEGACY] = "legacy",
-};
-
 const unsigned int efx_reset_type_max = RESET_TYPE_MAX;
 const char *efx_reset_type_names[] = {
 	[RESET_TYPE_INVISIBLE]     = "INVISIBLE",
@@ -128,7 +120,7 @@ static int napi_weight = 64;
  * - Check the on-board hardware monitor;
  * - Poll the link state and reconfigure the hardware as necessary.
  */
-unsigned int efx_monitor_interval = 1 * HZ;
+static unsigned int efx_monitor_interval = 1 * HZ;
 
 /* This controls whether or not the driver will initialise devices
  * with invalid MAC addresses stored in the EEPROM or flash.  If true,
@@ -2180,10 +2172,8 @@ int efx_port_dummy_op_int(struct efx_nic
 	return 0;
 }
 void efx_port_dummy_op_void(struct efx_nic *efx) {}
-void efx_port_dummy_op_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)
-{
-}
-bool efx_port_dummy_op_poll(struct efx_nic *efx)
+
+static bool efx_port_dummy_op_poll(struct efx_nic *efx)
 {
 	return false;
 }
--- a/drivers/net/sfc/efx.h	2010-10-15 16:33:49.707120362 -0700
+++ b/drivers/net/sfc/efx.h	2010-10-15 16:38:52.625979128 -0700
@@ -88,10 +88,6 @@ extern int efx_reconfigure_port(struct e
 extern int __efx_reconfigure_port(struct efx_nic *efx);
 
 /* Ethtool support */
-extern int efx_ethtool_get_settings(struct net_device *net_dev,
-				    struct ethtool_cmd *ecmd);
-extern int efx_ethtool_set_settings(struct net_device *net_dev,
-				    struct ethtool_cmd *ecmd);
 extern const struct ethtool_ops efx_ethtool_ops;
 
 /* Reset handling */
@@ -107,9 +103,7 @@ extern void efx_init_irq_moderation(stru
 /* Dummy PHY ops for PHY drivers */
 extern int efx_port_dummy_op_int(struct efx_nic *efx);
 extern void efx_port_dummy_op_void(struct efx_nic *efx);
-extern void
-efx_port_dummy_op_set_id_led(struct efx_nic *efx, enum efx_led_mode mode);
-extern bool efx_port_dummy_op_poll(struct efx_nic *efx);
+
 
 /* MTD */
 #ifdef CONFIG_SFC_MTD
@@ -122,8 +116,6 @@ static inline void efx_mtd_rename(struct
 static inline void efx_mtd_remove(struct efx_nic *efx) {}
 #endif
 
-extern unsigned int efx_monitor_interval;
-
 static inline void efx_schedule_channel(struct efx_channel *channel)
 {
 	netif_vdbg(channel->efx, intr, channel->efx->net_dev,
--- a/drivers/net/sfc/ethtool.c	2010-10-15 16:30:43.840446292 -0700
+++ b/drivers/net/sfc/ethtool.c	2010-10-15 16:33:11.385745045 -0700
@@ -187,8 +187,8 @@ static int efx_ethtool_phys_id(struct ne
 }
 
 /* This must be called with rtnl_lock held. */
-int efx_ethtool_get_settings(struct net_device *net_dev,
-			     struct ethtool_cmd *ecmd)
+static int efx_ethtool_get_settings(struct net_device *net_dev,
+				    struct ethtool_cmd *ecmd)
 {
 	struct efx_nic *efx = netdev_priv(net_dev);
 	struct efx_link_state *link_state = &efx->link_state;
@@ -211,8 +211,8 @@ int efx_ethtool_get_settings(struct net_
 }
 
 /* This must be called with rtnl_lock held. */
-int efx_ethtool_set_settings(struct net_device *net_dev,
-			     struct ethtool_cmd *ecmd)
+static int efx_ethtool_set_settings(struct net_device *net_dev,
+				    struct ethtool_cmd *ecmd)
 {
 	struct efx_nic *efx = netdev_priv(net_dev);
 	int rc;
@@ -891,7 +891,7 @@ static int efx_ethtool_set_wol(struct ne
 	return efx->type->set_wol(efx, wol->wolopts);
 }
 
-extern int efx_ethtool_reset(struct net_device *net_dev, u32 *flags)
+static int efx_ethtool_reset(struct net_device *net_dev, u32 *flags)
 {
 	struct efx_nic *efx = netdev_priv(net_dev);
 	enum reset_type method;
--- a/drivers/net/sfc/falcon_xmac.c	2010-10-15 16:31:54.590987837 -0700
+++ b/drivers/net/sfc/falcon_xmac.c	2010-10-15 16:32:04.819355160 -0700
@@ -143,7 +143,7 @@ static bool falcon_xmac_link_ok(struct e
 		 efx_mdio_phyxgxs_lane_sync(efx));
 }
 
-void falcon_reconfigure_xmac_core(struct efx_nic *efx)
+static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
 {
 	unsigned int max_frame_len;
 	efx_oword_t reg;
--- a/drivers/net/sfc/mcdi.c	2010-10-15 16:32:14.415699761 -0700
+++ b/drivers/net/sfc/mcdi.c	2010-10-15 16:32:24.576064590 -0700
@@ -1093,8 +1093,8 @@ int efx_mcdi_reset_mc(struct efx_nic *ef
 	return rc;
 }
 
-int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type,
-			    const u8 *mac, int *id_out)
+static int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type,
+				   const u8 *mac, int *id_out)
 {
 	u8 inbuf[MC_CMD_WOL_FILTER_SET_IN_LEN];
 	u8 outbuf[MC_CMD_WOL_FILTER_SET_OUT_LEN];
--- a/drivers/net/sfc/mcdi_phy.c	2010-10-15 16:32:37.700535811 -0700
+++ b/drivers/net/sfc/mcdi_phy.c	2010-10-15 16:32:49.312952707 -0700
@@ -713,7 +713,8 @@ static int efx_mcdi_phy_run_tests(struct
 	return 0;
 }
 
-const char *efx_mcdi_phy_test_name(struct efx_nic *efx, unsigned int index)
+static const char *efx_mcdi_phy_test_name(struct efx_nic *efx,
+					  unsigned int index)
 {
 	struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
 
--- a/drivers/net/sfc/net_driver.h	2010-10-15 16:28:56.320581376 -0700
+++ b/drivers/net/sfc/net_driver.h	2010-10-15 16:36:37.289130428 -0700
@@ -387,11 +387,6 @@ extern const unsigned int efx_loopback_m
 #define LOOPBACK_MODE(efx) \
 	STRING_TABLE_LOOKUP((efx)->loopback_mode, efx_loopback_mode)
 
-extern const char *efx_interrupt_mode_names[];
-extern const unsigned int efx_interrupt_mode_max;
-#define INT_MODE(efx) \
-	STRING_TABLE_LOOKUP(efx->interrupt_mode, efx_interrupt_mode)
-
 extern const char *efx_reset_type_names[];
 extern const unsigned int efx_reset_type_max;
 #define RESET_TYPE(type) \
--- a/drivers/net/sfc/nic.c	2010-10-15 16:33:00.257345589 -0700
+++ b/drivers/net/sfc/nic.c	2010-10-15 16:33:09.229667656 -0700
@@ -653,7 +653,7 @@ void efx_nic_eventq_read_ack(struct efx_
 }
 
 /* Use HW to insert a SW defined event */
-void efx_generate_event(struct efx_channel *channel, efx_qword_t *event)
+static void efx_generate_event(struct efx_channel *channel, efx_qword_t *event)
 {
 	efx_oword_t drv_ev_reg;
 
--- a/drivers/net/sfc/siena.c	2010-10-15 16:33:22.902158396 -0700
+++ b/drivers/net/sfc/siena.c	2010-10-15 16:33:34.690581475 -0700
@@ -129,7 +129,7 @@ static int siena_probe_port(struct efx_n
 	return 0;
 }
 
-void siena_remove_port(struct efx_nic *efx)
+static void siena_remove_port(struct efx_nic *efx)
 {
 	efx->phy_op->remove(efx);
 	efx_nic_free_buffer(efx, &efx->stats_buffer);
--- a/drivers/net/sfc/mac.h	2010-10-15 16:37:35.923231638 -0700
+++ b/drivers/net/sfc/mac.h	2010-10-15 16:38:35.625370285 -0700
@@ -15,7 +15,6 @@
 
 extern struct efx_mac_operations falcon_xmac_operations;
 extern struct efx_mac_operations efx_mcdi_mac_operations;
-extern void falcon_reconfigure_xmac_core(struct efx_nic *efx);
 extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
 			      u32 dma_len, int enable, int clear);
 
--- a/drivers/net/sfc/mcdi.h	2010-10-15 16:39:01.902311312 -0700
+++ b/drivers/net/sfc/mcdi.h	2010-10-15 16:39:14.482761784 -0700
@@ -121,8 +121,6 @@ extern int efx_mcdi_handle_assertion(str
 extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode);
 extern int efx_mcdi_reset_port(struct efx_nic *efx);
 extern int efx_mcdi_reset_mc(struct efx_nic *efx);
-extern int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type,
-				   const u8 *mac, int *id_out);
 extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx,
 					 const u8 *mac, int *id_out);
 extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out);
--- a/drivers/net/sfc/selftest.c	2010-10-15 16:38:07.788373215 -0700
+++ b/drivers/net/sfc/selftest.c	2010-10-15 16:38:32.453256674 -0700
@@ -48,6 +48,16 @@ static const unsigned char payload_sourc
 static const char payload_msg[] =
 	"Hello world! This is an Efx loopback test in progress!";
 
+/* Interrupt mode names */
+static const unsigned int efx_interrupt_mode_max = EFX_INT_MODE_MAX;
+static const char *efx_interrupt_mode_names[] = {
+	[EFX_INT_MODE_MSIX]   = "MSI-X",
+	[EFX_INT_MODE_MSI]    = "MSI",
+	[EFX_INT_MODE_LEGACY] = "legacy",
+};
+#define INT_MODE(efx) \
+	STRING_TABLE_LOOKUP(efx->interrupt_mode, efx_interrupt_mode)
+
 /**
  * efx_loopback_state - persistent state during a loopback selftest
  * @flush:		Drop all packets in efx_loopback_rx_packet

^ permalink raw reply

* [PATCH net-next-2.6] mlx4:  make functions local and remove dead code.
From: Stephen Hemminger @ 2010-10-18 15:30 UTC (permalink / raw)
  To: David Miller, Yevgeny Petrilin; +Cc: netdev

There is a whole section of code in this driver related to vlan tables
which is not accessed from any kernel code.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/net/mlx4/cq.c       |    3 +
 drivers/net/mlx4/en_rx.c    |    3 -
 drivers/net/mlx4/icm.c      |   28 ------------
 drivers/net/mlx4/icm.h      |    2 
 drivers/net/mlx4/mlx4_en.h  |    3 -
 drivers/net/mlx4/port.c     |   97 --------------------------------------------
 include/linux/mlx4/device.h |    3 -
 7 files changed, 6 insertions(+), 133 deletions(-)

--- a/drivers/net/mlx4/en_rx.c	2010-10-15 16:06:32.842275374 -0700
+++ b/drivers/net/mlx4/en_rx.c	2010-10-15 16:06:44.642682840 -0700
@@ -524,7 +524,8 @@ out_loopback:
 	dev_kfree_skb_any(skb);
 }
 
-int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int budget)
+static int mlx4_en_process_rx_cq(struct net_device *dev,
+				 struct mlx4_en_cq *cq, int budget)
 {
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 	struct mlx4_cqe *cqe;
--- a/drivers/net/mlx4/icm.c	2010-10-15 16:03:02.783025372 -0700
+++ b/drivers/net/mlx4/icm.c	2010-10-15 16:08:09.977629991 -0700
@@ -210,38 +210,12 @@ static int mlx4_MAP_ICM(struct mlx4_dev
 	return mlx4_map_cmd(dev, MLX4_CMD_MAP_ICM, icm, virt);
 }
 
-int mlx4_UNMAP_ICM(struct mlx4_dev *dev, u64 virt, u32 page_count)
+static int mlx4_UNMAP_ICM(struct mlx4_dev *dev, u64 virt, u32 page_count)
 {
 	return mlx4_cmd(dev, virt, page_count, 0, MLX4_CMD_UNMAP_ICM,
 			MLX4_CMD_TIME_CLASS_B);
 }
 
-int mlx4_MAP_ICM_page(struct mlx4_dev *dev, u64 dma_addr, u64 virt)
-{
-	struct mlx4_cmd_mailbox *mailbox;
-	__be64 *inbox;
-	int err;
-
-	mailbox = mlx4_alloc_cmd_mailbox(dev);
-	if (IS_ERR(mailbox))
-		return PTR_ERR(mailbox);
-	inbox = mailbox->buf;
-
-	inbox[0] = cpu_to_be64(virt);
-	inbox[1] = cpu_to_be64(dma_addr);
-
-	err = mlx4_cmd(dev, mailbox->dma, 1, 0, MLX4_CMD_MAP_ICM,
-		       MLX4_CMD_TIME_CLASS_B);
-
-	mlx4_free_cmd_mailbox(dev, mailbox);
-
-	if (!err)
-		mlx4_dbg(dev, "Mapped page at %llx to %llx for ICM.\n",
-			  (unsigned long long) dma_addr, (unsigned long long) virt);
-
-	return err;
-}
-
 int mlx4_MAP_ICM_AUX(struct mlx4_dev *dev, struct mlx4_icm *icm)
 {
 	return mlx4_map_cmd(dev, MLX4_CMD_MAP_ICM_AUX, icm, -1);
--- a/drivers/net/mlx4/icm.h	2010-10-15 16:05:35.580298413 -0700
+++ b/drivers/net/mlx4/icm.h	2010-10-15 16:05:54.912965820 -0700
@@ -128,8 +128,6 @@ static inline unsigned long mlx4_icm_siz
 	return sg_dma_len(&iter->chunk->mem[iter->page_idx]);
 }
 
-int mlx4_UNMAP_ICM(struct mlx4_dev *dev, u64 virt, u32 page_count);
-int mlx4_MAP_ICM_page(struct mlx4_dev *dev, u64 dma_addr, u64 virt);
 int mlx4_MAP_ICM_AUX(struct mlx4_dev *dev, struct mlx4_icm *icm);
 int mlx4_UNMAP_ICM_AUX(struct mlx4_dev *dev);
 
--- a/drivers/net/mlx4/port.c	2010-10-15 16:03:13.639399914 -0700
+++ b/drivers/net/mlx4/port.c	2010-10-15 16:11:09.571835685 -0700
@@ -161,103 +161,6 @@ out:
 }
 EXPORT_SYMBOL_GPL(mlx4_unregister_mac);
 
-static int mlx4_set_port_vlan_table(struct mlx4_dev *dev, u8 port,
-				    __be32 *entries)
-{
-	struct mlx4_cmd_mailbox *mailbox;
-	u32 in_mod;
-	int err;
-
-	mailbox = mlx4_alloc_cmd_mailbox(dev);
-	if (IS_ERR(mailbox))
-		return PTR_ERR(mailbox);
-
-	memcpy(mailbox->buf, entries, MLX4_VLAN_TABLE_SIZE);
-	in_mod = MLX4_SET_PORT_VLAN_TABLE << 8 | port;
-	err = mlx4_cmd(dev, mailbox->dma, in_mod, 1, MLX4_CMD_SET_PORT,
-		       MLX4_CMD_TIME_CLASS_B);
-
-	mlx4_free_cmd_mailbox(dev, mailbox);
-
-	return err;
-}
-
-int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index)
-{
-	struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
-	int i, err = 0;
-	int free = -1;
-
-	mutex_lock(&table->mutex);
-	for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) {
-		if (free < 0 && (table->refs[i] == 0)) {
-			free = i;
-			continue;
-		}
-
-		if (table->refs[i] &&
-		    (vlan == (MLX4_VLAN_MASK &
-			      be32_to_cpu(table->entries[i])))) {
-			/* Vlan already registered, increase refernce count */
-			*index = i;
-			++table->refs[i];
-			goto out;
-		}
-	}
-
-	if (table->total == table->max) {
-		/* No free vlan entries */
-		err = -ENOSPC;
-		goto out;
-	}
-
-	/* Register new MAC */
-	table->refs[free] = 1;
-	table->entries[free] = cpu_to_be32(vlan | MLX4_VLAN_VALID);
-
-	err = mlx4_set_port_vlan_table(dev, port, table->entries);
-	if (unlikely(err)) {
-		mlx4_warn(dev, "Failed adding vlan: %u\n", vlan);
-		table->refs[free] = 0;
-		table->entries[free] = 0;
-		goto out;
-	}
-
-	*index = free;
-	++table->total;
-out:
-	mutex_unlock(&table->mutex);
-	return err;
-}
-EXPORT_SYMBOL_GPL(mlx4_register_vlan);
-
-void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index)
-{
-	struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
-
-	if (index < MLX4_VLAN_REGULAR) {
-		mlx4_warn(dev, "Trying to free special vlan index %d\n", index);
-		return;
-	}
-
-	mutex_lock(&table->mutex);
-	if (!table->refs[index]) {
-		mlx4_warn(dev, "No vlan entry for index %d\n", index);
-		goto out;
-	}
-	if (--table->refs[index]) {
-		mlx4_dbg(dev, "Have more references for index %d,"
-			 "no need to modify vlan table\n", index);
-		goto out;
-	}
-	table->entries[index] = 0;
-	mlx4_set_port_vlan_table(dev, port, table->entries);
-	--table->total;
-out:
-	mutex_unlock(&table->mutex);
-}
-EXPORT_SYMBOL_GPL(mlx4_unregister_vlan);
-
 int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps)
 {
 	struct mlx4_cmd_mailbox *inmailbox, *outmailbox;
--- a/include/linux/mlx4/device.h	2010-10-15 16:07:38.204532549 -0700
+++ b/include/linux/mlx4/device.h	2010-10-15 16:07:44.988766865 -0700
@@ -474,9 +474,6 @@ int mlx4_multicast_detach(struct mlx4_de
 int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index);
 void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int index);
 
-int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
-void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index);
-
 int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list,
 		      int npages, u64 iova, u32 *lkey, u32 *rkey);
 int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages,
--- a/drivers/net/mlx4/mlx4_en.h	2010-10-15 16:08:26.146188502 -0700
+++ b/drivers/net/mlx4/mlx4_en.h	2010-10-15 16:08:31.706380578 -0700
@@ -518,9 +518,6 @@ void mlx4_en_destroy_rx_ring(struct mlx4
 int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv);
 void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,
 				struct mlx4_en_rx_ring *ring);
-int mlx4_en_process_rx_cq(struct net_device *dev,
-			  struct mlx4_en_cq *cq,
-			  int budget);
 int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget);
 void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
 			     int is_tx, int rss, int qpn, int cqn,
--- a/drivers/net/mlx4/cq.c	2010-10-15 16:02:59.774921596 -0700
+++ b/drivers/net/mlx4/cq.c	2010-10-15 16:11:49.937227452 -0700
@@ -73,6 +73,9 @@ struct mlx4_cq_context {
 #define MLX4_CQ_STATE_ARMED_SOL		( 6 <<  8)
 #define MLX4_EQ_STATE_FIRED		(10 <<  8)
 
+static int mlx4_ib_umem_write_mtt(struct mlx4_ib_dev *dev, struct mlx4_mtt *mtt,
+				  struct ib_umem *umem);
+
 void mlx4_cq_completion(struct mlx4_dev *dev, u32 cqn)
 {
 	struct mlx4_cq *cq;

^ permalink raw reply


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