Netdev List
 help / color / mirror / Atom feed
* Re: net/wanrouter?
From: Stephen Hemminger @ 2012-05-24 16:13 UTC (permalink / raw)
  To: Jan Ceuleers; +Cc: Joe Perches, netdev
In-Reply-To: <4FBE3CFC.6070103@computer.org>

On Thu, 24 May 2012 15:51:56 +0200
Jan Ceuleers <jan.ceuleers@computer.org> wrote:

> On 05/22/2012 07:33 PM, Joe Perches wrote:
> > Does anyone still use this?
> 
> I have the hardware (a Sangoma ADSL PCI card) but am no longer using it.
> Also, as I remember, Sangoma stopped contributing to the upstream driver
> many years ago while still actively developing the out-of-tree version.

The wanrouter code hasn't supported Sangoma hardware for a long time,
it got removed early in 2.6.

There are a bunch of old T1 and T3 cards there but I doubt any of them
are still for sale. But somebody is probably still using them.

^ permalink raw reply

* Re: [PATCH] gianfar:don't add FCB length to hard_header_len
From: Joe Perches @ 2012-05-24 16:16 UTC (permalink / raw)
  To: Jan Ceuleers; +Cc: David Miller, b06378, netdev, linuxppc-dev
In-Reply-To: <4FBE4E02.1070306@computer.org>

On Thu, 2012-05-24 at 17:04 +0200, Jan Ceuleers wrote:
> On 05/22/2012 09:18 PM, David Miller wrote:
> > From: Jiajun Wu <b06378@freescale.com>
> > Date: Tue, 22 May 2012 17:00:48 +0800
> > 
> >> FCB(Frame Control Block) isn't the part of netdev hard header.
> >> Add FCB to hard_header_len will make GRO fail at MAC comparision stage.
> >>
> >> Signed-off-by: Jiajun Wu <b06378@freescale.com>
> > 
> > Applied, thanks.
> > 
> > Someone needs to go through this driver when net-next opens up
> > and fix all of the indentation in this driver.
> 
> May I give that a go?

I have scripts that automate most of this.
I don't have the card though.

Maybe this is a starting point?
It doesn't fix most 80 column warnings.

 drivers/net/ethernet/freescale/gianfar.c         |  299 +++++++++++-----------
 drivers/net/ethernet/freescale/gianfar_ethtool.c |  131 +++++-----
 drivers/net/ethernet/freescale/gianfar_ptp.c     |    8 +-
 drivers/net/ethernet/freescale/gianfar_sysfs.c   |    2 +-
 4 files changed, 225 insertions(+), 215 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 1adb024..b1985aa 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -87,10 +87,10 @@
 #include <linux/in.h>
 #include <linux/net_tstamp.h>
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/reg.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/dma-mapping.h>
 #include <linux/crc32.h>
@@ -114,7 +114,7 @@ static void gfar_timeout(struct net_device *dev);
 static int gfar_close(struct net_device *dev);
 struct sk_buff *gfar_new_skb(struct net_device *dev);
 static void gfar_new_rxbdp(struct gfar_priv_rx_q *rx_queue, struct rxbd8 *bdp,
-		struct sk_buff *skb);
+			   struct sk_buff *skb);
 static int gfar_set_mac_address(struct net_device *dev);
 static int gfar_change_mtu(struct net_device *dev, int new_mtu);
 static irqreturn_t gfar_error(int irq, void *dev_id);
@@ -251,9 +251,9 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
 
 	/* Allocate memory for the buffer descriptors */
 	vaddr = dma_alloc_coherent(dev,
-			sizeof(struct txbd8) * priv->total_tx_ring_size +
-			sizeof(struct rxbd8) * priv->total_rx_ring_size,
-			&addr, GFP_KERNEL);
+				   sizeof(struct txbd8) * priv->total_tx_ring_size +
+				   sizeof(struct rxbd8) * priv->total_rx_ring_size,
+				   &addr, GFP_KERNEL);
 	if (!vaddr) {
 		netif_err(priv, ifup, ndev,
 			  "Could not allocate buffer descriptors!\n");
@@ -266,8 +266,8 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
 		tx_queue->tx_bd_dma_base = addr;
 		tx_queue->dev = ndev;
 		/* enet DMA only understands physical addresses */
-		addr    += sizeof(struct txbd8) *tx_queue->tx_ring_size;
-		vaddr   += sizeof(struct txbd8) *tx_queue->tx_ring_size;
+		addr    += sizeof(struct txbd8) * tx_queue->tx_ring_size;
+		vaddr   += sizeof(struct txbd8) * tx_queue->tx_ring_size;
 	}
 
 	/* Start the rx descriptor ring where the tx ring leaves off */
@@ -276,15 +276,16 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
 		rx_queue->rx_bd_base = vaddr;
 		rx_queue->rx_bd_dma_base = addr;
 		rx_queue->dev = ndev;
-		addr    += sizeof (struct rxbd8) * rx_queue->rx_ring_size;
-		vaddr   += sizeof (struct rxbd8) * rx_queue->rx_ring_size;
+		addr    += sizeof(struct rxbd8) * rx_queue->rx_ring_size;
+		vaddr   += sizeof(struct rxbd8) * rx_queue->rx_ring_size;
 	}
 
 	/* Setup the skbuff rings */
 	for (i = 0; i < priv->num_tx_queues; i++) {
 		tx_queue = priv->tx_queue[i];
 		tx_queue->tx_skbuff = kmalloc(sizeof(*tx_queue->tx_skbuff) *
-				  tx_queue->tx_ring_size, GFP_KERNEL);
+					      tx_queue->tx_ring_size,
+					      GFP_KERNEL);
 		if (!tx_queue->tx_skbuff) {
 			netif_err(priv, ifup, ndev,
 				  "Could not allocate tx_skbuff\n");
@@ -298,7 +299,8 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
 	for (i = 0; i < priv->num_rx_queues; i++) {
 		rx_queue = priv->rx_queue[i];
 		rx_queue->rx_skbuff = kmalloc(sizeof(*rx_queue->rx_skbuff) *
-				  rx_queue->rx_ring_size, GFP_KERNEL);
+					      rx_queue->rx_ring_size,
+					      GFP_KERNEL);
 
 		if (!rx_queue->rx_skbuff) {
 			netif_err(priv, ifup, ndev,
@@ -327,13 +329,13 @@ static void gfar_init_tx_rx_base(struct gfar_private *priv)
 	int i;
 
 	baddr = &regs->tbase0;
-	for(i = 0; i < priv->num_tx_queues; i++) {
+	for (i = 0; i < priv->num_tx_queues; i++) {
 		gfar_write(baddr, priv->tx_queue[i]->tx_bd_dma_base);
 		baddr	+= 2;
 	}
 
 	baddr = &regs->rbase0;
-	for(i = 0; i < priv->num_rx_queues; i++) {
+	for (i = 0; i < priv->num_rx_queues; i++) {
 		gfar_write(baddr, priv->rx_queue[i]->rx_bd_dma_base);
 		baddr   += 2;
 	}
@@ -501,7 +503,7 @@ void unlock_tx_qs(struct gfar_private *priv)
 static bool gfar_is_vlan_on(struct gfar_private *priv)
 {
 	return (priv->ndev->features & NETIF_F_HW_VLAN_RX) ||
-	       (priv->ndev->features & NETIF_F_HW_VLAN_TX);
+		(priv->ndev->features & NETIF_F_HW_VLAN_TX);
 }
 
 /* Returns 1 if incoming frames use an FCB */
@@ -554,7 +556,7 @@ static void enable_napi(struct gfar_private *priv)
 }
 
 static int gfar_parse_group(struct device_node *np,
-		struct gfar_private *priv, const char *model)
+			    struct gfar_private *priv, const char *model)
 {
 	u32 *queue_mask;
 
@@ -563,14 +565,14 @@ static int gfar_parse_group(struct device_node *np,
 		return -ENOMEM;
 
 	priv->gfargrp[priv->num_grps].interruptTransmit =
-			irq_of_parse_and_map(np, 0);
+		irq_of_parse_and_map(np, 0);
 
 	/* If we aren't the FEC we have multiple interrupts */
 	if (model && strcasecmp(model, "FEC")) {
 		priv->gfargrp[priv->num_grps].interruptReceive =
 			irq_of_parse_and_map(np, 1);
 		priv->gfargrp[priv->num_grps].interruptError =
-			irq_of_parse_and_map(np,2);
+			irq_of_parse_and_map(np, 2);
 		if (priv->gfargrp[priv->num_grps].interruptTransmit == NO_IRQ ||
 		    priv->gfargrp[priv->num_grps].interruptReceive  == NO_IRQ ||
 		    priv->gfargrp[priv->num_grps].interruptError    == NO_IRQ)
@@ -580,15 +582,15 @@ static int gfar_parse_group(struct device_node *np,
 	priv->gfargrp[priv->num_grps].grp_id = priv->num_grps;
 	priv->gfargrp[priv->num_grps].priv = priv;
 	spin_lock_init(&priv->gfargrp[priv->num_grps].grplock);
-	if(priv->mode == MQ_MG_MODE) {
-		queue_mask = (u32 *)of_get_property(np,
-					"fsl,rx-bit-map", NULL);
+	if (priv->mode == MQ_MG_MODE) {
+		queue_mask = (u32 *)of_get_property(np, "fsl,rx-bit-map", NULL);
 		priv->gfargrp[priv->num_grps].rx_bit_map =
-			queue_mask ?  *queue_mask :(DEFAULT_MAPPING >> priv->num_grps);
-		queue_mask = (u32 *)of_get_property(np,
-					"fsl,tx-bit-map", NULL);
+			queue_mask ? *queue_mask
+				   : (DEFAULT_MAPPING >> priv->num_grps);
+		queue_mask = (u32 *)of_get_property(np, "fsl,tx-bit-map", NULL);
 		priv->gfargrp[priv->num_grps].tx_bit_map =
-			queue_mask ? *queue_mask : (DEFAULT_MAPPING >> priv->num_grps);
+			queue_mask ? *queue_mask
+				   : (DEFAULT_MAPPING >> priv->num_grps);
 	} else {
 		priv->gfargrp[priv->num_grps].rx_bit_map = 0xFF;
 		priv->gfargrp[priv->num_grps].tx_bit_map = 0xFF;
@@ -673,12 +675,12 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 	} else {
 		priv->mode = SQ_SG_MODE;
 		err = gfar_parse_group(np, priv, model);
-		if(err)
+		if (err)
 			goto err_grp_init;
 	}
 
 	for (i = 0; i < priv->num_tx_queues; i++)
-	       priv->tx_queue[i] = NULL;
+		priv->tx_queue[i] = NULL;
 	for (i = 0; i < priv->num_rx_queues; i++)
 		priv->rx_queue[i] = NULL;
 
@@ -781,7 +783,7 @@ err_grp_init:
 }
 
 static int gfar_hwtstamp_ioctl(struct net_device *netdev,
-			struct ifreq *ifr, int cmd)
+			       struct ifreq *ifr, int cmd)
 {
 	struct hwtstamp_config config;
 	struct gfar_private *priv = netdev_priv(netdev);
@@ -936,22 +938,22 @@ static void gfar_detect_errata(struct gfar_private *priv)
 
 	/* MPC8313 Rev 2.0 and higher; All MPC837x */
 	if ((pvr == 0x80850010 && mod == 0x80b0 && rev >= 0x0020) ||
-			(pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
+	    (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
 		priv->errata |= GFAR_ERRATA_74;
 
 	/* MPC8313 and MPC837x all rev */
 	if ((pvr == 0x80850010 && mod == 0x80b0) ||
-			(pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
+	    (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
 		priv->errata |= GFAR_ERRATA_76;
 
 	/* MPC8313 and MPC837x all rev */
 	if ((pvr == 0x80850010 && mod == 0x80b0) ||
-			(pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
+	    (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
 		priv->errata |= GFAR_ERRATA_A002;
 
 	/* MPC8313 Rev < 2.0, MPC8548 rev 2.0 */
 	if ((pvr == 0x80850010 && mod == 0x80b0 && rev < 0x0020) ||
-			(pvr == 0x80210020 && mod == 0x8030 && rev == 0x0020))
+	    (pvr == 0x80210020 && mod == 0x8030 && rev == 0x0020))
 		priv->errata |= GFAR_ERRATA_12;
 
 	if (priv->errata)
@@ -1026,7 +1028,8 @@ static int gfar_probe(struct platform_device *ofdev)
 
 	/* Register for napi ...We are registering NAPI for each grp */
 	for (i = 0; i < priv->num_grps; i++)
-		netif_napi_add(dev, &priv->gfargrp[i].napi, gfar_poll, GFAR_DEV_WEIGHT);
+		netif_napi_add(dev, &priv->gfargrp[i].napi,
+			       gfar_poll, GFAR_DEV_WEIGHT);
 
 	if (priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) {
 		dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
@@ -1081,7 +1084,7 @@ static int gfar_probe(struct platform_device *ofdev)
 		priv->padding = 0;
 
 	if (dev->features & NETIF_F_IP_CSUM ||
-			priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
+	    priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
 		dev->hard_header_len += GMAC_FCB_LEN;
 
 	/* Program the isrg regs only if number of grps > 1 */
@@ -1099,11 +1102,11 @@ static int gfar_probe(struct platform_device *ofdev)
 	/* Need to reverse the bit maps as  bit_map's MSB is q0
 	 * but, for_each_set_bit parses from right to left, which
 	 * basically reverses the queue numbers */
-	for (i = 0; i< priv->num_grps; i++) {
+	for (i = 0; i < priv->num_grps; i++) {
 		priv->gfargrp[i].tx_bit_map = reverse_bitmap(
-				priv->gfargrp[i].tx_bit_map, MAX_TX_QS);
+			priv->gfargrp[i].tx_bit_map, MAX_TX_QS);
 		priv->gfargrp[i].rx_bit_map = reverse_bitmap(
-				priv->gfargrp[i].rx_bit_map, MAX_RX_QS);
+			priv->gfargrp[i].rx_bit_map, MAX_RX_QS);
 	}
 
 	/* Calculate RSTAT, TSTAT, RQUEUE and TQUEUE values,
@@ -1111,7 +1114,7 @@ static int gfar_probe(struct platform_device *ofdev)
 	for (grp_idx = 0; grp_idx < priv->num_grps; grp_idx++) {
 		priv->gfargrp[grp_idx].num_rx_queues = 0x0;
 		for_each_set_bit(i, &priv->gfargrp[grp_idx].rx_bit_map,
-				priv->num_rx_queues) {
+				 priv->num_rx_queues) {
 			priv->gfargrp[grp_idx].num_rx_queues++;
 			priv->rx_queue[i]->grp = &priv->gfargrp[grp_idx];
 			rstat = rstat | (RSTAT_CLEAR_RHALT >> i);
@@ -1119,7 +1122,7 @@ static int gfar_probe(struct platform_device *ofdev)
 		}
 		priv->gfargrp[grp_idx].num_tx_queues = 0x0;
 		for_each_set_bit(i, &priv->gfargrp[grp_idx].tx_bit_map,
-				priv->num_tx_queues) {
+				 priv->num_tx_queues) {
 			priv->gfargrp[grp_idx].num_tx_queues++;
 			priv->tx_queue[i]->grp = &priv->gfargrp[grp_idx];
 			tstat = tstat | (TSTAT_CLEAR_THALT >> i);
@@ -1127,7 +1130,7 @@ static int gfar_probe(struct platform_device *ofdev)
 		}
 		priv->gfargrp[grp_idx].rstat = rstat;
 		priv->gfargrp[grp_idx].tstat = tstat;
-		rstat = tstat =0;
+		rstat = tstat = 0;
 	}
 
 	gfar_write(&regs->rqueue, rqueue);
@@ -1152,7 +1155,7 @@ static int gfar_probe(struct platform_device *ofdev)
 	/* always enable rx filer*/
 	priv->rx_filer_enable = 1;
 	/* Enable most messages by default */
-	priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;
+	priv->msg_enable = (NETIF_MSG_IFUP << 1) - 1;
 
 	/* Carrier starts down, phylib will bring it up */
 	netif_carrier_off(dev);
@@ -1165,7 +1168,7 @@ static int gfar_probe(struct platform_device *ofdev)
 	}
 
 	device_init_wakeup(&dev->dev,
-		priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
+			   priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
 
 	/* fill out IRQ number and name fields */
 	for (i = 0; i < priv->num_grps; i++) {
@@ -1176,8 +1179,9 @@ static int gfar_probe(struct platform_device *ofdev)
 				dev->name, "_g", '0' + i, "_rx");
 			sprintf(priv->gfargrp[i].int_name_er, "%s%s%c%s",
 				dev->name, "_g", '0' + i, "_er");
-		} else
+		} else {
 			strcpy(priv->gfargrp[i].int_name_tx, dev->name);
+		}
 	}
 
 	/* Initialize the filer table */
@@ -1195,7 +1199,7 @@ static int gfar_probe(struct platform_device *ofdev)
 	for (i = 0; i < priv->num_rx_queues; i++)
 		netdev_info(dev, "RX BD ring size for Q[%d]: %d\n",
 			    i, priv->rx_queue[i]->rx_ring_size);
-	for(i = 0; i < priv->num_tx_queues; i++)
+	for (i = 0; i < priv->num_tx_queues; i++)
 		netdev_info(dev, "TX BD ring size for Q[%d]: %d\n",
 			    i, priv->tx_queue[i]->tx_ring_size);
 
@@ -1355,7 +1359,7 @@ static int gfar_restore(struct device *dev)
 	return 0;
 }
 
-static struct dev_pm_ops gfar_pm_ops = {
+static const struct dev_pm_ops gfar_pm_ops = {
 	.suspend = gfar_suspend,
 	.resume = gfar_resume,
 	.freeze = gfar_suspend,
@@ -1393,9 +1397,9 @@ static phy_interface_t gfar_get_interface(struct net_device *dev)
 	}
 
 	if (ecntrl & ECNTRL_REDUCED_MODE) {
-		if (ecntrl & ECNTRL_REDUCED_MII_MODE)
+		if (ecntrl & ECNTRL_REDUCED_MII_MODE) {
 			return PHY_INTERFACE_MODE_RMII;
-		else {
+		} else {
 			phy_interface_t interface = priv->interface;
 
 			/*
@@ -1468,8 +1472,7 @@ static void gfar_configure_serdes(struct net_device *dev)
 	struct phy_device *tbiphy;
 
 	if (!priv->tbi_node) {
-		dev_warn(&dev->dev, "error: SGMII mode requires that the "
-				    "device tree specify a tbi-handle\n");
+		dev_warn(&dev->dev, "error: SGMII mode requires that the device tree specify a tbi-handle\n");
 		return;
 	}
 
@@ -1492,11 +1495,11 @@ static void gfar_configure_serdes(struct net_device *dev)
 	phy_write(tbiphy, MII_TBICON, TBICON_CLK_SELECT);
 
 	phy_write(tbiphy, MII_ADVERTISE,
-			ADVERTISE_1000XFULL | ADVERTISE_1000XPAUSE |
-			ADVERTISE_1000XPSE_ASYM);
+		  ADVERTISE_1000XFULL | ADVERTISE_1000XPAUSE |
+		  ADVERTISE_1000XPSE_ASYM);
 
 	phy_write(tbiphy, MII_BMCR, BMCR_ANENABLE |
-			BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000);
+		  BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000);
 }
 
 static void init_registers(struct net_device *dev)
@@ -1536,7 +1539,7 @@ static void init_registers(struct net_device *dev)
 
 	/* Zero out the rmon mib registers if it has them */
 	if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
-		memset_io(&(regs->rmon), 0, sizeof (struct rmon_mib));
+		memset_io(&(regs->rmon), 0, sizeof(struct rmon_mib));
 
 		/* Mask off the CAM interrupts */
 		gfar_write(&regs->rmon.cam1, 0xffffffff);
@@ -1602,8 +1605,9 @@ static void gfar_halt_nodisable(struct net_device *dev)
 		gfar_write(&regs->dmactrl, tempval);
 
 		do {
-			ret = spin_event_timeout(((gfar_read(&regs->ievent) &
-				 (IEVENT_GRSC | IEVENT_GTSC)) ==
+			ret = spin_event_timeout(
+				((gfar_read(&regs->ievent) &
+				  (IEVENT_GRSC | IEVENT_GTSC)) ==
 				 (IEVENT_GRSC | IEVENT_GTSC)), 1000000, 0);
 			if (!ret && !(gfar_read(&regs->ievent) & IEVENT_GRSC))
 				ret = __gfar_is_rx_idle(priv);
@@ -1660,7 +1664,7 @@ void stop_gfar(struct net_device *dev)
 	} else {
 		for (i = 0; i < priv->num_grps; i++)
 			free_irq(priv->gfargrp[i].interruptTransmit,
-					&priv->gfargrp[i]);
+				 &priv->gfargrp[i]);
 	}
 
 	free_skb_resources(priv);
@@ -1679,13 +1683,13 @@ static void free_skb_tx_queue(struct gfar_priv_tx_q *tx_queue)
 			continue;
 
 		dma_unmap_single(&priv->ofdev->dev, txbdp->bufPtr,
-				txbdp->length, DMA_TO_DEVICE);
+				 txbdp->length, DMA_TO_DEVICE);
 		txbdp->lstatus = 0;
 		for (j = 0; j < skb_shinfo(tx_queue->tx_skbuff[i])->nr_frags;
-				j++) {
+		     j++) {
 			txbdp++;
 			dma_unmap_page(&priv->ofdev->dev, txbdp->bufPtr,
-					txbdp->length, DMA_TO_DEVICE);
+				       txbdp->length, DMA_TO_DEVICE);
 		}
 		txbdp++;
 		dev_kfree_skb_any(tx_queue->tx_skbuff[i]);
@@ -1705,8 +1709,8 @@ static void free_skb_rx_queue(struct gfar_priv_rx_q *rx_queue)
 	for (i = 0; i < rx_queue->rx_ring_size; i++) {
 		if (rx_queue->rx_skbuff[i]) {
 			dma_unmap_single(&priv->ofdev->dev,
-					rxbdp->bufPtr, priv->rx_buffer_size,
-					DMA_FROM_DEVICE);
+					 rxbdp->bufPtr, priv->rx_buffer_size,
+					 DMA_FROM_DEVICE);
 			dev_kfree_skb_any(rx_queue->rx_skbuff[i]);
 			rx_queue->rx_skbuff[i] = NULL;
 		}
@@ -1730,22 +1734,22 @@ static void free_skb_resources(struct gfar_private *priv)
 		struct netdev_queue *txq;
 		tx_queue = priv->tx_queue[i];
 		txq = netdev_get_tx_queue(tx_queue->dev, tx_queue->qindex);
-		if(tx_queue->tx_skbuff)
+		if (tx_queue->tx_skbuff)
 			free_skb_tx_queue(tx_queue);
 		netdev_tx_reset_queue(txq);
 	}
 
 	for (i = 0; i < priv->num_rx_queues; i++) {
 		rx_queue = priv->rx_queue[i];
-		if(rx_queue->rx_skbuff)
+		if (rx_queue->rx_skbuff)
 			free_skb_rx_queue(rx_queue);
 	}
 
 	dma_free_coherent(&priv->ofdev->dev,
-			sizeof(struct txbd8) * priv->total_tx_ring_size +
-			sizeof(struct rxbd8) * priv->total_rx_ring_size,
-			priv->tx_queue[0]->tx_bd_base,
-			priv->tx_queue[0]->tx_bd_dma_base);
+			  sizeof(struct txbd8) * priv->total_tx_ring_size +
+			  sizeof(struct rxbd8) * priv->total_rx_ring_size,
+			  priv->tx_queue[0]->tx_bd_base,
+			  priv->tx_queue[0]->tx_bd_dma_base);
 	skb_queue_purge(&priv->rx_recycle);
 }
 
@@ -1784,7 +1788,7 @@ void gfar_start(struct net_device *dev)
 }
 
 void gfar_configure_coalescing(struct gfar_private *priv,
-	unsigned long tx_mask, unsigned long rx_mask)
+			       unsigned long tx_mask, unsigned long rx_mask)
 {
 	struct gfar __iomem *regs = priv->gfargrp[0].regs;
 	u32 __iomem *baddr;
@@ -1794,11 +1798,11 @@ void gfar_configure_coalescing(struct gfar_private *priv,
 	 * multiple queues, there's only single reg to program
 	 */
 	gfar_write(&regs->txic, 0);
-	if(likely(priv->tx_queue[0]->txcoalescing))
+	if (likely(priv->tx_queue[0]->txcoalescing))
 		gfar_write(&regs->txic, priv->tx_queue[0]->txic);
 
 	gfar_write(&regs->rxic, 0);
-	if(unlikely(priv->rx_queue[0]->rxcoalescing))
+	if (unlikely(priv->rx_queue[0]->rxcoalescing))
 		gfar_write(&regs->rxic, priv->rx_queue[0]->rxic);
 
 	if (priv->mode == MQ_MG_MODE) {
@@ -1831,30 +1835,34 @@ static int register_grp_irqs(struct gfar_priv_grp *grp)
 	if (priv->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
 		/* Install our interrupt handlers for Error,
 		 * Transmit, and Receive */
-		if ((err = request_irq(grp->interruptError, gfar_error, 0,
-				grp->int_name_er,grp)) < 0) {
+		err = request_irq(grp->interruptError, gfar_error, 0,
+				  grp->int_name_er, grp);
+		if (err < 0) {
 			netif_err(priv, intr, dev, "Can't get IRQ %d\n",
 				  grp->interruptError);
 
 			goto err_irq_fail;
 		}
 
-		if ((err = request_irq(grp->interruptTransmit, gfar_transmit,
-				0, grp->int_name_tx, grp)) < 0) {
+		err = request_irq(grp->interruptTransmit, gfar_transmit,
+				  0, grp->int_name_tx, grp);
+		if (err < 0) {
 			netif_err(priv, intr, dev, "Can't get IRQ %d\n",
 				  grp->interruptTransmit);
 			goto tx_irq_fail;
 		}
 
-		if ((err = request_irq(grp->interruptReceive, gfar_receive, 0,
-				grp->int_name_rx, grp)) < 0) {
+		err = request_irq(grp->interruptReceive, gfar_receive, 0,
+				  grp->int_name_rx, grp);
+		if (err < 0) {
 			netif_err(priv, intr, dev, "Can't get IRQ %d\n",
 				  grp->interruptReceive);
 			goto rx_irq_fail;
 		}
 	} else {
-		if ((err = request_irq(grp->interruptTransmit, gfar_interrupt, 0,
-				grp->int_name_tx, grp)) < 0) {
+		err = request_irq(grp->interruptTransmit, gfar_interrupt, 0,
+				  grp->int_name_tx, grp);
+		if (err < 0) {
 			netif_err(priv, intr, dev, "Can't get IRQ %d\n",
 				  grp->interruptTransmit);
 			goto err_irq_fail;
@@ -1880,11 +1888,11 @@ int startup_gfar(struct net_device *ndev)
 	int err, i, j;
 
 	for (i = 0; i < priv->num_grps; i++) {
-		regs= priv->gfargrp[i].regs;
+		regs = priv->gfargrp[i].regs;
 		gfar_write(&regs->imask, IMASK_INIT_CLEAR);
 	}
 
-	regs= priv->gfargrp[0].regs;
+	regs = priv->gfargrp[0].regs;
 	err = gfar_alloc_skb_resources(ndev);
 	if (err)
 		return err;
@@ -1960,7 +1968,7 @@ static inline struct txfcb *gfar_add_fcb(struct sk_buff *skb)
 }
 
 static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb,
-		int fcb_length)
+				    int fcb_length)
 {
 	u8 flags = 0;
 
@@ -1975,8 +1983,9 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb,
 	if (ip_hdr(skb)->protocol == IPPROTO_UDP) {
 		flags |= TXFCB_UDP;
 		fcb->phcs = udp_hdr(skb)->check;
-	} else
+	} else {
 		fcb->phcs = tcp_hdr(skb)->check;
+	}
 
 	/* l3os is the distance between the start of the
 	 * frame (skb->data) and the start of the IP hdr.
@@ -1988,14 +1997,14 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb,
 	fcb->flags = flags;
 }
 
-void inline gfar_tx_vlan(struct sk_buff *skb, struct txfcb *fcb)
+inline void gfar_tx_vlan(struct sk_buff *skb, struct txfcb *fcb)
 {
 	fcb->flags |= TXFCB_VLN;
 	fcb->vlctl = vlan_tx_tag_get(skb);
 }
 
 static inline struct txbd8 *skip_txbd(struct txbd8 *bdp, int stride,
-			       struct txbd8 *base, int ring_size)
+				      struct txbd8 *base, int ring_size)
 {
 	struct txbd8 *new_bd = bdp + stride;
 
@@ -2003,7 +2012,7 @@ static inline struct txbd8 *skip_txbd(struct txbd8 *bdp, int stride,
 }
 
 static inline struct txbd8 *next_txbd(struct txbd8 *bdp, struct txbd8 *base,
-		int ring_size)
+				      int ring_size)
 {
 	return skip_txbd(bdp, 1, base, ring_size);
 }
@@ -2029,8 +2038,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	 * before start of transmission.
 	 */
 	if (unlikely(gfar_has_errata(priv, GFAR_ERRATA_76) &&
-			skb->ip_summed == CHECKSUM_PARTIAL &&
-			skb->len > 2500)) {
+		     skb->ip_summed == CHECKSUM_PARTIAL &&
+		     skb->len > 2500)) {
 		int ret;
 
 		ret = skb_checksum_help(skb);
@@ -2046,16 +2055,16 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	/* check if time stamp should be generated */
 	if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP &&
-			priv->hwts_tx_en)) {
+		     priv->hwts_tx_en)) {
 		do_tstamp = 1;
 		fcb_length = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
 	}
 
 	/* make space for additional header when fcb is needed */
 	if (((skb->ip_summed == CHECKSUM_PARTIAL) ||
-			vlan_tx_tag_present(skb) ||
-			unlikely(do_tstamp)) &&
-			(skb_headroom(skb) < fcb_length)) {
+	     vlan_tx_tag_present(skb) ||
+	     unlikely(do_tstamp)) &&
+	    (skb_headroom(skb) < fcb_length)) {
 		struct sk_buff *skb_new;
 
 		skb_new = skb_realloc_headroom(skb, fcb_length);
@@ -2099,12 +2108,12 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	/* Time stamp insertion requires one additional TxBD */
 	if (unlikely(do_tstamp))
 		txbdp_tstamp = txbdp = next_txbd(txbdp, base,
-				tx_queue->tx_ring_size);
+						 tx_queue->tx_ring_size);
 
 	if (nr_frags == 0) {
 		if (unlikely(do_tstamp))
 			txbdp_tstamp->lstatus |= BD_LFLAG(TXBD_LAST |
-					TXBD_INTERRUPT);
+							  TXBD_INTERRUPT);
 		else
 			lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT);
 	} else {
@@ -2146,8 +2155,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (CHECKSUM_PARTIAL == skb->ip_summed) {
 		fcb = gfar_add_fcb(skb);
 		/* as specified by errata */
-		if (unlikely(gfar_has_errata(priv, GFAR_ERRATA_12)
-			     && ((unsigned long)fcb % 0x20) > 0x18)) {
+		if (unlikely(gfar_has_errata(priv, GFAR_ERRATA_12) &&
+			     ((unsigned long)fcb % 0x20) > 0x18)) {
 			__skb_pull(skb, GMAC_FCB_LEN);
 			skb_checksum_help(skb);
 		} else {
@@ -2175,7 +2184,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 
 	txbdp_start->bufPtr = dma_map_single(&priv->ofdev->dev, skb->data,
-			skb_headlen(skb), DMA_TO_DEVICE);
+					     skb_headlen(skb), DMA_TO_DEVICE);
 
 	/*
 	 * If time stamping is requested one additional TxBD must be set up. The
@@ -2186,7 +2195,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (unlikely(do_tstamp)) {
 		txbdp_tstamp->bufPtr = txbdp_start->bufPtr + fcb_length;
 		txbdp_tstamp->lstatus |= BD_LFLAG(TXBD_READY) |
-				(skb_headlen(skb) - fcb_length);
+			(skb_headlen(skb) - fcb_length);
 		lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | GMAC_FCB_LEN;
 	} else {
 		lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | skb_headlen(skb);
@@ -2361,8 +2370,8 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
 	frame_size += priv->padding;
 
 	tempsize =
-	    (frame_size & ~(INCREMENTAL_BUFFER_SIZE - 1)) +
-	    INCREMENTAL_BUFFER_SIZE;
+		(frame_size & ~(INCREMENTAL_BUFFER_SIZE - 1)) +
+		INCREMENTAL_BUFFER_SIZE;
 
 	/* Only stop and start the controller if it isn't already
 	 * stopped, and we changed something */
@@ -2382,7 +2391,7 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
 	tempval = gfar_read(&regs->maccfg2);
 
 	if (priv->rx_buffer_size > DEFAULT_RX_BUFFER_SIZE ||
-			gfar_has_errata(priv, GFAR_ERRATA_74))
+	    gfar_has_errata(priv, GFAR_ERRATA_74))
 		tempval |= (MACCFG2_HUGEFRAME | MACCFG2_LENGTHCHECK);
 	else
 		tempval &= ~(MACCFG2_HUGEFRAME | MACCFG2_LENGTHCHECK);
@@ -2403,7 +2412,7 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
 static void gfar_reset_task(struct work_struct *work)
 {
 	struct gfar_private *priv = container_of(work, struct gfar_private,
-			reset_task);
+						 reset_task);
 	struct net_device *dev = priv->ndev;
 
 	if (dev->flags & IFF_UP) {
@@ -2430,7 +2439,7 @@ static void gfar_align_skb(struct sk_buff *skb)
 	 * as many bytes as needed to align the data properly
 	 */
 	skb_reserve(skb, RXBUF_ALIGNMENT -
-		(((unsigned long) skb->data) & (RXBUF_ALIGNMENT - 1)));
+		    (((unsigned long) skb->data) & (RXBUF_ALIGNMENT - 1)));
 }
 
 /* Interrupt Handler for Transmit complete */
@@ -2479,21 +2488,22 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
 
 		/* Only clean completed frames */
 		if ((lstatus & BD_LFLAG(TXBD_READY)) &&
-				(lstatus & BD_LENGTH_MASK))
+		    (lstatus & BD_LENGTH_MASK))
 			break;
 
 		if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) {
 			next = next_txbd(bdp, base, tx_ring_size);
 			buflen = next->length + GMAC_FCB_LEN + GMAC_TXPAL_LEN;
-		} else
+		} else {
 			buflen = bdp->length;
+		}
 
 		dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr,
-				buflen, DMA_TO_DEVICE);
+				 buflen, DMA_TO_DEVICE);
 
 		if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) {
 			struct skb_shared_hwtstamps shhwtstamps;
-			u64 *ns = (u64*) (((u32)skb->data + 0x10) & ~0x7);
+			u64 *ns = (u64 *)(((u32)skb->data + 0x10) & ~0x7);
 			memset(&shhwtstamps, 0, sizeof(shhwtstamps));
 			shhwtstamps.hwtstamp = ns_to_ktime(*ns);
 			skb_pull(skb, GMAC_FCB_LEN + GMAC_TXPAL_LEN);
@@ -2507,9 +2517,9 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
 
 		for (i = 0; i < frags; i++) {
 			dma_unmap_page(&priv->ofdev->dev,
-					bdp->bufPtr,
-					bdp->length,
-					DMA_TO_DEVICE);
+				       bdp->bufPtr,
+				       bdp->length,
+				       DMA_TO_DEVICE);
 			bdp->lstatus &= BD_LFLAG(TXBD_WRAP);
 			bdp = next_txbd(bdp, base, tx_ring_size);
 		}
@@ -2521,12 +2531,13 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
 		 * we add this skb back into the pool, if it's the right size
 		 */
 		if (skb_queue_len(&priv->rx_recycle) < rx_queue->rx_ring_size &&
-				skb_recycle_check(skb, priv->rx_buffer_size +
-					RXBUF_ALIGNMENT)) {
+		    skb_recycle_check(skb, priv->rx_buffer_size +
+				      RXBUF_ALIGNMENT)) {
 			gfar_align_skb(skb);
 			skb_queue_head(&priv->rx_recycle, skb);
-		} else
+		} else {
 			dev_kfree_skb_any(skb);
+		}
 
 		tx_queue->tx_skbuff[skb_dirtytx] = NULL;
 
@@ -2579,7 +2590,7 @@ static irqreturn_t gfar_transmit(int irq, void *grp_id)
 }
 
 static void gfar_new_rxbdp(struct gfar_priv_rx_q *rx_queue, struct rxbd8 *bdp,
-		struct sk_buff *skb)
+			   struct sk_buff *skb)
 {
 	struct net_device *dev = rx_queue->dev;
 	struct gfar_private *priv = netdev_priv(dev);
@@ -2590,7 +2601,7 @@ static void gfar_new_rxbdp(struct gfar_priv_rx_q *rx_queue, struct rxbd8 *bdp,
 	gfar_init_rxbdp(rx_queue, bdp, buf);
 }
 
-static struct sk_buff * gfar_alloc_skb(struct net_device *dev)
+static struct sk_buff *gfar_alloc_skb(struct net_device *dev)
 {
 	struct gfar_private *priv = netdev_priv(dev);
 	struct sk_buff *skb = NULL;
@@ -2604,7 +2615,7 @@ static struct sk_buff * gfar_alloc_skb(struct net_device *dev)
 	return skb;
 }
 
-struct sk_buff * gfar_new_skb(struct net_device *dev)
+struct sk_buff *gfar_new_skb(struct net_device *dev)
 {
 	struct gfar_private *priv = netdev_priv(dev);
 	struct sk_buff *skb = NULL;
@@ -2695,7 +2706,7 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
 	/* Get receive timestamp from the skb */
 	if (priv->hwts_rx_en) {
 		struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb);
-		u64 *ns = (u64 *) skb->data;
+		u64 *ns = (u64 *)skb->data;
 		memset(shhwtstamps, 0, sizeof(*shhwtstamps));
 		shhwtstamps->hwtstamp = ns_to_ktime(*ns);
 	}
@@ -2757,15 +2768,15 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
 		skb = rx_queue->rx_skbuff[rx_queue->skb_currx];
 
 		dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr,
-				priv->rx_buffer_size, DMA_FROM_DEVICE);
+				 priv->rx_buffer_size, DMA_FROM_DEVICE);
 
 		if (unlikely(!(bdp->status & RXBD_ERR) &&
-				bdp->length > priv->rx_buffer_size))
+			     bdp->length > priv->rx_buffer_size))
 			bdp->status = RXBD_LARGE;
 
 		/* We drop the frame if we failed to allocate a new buffer */
 		if (unlikely(!newskb || !(bdp->status & RXBD_LAST) ||
-				 bdp->status & RXBD_ERR)) {
+			     bdp->status & RXBD_ERR)) {
 			count_errors(bdp->status, dev);
 
 			if (unlikely(!newskb))
@@ -2784,7 +2795,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
 				rx_queue->stats.rx_bytes += pkt_len;
 				skb_record_rx_queue(skb, rx_queue->qindex);
 				gfar_process_frame(dev, skb, amount_pull,
-						&rx_queue->grp->napi);
+						   &rx_queue->grp->napi);
 
 			} else {
 				netif_warn(priv, rx_err, dev, "Missing skb!\n");
@@ -2804,8 +2815,8 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
 
 		/* update to point at the next skb */
 		rx_queue->skb_currx =
-		    (rx_queue->skb_currx + 1) &
-		    RX_RING_MOD_MASK(rx_queue->rx_ring_size);
+			(rx_queue->skb_currx + 1) &
+			RX_RING_MOD_MASK(rx_queue->rx_ring_size);
 	}
 
 	/* Update the current rxbd pointer to be the next one */
@@ -2816,8 +2827,8 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
 
 static int gfar_poll(struct napi_struct *napi, int budget)
 {
-	struct gfar_priv_grp *gfargrp = container_of(napi,
-			struct gfar_priv_grp, napi);
+	struct gfar_priv_grp *gfargrp =
+		container_of(napi, struct gfar_priv_grp, napi);
 	struct gfar_private *priv = gfargrp->priv;
 	struct gfar __iomem *regs = gfargrp->regs;
 	struct gfar_priv_tx_q *tx_queue = NULL;
@@ -2847,11 +2858,11 @@ static int gfar_poll(struct napi_struct *napi, int budget)
 
 			tx_cleaned += gfar_clean_tx_ring(tx_queue);
 			rx_cleaned_per_queue = gfar_clean_rx_ring(rx_queue,
-							budget_per_queue);
+								  budget_per_queue);
 			rx_cleaned += rx_cleaned_per_queue;
-			if(rx_cleaned_per_queue < budget_per_queue) {
-				left_over_budget = left_over_budget +
-					(budget_per_queue - rx_cleaned_per_queue);
+			if (rx_cleaned_per_queue < budget_per_queue) {
+				left_over_budget += (budget_per_queue -
+						     rx_cleaned_per_queue);
 				set_bit(i, &serviced_queues);
 				num_queues--;
 			}
@@ -2871,8 +2882,8 @@ static int gfar_poll(struct napi_struct *napi, int budget)
 
 		/* If we are coalescing interrupts, update the timer */
 		/* Otherwise, clear it */
-		gfar_configure_coalescing(priv,
-				gfargrp->rx_bit_map, gfargrp->tx_bit_map);
+		gfar_configure_coalescing(priv, gfargrp->rx_bit_map,
+					  gfargrp->tx_bit_map);
 	}
 
 	return rx_cleaned;
@@ -2896,7 +2907,7 @@ static void gfar_netpoll(struct net_device *dev)
 			disable_irq(priv->gfargrp[i].interruptReceive);
 			disable_irq(priv->gfargrp[i].interruptError);
 			gfar_interrupt(priv->gfargrp[i].interruptTransmit,
-						&priv->gfargrp[i]);
+				       &priv->gfargrp[i]);
 			enable_irq(priv->gfargrp[i].interruptError);
 			enable_irq(priv->gfargrp[i].interruptReceive);
 			enable_irq(priv->gfargrp[i].interruptTransmit);
@@ -2905,7 +2916,7 @@ static void gfar_netpoll(struct net_device *dev)
 		for (i = 0; i < priv->num_grps; i++) {
 			disable_irq(priv->gfargrp[i].interruptTransmit);
 			gfar_interrupt(priv->gfargrp[i].interruptTransmit,
-						&priv->gfargrp[i]);
+				       &priv->gfargrp[i]);
 			enable_irq(priv->gfargrp[i].interruptTransmit);
 		}
 	}
@@ -2972,15 +2983,15 @@ static void adjust_link(struct net_device *dev)
 			new_state = 1;
 			switch (phydev->speed) {
 			case 1000:
-				tempval =
-				    ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII);
+				tempval = ((tempval & ~(MACCFG2_IF)) |
+					   MACCFG2_GMII);
 
 				ecntrl &= ~(ECNTRL_R100);
 				break;
 			case 100:
 			case 10:
-				tempval =
-				    ((tempval & ~(MACCFG2_IF)) | MACCFG2_MII);
+				tempval = ((tempval & ~(MACCFG2_IF)) |
+					   MACCFG2_MII);
 
 				/* Reduced mode distinguishes
 				 * between 10 and 100 */
@@ -3102,8 +3113,9 @@ static void gfar_set_multi(struct net_device *dev)
 			if (idx < em_num) {
 				gfar_set_mac_for_addr(dev, idx, ha->addr);
 				idx++;
-			} else
+			} else {
 				gfar_set_hash_for_addr(dev, ha->addr);
+			}
 		}
 	}
 }
@@ -3116,7 +3128,7 @@ static void gfar_clear_exact_match(struct net_device *dev)
 	int idx;
 	static const u8 zero_arr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
 
-	for(idx = 1;idx < GFAR_EM_NUM + 1;idx++)
+	for (idx = 1; idx < GFAR_EM_NUM + 1; idx++)
 		gfar_set_mac_for_addr(dev, idx, zero_arr);
 }
 
@@ -3169,11 +3181,11 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num,
 	for (idx = 0; idx < ETH_ALEN; idx++)
 		tmpbuf[ETH_ALEN - 1 - idx] = addr[idx];
 
-	gfar_write(macptr, *((u32 *) (tmpbuf)));
+	gfar_write(macptr, *((u32 *)(tmpbuf)));
 
-	tempval = *((u32 *) (tmpbuf + 4));
+	tempval = *((u32 *)(tmpbuf + 4));
 
-	gfar_write(macptr+1, tempval);
+	gfar_write(macptr + 1, tempval);
 }
 
 /* GFAR error interrupt handler */
@@ -3181,7 +3193,7 @@ static irqreturn_t gfar_error(int irq, void *grp_id)
 {
 	struct gfar_priv_grp *gfargrp = grp_id;
 	struct gfar __iomem *regs = gfargrp->regs;
-	struct gfar_private *priv= gfargrp->priv;
+	struct gfar_private *priv = gfargrp->priv;
 	struct net_device *dev = priv->ndev;
 
 	/* Save ievent for future reference */
@@ -3256,8 +3268,7 @@ static irqreturn_t gfar_error(int irq, void *grp_id)
 	return IRQ_HANDLED;
 }
 
-static struct of_device_id gfar_match[] =
-{
+static struct of_device_id gfar_match[] = {
 	{
 		.type = "network",
 		.compatible = "gianfar",
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index 8a02557..26a2fa2 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -31,12 +31,12 @@
 #include <linux/spinlock.h>
 #include <linux/mm.h>
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/crc32.h>
-#include <asm/types.h>
+#include <linux/types.h>
 #include <linux/ethtool.h>
 #include <linux/mii.h>
 #include <linux/phy.h>
@@ -51,8 +51,8 @@ extern int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit
 #define GFAR_MAX_COAL_USECS 0xffff
 #define GFAR_MAX_COAL_FRAMES 0xff
 static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
-		     u64 * buf);
-static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf);
+		     u64 *buf);
+static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 *buf);
 static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals);
 static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals);
 static void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals);
@@ -122,7 +122,7 @@ static const char stat_gstrings[][ETH_GSTRING_LEN] = {
 
 /* Fill in a buffer with the strings which correspond to the
  * stats */
-static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf)
+static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 *buf)
 {
 	struct gfar_private *priv = netdev_priv(dev);
 
@@ -130,23 +130,23 @@ static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf)
 		memcpy(buf, stat_gstrings, GFAR_STATS_LEN * ETH_GSTRING_LEN);
 	else
 		memcpy(buf, stat_gstrings,
-				GFAR_EXTRA_STATS_LEN * ETH_GSTRING_LEN);
+		       GFAR_EXTRA_STATS_LEN * ETH_GSTRING_LEN);
 }
 
 /* Fill in an array of 64-bit statistics from various sources.
  * This array will be appended to the end of the ethtool_stats
  * structure, and returned to user space
  */
-static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, u64 * buf)
+static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, u64 *buf)
 {
 	int i;
 	struct gfar_private *priv = netdev_priv(dev);
 	struct gfar __iomem *regs = priv->gfargrp[0].regs;
-	u64 *extra = (u64 *) & priv->extra_stats;
+	u64 *extra = (u64 *)&priv->extra_stats;
 
 	if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
-		u32 __iomem *rmon = (u32 __iomem *) &regs->rmon;
-		struct gfar_stats *stats = (struct gfar_stats *) buf;
+		u32 __iomem *rmon = (u32 __iomem *)&regs->rmon;
+		struct gfar_stats *stats = (struct gfar_stats *)buf;
 
 		for (i = 0; i < GFAR_RMON_LEN; i++)
 			stats->rmon[i] = (u64) gfar_read(&rmon[i]);
@@ -174,8 +174,8 @@ static int gfar_sset_count(struct net_device *dev, int sset)
 }
 
 /* Fills in the drvinfo structure with some basic info */
-static void gfar_gdrvinfo(struct net_device *dev, struct
-	      ethtool_drvinfo *drvinfo)
+static void gfar_gdrvinfo(struct net_device *dev,
+			  struct ethtool_drvinfo *drvinfo)
 {
 	strncpy(drvinfo->driver, DRV_NAME, GFAR_INFOSTR_LEN);
 	strncpy(drvinfo->version, gfar_driver_version, GFAR_INFOSTR_LEN);
@@ -222,7 +222,7 @@ static int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd)
 /* Return the length of the register structure */
 static int gfar_reglen(struct net_device *dev)
 {
-	return sizeof (struct gfar);
+	return sizeof(struct gfar);
 }
 
 /* Return a dump of the GFAR register space */
@@ -230,10 +230,10 @@ static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, voi
 {
 	int i;
 	struct gfar_private *priv = netdev_priv(dev);
-	u32 __iomem *theregs = (u32 __iomem *) priv->gfargrp[0].regs;
-	u32 *buf = (u32 *) regbuf;
+	u32 __iomem *theregs = (u32 __iomem *)priv->gfargrp[0].regs;
+	u32 *buf = (u32 *)regbuf;
 
-	for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++)
+	for (i = 0; i < sizeof(struct gfar) / sizeof(u32); i++)
 		buf[i] = gfar_read(&theregs[i]);
 }
 
@@ -499,7 +499,7 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva
 
 		for (i = 0; i < priv->num_rx_queues; i++)
 			gfar_clean_rx_ring(priv->rx_queue[i],
-					priv->rx_queue[i]->rx_ring_size);
+					   priv->rx_queue[i]->rx_ring_size);
 
 		/* Now we take down the rings to rebuild them */
 		stop_gfar(dev);
@@ -548,7 +548,7 @@ int gfar_set_features(struct net_device *dev, netdev_features_t features)
 
 		for (i = 0; i < priv->num_rx_queues; i++)
 			gfar_clean_rx_ring(priv->rx_queue[i],
-					priv->rx_queue[i]->rx_ring_size);
+					   priv->rx_queue[i]->rx_ring_size);
 
 		/* Now we take down the rings to rebuild them */
 		stop_gfar(dev);
@@ -608,12 +608,12 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 }
 #endif
 
-static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
+static void ethflow_to_filer_rules(struct gfar_private *priv, u64 ethflow)
 {
 	u32 fcr = 0x0, fpr = FPR_FILER_MASK;
 
 	if (ethflow & RXH_L2DA) {
-		fcr = RQFCR_PID_DAH |RQFCR_CMP_NOMATCH |
+		fcr = RQFCR_PID_DAH | RQFCR_CMP_NOMATCH |
 			RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0;
 		priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
 		priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
@@ -705,16 +705,16 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 
 	switch (class) {
 	case TCP_V4_FLOW:
-		cmp_rqfpr = RQFPR_IPV4 |RQFPR_TCP;
+		cmp_rqfpr = RQFPR_IPV4 | RQFPR_TCP;
 		break;
 	case UDP_V4_FLOW:
-		cmp_rqfpr = RQFPR_IPV4 |RQFPR_UDP;
+		cmp_rqfpr = RQFPR_IPV4 | RQFPR_UDP;
 		break;
 	case TCP_V6_FLOW:
-		cmp_rqfpr = RQFPR_IPV6 |RQFPR_TCP;
+		cmp_rqfpr = RQFPR_IPV6 | RQFPR_TCP;
 		break;
 	case UDP_V6_FLOW:
-		cmp_rqfpr = RQFPR_IPV6 |RQFPR_UDP;
+		cmp_rqfpr = RQFPR_IPV6 | RQFPR_UDP;
 		break;
 	default:
 		pr_err("Right now this class is not supported\n");
@@ -727,7 +727,7 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 		local_rqfcr[j] = priv->ftp_rqfcr[i];
 		j--;
 		if ((priv->ftp_rqfcr[i] == (RQFCR_PID_PARSE |
-			RQFCR_CLE |RQFCR_AND)) &&
+			RQFCR_CLE | RQFCR_AND)) &&
 			(priv->ftp_rqfpr[i] == cmp_rqfpr))
 			break;
 	}
@@ -743,17 +743,17 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 	 */
 	for (l = i+1; l < MAX_FILER_IDX; l++) {
 		if ((priv->ftp_rqfcr[l] & RQFCR_CLE) &&
-			!(priv->ftp_rqfcr[l] & RQFCR_AND)) {
+		    !(priv->ftp_rqfcr[l] & RQFCR_AND)) {
 			priv->ftp_rqfcr[l] = RQFCR_CLE | RQFCR_CMP_EXACT |
 				RQFCR_HASHTBL_0 | RQFCR_PID_MASK;
 			priv->ftp_rqfpr[l] = FPR_FILER_MASK;
 			gfar_write_filer(priv, l, priv->ftp_rqfcr[l],
-				priv->ftp_rqfpr[l]);
+					 priv->ftp_rqfpr[l]);
 			break;
 		}
 
 		if (!(priv->ftp_rqfcr[l] & RQFCR_CLE) &&
-			(priv->ftp_rqfcr[l] & RQFCR_AND))
+		    (priv->ftp_rqfcr[l] & RQFCR_AND))
 			continue;
 		else {
 			local_rqfpr[j] = priv->ftp_rqfpr[l];
@@ -773,7 +773,7 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 		priv->ftp_rqfpr[priv->cur_filer_idx] = local_rqfpr[k];
 		priv->ftp_rqfcr[priv->cur_filer_idx] = local_rqfcr[k];
 		gfar_write_filer(priv, priv->cur_filer_idx,
-				local_rqfcr[k], local_rqfpr[k]);
+				 local_rqfcr[k], local_rqfpr[k]);
 		if (!priv->cur_filer_idx)
 			break;
 		priv->cur_filer_idx = priv->cur_filer_idx - 1;
@@ -810,10 +810,10 @@ static int gfar_check_filer_hardware(struct gfar_private *priv)
 		i &= RCTRL_PRSDEP_MASK | RCTRL_PRSFM;
 		if (i == (RCTRL_PRSDEP_MASK | RCTRL_PRSFM)) {
 			netdev_info(priv->ndev,
-					"Receive Queue Filtering enabled\n");
+				    "Receive Queue Filtering enabled\n");
 		} else {
 			netdev_warn(priv->ndev,
-					"Receive Queue Filtering disabled\n");
+				    "Receive Queue Filtering disabled\n");
 			return -EOPNOTSUPP;
 		}
 	}
@@ -823,10 +823,10 @@ static int gfar_check_filer_hardware(struct gfar_private *priv)
 		i &= RCTRL_PRSDEP_MASK;
 		if (i == RCTRL_PRSDEP_MASK) {
 			netdev_info(priv->ndev,
-					"Receive Queue Filtering enabled\n");
+				    "Receive Queue Filtering enabled\n");
 		} else {
 			netdev_warn(priv->ndev,
-					"Receive Queue Filtering disabled\n");
+				    "Receive Queue Filtering disabled\n");
 			return -EOPNOTSUPP;
 		}
 	}
@@ -977,7 +977,7 @@ static void gfar_set_user_ip(struct ethtool_usrip4_spec *value,
 	gfar_set_attribute(value->tos, mask->tos, RQFCR_PID_TOS, tab);
 	gfar_set_attribute(value->proto, mask->proto, RQFCR_PID_L4P, tab);
 	gfar_set_attribute(value->l4_4_bytes, mask->l4_4_bytes, RQFCR_PID_ARB,
-			tab);
+			   tab);
 
 }
 
@@ -1016,8 +1016,8 @@ static void gfar_set_ether(struct ethhdr *value, struct ethhdr *mask,
 	if (!is_broadcast_ether_addr(mask->h_dest)) {
 
 		/* Special for destination is limited broadcast */
-		if ((is_broadcast_ether_addr(value->h_dest)
-				&& is_zero_ether_addr(mask->h_dest))) {
+		if (is_broadcast_ether_addr(value->h_dest) &&
+		    is_zero_ether_addr(mask->h_dest)) {
 			gfar_set_parse_bits(RQFPR_EBC, RQFPR_EBC, tab);
 		} else {
 
@@ -1090,34 +1090,34 @@ static int gfar_convert_to_filer(struct ethtool_rx_flow_spec *rule,
 	switch (rule->flow_type & ~FLOW_EXT) {
 	case TCP_V4_FLOW:
 		gfar_set_parse_bits(RQFPR_IPV4 | RQFPR_TCP | vlan,
-				RQFPR_IPV4 | RQFPR_TCP | vlan_mask, tab);
+				    RQFPR_IPV4 | RQFPR_TCP | vlan_mask, tab);
 		gfar_set_basic_ip(&rule->h_u.tcp_ip4_spec,
-				&rule->m_u.tcp_ip4_spec, tab);
+				  &rule->m_u.tcp_ip4_spec, tab);
 		break;
 	case UDP_V4_FLOW:
 		gfar_set_parse_bits(RQFPR_IPV4 | RQFPR_UDP | vlan,
-				RQFPR_IPV4 | RQFPR_UDP | vlan_mask, tab);
+				    RQFPR_IPV4 | RQFPR_UDP | vlan_mask, tab);
 		gfar_set_basic_ip(&rule->h_u.udp_ip4_spec,
-				&rule->m_u.udp_ip4_spec, tab);
+				  &rule->m_u.udp_ip4_spec, tab);
 		break;
 	case SCTP_V4_FLOW:
 		gfar_set_parse_bits(RQFPR_IPV4 | vlan, RQFPR_IPV4 | vlan_mask,
-				tab);
+				    tab);
 		gfar_set_attribute(132, 0, RQFCR_PID_L4P, tab);
-		gfar_set_basic_ip((struct ethtool_tcpip4_spec *) &rule->h_u,
-				(struct ethtool_tcpip4_spec *) &rule->m_u, tab);
+		gfar_set_basic_ip((struct ethtool_tcpip4_spec *)&rule->h_u,
+				  (struct ethtool_tcpip4_spec *)&rule->m_u, tab);
 		break;
 	case IP_USER_FLOW:
 		gfar_set_parse_bits(RQFPR_IPV4 | vlan, RQFPR_IPV4 | vlan_mask,
-				tab);
-		gfar_set_user_ip((struct ethtool_usrip4_spec *) &rule->h_u,
-				(struct ethtool_usrip4_spec *) &rule->m_u, tab);
+				    tab);
+		gfar_set_user_ip((struct ethtool_usrip4_spec *)&rule->h_u,
+				 (struct ethtool_usrip4_spec *)&rule->m_u, tab);
 		break;
 	case ETHER_FLOW:
 		if (vlan)
 			gfar_set_parse_bits(vlan, vlan_mask, tab);
-		gfar_set_ether((struct ethhdr *) &rule->h_u,
-				(struct ethhdr *) &rule->m_u, tab);
+		gfar_set_ether((struct ethhdr *)&rule->h_u,
+			       (struct ethhdr *)&rule->m_u, tab);
 		break;
 	default:
 		return -1;
@@ -1207,7 +1207,7 @@ static int gfar_expand_filer_entries(u32 begin, u32 length,
 		return -EINVAL;
 
 	gfar_copy_filer_entries(&(tab->fe[begin + length]), &(tab->fe[begin]),
-			tab->index - length + 1);
+				tab->index - length + 1);
 
 	tab->index += length;
 	return 0;
@@ -1271,10 +1271,10 @@ static void gfar_cluster_filer(struct filer_table *tab)
 				break;
 
 			gfar_copy_filer_entries(&(tab->fe[iend + 1]),
-					&(tab->fe[jend + 1]), jend - j);
+						&(tab->fe[jend + 1]), jend - j);
 
 			if (gfar_trim_filer_entries(jend - 1,
-					jend + (jend - j), tab) == -EINVAL)
+						    jend + (jend - j), tab) == -EINVAL)
 				return;
 
 			/* Mask out cluster bit */
@@ -1364,8 +1364,8 @@ static void gfar_sort_mask_table(struct gfar_mask_entry *mask_table,
 			old_first = mask_table[start].start + 1;
 			old_last = mask_table[i - 1].end;
 			sort(mask_table + start, size,
-					sizeof(struct gfar_mask_entry),
-					gfar_comp, &gfar_swap);
+			     sizeof(struct gfar_mask_entry),
+			     gfar_comp, &gfar_swap);
 
 			/* Toggle order for every block. This makes the
 			 * thing more efficient! */
@@ -1378,12 +1378,11 @@ static void gfar_sort_mask_table(struct gfar_mask_entry *mask_table,
 			new_last = mask_table[i - 1].end;
 
 			gfar_swap_bits(&temp_table->fe[new_first],
-					&temp_table->fe[old_first],
-					&temp_table->fe[new_last],
-					&temp_table->fe[old_last],
-					RQFCR_QUEUE | RQFCR_CLE |
-						RQFCR_RJE | RQFCR_AND
-					);
+				       &temp_table->fe[old_first],
+				       &temp_table->fe[new_last],
+				       &temp_table->fe[old_last],
+				       RQFCR_QUEUE | RQFCR_CLE |
+				       RQFCR_RJE | RQFCR_AND);
 
 			start = i;
 			size = 0;
@@ -1432,7 +1431,7 @@ static int gfar_optimize_filer_masks(struct filer_table *tab)
 	for (i = 0; i < and_index; i++) {
 		size = mask_table[i].end - mask_table[i].start + 1;
 		gfar_copy_filer_entries(&(tab->fe[j]),
-				&(temp_table->fe[mask_table[i].start]), size);
+					&(temp_table->fe[mask_table[i].start]), size);
 		j += size;
 	}
 
@@ -1494,15 +1493,15 @@ static int gfar_check_capability(struct ethtool_rx_flow_spec *flow,
 	if (flow->flow_type & FLOW_EXT)	{
 		if (~flow->m_ext.data[0] || ~flow->m_ext.data[1])
 			netdev_warn(priv->ndev,
-					"User-specific data not supported!\n");
+				    "User-specific data not supported!\n");
 		if (~flow->m_ext.vlan_etype)
 			netdev_warn(priv->ndev,
-					"VLAN-etype not supported!\n");
+				    "VLAN-etype not supported!\n");
 	}
 	if (flow->flow_type == IP_USER_FLOW)
 		if (flow->h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4)
 			netdev_warn(priv->ndev,
-					"IP-Version differing from IPv4 not supported!\n");
+				    "IP-Version differing from IPv4 not supported!\n");
 
 	return 0;
 }
@@ -1599,8 +1598,8 @@ static int gfar_add_cls(struct gfar_private *priv,
 			}
 			if (comp->fs.location == flow->location) {
 				netdev_err(priv->ndev,
-						"Rule not added: ID %d not free!\n",
-					flow->location);
+					   "Rule not added: ID %d not free!\n",
+					   flow->location);
 				ret = -EBUSY;
 				goto clean_mem;
 			}
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
index c08e5d4..3f7b81d 100644
--- a/drivers/net/ethernet/freescale/gianfar_ptp.c
+++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
@@ -268,11 +268,11 @@ static irqreturn_t isr(int irq, void *priv)
 		ptp_clock_event(etsects->clock, &event);
 	}
 
-	if (ack) {
-		gfar_write(&etsects->regs->tmr_tevent, ack);
-		return IRQ_HANDLED;
-	} else
+	if (!ack)
 		return IRQ_NONE;
+
+	gfar_write(&etsects->regs->tmr_tevent, ack);
+	return IRQ_HANDLED;
 }
 
 /*
diff --git a/drivers/net/ethernet/freescale/gianfar_sysfs.c b/drivers/net/ethernet/freescale/gianfar_sysfs.c
index cd14a4d..3a1fa70 100644
--- a/drivers/net/ethernet/freescale/gianfar_sysfs.c
+++ b/drivers/net/ethernet/freescale/gianfar_sysfs.c
@@ -31,7 +31,7 @@
 #include <linux/mm.h>
 #include <linux/device.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 
 #include "gianfar.h"

^ permalink raw reply related

* Re: net/wanrouter?
From: Joe Perches @ 2012-05-24 16:22 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Jan Ceuleers, netdev
In-Reply-To: <20120524091310.1c01577e@nehalam.linuxnetplumber.net>

On Thu, 2012-05-24 at 09:13 -0700, Stephen Hemminger wrote:
> On Thu, 24 May 2012 15:51:56 +0200
> Jan Ceuleers <jan.ceuleers@computer.org> wrote:
> 
> > On 05/22/2012 07:33 PM, Joe Perches wrote:
> > > Does anyone still use this?
> > 
> > I have the hardware (a Sangoma ADSL PCI card) but am no longer using it.
> > Also, as I remember, Sangoma stopped contributing to the upstream driver
> > many years ago while still actively developing the out-of-tree version.
> 
> The wanrouter code hasn't supported Sangoma hardware for a long time,
> it got removed early in 2.6.
> 
> There are a bunch of old T1 and T3 cards there but I doubt any of them
> are still for sale. But somebody is probably still using them.

I'm sure people are still using token ring
too, just not with recent kernels.

I think wanrouter is old and dusty and can
be removed just like TR.

^ permalink raw reply

* [PATCH] xen/netback: Calculate the number of SKB slots required correctly
From: Simon Graham @ 2012-05-24 16:26 UTC (permalink / raw)
  To: Ian Campbell, konrad.wilk@oracle.com,
	xen-devel@lists.xensource.com, netdev@vger.kernel.org
  Cc: bhutchings@solarflare.com, davem@davemloft.net,
	adnan.misherfi@oracle.com, Simon Graham

When calculating the number of slots required for a packet header, the code
was reserving too many slots if the header crossed a page boundary. Since
netbk_gop_skb copies the header to the start of the page, the count of
slots required for the header should be based solely on the header size.

This problem is easy to reproduce if a VIF is bridged to a USB 3G modem
device as the skb->data value always starts near the end of the first page.

Signed-off-by: Simon Graham <simon.graham@citrix.com>
---
 drivers/net/xen-netback/netback.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 2596401..f4a6fca 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -325,8 +325,7 @@ unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb)
 	unsigned int count;
 	int i, copy_off;
 
-	count = DIV_ROUND_UP(
-			offset_in_page(skb->data)+skb_headlen(skb), PAGE_SIZE);
+	count = DIV_ROUND_UP(skb_headlen(skb), PAGE_SIZE);
 
 	copy_off = skb_headlen(skb) % PAGE_SIZE;
 
-- 
1.7.9.1

^ permalink raw reply related

* Re: [PATCH 03/21] odp-util: Add tun_key to parse_odp_key_attr()
From: Ben Pfaff @ 2012-05-24 16:29 UTC (permalink / raw)
  To: Simon Horman; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1337850554-10339-4-git-send-email-horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>

On Thu, May 24, 2012 at 06:08:56PM +0900, Simon Horman wrote:
> Cc: Kyle Mestery <kmestery-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>

But I don't see him CCed?

> +        ovs_be32 ipv4_src;
> +        ovs_be32 ipv4_dst;
> +        unsigned long long tun_flags;
> +        int ipv4_tos;
> +        int ipv4_ttl;
> +        int n = -1;
> +
> +        if (sscanf(s, "ipv4_tunnel(tun_id=%31[x0123456789abcdefABCDEF]"
> +                   ",flags=%llx,src="IP_SCAN_FMT",dst="IP_SCAN_FMT
> +                   ",tos=%i,ttl=%i)%n",
> +                   tun_id_s, &tun_flags,
> +                   IP_SCAN_ARGS(&ipv4_src), IP_SCAN_ARGS(&ipv4_dst),
> +                   &ipv4_tos, &ipv4_ttl, &n) > 0
> +            && n > 0) {

Does this compile?  I don't see a declaration of tun_id_s.

In the ODP printer and parser, we usually require fields that are
hexadecimal to be written with an explicit "0x" on output (using
something like "0x%x" or "%#x" on output), and then use "%i" on input,
so that it is always unambiguous at a glance whether a number is
decimal or hexadecimal.  I'd appreciate it if we could maintain that
here (I didn't look over at the printer code to see if it writes 0x,
but I'd like it to).

Otherwise, this looks good, thank you.

^ permalink raw reply

* Re: net/wanrouter?
From: Ben Greear @ 2012-05-24 16:32 UTC (permalink / raw)
  To: Joe Perches; +Cc: Stephen Hemminger, Jan Ceuleers, netdev
In-Reply-To: <1337876577.5070.7.camel@joe2Laptop>

On 05/24/2012 09:22 AM, Joe Perches wrote:
> On Thu, 2012-05-24 at 09:13 -0700, Stephen Hemminger wrote:
>> On Thu, 24 May 2012 15:51:56 +0200
>> Jan Ceuleers<jan.ceuleers@computer.org>  wrote:
>>
>>> On 05/22/2012 07:33 PM, Joe Perches wrote:
>>>> Does anyone still use this?
>>>
>>> I have the hardware (a Sangoma ADSL PCI card) but am no longer using it.
>>> Also, as I remember, Sangoma stopped contributing to the upstream driver
>>> many years ago while still actively developing the out-of-tree version.
>>
>> The wanrouter code hasn't supported Sangoma hardware for a long time,
>> it got removed early in 2.6.
>>
>> There are a bunch of old T1 and T3 cards there but I doubt any of them
>> are still for sale. But somebody is probably still using them.
>
> I'm sure people are still using token ring
> too, just not with recent kernels.
>
> I think wanrouter is old and dusty and can
> be removed just like TR.

I think you should mark it deprecated for a release or
two first, just in case.  Unless it is obviously very
broken or holding up other important work.

Lots of people that might be using this do not follow
the netdev mailing list...

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply

* Re: net/wanrouter?
From: Stephen Hemminger @ 2012-05-24 16:37 UTC (permalink / raw)
  To: Ben Greear; +Cc: Joe Perches, Jan Ceuleers, netdev
In-Reply-To: <4FBE62AB.6000900@candelatech.com>

On Thu, 24 May 2012 09:32:43 -0700
Ben Greear <greearb@candelatech.com> wrote:

> On 05/24/2012 09:22 AM, Joe Perches wrote:
> > On Thu, 2012-05-24 at 09:13 -0700, Stephen Hemminger wrote:
> >> On Thu, 24 May 2012 15:51:56 +0200
> >> Jan Ceuleers<jan.ceuleers@computer.org>  wrote:
> >>
> >>> On 05/22/2012 07:33 PM, Joe Perches wrote:
> >>>> Does anyone still use this?
> >>>
> >>> I have the hardware (a Sangoma ADSL PCI card) but am no longer using it.
> >>> Also, as I remember, Sangoma stopped contributing to the upstream driver
> >>> many years ago while still actively developing the out-of-tree version.
> >>
> >> The wanrouter code hasn't supported Sangoma hardware for a long time,
> >> it got removed early in 2.6.
> >>
> >> There are a bunch of old T1 and T3 cards there but I doubt any of them
> >> are still for sale. But somebody is probably still using them.
> >
> > I'm sure people are still using token ring
> > too, just not with recent kernels.
> >
> > I think wanrouter is old and dusty and can
> > be removed just like TR.
> 
> I think you should mark it deprecated for a release or
> two first, just in case.  Unless it is obviously very
> broken or holding up other important work.
> 

And add to Documentation/features-removal. Probably need a year of
warning period.

^ permalink raw reply

* Re: [PATCH 04/21] vswitchd: Add iface_parse_tunnel
From: Ben Pfaff @ 2012-05-24 16:47 UTC (permalink / raw)
  To: Simon Horman; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1337850554-10339-5-git-send-email-horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>

The concept seems OK to me here.  I have only a few minor comments.

On Thu, May 24, 2012 at 06:08:57PM +0900, Simon Horman wrote:
> +#define TNL_F_CSUM          (1 << 0) /* Checksum packets. */
> +#define TNL_F_TOS_INHERIT	(1 << 1) /* Inherit ToS from inner packet. */
> +#define TNL_F_TTL_INHERIT	(1 << 2) /* Inherit TTL from inner packet. */
> +#define TNL_F_DF_INHERIT	(1 << 3) /* Inherit DF bit from inner packet. */
> +#define TNL_F_DF_DEFAULT	(1 << 4) /* Set DF bit if inherit off or
> +                                      * not IP. */
> +#define TNL_F_PMTUD		    (1 << 5) /* Enable path MTU discovery. */
> +#define TNL_F_HDR_CACHE		(1 << 6) /* Enable tunnel header caching. */
> +#define TNL_F_IPSEC		    (1 << 7) /* Traffic is IPsec encrypted. */
> +#define TNL_F_IN_KEY	    (1 << 8) /* Tunnel port has input key. */
> +#define TNL_F_OUT_KEY	    (1 << 9) /* Tunnel port has output key. */

Some of the above definitions use all spaces, others use tabs.  It's
OVS userspace code so it's better to use all spaces, I think.

> +    if (is_ipsec) {
> +        char *file_name = xasprintf("%s/%s", ovs_rundir(),
> +                "ovs-monitor-ipsec.pid");
> +        pid_t pid = read_pidfile(file_name);
> +        free(file_name);
> +        if (pid < 0) {
> +            VLOG_ERR("%s: IPsec requires the ovs-monitor-ipsec daemon",
> +                     iface_cfg->name);
> +            goto err;
> +        }

I just noticed that we re-read this pidfile every time we parse an
IPsec tunnel.  I guess that would be a big waste of time if we have a
lot of IPsec tunnels.  I'll make a note to consider fixing this
separately (it's not your problem).

^ permalink raw reply

* Re: [RFC] net/hsr: Add support for IEC 62439-3 High-availability Seamless Redundancy
From: Arvid Brodin @ 2012-05-24 17:09 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: netdev@vger.kernel.org, David S. Miller, Bruno Ferreira,
	Christian Borntraeger, Herbert Xu
In-Reply-To: <20120514112821.526b12be@nehalam.linuxnetplumber.net>

On 2012-05-14 20:28, Stephen Hemminger wrote:
> On Mon, 14 May 2012 18:11:44 +0000
> Arvid Brodin <Arvid.Brodin@xdin.com> wrote:
> 
>> On 2012-03-27 15:20, Arvid Brodin wrote:
>>> Hi!
>>
>> *snip*
>>>
>>> 2) I have a locking problem that I haven't managed to figure out. This happens
>>>    the first time I send any packet (hsr_dev_xmit() in hsr_device.c:121, called
>>>    from hsr_device.c:147). It happens even if I set skb2 to NULL (i.e. only send
>>>    one copy):
>>>
>>> =============================================
>>> [ INFO: possible recursive locking detected ]
>>> 2.6.37 #118
>>> ---------------------------------------------
>>> swapper/0 is trying to acquire lock:
>>>  (_xmit_ETHER#2){+.-...}, at: [<901bf38e>] sch_direct_xmit+0x24/0x152
>>>
>>> but task is already holding lock:
>>>  (_xmit_ETHER#2){+.-...}, at: [<901b4d1a>] dev_queue_xmit+0x31e/0x3cc
>>>
>>> other info that might help us debug this:
>>> 4 locks held by swapper/0:
>>>  #0:  (&n->timer){+.-...}, at: [<9002bc20>] run_timer_softirq+0x98/0x184
>>>  #1:  (rcu_read_lock_bh){.+....}, at: [<901b49fc>] dev_queue_xmit+0x0/0x3cc
>>>  #2:  (_xmit_ETHER#2){+.-...}, at: [<901b4d1a>] dev_queue_xmit+0x31e/0x3cc
>>>  #3:  (rcu_read_lock_bh){.+....}, at: [<901b49fc>] dev_queue_xmit+0x0/0x3cc
>>>
>>> stack backtrace:
>>> Call trace:
>>>  [<9001c640>] dump_stack+0x18/0x20
>>>  [<90040eac>] validate_chain+0x40c/0x9ac
>>>  [<90041a58>] __lock_acquire+0x60c/0x670
>>>  [<90042f32>] lock_acquire+0x3a/0x48
>>>  [<902201a4>] _raw_spin_lock+0x20/0x44
>>>  [<901bf38e>] sch_direct_xmit+0x24/0x152
>>>  [<901b4c14>] dev_queue_xmit+0x218/0x3cc
>>>  [<9021c2e0>] slave_xmit+0x10/0x14
>>>  [<9021c540>] hsr_dev_xmit+0x88/0x8c
>>>  [<901b4942>] dev_hard_start_xmit+0x3c6/0x480
>>>  [<901b4d34>] dev_queue_xmit+0x338/0x3cc
>>>  [<901e3cd8>] arp_xmit+0x8/0xc
>>>  [<901e4436>] arp_send+0x2a/0x2c
>>>  [<901e4e74>] arp_solicit+0x15c/0x170
>>>  [<901bad0c>] neigh_timer_handler+0x1c0/0x204
>>>  [<9002bc8a>] run_timer_softirq+0x102/0x184
>>>  [<900287d8>] __do_softirq+0x64/0xe0
>>>  [<9002896a>] do_softirq+0x26/0x48
>>>  [<90028a66>] irq_exit+0x2e/0x64
>>>  [<90019f16>] do_IRQ+0x46/0x5c
>>>  [<90018428>] irq_level0+0x18/0x60
>>>  [<9021cc16>] rest_init+0x72/0x98
>>>  [<9000063c>] start_kernel+0x21c/0x258
>>>  [<00000000>] 0x0
>>>
>>>    Any idea why this happens? I need help!
>>
>>
>> I've spent a few days digging into this and the key apparently is NETIF_F_LLTX.
>>
>> The problem seems to be that HARD_TX_LOCK is called more than once, first for my virtual
>> hsr device and then, recursively, for each of the slaves in turn. (At least that's where
>> lockdep complains - at __netif_tx_lock(), that is.)
>>
>> At first I just could not understand why both the VLAN and the bonding code got away with
>> recursive calls to dev_queue_xmit() but I didn't. After some gooling (a lot, actually) I
>> found some references to the NETIF_F_LLTX flag (here's one:
>> http://lwn.net/Articles/121566/). I realised both VLAN and bonding code set this flag. And
>> sure enough, if I set it for my hsr device lockdep does not complain any more.
>>
>> But NETIF_F_LLTX is described as deprecated in both netdevice.h and in
>> Documentation/networking/netdevices.txt. Is there an alternative solution that I should
>> use instead?
>>
>> (To recap, a hsr device is a virtual device which uses two Ethernet devices as slaves.
>> This gives redundancy with instant failover, and since nodes are connected in a ring
>> topology, uses less cabling than duplication.)
>>
> 
> LLTX is deprecated (ie should not be used) for physical devices.
> 
> Also, for virtual devices, there should be non transmit queue, this
> causes mulit-queue lockless semantics to be preserved as the call passes
> through the virtual device.

(First: apologies for my late reply; your emails doesn't get through to me for some reason.)

So does this mean that it is OK to use LLTX for virtual devices? My virtual device has
zero queue length (no transmit queue), but since it calls dev_queue_xmit for its slaves, I
still get recursive locking if I don't set LLTX (just like vlan and bonding does).

-- 
Arvid Brodin | Consultant (Linux)
XDIN AB | Jan Stenbecks Torg 17 | SE-164 40 Kista | Sweden | xdin.com

^ permalink raw reply

* [PATCH] net/wanrouter: Deprecate and schedule for removal
From: Joe Perches @ 2012-05-24 17:13 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Ben Greear, Jan Ceuleers, netdev
In-Reply-To: <20120524093713.59e3e497@nehalam.linuxnetplumber.net>

No one uses this on current kernels anymore.

Let it be known it's going to be removed eventually.

Signed-off-by: Joe Perches <joe@perches.com>
---
On Thu, 2012-05-24 at 09:37 -0700, Stephen Hemminger wrote:
> And add to Documentation/features-removal. Probably need a year of
> warning period.

feature-removal-schedule.txt needs work,
but OK, here it is.

diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 1e69a81..145cded 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -567,3 +567,9 @@ Why:	Remount currently allows changing bound subsystems and
 	replaced with conventional fsnotify.
 
 ----------------------------
+
+What:	net/wanrouter/
+When:	June 2013
+Why:	Unsupported/unmaintained/unused since 2.6
+
+----------------------------
diff --git a/net/wanrouter/Kconfig b/net/wanrouter/Kconfig
index 61ceae0..a157a2e 100644
--- a/net/wanrouter/Kconfig
+++ b/net/wanrouter/Kconfig
@@ -3,7 +3,7 @@
 #
 
 config WAN_ROUTER
-	tristate "WAN router"
+	tristate "WAN router (DEPRECATED)"
 	depends on EXPERIMENTAL
 	---help---
 	  Wide Area Networks (WANs), such as X.25, frame relay and leased

^ permalink raw reply related

* Re: [RFC] net/hsr: Add support for IEC 62439-3 High-availability Seamless Redundancy
From: Stephen Hemminger @ 2012-05-24 17:16 UTC (permalink / raw)
  To: Arvid Brodin
  Cc: netdev@vger.kernel.org, David S. Miller, Bruno Ferreira,
	Christian Borntraeger, Herbert Xu
In-Reply-To: <4FBE6B5E.3060403@xdin.com>

On Thu, 24 May 2012 17:09:53 +0000
Arvid Brodin <Arvid.Brodin@xdin.com> wrote:

> On 2012-05-14 20:28, Stephen Hemminger wrote:
> > On Mon, 14 May 2012 18:11:44 +0000
> > Arvid Brodin <Arvid.Brodin@xdin.com> wrote:
> > 
> >> On 2012-03-27 15:20, Arvid Brodin wrote:
> >>> Hi!
> >>
> >> *snip*
> >>>
> >>> 2) I have a locking problem that I haven't managed to figure out. This happens
> >>>    the first time I send any packet (hsr_dev_xmit() in hsr_device.c:121, called
> >>>    from hsr_device.c:147). It happens even if I set skb2 to NULL (i.e. only send
> >>>    one copy):
> >>>
> >>> =============================================
> >>> [ INFO: possible recursive locking detected ]
> >>> 2.6.37 #118
> >>> ---------------------------------------------
> >>> swapper/0 is trying to acquire lock:
> >>>  (_xmit_ETHER#2){+.-...}, at: [<901bf38e>] sch_direct_xmit+0x24/0x152
> >>>
> >>> but task is already holding lock:
> >>>  (_xmit_ETHER#2){+.-...}, at: [<901b4d1a>] dev_queue_xmit+0x31e/0x3cc
> >>>
> >>> other info that might help us debug this:
> >>> 4 locks held by swapper/0:
> >>>  #0:  (&n->timer){+.-...}, at: [<9002bc20>] run_timer_softirq+0x98/0x184
> >>>  #1:  (rcu_read_lock_bh){.+....}, at: [<901b49fc>] dev_queue_xmit+0x0/0x3cc
> >>>  #2:  (_xmit_ETHER#2){+.-...}, at: [<901b4d1a>] dev_queue_xmit+0x31e/0x3cc
> >>>  #3:  (rcu_read_lock_bh){.+....}, at: [<901b49fc>] dev_queue_xmit+0x0/0x3cc
> >>>
> >>> stack backtrace:
> >>> Call trace:
> >>>  [<9001c640>] dump_stack+0x18/0x20
> >>>  [<90040eac>] validate_chain+0x40c/0x9ac
> >>>  [<90041a58>] __lock_acquire+0x60c/0x670
> >>>  [<90042f32>] lock_acquire+0x3a/0x48
> >>>  [<902201a4>] _raw_spin_lock+0x20/0x44
> >>>  [<901bf38e>] sch_direct_xmit+0x24/0x152
> >>>  [<901b4c14>] dev_queue_xmit+0x218/0x3cc
> >>>  [<9021c2e0>] slave_xmit+0x10/0x14
> >>>  [<9021c540>] hsr_dev_xmit+0x88/0x8c
> >>>  [<901b4942>] dev_hard_start_xmit+0x3c6/0x480
> >>>  [<901b4d34>] dev_queue_xmit+0x338/0x3cc
> >>>  [<901e3cd8>] arp_xmit+0x8/0xc
> >>>  [<901e4436>] arp_send+0x2a/0x2c
> >>>  [<901e4e74>] arp_solicit+0x15c/0x170
> >>>  [<901bad0c>] neigh_timer_handler+0x1c0/0x204
> >>>  [<9002bc8a>] run_timer_softirq+0x102/0x184
> >>>  [<900287d8>] __do_softirq+0x64/0xe0
> >>>  [<9002896a>] do_softirq+0x26/0x48
> >>>  [<90028a66>] irq_exit+0x2e/0x64
> >>>  [<90019f16>] do_IRQ+0x46/0x5c
> >>>  [<90018428>] irq_level0+0x18/0x60
> >>>  [<9021cc16>] rest_init+0x72/0x98
> >>>  [<9000063c>] start_kernel+0x21c/0x258
> >>>  [<00000000>] 0x0
> >>>
> >>>    Any idea why this happens? I need help!
> >>
> >>
> >> I've spent a few days digging into this and the key apparently is NETIF_F_LLTX.
> >>
> >> The problem seems to be that HARD_TX_LOCK is called more than once, first for my virtual
> >> hsr device and then, recursively, for each of the slaves in turn. (At least that's where
> >> lockdep complains - at __netif_tx_lock(), that is.)
> >>
> >> At first I just could not understand why both the VLAN and the bonding code got away with
> >> recursive calls to dev_queue_xmit() but I didn't. After some gooling (a lot, actually) I
> >> found some references to the NETIF_F_LLTX flag (here's one:
> >> http://lwn.net/Articles/121566/). I realised both VLAN and bonding code set this flag. And
> >> sure enough, if I set it for my hsr device lockdep does not complain any more.
> >>
> >> But NETIF_F_LLTX is described as deprecated in both netdevice.h and in
> >> Documentation/networking/netdevices.txt. Is there an alternative solution that I should
> >> use instead?
> >>
> >> (To recap, a hsr device is a virtual device which uses two Ethernet devices as slaves.
> >> This gives redundancy with instant failover, and since nodes are connected in a ring
> >> topology, uses less cabling than duplication.)
> >>
> > 
> > LLTX is deprecated (ie should not be used) for physical devices.
> > 
> > Also, for virtual devices, there should be non transmit queue, this
> > causes mulit-queue lockless semantics to be preserved as the call passes
> > through the virtual device.
> 
> (First: apologies for my late reply; your emails doesn't get through to me for some reason.)
> 
> So does this mean that it is OK to use LLTX for virtual devices? My virtual device has
> zero queue length (no transmit queue), but since it calls dev_queue_xmit for its slaves, I
> still get recursive locking if I don't set LLTX (just like vlan and bonding does).

Yes LLTX is fine for virtual devices.

^ permalink raw reply

* Re: [RFC PATCH] tcp: Fast/early SYN handling to mitigate SYN floods
From: Jesper Dangaard Brouer @ 2012-05-24 17:21 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: christoph.paasch, David Miller, Martin Topholm, netdev,
	Tom Herbert
In-Reply-To: <1337871077.3140.12.camel@edumazet-glaptop>

On Thu, 2012-05-24 at 16:51 +0200, Eric Dumazet wrote:
> On Thu, 2012-05-24 at 15:26 +0200, Christoph Paasch wrote:
> > Hello,
> > 
> > On 05/24/2012 03:01 PM, Jesper Dangaard Brouer wrote:
> > > I have been doing some TCP performance measurements with SYN flooding,
> > > and have found that, we don't handle this case well.
> > > 
> > > I have made a patch for fast/early SYN handling in tcp_v4_rcv() in
> > > net/ipv4/tcp_ipv4.c.  This increases SYN performance from 130 kpps to
> > > 750 kpps (max of the generator), with idle CPU cycles.
> > > 
> > > Current locking:
> > >  During a SYN flood (against a single port) all CPUs are spinning on
> > > the same spinlock, namely bh_lock_sock_nested(sk), in tcp_ipv4.c.  The
> > > lock dates back to a commit by DaveM in May 1999, see historic
> > > commit[1].  It seem that TCP runs fully locked, per sock.
> > > 
> > > I need some help with locking, as the patch seems to work fine, with
> > > NO-PREEMPT, but with PREEMPT enabled I start to see warnings (in
> > > reqsk_queue_destroy) and oopses (in inet_csk_reqsk_queue_prune).
> > > 
> > > What am I missing?
> > 
> > For each retransmission of a SYN you will add a request-sock to the
> > syn_table, because you do not pass by tcp_v4_hnd_req(), which checks
> > this by calling inet_csk_search_req().

Thanks that's good hint.  I was suspecting that tcp_v4_hnd_req() was
somehow needed (as noted in the comment in the patch)

> > And your warning in reqsk_queue_destroy is because the access to the the
> > request_sock_queue is no more protected by a lock.

Yes, I was suspecting that.

> > The request_sock_queue is a shared resource, which must be protect by a
> > lock. As you allow "parallel" SYN-processing, the queue will get corrupted.
> > 
> 
> Hi guys, that's a very interesting subject.
> 
> I began work on fully converting this stuff to RCU some weeks ago but
> got distracted by codel / fq_codel and other cool stuff (TCP coalescing
> and skb->frag_head)
> 
> I dont know if you remember the SO_REUSEPORT patch(s) posted by Tom
> Herbert in the past. The remaining issue was about adding/removing a new
> listener to a pool of listeners to same port, and hash function was
> changed so we could lost some connexions in SYN_RECV state at this
> stage.

Sorry, don't remember.

> So I was working having a shared table, and not anymore using a central
> spinlock, but an array of spinlock, as done elsewhere
> (ESTABLISHED/TIMEWAIT hash tables)
> 
> My work is probably a ~500 LOC target, allowing concurrent processing by
> all cpus of the host.

Sounds really promising, especially coming from the network-ninja :-)


> Jesper, my goals are probably different than yours, unless I
> misunderstood your intention.
> 
> I feel you want to have an emergency mode, when listener is overflowed
> to immediately send a SYNCOOKIE ?

Yes, this is more an emergency mode.

I was thinking of only handling the SYN cookie case in parallel.
That should be easier locking wise, right.

I'm also considering writing a netfilter/iptables syn-cookie module, as
this would allow people to use it in combination with IPset, to e.g
create a whitelist feature of known-good-hosts (which have completed the
TCP handshake). But it would be nicer if the base kernel was just fast
enough to handle these SYN floods.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Sr. Network Kernel Developer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply

* Re: [RFC PATCH] tcp: Fast/early SYN handling to mitigate SYN floods
From: Eric Dumazet @ 2012-05-24 17:27 UTC (permalink / raw)
  To: Jesper Dangaard Brouer
  Cc: christoph.paasch, David Miller, Martin Topholm, netdev,
	Tom Herbert
In-Reply-To: <1337880065.2388.15.camel@localhost>

On Thu, 2012-05-24 at 19:21 +0200, Jesper Dangaard Brouer wrote:

> Sorry, don't remember.

http://kerneltrap.org/mailarchive/linux-netdev/2010/4/19/6274993

> Sounds really promising, especially coming from the network-ninja :-)

;)

> Yes, this is more an emergency mode.
> 
> I was thinking of only handling the SYN cookie case in parallel.
> That should be easier locking wise, right.
> 
> I'm also considering writing a netfilter/iptables syn-cookie module, as
> this would allow people to use it in combination with IPset, to e.g
> create a whitelist feature of known-good-hosts (which have completed the
> TCP handshake). But it would be nicer if the base kernel was just fast
> enough to handle these SYN floods.
> 

Indeed, I believe I can make this happen eventually in a short term.

^ permalink raw reply

* Re: [RFC PATCH] tcp: Fast/early SYN handling to mitigate SYN floods
From: Jesper Dangaard Brouer @ 2012-05-24 17:32 UTC (permalink / raw)
  To: Hans Schillstrom; +Cc: Eric Dumazet, David Miller, Martin Topholm, netdev
In-Reply-To: <201205241529.37684.hans.schillstrom@ericsson.com>

On Thu, 2012-05-24 at 15:20 +0200, Hans Schillstrom wrote:
> Hi Jesper
> We are also working with this issue right now,
> 
[..] 
> > [RFC PATCH] tcp: Fast/early SYN handling to mitigate SYN floods
> > 
> > TCP SYN handling is on the slow path via tcp_v4_rcv(), and is
> > performed while holding spinlock bh_lock_sock().
> > 
> > Real-life and testlab experiments show, that the kernel choks
> > when reaching 130Kpps SYN floods (powerful Nehalem 16 cores).
> > Measuring with perf reveals, that its caused by
> > bh_lock_sock_nested() call in tcp_v4_rcv().
> 
> I can confirm this too, and it doesn't scale with more cores
> 
> > 
> > With this patch, the machine can handle 750Kpps (max of the SYN
> > flood generator) with cycles to spare.
>
> This looks great.

Yes, its definitely shows that there is huge performance gain hidden
here! But we still have to handle locking (which will affect perf).

> I'm also working with a solution that not trash conntack
> i.e. have conntrack working during a heavy SYN attack

Sounds interesting, but that's a separate problem.  In this case I have
disabled conntracking (I even disabled flow-control and drop the syn-ack
responses on the generator).

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Sr. Network Kernel Developer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply

* Re: [PATCH] gianfar:don't add FCB length to hard_header_len
From: Jan Ceuleers @ 2012-05-24 18:03 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Miller, b06378, netdev, linuxppc-dev
In-Reply-To: <1337876210.5070.4.camel@joe2Laptop>

On 05/24/2012 06:16 PM, Joe Perches wrote:
> On Thu, 2012-05-24 at 17:04 +0200, Jan Ceuleers wrote:
>> On 05/22/2012 09:18 PM, David Miller wrote:
>>> Someone needs to go through this driver when net-next opens up
>>> and fix all of the indentation in this driver.
>>
>> May I give that a go?
> 
> I have scripts that automate most of this.
> I don't have the card though.
> 
> Maybe this is a starting point?
> It doesn't fix most 80 column warnings.

Thanks Joe.

I also don't have the card; the kinds of changes I was proposing to make
are code-neutral, whose correctness I was intending to prove by a binary
compare of the before-and-after .o.

Still happy to do that taking your contribution as a starting point.

Thanks, Jan

^ permalink raw reply

* Re: [PATCH IPROUTE2] tc-codel: Add manpage
From: Vijay Subramanian @ 2012-05-24 18:19 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, Stephen Hemminger, Dave Taht
In-Reply-To: <1337835239.3361.3954.camel@edumazet-glaptop>

>> +.SS target
>> +Default and recommended value is 5ms.
>
> Although I can tell I prefer lower values on hosts.
>
> On 10Gbe links, I used 500us target
>
>> +.SS interval
>> +give endpoints sufficient time to react.  Default value is 100ms.
>
> Same here. In a datacenter, you might reduce this to 20ms or so...
>

Thanks for the insight. The paper does claim that codel can be run
with the same setting, regardless of link rate.
I guess reality is different.

Thanks,
Vijay

^ permalink raw reply

* Re: [PATCH IPROUTE2] tc-codel: Add manpage
From: Dave Taht @ 2012-05-24 18:28 UTC (permalink / raw)
  To: Vijay Subramanian; +Cc: Eric Dumazet, netdev, Stephen Hemminger
In-Reply-To: <CAGK4HS8_O94rQZmvxeNjeYtbT3_a2C1FsZ9O=b9_n0vV2putdA@mail.gmail.com>

well, it would be nice if codel could sense it was on 10gigE or
greater, and self adjust.

On Thu, May 24, 2012 at 7:19 PM, Vijay Subramanian
<subramanian.vijay@gmail.com> wrote:
>>> +.SS target
>>> +Default and recommended value is 5ms.
>>
>> Although I can tell I prefer lower values on hosts.
>>
>> On 10Gbe links, I used 500us target
>>
>>> +.SS interval
>>> +give endpoints sufficient time to react.  Default value is 100ms.
>>
>> Same here. In a datacenter, you might reduce this to 20ms or so...
>>
>
> Thanks for the insight. The paper does claim that codel can be run
> with the same setting, regardless of link rate.
> I guess reality is different.
>
> Thanks,
> Vijay



-- 
Dave Täht
SKYPE: davetaht
US Tel: 1-239-829-5608
http://www.bufferbloat.net

^ permalink raw reply

* [PATCH net-next 0/2] qlcnic: Bug fixes
From: Anirban Chakraborty @ 2012-05-24 18:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver

Please apply to net-next.

Thanks,
Anirban

^ permalink raw reply

* [PATCH 2/2] qlcnic: Fix unsupported CDRP command error message.
From: Anirban Chakraborty @ 2012-05-24 18:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Jitendra Kalsaria
In-Reply-To: <1337882816-2097-1-git-send-email-anirban.chakraborty@qlogic.com>

From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>

- Added proper error messages for unsupported FW commands
- Bumped up version to 5.0.29

Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h     |    8 ++++-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c |   34 +++++++++++++++++++---
 2 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 520ff03..eaa1db9 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -36,8 +36,8 @@
 
 #define _QLCNIC_LINUX_MAJOR 5
 #define _QLCNIC_LINUX_MINOR 0
-#define _QLCNIC_LINUX_SUBVERSION 28
-#define QLCNIC_LINUX_VERSIONID  "5.0.28"
+#define _QLCNIC_LINUX_SUBVERSION 29
+#define QLCNIC_LINUX_VERSIONID  "5.0.29"
 #define QLCNIC_DRV_IDC_VER  0x01
 #define QLCNIC_DRIVER_VERSION  ((_QLCNIC_LINUX_MAJOR << 16) |\
 		 (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
@@ -612,7 +612,11 @@ struct qlcnic_recv_context {
 #define QLCNIC_CDRP_CMD_GET_MAC_STATS		0x00000037
 
 #define QLCNIC_RCODE_SUCCESS		0
+#define QLCNIC_RCODE_INVALID_ARGS	6
 #define QLCNIC_RCODE_NOT_SUPPORTED	9
+#define QLCNIC_RCODE_NOT_PERMITTED	10
+#define QLCNIC_RCODE_NOT_IMPL		15
+#define QLCNIC_RCODE_INVALID		16
 #define QLCNIC_RCODE_TIMEOUT		17
 #define QLCNIC_DESTROY_CTX_RESET	0
 
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index cfa174d..b8ead69 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -53,12 +53,39 @@ qlcnic_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd)
 	rsp = qlcnic_poll_rsp(adapter);
 
 	if (rsp == QLCNIC_CDRP_RSP_TIMEOUT) {
-		dev_err(&pdev->dev, "card response timeout.\n");
+		dev_err(&pdev->dev, "CDRP response timeout.\n");
 		cmd->rsp.cmd = QLCNIC_RCODE_TIMEOUT;
 	} else if (rsp == QLCNIC_CDRP_RSP_FAIL) {
 		cmd->rsp.cmd = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
-		dev_err(&pdev->dev, "failed card response code:0x%x\n",
+		switch (cmd->rsp.cmd) {
+		case QLCNIC_RCODE_INVALID_ARGS:
+			dev_err(&pdev->dev, "CDRP invalid args: 0x%x.\n",
 				cmd->rsp.cmd);
+			break;
+		case QLCNIC_RCODE_NOT_SUPPORTED:
+		case QLCNIC_RCODE_NOT_IMPL:
+			dev_err(&pdev->dev,
+				"CDRP command not supported: 0x%x.\n",
+				cmd->rsp.cmd);
+			break;
+		case QLCNIC_RCODE_NOT_PERMITTED:
+			dev_err(&pdev->dev,
+				"CDRP requested action not permitted: 0x%x.\n",
+				cmd->rsp.cmd);
+			break;
+		case QLCNIC_RCODE_INVALID:
+			dev_err(&pdev->dev,
+				"CDRP invalid or unknown cmd received: 0x%x.\n",
+				cmd->rsp.cmd);
+			break;
+		case QLCNIC_RCODE_TIMEOUT:
+			dev_err(&pdev->dev, "CDRP command timeout: 0x%x.\n",
+				cmd->rsp.cmd);
+			break;
+		default:
+			dev_err(&pdev->dev, "CDRP command failed: 0x%x.\n",
+				cmd->rsp.cmd);
+		}
 	} else if (rsp == QLCNIC_CDRP_RSP_OK) {
 		cmd->rsp.cmd = QLCNIC_RCODE_SUCCESS;
 		if (cmd->rsp.arg2)
@@ -957,9 +984,6 @@ int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter,
 		mac_stats->mac_rx_jabber = le64_to_cpu(stats->mac_rx_jabber);
 		mac_stats->mac_rx_dropped = le64_to_cpu(stats->mac_rx_dropped);
 		mac_stats->mac_rx_crc_error = le64_to_cpu(stats->mac_rx_crc_error);
-	} else {
-		dev_info(&adapter->pdev->dev,
-			"%s: Get mac stats failed =%d.\n", __func__, err);
 	}
 
 	dma_free_coherent(&adapter->pdev->dev, stats_size, stats_addr,
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH v6 0/3] netdev/of/phy: MDIO bus multiplexer support.
From: Timur Tabi @ 2012-05-24 18:28 UTC (permalink / raw)
  To: David Daney
  Cc: devicetree-discuss@lists.ozlabs.org, netdev@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <4FB6CBF1.40300@gmail.com>

David Daney wrote:
> Yes.  You may note in the DTS file I attached in the parent (sorry for 
> the fubar mime types), that there are two, almost identical, MDIO 
> masters.  smi0 has two directly attached PHYs.  smi1 goes to the mux, 
> and each child of the mux has four attached PHYs.

I'm till have trouble understanding all this.  I'm just hacking things up
in order to help me understand it, but it's a slow and painful process.

This call in mdio_mux_init() is failing:

	parent_bus = of_mdio_find_bus(parent_bus_node);

It returns NULL.  Here is my MDIO node:

		fman0: fman@400000 {
			enet0: ethernet@e0000 {
				tbi-handle = <&tbi0>;
				phy-handle = <&phy0>;
				phy-connection-type = "sgmii";
			};

			mdio0: mdio@e1120 {
				gpios = <&gpio0 0 0
					 &gpio0 1 0>;

				tbi0: tbi-phy@8 {
					reg = <0x8>;
					device_type = "tbi-phy";
				};

				phy0: ethernet-phy@1c {
					reg = <0x1c>;
				};
			};
		};

What am I missing?  What do I need to do in order to get
of_mdio_find_bus() to return a real value?

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* [PATCH 1/2] qlcnic: Fix estimation of recv MSS in case of LRO
From: Anirban Chakraborty @ 2012-05-24 18:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Rajesh Borundia
In-Reply-To: <1337882816-2097-1-git-send-email-anirban.chakraborty@qlogic.com>

From: Rajesh Borundia <rajesh.borundia@qlogic.com>

o Linux stack estimates MSS from skb->len or skb_shinfo(skb)->gso_size.
In case of LRO skb->len is aggregate of len of number of packets hence MSS
obtained using skb->len would be incorrect. Incorrect estimation of recv MSS
would lead to delayed acks in some traffic patterns (which sends two or three
packets and wait for ack and only then send remaining packets). This leads to
drop in performance. Hence we need to set gso_size to MSS obtained from firmware.

o This is fixed recently in firmware hence the MSS is obtained based on
capability. If fw is capable of sending the MSS then only driver sets the gso_size.

Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h      |    7 +++++++
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c  |    3 +++
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h  |    1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c |    3 +++
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |    9 +++++++++
 5 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 8680a5d..520ff03 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -258,6 +258,8 @@ struct rcv_desc {
 	(((sts_data) >> 52) & 0x1)
 #define qlcnic_get_lro_sts_seq_number(sts_data)		\
 	((sts_data) & 0x0FFFFFFFF)
+#define qlcnic_get_lro_sts_mss(sts_data1)		\
+	((sts_data1 >> 32) & 0x0FFFF)
 
 
 struct status_desc {
@@ -623,6 +625,7 @@ struct qlcnic_recv_context {
 #define QLCNIC_CAP0_JUMBO_CONTIGUOUS	(1 << 7)
 #define QLCNIC_CAP0_LRO_CONTIGUOUS	(1 << 8)
 #define QLCNIC_CAP0_VALIDOFF		(1 << 11)
+#define QLCNIC_CAP0_LRO_MSS		(1 << 21)
 
 /*
  * Context state
@@ -829,6 +832,9 @@ struct qlcnic_mac_list_s {
 #define QLCNIC_FW_CAPABILITY_FVLANTX		BIT_9
 #define QLCNIC_FW_CAPABILITY_HW_LRO		BIT_10
 #define QLCNIC_FW_CAPABILITY_MULTI_LOOPBACK	BIT_27
+#define QLCNIC_FW_CAPABILITY_MORE_CAPS		BIT_31
+
+#define QLCNIC_FW_CAPABILITY_2_LRO_MAX_TCP_SEG	BIT_2
 
 /* module types */
 #define LINKEVENT_MODULE_NOT_PRESENT			1
@@ -918,6 +924,7 @@ struct qlcnic_ipaddr {
 #define QLCNIC_NEED_FLR			0x1000
 #define QLCNIC_FW_RESET_OWNER		0x2000
 #define QLCNIC_FW_HANG			0x4000
+#define QLCNIC_FW_LRO_MSS_CAP		0x8000
 #define QLCNIC_IS_MSI_FAMILY(adapter) \
 	((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED))
 
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index 8db8524..cfa174d 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -237,6 +237,9 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
 						| QLCNIC_CAP0_VALIDOFF);
 	cap |= (QLCNIC_CAP0_JUMBO_CONTIGUOUS | QLCNIC_CAP0_LRO_CONTIGUOUS);
 
+	if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP)
+		cap |= QLCNIC_CAP0_LRO_MSS;
+
 	prq->valid_field_offset = offsetof(struct qlcnic_hostrq_rx_ctx,
 							 msix_handler);
 	prq->txrx_sds_binding = nsds_rings - 1;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h
index 6ced319..28a6b28 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h
@@ -588,6 +588,7 @@ enum {
 #define CRB_DRIVER_VERSION		(QLCNIC_REG(0x2a0))
 
 #define CRB_FW_CAPABILITIES_1		(QLCNIC_CAM_RAM(0x128))
+#define CRB_FW_CAPABILITIES_2		(QLCNIC_CAM_RAM(0x12c))
 #define CRB_MAC_BLOCK_START		(QLCNIC_CAM_RAM(0x1c0))
 
 /*
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
index d32cf0d..f5a0ddc 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
@@ -1654,6 +1654,9 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
 
 	length = skb->len;
 
+	if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP)
+		skb_shinfo(skb)->gso_size = qlcnic_get_lro_sts_mss(sts_data1);
+
 	if (vid != 0xffff)
 		__vlan_hwaccel_put_tag(skb, vid);
 	netif_receive_skb(skb);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 46e77a2..707b5ca 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -1136,6 +1136,8 @@ static int
 __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev)
 {
 	int ring;
+	u32 capab2;
+
 	struct qlcnic_host_rds_ring *rds_ring;
 
 	if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC)
@@ -1146,6 +1148,12 @@ __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev)
 	if (qlcnic_set_eswitch_port_config(adapter))
 		return -EIO;
 
+	if (adapter->capabilities & QLCNIC_FW_CAPABILITY_MORE_CAPS) {
+		capab2 = QLCRD32(adapter, CRB_FW_CAPABILITIES_2);
+		if (capab2 & QLCNIC_FW_CAPABILITY_2_LRO_MAX_TCP_SEG)
+			adapter->flags |= QLCNIC_FW_LRO_MSS_CAP;
+	}
+
 	if (qlcnic_fw_create_ctx(adapter))
 		return -EIO;
 
@@ -1215,6 +1223,7 @@ __qlcnic_down(struct qlcnic_adapter *adapter, struct net_device *netdev)
 	qlcnic_napi_disable(adapter);
 
 	qlcnic_fw_destroy_ctx(adapter);
+	adapter->flags &= ~QLCNIC_FW_LRO_MSS_CAP;
 
 	qlcnic_reset_rx_buffers_list(adapter);
 	qlcnic_release_tx_buffers(adapter);
-- 
1.7.1

^ permalink raw reply related

* [PATCH IPROUTE2] tc-codel: Update usage text
From: Vijay Subramanian @ 2012-05-24 18:48 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Eric Dumazet, Dave Taht, Vijay Subramanian

codel can take 'noecn' as an option. This also makes it consistent with the
manpage.

Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
---
 tc/q_codel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tc/q_codel.c b/tc/q_codel.c
index 826285a..dc4b3f6 100644
--- a/tc/q_codel.c
+++ b/tc/q_codel.c
@@ -54,7 +54,7 @@
 static void explain(void)
 {
 	fprintf(stderr, "Usage: ... codel [ limit PACKETS ] [ target TIME]\n");
-	fprintf(stderr, "                 [ interval TIME ] [ ecn ]\n");
+	fprintf(stderr, "                 [ interval TIME ] [ ecn | noecn ]\n");
 }
 
 static int codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
-- 
1.7.0.4

^ permalink raw reply related

* Re: [PATCH v6 0/3] netdev/of/phy: MDIO bus multiplexer support.
From: David Daney @ 2012-05-24 18:50 UTC (permalink / raw)
  To: Timur Tabi
  Cc: devicetree-discuss@lists.ozlabs.org, netdev@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <4FBE7DD8.509@freescale.com>

On 05/24/2012 11:28 AM, Timur Tabi wrote:
> David Daney wrote:
>> Yes.  You may note in the DTS file I attached in the parent (sorry for
>> the fubar mime types), that there are two, almost identical, MDIO
>> masters.  smi0 has two directly attached PHYs.  smi1 goes to the mux,
>> and each child of the mux has four attached PHYs.
>
> I'm till have trouble understanding all this.  I'm just hacking things up
> in order to help me understand it, but it's a slow and painful process.
>
> This call in mdio_mux_init() is failing:
>
> 	parent_bus = of_mdio_find_bus(parent_bus_node);
>

Well, the MDIO bus must have an associated device tree node.

For my OCTEON code, the MDIO bus device is created as a result of the 
call to of_platform_bus_probe(), which takes care of filling in all the 
device tree nodes of the devices it finds and creates.

> It returns NULL.  Here is my MDIO node:
>
> 		fman0: fman@400000 {
> 			enet0: ethernet@e0000 {
> 				tbi-handle =<&tbi0>;
> 				phy-handle =<&phy0>;
> 				phy-connection-type = "sgmii";
> 			};
>
> 			mdio0: mdio@e1120 {
> 				gpios =<&gpio0 0 0
> 					&gpio0 1 0>;
>
> 				tbi0: tbi-phy@8 {
> 					reg =<0x8>;
> 					device_type = "tbi-phy";
> 				};
>
> 				phy0: ethernet-phy@1c {
> 					reg =<0x1c>;
> 				};
> 			};
> 		};
>
> What am I missing?

For starters, I do not see any compatible properties that would allow 
the proper drivers to be bound to anything.

Also I see no MDIO mux node there, so it is unclear why you are even 
asking these questions.

David Daney

^ permalink raw reply

* Re: [PATCH v6 0/3] netdev/of/phy: MDIO bus multiplexer support.
From: Timur Tabi @ 2012-05-24 19:03 UTC (permalink / raw)
  To: David Daney
  Cc: devicetree-discuss@lists.ozlabs.org, netdev@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <4FBE82F2.6080100@gmail.com>

David Daney wrote:

> Well, the MDIO bus must have an associated device tree node.
> 
> For my OCTEON code, the MDIO bus device is created as a result of the 
> call to of_platform_bus_probe(), which takes care of filling in all the 
> device tree nodes of the devices it finds and creates.

Ok, let me give you some background.  We actually already have MDIO muxing
code in-house, but it's different from yours.  So now I'm rewriting it to
use your design instead.

So our current code looks for "virtual MDIO nodes", and we call
mdiobus_alloc() and then of_mdiobus_register().  I think this is what I'm
missing now.

I just don't know what to do next.  Part of the problem is that I don't
have much experience with MDIO drivers.

>> It returns NULL.  Here is my MDIO node:
>>
>> 		fman0: fman@400000 {
>> 			enet0: ethernet@e0000 {
>> 				tbi-handle =<&tbi0>;
>> 				phy-handle =<&phy0>;
>> 				phy-connection-type = "sgmii";
>> 			};
>>
>> 			mdio0: mdio@e1120 {
>> 				gpios =<&gpio0 0 0
>> 					&gpio0 1 0>;
>>
>> 				tbi0: tbi-phy@8 {
>> 					reg =<0x8>;
>> 					device_type = "tbi-phy";
>> 				};
>>
>> 				phy0: ethernet-phy@1c {
>> 					reg =<0x1c>;
>> 				};
>> 			};
>> 		};
>>
>> What am I missing?
> 
> For starters, I do not see any compatible properties that would allow 
> the proper drivers to be bound to anything.

Ok, that makes sense.

> Also I see no MDIO mux node there, so it is unclear why you are even 
> asking these questions.

I only gave you part of the device tree.  Here's my mdio mux node:

	mdio-mux {
		compatible = "mdio-mux-gpio";
		gpios = <&gpio0 0 0>, <&gpio0 1 0>;
		mdio-parent-bus = <&mdio0>;
		#address-cells = <1>;
		#size-cells = <0>;

		mdio@2 {
			reg = <2>;
			#address-cells = <1>;
			#size-cells = <0>;

			phy21: ethernet-phy@1 {
				reg = <1>;
//				compatible = "marvell,88e1149r", "ethernet-phy-ieee802.3-c22";
				marvell,reg-init = <3 0x10 0 0x5777>,
					<3 0x11 0 0x00aa>,
					<3 0x12 0 0x4105>,
					<3 0x13 0 0x0a60>;
				interrupt-parent = <&gpio0>;
//				interrupts = <10 8>; /* Pin 10, active low */
			};
		};
	};
};




> 
> David Daney
> 


-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* Re: [PATCH v6 0/3] netdev/of/phy: MDIO bus multiplexer support.
From: David Daney @ 2012-05-24 19:19 UTC (permalink / raw)
  To: Timur Tabi
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
In-Reply-To: <4FBE8605.2020507-KZfg59tc24xl57MIdRCFDg@public.gmane.org>

On 05/24/2012 12:03 PM, Timur Tabi wrote:
> David Daney wrote:
>
>> Well, the MDIO bus must have an associated device tree node.
>>
>> For my OCTEON code, the MDIO bus device is created as a result of the
>> call to of_platform_bus_probe(), which takes care of filling in all the
>> device tree nodes of the devices it finds and creates.
>
> Ok, let me give you some background.  We actually already have MDIO muxing
> code in-house, but it's different from yours.  So now I'm rewriting it to
> use your design instead.
>
> So our current code looks for "virtual MDIO nodes", and we call
> mdiobus_alloc() and then of_mdiobus_register().  I think this is what I'm
> missing now.
>
> I just don't know what to do next.

You will have to debug it and find out why the device match is failing, 
then fix it.

David Daney

^ 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