All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes
@ 2007-04-02  0:11 Stefan Richter
  2007-04-02  0:12 ` [PATCH linux1394-2.6.git 01/15] ieee1394: eth1394: coding style Stefan Richter
                   ` (14 more replies)
  0 siblings, 15 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:11 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

01/15 ieee1394: eth1394: coding style
02/15 ieee1394: eth1394: .probe and .update may sleep
03/15 ieee1394: eth1394: refactor .probe and .update
04/15 ieee1394: eth1394: correct a memset argument
05/15 ieee1394: eth1394: shorter error messages
06/15 ieee1394: eth1394: contain host reset
07/15 ieee1394: eth1394: make MTU configurable
08/15 ieee1394: eth1394: CONFIG_INET is always defined
09/15 ieee1394: eth1394: omit useless set_mac_address callback
10/15 ieee1394: eth1394: don't use alloc_etherdev
11/15 ieee1394: eth1394: clean up fragment_overlap
12/15 ieee1394: eth1394: some conditions are unlikely
13/15 ieee1394: eth1394: hard_start_xmit is called in atomic context
14/15 ieee1394: eth1394: correct return codes in hard_start_xmit
15/15 ieee1394: eth1394: check for kmem_cache_create failure

 drivers/ieee1394/eth1394.c |  603 ++++++++++++++++---------------------
 drivers/ieee1394/eth1394.h |   24 -
 2 files changed, 268 insertions(+), 359 deletions(-)

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 01/15] ieee1394: eth1394: coding style
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
@ 2007-04-02  0:12 ` Stefan Richter
  2007-04-02  0:13 ` [PATCH linux1394-2.6.git 02/15] ieee1394: eth1394: .probe and .update may sleep Stefan Richter
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:12 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Adjust white space and line wraps.  Remove unnecessary parentheses and
braces, unused macros, and some of the more redundant comments.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |  426 +++++++++++++++++--------------------
 drivers/ieee1394/eth1394.h |   24 --
 2 files changed, 206 insertions(+), 244 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -1,5 +1,5 @@
 /*
- * eth1394.c -- Ethernet driver for Linux IEEE-1394 Subsystem
+ * eth1394.c -- IPv4 driver for Linux IEEE-1394 Subsystem
  *
  * Copyright (C) 2001-2003 Ben Collins <bcollins@debian.org>
  *               2000 Bonin Franck <boninf@free.fr>
@@ -22,10 +22,9 @@
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-/* This driver intends to support RFC 2734, which describes a method for
- * transporting IPv4 datagrams over IEEE-1394 serial busses. This driver
- * will ultimately support that method, but currently falls short in
- * several areas.
+/*
+ * This driver intends to support RFC 2734, which describes a method for
+ * transporting IPv4 datagrams over IEEE-1394 serial busses.
  *
  * TODO:
  * RFC 2734 related:
@@ -40,7 +39,6 @@
  * - Consider garbage collecting old partial datagrams after X amount of time
  */
 
-
 #include <linux/module.h>
 
 #include <linux/kernel.h>
@@ -84,10 +82,6 @@
 #define ETH1394_PRINT(level, dev_name, fmt, args...) \
 	printk(level "%s: %s: " fmt, driver_name, dev_name, ## args)
 
-#define DEBUG(fmt, args...) \
-	printk(KERN_ERR "%s:%s[%d]: " fmt "\n", driver_name, __FUNCTION__, __LINE__, ## args)
-#define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
-
 struct fragment_info {
 	struct list_head list;
 	int offset;
@@ -105,9 +99,9 @@ struct partial_datagram {
 };
 
 struct pdg_list {
-	struct list_head list;		/* partial datagram list per node	*/
-	unsigned int sz;		/* partial datagram list size per node	*/
-	spinlock_t lock;		/* partial datagram lock		*/
+	struct list_head list;	/* partial datagram list per node	*/
+	unsigned int sz;	/* partial datagram list size per node	*/
+	spinlock_t lock;	/* partial datagram lock		*/
 };
 
 struct eth1394_host_info {
@@ -121,16 +115,14 @@ struct eth1394_node_ref {
 };
 
 struct eth1394_node_info {
-	u16 maxpayload;			/* Max payload			*/
-	u8 sspd;			/* Max speed			*/
-	u64 fifo;			/* FIFO address			*/
-	struct pdg_list pdg;		/* partial RX datagram lists	*/
-	int dgl;			/* Outgoing datagram label	*/
+	u16 maxpayload;		/* max payload			*/
+	u8 sspd;		/* max speed			*/
+	u64 fifo;		/* FIFO address			*/
+	struct pdg_list pdg;	/* partial RX datagram lists	*/
+	int dgl;		/* outgoing datagram label	*/
 };
 
-/* Our ieee1394 highlevel driver */
-#define ETH1394_DRIVER_NAME "eth1394"
-static const char driver_name[] = ETH1394_DRIVER_NAME;
+static const char driver_name[] = "eth1394";
 
 static struct kmem_cache *packet_task_cache;
 
@@ -138,15 +130,12 @@ static struct hpsb_highlevel eth1394_hig
 
 /* Use common.lf to determine header len */
 static const int hdr_type_len[] = {
-	sizeof (struct eth1394_uf_hdr),
-	sizeof (struct eth1394_ff_hdr),
-	sizeof (struct eth1394_sf_hdr),
-	sizeof (struct eth1394_sf_hdr)
+	sizeof(struct eth1394_uf_hdr),
+	sizeof(struct eth1394_ff_hdr),
+	sizeof(struct eth1394_sf_hdr),
+	sizeof(struct eth1394_sf_hdr)
 };
 
-/* Change this to IEEE1394_SPEED_S100 to make testing easier */
-#define ETH1394_SPEED_DEF	IEEE1394_SPEED_MAX
-
 /* For now, this needs to be 1500, so that XP works with us */
 #define ETH1394_DATA_LEN	ETH_DATA_LEN
 
@@ -159,7 +148,8 @@ MODULE_AUTHOR("Ben Collins (bcollins@deb
 MODULE_DESCRIPTION("IEEE 1394 IPv4 Driver (IPv4-over-1394 as per RFC 2734)");
 MODULE_LICENSE("GPL");
 
-/* The max_partial_datagrams parameter is the maximum number of fragmented
+/*
+ * The max_partial_datagrams parameter is the maximum number of fragmented
  * datagrams per node that eth1394 will keep in memory.  Providing an upper
  * bound allows us to limit the amount of memory that partial datagrams
  * consume in the event that some partial datagrams are never completed.
@@ -179,10 +169,9 @@ static int ether1394_header_parse(struct
 static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh);
 static void ether1394_header_cache_update(struct hh_cache *hh,
 					  struct net_device *dev,
-					  unsigned char * haddr);
+					  unsigned char *haddr);
 static int ether1394_mac_addr(struct net_device *dev, void *p);
 
-static void purge_partial_datagram(struct list_head *old);
 static int ether1394_tx(struct sk_buff *skb, struct net_device *dev);
 static void ether1394_iso(struct hpsb_iso *iso);
 
@@ -190,9 +179,9 @@ static struct ethtool_ops ethtool_ops;
 
 static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
 			   quadlet_t *data, u64 addr, size_t len, u16 flags);
-static void ether1394_add_host (struct hpsb_host *host);
-static void ether1394_remove_host (struct hpsb_host *host);
-static void ether1394_host_reset (struct hpsb_host *host);
+static void ether1394_add_host(struct hpsb_host *host);
+static void ether1394_remove_host(struct hpsb_host *host);
+static void ether1394_host_reset(struct hpsb_host *host);
 
 /* Function for incoming 1394 packets */
 static struct hpsb_address_ops addr_ops = {
@@ -207,13 +196,17 @@ static struct hpsb_highlevel eth1394_hig
 	.host_reset =	ether1394_host_reset,
 };
 
-
 static int ether1394_recv_init(struct net_device *dev)
 {
 	struct eth1394_priv *priv = netdev_priv(dev);
+	unsigned int iso_buf_size;
+
+	/* FIXME: rawiso limits us to PAGE_SIZE */
+	iso_buf_size = min((unsigned int)PAGE_SIZE,
+			   2 * (1U << (priv->host->csr.max_rec + 1)));
 
 	priv->iso = hpsb_iso_recv_init(priv->host,
-				       ETHER1394_ISO_BUF_SIZE,
+				       ETHER1394_GASP_BUFFERS * iso_buf_size,
 				       ETHER1394_GASP_BUFFERS,
 				       priv->broadcast_channel,
 				       HPSB_ISO_DMA_PACKET_PER_BUFFER,
@@ -239,64 +232,66 @@ static int ether1394_open(struct net_dev
 	struct eth1394_priv *priv = netdev_priv(dev);
 	int ret;
 
-	/* Something bad happened, don't even try */
 	if (priv->bc_state == ETHER1394_BC_ERROR) {
-		/* we'll try again */
 		ret = ether1394_recv_init(dev);
 		if (ret)
 			return ret;
 	}
-
-	netif_start_queue (dev);
+	netif_start_queue(dev);
 	return 0;
 }
 
 /* This is called after an "ifdown" */
-static int ether1394_stop (struct net_device *dev)
+static int ether1394_stop(struct net_device *dev)
 {
-	netif_stop_queue (dev);
+	netif_stop_queue(dev);
 	return 0;
 }
 
 /* Return statistics to the caller */
-static struct net_device_stats *ether1394_stats (struct net_device *dev)
+static struct net_device_stats *ether1394_stats(struct net_device *dev)
 {
 	return &(((struct eth1394_priv *)netdev_priv(dev))->stats);
 }
 
-/* What to do if we timeout. I think a host reset is probably in order, so
- * that's what we do. Should we increment the stat counters too?  */
-static void ether1394_tx_timeout (struct net_device *dev)
-{
-	ETH1394_PRINT (KERN_ERR, dev->name, "Timeout, resetting host %s\n",
-		       ((struct eth1394_priv *)netdev_priv(dev))->host->driver->name);
-
-	highlevel_host_reset (((struct eth1394_priv *)netdev_priv(dev))->host);
-
-	netif_wake_queue (dev);
+/* FIXME: What to do if we timeout? I think a host reset is probably in order,
+ * so that's what we do. Should we increment the stat counters too?  */
+static void ether1394_tx_timeout(struct net_device *dev)
+{
+	struct hpsb_host *host =
+			((struct eth1394_priv *)netdev_priv(dev))->host;
+
+	ETH1394_PRINT(KERN_ERR, dev->name, "Timeout, resetting host %s\n",
+		      host->driver->name);
+	highlevel_host_reset(host);
+	netif_wake_queue(dev);
 }
 
 static int ether1394_change_mtu(struct net_device *dev, int new_mtu)
 {
-	struct eth1394_priv *priv = netdev_priv(dev);
+	int max_rec =
+		((struct eth1394_priv *)netdev_priv(dev))->host->csr.max_rec;
 
-	if ((new_mtu < 68) ||
-	    (new_mtu > min(ETH1394_DATA_LEN,
-			   (int)((1 << (priv->host->csr.max_rec + 1)) -
-				 (sizeof(union eth1394_hdr) +
-				  ETHER1394_GASP_OVERHEAD)))))
+	if (new_mtu < 68 ||
+	    new_mtu > ETH1394_DATA_LEN ||
+	    new_mtu > (1 << (max_rec + 1)) - sizeof(union eth1394_hdr) -
+		      ETHER1394_GASP_OVERHEAD)
 		return -EINVAL;
+
 	dev->mtu = new_mtu;
 	return 0;
 }
 
 static void purge_partial_datagram(struct list_head *old)
 {
-	struct partial_datagram *pd = list_entry(old, struct partial_datagram, list);
+	struct partial_datagram *pd;
 	struct list_head *lh, *n;
+	struct fragment_info *fi;
+
+	pd = list_entry(old, struct partial_datagram, list);
 
 	list_for_each_safe(lh, n, &pd->frag_info) {
-		struct fragment_info *fi = list_entry(lh, struct fragment_info, list);
+		fi = list_entry(lh, struct fragment_info, list);
 		list_del(lh);
 		kfree(fi);
 	}
@@ -337,10 +332,10 @@ static struct eth1394_node_ref *eth1394_
 							 nodeid_t nodeid)
 {
 	struct eth1394_node_ref *node;
-	list_for_each_entry(node, inl, list) {
+
+	list_for_each_entry(node, inl, list)
 		if (node->ud->ne->nodeid == nodeid)
 			return node;
-	}
 
 	return NULL;
 }
@@ -403,24 +398,23 @@ static int eth1394_remove(struct device 
 	priv = netdev_priv(hi->dev);
 
 	old_node = eth1394_find_node(&priv->ip_node_list, ud);
+	if (!old_node)
+		return 0;
 
-	if (old_node) {
-		list_del(&old_node->list);
-		kfree(old_node);
+	list_del(&old_node->list);
+	kfree(old_node);
 
-		node_info = (struct eth1394_node_info*)ud->device.driver_data;
+	node_info = (struct eth1394_node_info*)ud->device.driver_data;
 
-		spin_lock_irqsave(&node_info->pdg.lock, flags);
-		/* The partial datagram list should be empty, but we'll just
-		 * make sure anyway... */
-		list_for_each_safe(lh, n, &node_info->pdg.list) {
-			purge_partial_datagram(lh);
-		}
-		spin_unlock_irqrestore(&node_info->pdg.lock, flags);
+	spin_lock_irqsave(&node_info->pdg.lock, flags);
+	/* The partial datagram list should be empty, but we'll just
+	 * make sure anyway... */
+	list_for_each_safe(lh, n, &node_info->pdg.list)
+		purge_partial_datagram(lh);
+	spin_unlock_irqrestore(&node_info->pdg.lock, flags);
 
-		kfree(node_info);
-		ud->device.driver_data = NULL;
-	}
+	kfree(node_info);
+	ud->device.driver_data = NULL;
 	return 0;
 }
 
@@ -438,35 +432,33 @@ static int eth1394_update(struct unit_di
 	priv = netdev_priv(hi->dev);
 
 	node = eth1394_find_node(&priv->ip_node_list, ud);
+	if (node)
+		return 0;
 
-	if (!node) {
-		node = kmalloc(sizeof(*node),
-			       in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
-		if (!node)
-			return -ENOMEM;
-
-		node_info = kmalloc(sizeof(*node_info),
-				    in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
-		if (!node_info) {
-			kfree(node);
-			return -ENOMEM;
-		}
+	node = kmalloc(sizeof(*node),
+		       in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
+	if (!node)
+		return -ENOMEM;
 
-		spin_lock_init(&node_info->pdg.lock);
-		INIT_LIST_HEAD(&node_info->pdg.list);
-		node_info->pdg.sz = 0;
+	node_info = kmalloc(sizeof(*node_info),
+			    in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
+	if (!node_info) {
+		kfree(node);
+		return -ENOMEM;
+	}
 
-		ud->device.driver_data = node_info;
-		node->ud = ud;
+	spin_lock_init(&node_info->pdg.lock);
+	INIT_LIST_HEAD(&node_info->pdg.list);
+	node_info->pdg.sz = 0;
 
-		priv = netdev_priv(hi->dev);
-		list_add_tail(&node->list, &priv->ip_node_list);
-	}
+	ud->device.driver_data = node_info;
+	node->ud = ud;
 
+	priv = netdev_priv(hi->dev);
+	list_add_tail(&node->list, &priv->ip_node_list);
 	return 0;
 }
 
-
 static struct ieee1394_device_id eth1394_id_table[] = {
 	{
 		.match_flags = (IEEE1394_MATCH_SPECIFIER_ID |
@@ -480,7 +472,7 @@ static struct ieee1394_device_id eth1394
 MODULE_DEVICE_TABLE(ieee1394, eth1394_id_table);
 
 static struct hpsb_protocol_driver eth1394_proto_driver = {
-	.name		= ETH1394_DRIVER_NAME,
+	.name		= driver_name,
 	.id_table	= eth1394_id_table,
 	.update		= eth1394_update,
 	.driver		= {
@@ -489,18 +481,16 @@ static struct hpsb_protocol_driver eth13
 	},
 };
 
-
-static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
+static void ether1394_reset_priv(struct net_device *dev, int set_mtu)
 {
 	unsigned long flags;
 	int i;
 	struct eth1394_priv *priv = netdev_priv(dev);
 	struct hpsb_host *host = priv->host;
-	u64 guid = get_unaligned((u64*)&(host->csr.rom->bus_info_data[3]));
-	u16 maxpayload = 1 << (host->csr.max_rec + 1);
+	u64 guid = get_unaligned((u64 *)&(host->csr.rom->bus_info_data[3]));
 	int max_speed = IEEE1394_SPEED_MAX;
 
-	spin_lock_irqsave (&priv->lock, flags);
+	spin_lock_irqsave(&priv->lock, flags);
 
 	memset(priv->ud_list, 0, sizeof(struct node_entry*) * ALL_NODES);
 	priv->bc_maxpayload = 512;
@@ -511,23 +501,24 @@ static void ether1394_reset_priv (struct
 			max_speed = host->speed[i];
 	priv->bc_sspd = max_speed;
 
-	/* We'll use our maxpayload as the default mtu */
+	/* We'll use our maximum payload as the default MTU */
 	if (set_mtu) {
+		int max_payload = 1 << (host->csr.max_rec + 1);
+
 		dev->mtu = min(ETH1394_DATA_LEN,
-			       (int)(maxpayload -
-				     (sizeof(union eth1394_hdr) +
-				      ETHER1394_GASP_OVERHEAD)));
+			       (int)(max_payload - sizeof(union eth1394_hdr) -
+				     ETHER1394_GASP_OVERHEAD));
 
 		/* Set our hardware address while we're at it */
 		memcpy(dev->dev_addr, &guid, sizeof(u64));
 		memset(dev->broadcast, 0xff, sizeof(u64));
 	}
 
-	spin_unlock_irqrestore (&priv->lock, flags);
+	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
 /* This function is called right before register_netdev */
-static void ether1394_init_dev (struct net_device *dev)
+static void ether1394_init_dev(struct net_device *dev)
 {
 	/* Our functions */
 	dev->open		= ether1394_open;
@@ -553,7 +544,7 @@ static void ether1394_init_dev (struct n
 	dev->hard_header_len 	= ETH1394_HLEN;
 	dev->type		= ARPHRD_IEEE1394;
 
-	ether1394_reset_priv (dev, 1);
+	ether1394_reset_priv(dev, 1);
 }
 
 /*
@@ -561,7 +552,7 @@ static void ether1394_init_dev (struct n
  * when the module is installed. This is where we add all of our ethernet
  * devices. One for each host.
  */
-static void ether1394_add_host (struct hpsb_host *host)
+static void ether1394_add_host(struct hpsb_host *host)
 {
 	struct eth1394_host_info *hi = NULL;
 	struct net_device *dev = NULL;
@@ -593,7 +584,7 @@ static void ether1394_add_host (struct h
 				 "etherdevice for IEEE 1394 device %s-%d\n",
 				 host->driver->name, host->id);
 		goto out;
-        }
+	}
 
 	SET_MODULE_OWNER(dev);
 #if 0
@@ -616,7 +607,7 @@ static void ether1394_add_host (struct h
 				 "hostinfo for IEEE 1394 device %s-%d\n",
 				 host->driver->name, host->id);
 		goto out;
-        }
+	}
 
 	ether1394_init_dev(dev);
 
@@ -647,7 +638,7 @@ out:
 }
 
 /* Remove a card from our list */
-static void ether1394_remove_host (struct hpsb_host *host)
+static void ether1394_remove_host(struct hpsb_host *host)
 {
 	struct eth1394_host_info *hi;
 	struct eth1394_priv *priv;
@@ -664,8 +655,8 @@ static void ether1394_remove_host (struc
 	free_netdev(hi->dev);
 }
 
-/* A reset has just arisen */
-static void ether1394_host_reset (struct hpsb_host *host)
+/* A bus reset happened */
+static void ether1394_host_reset(struct hpsb_host *host)
 {
 	struct eth1394_host_info *hi;
 	struct eth1394_priv *priv;
@@ -682,20 +673,19 @@ static void ether1394_host_reset (struct
 		return;
 
 	dev = hi->dev;
-	priv = (struct eth1394_priv *)netdev_priv(dev);
+	priv = netdev_priv(dev);
 
-	/* Reset our private host data, but not our mtu */
-	netif_stop_queue (dev);
-	ether1394_reset_priv (dev, 0);
+	/* Reset our private host data, but not our MTU */
+	netif_stop_queue(dev);
+	ether1394_reset_priv(dev, 0);
 
 	list_for_each_entry(node, &priv->ip_node_list, list) {
-		node_info = (struct eth1394_node_info*)node->ud->device.driver_data;
+		node_info = node->ud->device.driver_data;
 
 		spin_lock_irqsave(&node_info->pdg.lock, flags);
 
-		list_for_each_safe(lh, n, &node_info->pdg.list) {
+		list_for_each_safe(lh, n, &node_info->pdg.list)
 			purge_partial_datagram(lh);
-		}
 
 		INIT_LIST_HEAD(&(node_info->pdg.list));
 		node_info->pdg.sz = 0;
@@ -703,7 +693,7 @@ static void ether1394_host_reset (struct
 		spin_unlock_irqrestore(&node_info->pdg.lock, flags);
 	}
 
-	netif_wake_queue (dev);
+	netif_wake_queue(dev);
 }
 
 /******************************************
@@ -711,7 +701,6 @@ static void ether1394_host_reset (struct
  ******************************************/
 /* These functions have been adapted from net/ethernet/eth.c */
 
-
 /* Create a fake MAC header for an arbitrary protocol layer.
  * saddr=NULL means use device source address
  * daddr=NULL means leave destination address (eg unresolved arp). */
@@ -719,25 +708,24 @@ static int ether1394_header(struct sk_bu
 			    unsigned short type, void *daddr, void *saddr,
 			    unsigned len)
 {
-	struct eth1394hdr *eth = (struct eth1394hdr *)skb_push(skb, ETH1394_HLEN);
+	struct eth1394hdr *eth =
+			(struct eth1394hdr *)skb_push(skb, ETH1394_HLEN);
 
 	eth->h_proto = htons(type);
 
-	if (dev->flags & (IFF_LOOPBACK|IFF_NOARP)) {
+	if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
 		memset(eth->h_dest, 0, dev->addr_len);
-		return(dev->hard_header_len);
+		return dev->hard_header_len;
 	}
 
 	if (daddr) {
-		memcpy(eth->h_dest,daddr,dev->addr_len);
+		memcpy(eth->h_dest, daddr, dev->addr_len);
 		return dev->hard_header_len;
 	}
 
 	return -dev->hard_header_len;
-
 }
 
-
 /* Rebuild the faked MAC header. This is called after an ARP
  * (or in future other address resolution) has completed on this
  * sk_buff. We now let ARP fill in the other fields.
@@ -754,7 +742,7 @@ static int ether1394_rebuild_header(stru
 
 #ifdef CONFIG_INET
 	case __constant_htons(ETH_P_IP):
- 		return arp_find((unsigned char*)&eth->h_dest, skb);
+ 		return arp_find((unsigned char *)&eth->h_dest, skb);
 #endif
 	default:
 		ETH1394_PRINT(KERN_DEBUG, dev->name,
@@ -769,17 +757,17 @@ static int ether1394_rebuild_header(stru
 static int ether1394_header_parse(struct sk_buff *skb, unsigned char *haddr)
 {
 	struct net_device *dev = skb->dev;
+
 	memcpy(haddr, dev->dev_addr, ETH1394_ALEN);
 	return ETH1394_ALEN;
 }
 
-
 static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh)
 {
 	unsigned short type = hh->hh_type;
-	struct eth1394hdr *eth = (struct eth1394hdr*)(((u8*)hh->hh_data) +
-						      (16 - ETH1394_HLEN));
 	struct net_device *dev = neigh->dev;
+	struct eth1394hdr *eth =
+		(struct eth1394hdr *)((u8 *)hh->hh_data + 16 - ETH1394_HLEN);
 
 	if (type == htons(ETH_P_802_3))
 		return -1;
@@ -796,7 +784,7 @@ static void ether1394_header_cache_updat
 					  struct net_device *dev,
 					  unsigned char * haddr)
 {
-	memcpy(((u8*)hh->hh_data) + (16 - ETH1394_HLEN), haddr, dev->addr_len);
+	memcpy((u8 *)hh->hh_data + 16 - ETH1394_HLEN, haddr, dev->addr_len);
 }
 
 static int ether1394_mac_addr(struct net_device *dev, void *p)
@@ -807,9 +795,7 @@ static int ether1394_mac_addr(struct net
 	/* Not going to allow setting the MAC address, we really need to use
 	 * the real one supplied by the hardware */
 	 return -EINVAL;
- }
-
-
+}
 
 /******************************************
  * Datagram reception code
@@ -822,11 +808,11 @@ static u16 ether1394_type_trans(struct s
 	unsigned char *rawp;
 
 	skb->mac.raw = skb->data;
-	skb_pull (skb, ETH1394_HLEN);
+	skb_pull(skb, ETH1394_HLEN);
 	eth = eth1394_hdr(skb);
 
 	if (*eth->h_dest & 1) {
-		if (memcmp(eth->h_dest, dev->broadcast, dev->addr_len)==0)
+		if (memcmp(eth->h_dest, dev->broadcast, dev->addr_len) == 0)
 			skb->pkt_type = PACKET_BROADCAST;
 #if 0
 		else
@@ -835,17 +821,17 @@ static u16 ether1394_type_trans(struct s
 	} else {
 		if (memcmp(eth->h_dest, dev->dev_addr, dev->addr_len))
 			skb->pkt_type = PACKET_OTHERHOST;
-        }
+	}
 
-	if (ntohs (eth->h_proto) >= 1536)
+	if (ntohs(eth->h_proto) >= 1536)
 		return eth->h_proto;
 
 	rawp = skb->data;
 
-        if (*(unsigned short *)rawp == 0xFFFF)
-		return htons (ETH_P_802_3);
+	if (*(unsigned short *)rawp == 0xFFFF)
+		return htons(ETH_P_802_3);
 
-        return htons (ETH_P_802_2);
+	return htons(ETH_P_802_2);
 }
 
 /* Parse an encapsulated IP1394 header into an ethernet frame packet.
@@ -858,23 +844,22 @@ static u16 ether1394_parse_encap(struct 
 	u64 dest_hw;
 	unsigned short ret = 0;
 
-	/* Setup our hw addresses. We use these to build the
-	 * ethernet header.  */
+	/* Setup our hw addresses. We use these to build the ethernet header. */
 	if (destid == (LOCAL_BUS | ALL_NODES))
 		dest_hw = ~0ULL;  /* broadcast */
 	else
-		dest_hw = cpu_to_be64((((u64)priv->host->csr.guid_hi) << 32) |
+		dest_hw = cpu_to_be64((u64)priv->host->csr.guid_hi << 32 |
 				      priv->host->csr.guid_lo);
 
 	/* If this is an ARP packet, convert it. First, we want to make
 	 * use of some of the fields, since they tell us a little bit
 	 * about the sending machine.  */
 	if (ether_type == htons(ETH_P_ARP)) {
-		struct eth1394_arp *arp1394 = (struct eth1394_arp*)skb->data;
+		struct eth1394_arp *arp1394 = (struct eth1394_arp *)skb->data;
 		struct arphdr *arp = (struct arphdr *)skb->data;
 		unsigned char *arp_ptr = (unsigned char *)(arp + 1);
 		u64 fifo_addr = (u64)ntohs(arp1394->fifo_hi) << 32 |
-			ntohl(arp1394->fifo_lo);
+					   ntohl(arp1394->fifo_lo);
 		u8 max_rec = min(priv->host->csr.max_rec,
 				 (u8)(arp1394->max_rec));
 		int sspd = arp1394->sspd;
@@ -888,16 +873,17 @@ static u16 ether1394_parse_encap(struct 
 		if (sspd > 5 || sspd < 0)
 			sspd = 0;
 
-		maxpayload = min(eth1394_speedto_maxpayload[sspd], (u16)(1 << (max_rec + 1)));
+		maxpayload = min(eth1394_speedto_maxpayload[sspd],
+				 (u16)(1 << (max_rec + 1)));
 
 		guid = get_unaligned(&arp1394->s_uniq_id);
 		node = eth1394_find_node_guid(&priv->ip_node_list,
 					      be64_to_cpu(guid));
-		if (!node) {
+		if (!node)
 			return 0;
-		}
 
-		node_info = (struct eth1394_node_info*)node->ud->device.driver_data;
+		node_info =
+		    (struct eth1394_node_info *)node->ud->device.driver_data;
 
 		/* Update our speed/payload/fifo_offset table */
 		node_info->maxpayload =	maxpayload;
@@ -916,7 +902,7 @@ static u16 ether1394_parse_encap(struct 
 
 		arp->ar_hln = 8;
 		arp_ptr += arp->ar_hln;		/* skip over sender unique id */
-		*(u32*)arp_ptr = arp1394->sip;	/* move sender IP addr */
+		*(u32 *)arp_ptr = arp1394->sip;	/* move sender IP addr */
 		arp_ptr += arp->ar_pln;		/* skip over sender IP addr */
 
 		if (arp->ar_op == htons(ARPOP_REQUEST))
@@ -949,10 +935,10 @@ static struct list_head *find_partial_da
 {
 	struct partial_datagram *pd;
 
-	list_for_each_entry(pd, pdgl, list) {
+	list_for_each_entry(pd, pdgl, list)
 		if (pd->dgl == dgl)
 			return &pd->list;
-	}
+
 	return NULL;
 }
 
@@ -964,34 +950,34 @@ static int new_fragment(struct list_head
 
 	list_for_each(lh, frag_info) {
 		fi = list_entry(lh, struct fragment_info, list);
-		if ((fi->offset + fi->len) == offset) {
+		if (fi->offset + fi->len == offset) {
 			/* The new fragment can be tacked on to the end */
 			fi->len += len;
 			/* Did the new fragment plug a hole? */
 			fi2 = list_entry(lh->next, struct fragment_info, list);
-			if ((fi->offset + fi->len) == fi2->offset) {
+			if (fi->offset + fi->len == fi2->offset) {
 				/* glue fragments together */
 				fi->len += fi2->len;
 				list_del(lh->next);
 				kfree(fi2);
 			}
 			return 0;
-		} else if ((offset + len) == fi->offset) {
+		} else if (offset + len == fi->offset) {
 			/* The new fragment can be tacked on to the beginning */
 			fi->offset = offset;
 			fi->len += len;
 			/* Did the new fragment plug a hole? */
 			fi2 = list_entry(lh->prev, struct fragment_info, list);
-			if ((fi2->offset + fi2->len) == fi->offset) {
+			if (fi2->offset + fi2->len == fi->offset) {
 				/* glue fragments together */
 				fi2->len += fi->len;
 				list_del(lh);
 				kfree(fi);
 			}
 			return 0;
-		} else if (offset > (fi->offset + fi->len)) {
+		} else if (offset > fi->offset + fi->len) {
 			break;
-		} else if ((offset + len) < fi->offset) {
+		} else if (offset + len < fi->offset) {
 			lh = lh->prev;
 			break;
 		}
@@ -1005,7 +991,6 @@ static int new_fragment(struct list_head
 	new->len = len;
 
 	list_add(&new->list, lh);
-
 	return 0;
 }
 
@@ -1044,25 +1029,23 @@ static int new_partial_datagram(struct n
 	memcpy(new->pbuf + frag_off, frag_buf, frag_len);
 
 	list_add(&new->list, pdgl);
-
 	return 0;
 }
 
 static int update_partial_datagram(struct list_head *pdgl, struct list_head *lh,
 				   char *frag_buf, int frag_off, int frag_len)
 {
-	struct partial_datagram *pd = list_entry(lh, struct partial_datagram, list);
+	struct partial_datagram *pd =
+			list_entry(lh, struct partial_datagram, list);
 
-	if (new_fragment(&pd->frag_info, frag_off, frag_len) < 0) {
+	if (new_fragment(&pd->frag_info, frag_off, frag_len) < 0)
 		return -ENOMEM;
-	}
 
 	memcpy(pd->pbuf + frag_off, frag_buf, frag_len);
 
 	/* Move list entry to beginnig of list so that oldest partial
 	 * datagrams percolate to the end of the list */
 	list_move(lh, pdgl);
-
 	return 0;
 }
 
@@ -1107,7 +1090,7 @@ static int ether1394_data_handler(struct
 		priv->ud_list[NODEID_TO_NODE(srcid)] = ud;
 	}
 
-	node_info = (struct eth1394_node_info*)ud->device.driver_data;
+	node_info = (struct eth1394_node_info *)ud->device.driver_data;
 
 	/* First, did we receive a fragmented or unfragmented datagram? */
 	hdr->words.word1 = ntohs(hdr->words.word1);
@@ -1126,7 +1109,8 @@ static int ether1394_data_handler(struct
 			return -1;
 		}
 		skb_reserve(skb, (dev->hard_header_len + 15) & ~15);
-		memcpy(skb_put(skb, len - hdr_len), buf + hdr_len, len - hdr_len);
+		memcpy(skb_put(skb, len - hdr_len), buf + hdr_len,
+		       len - hdr_len);
 		ether_type = hdr->uf.ether_type;
 	} else {
 		/* A datagram fragment has been received, now the fun begins. */
@@ -1211,9 +1195,8 @@ static int ether1394_data_handler(struct
 
 		pd = list_entry(lh, struct partial_datagram, list);
 
-		if (hdr->common.lf == ETH1394_HDR_LF_FF) {
+		if (hdr->common.lf == ETH1394_HDR_LF_FF)
 			pd->ether_type = ether_type;
-		}
 
 		if (is_datagram_complete(lh, dg_size)) {
 			ether_type = pd->ether_type;
@@ -1240,8 +1223,8 @@ static int ether1394_data_handler(struct
 	skb->protocol = ether1394_parse_encap(skb, dev, srcid, destid,
 					      ether_type);
 
-
 	spin_lock_irqsave(&priv->lock, flags);
+
 	if (!skb->protocol) {
 		priv->stats.rx_errors++;
 		priv->stats.rx_dropped++;
@@ -1313,20 +1296,20 @@ static void ether1394_iso(struct hpsb_is
 	for (i = 0; i < nready; i++) {
 		struct hpsb_iso_packet_info *info =
 			&iso->infos[(iso->first_packet + i) % iso->buf_packets];
-		data = (quadlet_t*) (iso->data_buf.kvirt + info->offset);
+		data = (quadlet_t *)(iso->data_buf.kvirt + info->offset);
 
 		/* skip over GASP header */
 		buf = (char *)data + 8;
 		len = info->len - 8;
 
-		specifier_id = (((be32_to_cpu(data[0]) & 0xffff) << 8) |
-				((be32_to_cpu(data[1]) & 0xff000000) >> 24));
+		specifier_id = (be32_to_cpu(data[0]) & 0xffff) << 8 |
+			       (be32_to_cpu(data[1]) & 0xff000000) >> 24;
 		source_id = be32_to_cpu(data[0]) >> 16;
 
 		priv = netdev_priv(dev);
 
-		if (info->channel != (iso->host->csr.broadcast_channel & 0x3f) ||
-		   specifier_id != ETHER1394_GASP_SPECIFIER_ID) {
+		if (info->channel != (iso->host->csr.broadcast_channel & 0x3f)
+		    || specifier_id != ETHER1394_GASP_SPECIFIER_ID) {
 			/* This packet is not for us */
 			continue;
 		}
@@ -1358,21 +1341,16 @@ static void ether1394_arp_to_1394arp(str
 				     struct net_device *dev)
 {
 	struct eth1394_priv *priv = netdev_priv(dev);
-
 	struct arphdr *arp = (struct arphdr *)skb->data;
 	unsigned char *arp_ptr = (unsigned char *)(arp + 1);
 	struct eth1394_arp *arp1394 = (struct eth1394_arp *)skb->data;
 
-	/* Believe it or not, all that need to happen is sender IP get moved
-	 * and set hw_addr_len, max_rec, sspd, fifo_hi and fifo_lo.  */
 	arp1394->hw_addr_len	= 16;
 	arp1394->sip		= *(u32*)(arp_ptr + ETH1394_ALEN);
 	arp1394->max_rec	= priv->host->csr.max_rec;
 	arp1394->sspd		= priv->host->csr.lnk_spd;
-	arp1394->fifo_hi	= htons (priv->local_fifo >> 32);
-	arp1394->fifo_lo	= htonl (priv->local_fifo & ~0x0);
-
-	return;
+	arp1394->fifo_hi	= htons(priv->local_fifo >> 32);
+	arp1394->fifo_lo	= htonl(priv->local_fifo & ~0x0);
 }
 
 /* We need to encapsulate the standard header with our own. We use the
@@ -1382,7 +1360,8 @@ static unsigned int ether1394_encapsulat
 					       union eth1394_hdr *hdr,
 					       u16 dg_size, u16 dgl)
 {
-	unsigned int adj_max_payload = max_payload - hdr_type_len[ETH1394_HDR_LF_UF];
+	unsigned int adj_max_payload =
+				max_payload - hdr_type_len[ETH1394_HDR_LF_UF];
 
 	/* Does it all fit in one packet? */
 	if (dg_size <= adj_max_payload) {
@@ -1395,7 +1374,7 @@ static unsigned int ether1394_encapsulat
 		hdr->ff.dgl = dgl;
 		adj_max_payload = max_payload - hdr_type_len[ETH1394_HDR_LF_FF];
 	}
-	return((dg_size + (adj_max_payload - 1)) / adj_max_payload);
+	return (dg_size + adj_max_payload - 1) / adj_max_payload;
 }
 
 static unsigned int ether1394_encapsulate(struct sk_buff *skb,
@@ -1407,7 +1386,7 @@ static unsigned int ether1394_encapsulat
 	int hdrsz = hdr_type_len[ftype];
 	unsigned int adj_max_payload = max_payload - hdrsz;
 
-	switch(ftype) {
+	switch (ftype) {
 	case ETH1394_HDR_LF_UF:
 		bufhdr = (union eth1394_hdr *)skb_push(skb, hdrsz);
 		bufhdr->words.word1 = htons(hdr->words.word1);
@@ -1436,7 +1415,6 @@ static unsigned int ether1394_encapsulat
 		bufhdr->words.word3 = htons(hdr->words.word3);
 		bufhdr->words.word4 = 0;
 	}
-
 	return min(max_payload, skb->len);
 }
 
@@ -1455,13 +1433,13 @@ static struct hpsb_packet *ether1394_all
 
 static int ether1394_prep_write_packet(struct hpsb_packet *p,
 				       struct hpsb_host *host, nodeid_t node,
-				       u64 addr, void * data, int tx_len)
+				       u64 addr, void *data, int tx_len)
 {
 	p->node_id = node;
 	p->data = NULL;
 
 	p->tcode = TCODE_WRITEB;
-	p->header[1] = (host->node_id << 16) | (addr >> 32);
+	p->header[1] = host->node_id << 16 | addr >> 32;
 	p->header[2] = addr & 0xffffffff;
 
 	p->header_size = 16;
@@ -1472,12 +1450,12 @@ static int ether1394_prep_write_packet(s
 				"to node " NODE_BUS_FMT "\n", NODE_BUS_ARGS(host, node));
 		return -1;
 	}
-	p->header[0] = (p->node_id << 16) | (p->tlabel << 10)
-		| (1 << 8) | (TCODE_WRITEB << 4);
+	p->header[0] =
+		p->node_id << 16 | p->tlabel << 10 | 1 << 8 | TCODE_WRITEB << 4;
 
 	p->header[3] = tx_len << 16;
 	p->data_size = (tx_len + 3) & ~3;
-	p->data = (quadlet_t*)data;
+	p->data = data;
 
 	return 0;
 }
@@ -1489,14 +1467,13 @@ static void ether1394_prep_gasp_packet(s
 	p->header_size = 4;
 	p->tcode = TCODE_STREAM_DATA;
 
-	p->header[0] = (length << 16) | (3 << 14)
-		| ((priv->broadcast_channel) << 8)
-		| (TCODE_STREAM_DATA << 4);
+	p->header[0] = length << 16 | 3 << 14 | priv->broadcast_channel << 8 |
+		       TCODE_STREAM_DATA << 4;
 	p->data_size = length;
-	p->data = ((quadlet_t*)skb->data) - 2;
-	p->data[0] = cpu_to_be32((priv->host->node_id << 16) |
+	p->data = (quadlet_t *)skb->data - 2;
+	p->data[0] = cpu_to_be32(priv->host->node_id << 16 |
 				 ETHER1394_GASP_SPECIFIER_ID_HI);
-	p->data[1] = cpu_to_be32((ETHER1394_GASP_SPECIFIER_ID_LO << 24) |
+	p->data[1] = cpu_to_be32(ETHER1394_GASP_SPECIFIER_ID_LO << 24 |
 				 ETHER1394_GASP_VERSION);
 
 	/* Setting the node id to ALL_NODES (not LOCAL_BUS | ALL_NODES)
@@ -1525,7 +1502,7 @@ static int ether1394_send_packet(struct 
 		return -1;
 
 	if (ptask->tx_type == ETH1394_GASP) {
-		int length = tx_len + (2 * sizeof(quadlet_t));
+		int length = tx_len + 2 * sizeof(quadlet_t);
 
 		ether1394_prep_gasp_packet(packet, priv, ptask->skb, length);
 	} else if (ether1394_prep_write_packet(packet, priv->host,
@@ -1548,13 +1525,11 @@ static int ether1394_send_packet(struct 
 	return 0;
 }
 
-
 /* Task function to be run when a datagram transmission is completed */
 static void ether1394_dg_complete(struct packet_task *ptask, int fail)
 {
 	struct sk_buff *skb = ptask->skb;
-	struct net_device *dev = skb->dev;
-	struct eth1394_priv *priv = netdev_priv(dev);
+	struct eth1394_priv *priv = netdev_priv(skb->dev);
 	unsigned long flags;
 
 	/* Statistics */
@@ -1572,7 +1547,6 @@ static void ether1394_dg_complete(struct
 	kmem_cache_free(packet_task_cache, ptask);
 }
 
-
 /* Callback for when a packet has been sent and the status of that packet is
  * known */
 static void ether1394_complete_cb(void *__ptask)
@@ -1600,10 +1574,8 @@ static void ether1394_complete_cb(void *
 	}
 }
 
-
-
 /* Transmit a packet (called by kernel) */
-static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
+static int ether1394_tx(struct sk_buff *skb, struct net_device *dev)
 {
 	gfp_t kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
 	struct eth1394hdr *eth;
@@ -1637,13 +1609,14 @@ static int ether1394_tx (struct sk_buff 
 	}
 #endif
 
-	if ((skb = skb_share_check (skb, kmflags)) == NULL) {
+	skb = skb_share_check(skb, kmflags);
+	if (!skb) {
 		ret = -ENOMEM;
 		goto fail;
 	}
 
 	/* Get rid of the fake eth1394 header, but save a pointer */
-	eth = (struct eth1394hdr*)skb->data;
+	eth = (struct eth1394hdr *)skb->data;
 	skb_pull(skb, ETH1394_HLEN);
 
 	proto = eth->h_proto;
@@ -1658,7 +1631,7 @@ static int ether1394_tx (struct sk_buff 
 		tx_type = ETH1394_GASP;
 		dest_node = LOCAL_BUS | ALL_NODES;
 		max_payload = priv->bc_maxpayload - ETHER1394_GASP_OVERHEAD;
-		BUG_ON(max_payload < (512 - ETHER1394_GASP_OVERHEAD));
+		BUG_ON(max_payload < 512 - ETHER1394_GASP_OVERHEAD);
 		dgl = priv->bc_dgl;
 		if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF])
 			priv->bc_dgl++;
@@ -1671,7 +1644,8 @@ static int ether1394_tx (struct sk_buff 
 			ret = -EAGAIN;
 			goto fail;
 		}
-		node_info = (struct eth1394_node_info*)node->ud->device.driver_data;
+		node_info =
+		    (struct eth1394_node_info *)node->ud->device.driver_data;
 		if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE) {
 			ret = -EAGAIN;
 			goto fail;
@@ -1679,7 +1653,7 @@ static int ether1394_tx (struct sk_buff 
 
 		dest_node = node->ud->ne->nodeid;
 		max_payload = node_info->maxpayload;
-		BUG_ON(max_payload < (512 - ETHER1394_GASP_OVERHEAD));
+		BUG_ON(max_payload < 512 - ETHER1394_GASP_OVERHEAD);
 
 		dgl = node_info->dgl;
 		if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF])
@@ -1689,7 +1663,7 @@ static int ether1394_tx (struct sk_buff 
 
 	/* If this is an ARP packet, convert it */
 	if (proto == htons(ETH_P_ARP))
-		ether1394_arp_to_1394arp (skb, dev);
+		ether1394_arp_to_1394arp(skb, dev);
 
 	ptask->hdr.words.word1 = 0;
 	ptask->hdr.words.word2 = 0;
@@ -1712,9 +1686,8 @@ static int ether1394_tx (struct sk_buff 
 
 	ptask->tx_type = tx_type;
 	ptask->max_payload = max_payload;
-        ptask->outstanding_pkts = ether1394_encapsulate_prep(max_payload, proto,
-							     &ptask->hdr, dg_size,
-							     dgl);
+	ptask->outstanding_pkts = ether1394_encapsulate_prep(max_payload,
+					proto, &ptask->hdr, dg_size, dgl);
 
 	/* Add the encapsulation header to the fragment */
 	tx_len = ether1394_encapsulate(skb, max_payload, &ptask->hdr);
@@ -1742,11 +1715,11 @@ fail:
 	return 0;  /* returning non-zero causes serious problems */
 }
 
-static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+static void ether1394_get_drvinfo(struct net_device *dev,
+				  struct ethtool_drvinfo *info)
 {
-	strcpy (info->driver, driver_name);
-	/* FIXME XXX provide sane businfo */
-	strcpy (info->bus_info, "ieee1394");
+	strcpy(info->driver, driver_name);
+	strcpy(info->bus_info, "ieee1394"); /* FIXME provide more detail? */
 }
 
 static struct ethtool_ops ethtool_ops = {
@@ -1755,12 +1728,11 @@ static struct ethtool_ops ethtool_ops = 
 
 static int __init ether1394_init_module (void)
 {
-	packet_task_cache = kmem_cache_create("packet_task", sizeof(struct packet_task),
+	packet_task_cache = kmem_cache_create("packet_task",
+					      sizeof(struct packet_task),
 					      0, 0, NULL, NULL);
 
-	/* Register ourselves as a highlevel driver */
 	hpsb_register_highlevel(&eth1394_highlevel);
-
 	return hpsb_register_protocol(&eth1394_proto_driver);
 }
 
Index: linux/drivers/ieee1394/eth1394.h
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.h
+++ linux/drivers/ieee1394/eth1394.h
@@ -25,6 +25,8 @@
 #define __ETH1394_H
 
 #include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <asm/byteorder.h>
 
 #include "ieee1394.h"
 #include "ieee1394_types.h"
@@ -35,22 +37,15 @@
 
 /* GASP identifier numbers for IPv4 over IEEE 1394 */
 #define ETHER1394_GASP_SPECIFIER_ID	0x00005E
-#define ETHER1394_GASP_SPECIFIER_ID_HI	((ETHER1394_GASP_SPECIFIER_ID >> 8) & 0xffff)
-#define ETHER1394_GASP_SPECIFIER_ID_LO	(ETHER1394_GASP_SPECIFIER_ID & 0xff)
+#define ETHER1394_GASP_SPECIFIER_ID_HI	((0x00005E >> 8) & 0xffff)
+#define ETHER1394_GASP_SPECIFIER_ID_LO	(0x00005E & 0xff)
 #define ETHER1394_GASP_VERSION		1
 
-#define ETHER1394_GASP_OVERHEAD (2 * sizeof(quadlet_t))  /* GASP header overhead */
+#define ETHER1394_GASP_OVERHEAD	(2 * sizeof(quadlet_t))	/* for GASP header */
 
-#define ETHER1394_GASP_BUFFERS 16
+#define ETHER1394_GASP_BUFFERS	16
 
-/* rawiso buffer size - due to a limitation in rawiso, we must limit each
- * GASP buffer to be less than PAGE_SIZE. */
-#define ETHER1394_ISO_BUF_SIZE	ETHER1394_GASP_BUFFERS *                        \
-				   min((unsigned int)PAGE_SIZE,                 \
-				       2 * (1U << (priv->host->csr.max_rec + 1)))
-
-/* Node set == 64 */
-#define NODE_SET			(ALL_NODES + 1)
+#define NODE_SET		(ALL_NODES + 1)		/* Node set == 64 */
 
 enum eth1394_bc_states { ETHER1394_BC_ERROR,
 			 ETHER1394_BC_RUNNING,
@@ -86,19 +81,14 @@ struct eth1394hdr {
 	unsigned short	h_proto;		/* packet type ID field	*/
 }  __attribute__((packed));
 
-#ifdef __KERNEL__
-#include <linux/skbuff.h>
-
 static inline struct eth1394hdr *eth1394_hdr(const struct sk_buff *skb)
 {
 	return (struct eth1394hdr *)skb->mac.raw;
 }
-#endif
 
 typedef enum {ETH1394_GASP, ETH1394_WRREQ} eth1394_tx_type;
 
 /* IP1394 headers */
-#include <asm/byteorder.h>
 
 /* Unfragmented */
 #if defined __BIG_ENDIAN_BITFIELD

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 02/15] ieee1394: eth1394: .probe and .update may sleep
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
  2007-04-02  0:12 ` [PATCH linux1394-2.6.git 01/15] ieee1394: eth1394: coding style Stefan Richter
@ 2007-04-02  0:13 ` Stefan Richter
  2007-04-02  0:14 ` [PATCH linux1394-2.6.git 03/15] eth1394: refactor .probe and .update Stefan Richter
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:13 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -354,13 +354,11 @@ static int eth1394_probe(struct device *
 	if (!hi)
 		return -ENOENT;
 
-	new_node = kmalloc(sizeof(*new_node),
-			   in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
+	new_node = kmalloc(sizeof(*new_node), GFP_KERNEL);
 	if (!new_node)
 		return -ENOMEM;
 
-	node_info = kmalloc(sizeof(*node_info),
-			    in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
+	node_info = kmalloc(sizeof(*node_info), GFP_KERNEL);
 	if (!node_info) {
 		kfree(new_node);
 		return -ENOMEM;
@@ -435,13 +433,11 @@ static int eth1394_update(struct unit_di
 	if (node)
 		return 0;
 
-	node = kmalloc(sizeof(*node),
-		       in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
+	node = kmalloc(sizeof(*node), GFP_KERNEL);
 	if (!node)
 		return -ENOMEM;
 
-	node_info = kmalloc(sizeof(*node_info),
-			    in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
+	node_info = kmalloc(sizeof(*node_info), GFP_KERNEL);
 	if (!node_info) {
 		kfree(node);
 		return -ENOMEM;

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 03/15] eth1394: refactor .probe and .update
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
  2007-04-02  0:12 ` [PATCH linux1394-2.6.git 01/15] ieee1394: eth1394: coding style Stefan Richter
  2007-04-02  0:13 ` [PATCH linux1394-2.6.git 02/15] ieee1394: eth1394: .probe and .update may sleep Stefan Richter
@ 2007-04-02  0:14 ` Stefan Richter
  2007-04-02  0:15 ` [PATCH linux1394-2.6.git 04/15] ieee1394: eth1394: correct a memset argument Stefan Richter
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:14 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Move common code into an extra function.  This implicitly adds a missing
node_info->fifo = CSR1212_INVALID_ADDR_SPACE; to .update.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |   48 ++++++++++++-------------------------
 1 file changed, 16 insertions(+), 32 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -340,20 +340,13 @@ static struct eth1394_node_ref *eth1394_
 	return NULL;
 }
 
-static int eth1394_probe(struct device *dev)
+static int eth1394_new_node(struct eth1394_host_info *hi,
+			    struct unit_directory *ud)
 {
-	struct unit_directory *ud;
-	struct eth1394_host_info *hi;
 	struct eth1394_priv *priv;
 	struct eth1394_node_ref *new_node;
 	struct eth1394_node_info *node_info;
 
-	ud = container_of(dev, struct unit_directory, device);
-
-	hi = hpsb_get_hostinfo(&eth1394_highlevel, ud->ne->host);
-	if (!hi)
-		return -ENOENT;
-
 	new_node = kmalloc(sizeof(*new_node), GFP_KERNEL);
 	if (!new_node)
 		return -ENOMEM;
@@ -374,10 +367,22 @@ static int eth1394_probe(struct device *
 
 	priv = netdev_priv(hi->dev);
 	list_add_tail(&new_node->list, &priv->ip_node_list);
-
 	return 0;
 }
 
+static int eth1394_probe(struct device *dev)
+{
+	struct unit_directory *ud;
+	struct eth1394_host_info *hi;
+
+	ud = container_of(dev, struct unit_directory, device);
+	hi = hpsb_get_hostinfo(&eth1394_highlevel, ud->ne->host);
+	if (!hi)
+		return -ENOENT;
+
+	return eth1394_new_node(hi, ud);
+}
+
 static int eth1394_remove(struct device *dev)
 {
 	struct unit_directory *ud;
@@ -421,38 +426,17 @@ static int eth1394_update(struct unit_di
 	struct eth1394_host_info *hi;
 	struct eth1394_priv *priv;
 	struct eth1394_node_ref *node;
-	struct eth1394_node_info *node_info;
 
 	hi = hpsb_get_hostinfo(&eth1394_highlevel, ud->ne->host);
 	if (!hi)
 		return -ENOENT;
 
 	priv = netdev_priv(hi->dev);
-
 	node = eth1394_find_node(&priv->ip_node_list, ud);
 	if (node)
 		return 0;
 
-	node = kmalloc(sizeof(*node), GFP_KERNEL);
-	if (!node)
-		return -ENOMEM;
-
-	node_info = kmalloc(sizeof(*node_info), GFP_KERNEL);
-	if (!node_info) {
-		kfree(node);
-		return -ENOMEM;
-	}
-
-	spin_lock_init(&node_info->pdg.lock);
-	INIT_LIST_HEAD(&node_info->pdg.list);
-	node_info->pdg.sz = 0;
-
-	ud->device.driver_data = node_info;
-	node->ud = ud;
-
-	priv = netdev_priv(hi->dev);
-	list_add_tail(&node->list, &priv->ip_node_list);
-	return 0;
+	return eth1394_new_node(hi, ud);
 }
 
 static struct ieee1394_device_id eth1394_id_table[] = {

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 04/15] ieee1394: eth1394: correct a memset argument
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (2 preceding siblings ...)
  2007-04-02  0:14 ` [PATCH linux1394-2.6.git 03/15] eth1394: refactor .probe and .update Stefan Richter
@ 2007-04-02  0:15 ` Stefan Richter
  2007-04-02  0:15 ` [PATCH linux1394-2.6.git 05/15] ieee1394: eth1394: shorter error messages Stefan Richter
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:15 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

The old argument calculated the correct value in a wrong way.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -472,7 +472,7 @@ static void ether1394_reset_priv(struct 
 
 	spin_lock_irqsave(&priv->lock, flags);
 
-	memset(priv->ud_list, 0, sizeof(struct node_entry*) * ALL_NODES);
+	memset(priv->ud_list, 0, sizeof(priv->ud_list));
 	priv->bc_maxpayload = 512;
 
 	/* Determine speed limit */

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 05/15] ieee1394: eth1394: shorter error messages
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (3 preceding siblings ...)
  2007-04-02  0:15 ` [PATCH linux1394-2.6.git 04/15] ieee1394: eth1394: correct a memset argument Stefan Richter
@ 2007-04-02  0:15 ` Stefan Richter
  2007-04-02  0:16 ` [PATCH linux1394-2.6.git 06/15] ieee1394: eth1394: contain host reset Stefan Richter
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:15 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |   40 ++++++++++++++-----------------------
 1 file changed, 16 insertions(+), 24 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -196,9 +196,8 @@ static struct hpsb_highlevel eth1394_hig
 	.host_reset =	ether1394_host_reset,
 };
 
-static int ether1394_recv_init(struct net_device *dev)
+static int ether1394_recv_init(struct eth1394_priv *priv)
 {
-	struct eth1394_priv *priv = netdev_priv(dev);
 	unsigned int iso_buf_size;
 
 	/* FIXME: rawiso limits us to PAGE_SIZE */
@@ -212,9 +211,7 @@ static int ether1394_recv_init(struct ne
 				       HPSB_ISO_DMA_PACKET_PER_BUFFER,
 				       1, ether1394_iso);
 	if (priv->iso == NULL) {
-		ETH1394_PRINT(KERN_ERR, dev->name,
-			      "Could not allocate isochronous receive "
-			      "context for the broadcast channel\n");
+		ETH1394_PRINT_G(KERN_ERR, "Failed to allocate IR context\n");
 		priv->bc_state = ETHER1394_BC_ERROR;
 		return -EAGAIN;
 	}
@@ -233,7 +230,7 @@ static int ether1394_open(struct net_dev
 	int ret;
 
 	if (priv->bc_state == ETHER1394_BC_ERROR) {
-		ret = ether1394_recv_init(dev);
+		ret = ether1394_recv_init(priv);
 		if (ret)
 			return ret;
 	}
@@ -560,9 +557,7 @@ static void ether1394_add_host(struct hp
 	dev = alloc_etherdev(sizeof (struct eth1394_priv));
 
 	if (dev == NULL) {
-		ETH1394_PRINT_G (KERN_ERR, "Out of memory trying to allocate "
-				 "etherdevice for IEEE 1394 device %s-%d\n",
-				 host->driver->name, host->id);
+		ETH1394_PRINT_G(KERN_ERR, "Out of memory\n");
 		goto out;
 	}
 
@@ -583,21 +578,19 @@ static void ether1394_add_host(struct hp
 	hi = hpsb_create_hostinfo(&eth1394_highlevel, host, sizeof(*hi));
 
 	if (hi == NULL) {
-		ETH1394_PRINT_G (KERN_ERR, "Out of memory trying to create "
-				 "hostinfo for IEEE 1394 device %s-%d\n",
-				 host->driver->name, host->id);
+		ETH1394_PRINT_G(KERN_ERR, "Out of memory\n");
 		goto out;
 	}
 
 	ether1394_init_dev(dev);
 
-	if (register_netdev (dev)) {
-		ETH1394_PRINT (KERN_ERR, dev->name, "Error registering network driver\n");
+	if (register_netdev(dev)) {
+		ETH1394_PRINT_G(KERN_ERR, "Cannot register the driver\n");
 		goto out;
 	}
 
-	ETH1394_PRINT (KERN_INFO, dev->name, "IEEE-1394 IPv4 over 1394 Ethernet (fw-host%d)\n",
-		       host->id);
+	ETH1394_PRINT(KERN_INFO, dev->name, "IPv4 over IEEE 1394 (fw-host%d)\n",
+		      host->id);
 
 	hi->host = host;
 	hi->dev = dev;
@@ -606,7 +599,7 @@ static void ether1394_add_host(struct hp
 	 * be checked when the eth device is opened. */
 	priv->broadcast_channel = host->csr.broadcast_channel & 0x3f;
 
-	ether1394_recv_init(dev);
+	ether1394_recv_init(priv);
 	return;
 out:
 	if (dev)
@@ -1084,7 +1077,7 @@ static int ether1394_data_handler(struct
 
 		skb = dev_alloc_skb(len + dev->hard_header_len + 15);
 		if (!skb) {
-			HPSB_PRINT (KERN_ERR, "ether1394 rx: low on mem\n");
+			ETH1394_PRINT_G(KERN_ERR, "Out of memory\n");
 			priv->stats.rx_dropped++;
 			return -1;
 		}
@@ -1239,8 +1232,8 @@ static int ether1394_write(struct hpsb_h
 
 	hi = hpsb_get_hostinfo(&eth1394_highlevel, host);
 	if (hi == NULL) {
-		ETH1394_PRINT_G(KERN_ERR, "Could not find net device for host %s\n",
-				host->driver->name);
+		ETH1394_PRINT_G(KERN_ERR, "No net device at fw-host%d\n",
+				host->id);
 		return RCODE_ADDRESS_ERROR;
 	}
 
@@ -1265,8 +1258,8 @@ static void ether1394_iso(struct hpsb_is
 
 	hi = hpsb_get_hostinfo(&eth1394_highlevel, iso->host);
 	if (hi == NULL) {
-		ETH1394_PRINT_G(KERN_ERR, "Could not find net device for host %s\n",
-				iso->host->driver->name);
+		ETH1394_PRINT_G(KERN_ERR, "No net device at fw-host%d\n",
+				iso->host->id);
 		return;
 	}
 
@@ -1426,8 +1419,7 @@ static int ether1394_prep_write_packet(s
 	p->expect_response = 1;
 
 	if (hpsb_get_tlabel(p)) {
-		ETH1394_PRINT_G(KERN_ERR, "No more tlabels left while sending "
-				"to node " NODE_BUS_FMT "\n", NODE_BUS_ARGS(host, node));
+		ETH1394_PRINT_G(KERN_ERR, "Out of tlabels\n");
 		return -1;
 	}
 	p->header[0] =


-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 06/15] ieee1394: eth1394: contain host reset
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (4 preceding siblings ...)
  2007-04-02  0:15 ` [PATCH linux1394-2.6.git 05/15] ieee1394: eth1394: shorter error messages Stefan Richter
@ 2007-04-02  0:16 ` Stefan Richter
  2007-04-02  0:18 ` [PATCH linux1394-2.6.git 07/15] ieee1394: eth1394: make MTU configurable Stefan Richter
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:16 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Call only eth1394's own host reset handler from .tx_timeout, not the
reset hooks of all other IEEE 1394 drivers.

A minor drawback of this patch is that ether1394_host_reset by timeout
is not serialized against ether1394_host_reset by bus reset.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -258,10 +258,8 @@ static void ether1394_tx_timeout(struct 
 	struct hpsb_host *host =
 			((struct eth1394_priv *)netdev_priv(dev))->host;
 
-	ETH1394_PRINT(KERN_ERR, dev->name, "Timeout, resetting host %s\n",
-		      host->driver->name);
-	highlevel_host_reset(host);
-	netif_wake_queue(dev);
+	ETH1394_PRINT(KERN_ERR, dev->name, "Timeout, resetting host\n");
+	ether1394_host_reset(host);
 }
 
 static int ether1394_change_mtu(struct net_device *dev, int new_mtu)

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 07/15] ieee1394: eth1394: make MTU configurable
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (5 preceding siblings ...)
  2007-04-02  0:16 ` [PATCH linux1394-2.6.git 06/15] ieee1394: eth1394: contain host reset Stefan Richter
@ 2007-04-02  0:18 ` Stefan Richter
  2007-04-03 21:55   ` Stefan Richter
  2007-04-02  0:19 ` [PATCH linux1394-2.6.git 08/15] eth1394: CONFIG_INET is always defined Stefan Richter
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:18 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -136,9 +136,6 @@ static const int hdr_type_len[] = {
 	sizeof(struct eth1394_sf_hdr)
 };
 
-/* For now, this needs to be 1500, so that XP works with us */
-#define ETH1394_DATA_LEN	ETH_DATA_LEN
-
 static const u16 eth1394_speedto_maxpayload[] = {
 /*     S100, S200, S400, S800, S1600, S3200 */
 	512, 1024, 2048, 4096,  4096,  4096
@@ -158,8 +155,19 @@ static int max_partial_datagrams = 25;
 module_param(max_partial_datagrams, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(max_partial_datagrams,
 		 "Maximum number of partially received fragmented datagrams "
-		 "(default = 25).");
+		 "(default = 25)");
 
+/*
+ * RFC 2734 says: "IP-capable nodes may operate with an MTU size larger than
+ * the default [1500 octets], but the means by which a larger MTU is configured
+ * are beyond the scope of this document."
+ *
+ * Leave it at the default 1500 for interoperability.
+ * Raise it for performance tuning.
+ */
+static int eth1394_data_len = 1500;
+module_param_named(mtu, eth1394_data_len, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(mtu, "MTU (default = 1500)");
 
 static int ether1394_header(struct sk_buff *skb, struct net_device *dev,
 			    unsigned short type, void *daddr, void *saddr,
@@ -268,7 +276,7 @@ static int ether1394_change_mtu(struct n
 		((struct eth1394_priv *)netdev_priv(dev))->host->csr.max_rec;
 
 	if (new_mtu < 68 ||
-	    new_mtu > ETH1394_DATA_LEN ||
+	    new_mtu > eth1394_data_len ||
 	    new_mtu > (1 << (max_rec + 1)) - sizeof(union eth1394_hdr) -
 		      ETHER1394_GASP_OVERHEAD)
 		return -EINVAL;
@@ -480,7 +488,7 @@ static void ether1394_reset_priv(struct 
 	if (set_mtu) {
 		int max_payload = 1 << (host->csr.max_rec + 1);
 
-		dev->mtu = min(ETH1394_DATA_LEN,
+		dev->mtu = min(eth1394_data_len,
 			       (int)(max_payload - sizeof(union eth1394_hdr) -
 				     ETHER1394_GASP_OVERHEAD));
 

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 08/15] eth1394: CONFIG_INET is always defined
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (6 preceding siblings ...)
  2007-04-02  0:18 ` [PATCH linux1394-2.6.git 07/15] ieee1394: eth1394: make MTU configurable Stefan Richter
@ 2007-04-02  0:19 ` Stefan Richter
  2007-04-02  0:19 ` [PATCH linux1394-2.6.git 09/15] ieee1394: eth1394: omit useless set_mac_address callback Stefan Richter
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:19 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

because CONFIG_IEEE1394_ETH1394 depends on it.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -715,21 +715,13 @@ static int ether1394_header(struct sk_bu
 static int ether1394_rebuild_header(struct sk_buff *skb)
 {
 	struct eth1394hdr *eth = (struct eth1394hdr *)skb->data;
-	struct net_device *dev = skb->dev;
-
-	switch (eth->h_proto) {
 
-#ifdef CONFIG_INET
-	case __constant_htons(ETH_P_IP):
+	if (eth->h_proto == htons(ETH_P_IP))
  		return arp_find((unsigned char *)&eth->h_dest, skb);
-#endif
-	default:
-		ETH1394_PRINT(KERN_DEBUG, dev->name,
-			      "unable to resolve type %04x addresses.\n",
-			      ntohs(eth->h_proto));
-		break;
-	}
 
+	ETH1394_PRINT(KERN_DEBUG, skb->dev->name,
+		      "unable to resolve type %04x addresses\n",
+		      ntohs(eth->h_proto));
 	return 0;
 }
 

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 09/15] ieee1394: eth1394: omit useless set_mac_address callback
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (7 preceding siblings ...)
  2007-04-02  0:19 ` [PATCH linux1394-2.6.git 08/15] eth1394: CONFIG_INET is always defined Stefan Richter
@ 2007-04-02  0:19 ` Stefan Richter
  2007-04-02  0:20 ` [PATCH linux1394-2.6.git 10/15] ieee1394: eth1394: don't use alloc_etherdev Stefan Richter
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:19 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

We can't reconfigure the MAC address, hence we don't need the callback.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -178,8 +178,6 @@ static int ether1394_header_cache(struct
 static void ether1394_header_cache_update(struct hh_cache *hh,
 					  struct net_device *dev,
 					  unsigned char *haddr);
-static int ether1394_mac_addr(struct net_device *dev, void *p);
-
 static int ether1394_tx(struct sk_buff *skb, struct net_device *dev);
 static void ether1394_iso(struct hpsb_iso *iso);
 
@@ -516,7 +514,7 @@ static void ether1394_init_dev(struct ne
 	dev->hard_header_cache	= ether1394_header_cache;
 	dev->header_cache_update= ether1394_header_cache_update;
 	dev->hard_header_parse	= ether1394_header_parse;
-	dev->set_mac_address	= ether1394_mac_addr;
+	dev->set_mac_address	= NULL;
 	SET_ETHTOOL_OPS(dev, &ethtool_ops);
 
 	/* Some constants */
@@ -758,16 +756,6 @@ static void ether1394_header_cache_updat
 	memcpy((u8 *)hh->hh_data + 16 - ETH1394_HLEN, haddr, dev->addr_len);
 }
 
-static int ether1394_mac_addr(struct net_device *dev, void *p)
-{
-	if (netif_running(dev))
-		return -EBUSY;
-
-	/* Not going to allow setting the MAC address, we really need to use
-	 * the real one supplied by the hardware */
-	 return -EINVAL;
-}
-
 /******************************************
  * Datagram reception code
  ******************************************/

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 10/15] ieee1394: eth1394: don't use alloc_etherdev
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (8 preceding siblings ...)
  2007-04-02  0:19 ` [PATCH linux1394-2.6.git 09/15] ieee1394: eth1394: omit useless set_mac_address callback Stefan Richter
@ 2007-04-02  0:20 ` Stefan Richter
  2007-04-02  0:21 ` [PATCH linux1394-2.6.git 11/15] ieee1394: eth1394: clean up fragment_overlap Stefan Richter
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:20 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -50,7 +50,6 @@
 
 #include <linux/netdevice.h>
 #include <linux/inetdevice.h>
-#include <linux/etherdevice.h>
 #include <linux/if_arp.h>
 #include <linux/if_ether.h>
 #include <linux/ip.h>
@@ -498,10 +497,8 @@ static void ether1394_reset_priv(struct 
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
-/* This function is called right before register_netdev */
 static void ether1394_init_dev(struct net_device *dev)
 {
-	/* Our functions */
 	dev->open		= ether1394_open;
 	dev->stop		= ether1394_stop;
 	dev->hard_start_xmit	= ether1394_tx;
@@ -514,10 +511,9 @@ static void ether1394_init_dev(struct ne
 	dev->hard_header_cache	= ether1394_header_cache;
 	dev->header_cache_update= ether1394_header_cache_update;
 	dev->hard_header_parse	= ether1394_header_parse;
-	dev->set_mac_address	= NULL;
+
 	SET_ETHTOOL_OPS(dev, &ethtool_ops);
 
-	/* Some constants */
 	dev->watchdog_timeo	= ETHER1394_TIMEOUT;
 	dev->flags		= IFF_BROADCAST | IFF_MULTICAST;
 	dev->features		= NETIF_F_HIGHDMA;
@@ -525,7 +521,8 @@ static void ether1394_init_dev(struct ne
 	dev->hard_header_len 	= ETH1394_HLEN;
 	dev->type		= ARPHRD_IEEE1394;
 
-	ether1394_reset_priv(dev, 1);
+	/* FIXME: This value was copied from ether_setup(). Is it too much? */
+	dev->tx_queue_len	= 1000;
 }
 
 /*
@@ -555,11 +552,7 @@ static void ether1394_add_host(struct hp
 		return;
 	}
 
-	/* We should really have our own alloc_hpsbdev() function in
-	 * net_init.c instead of calling the one for ethernet then hijacking
-	 * it for ourselves.  That way we'd be a real networking device. */
-	dev = alloc_etherdev(sizeof (struct eth1394_priv));
-
+	dev = alloc_netdev(sizeof(*priv), "eth%d", ether1394_init_dev);
 	if (dev == NULL) {
 		ETH1394_PRINT_G(KERN_ERR, "Out of memory\n");
 		goto out;
@@ -572,21 +565,18 @@ static void ether1394_add_host(struct hp
 #endif
 
 	priv = netdev_priv(dev);
-
 	INIT_LIST_HEAD(&priv->ip_node_list);
-
 	spin_lock_init(&priv->lock);
 	priv->host = host;
 	priv->local_fifo = fifo_addr;
 
 	hi = hpsb_create_hostinfo(&eth1394_highlevel, host, sizeof(*hi));
-
 	if (hi == NULL) {
 		ETH1394_PRINT_G(KERN_ERR, "Out of memory\n");
 		goto out;
 	}
 
-	ether1394_init_dev(dev);
+	ether1394_reset_priv(dev, 1);
 
 	if (register_netdev(dev)) {
 		ETH1394_PRINT_G(KERN_ERR, "Cannot register the driver\n");

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 11/15] ieee1394: eth1394: clean up fragment_overlap
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (9 preceding siblings ...)
  2007-04-02  0:20 ` [PATCH linux1394-2.6.git 10/15] ieee1394: eth1394: don't use alloc_etherdev Stefan Richter
@ 2007-04-02  0:21 ` Stefan Richter
  2007-04-02  0:22 ` [PATCH linux1394-2.6.git 12/15] ieee1394: eth1394: some conditions are unlikely Stefan Richter
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:21 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

offset > fi->offset + fi->len - 1  ==  !(offset < fi->offset + fi->len)
offset + len - 1 < fi->offset      ==  !(offset + len > fi->offset)
!(A || B)  ==  (!A && !B)

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -871,12 +871,12 @@ static u16 ether1394_parse_encap(struct 
 static int fragment_overlap(struct list_head *frag_list, int offset, int len)
 {
 	struct fragment_info *fi;
+	int end = offset + len;
 
-	list_for_each_entry(fi, frag_list, list) {
-		if ( ! ((offset > (fi->offset + fi->len - 1)) ||
-		       ((offset + len - 1) < fi->offset)))
+	list_for_each_entry(fi, frag_list, list)
+		if (offset < fi->offset + fi->len && end > fi->offset)
 			return 1;
-	}
+
 	return 0;
 }
 

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 12/15] ieee1394: eth1394: some conditions are unlikely
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (10 preceding siblings ...)
  2007-04-02  0:21 ` [PATCH linux1394-2.6.git 11/15] ieee1394: eth1394: clean up fragment_overlap Stefan Richter
@ 2007-04-02  0:22 ` Stefan Richter
  2007-04-02  0:23 ` [PATCH linux1394-2.6.git 13/15] ieee1394: eth1394: hard_start_xmit is called in atomic context Stefan Richter
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:22 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -1027,7 +1027,7 @@ static int ether1394_data_handler(struct
 	if (!ud) {
 		struct eth1394_node_ref *node;
 		node = eth1394_find_node_nodeid(&priv->ip_node_list, srcid);
-		if (!node) {
+		if (unlikely(!node)) {
 			HPSB_PRINT(KERN_ERR, "ether1394 rx: sender nodeid "
 				   "lookup failure: " NODE_BUS_FMT,
 				   NODE_BUS_ARGS(priv->host, srcid));
@@ -1052,7 +1052,7 @@ static int ether1394_data_handler(struct
 		 * high level network layer. */
 
 		skb = dev_alloc_skb(len + dev->hard_header_len + 15);
-		if (!skb) {
+		if (unlikely(!skb)) {
 			ETH1394_PRINT_G(KERN_ERR, "Out of memory\n");
 			priv->stats.rx_dropped++;
 			return -1;
@@ -1207,7 +1207,7 @@ static int ether1394_write(struct hpsb_h
 	struct eth1394_host_info *hi;
 
 	hi = hpsb_get_hostinfo(&eth1394_highlevel, host);
-	if (hi == NULL) {
+	if (unlikely(!hi)) {
 		ETH1394_PRINT_G(KERN_ERR, "No net device at fw-host%d\n",
 				host->id);
 		return RCODE_ADDRESS_ERROR;
@@ -1233,7 +1233,7 @@ static void ether1394_iso(struct hpsb_is
 	int nready;
 
 	hi = hpsb_get_hostinfo(&eth1394_highlevel, iso->host);
-	if (hi == NULL) {
+	if (unlikely(!hi)) {
 		ETH1394_PRINT_G(KERN_ERR, "No net device at fw-host%d\n",
 				iso->host->id);
 		return;

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 13/15] ieee1394: eth1394: hard_start_xmit is called in atomic context
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (11 preceding siblings ...)
  2007-04-02  0:22 ` [PATCH linux1394-2.6.git 12/15] ieee1394: eth1394: some conditions are unlikely Stefan Richter
@ 2007-04-02  0:23 ` Stefan Richter
  2007-04-02  0:24 ` [PATCH linux1394-2.6.git 14/15] ieee1394: eth1394: correct return codes in hard_start_xmit Stefan Richter
  2007-04-02  0:25 ` [PATCH linux1394-2.6.git 15/15] ieee1394: eth1394: check for kmem_cache_create failure Stefan Richter
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:23 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -1525,7 +1525,6 @@ static void ether1394_complete_cb(void *
 /* Transmit a packet (called by kernel) */
 static int ether1394_tx(struct sk_buff *skb, struct net_device *dev)
 {
-	gfp_t kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
 	struct eth1394hdr *eth;
 	struct eth1394_priv *priv = netdev_priv(dev);
 	__be16 proto;
@@ -1541,7 +1540,7 @@ static int ether1394_tx(struct sk_buff *
 	struct eth1394_node_ref *node;
 	struct eth1394_node_info *node_info = NULL;
 
-	ptask = kmem_cache_alloc(packet_task_cache, kmflags);
+	ptask = kmem_cache_alloc(packet_task_cache, GFP_ATOMIC);
 	if (ptask == NULL) {
 		ret = -ENOMEM;
 		goto fail;
@@ -1557,7 +1556,7 @@ static int ether1394_tx(struct sk_buff *
 	}
 #endif
 
-	skb = skb_share_check(skb, kmflags);
+	skb = skb_share_check(skb, GFP_ATOMIC);
 	if (!skb) {
 		ret = -ENOMEM;
 		goto fail;

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 14/15] ieee1394: eth1394: correct return codes in hard_start_xmit
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (12 preceding siblings ...)
  2007-04-02  0:23 ` [PATCH linux1394-2.6.git 13/15] ieee1394: eth1394: hard_start_xmit is called in atomic context Stefan Richter
@ 2007-04-02  0:24 ` Stefan Richter
  2007-04-02  0:25 ` [PATCH linux1394-2.6.git 15/15] ieee1394: eth1394: check for kmem_cache_create failure Stefan Richter
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:24 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

This patch actually doesn't change anything because there was always 0
== NETDEV_TX_OK returned before.

TODO: Return NETDEV_TX_BUSY in error case and test in different error
conditions.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -1531,7 +1531,6 @@ static int ether1394_tx(struct sk_buff *
 	unsigned long flags;
 	nodeid_t dest_node;
 	eth1394_tx_type tx_type;
-	int ret = 0;
 	unsigned int tx_len;
 	unsigned int max_payload;
 	u16 dg_size;
@@ -1541,26 +1540,20 @@ static int ether1394_tx(struct sk_buff *
 	struct eth1394_node_info *node_info = NULL;
 
 	ptask = kmem_cache_alloc(packet_task_cache, GFP_ATOMIC);
-	if (ptask == NULL) {
-		ret = -ENOMEM;
+	if (ptask == NULL)
 		goto fail;
-	}
 
 	/* XXX Ignore this for now. Noticed that when MacOSX is the IRM,
 	 * it does not set our validity bit. We need to compensate for
 	 * that somewhere else, but not in eth1394. */
 #if 0
-	if ((priv->host->csr.broadcast_channel & 0xc0000000) != 0xc0000000) {
-		ret = -EAGAIN;
+	if ((priv->host->csr.broadcast_channel & 0xc0000000) != 0xc0000000)
 		goto fail;
-	}
 #endif
 
 	skb = skb_share_check(skb, GFP_ATOMIC);
-	if (!skb) {
-		ret = -ENOMEM;
+	if (!skb)
 		goto fail;
-	}
 
 	/* Get rid of the fake eth1394 header, but save a pointer */
 	eth = (struct eth1394hdr *)skb->data;
@@ -1587,16 +1580,13 @@ static int ether1394_tx(struct sk_buff *
 
 		node = eth1394_find_node_guid(&priv->ip_node_list,
 					      be64_to_cpu(guid));
-		if (!node) {
-			ret = -EAGAIN;
+		if (!node)
 			goto fail;
-		}
+
 		node_info =
 		    (struct eth1394_node_info *)node->ud->device.driver_data;
-		if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE) {
-			ret = -EAGAIN;
+		if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE)
 			goto fail;
-		}
 
 		dest_node = node->ud->ne->nodeid;
 		max_payload = node_info->maxpayload;
@@ -1643,7 +1633,7 @@ static int ether1394_tx(struct sk_buff *
 		goto fail;
 
 	netif_wake_queue(dev);
-	return 0;
+	return NETDEV_TX_OK;
 fail:
 	if (ptask)
 		kmem_cache_free(packet_task_cache, ptask);
@@ -1659,7 +1649,15 @@ fail:
 	if (netif_queue_stopped(dev))
 		netif_wake_queue(dev);
 
-	return 0;  /* returning non-zero causes serious problems */
+	/*
+	 * FIXME: According to a patch from 2003-02-26, "returning non-zero
+	 * causes serious problems" here, allegedly.  Before that patch,
+	 * -ERRNO was returned which is not appropriate under Linux 2.6.
+	 * Perhaps more needs to be done?  Stop the queue in serious
+	 * conditions and restart it elsewhere?
+	 */
+	/* return NETDEV_TX_BUSY; */
+	return NETDEV_TX_OK;
 }
 
 static void ether1394_get_drvinfo(struct net_device *dev,

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH linux1394-2.6.git 15/15] ieee1394: eth1394: check for kmem_cache_create failure
  2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
                   ` (13 preceding siblings ...)
  2007-04-02  0:24 ` [PATCH linux1394-2.6.git 14/15] ieee1394: eth1394: correct return codes in hard_start_xmit Stefan Richter
@ 2007-04-02  0:25 ` Stefan Richter
  14 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-02  0:25 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/eth1394.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -1676,6 +1676,8 @@ static int __init ether1394_init_module 
 	packet_task_cache = kmem_cache_create("packet_task",
 					      sizeof(struct packet_task),
 					      0, 0, NULL, NULL);
+	if (!packet_task_cache)
+		return -ENOMEM;
 
 	hpsb_register_highlevel(&eth1394_highlevel);
 	return hpsb_register_protocol(&eth1394_proto_driver);

-- 
Stefan Richter
-=====-=-=== -=-- ---=-
http://arcgraph.de/sr/


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH linux1394-2.6.git 07/15] ieee1394: eth1394: make MTU configurable
  2007-04-02  0:18 ` [PATCH linux1394-2.6.git 07/15] ieee1394: eth1394: make MTU configurable Stefan Richter
@ 2007-04-03 21:55   ` Stefan Richter
  0 siblings, 0 replies; 17+ messages in thread
From: Stefan Richter @ 2007-04-03 21:55 UTC (permalink / raw)
  To: linux1394-devel; +Cc: netdev

On  2 Apr, I wrote:
> +static int eth1394_data_len = 1500;
> +module_param_named(mtu, eth1394_data_len, int, S_IRUGO | S_IWUSR);
> +MODULE_PARM_DESC(mtu, "MTU (default = 1500)");

Can be solved without a new module load parameter.


From: Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: ieee1394: eth1394: allow MTU bigger than 1500

RFC 2734 says: "IP-capable nodes may operate with an MTU size larger
than the default [1500 octets], but the means by which a larger MTU is
configured are beyond the scope of this document."

Allow users to set an MTU bigger than 1500.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
Replaces patch "ieee1394: eth1394: make MTU configurable"

 drivers/ieee1394/eth1394.c |   34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

Index: linux/drivers/ieee1394/eth1394.c
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.c
+++ linux/drivers/ieee1394/eth1394.c
@@ -136,9 +136,6 @@ static const int hdr_type_len[] = {
 	sizeof(struct eth1394_sf_hdr)
 };
 
-/* For now, this needs to be 1500, so that XP works with us */
-#define ETH1394_DATA_LEN	ETH_DATA_LEN
-
 static const u16 eth1394_speedto_maxpayload[] = {
 /*     S100, S200, S400, S800, S1600, S3200 */
 	512, 1024, 2048, 4096,  4096,  4096
@@ -262,17 +259,27 @@ static void ether1394_tx_timeout(struct 
 	ether1394_host_reset(host);
 }
 
+static inline int ether1394_max_mtu(struct hpsb_host* host)
+{
+	return (1 << (host->csr.max_rec + 1))
+			- sizeof(union eth1394_hdr) - ETHER1394_GASP_OVERHEAD;
+}
+
 static int ether1394_change_mtu(struct net_device *dev, int new_mtu)
 {
-	int max_rec =
-		((struct eth1394_priv *)netdev_priv(dev))->host->csr.max_rec;
+	int max_mtu;
 
-	if (new_mtu < 68 ||
-	    new_mtu > ETH1394_DATA_LEN ||
-	    new_mtu > (1 << (max_rec + 1)) - sizeof(union eth1394_hdr) -
-		      ETHER1394_GASP_OVERHEAD)
+	if (new_mtu < 68)
 		return -EINVAL;
 
+	max_mtu = ether1394_max_mtu(
+			((struct eth1394_priv *)netdev_priv(dev))->host);
+	if (new_mtu > max_mtu) {
+		ETH1394_PRINT(KERN_INFO, dev->name,
+			      "Local node constrains MTU to %d\n", max_mtu);
+		return -ERANGE;
+	}
+
 	dev->mtu = new_mtu;
 	return 0;
 }
@@ -476,13 +483,10 @@ static void ether1394_reset_priv(struct 
 			max_speed = host->speed[i];
 	priv->bc_sspd = max_speed;
 
-	/* We'll use our maximum payload as the default MTU */
 	if (set_mtu) {
-		int max_payload = 1 << (host->csr.max_rec + 1);
-
-		dev->mtu = min(ETH1394_DATA_LEN,
-			       (int)(max_payload - sizeof(union eth1394_hdr) -
-				     ETHER1394_GASP_OVERHEAD));
+		/* Use the RFC 2734 default 1500 octets or the maximum payload
+		 * as initial MTU */
+		dev->mtu = min(1500, ether1394_max_mtu(host));
 
 		/* Set our hardware address while we're at it */
 		memcpy(dev->dev_addr, &guid, sizeof(u64));

-- 
Stefan Richter
-=====-=-=== -=-- ---==
http://arcgraph.de/sr/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2007-04-03 21:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-02  0:11 [PATCH linux1394-2.6.git 00/15] ieee1394: eth1394: cleanups and small fixes Stefan Richter
2007-04-02  0:12 ` [PATCH linux1394-2.6.git 01/15] ieee1394: eth1394: coding style Stefan Richter
2007-04-02  0:13 ` [PATCH linux1394-2.6.git 02/15] ieee1394: eth1394: .probe and .update may sleep Stefan Richter
2007-04-02  0:14 ` [PATCH linux1394-2.6.git 03/15] eth1394: refactor .probe and .update Stefan Richter
2007-04-02  0:15 ` [PATCH linux1394-2.6.git 04/15] ieee1394: eth1394: correct a memset argument Stefan Richter
2007-04-02  0:15 ` [PATCH linux1394-2.6.git 05/15] ieee1394: eth1394: shorter error messages Stefan Richter
2007-04-02  0:16 ` [PATCH linux1394-2.6.git 06/15] ieee1394: eth1394: contain host reset Stefan Richter
2007-04-02  0:18 ` [PATCH linux1394-2.6.git 07/15] ieee1394: eth1394: make MTU configurable Stefan Richter
2007-04-03 21:55   ` Stefan Richter
2007-04-02  0:19 ` [PATCH linux1394-2.6.git 08/15] eth1394: CONFIG_INET is always defined Stefan Richter
2007-04-02  0:19 ` [PATCH linux1394-2.6.git 09/15] ieee1394: eth1394: omit useless set_mac_address callback Stefan Richter
2007-04-02  0:20 ` [PATCH linux1394-2.6.git 10/15] ieee1394: eth1394: don't use alloc_etherdev Stefan Richter
2007-04-02  0:21 ` [PATCH linux1394-2.6.git 11/15] ieee1394: eth1394: clean up fragment_overlap Stefan Richter
2007-04-02  0:22 ` [PATCH linux1394-2.6.git 12/15] ieee1394: eth1394: some conditions are unlikely Stefan Richter
2007-04-02  0:23 ` [PATCH linux1394-2.6.git 13/15] ieee1394: eth1394: hard_start_xmit is called in atomic context Stefan Richter
2007-04-02  0:24 ` [PATCH linux1394-2.6.git 14/15] ieee1394: eth1394: correct return codes in hard_start_xmit Stefan Richter
2007-04-02  0:25 ` [PATCH linux1394-2.6.git 15/15] ieee1394: eth1394: check for kmem_cache_create failure Stefan Richter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.