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

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

arcnet: Convert BUGMSG and BUGMSG2 to arc_prink and arc_cont



These macros don't actually represent BUG uses but are more commonly
used as logging macros, so use a more kernel style macro.

Convert the BUGMSG from a netdev_ like use to actually use netdev_<level>.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
parent 72aeea48
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ static void rx(struct net_device *dev, int bufnum,
	struct archdr *pkt = pkthdr;
	int ofs;

	BUGMSG(D_DURING, "it's a raw packet (length=%d)\n", length);
	arc_printk(D_DURING, dev, "it's a raw packet (length=%d)\n", length);

	if (length > MTU)
		ofs = 512 - length;
@@ -98,7 +98,7 @@ static void rx(struct net_device *dev, int bufnum,

	skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
	if (skb == NULL) {
		BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
		arc_printk(D_NORMAL, dev, "Memory squeeze, dropping packet\n");
		dev->stats.rx_dropped++;
		return;
	}
@@ -163,14 +163,14 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
	struct arc_hardware *hard = &pkt->hard;
	int ofs;

	BUGMSG(D_DURING, "prepare_tx: txbufs=%d/%d/%d\n",
	arc_printk(D_DURING, dev, "prepare_tx: txbufs=%d/%d/%d\n",
		   lp->next_tx, lp->cur_tx, bufnum);

	length -= ARC_HDR_SIZE;	/* hard header is not included in packet length */

	if (length > XMTU) {
		/* should never happen! other people already check for this. */
		BUGMSG(D_NORMAL, "Bug!  prepare_tx with size %d (> %d)\n",
		arc_printk(D_NORMAL, dev, "Bug!  prepare_tx with size %d (> %d)\n",
			   length, XMTU);
		length = XMTU;
	}
@@ -184,7 +184,7 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
		hard->offset[0] = ofs = 256 - length;
	}

	BUGMSG(D_DURING, "prepare_tx: length=%d ofs=%d\n",
	arc_printk(D_DURING, dev, "prepare_tx: length=%d ofs=%d\n",
		   length, ofs);

	lp->hw.copy_to_card(dev, bufnum, 0, hard, ARC_HDR_SIZE);
+13 −11
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ static int __init arcrimi_found(struct net_device *dev)
	p = ioremap(dev->mem_start, MIRROR_SIZE);
	if (!p) {
		release_mem_region(dev->mem_start, MIRROR_SIZE);
		BUGMSG(D_NORMAL, "Can't ioremap\n");
		arc_printk(D_NORMAL, dev, "Can't ioremap\n");
		return -ENODEV;
	}

@@ -155,7 +155,7 @@ static int __init arcrimi_found(struct net_device *dev)
	if (request_irq(dev->irq, arcnet_interrupt, 0, "arcnet (RIM I)", dev)) {
		iounmap(p);
		release_mem_region(dev->mem_start, MIRROR_SIZE);
		BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq);
		arc_printk(D_NORMAL, dev, "Can't get IRQ %d!\n", dev->irq);
		return -ENODEV;
	}

@@ -210,23 +210,24 @@ static int __init arcrimi_found(struct net_device *dev)
	if (!request_mem_region(dev->mem_start,
				dev->mem_end - dev->mem_start + 1,
				"arcnet (90xx)")) {
		BUGMSG(D_NORMAL, "Card memory already allocated\n");
		arc_printk(D_NORMAL, dev, "Card memory already allocated\n");
		goto err_free_irq;
	}

	lp->mem_start = ioremap(dev->mem_start, dev->mem_end - dev->mem_start + 1);
	if (!lp->mem_start) {
		BUGMSG(D_NORMAL, "Can't remap device memory!\n");
		arc_printk(D_NORMAL, dev, "Can't remap device memory!\n");
		goto err_release_mem;
	}

	/* get and check the station ID from offset 1 in shmem */
	dev->dev_addr[0] = readb(lp->mem_start + 1);

	BUGMSG(D_NORMAL, "ARCnet RIM I: station %02Xh found at IRQ %d, ShMem %lXh (%ld*%d bytes)\n",
	arc_printk(D_NORMAL, dev, "ARCnet RIM I: station %02Xh found at IRQ %d, ShMem %lXh (%ld*%d bytes)\n",
		   dev->dev_addr[0],
		   dev->irq, dev->mem_start,
	 (dev->mem_end - dev->mem_start + 1) / mirror_size, mirror_size);
		   (dev->mem_end - dev->mem_start + 1) / mirror_size,
		   mirror_size);

	err = register_netdev(dev);
	if (err)
@@ -255,7 +256,8 @@ static int arcrimi_reset(struct net_device *dev, int really_reset)
	struct arcnet_local *lp = netdev_priv(dev);
	void __iomem *ioaddr = lp->mem_start + 0x800;

	BUGMSG(D_INIT, "Resetting %s (status=%02Xh)\n", dev->name, ASTATUS());
	arc_printk(D_INIT, dev, "Resetting %s (status=%02Xh)\n",
		   dev->name, ASTATUS());

	if (really_reset) {
		writeb(TESTvalue, ioaddr - 0x800);	/* fake reset */
@@ -301,7 +303,7 @@ static void arcrimi_copy_to_card(struct net_device *dev, int bufnum, int offset,
	struct arcnet_local *lp = netdev_priv(dev);
	void __iomem *memaddr = lp->mem_start + 0x800 + bufnum * 512 + offset;

	TIME("memcpy_toio", count, memcpy_toio(memaddr, buf, count));
	TIME(dev, "memcpy_toio", count, memcpy_toio(memaddr, buf, count));
}

static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offset,
@@ -310,7 +312,7 @@ static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offse
	struct arcnet_local *lp = netdev_priv(dev);
	void __iomem *memaddr = lp->mem_start + 0x800 + bufnum * 512 + offset;

	TIME("memcpy_fromio", count, memcpy_fromio(buf, memaddr, count));
	TIME(dev, "memcpy_fromio", count, memcpy_fromio(buf, memaddr, count));
}

static int node;
+110 −102
Original line number Diff line number Diff line
@@ -236,11 +236,11 @@ static void release_arcbuf(struct net_device *dev, int bufnum)
	lp->first_free_buf %= 5;

	if (BUGLVL(D_DURING)) {
		BUGMSG(D_DURING, "release_arcbuf: freed #%d; buffer queue is now: ",
		arc_printk(D_DURING, dev, "release_arcbuf: freed #%d; buffer queue is now: ",
			   bufnum);
		for (i = lp->next_buf; i != lp->first_free_buf; i = (i + 1) % 5)
			BUGMSG2(D_DURING, "#%d ", lp->buf_queue[i]);
		BUGMSG2(D_DURING, "\n");
			arc_cont(D_DURING, "#%d ", lp->buf_queue[i]);
		arc_cont(D_DURING, "\n");
	}
}

@@ -254,14 +254,14 @@ static int get_arcbuf(struct net_device *dev)

	if (!atomic_dec_and_test(&lp->buf_lock)) {
		/* already in this function */
		BUGMSG(D_NORMAL, "get_arcbuf: overlap (%d)!\n",
		arc_printk(D_NORMAL, dev, "get_arcbuf: overlap (%d)!\n",
			   lp->buf_lock.counter);
	} else {			/* we can continue */
		if (lp->next_buf >= 5)
			lp->next_buf -= 5;

		if (lp->next_buf == lp->first_free_buf) {
			BUGMSG(D_NORMAL, "get_arcbuf: BUG: no buffers are available??\n");
			arc_printk(D_NORMAL, dev, "get_arcbuf: BUG: no buffers are available??\n");
		} else {
			buf = lp->buf_queue[lp->next_buf++];
			lp->next_buf %= 5;
@@ -269,10 +269,11 @@ static int get_arcbuf(struct net_device *dev)
	}

	if (BUGLVL(D_DURING)) {
		BUGMSG(D_DURING, "get_arcbuf: got #%d; buffer queue is now: ", buf);
		arc_printk(D_DURING, dev, "get_arcbuf: got #%d; buffer queue is now: ",
			   buf);
		for (i = lp->next_buf; i != lp->first_free_buf; i = (i + 1) % 5)
			BUGMSG2(D_DURING, "#%d ", lp->buf_queue[i]);
		BUGMSG2(D_DURING, "\n");
			arc_cont(D_DURING, "#%d ", lp->buf_queue[i]);
		arc_cont(D_DURING, "\n");
	}

	atomic_inc(&lp->buf_lock);
@@ -351,20 +352,20 @@ int arcnet_open(struct net_device *dev)
	struct arcnet_local *lp = netdev_priv(dev);
	int count, newmtu, error;

	BUGMSG(D_INIT, "opened.");
	arc_printk(D_INIT, dev, "opened.");

	if (!try_module_get(lp->hw.owner))
		return -ENODEV;

	if (BUGLVL(D_PROTO)) {
		BUGMSG(D_PROTO, "protocol map (default is '%c'): ",
		arc_printk(D_PROTO, dev, "protocol map (default is '%c'): ",
			   arc_proto_default->suffix);
		for (count = 0; count < 256; count++)
			BUGMSG2(D_PROTO, "%c", arc_proto_map[count]->suffix);
		BUGMSG2(D_PROTO, "\n");
			arc_cont(D_PROTO, "%c", arc_proto_map[count]->suffix);
		arc_cont(D_PROTO, "\n");
	}

	BUGMSG(D_INIT, "arcnet_open: resetting card.\n");
	arc_printk(D_INIT, dev, "arcnet_open: resetting card.\n");

	/* try to put the card in a defined state - if it fails the first
	 * time, actually reset it.
@@ -377,7 +378,7 @@ int arcnet_open(struct net_device *dev)
	if (newmtu < dev->mtu)
		dev->mtu = newmtu;

	BUGMSG(D_INIT, "arcnet_open: mtu: %d.\n", dev->mtu);
	arc_printk(D_INIT, dev, "arcnet_open: mtu: %d.\n", dev->mtu);

	/* autodetect the encapsulation for each host. */
	memset(lp->default_proto, 0, sizeof(lp->default_proto));
@@ -408,27 +409,28 @@ int arcnet_open(struct net_device *dev)
		lp->hw.open(dev);

	if (dev->dev_addr[0] == 0)
		BUGMSG(D_NORMAL, "WARNING!  Station address 00 is reserved for broadcasts!\n");
		arc_printk(D_NORMAL, dev, "WARNING!  Station address 00 is reserved for broadcasts!\n");
	else if (dev->dev_addr[0] == 255)
		BUGMSG(D_NORMAL, "WARNING!  Station address FF may confuse DOS networking programs!\n");
		arc_printk(D_NORMAL, dev, "WARNING!  Station address FF may confuse DOS networking programs!\n");

	BUGMSG(D_DEBUG, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
	arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
	if (ASTATUS() & RESETflag) {
		BUGMSG(D_DEBUG, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
		arc_printk(D_DEBUG, dev, "%s: %d: %s\n",
			   __FILE__, __LINE__, __func__);
		ACOMMAND(CFLAGScmd | RESETclear);
	}

	BUGMSG(D_DEBUG, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
	arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
	/* make sure we're ready to receive IRQ's. */
	AINTMASK(0);
	udelay(1);		/* give it time to set the mask before
				 * we reset it again. (may not even be
				 * necessary)
				 */
	BUGMSG(D_DEBUG, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
	arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
	lp->intmask = NORXflag | RECONflag;
	AINTMASK(lp->intmask);
	BUGMSG(D_DEBUG, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
	arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);

	netif_start_queue(dev);

@@ -466,20 +468,21 @@ static int arcnet_header(struct sk_buff *skb, struct net_device *dev,
	uint8_t _daddr, proto_num;
	struct ArcProto *proto;

	BUGMSG(D_DURING,
	arc_printk(D_DURING, dev,
		   "create header from %d to %d; protocol %d (%Xh); size %u.\n",
		   saddr ? *(uint8_t *)saddr : -1,
		   daddr ? *(uint8_t *)daddr : -1,
		   type, type, len);

	if (skb->len != 0 && len != skb->len)
		BUGMSG(D_NORMAL, "arcnet_header: Yikes!  skb->len(%d) != len(%d)!\n",
		arc_printk(D_NORMAL, dev, "arcnet_header: Yikes!  skb->len(%d) != len(%d)!\n",
			   skb->len, len);

	/* Type is host order - ? */
	if (type == ETH_P_ARCNET) {
		proto = arc_raw_proto;
		BUGMSG(D_DEBUG, "arc_raw_proto used. proto='%c'\n", proto->suffix);
		arc_printk(D_DEBUG, dev, "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
@@ -490,18 +493,18 @@ static int arcnet_header(struct sk_buff *skb, struct net_device *dev,
		*(uint16_t *)skb_push(skb, 2) = type;
		/* 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));
			arc_printk(D_NORMAL, dev, "arcnet_header: Yikes!  diff (%u) is not 2!\n",
				   skb->network_header - skb->mac_header);
		return -2;	/* return error -- can't transmit yet! */
	} else {
		/* otherwise, we can just add the header as usual. */
		_daddr = *(uint8_t *)daddr;
		proto_num = lp->default_proto[_daddr];
		proto = arc_proto_map[proto_num];
		BUGMSG(D_DURING, "building header for %02Xh using protocol '%c'\n",
		arc_printk(D_DURING, dev, "building header for %02Xh using protocol '%c'\n",
			   proto_num, proto->suffix);
		if (proto == &arc_proto_null && arc_bcast_proto != proto) {
			BUGMSG(D_DURING, "actually, let's use '%c' instead.\n",
			arc_printk(D_DURING, dev, "actually, let's use '%c' instead.\n",
				   arc_bcast_proto->suffix);
			proto = arc_bcast_proto;
		}
@@ -521,7 +524,7 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
	unsigned long flags;
	int freeskb, retval;

	BUGMSG(D_DURING,
	arc_printk(D_DURING, dev,
		   "transmit requested (status=%Xh, txbufs=%d/%d, len=%d, protocol %x)\n",
		   ASTATUS(), lp->cur_tx, lp->next_tx, skb->len, skb->protocol);

@@ -529,14 +532,14 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
	soft = &pkt->soft.rfc1201;
	proto = arc_proto_map[soft->proto];

	BUGMSG(D_SKB_SIZE, "skb: transmitting %d bytes to %02X\n",
	arc_printk(D_SKB_SIZE, dev, "skb: transmitting %d bytes to %02X\n",
		   skb->len, pkt->hard.dest);
	if (BUGLVL(D_SKB))
		arcnet_dump_skb(dev, skb, "tx");

	/* fits in one packet? */
	if (skb->len - ARC_HDR_SIZE > XMTU && !proto->continue_tx) {
		BUGMSG(D_NORMAL, "fixme: packet too large: compensating badly!\n");
		arc_printk(D_NORMAL, dev, "fixme: packet too large: compensating badly!\n");
		dev_kfree_skb(skb);
		return NETDEV_TX_OK;	/* don't try again */
	}
@@ -569,7 +572,7 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,

			if (proto->continue_tx &&
			    proto->continue_tx(dev, txbuf)) {
				BUGMSG(D_NORMAL,
				arc_printk(D_NORMAL, dev,
					   "bug! continue_tx finished the first time! (proto='%c')\n",
					   proto->suffix);
			}
@@ -581,14 +584,16 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
		freeskb = 0;
	}

	BUGMSG(D_DEBUG, "%s: %d: %s, status: %x\n", __FILE__, __LINE__, __func__, ASTATUS());
	arc_printk(D_DEBUG, dev, "%s: %d: %s, status: %x\n",
		   __FILE__, __LINE__, __func__, ASTATUS());
	/* make sure we didn't ignore a TX IRQ while we were in here */
	AINTMASK(0);

	BUGMSG(D_DEBUG, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
	arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
	lp->intmask |= TXFREEflag | EXCNAKflag;
	AINTMASK(lp->intmask);
	BUGMSG(D_DEBUG, "%s: %d: %s, status: %x\n", __FILE__, __LINE__, __func__, ASTATUS());
	arc_printk(D_DEBUG, dev, "%s: %d: %s, status: %x\n",
		   __FILE__, __LINE__, __func__, ASTATUS());

	spin_unlock_irqrestore(&lp->lock, flags);
	if (freeskb)
@@ -604,7 +609,7 @@ static int go_tx(struct net_device *dev)
{
	struct arcnet_local *lp = netdev_priv(dev);

	BUGMSG(D_DURING, "go_tx: status=%Xh, intmask=%Xh, next_tx=%d, cur_tx=%d\n",
	arc_printk(D_DURING, dev, "go_tx: status=%Xh, intmask=%Xh, next_tx=%d, cur_tx=%d\n",
		   ASTATUS(), lp->intmask, lp->next_tx, lp->cur_tx);

	if (lp->cur_tx != -1 || lp->next_tx == -1)
@@ -655,7 +660,7 @@ void arcnet_timeout(struct net_device *dev)
	spin_unlock_irqrestore(&lp->lock, flags);

	if (time_after(jiffies, lp->last_timeout + 10 * HZ)) {
		BUGMSG(D_EXTRA, "tx timed out%s (status=%Xh, intmask=%Xh, dest=%02Xh)\n",
		arc_printk(D_EXTRA, dev, "tx timed out%s (status=%Xh, intmask=%Xh, dest=%02Xh)\n",
			   msg, status, lp->intmask, lp->lasttrans_dest);
		lp->last_timeout = jiffies;
	}
@@ -675,9 +680,9 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
	int recbuf, status, diagstatus, didsomething, boguscount;
	int retval = IRQ_NONE;

	BUGMSG(D_DURING, "\n");
	arc_printk(D_DURING, dev, "\n");

	BUGMSG(D_DURING, "in arcnet_interrupt\n");
	arc_printk(D_DURING, dev, "in arcnet_interrupt\n");

	lp = netdev_priv(dev);
	BUG_ON(!lp);
@@ -695,7 +700,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
		return retval;
	}

	BUGMSG(D_DURING, "in arcnet_inthandler (status=%Xh, intmask=%Xh)\n",
	arc_printk(D_DURING, dev, "in arcnet_inthandler (status=%Xh, intmask=%Xh)\n",
		   ASTATUS(), lp->intmask);

	boguscount = 5;
@@ -703,7 +708,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
		status = ASTATUS();
		diagstatus = (status >> 8) & 0xFF;

		BUGMSG(D_DEBUG, "%s: %d: %s: status=%x\n",
		arc_printk(D_DEBUG, dev, "%s: %d: %s: status=%x\n",
			   __FILE__, __LINE__, __func__, status);
		didsomething = 0;

@@ -714,7 +719,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
		 * Clear it out and start over.
		 */
		if (status & RESETflag) {
			BUGMSG(D_NORMAL, "spurious reset (status=%Xh)\n", status);
			arc_printk(D_NORMAL, dev, "spurious reset (status=%Xh)\n",
				   status);
			arcnet_close(dev);
			arcnet_open(dev);

@@ -732,12 +738,12 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
		recbuf = -1;
		if (status & lp->intmask & NORXflag) {
			recbuf = lp->cur_rx;
			BUGMSG(D_DURING, "Buffer #%d: receive irq (status=%Xh)\n",
			arc_printk(D_DURING, dev, "Buffer #%d: receive irq (status=%Xh)\n",
				   recbuf, status);

			lp->cur_rx = get_arcbuf(dev);
			if (lp->cur_rx != -1) {
				BUGMSG(D_DURING, "enabling receive to buffer #%d\n",
				arc_printk(D_DURING, dev, "enabling receive to buffer #%d\n",
					   lp->cur_rx);
				ACOMMAND(RXcmd | (lp->cur_rx << 3) | RXbcasts);
			}
@@ -745,7 +751,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
		}

		if ((diagstatus & EXCNAKflag)) {
			BUGMSG(D_DURING, "EXCNAK IRQ (diagstat=%Xh)\n",
			arc_printk(D_DURING, dev, "EXCNAK IRQ (diagstat=%Xh)\n",
				   diagstatus);

			ACOMMAND(NOTXcmd);      /* disable transmit */
@@ -760,20 +766,22 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
		if ((status & lp->intmask & TXFREEflag) || lp->timed_out) {
			lp->intmask &= ~(TXFREEflag | EXCNAKflag);

			BUGMSG(D_DURING, "TX IRQ (stat=%Xh)\n", status);
			arc_printk(D_DURING, dev, "TX IRQ (stat=%Xh)\n", status);

			if (lp->cur_tx != -1 && !lp->timed_out) {
				if (!(status & TXACKflag)) {
					if (lp->lasttrans_dest != 0) {
						BUGMSG(D_EXTRA,
						arc_printk(D_EXTRA, dev,
							   "transmit was not acknowledged! (status=%Xh, dest=%02Xh)\n",
						       status, lp->lasttrans_dest);
							   status,
							   lp->lasttrans_dest);
						dev->stats.tx_errors++;
						dev->stats.tx_carrier_errors++;
					} else {
						BUGMSG(D_DURING,
						arc_printk(D_DURING, dev,
							   "broadcast was not acknowledged; that's normal (status=%Xh, dest=%02Xh)\n",
						       status, lp->lasttrans_dest);
							   status,
							   lp->lasttrans_dest);
					}
				}

@@ -836,26 +844,26 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
			ACOMMAND(CFLAGScmd | CONFIGclear);
			dev->stats.tx_carrier_errors++;

			BUGMSG(D_RECON, "Network reconfiguration detected (status=%Xh)\n",
			arc_printk(D_RECON, dev, "Network reconfiguration detected (status=%Xh)\n",
				   status);
			/* MYRECON bit is at bit 7 of diagstatus */
			if (diagstatus & 0x80)
				BUGMSG(D_RECON, "Put out that recon myself\n");
				arc_printk(D_RECON, dev, "Put out that recon myself\n");

			/* is the RECON info empty or old? */
			if (!lp->first_recon || !lp->last_recon ||
			    time_after(jiffies, lp->last_recon + HZ * 10)) {
				if (lp->network_down)
					BUGMSG(D_NORMAL, "reconfiguration detected: cabling restored?\n");
					arc_printk(D_NORMAL, dev, "reconfiguration detected: cabling restored?\n");
				lp->first_recon = lp->last_recon = jiffies;
				lp->num_recons = lp->network_down = 0;

				BUGMSG(D_DURING, "recon: clearing counters.\n");
				arc_printk(D_DURING, dev, "recon: clearing counters.\n");
			} else {	/* add to current RECON counter */
				lp->last_recon = jiffies;
				lp->num_recons++;

				BUGMSG(D_DURING, "recon: counter=%d, time=%lds, net=%d\n",
				arc_printk(D_DURING, dev, "recon: counter=%d, time=%lds, net=%d\n",
					   lp->num_recons,
					   (lp->last_recon - lp->first_recon) / HZ,
					   lp->network_down);
@@ -870,7 +878,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
				    (lp->last_recon - lp->first_recon) <= HZ * 60 &&
				    lp->num_recons >= RECON_THRESHOLD) {
					lp->network_down = 1;
					BUGMSG(D_NORMAL, "many reconfigurations detected: cabling problem?\n");
					arc_printk(D_NORMAL, dev, "many reconfigurations detected: cabling problem?\n");
				} else if (!lp->network_down &&
					   lp->last_recon - lp->first_recon > HZ * 60) {
					/* reset counters if we've gone for over a minute. */
@@ -881,20 +889,20 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
		} else if (lp->network_down &&
			   time_after(jiffies, lp->last_recon + HZ * 10)) {
			if (lp->network_down)
				BUGMSG(D_NORMAL, "cabling restored?\n");
				arc_printk(D_NORMAL, dev, "cabling restored?\n");
			lp->first_recon = lp->last_recon = 0;
			lp->num_recons = lp->network_down = 0;

			BUGMSG(D_DURING, "not recon: clearing counters anyway.\n");
			arc_printk(D_DURING, dev, "not recon: clearing counters anyway.\n");
		}

		if (didsomething)
			retval |= IRQ_HANDLED;
	} while (--boguscount && didsomething);

	BUGMSG(D_DURING, "arcnet_interrupt complete (status=%Xh, count=%d)\n",
	arc_printk(D_DURING, dev, "arcnet_interrupt complete (status=%Xh, count=%d)\n",
		   ASTATUS(), boguscount);
	BUGMSG(D_DURING, "\n");
	arc_printk(D_DURING, dev, "\n");

	AINTMASK(0);
	udelay(1);
@@ -933,7 +941,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
		lp->hw.copy_from_card(dev, bufnum, ofs, soft, length);
	}

	BUGMSG(D_DURING, "Buffer #%d: received packet from %02Xh to %02Xh (%d+4 bytes)\n",
	arc_printk(D_DURING, dev, "Buffer #%d: received packet from %02Xh to %02Xh (%d+4 bytes)\n",
		   bufnum, pkt.hard.source, pkt.hard.dest, length);

	dev->stats.rx_packets++;
@@ -947,7 +955,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
			*newp = arc_proto_map[soft->proto];

			if (oldp != newp) {
				BUGMSG(D_PROTO,
				arc_printk(D_PROTO, dev,
					   "got protocol %02Xh; encap for host %02Xh is now '%c' (was '%c')\n",
					   soft->proto, pkt.hard.source,
					   newp->suffix, oldp->suffix);
@@ -967,7 +975,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
static void null_rx(struct net_device *dev, int bufnum,
		    struct archdr *pkthdr, int length)
{
	BUGMSG(D_PROTO,
	arc_printk(D_PROTO, dev,
		   "rx: don't know how to deal with proto %02Xh from host %02Xh.\n",
		   pkthdr->soft.rfc1201.proto, pkthdr->hard.source);
}
@@ -977,7 +985,7 @@ static int null_build_header(struct sk_buff *skb, struct net_device *dev,
{
	struct arcnet_local *lp = netdev_priv(dev);

	BUGMSG(D_PROTO,
	arc_printk(D_PROTO, dev,
		   "tx: can't build header for encap %02Xh; load a protocol driver.\n",
		   lp->default_proto[daddr]);

@@ -992,7 +1000,7 @@ static int null_prepare_tx(struct net_device *dev, struct archdr *pkt,
	struct arcnet_local *lp = netdev_priv(dev);
	struct arc_hardware newpkt;

	BUGMSG(D_PROTO, "tx: no encap for this host; load a protocol driver.\n");
	arc_printk(D_PROTO, dev, "tx: no encap for this host; load a protocol driver.\n");

	/* send a packet to myself -- will never get received, of course */
	newpkt.source = newpkt.dest = dev->dev_addr[0];
+18 −17
Original line number Diff line number Diff line
@@ -47,7 +47,8 @@ static void rx(struct net_device *dev, int bufnum,
	char *pktbuf, *pkthdrbuf;
	int ofs;

	BUGMSG(D_DURING, "it's a raw(cap) packet (length=%d)\n", length);
	arc_printk(D_DURING, dev, "it's a raw(cap) packet (length=%d)\n",
		   length);

	if (length >= MinTU)
		ofs = 512 - length;
@@ -56,7 +57,7 @@ static void rx(struct net_device *dev, int bufnum,

	skb = alloc_skb(length + ARC_HDR_SIZE + sizeof(int), GFP_ATOMIC);
	if (skb == NULL) {
		BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
		arc_printk(D_NORMAL, dev, "Memory squeeze, dropping packet\n");
		dev->stats.rx_dropped++;
		return;
	}
@@ -102,7 +103,7 @@ static int build_header(struct sk_buff *skb,
	int hdr_size = ARC_HDR_SIZE;
	struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size);

	BUGMSG(D_PROTO, "Preparing header for cap packet %x.\n",
	arc_printk(D_PROTO, dev, "Preparing header for cap packet %x.\n",
		   *((int *)&pkt->soft.cap.cookie[0]));

	/* Set the source hardware address.
@@ -140,15 +141,15 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
	/* And neither is the cookie field */
	length -= sizeof(int);

	BUGMSG(D_DURING, "prepare_tx: txbufs=%d/%d/%d\n",
	arc_printk(D_DURING, dev, "prepare_tx: txbufs=%d/%d/%d\n",
		   lp->next_tx, lp->cur_tx, bufnum);

	BUGMSG(D_PROTO, "Sending for cap packet %x.\n",
	arc_printk(D_PROTO, dev, "Sending for cap packet %x.\n",
		   *((int *)&pkt->soft.cap.cookie[0]));

	if (length > XMTU) {
		/* should never happen! other people already check for this. */
		BUGMSG(D_NORMAL, "Bug!  prepare_tx with size %d (> %d)\n",
		arc_printk(D_NORMAL, dev, "Bug!  prepare_tx with size %d (> %d)\n",
			   length, XMTU);
		length = XMTU;
	}
@@ -162,7 +163,7 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
		hard->offset[0] = ofs = 256 - length;
	}

	BUGMSG(D_DURING, "prepare_tx: length=%d ofs=%d\n",
	arc_printk(D_DURING, dev, "prepare_tx: length=%d ofs=%d\n",
		   length, ofs);

	/* Copy the arcnet-header + the protocol byte down: */
@@ -188,7 +189,7 @@ static int ack_tx(struct net_device *dev, int acked)
	struct archdr *ackpkt;
	int length = sizeof(struct arc_cap);

	BUGMSG(D_DURING, "capmode: ack_tx: protocol: %x: result: %d\n",
	arc_printk(D_DURING, dev, "capmode: ack_tx: protocol: %x: result: %d\n",
		   lp->outgoing.skb->protocol, acked);

	if (BUGLVL(D_SKB))
@@ -197,7 +198,7 @@ static int ack_tx(struct net_device *dev, int acked)
	/* Now alloc a skb to send back up through the layers: */
	ackskb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
	if (ackskb == NULL) {
		BUGMSG(D_NORMAL, "Memory squeeze, can't acknowledge.\n");
		arc_printk(D_NORMAL, dev, "Memory squeeze, can't acknowledge\n");
		goto free_outskb;
	}

@@ -213,7 +214,7 @@ static int ack_tx(struct net_device *dev, int acked)
	ackpkt->soft.cap.proto = 0; /* using protocol 0 for acknowledge */
	ackpkt->soft.cap.mes.ack = acked;

	BUGMSG(D_PROTO, "Ackknowledge for cap packet %x.\n",
	arc_printk(D_PROTO, dev, "Ackknowledge for cap packet %x.\n",
		   *((int *)&ackpkt->soft.cap.cookie[0]));

	ackskb->protocol = cpu_to_be16(ETH_P_ARCNET);
+8 −7
Original line number Diff line number Diff line
@@ -58,16 +58,16 @@ static int __init com20020isa_probe(struct net_device *dev)

	ioaddr = dev->base_addr;
	if (!ioaddr) {
		BUGMSG(D_NORMAL, "No autoprobe (yet) for IO mapped cards; you must specify the base address!\n");
		arc_printk(D_NORMAL, dev, "No autoprobe (yet) for IO mapped cards; you must specify the base address!\n");
		return -ENODEV;
	}
	if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "arcnet (COM20020)")) {
		BUGMSG(D_NORMAL, "IO region %xh-%xh already allocated.\n",
		arc_printk(D_NORMAL, dev, "IO region %xh-%xh already allocated.\n",
			   ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
		return -ENXIO;
	}
	if (ASTATUS() == 0xFF) {
		BUGMSG(D_NORMAL, "IO address %x empty\n", ioaddr);
		arc_printk(D_NORMAL, dev, "IO address %x empty\n", ioaddr);
		err = -ENODEV;
		goto out;
	}
@@ -81,7 +81,8 @@ static int __init com20020isa_probe(struct net_device *dev)
		 * card has just reset and the NORXflag is on until
		 * we tell it to start receiving.
		 */
		BUGMSG(D_INIT_REASONS, "intmask was %02Xh\n", inb(_INTMASK));
		arc_printk(D_INIT_REASONS, dev, "intmask was %02Xh\n",
			   inb(_INTMASK));
		outb(0, _INTMASK);
		airqmask = probe_irq_on();
		outb(NORXflag, _INTMASK);
@@ -90,14 +91,14 @@ static int __init com20020isa_probe(struct net_device *dev)
		dev->irq = probe_irq_off(airqmask);

		if ((int)dev->irq <= 0) {
			BUGMSG(D_INIT_REASONS, "Autoprobe IRQ failed first time\n");
			arc_printk(D_INIT_REASONS, dev, "Autoprobe IRQ failed first time\n");
			airqmask = probe_irq_on();
			outb(NORXflag, _INTMASK);
			udelay(5);
			outb(0, _INTMASK);
			dev->irq = probe_irq_off(airqmask);
			if ((int)dev->irq <= 0) {
				BUGMSG(D_NORMAL, "Autoprobe IRQ failed.\n");
				arc_printk(D_NORMAL, dev, "Autoprobe IRQ failed.\n");
				err = -ENODEV;
				goto out;
			}
Loading