Skip to content

Commit

Permalink
[ARCNET]: Fix return value from arcnet_send_packet().
Browse files Browse the repository at this point in the history
From: Pieter Dejaeghere <pieter@dejaeghere.net>

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pieter Dejaeghere authored and David S. Miller committed Sep 7, 2005
1 parent 0a3f435 commit c6bb15a
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions drivers/net/arcnet/arcnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
struct ArcProto *proto;
int txbuf;
unsigned long flags;
int freeskb = 0;
int freeskb, retval;

BUGMSG(D_DURING,
"transmit requested (status=%Xh, txbufs=%d/%d, len=%d, protocol %x)\n",
Expand All @@ -615,16 +615,19 @@ static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
if (skb->len - ARC_HDR_SIZE > XMTU && !proto->continue_tx) {
BUGMSG(D_NORMAL, "fixme: packet too large: compensating badly!\n");
dev_kfree_skb(skb);
return 0; /* don't try again */
return NETDEV_TX_OK; /* don't try again */
}

/* We're busy transmitting a packet... */
netif_stop_queue(dev);

spin_lock_irqsave(&lp->lock, flags);
AINTMASK(0);

txbuf = get_arcbuf(dev);
if(lp->next_tx == -1)
txbuf = get_arcbuf(dev);
else {
txbuf = -1;
}
if (txbuf != -1) {
if (proto->prepare_tx(dev, pkt, skb->len, txbuf) &&
!proto->ack_tx) {
Expand All @@ -638,17 +641,21 @@ static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
lp->outgoing.skb = skb;
lp->outgoing.pkt = pkt;

freeskb = 0;

if (proto->continue_tx &&
proto->continue_tx(dev, txbuf)) {
BUGMSG(D_NORMAL,
"bug! continue_tx finished the first time! "
"(proto='%c')\n", proto->suffix);
}
}

retval = NETDEV_TX_OK;
dev->trans_start = jiffies;
lp->next_tx = txbuf;
} else {
freeskb = 1;
retval = NETDEV_TX_BUSY;
freeskb = 0;
}

BUGMSG(D_DEBUG, "%s: %d: %s, status: %x\n",__FILE__,__LINE__,__FUNCTION__,ASTATUS());
Expand All @@ -664,7 +671,7 @@ static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
if (freeskb) {
dev_kfree_skb(skb);
}
return 0; /* no need to try again */
return retval; /* no need to try again */
}


Expand All @@ -690,7 +697,6 @@ static int go_tx(struct net_device *dev)
/* start sending */
ACOMMAND(TXcmd | (lp->cur_tx << 3));

dev->trans_start = jiffies;
lp->stats.tx_packets++;
lp->lasttrans_dest = lp->lastload_dest;
lp->lastload_dest = 0;
Expand Down Expand Up @@ -917,6 +923,9 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs)

BUGMSG(D_RECON, "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");

/* is the RECON info empty or old? */
if (!lp->first_recon || !lp->last_recon ||
Expand Down

0 comments on commit c6bb15a

Please sign in to comment.