patch-2.2.6 linux/drivers/net/defxx.c

Next file: linux/drivers/net/defxx.h
Previous file: linux/drivers/net/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.5/linux/drivers/net/defxx.c linux/drivers/net/defxx.c
@@ -1911,6 +1911,8 @@
 		}
 	bp = (DFX_board_t *) dev->priv;
 
+	spin_lock(&bp->lock);
+	
 	/* See if we're already servicing an interrupt */
 
 	if (dev->interrupt)
@@ -1955,6 +1957,7 @@
 		}
 
 	dev->interrupt = DFX_UNMASK_INTERRUPTS;
+	spin_unlock(&bp->lock);
 	return;
 	}
 
@@ -3205,10 +3208,11 @@
 	)
 
 	{
-	DFX_board_t			*bp = (DFX_board_t *) dev->priv;
-	u8					prod;				/* local transmit producer index */
+	DFX_board_t		*bp = (DFX_board_t *) dev->priv;
+	u8			prod;				/* local transmit producer index */
 	PI_XMT_DESCR		*p_xmt_descr;		/* ptr to transmit descriptor block entry */
 	XMT_DRIVER_DESCR	*p_xmt_drv_descr;	/* ptr to transmit driver descriptor */
+	unsigned long		flags;
 
 	/*
 	 * Verify that incoming transmit request is OK
@@ -3252,6 +3256,8 @@
 			}
 		}
 
+	spin_lock_irqsave(&bp->lock, flags);
+	
 	/* Get the current producer and the next free xmt data descriptor */
 
 	prod		= bp->rcv_xmt_reg.index.xmt_prod;
@@ -3272,9 +3278,10 @@
 
 	/* Write the three PRH bytes immediately before the FC byte */
 
-	*((char *)skb->data - 3) = DFX_PRH0_BYTE;	/* these byte values are defined */
-	*((char *)skb->data - 2) = DFX_PRH1_BYTE;	/* in the Motorola FDDI MAC chip */
-	*((char *)skb->data - 1) = DFX_PRH2_BYTE;	/* specification */
+	skb_push(skb,3);
+	skb->data[0] = DFX_PRH0_BYTE;	/* these byte values are defined */
+	skb->data[1] = DFX_PRH1_BYTE;	/* in the Motorola FDDI MAC chip */
+	skb->data[2] = DFX_PRH2_BYTE;	/* specification */
 
 	/*
 	 * Write the descriptor with buffer info and bump producer
@@ -3304,7 +3311,7 @@
 	 */
 
 	p_xmt_descr->long_0	= (u32) (PI_XMT_DESCR_M_SOP | PI_XMT_DESCR_M_EOP | ((skb->len + 3) << PI_XMT_DESCR_V_SEG_LEN));
-	p_xmt_descr->long_1 = (u32) virt_to_bus(skb->data - 3);
+	p_xmt_descr->long_1 = (u32) virt_to_bus(skb->data);
 
 	/*
 	 * Verify that descriptor is actually available
@@ -3318,7 +3325,11 @@
 	 */
 
 	if (prod == bp->rcv_xmt_reg.index.xmt_comp)
+	{
+		skb_pull(skb,3);
+		spin_unlock_irqrestore(&bp->lock, flags);
 		return(1);			/* requeue packet for later */
+	}
 
 	/*
 	 * Save info for this packet for xmt done indication routine
@@ -3342,6 +3353,7 @@
 
 	bp->rcv_xmt_reg.index.xmt_prod = prod;
 	dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword);
+	spin_unlock_irqrestore(&bp->lock, flags);
 	return(0);							/* packet queued to adapter */
 	}
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)