Netdev List
 help / color / mirror / Atom feed
* [PATCH 23/29] LMC: lmc_set_protocol() is effectively a NOP, remove it.
From: Krzysztof Halasa @ 2010-07-31 15:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <m3fwyzzpjf.fsf@intrepid.localdomain>

From: Krzysztof Hałasa <khc@pm.waw.pl>

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
---
 drivers/net/wan/lmc/main.c  |    2 +-
 drivers/net/wan/lmc/media.c |   27 +++------------------------
 drivers/net/wan/lmc/var.h   |    2 +-
 3 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wan/lmc/main.c b/drivers/net/wan/lmc/main.c
index 1231d7c..133cc77 100644
--- a/drivers/net/wan/lmc/main.c
+++ b/drivers/net/wan/lmc/main.c
@@ -962,7 +962,7 @@ static void lmc_running_reset(struct net_device *dev)
 
 
 /* This is what is called when you ifconfig down a device. This disables
-   the timer for the watchdog and keepalives, and disables the irq for dev. */
+   the watchdog timer and the irq for dev. */
 static int lmc_close(struct net_device *dev)
 {
 	/* not calling release_region() as we should */
diff --git a/drivers/net/wan/lmc/media.c b/drivers/net/wan/lmc/media.c
index ecf0f2a..ea5c2bc 100644
--- a/drivers/net/wan/lmc/media.c
+++ b/drivers/net/wan/lmc/media.c
@@ -35,13 +35,6 @@
  * the GNU General Public License version 2, incorporated herein by reference.
  */
 
-static void lmc_set_protocol(struct card * const sc, struct control *ctl)
-{
-	if (!ctl)
-		sc->ictl.keepalive_onoff = LMC_CTL_ON;
-}
-
-
 /* SSI methods */
 
 /* These are bits to program the ssi frequency generator */
@@ -180,7 +173,6 @@ static void lmc_ssi_set_status(struct card * const sc, struct control *ctl)
 	if (ctl == NULL) {
 		lmc_ssi_set_clock(sc, sc->ictl.clock_source);
 		lmc_ssi_set_speed(sc, &sc->ictl);
-		lmc_set_protocol(sc, NULL);
 		return;
 	}
 
@@ -197,8 +189,6 @@ static void lmc_ssi_set_status(struct card * const sc, struct control *ctl)
 
 	if (ctl->clock_rate != sc->ictl.clock_rate)
 		lmc_ssi_set_speed(sc, ctl);
-
-	lmc_set_protocol(sc, ctl);
 }
 
 /* Return hardware link status. 0 == link is down, 1 == link is up. */
@@ -375,21 +365,15 @@ static void lmc_hssi_set_status(struct card * const sc, struct control *ctl)
 {
 	if (ctl == NULL) {
 		lmc_hssi_set_clock(sc, sc->ictl.clock_source);
-		lmc_set_protocol(sc, NULL);
-
 		return;
 	}
 
 	/* check for change in clock source */
-	if (ctl->clock_source && !sc->ictl.clock_source) {
-		lmc_hssi_set_clock(sc, LMC_CTL_CLOCK_SOURCE_INT);
+	if (ctl->clock_source && !sc->ictl.clock_source)
 		sc->timing = LMC_CTL_CLOCK_SOURCE_INT;
-	} else if (!ctl->clock_source && sc->ictl.clock_source) {
+	else if (!ctl->clock_source && sc->ictl.clock_source)
 		sc->timing = LMC_CTL_CLOCK_SOURCE_EXT;
-		lmc_hssi_set_clock(sc, LMC_CTL_CLOCK_SOURCE_EXT);
-	}
-
-	lmc_set_protocol(sc, ctl);
+	lmc_hssi_set_clock(sc, sc->timing);
 }
 
 /* Return hardware link status. 0 == link is down, 1 == link is up. */
@@ -470,7 +454,6 @@ static void lmc_ds3_set_status(struct card * const sc, struct control *ctl)
 	if (ctl == NULL) {
 		lmc_ds3_set_100ft(sc, sc->ictl.cable_length);
 		lmc_ds3_set_scram(sc, sc->ictl.scrambler_onoff);
-		lmc_set_protocol(sc, NULL);
 		return;
 	}
 
@@ -485,8 +468,6 @@ static void lmc_ds3_set_status(struct card * const sc, struct control *ctl)
 		lmc_ds3_set_scram(sc, LMC_CTL_ON);
 	else if (!ctl->scrambler_onoff && sc->ictl.scrambler_onoff)
 		lmc_ds3_set_scram(sc, LMC_CTL_OFF);
-
-	lmc_set_protocol(sc, ctl);
 }
 
 static void lmc_ds3_init(struct card * const sc)
@@ -732,7 +713,6 @@ static void lmc_t1_set_status(struct card * const sc, struct control *ctl)
 {
 	if (ctl == NULL) {
 		lmc_t1_set_circuit_type(sc, sc->ictl.circuit_type);
-		lmc_set_protocol(sc, NULL);
 		return;
 	}
 	/* check for change in circuit type */
@@ -742,7 +722,6 @@ static void lmc_t1_set_status(struct card * const sc, struct control *ctl)
 	else if (ctl->circuit_type == LMC_CTL_CIRCUIT_TYPE_E1
 		 && sc->ictl.circuit_type == LMC_CTL_CIRCUIT_TYPE_T1)
 		lmc_t1_set_circuit_type(sc, LMC_CTL_CIRCUIT_TYPE_T1);
-	lmc_set_protocol(sc, ctl);
 }
 
 /* Return hardware link status. 0 == link is down, 1 == link is up. */
diff --git a/drivers/net/wan/lmc/var.h b/drivers/net/wan/lmc/var.h
index 971f5d6..93c21fe 100644
--- a/drivers/net/wan/lmc/var.h
+++ b/drivers/net/wan/lmc/var.h
@@ -152,7 +152,7 @@ struct control {
 	u32 cable_length;		/* DS3 */
 	u32 scrambler_onoff;		/* DS3 */
 	u32 cable_type;			/* T1 */
-	u32 keepalive_onoff;		/* protocol */
+	u32 keepalive_onoff;		/* unused */
 	u32 ticks;			/* ticks/sec */
 	union {
 		lmc_av9110_t ssi;
-- 
1.7.1.1


^ permalink raw reply related

* [PATCH 27/29] LMC: Remove redundant card->name.
From: Krzysztof Halasa @ 2010-07-31 15:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <m3fwyzzpjf.fsf@intrepid.localdomain>

From: Krzysztof Hałasa <khc@pm.waw.pl>

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
---
 drivers/net/wan/lmc/main.c  |    3 +--
 drivers/net/wan/lmc/media.c |   40 ++++++++++++++++++++++------------------
 drivers/net/wan/lmc/var.h   |    1 -
 3 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wan/lmc/main.c b/drivers/net/wan/lmc/main.c
index 133cc77..13383a5 100644
--- a/drivers/net/wan/lmc/main.c
+++ b/drivers/net/wan/lmc/main.c
@@ -754,7 +754,6 @@ static int __devinit lmc_init_one(struct pci_dev *pdev,
 	dev->watchdog_timeo = HZ; /* 1 second */
 	dev->tx_queue_len = 100;
 	sc->netdev = dev;
-	sc->name = dev->name;
 	dev->base_addr = pci_resource_start(pdev, 0);
 	dev->irq = pdev->irq;
 	pci_set_drvdata(pdev, dev);
@@ -1624,7 +1623,7 @@ static void lmc_softreset(struct card * const sc)
 			if (skb == NULL) {
 				printk(KERN_WARNING
 				       "%s: Failed to allocate receiver ring, will try again\n",
-				       sc->name);
+				       sc->netdev->name);
 				sc->failed_ring = 1;
 				break;
 			} else
diff --git a/drivers/net/wan/lmc/media.c b/drivers/net/wan/lmc/media.c
index ea5c2bc..b9fadb4 100644
--- a/drivers/net/wan/lmc/media.c
+++ b/drivers/net/wan/lmc/media.c
@@ -230,13 +230,14 @@ static int lmc_ssi_get_link_status(struct card * const sc)
 		if (sc->last_led_err[3] != 1) {
 			sc->extra_stats.tx_lossOfClockCnt++;
 			printk(KERN_WARNING "%s: Lost Clock, Link Down\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		sc->last_led_err[3] = 1;
 		lmc_led_on(sc, LMC_MII16_LED3);	/* turn ON red LED */
 	} else {
 		if (sc->last_led_err[3] == 1)
-			printk(KERN_WARNING "%s: Clock Returned\n", sc->name);
+			printk(KERN_WARNING "%s: Clock Returned\n",
+			       sc->netdev->name);
 		sc->last_led_err[3] = 0;
 		lmc_led_off(sc, LMC_MII16_LED3); /* turn OFF red LED */
 	}
@@ -255,12 +256,14 @@ static int lmc_ssi_get_link_status(struct card * const sc)
 
 	if (hw_hdsk == 0) {
 		if (sc->last_led_err[1] != 1)
-			printk(KERN_WARNING "%s: DSR not asserted\n", sc->name);
+			printk(KERN_WARNING "%s: DSR not asserted\n",
+			       sc->netdev->name);
 		sc->last_led_err[1] = 1;
 		lmc_led_off(sc, LMC_MII16_LED1);
 	} else {
 		if (sc->last_led_err[1] != 0)
-			printk(KERN_WARNING "%s: DSR now asserted\n", sc->name);
+			printk(KERN_WARNING "%s: DSR now asserted\n",
+			       sc->netdev->name);
 		sc->last_led_err[1] = 0;
 		lmc_led_on(sc, LMC_MII16_LED1);
 	}
@@ -532,7 +535,7 @@ static int lmc_ds3_get_link_status(struct card * const sc)
 			lmc_mii_writereg(sc, 0, 18, r1);
 			printk(KERN_WARNING
 			       "%s: Red Alarm - Loss of Signal or Loss of Framing\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		lmc_led_on(sc, LMC_DS3_LED3);	/* turn on red LED */
 		sc->last_led_err[3] = 1;
@@ -556,10 +559,11 @@ static int lmc_ds3_get_link_status(struct card * const sc)
 		ret = 0;
 		if (sc->last_led_err[0] != 1) {
 			printk(KERN_WARNING
-			       "%s: AIS Alarm or XBit Error\n", sc->name);
+			       "%s: AIS Alarm or XBit Error\n",
+			       sc->netdev->name);
 			printk(KERN_WARNING
 			       "%s: Remote end has loss of signal or framing\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		lmc_led_on(sc, LMC_DS3_LED0);
 		sc->last_led_err[0] = 1;
@@ -576,7 +580,7 @@ static int lmc_ds3_get_link_status(struct card * const sc)
 		if (sc->last_led_err[1] != 1) {
 			printk(KERN_WARNING
 			       "%s: Blue Alarm - Receiving all 1's\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		lmc_led_on(sc, LMC_DS3_LED1);
 		sc->last_led_err[1] = 1;
@@ -638,11 +642,11 @@ static void lmc_t1_set_circuit_type(struct card * const sc, int ie)
 	if (ie == LMC_CTL_CIRCUIT_TYPE_T1) {
 		sc->miireg16 |= LMC_MII16_T1_Z;
 		sc->ictl.circuit_type = LMC_CTL_CIRCUIT_TYPE_T1;
-		printk(KERN_INFO "%s: In T1 Mode\n", sc->name);
+		printk(KERN_INFO "%s: In T1 Mode\n", sc->netdev->name);
 	} else {
 		sc->miireg16 &= ~LMC_MII16_T1_Z;
 		sc->ictl.circuit_type = LMC_CTL_CIRCUIT_TYPE_E1;
-		printk(KERN_INFO "%s: In E1 Mode\n", sc->name);
+		printk(KERN_INFO "%s: In E1 Mode\n", sc->netdev->name);
 	}
 
 	lmc_mii_writereg(sc, 0, 16, sc->miireg16);
@@ -747,14 +751,14 @@ static int lmc_t1_get_link_status(struct card * const sc)
 		if (sc->last_led_err[1] != 1) {
 			printk(KERN_WARNING
 			       "%s: Receive AIS/Blue Alarm. Far end in RED alarm\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		lmc_led_on(sc, LMC_DS3_LED1);
 		sc->last_led_err[1] = 1;
 	} else {
 		if (sc->last_led_err[1] != 0) {
 			printk(KERN_WARNING "%s: End AIS/Blue Alarm\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		lmc_led_off(sc, LMC_DS3_LED1);
 		sc->last_led_err[1] = 0;
@@ -770,14 +774,14 @@ static int lmc_t1_get_link_status(struct card * const sc)
 		ret = 0;
 		if (sc->last_led_err[0] != 1) {
 			printk(KERN_WARNING "%s: Receive Yellow AIS Alarm\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		lmc_led_on(sc, LMC_DS3_LED0);
 		sc->last_led_err[0] = 1;
 	} else {
 		if (sc->last_led_err[0] != 0) {
 			printk(KERN_WARNING "%s: End of Yellow AIS Alarm\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		lmc_led_off(sc, LMC_DS3_LED0);
 		sc->last_led_err[0] = 0;
@@ -790,7 +794,7 @@ static int lmc_t1_get_link_status(struct card * const sc)
 		if (sc->last_led_err[3] != 1) {
 			printk(KERN_WARNING
 			       "%s: Local Red Alarm: Loss of Framing\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		lmc_led_on(sc, LMC_DS3_LED3);
 		sc->last_led_err[3] = 1;
@@ -798,7 +802,7 @@ static int lmc_t1_get_link_status(struct card * const sc)
 	} else {
 		if (sc->last_led_err[3] != 0) {
 			printk(KERN_WARNING "%s: End Red Alarm (LOF)\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		if (!(link_status & T1F_RLOS))
 			lmc_led_off(sc, LMC_DS3_LED3);
@@ -810,7 +814,7 @@ static int lmc_t1_get_link_status(struct card * const sc)
 		if (sc->last_led_err[2] != 1) {
 			printk(KERN_WARNING
 			       "%s: Local Red Alarm: Loss of Signal\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		lmc_led_on(sc, LMC_DS3_LED3);
 		sc->last_led_err[2] = 1;
@@ -818,7 +822,7 @@ static int lmc_t1_get_link_status(struct card * const sc)
 	} else {
 		if (sc->last_led_err[2] != 0) {
 			printk(KERN_WARNING "%s: End Red Alarm (LOS)\n",
-			       sc->name);
+			       sc->netdev->name);
 		}
 		if (!(link_status & T1F_RLOF))
 			lmc_led_off(sc, LMC_DS3_LED3);
diff --git a/drivers/net/wan/lmc/var.h b/drivers/net/wan/lmc/var.h
index 54e9b0b..f62f9a1 100644
--- a/drivers/net/wan/lmc/var.h
+++ b/drivers/net/wan/lmc/var.h
@@ -268,7 +268,6 @@ typedef struct lmc_xinfo {
 
 /* forward decl */
 struct card {
-	char *name;
 	struct lmc_extra_statistics extra_stats;
 	struct net_device *netdev;
 
-- 
1.7.1.1


^ permalink raw reply related

* [PATCH 28/29] LMC: Simplify and fix CSR names and logic.
From: Krzysztof Halasa @ 2010-07-31 15:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <m3fwyzzpjf.fsf@intrepid.localdomain>

From: Krzysztof Hałasa <khc@pm.waw.pl>

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
---
 drivers/net/wan/lmc/main.c  |  155 ++++++++++++++++++-------------------------
 drivers/net/wan/lmc/media.c |   24 ++++----
 drivers/net/wan/lmc/var.h   |   93 ++++++++++++--------------
 3 files changed, 118 insertions(+), 154 deletions(-)

diff --git a/drivers/net/wan/lmc/main.c b/drivers/net/wan/lmc/main.c
index 13383a5..6635afc 100644
--- a/drivers/net/wan/lmc/main.c
+++ b/drivers/net/wan/lmc/main.c
@@ -26,8 +26,7 @@
  * arround.
  *
  * The initialization portion of this driver (the lmc_reset() and the
- * lmc_dec_reset() functions, as well as the led controls and the
- * lmc_initcsrs() functions.
+ * lmc_dec_reset() functions, as well as the led controls.
  *
  * The watchdog function runs every second and checks to see if
  * we still have link, and that the timing source is what we expected
@@ -96,8 +95,6 @@ static int lmc_open(struct net_device *dev);
 static int lmc_close(struct net_device *dev);
 static struct net_device_stats *lmc_get_stats(struct net_device *dev);
 static irqreturn_t lmc_interrupt(int irq, void *dev_instance);
-static void lmc_initcsrs(struct card * const sc, lmc_csrptr_t csr_base,
-			 size_t csr_size);
 static void lmc_softreset(struct card * const);
 static void lmc_running_reset(struct net_device *dev);
 static int lmc_ifdown(struct net_device * const);
@@ -329,13 +326,13 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			   to reset that later anyway. */
 
 			sc->gpio &= ~LMC_GEP_RESET;
-			LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+			csr_write(sc, CSR_GPIO, sc->gpio);
 
 			/* hold for more than 10 microseconds */
 			udelay(50);
 
 			sc->gpio |= LMC_GEP_RESET;
-			LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+			csr_write(sc, CSR_GPIO, sc->gpio);
 
 			/* stop driving Xilinx-related signals */
 			lmc_gpio_mkinput(sc, 0xff);
@@ -386,16 +383,16 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			   to reset that later anyway. */
 
 			sc->gpio &= ~(LMC_GEP_RESET | LMC_GEP_DP);
-			LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+			csr_write(sc, CSR_GPIO, sc->gpio);
 
 			/* hold for more than 10 microseconds */
 			udelay(50);
 
 			sc->gpio |= LMC_GEP_DP | LMC_GEP_RESET;
-			LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+			csr_write(sc, CSR_GPIO, sc->gpio);
 
 			/* busy wait for the chip to reset */
-			while ((LMC_CSR_READ(sc, csr_gp) & LMC_GEP_INIT) == 0 &&
+			while ((csr_read(sc, CSR_GPIO) & LMC_GEP_INIT) == 0 &&
 			       (timeout-- > 0))
 				cpu_relax();
 
@@ -450,7 +447,7 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			sc->gpio &= ~LMC_GEP_DP;
 			sc->gpio &= ~LMC_GEP_RESET;
 			sc->gpio |=  LMC_GEP_MODE;
-			LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+			csr_write(sc, CSR_GPIO, sc->gpio);
 
 			lmc_gpio_mkoutput(sc, LMC_GEP_MODE | LMC_GEP_DP |
 					  LMC_GEP_RESET);
@@ -477,13 +474,13 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			sc->gpio |= LMC_GEP_MODE;
 			sc->gpio |= LMC_GEP_DATA;
 			sc->gpio |= LMC_GEP_CLK;
-			LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+			csr_write(sc, CSR_GPIO, sc->gpio);
 
 			lmc_gpio_mkoutput(sc, LMC_GEP_DATA | LMC_GEP_CLK |
 					  LMC_GEP_MODE);
 
 			/* busy wait for the chip to reset */
-			while ((LMC_CSR_READ(sc, csr_gp) & LMC_GEP_INIT) == 0 &&
+			while ((csr_read(sc, CSR_GPIO) & LMC_GEP_INIT) == 0 &&
 			       (timeout-- > 0))
 				cpu_relax();
 
@@ -511,24 +508,25 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 				/* Clock to zero */
 				sc->gpio &= ~LMC_GEP_CLK;
 				sc->gpio |= LMC_GEP_MODE;
-				LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+				csr_write(sc, CSR_GPIO, sc->gpio);
 				udelay(1);
 
 				/* Put the clack back to one */
 				sc->gpio |= LMC_GEP_CLK;
 				sc->gpio |= LMC_GEP_MODE;
-				LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+				csr_write(sc, CSR_GPIO, sc->gpio);
 				udelay(1);
 			}
-			if ((LMC_CSR_READ(sc, csr_gp) & LMC_GEP_INIT) == 0) {
+
+			if ((csr_read(sc, CSR_GPIO) & LMC_GEP_INIT) == 0)
 				printk(KERN_WARNING
 				       "%s: Reprogramming FAILED. Needs to be reprogrammed. (corrupted data)\n",
 				       dev->name);
-			} else if ((LMC_CSR_READ(sc, csr_gp) &
-				    LMC_GEP_DP) == 0){
-				printk(KERN_WARNING "%s: Reprogramming FAILED. Needs to be reprogrammed. (done)\n",
+			else if ((csr_read(sc, CSR_GPIO) & LMC_GEP_DP) == 0)
+				printk(KERN_WARNING
+				       "%s: Reprogramming FAILED. Needs to be reprogrammed. (done)\n",
 				       dev->name);
-			} else
+			else
 				printk(KERN_DEBUG
 				       "%s: Done reprogramming Xilinx, %d bits, good luck!\n",
 				       dev->name, pos);
@@ -583,9 +581,9 @@ static void lmc_watchdog(unsigned long data)
 	 * and the transmit and receive processes are running.
 	 */
 
-	LMC_CSR_WRITE(sc, csr_15, 0x00000011);
+	csr_write(sc, CSR_WATCHDOG, 0x00000011);
 	sc->cmdmode |= TULIP_CMD_TXRUN | TULIP_CMD_RXRUN;
-	LMC_CSR_WRITE(sc, csr_command, sc->cmdmode);
+	csr_write(sc, CSR_COMMAND, sc->cmdmode);
 
 	if (sc->ok == 0)
 		goto kick_timer;
@@ -657,7 +655,7 @@ static void lmc_watchdog(unsigned long data)
 
 	/* Poke the transmitter to make sure it never stops, even if we run
 	   out of mem */
-	LMC_CSR_WRITE(sc, csr_rxpoll, 0);
+	csr_write(sc, CSR_RXPOLL, 0);
 
 	/* Check for code that failed and try and fix it as appropriate */
 	if (sc->failed_ring == 1) {
@@ -678,8 +676,8 @@ static void lmc_watchdog(unsigned long data)
 
 	/* remember the timer value */
 kick_timer:
-	ticks = LMC_CSR_READ(sc, csr_gp_timer);
-	LMC_CSR_WRITE(sc, csr_gp_timer, 0xffffffffUL);
+	ticks = csr_read(sc, CSR_GP_TIMER);
+	csr_write(sc, CSR_GP_TIMER, 0xffffffffUL);
 	sc->ictl.ticks = 0x0000ffff - (ticks & 0x0000ffff);
 
 	/* restart this timer. */
@@ -776,8 +774,6 @@ static int __devinit lmc_init_one(struct pci_dev *pdev,
 
 	dev_info(&pdev->dev, "%s = LMC %s\n", dev->name, sc->media->name);
 
-	lmc_initcsrs(sc, dev->base_addr, 8);
-
 	lmc_gpio_mkinput(sc, 0xff);
 	sc->gpio = 0;		/* drive no signals yet */
 
@@ -794,7 +790,7 @@ static int __devinit lmc_init_one(struct pci_dev *pdev,
 		dev_warn(&pdev->dev, "%s: Invalid model number (%d)",
 			 dev->name, model);
 
-	LMC_CSR_WRITE(sc, csr_gp_timer, 0xFFFFFFFFUL); /* reset clock */
+	csr_write(sc, CSR_GP_TIMER, 0xFFFFFFFFUL); /* reset clock */
 
 	sc->extra_stats.check = STATCHECK;
 	sc->extra_stats.version_size = (DRIVER_VERSION << 16) +
@@ -901,11 +897,11 @@ static int lmc_open(struct net_device *dev)
 			     TULIP_STS_SYSERROR | TULIP_STS_TXSTOPPED |
 			     TULIP_STS_TXUNDERFLOW | TULIP_STS_RXSTOPPED |
 			     TULIP_STS_RXNOBUF);
-	LMC_CSR_WRITE(sc, csr_intr, sc->intrmask);
+	csr_write(sc, CSR_INTR, sc->intrmask);
 
 	sc->cmdmode |= TULIP_CMD_TXRUN;
 	sc->cmdmode |= TULIP_CMD_RXRUN;
-	LMC_CSR_WRITE(sc, csr_command, sc->cmdmode);
+	csr_write(sc, CSR_COMMAND, sc->cmdmode);
 
 	sc->ok = 1; /* Run watchdog */
 
@@ -935,7 +931,7 @@ static void lmc_running_reset(struct net_device *dev)
 
 	/* stop interrupts */
 	/* Clear the interrupt mask */
-	LMC_CSR_WRITE(sc, csr_intr, 0x00000000);
+	csr_write(sc, CSR_INTR, 0x00000000);
 
 	lmc_dec_reset(sc);
 	lmc_reset(sc);
@@ -951,10 +947,10 @@ static void lmc_running_reset(struct net_device *dev)
 	sc->extra_stats.tx_tbusy0++;
 
 	sc->intrmask = TULIP_DEFAULT_INTR_MASK;
-	LMC_CSR_WRITE(sc, csr_intr, sc->intrmask);
+	csr_write(sc, CSR_INTR, sc->intrmask);
 
 	sc->cmdmode |= (TULIP_CMD_TXRUN | TULIP_CMD_RXRUN);
-	LMC_CSR_WRITE(sc, csr_command, sc->cmdmode);
+	csr_write(sc, CSR_COMMAND, sc->cmdmode);
 
 	lmc_trace(dev, "lmc_runnin_reset_out");
 }
@@ -998,16 +994,16 @@ static int lmc_ifdown(struct net_device *dev)
 
 	/* stop interrupts */
 	/* Clear the interrupt mask */
-	LMC_CSR_WRITE(sc, csr_intr, 0x00000000);
+	csr_write(sc, CSR_INTR, 0x00000000);
 
 	/* Stop Tx and Rx on the chip */
-	csr6 = LMC_CSR_READ(sc, csr_command);
+	csr6 = csr_read(sc, CSR_COMMAND);
 	csr6 &= ~LMC_DEC_ST;		/* Turn off the Transmission bit */
 	csr6 &= ~LMC_DEC_SR;		/* Turn off the Receive bit */
-	LMC_CSR_WRITE(sc, csr_command, csr6);
+	csr_write(sc, CSR_COMMAND, csr6);
 
 	sc->netdev->stats.rx_missed_errors +=
-		LMC_CSR_READ(sc, csr_missed_frames) & 0xffff;
+		csr_read(sc, CSR_MISSED_FRAMES) & 0xFFFF;
 
 	/* release the interrupt */
 	if (sc->got_irq == 1) {
@@ -1062,7 +1058,7 @@ static irqreturn_t lmc_interrupt(int irq, void *dev_instance)
 	spin_lock(&sc->lock);
 
 	/* Read the csr to find what interrupts we have (if any) */
-	csr = LMC_CSR_READ(sc, csr_status);
+	csr = csr_read(sc, CSR_STATUS);
 
 	/* Make sure this is our interrupt */
 	if (!(csr & sc->intrmask))
@@ -1075,7 +1071,7 @@ static irqreturn_t lmc_interrupt(int irq, void *dev_instance)
 		handled = 1;
 
 		/* Clear interrupt bits, we handle all case below */
-		LMC_CSR_WRITE(sc, csr_status, csr);
+		csr_write(sc, CSR_STATUS, csr);
 
 		/*
 		 * One of
@@ -1201,7 +1197,7 @@ static irqreturn_t lmc_interrupt(int irq, void *dev_instance)
 
 		/* Get current csr status to make sure we've cleared all
 		   interrupts */
-		csr = LMC_CSR_READ(sc, csr_status);
+		csr = csr_read(sc, CSR_STATUS);
 	} /* end interrupt loop */
 
 lmc_int_fail_out:
@@ -1282,7 +1278,7 @@ static netdev_tx_t lmc_start_xmit(struct sk_buff *skb,
 	sc->txring[entry].status = 0x80000000;
 
 	/* send now! */
-	LMC_CSR_WRITE(sc, csr_txpoll, 0);
+	csr_write(sc, CSR_TXPOLL, 0);
 
 	spin_unlock_irqrestore(&sc->lock, flags);
 
@@ -1486,7 +1482,7 @@ static struct net_device_stats *lmc_get_stats(struct net_device *dev)
 	spin_lock_irqsave(&sc->lock, flags);
 
 	sc->netdev->stats.rx_missed_errors +=
-		LMC_CSR_READ(sc, csr_missed_frames) & 0xffff;
+		csr_read(sc, CSR_MISSED_FRAMES) & 0xFFFF;
 
 	spin_unlock_irqrestore(&sc->lock, flags);
 
@@ -1530,10 +1526,10 @@ unsigned lmc_mii_readreg(struct card * const sc, unsigned devaddr,
 	for (i = 15; i >= 0; i--) {
 		int dataval = (command & (1 << i)) ? 0x20000 : 0;
 
-		LMC_CSR_WRITE(sc, csr_9, dataval);
+		csr_write(sc, CSR_SROM_MII, dataval);
 		lmc_delay();
 		/* __SLOW_DOWN_IO; */
-		LMC_CSR_WRITE(sc, csr_9, dataval | 0x10000);
+		csr_write(sc, CSR_SROM_MII, dataval | 0x10000);
 		lmc_delay();
 		/* __SLOW_DOWN_IO; */
 	}
@@ -1541,12 +1537,12 @@ unsigned lmc_mii_readreg(struct card * const sc, unsigned devaddr,
 	lmc_trace(sc->netdev, "lmc_mii_readreg: done1");
 
 	for (i = 19; i > 0; i--) {
-		LMC_CSR_WRITE(sc, csr_9, 0x40000);
+		csr_write(sc, CSR_SROM_MII, 0x40000);
 		lmc_delay();
 		/* __SLOW_DOWN_IO; */
-		retval = (retval << 1) |
-			((LMC_CSR_READ(sc, csr_9) & 0x80000) ? 1 : 0);
-		LMC_CSR_WRITE(sc, csr_9, 0x40000 | 0x10000);
+		retval <<= 1;
+		retval |= !!(csr_read(sc, CSR_SROM_MII) & 0x80000);
+		csr_write(sc, CSR_SROM_MII, 0x40000 | 0x10000);
 		lmc_delay();
 		/* __SLOW_DOWN_IO; */
 	}
@@ -1575,10 +1571,10 @@ void lmc_mii_writereg(struct card * const sc, unsigned devaddr, unsigned regno,
 		else
 			datav = 0x00000;
 
-		LMC_CSR_WRITE(sc, csr_9, datav);
+		csr_write(sc, CSR_SROM_MII, datav);
 		lmc_delay();
 		/* __SLOW_DOWN_IO; */
-		LMC_CSR_WRITE(sc, csr_9, (datav | 0x10000));
+		csr_write(sc, CSR_SROM_MII, (datav | 0x10000));
 		lmc_delay();
 		/* __SLOW_DOWN_IO; */
 		i--;
@@ -1586,10 +1582,10 @@ void lmc_mii_writereg(struct card * const sc, unsigned devaddr, unsigned regno,
 
 	i = 2;
 	while (i > 0) {
-		LMC_CSR_WRITE(sc, csr_9, 0x40000);
+		csr_write(sc, CSR_SROM_MII, 0x40000);
 		lmc_delay();
 		/* __SLOW_DOWN_IO; */
-		LMC_CSR_WRITE(sc, csr_9, 0x50000);
+		csr_write(sc, CSR_SROM_MII, 0x50000);
 		lmc_delay();
 		/* __SLOW_DOWN_IO; */
 		i--;
@@ -1658,7 +1654,7 @@ static void lmc_softreset(struct card * const sc)
 		sc->rxring[i - 1].buffer2 = virt_to_bus(&sc->rxring[0]);
 	}
 	/* write base address */
-	LMC_CSR_WRITE(sc, csr_rxlist, virt_to_bus(sc->rxring));
+	csr_write(sc, CSR_RXLIST, virt_to_bus(sc->rxring));
 
 	/* Initialize the transmit rings and buffers */
 	for (i = 0; i < LMC_TXDESCS; i++) {
@@ -1672,7 +1668,7 @@ static void lmc_softreset(struct card * const sc)
 		sc->txring[i].buffer2 = virt_to_bus(&sc->txring[i + 1]);
 	}
 	sc->txring[i - 1].buffer2 = virt_to_bus(&sc->txring[0]);
-	LMC_CSR_WRITE(sc, csr_txlist, virt_to_bus(sc->txring));
+	csr_write(sc, CSR_TXLIST, virt_to_bus(sc->txring));
 
 	lmc_trace(sc->netdev, "lmc_softreset out");
 }
@@ -1681,7 +1677,7 @@ void lmc_gpio_mkinput(struct card * const sc, u32 bits)
 {
 	lmc_trace(sc->netdev, "lmc_gpio_mkinput in");
 	sc->gpio_io &= ~bits;
-	LMC_CSR_WRITE(sc, csr_gp, TULIP_GP_PINSET | (sc->gpio_io));
+	csr_write(sc, CSR_GPIO, TULIP_GP_PINSET | (sc->gpio_io));
 	lmc_trace(sc->netdev, "lmc_gpio_mkinput out");
 }
 
@@ -1689,7 +1685,7 @@ void lmc_gpio_mkoutput(struct card * const sc, u32 bits)
 {
 	lmc_trace(sc->netdev, "lmc_gpio_mkoutput in");
 	sc->gpio_io |= bits;
-	LMC_CSR_WRITE(sc, csr_gp, TULIP_GP_PINSET | (sc->gpio_io));
+	csr_write(sc, CSR_GPIO, TULIP_GP_PINSET | (sc->gpio_io));
 	lmc_trace(sc->netdev, "lmc_gpio_mkoutput out");
 }
 
@@ -1734,7 +1730,7 @@ static void lmc_reset(struct card * const sc)
 	/* RESET low to force state reset.  This also forces the transmitter
 	   clock to be internal, but we expect to reset that later anyway. */
 	sc->gpio &= ~(LMC_GEP_RESET);
-	LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+	csr_write(sc, CSR_GPIO, sc->gpio);
 
 	/* hold for more than 10 microseconds */
 	udelay(50);
@@ -1756,20 +1752,20 @@ static void lmc_dec_reset(struct card * const sc)
 
 	/* disable all interrupts */
 	sc->intrmask = 0;
-	LMC_CSR_WRITE(sc, csr_intr, sc->intrmask);
+	csr_write(sc, CSR_INTR, sc->intrmask);
 
 	/* Reset the chip with a software reset command. Wait 10 microseconds
 	   (actually 50 PCI cycles but at 33MHz that comes to two microseconds
 	   but wait a bit longer anyways) */
-	LMC_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET);
+	csr_write(sc, CSR_BUSMODE, TULIP_BUSMODE_SWRESET);
 	udelay(25);
 #ifdef __sparc__
-	sc->busmode = LMC_CSR_READ(sc, csr_busmode);
+	sc->busmode = csr_read(sc, CSR_BUSMODE);
 	sc->busmode = 0x00100000;
 	sc->busmode &= ~TULIP_BUSMODE_SWRESET;
-	LMC_CSR_WRITE(sc, csr_busmode, sc->busmode);
+	csr_write(sc, CSR_BUSMODE, sc->busmode);
 #endif
-	sc->cmdmode = LMC_CSR_READ(sc, csr_command);
+	sc->cmdmode = csr_read(sc, CSR_COMMAND);
 
 	/*
 	 * We want:
@@ -1788,39 +1784,16 @@ static void lmc_dec_reset(struct card * const sc)
 	sc->cmdmode &= ~(TULIP_CMD_OPERMODE | TULIP_CMD_THRESHOLDCTL |
 			     TULIP_CMD_STOREFWD | TULIP_CMD_TXTHRSHLDCTL);
 
-	LMC_CSR_WRITE(sc, csr_command, sc->cmdmode);
+	csr_write(sc, CSR_COMMAND, sc->cmdmode);
 
 	/* disable receiver watchdog and transmit jabber */
-	val = LMC_CSR_READ(sc, csr_sia_general);
+	val = csr_read(sc, CSR_WATCHDOG);
 	val |= (TULIP_WATCHDOG_TXDISABLE | TULIP_WATCHDOG_RXDISABLE);
-	LMC_CSR_WRITE(sc, csr_sia_general, val);
+	csr_write(sc, CSR_WATCHDOG, val);
 
 	lmc_trace(sc->netdev, "lmc_dec_reset out");
 }
 
-static void lmc_initcsrs(struct card * const sc, lmc_csrptr_t csr_base,
-			 size_t csr_size)
-{
-	lmc_trace(sc->netdev, "lmc_initcsrs in");
-	sc->csrs.csr_busmode	= csr_base +  0 * csr_size;
-	sc->csrs.csr_txpoll		= csr_base +  1 * csr_size;
-	sc->csrs.csr_rxpoll		= csr_base +  2 * csr_size;
-	sc->csrs.csr_rxlist		= csr_base +  3 * csr_size;
-	sc->csrs.csr_txlist		= csr_base +  4 * csr_size;
-	sc->csrs.csr_status		= csr_base +  5 * csr_size;
-	sc->csrs.csr_command	= csr_base +  6 * csr_size;
-	sc->csrs.csr_intr		= csr_base +  7 * csr_size;
-	sc->csrs.csr_missed_frames	= csr_base +  8 * csr_size;
-	sc->csrs.csr_9		= csr_base +  9 * csr_size;
-	sc->csrs.csr_10		= csr_base + 10 * csr_size;
-	sc->csrs.csr_11		= csr_base + 11 * csr_size;
-	sc->csrs.csr_12		= csr_base + 12 * csr_size;
-	sc->csrs.csr_13		= csr_base + 13 * csr_size;
-	sc->csrs.csr_14		= csr_base + 14 * csr_size;
-	sc->csrs.csr_15		= csr_base + 15 * csr_size;
-	lmc_trace(sc->netdev, "lmc_initcsrs out");
-}
-
 static void lmc_driver_timeout(struct net_device *dev)
 {
 	struct card *sc = dev_to_sc(dev);
@@ -1843,12 +1816,12 @@ static void lmc_driver_timeout(struct net_device *dev)
 	lmc_running_reset(dev);
 
 	/* restart the tx processes */
-	csr6 = LMC_CSR_READ(sc, csr_command);
-	LMC_CSR_WRITE(sc, csr_command, csr6 | 0x0002);
-	LMC_CSR_WRITE(sc, csr_command, csr6 | 0x2002);
+	csr6 = csr_read(sc, CSR_COMMAND);
+	csr_write(sc, CSR_COMMAND, csr6 | 0x0002);
+	csr_write(sc, CSR_COMMAND, csr6 | 0x2002);
 
 	/* immediate transmit */
-	LMC_CSR_WRITE(sc, csr_txpoll, 0);
+	csr_write(sc, CSR_TXPOLL, 0);
 
 	sc->netdev->stats.tx_errors++;
 	sc->extra_stats.tx_ProcTimeout++;
diff --git a/drivers/net/wan/lmc/media.c b/drivers/net/wan/lmc/media.c
index b9fadb4..cad17be 100644
--- a/drivers/net/wan/lmc/media.c
+++ b/drivers/net/wan/lmc/media.c
@@ -46,15 +46,15 @@ static inline void write_av9110_bit(struct card *sc, int c)
 		sc->gpio |= LMC_GEP_DATA;
 	else
 		sc->gpio &= ~(LMC_GEP_DATA);
-	LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+	csr_write(sc, CSR_GPIO, sc->gpio);
 
 	/* set the clock to high */
 	sc->gpio |= LMC_GEP_CLK;
-	LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+	csr_write(sc, CSR_GPIO, sc->gpio);
 
 	/* set the clock to low again. */
 	sc->gpio &= ~(LMC_GEP_CLK);
-	LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+	csr_write(sc, CSR_GPIO, sc->gpio);
 }
 
 static void write_av9110(struct card *sc, u32 n, u32 m, u32 v, u32 x, u32 r)
@@ -68,14 +68,14 @@ static void write_av9110(struct card *sc, u32 n, u32 m, u32 v, u32 x, u32 r)
 
 	sc->gpio |= LMC_GEP_SSI_GENERATOR;
 	sc->gpio &= ~(LMC_GEP_DATA | LMC_GEP_CLK);
-	LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+	csr_write(sc, CSR_GPIO, sc->gpio);
 
 	/* Set the TXCLOCK, GENERATOR, SERIAL, and SERIALCLK as outputs. */
 	lmc_gpio_mkoutput(sc, (LMC_GEP_DATA | LMC_GEP_CLK
 				| LMC_GEP_SSI_GENERATOR));
 
 	sc->gpio &= ~(LMC_GEP_SSI_GENERATOR);
-	LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+	csr_write(sc, CSR_GPIO, sc->gpio);
 
 	/* a shifting we will go... */
 	for (i = 0; i < 7; i++)
@@ -118,14 +118,14 @@ static void lmc_ssi_set_clock(struct card * const sc, int ie)
 	old = ie;
 	if (ie == LMC_CTL_CLOCK_SOURCE_EXT) {
 		sc->gpio &= ~(LMC_GEP_SSI_TXCLOCK);
-		LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+		csr_write(sc, CSR_GPIO, sc->gpio);
 		sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_EXT;
 		if (ie != old)
 			printk(LMC_PRINTF_FMT ": clock external\n",
 			       LMC_PRINTF_ARGS);
 	} else {
 		sc->gpio |= LMC_GEP_SSI_TXCLOCK;
-		LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+		csr_write(sc, CSR_GPIO, sc->gpio);
 		sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_INT;
 		if (ie != old)
 			printk(LMC_PRINTF_FMT ": clock internal\n",
@@ -217,7 +217,7 @@ static int lmc_ssi_get_link_status(struct card * const sc)
 	link_status = lmc_mii_readreg(sc, 0, 16);
 
 	/* Is the transmit clock still available */
-	ticks = LMC_CSR_READ(sc, csr_gp_timer);
+	ticks = csr_read(sc, CSR_GP_TIMER);
 	ticks = 0x0000ffff - (ticks & 0x0000ffff);
 
 	lmc_led_on(sc, LMC_MII16_LED0);
@@ -347,14 +347,14 @@ static void lmc_hssi_set_clock(struct card * const sc, int ie)
 	old = sc->ictl.clock_source;
 	if (ie == LMC_CTL_CLOCK_SOURCE_EXT) {
 		sc->gpio |= LMC_GEP_HSSI_CLOCK;
-		LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+		csr_write(sc, CSR_GPIO, sc->gpio);
 		sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_EXT;
 		if (old != ie)
 			printk(LMC_PRINTF_FMT ": clock external\n",
 			       LMC_PRINTF_ARGS);
 	} else {
 		sc->gpio &= ~LMC_GEP_HSSI_CLOCK;
-		LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+		csr_write(sc, CSR_GPIO, sc->gpio);
 		sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_INT;
 		if (old != ie)
 			printk(LMC_PRINTF_FMT ": clock internal\n",
@@ -864,14 +864,14 @@ static void lmc_t1_set_clock(struct card * const sc, int ie)
 	old = ie;
 	if (ie == LMC_CTL_CLOCK_SOURCE_EXT) {
 		sc->gpio &= ~(LMC_GEP_SSI_TXCLOCK);
-		LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+		csr_write(sc, CSR_GPIO, sc->gpio);
 		sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_EXT;
 		if (old != ie)
 			printk(LMC_PRINTF_FMT ": clock external\n",
 			       LMC_PRINTF_ARGS);
 	} else {
 		sc->gpio |= LMC_GEP_SSI_TXCLOCK;
-		LMC_CSR_WRITE(sc, csr_gp, sc->gpio);
+		csr_write(sc, CSR_GPIO, sc->gpio);
 		sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_INT;
 		if (old != ie)
 			printk(LMC_PRINTF_FMT ": clock internal\n",
diff --git a/drivers/net/wan/lmc/var.h b/drivers/net/wan/lmc/var.h
index f62f9a1..582f00e 100644
--- a/drivers/net/wan/lmc/var.h
+++ b/drivers/net/wan/lmc/var.h
@@ -32,56 +32,36 @@
 #define LMC_LINK_UP		1
 #define LMC_LINK_DOWN		0
 
-/* These macros for generic read and write to and from the dec chip */
-#define LMC_CSR_READ(sc, csr)		inl((sc)->csrs.csr)
-#define LMC_CSR_WRITE(sc, reg, val)	outl((val), (sc)->csrs.reg)
-
-#define lmc_delay()		inl(sc->csrs.csr_9)
-
 /* This macro sync's up with the mii so that reads and writes can take place */
-#define LMC_MII_SYNC(sc)					\
-	do {							\
-		int n = 32;					\
-		while (n >= 0) {				\
-			LMC_CSR_WRITE((sc), csr_9, 0x20000);	\
-			lmc_delay();				\
-			LMC_CSR_WRITE((sc), csr_9, 0x30000);	\
-			lmc_delay();				\
-			n--;					\
-		}						\
+#define LMC_MII_SYNC(sc)						\
+	do {								\
+		int n = 32;						\
+		while (n >= 0) {					\
+			csr_write((sc), CSR_SROM_MII, 0x20000);		\
+			lmc_delay();					\
+			csr_write((sc), CSR_SROM_MII, 0x30000);		\
+			lmc_delay();					\
+			n--;						\
+		}							\
 	} while (0)
 
-struct lmc_regfile_t {
-	lmc_csrptr_t csr_busmode;	/* CSR0 */
-	lmc_csrptr_t csr_txpoll;	/* CSR1 */
-	lmc_csrptr_t csr_rxpoll;	/* CSR2 */
-	lmc_csrptr_t csr_rxlist;	/* CSR3 */
-	lmc_csrptr_t csr_txlist;	/* CSR4 */
-	lmc_csrptr_t csr_status;	/* CSR5 */
-	lmc_csrptr_t csr_command;	/* CSR6 */
-	lmc_csrptr_t csr_intr;		/* CSR7 */
-	lmc_csrptr_t csr_missed_frames;	/* CSR8 */
-	lmc_csrptr_t csr_9;		/* CSR9 */
-	lmc_csrptr_t csr_10;		/* CSR10 */
-	lmc_csrptr_t csr_11;		/* CSR11 */
-	lmc_csrptr_t csr_12;		/* CSR12 */
-	lmc_csrptr_t csr_13;		/* CSR13 */
-	lmc_csrptr_t csr_14;		/* CSR14 */
-	lmc_csrptr_t csr_15;		/* CSR15 */
-};
-
-#define csr_enetrom		csr_9	/* 21040 */
-#define csr_reserved		csr_10	/* 21040 */
-#define csr_full_duplex		csr_11	/* 21040 */
-#define csr_bootrom		csr_10	/* 21041/21140A/?? */
-#define csr_gp			csr_12	/* 21140* */
-#define csr_watchdog		csr_15	/* 21140* */
-#define csr_gp_timer		csr_11	/* 21041/21140* */
-#define csr_srom_mii		csr_9	/* 21041/21140* */
-#define csr_sia_status		csr_12	/* 2104x */
-#define csr_sia_connectivity	csr_13	/* 2104x */
-#define csr_sia_tx_rx		csr_14	/* 2104x */
-#define csr_sia_general		csr_15	/* 2104x */
+/* DC21140 CSRs */
+#define CSR_BUSMODE		0
+#define CSR_TXPOLL		1
+#define CSR_RXPOLL		2
+#define CSR_RXLIST		3
+#define CSR_TXLIST		4
+#define CSR_STATUS		5
+#define CSR_COMMAND		6 /* operation mode */
+#define CSR_INTR		7
+#define CSR_MISSED_FRAMES	8
+#define CSR_SROM_MII		9
+/* #define CSR_RESERVED		10 */
+#define CSR_GP_TIMER		11
+#define CSR_GPIO		12
+/* #define CSR_RESERVED		13 */
+/* #define CSR_RESERVED		14 */
+#define CSR_WATCHDOG		15
 
 /* tulip length/control transmit descriptor definitions used to define bits
    in the second tulip_desc_t field (length) for the transmit descriptor */
@@ -270,10 +250,8 @@ typedef struct lmc_xinfo {
 struct card {
 	struct lmc_extra_statistics extra_stats;
 	struct net_device *netdev;
-
-	struct lmc_regfile_t csrs;
-	u32 intrmask;		/* our copy of csr_intr */
-	u32 cmdmode;		/* our copy of csr_cmdmode */
+	u32 intrmask;		/* our copy of CSR_INTR */
+	u32 cmdmode;		/* our copy of CSR_COMMAND */
 	u32 gpio_io;		/* state of in/out settings */
 	u32 gpio;		/* state of outputs */
 	struct sk_buff *txq[LMC_TXDESCS];
@@ -421,6 +399,19 @@ static inline void lmc_trace(struct net_device *dev, char *msg)
 #endif
 }
 
+/* These macros for generic read and write to and from the dec chip */
+static inline u32 csr_read(struct card *sc, int csr)
+{
+	return inl(sc->netdev->base_addr + 8 * csr);
+}
+
+static inline void csr_write(struct card *sc, int csr, u32 val)
+{
+	outl(val, sc->netdev->base_addr + 8 * csr);
+}
+
+#define lmc_delay()		csr_read(sc, CSR_SROM_MII);
+
 
 void lmc_led_on(struct card * const, u32);
 void lmc_led_off(struct card * const, u32);
-- 
1.7.1.1


^ permalink raw reply related

* [PATCH 29/29] LMC: Report proper card type before the first dev->open().
From: Krzysztof Halasa @ 2010-07-31 15:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <m3fwyzzpjf.fsf@intrepid.localdomain>

From: Krzysztof Hałasa <khc@pm.waw.pl>

 Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
---
 drivers/net/wan/lmc/main.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wan/lmc/main.c b/drivers/net/wan/lmc/main.c
index 6635afc..14b60ce 100644
--- a/drivers/net/wan/lmc/main.c
+++ b/drivers/net/wan/lmc/main.c
@@ -777,6 +777,7 @@ static int __devinit lmc_init_one(struct pci_dev *pdev,
 	lmc_gpio_mkinput(sc, 0xff);
 	sc->gpio = 0;		/* drive no signals yet */
 
+	sc->media->init(sc);
 	sc->media->defaults(sc);
 
 	if (sc->media->set_link_status)
-- 
1.7.1.1


^ permalink raw reply related

* [PATCH] net: wl12xx: do not use kfree'd memory
From: Kulikov Vasiliy @ 2010-07-31 16:33 UTC (permalink / raw)
  To: kernel-janitors
  Cc: Luciano Coelho, John W. Linville, Juuso Oikarinen,
	Teemu Paasikivi, linux-wireless, netdev

wl1271_dump() uses cmd after kfree(cmd). Move kfree() just after
wl1271_dump().

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/net/wireless/wl12xx/wl1271_spi.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index 96d25fb..4cb99c5 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -160,9 +160,8 @@ static void wl1271_spi_init(struct wl1271 *wl)
 	spi_message_add_tail(&t, &m);
 
 	spi_sync(wl_to_spi(wl), &m);
-	kfree(cmd);
-
 	wl1271_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
+	kfree(cmd);
 }
 
 #define WL1271_BUSY_WORD_TIMEOUT 1000
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH] nf_nat: no IP_NAT_RANGE_MAP_IPS flags when alloc_null_binding()
From: Changli Gao @ 2010-07-31 18:15 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: David S. Miller, netfilter-devel, netdev, Changli Gao

when alloc_null_binding(), no IP_NAT_RNAGE_MAP_IPS in flags means no IP address
translation is needed. It isn't necessary to specify the address explicitly.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 net/ipv4/netfilter/nf_nat_rule.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/net/ipv4/netfilter/nf_nat_rule.c b/net/ipv4/netfilter/nf_nat_rule.c
index ebbd319..fe8c90e 100644
--- a/net/ipv4/netfilter/nf_nat_rule.c
+++ b/net/ipv4/netfilter/nf_nat_rule.c
@@ -108,14 +108,12 @@ alloc_null_binding(struct nf_conn *ct, unsigned int hooknum)
 	   per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED).
 	   Use reply in case it's already been mangled (eg local packet).
 	*/
-	__be32 ip
-		= (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC
-		   ? ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip
-		   : ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip);
-	struct nf_nat_range range
-		= { IP_NAT_RANGE_MAP_IPS, ip, ip, { 0 }, { 0 } };
-
-	pr_debug("Allocating NULL binding for %p (%pI4)\n", ct, &ip);
+	struct nf_nat_range range = { 0 };
+
+	pr_debug("Allocating NULL binding for %p (%pI4)\n", ct,
+		 HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC ?
+		 &ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip :
+		 &ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip);
 	return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum));
 }
 

^ permalink raw reply related

* [PATCH] net: ingress filter message limit
From: Stephen Hemminger @ 2010-07-31 19:13 UTC (permalink / raw)
  To: David Miller, jamal; +Cc: netdev

If user misconfigures ingress and causes a redirection loop, don't
overwhelm the log.  This is also a error case so make it unlikely.
Found by inspection, luckily not in real system.

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


--- a/net/core/dev.c	2010-07-31 12:08:00.808476717 -0700
+++ b/net/core/dev.c	2010-07-31 12:09:32.488882593 -0700
@@ -2646,10 +2646,10 @@ static int ing_filter(struct sk_buff *sk
 	int result = TC_ACT_OK;
 	struct Qdisc *q;
 
-	if (MAX_RED_LOOP < ttl++) {
-		printk(KERN_WARNING
-		       "Redir loop detected Dropping packet (%d->%d)\n",
-		       skb->skb_iif, dev->ifindex);
+	if (unlikely(MAX_RED_LOOP < ttl++)) {
+		if (net_ratelimit())
+			pr_warning( "Redir loop detected Dropping packet (%d->%d)\n",
+			       skb->skb_iif, dev->ifindex);
 		return TC_ACT_SHOT;
 	}
 

^ permalink raw reply

* Re: [PATCH] Multiqueue macvtap driver
From: Ben Hutchings @ 2010-07-31 19:18 UTC (permalink / raw)
  To: Krishna Kumar; +Cc: davem, arnd, netdev, mst
In-Reply-To: <20100731135743.3072.99933.sendpatchset@krkumar2.in.ibm.com>

On Sat, 2010-07-31 at 19:27 +0530, Krishna Kumar wrote:
[...]
> @@ -136,39 +158,68 @@ static void macvtap_put_queue(struct mac
>  }
>  
>  /*
> - * Since we only support one queue, just dereference the pointer.
> + * Select a queue based on the rxq of the device on which this packet
> + * arrived. If the incoming device is not mq, then use our cpu number
> + * to select a queue. vlan->numvtaps is cached in case it changes
> + * during the execution of this function.
>   */
[...]

This can result in reordering if a single-queue device's RX interrupt's
CPU affinity is changed.  We generally try to avoid that.  You should
really use or generate a flow hash.  There is code for this in
net/core/dev.c:get_rps_cpu() which could be factored out into a separate
function.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply

* Re: [PATCH v4] can: Add driver for esd CAN-USB/2 device
From: Wolfgang Grandegger @ 2010-07-31 19:27 UTC (permalink / raw)
  To: Matthias Fuchs
  Cc: Socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <201007271542.40997.matthias.fuchs-iOnpLzIbIdM@public.gmane.org>

On 07/27/2010 03:42 PM, Matthias Fuchs wrote:
> This patch adds a driver for esd's USB high speed
> CAN interface. The driver supports devices with
> multiple CAN interfaces.
> 
> Signed-off-by: Matthias Fuchs <matthias.fuchs-iOnpLzIbIdM@public.gmane.org>

Acked-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>

Thanks for your contribution.

Wolfgang,

^ permalink raw reply

* Re: [PATCH staging] Add SBE 2T3E3 WAN driver
From: Greg KH @ 2010-07-31 19:53 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: netdev
In-Reply-To: <m3ocdoasen.fsf@intrepid.localdomain>

On Sat, Jul 31, 2010 at 11:53:52AM +0200, Krzysztof Halasa wrote:
> This is a driver for SBE Inc.'s dual port T3/E3 WAN cards. Based on
> their original GPLed driver.
> It needs at least a new generic HDLC setup code (not yet written) before
> moving to drivers/net/wan.
> 
> Signed-off-by: Krzysztof Ha??asa <khc@pm.waw.pl>
> 
> ---
> I have generated the patch against v2.6.35-rc6. Compiles cleanly.
> Please let me know if it needs extra changes for e.g. staging tree.
> Thanks.
> 
>  drivers/staging/Kconfig              |    2 +
>  drivers/staging/Makefile             |    1 +
>  drivers/staging/sbe-2t3e3/2t3e3.h    |  896 ++++++++++++++++++++++++++++++++++
>  drivers/staging/sbe-2t3e3/Kconfig    |   13 +
>  drivers/staging/sbe-2t3e3/Makefile   |    4 +
>  drivers/staging/sbe-2t3e3/cpld.c     |  366 ++++++++++++++
>  drivers/staging/sbe-2t3e3/ctrl.c     |  363 ++++++++++++++
>  drivers/staging/sbe-2t3e3/ctrl.h     |  131 +++++
>  drivers/staging/sbe-2t3e3/dc.c       |  507 +++++++++++++++++++
>  drivers/staging/sbe-2t3e3/exar7250.c |  217 ++++++++
>  drivers/staging/sbe-2t3e3/exar7300.c |  182 +++++++
>  drivers/staging/sbe-2t3e3/intr.c     |  651 ++++++++++++++++++++++++
>  drivers/staging/sbe-2t3e3/io.c       |  352 +++++++++++++
>  drivers/staging/sbe-2t3e3/main.c     |  171 +++++++
>  drivers/staging/sbe-2t3e3/maps.c     |  104 ++++
>  drivers/staging/sbe-2t3e3/module.c   |  210 ++++++++
>  drivers/staging/sbe-2t3e3/netdev.c   |  142 ++++++
>  include/linux/pci_ids.h              |    3 +

First off, read the top of the pci_ids.h file, which says to not add new
entries that are only used in a single driver.

Secondly, why have this as a staging driver?  What is lacking in it to
get it merged into the main kernel tree as a "normal" driver?  Hint, you
need a TODO file in the driver directory that lists the things left to
be done to it to get it merged, and a name/email address to send the
patches to.

> +++ b/drivers/staging/sbe-2t3e3/2t3e3.h
> @@ -0,0 +1,896 @@
> +/*
> + * SBE 2T3E3 synchronous serial card driver for Linux
> + *
> + * Copyright (C) 2009-2010 Krzysztof Halasa <khc@pm.waw.pl>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of version 2 of the GNU General Public License
> + * as published by the Free Software Foundation.
> + *
> + * This code is based on a driver written by SBE Inc.

What driver would that have been?  If it's based on someone else's work,
it's nice to mention the copyright holders of that work you based yours
on.

> + */
> +
> +#ifndef T3E3_H
> +#define T3E3_H
> +
> +#include <linux/hdlc.h>
> +#include <linux/interrupt.h>
> +#include <linux/netdevice.h>
> +#include <linux/pci.h>
> +#include <linux/io.h>
> +#include "ctrl.h"
> +
> +#define DRV_NAME "SBE 2T3E3"

spaces and all caps isn't the nicest thing for linux drivers, it does
odd things in sysfs for some scripts (the space thing, not the
uppercase.)


thanks,

greg k-h

^ permalink raw reply

* Re: iw reg set does not work because udev and crda do not respond to boot-time request.
From: Luis R. Rodriguez @ 2010-07-31 21:05 UTC (permalink / raw)
  To: Daniel Haid; +Cc: linux-wireless, linux-kernel, netdev, Kay Sievers
In-Reply-To: <201007311448.06959.d.haid@gogi.tv>

Netlink / udev folks, please review.

On Sat, Jul 31, 2010 at 5:48 AM, Daniel Haid <d.haid@gogi.tv> wrote:
> Hello,
>
> the driver of my wireless card seems to ask for "US"
> regulatory data during boot, but since udev is not
> running at that point (I think not even the root filesystem
> is mounted) crda does not respond.

CRDA is not the only thing called by the kernel where there would be
an issue due to a delay with udev during bootup to react to a message.
The kernel calls CRDA for udev through kobject_uevent_env(). Uevent
messages are now broadcasted through
netlinknetlink_broadcast_filtered() since the old method of using a
direct call to /sbin/hotplug would lead to many processes being
spawned and in some cases OOM. You can still use this though through
CONFIG_UEVENT_HELPER_PATH which will issue call_usermodehelper()
during early boot on an initramfs for example, if you so need it.

I am not sure though if netlink broadcast messages would be reissued
by the kernel during early boot if no one replied back to the send
message but it is worth looking into. As far as I can tell you would
be the first to notice this. In fact we actually had reports of two
consecutive messages being being sent to userspace when only one was
being sent to userspace so it may indeed be in fact true that messages
are rebroadcasted somehow, I am just not sure so Cc'ing netdev and
lkml.

> The effect is that "iw reg set" does not work, because
> the kernel seems to be still waiting for the "US"
> regulatory data. Running
> COUNTRY="US" crda
> manually once fixes the problem (until the next reboot).

iw reg set will be ignored by net/wireless/reg.c as it is still
waiting for last_request to be processed. It seems in your case the
assumption that the request will be reissued in case udev is running
at early boot is incorrect and we need to further understand exactly
how these messages get queued and perhaps reissued or not.

I considered recently changing the way we handle requests to userspace
to use a completion handler but that would sit idle there for a while
blocking on the reg_mutex... so decided against it. But could take a
look again.

> What is the correct way of solving this? Should udev not
> pick up the request later when it is started?

We need a better understanding of how netlink broadcast messages get
processed during early boot. Right now cfg80211 will drop duplicate
requests or any request while we're still pending for the last one.
Once we find out more details about how netlink broadcast messages get
processed during early boot we can then rework things a bit. In the
meantime can you try using CONFIG_UEVENT_HELPER_PATH during the
initramfs?

  Luis

^ permalink raw reply

* Re: [PATCH staging] Add SBE 2T3E3 WAN driver
From: Krzysztof Halasa @ 2010-07-31 21:31 UTC (permalink / raw)
  To: Greg KH; +Cc: netdev
In-Reply-To: <20100731195335.GB4644@kroah.com>

Greg KH <greg@kroah.com> writes:

>>  include/linux/pci_ids.h              |    3 +
>
> First off, read the top of the pci_ids.h file, which says to not add new
> entries that are only used in a single driver.

These entries are also needed for the tulip Ethernet driver, to avoid
initializing these ports (they are using Tulip DECchips with custom FPGA
for HDLC). I posted a patch on netdev list.

> Secondly, why have this as a staging driver?  What is lacking in it to
> get it merged into the main kernel tree as a "normal" driver?

The main reason is the interface ("PRIVATE" netdev ioctls) for
controlling the hdlcX devices is not stable. The plan is to write a new
user-kernel interface for generic HDLC, this driver (and other ones)
will then use it. For now, there is a separate utility from SBE for this
card.

> Hint, you
> need a TODO file in the driver directory that lists the things left to
> be done to it to get it merged, and a name/email address to send the
> patches to.

Ok.

>> + * This code is based on a driver written by SBE Inc.
>
> What driver would that have been?  If it's based on someone else's work,
> it's nice to mention the copyright holders of that work you based yours
> on.

I don't have any details, I'm only told the driver is open-source and
the file name starts with SBE. No copyright notices except this one:

$ grep LIC *
linux_sbe2t3e3.c:MODULE_LICENSE("GPL");

BTW SBE Inc. (division?) has been acquired by One Stop Systems, they
seem to still sell this hw, but I can't see any drivers available for
downloading (though they mention "open source Linux drivers").

>> +#define DRV_NAME "SBE 2T3E3"
>
> spaces and all caps isn't the nicest thing for linux drivers, it does
> odd things in sysfs for some scripts (the space thing, not the
> uppercase.)

It seems the DRV_NAME is only used for various printk() and for
pci_request_regions(). Does it still cause problems?
-- 
Krzysztof Halasa

^ permalink raw reply

* shape traffic on tun interfaces
From: Franchoze Eric @ 2010-07-31 22:09 UTC (permalink / raw)
  To: lartc; +Cc: netdev

Do we have any interface to shape traffic per destination IP? The standrad HTB shapes it per device, which is not suitable for case if limitation required per destination IP. For example openvpn server which servers about 3000 clients and has 10 internal tun interfases (tun0-tun9). Of course it is possible to do it on application level (vpn), but I would prefer any system solution for this.  iptables with --limit does not work in this case because it will simple drop packets. Did somebody work on such task?

Eric.

^ permalink raw reply

* Re: [PATCH staging] Add SBE 2T3E3 WAN driver
From: Greg KH @ 2010-08-01  0:27 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: netdev
In-Reply-To: <m362zv5oet.fsf@intrepid.localdomain>

On Sat, Jul 31, 2010 at 11:31:22PM +0200, Krzysztof Halasa wrote:
> Greg KH <greg@kroah.com> writes:
> 
> >>  include/linux/pci_ids.h              |    3 +
> >
> > First off, read the top of the pci_ids.h file, which says to not add new
> > entries that are only used in a single driver.
> 
> These entries are also needed for the tulip Ethernet driver, to avoid
> initializing these ports (they are using Tulip DECchips with custom FPGA
> for HDLC). I posted a patch on netdev list.

Then make the patch part of that submission, I can't add non-staging
patches to the drivers/staging/ tree if at all possible.

> > Secondly, why have this as a staging driver?  What is lacking in it to
> > get it merged into the main kernel tree as a "normal" driver?
> 
> The main reason is the interface ("PRIVATE" netdev ioctls) for
> controlling the hdlcX devices is not stable. The plan is to write a new
> user-kernel interface for generic HDLC, this driver (and other ones)
> will then use it. For now, there is a separate utility from SBE for this
> card.

Ah, ick.  Is this going to be fixed up anytime soon?

> > Hint, you
> > need a TODO file in the driver directory that lists the things left to
> > be done to it to get it merged, and a name/email address to send the
> > patches to.
> 
> Ok.

Care to respin this with the TODO file?`

> >> + * This code is based on a driver written by SBE Inc.
> >
> > What driver would that have been?  If it's based on someone else's work,
> > it's nice to mention the copyright holders of that work you based yours
> > on.
> 
> I don't have any details, I'm only told the driver is open-source and
> the file name starts with SBE. No copyright notices except this one:
> 
> $ grep LIC *
> linux_sbe2t3e3.c:MODULE_LICENSE("GPL");

Wait, you wrote this driver, yet you don't have any details about the
driver you based it on?  That makes absolutely no sense.  Please
clarify.

And look, you do have a copy of the file, right there.  Care to post it
somewhere?  We need to see the license and other markings on it to know
about this driver, right?  Where did you get it from?

> BTW SBE Inc. (division?) has been acquired by One Stop Systems, they
> seem to still sell this hw, but I can't see any drivers available for
> downloading (though they mention "open source Linux drivers").

Any links would be appreciated.

> >> +#define DRV_NAME "SBE 2T3E3"
> >
> > spaces and all caps isn't the nicest thing for linux drivers, it does
> > odd things in sysfs for some scripts (the space thing, not the
> > uppercase.)
> 
> It seems the DRV_NAME is only used for various printk() and for
> pci_request_regions(). Does it still cause problems?

It's not nice, hopefully you can fix it up.  Well, remove it entirely
would be good, but you can add that to the TODO file :)

thanks,

greg k-h

^ permalink raw reply

* Re: [REGRESSION] e1000e stopped working [MANUALLY BISECTED]
From: Jeff Kirsher @ 2010-08-01  2:08 UTC (permalink / raw)
  To: Maxim Levitsky
  Cc: Tantilov, Emil S, netdev@vger.kernel.org, Allan, Bruce W,
	Pieper, Jeffrey E
In-Reply-To: <AANLkTinSOUcAxnqCo9YVVonhZ4sdC8iUK4r6F1+ayKef@mail.gmail.com>

On Wed, Jul 28, 2010 at 18:10, Jeff Kirsher <jeffrey.t.kirsher@intel.com> wrote:
> On Wed, Jul 28, 2010 at 00:04, Maxim Levitsky <maximlevitsky@gmail.com> wrote:
>> On Mon, 2010-07-26 at 03:25 +0300, Maxim Levitsky wrote:
>>>
>>> This commit, present in net-next, solves the problem:
>>>
>>> commit 1286950690f0f82ffa504e1e149ee3fdb4c51478
>>> Author: Bruce Allan <bruce.w.allan@intel.com>
>>> Date:   Mon Jul 26 03:19:38 2010 +0300
>>>
>>>     e1000e: cleanup e1000_sw_lcd_config_ich8lan()
>>>
>>>     Do not acquire and release the PHY unnecessarily for parts that return
>>>     from this workaround without actually accessing the PHY registers.
>>>
>>>     Signed-off-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>
>>>     Signed-off-by: David S. Miller <davem@davemloft.net>
>>>
>>>
>>>
>>>
>>> Also, the above patch is part of whole series of patches with scary descriptions (that is these fix bugs).
>>> If I were you I would send them to Linus for 2.6.35 inclusion too.
>>>
>>> Best regards,
>>>       Maxim Levitsky
>>>
>>>
>>>
>> ping
>>
>
> Sorry for the delayed response.  I am working on the issue.  Here is
> the problem I am having, the patch that fixes the issue you are seeing
> is fairly large and is a cleanup to the ich8 function, which as it
> stands now, would not be accepted into net-2.6 tree this late into the
> -rc cycle.  So, what I looking at is, what specifically fixed the
> issue you are seeing that resides in that patch, and come up with a
> smaller (acceptable) patch that I can submit to net-2.6 now to resolve
> your issue.
>
> I have dedicated most of this evening to finding a resolution to your
> issue that will be acceptable for the net-2.6 tree.  As you noted,
> there were several patches before this particular commit that may play
> some part in the resolution as well, and that is what I will be
> looking into.  I greatly appreciate the hard work you have done to
> help us resolve this issue, and will make sure you get credit for any
> solution I put together to resolve this issue.
>
> --
> Cheers,
> Jeff
>

To keep everyone informed...

We have found the root cause for this issue with the help of Maxim,
and will have a patch to fix the issue in the next couple of days.

-- 
Cheers,
Jeff

^ permalink raw reply

* Re: [PATCH] netem: fix installs of dist files
From: Stephen Hemminger @ 2010-08-01  2:33 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: stephen.hemminger, netdev
In-Reply-To: <1276131129-18079-1-git-send-email-vapier@gentoo.org>

On Wed,  9 Jun 2010 20:52:09 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> The tc program searches LIBDIR by default for the .dist files, and that
> defaults to /usr/lib.  But the netem subdir has /lib/ hardcoded which
> means the default build+install results in the files not being found.
> 
> Further, these are plain text files which are read at runtime, so it
> doesn't make sense to give them executable bits.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  netem/Makefile |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/netem/Makefile b/netem/Makefile
> index b6ccfc6..e52e125 100644
> --- a/netem/Makefile
> +++ b/netem/Makefile
> @@ -20,9 +20,9 @@ stats: stats.c
>  	$(HOSTCC) $(CCOPTS) -I../include -o $@ $@.c -lm
>  
>  install: all
> -	mkdir -p $(DESTDIR)/lib/tc
> +	mkdir -p $(DESTDIR)$(LIBDIR)/tc
>  	for i in $(DISTDATA); \
> -	do install -m 755 $$i $(DESTDIR)/lib/tc; \
> +	do install -m 644 $$i $(DESTDIR)$(LIBDIR)/tc; \
>  	done
>  
>  clean:


Applied

^ permalink raw reply

* Re: ss -p is much too slow
From: Stephen Hemminger @ 2010-08-01  2:33 UTC (permalink / raw)
  To: David Miller; +Cc: sphink, netdev, stephen.hemminger
In-Reply-To: <20100628.162139.59679342.davem@davemloft.net>

On Mon, 28 Jun 2010 16:21:39 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Steve Fink <sphink@gmail.com>
> Date: Wed, 9 Jun 2010 11:42:38 -0700
> 
> > On closer inspection, it appears that ss -p does a quadratic scan. It
> > rescans every entry in /proc/*/fd/* repeatedly (once per listening
> > port? per process? I don't remember what I figured out.)
> > 
> > I humbly suggest that this is not a good idea.
> 
> Yep, this is junk.  Please give this patch a try:
> 
> ss: Avoid quadradic complexity with '-p'
> 
> Scan the process list of open sockets once, and store in a hash
> table to be used by subsequent find_user() calls.
> 
> Reported-by: Steve Fink <sphink@gmail.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>

Applied


-- 

^ permalink raw reply

* Re: [PATCH] act_nat: fix wild pointer
From: David Miller @ 2010-08-01  5:05 UTC (permalink / raw)
  To: herbert; +Cc: xiaosuo, hadi, netdev
In-Reply-To: <20100730071838.GA7256@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Fri, 30 Jul 2010 15:18:38 +0800

> On Fri, Jul 30, 2010 at 07:41:46AM +0800, Changli Gao wrote:
>> pskb_may_pull() may change skb pointers, so adjust icmph after pskb_may_pull().
>> 
>> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> 
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.

^ permalink raw reply

* Re: [PATCH] act_nat: the checksum of ICMP doesn't have pseudo header
From: David Miller @ 2010-08-01  5:05 UTC (permalink / raw)
  To: herbert; +Cc: xiaosuo, hadi, netdev, linux-kernel, kaber
In-Reply-To: <20100730143016.GA10543@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Fri, 30 Jul 2010 22:30:16 +0800

> On Fri, Jul 30, 2010 at 10:16:05PM +0800, Changli Gao wrote:
>> 
>> I know we need to update the ICMP checksum if we alter the payload(the
>> inner IP header here) of ICMP. But I doubt if the update is really
>> necessary if the checksum is partial, as the   checksum will be done
>> later(by ether skb_checksum_help() or NIC hardware). In fact, as there
>> isn't any pseudo header, the icmph->checksum should be always ZERO,
>> otherwise skb_checksum_help() or NIC will give the wrong checksums,
>> when the checksum is partial.
> 
> Actually you are right.  I suppose the only reason this has never
> shown up is because CHEKSUM_PARTIAL doesn't usually occur with
> forwarded packets.
> 
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Also applied, thanks.

^ permalink raw reply

* [PATCH] ip_fragment: fix subtracting PPPOE_SES_HLEN from mtu twice
From: Changli Gao @ 2010-07-31 23:25 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: David S. Miller, Bart De Schuymer, netdev, Changli Gao

6c79bf0f2440fd250c8fce8d9b82fcf03d4e8350 subtracts PPPOE_SES_HLEN from mtu at
the front of ip_fragment(). So the later subtraction should be removed. The
MTU of 802.1q is also 1500, so MTU should not be changed.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 net/ipv4/ip_output.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 6652bd9..04b6989 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -446,7 +446,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
 	int ptr;
 	struct net_device *dev;
 	struct sk_buff *skb2;
-	unsigned int mtu, hlen, left, len, ll_rs, pad;
+	unsigned int mtu, hlen, left, len, ll_rs;
 	int offset;
 	__be16 not_last_frag;
 	struct rtable *rt = skb_rtable(skb);
@@ -585,9 +585,7 @@ slow_path:
 	/* for bridged IP traffic encapsulated inside f.e. a vlan header,
 	 * we need to make room for the encapsulating header
 	 */
-	pad = nf_bridge_pad(skb);
-	ll_rs = LL_RESERVED_SPACE_EXTRA(rt->dst.dev, pad);
-	mtu -= pad;
+	ll_rs = LL_RESERVED_SPACE_EXTRA(rt->dst.dev, nf_bridge_pad(skb));
 
 	/*
 	 *	Fragment the datagram.

^ permalink raw reply related

* Re: [PATCH] net/rose: Use GFP_ATOMIC
From: David Miller @ 2010-08-01  7:32 UTC (permalink / raw)
  To: julia; +Cc: ralf, linux-hams, linux-kernel, netdev, kernel-janitors
In-Reply-To: <Pine.LNX.4.64.1007311156180.6434@ask.diku.dk>

From: Julia Lawall <julia@diku.dk>
Date: Sat, 31 Jul 2010 11:56:39 +0200 (CEST)

> The other calls to kmalloc in the same function use GFP_ATOMIC, and indeed
> two locks are held within the body of the function.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
 ...
> Signed-off-by: Julia Lawall <julia@diku.dk>

Applied, thank you!

^ permalink raw reply

* Re: [PATCH] net: ingress filter message limit
From: David Miller @ 2010-08-01  7:33 UTC (permalink / raw)
  To: shemminger; +Cc: hadi, netdev
In-Reply-To: <20100731121316.1adb52c0@nehalam>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Sat, 31 Jul 2010 12:13:16 -0700

> If user misconfigures ingress and causes a redirection loop, don't
> overwhelm the log.  This is also a error case so make it unlikely.
> Found by inspection, luckily not in real system.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied, thanks Stephen.

^ permalink raw reply

* Re: [PATCH] Multiqueue macvtap driver
From: David Miller @ 2010-08-01  7:34 UTC (permalink / raw)
  To: bhutchings; +Cc: krkumar2, arnd, netdev, mst
In-Reply-To: <1280603907.13192.353.camel@localhost>

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Sat, 31 Jul 2010 20:18:27 +0100

> On Sat, 2010-07-31 at 19:27 +0530, Krishna Kumar wrote:
> [...]
>> @@ -136,39 +158,68 @@ static void macvtap_put_queue(struct mac
>>  }
>>  
>>  /*
>> - * Since we only support one queue, just dereference the pointer.
>> + * Select a queue based on the rxq of the device on which this packet
>> + * arrived. If the incoming device is not mq, then use our cpu number
>> + * to select a queue. vlan->numvtaps is cached in case it changes
>> + * during the execution of this function.
>>   */
> [...]
> 
> This can result in reordering if a single-queue device's RX interrupt's
> CPU affinity is changed.  We generally try to avoid that.  You should
> really use or generate a flow hash.  There is code for this in
> net/core/dev.c:get_rps_cpu() which could be factored out into a separate
> function.

Agreed.

^ permalink raw reply

* Re: [PATCH] can-raw: Fix skb_orphan_try handling
From: David Miller @ 2010-08-01  8:03 UTC (permalink / raw)
  To: socketcan
  Cc: eric.dumazet, patrick.ohly, netdev, socketcan-core,
	matthias.fuchs
In-Reply-To: <4C529EFB.4090601@hartkopp.net>

From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: Fri, 30 Jul 2010 11:44:27 +0200

> Hello Eric, hello Patrick,
> 
> Commit fc6055a5ba31e2c14e36e8939f9bf2b6d586a7f5 (net: Introduce
> skb_orphan_try()) allows an early orphan of the skb and takes care on
> tx timestamping, which needs the sk-reference in the skb on driver level.
> So does the can-raw socket, which has not been taken into account here.
> 
> The patch below adds a 'prevent_sk_orphan' bit in the skb tx shared info,
> which fixes the problem discovered by Matthias Fuchs here:
> 
>       http://marc.info/?t=128030411900003&r=1&w=2

Your patch sets this new value, but I never see it getting tested anywhere.

How does this work?

^ permalink raw reply

* Re: [RFC PATCH 2/2] igb/ixgbe: add code to trigger function reset if reset_devices is set
From: David Miller @ 2010-08-01  8:15 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: jbarnes, netdev, linux-pci, alexander.h.duyck
In-Reply-To: <20100731005910.32625.89518.stgit@localhost.localdomain>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 30 Jul 2010 17:59:12 -0700

> From: Alexander Duyck <alexander.h.duyck@intel.com>
> 
> This change makes it so that both igb and ixgbe can trigger a full pcie
> function reset if the reset_devices kernel parameter is defined.  The main
> reason for adding this is that kdump can cause serious issues when the
> kdump kernel resets the IOMMU while DMA transactions are still occurring.
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

I tend to disagree with the essence of this change.

Which is that we should add workaround after workaround for things
that aren't functioning properly in kdump and kexec.

They should have a pass that shuts devices down properly, so that this
kind of stuff doesn't need to happen in the kernel we then boot into.

What happens on non-PCIE systems then?  Do they just lose when this
happens?

No, you dun goof'd.  :-) Find another way to fix this please.

Thanks.

^ 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