Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2f0a16b authored by Joe Perches's avatar Joe Perches Committed by Michael Grzeschik
Browse files

arcnet: Use network block comment style



Conformity can be useful.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
parent 5e7ef913
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -123,8 +123,7 @@ static void rx(struct net_device *dev, int bufnum,
	netif_rx(skb);
}

/*
 * Create the ARCnet hard/soft headers for raw mode.
/* Create the ARCnet hard/soft headers for raw mode.
 * There aren't any soft headers in raw mode - not even the protocol id.
 */
static int build_header(struct sk_buff *skb, struct net_device *dev,
@@ -133,21 +132,19 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,
	int hdr_size = ARC_HDR_SIZE;
	struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size);

	/*
	 * Set the source hardware address.
	/* Set the source hardware address.
	 *
	 * This is pretty pointless for most purposes, but it can help in
	 * debugging.  ARCnet does not allow us to change the source address in
	 * the actual packet sent)
	 * debugging.  ARCnet does not allow us to change the source address
	 * in the actual packet sent.
	 */
	pkt->hard.source = *dev->dev_addr;

	/* see linux/net/ethernet/eth.c to see where I got the following */

	if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
		/*
		 * FIXME: fill in the last byte of the dest ipaddr here to better
		 * comply with RFC1051 in "noarp" mode.
		/* FIXME: fill in the last byte of the dest ipaddr here
		 * to better comply with RFC1051 in "noarp" mode.
		 */
		pkt->hard.dest = 0;
		return hdr_size;
+6 −11
Original line number Diff line number Diff line
@@ -76,8 +76,7 @@ static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offse
#define AINTMASK(msk)	writeb((msk), _INTMASK)
#define SETCONF()	writeb(lp->config, _CONFIG)

/*
 * We cannot probe for a RIM I card; one reason is I don't know how to reset
/* We cannot probe for a RIM I card; one reason is I don't know how to reset
 * them.  In fact, we can't even get their node ID automatically.  So, we
 * need to be passed a specific shmem address, IRQ, and node ID.
 */
@@ -97,8 +96,7 @@ static int __init arcrimi_probe(struct net_device *dev)
		BUGLVL(D_NORMAL) printk("You need to specify your card's station ID!\n");
		return -ENODEV;
	}
	/*
	 * Grab the memory region at mem_start for MIRROR_SIZE bytes.
	/* Grab the memory region at mem_start for MIRROR_SIZE bytes.
	 * Later in arcrimi_found() the real size will be determined
	 * and this reserve will be released and the correct size
	 * will be taken.
@@ -131,9 +129,8 @@ static int check_mirror(unsigned long addr, size_t size)
	return res;
}

/*
 * Set up the struct net_device associated with this card.  Called after
 * probing succeeds.
/* Set up the struct net_device associated with this card.
 * Called after probing succeeds.
 */
static int __init arcrimi_found(struct net_device *dev)
{
@@ -199,8 +196,7 @@ static int __init arcrimi_found(struct net_device *dev)
	lp->hw.copy_to_card = arcrimi_copy_to_card;
	lp->hw.copy_from_card = arcrimi_copy_from_card;

	/*
	 * re-reserve the memory region - arcrimi_probe() alloced this reqion
	/* re-reserve the memory region - arcrimi_probe() alloced this reqion
	 * but didn't know the real size.  Free that region and then re-get
	 * with the correct size.  There is a VERY slim chance this could
	 * fail.
@@ -243,8 +239,7 @@ static int __init arcrimi_found(struct net_device *dev)
	return -EIO;
}

/*
 * Do a hardware reset on the card, and set up necessary registers.
/* Do a hardware reset on the card, and set up necessary registers.
 *
 * This should be called as little as possible, because it disrupts the
 * token on the network (causes a RECON) and requires a significant delay.
+31 −45
Original line number Diff line number Diff line
@@ -63,8 +63,7 @@ static int null_prepare_tx(struct net_device *dev, struct archdr *pkt,

static void arcnet_rx(struct net_device *dev, int bufnum);

/*
 * one ArcProto per possible proto ID.  None of the elements of
/* one ArcProto per possible proto ID.  None of the elements of
 * arc_proto_map are allowed to be NULL; they will get set to
 * arc_proto_default instead.  It also must not be NULL; if you would like
 * to set it to NULL, set it to &arc_proto_null instead.
@@ -149,9 +148,7 @@ static void __exit arcnet_exit(void)
module_init(arcnet_init);
module_exit(arcnet_exit);

/*
 * Dump the contents of an sk_buff
 */
/* Dump the contents of an sk_buff */
#if ARCNET_DEBUG_MAX & D_SKB
void arcnet_dump_skb(struct net_device *dev,
		     struct sk_buff *skb, char *desc)
@@ -167,9 +164,7 @@ void arcnet_dump_skb(struct net_device *dev,
EXPORT_SYMBOL(arcnet_dump_skb);
#endif

/*
 * Dump the contents of an ARCnet buffer
 */
/* Dump the contents of an ARCnet buffer */
#if (ARCNET_DEBUG_MAX & (D_RX | D_TX))
static void arcnet_dump_packet(struct net_device *dev, int bufnum,
			       char *desc, int take_arcnet_lock)
@@ -181,7 +176,8 @@ static void arcnet_dump_packet(struct net_device *dev, int bufnum,
	char hdr[32];

	/* hw.copy_from_card expects IRQ context so take the IRQ lock
	   to keep it single threaded */
	 * to keep it single threaded
	 */
	if (take_arcnet_lock)
		spin_lock_irqsave(&lp->lock, flags);

@@ -204,8 +200,7 @@ static void arcnet_dump_packet(struct net_device *dev, int bufnum,

#endif

/*
 * Unregister a protocol driver from the arc_proto_map.  Protocol drivers
/* Unregister a protocol driver from the arc_proto_map.  Protocol drivers
 * are responsible for registering themselves, but the unregister routine
 * is pretty generic so we'll do it here.
 */
@@ -226,8 +221,7 @@ void arcnet_unregister_proto(struct ArcProto *proto)
	}
}

/*
 * Add a buffer to the queue.  Only the interrupt handler is allowed to do
/* Add a buffer to the queue.  Only the interrupt handler is allowed to do
 * this, unless interrupts are disabled.
 *
 * Note: we don't check for a full queue, since there aren't enough buffers
@@ -250,9 +244,8 @@ static void release_arcbuf(struct net_device *dev, int bufnum)
	}
}

/*
 * Get a buffer from the queue.  If this returns -1, there are no buffers
 * available.
/* Get a buffer from the queue.
 * If this returns -1, there are no buffers available.
 */
static int get_arcbuf(struct net_device *dev)
{
@@ -346,8 +339,7 @@ struct net_device *alloc_arcdev(const char *name)
	return dev;
}

/*
 * Open/initialize the board.  This is called sometime after booting when
/* Open/initialize the board.  This is called sometime after booting when
 * the 'ifconfig' program is run.
 *
 * This routine should set everything up anew at each open, even registers
@@ -490,15 +482,13 @@ static int arcnet_header(struct sk_buff *skb, struct net_device *dev,
		BUGMSG(D_DEBUG, "arc_raw_proto used. proto='%c'\n", proto->suffix);
		_daddr = daddr ? *(uint8_t *)daddr : 0;
	} else if (!daddr) {
		/*
		 * if the dest addr isn't provided, we can't choose an encapsulation!
		 * Store the packet type (eg. ETH_P_IP) for now, and we'll push on a
		 * real header when we do rebuild_header.
		/* if the dest addr isn't provided, we can't choose an
		 * encapsulation!  Store the packet type (eg. ETH_P_IP)
		 * for now, and we'll push on a real header when we do
		 * rebuild_header.
		 */
		*(uint16_t *)skb_push(skb, 2) = type;
		/*
		 * XXX: Why not use skb->mac_len?
		 */
		/* XXX: Why not use skb->mac_len? */
		if (skb->network_header - skb->mac_header != 2)
			BUGMSG(D_NORMAL, "arcnet_header: Yikes!  diff (%d) is not 2!\n",
			       (int)(skb->network_header - skb->mac_header));
@@ -564,7 +554,8 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
		if (proto->prepare_tx(dev, pkt, skb->len, txbuf) &&
		    !proto->ack_tx) {
			/* done right away and we don't want to acknowledge
			   the package later - forget about it now */
			 *  the package later - forget about it now
			 */
			dev->stats.tx_bytes += skb->len;
			freeskb = 1;
		} else {
@@ -605,8 +596,7 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
	return retval;		/* no need to try again */
}

/*
 * Actually start transmitting a packet that was loaded into a buffer
/* Actually start transmitting a packet that was loaded into a buffer
 * by prepare_tx.  This should _only_ be called by the interrupt handler.
 */
static int go_tx(struct net_device *dev)
@@ -672,8 +662,7 @@ void arcnet_timeout(struct net_device *dev)
		netif_wake_queue(dev);
}

/*
 * The typical workload of the driver: Handle the network interface
/* The typical workload of the driver: Handle the network interface
 * interrupts. Establish which device needs attention, and call the correct
 * chipset interrupt handler.
 */
@@ -693,9 +682,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)

	spin_lock(&lp->lock);

	/*
	 * RESET flag was enabled - if device is not running, we must clear it right
	 * away (but nothing else).
	/* RESET flag was enabled - if device is not running, we must
	 * clear it right away (but nothing else).
	 */
	if (!netif_running(dev)) {
		if (ASTATUS() & RESETflag)
@@ -717,11 +705,11 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
		       __FILE__, __LINE__, __func__, status);
		didsomething = 0;

		/*
		 * RESET flag was enabled - card is resetting and if RX is
		/* RESET flag was enabled - card is resetting and if RX is
		 * disabled, it's NOT because we just got a packet.
		 *
		 * The card is in an undefined state.  Clear it out and start over.
		 * The card is in an undefined state.
		 * Clear it out and start over.
		 */
		if (status & RESETflag) {
			BUGMSG(D_NORMAL, "spurious reset (status=%Xh)\n", status);
@@ -731,14 +719,13 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
			/* get out of the interrupt handler! */
			break;
		}
		/*
		 * RX is inhibited - we must have received something. Prepare to
		 * receive into the next buffer.
		/* RX is inhibited - we must have received something.
		 * Prepare to receive into the next buffer.
		 *
		 * We don't actually copy the received packet from the card until
		 * after the transmit handler runs (and possibly launches the next
		 * tx); this should improve latency slightly if we get both types
		 * of interrupts at once.
		 * We don't actually copy the received packet from the card
		 * until after the transmit handler runs (and possibly
		 * launches the next tx); this should improve latency slightly
		 * if we get both types of interrupts at once.
		 */
		recbuf = -1;
		if (status & lp->intmask & NORXflag) {
@@ -914,8 +901,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
	return retval;
}

/*
 * This is a generic packet receiver that calls arcnet??_rx depending on the
/* This is a generic packet receiver that calls arcnet??_rx depending on the
 * protocol ID found.
 */
static void arcnet_rx(struct net_device *dev, int bufnum)
+12 −13
Original line number Diff line number Diff line
@@ -66,11 +66,11 @@ static void rx(struct net_device *dev, int bufnum,
	pkt = (struct archdr *)skb_mac_header(skb);
	skb_pull(skb, ARC_HDR_SIZE);

	/* up to sizeof(pkt->soft) has already been copied from the card */
	/* squeeze in an int for the cap encapsulation */

	/* use these variables to be sure we count in bytes, not in
	   sizeof(struct archdr) */
	/* up to sizeof(pkt->soft) has already been copied from the card
	 * squeeze in an int for the cap encapsulation
	 * use these variables to be sure we count in bytes, not in
	 * sizeof(struct archdr)
	 */
	pktbuf = (char *)pkt;
	pkthdrbuf = (char *)pkthdr;
	memcpy(pktbuf, pkthdrbuf, ARC_HDR_SIZE + sizeof(pkt->soft.cap.proto));
@@ -90,8 +90,7 @@ static void rx(struct net_device *dev, int bufnum,
	netif_rx(skb);
}

/*
 * Create the ARCnet hard/soft headers for cap mode.
/* Create the ARCnet hard/soft headers for cap mode.
 * There aren't any soft headers in cap mode - not even the protocol id.
 */
static int build_header(struct sk_buff *skb,
@@ -104,8 +103,8 @@ static int build_header(struct sk_buff *skb,

	BUGMSG(D_PROTO, "Preparing header for cap packet %x.\n",
	       *((int *)&pkt->soft.cap.cookie[0]));
	/*
	 * Set the source hardware address.

	/* Set the source hardware address.
	 *
	 * This is pretty pointless for most purposes, but it can help in
	 * debugging.  ARCnet does not allow us to change the source address in
@@ -116,9 +115,8 @@ static int build_header(struct sk_buff *skb,
	/* see linux/net/ethernet/eth.c to see where I got the following */

	if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
		/*
		 * FIXME: fill in the last byte of the dest ipaddr here to better
		 * comply with RFC1051 in "noarp" mode.
		/* FIXME: fill in the last byte of the dest ipaddr here to
		 * better comply with RFC1051 in "noarp" mode.
		 */
		pkt->hard.dest = 0;
		return hdr_size;
@@ -172,7 +170,8 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
			    sizeof(pkt->soft.cap.proto));

	/* Skip the extra integer we have written into it as a cookie
	   but write the rest of the message: */
	 * but write the rest of the message:
	 */
	lp->hw.copy_to_card(dev, bufnum, ofs + 1,
			    ((unsigned char *)&pkt->soft.cap.mes), length - 1);

+1 −2
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@

#define VERSION "arcnet: COM20020 ISA support (by David Woodhouse et al.)\n"

/*
 * We cannot (yet) probe for an IO mapped card, although we can check that
/* We cannot (yet) probe for an IO mapped card, although we can check that
 * it's where we were told it was, and even do autoirq.
 */
static int __init com20020isa_probe(struct net_device *dev)
Loading