patch-2.4.22 linux-2.4.22/drivers/acorn/net/ether3.c

Next file: linux-2.4.22/drivers/acorn/net/etherh.c
Previous file: linux-2.4.22/drivers/acorn/net/ether1.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/drivers/acorn/net/ether3.c linux-2.4.22/drivers/acorn/net/ether3.c
@@ -417,6 +417,9 @@
 static int
 ether3_open(struct net_device *dev)
 {
+	if (!is_valid_ether_addr(dev->dev_addr))
+		return -EINVAL;
+
 	if (request_irq(dev->irq, ether3_interrupt, 0, "ether3", dev))
 		return -EAGAIN;
 
@@ -460,6 +463,23 @@
 	return &priv->stats;
 }
 
+static int
+ether3_set_mac_address(struct net_device *dev, void *p)
+{
+	struct sockaddr *addr = p;
+
+	if (netif_running(dev))
+		return -EBUSY;
+
+	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+
+	/*
+	 * We'll set the MAC address on the chip when we open it.
+	 */
+
+	return 0;
+}
+
 /*
  * Set or clear promiscuous/multicast mode filter for this adaptor.
  *
@@ -531,6 +551,12 @@
 		return 0;
 	}
 
+	if (skb->len != length) {
+		skb = skb_padto(skb, length);
+		if (!skb)
+			goto out;
+	}
+
 	next_ptr = (priv->tx_head + 1) & 15;
 
 	save_flags_cli(flags);
@@ -572,6 +598,7 @@
 	if (priv->tx_tail == next_ptr)
 		netif_stop_queue(dev);
 
+ out:
 	return 0;
 }
 
@@ -718,7 +745,7 @@
 	/*
 	 * Don't print this message too many times...
 	 */
-	if (jiffies - last_warned > 30 * HZ) {
+	if (time_after(jiffies, last_warned + 10 * HZ)) {
 		last_warned = jiffies;
 		printk("%s: memory squeeze, dropping packet.\n", dev->name);
 	}
@@ -875,6 +902,7 @@
 	dev->hard_start_xmit	= ether3_sendpacket;
 	dev->get_stats		= ether3_getstats;
 	dev->set_multicast_list	= ether3_setmulticastlist;
+	dev->set_mac_address	= ether3_set_mac_address;
 	dev->tx_timeout		= ether3_timeout;
 	dev->watchdog_timeo	= 5 * HZ / 100;
 	return 0;

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