mlx4_core: Don't leak mailbox for SET_PORT on Ethernet ports
[safe/jmp/linux-2.6] / drivers / net / 8139cp.c
index 13f75b6..a09e3a7 100644 (file)
@@ -604,7 +604,7 @@ rx_next:
 
                spin_lock_irqsave(&cp->lock, flags);
                cpw16_f(IntrMask, cp_intr_mask);
-               __netif_rx_complete(dev, napi);
+               __napi_complete(napi);
                spin_unlock_irqrestore(&cp->lock, flags);
        }
 
@@ -641,9 +641,9 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
        }
 
        if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr))
-               if (netif_rx_schedule_prep(dev, &cp->napi)) {
+               if (napi_schedule_prep(&cp->napi)) {
                        cpw16_f(IntrMask, cp_norx_intr_mask);
-                       __netif_rx_schedule(dev, &cp->napi);
+                       __napi_schedule(&cp->napi);
                }
 
        if (status & (TxOK | TxErr | TxEmpty | SWInt))
@@ -1602,6 +1602,28 @@ static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
        return rc;
 }
 
+static int cp_set_mac_address(struct net_device *dev, void *p)
+{
+       struct cp_private *cp = netdev_priv(dev);
+       struct sockaddr *addr = p;
+
+       if (!is_valid_ether_addr(addr->sa_data))
+               return -EADDRNOTAVAIL;
+
+       memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+
+       spin_lock_irq(&cp->lock);
+
+       cpw8_f(Cfg9346, Cfg9346_Unlock);
+       cpw32_f(MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0)));
+       cpw32_f(MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr + 4)));
+       cpw8_f(Cfg9346, Cfg9346_Lock);
+
+       spin_unlock_irq(&cp->lock);
+
+       return 0;
+}
+
 /* Serial EEPROM section. */
 
 /*  EEPROM_Ctrl bits. */
@@ -1821,9 +1843,11 @@ static const struct net_device_ops cp_netdev_ops = {
        .ndo_open               = cp_open,
        .ndo_stop               = cp_close,
        .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = cp_set_mac_address,
        .ndo_set_multicast_list = cp_set_rx_mode,
        .ndo_get_stats          = cp_get_stats,
        .ndo_do_ioctl           = cp_ioctl,
+       .ndo_start_xmit         = cp_start_xmit,
        .ndo_tx_timeout         = cp_tx_timeout,
 #if CP_VLAN_TAG_USED
        .ndo_vlan_rx_register   = cp_vlan_rx_register,
@@ -1831,6 +1855,7 @@ static const struct net_device_ops cp_netdev_ops = {
 #ifdef BROKEN
        .ndo_change_mtu         = cp_change_mtu,
 #endif
+
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller    = cp_poll_controller,
 #endif
@@ -1949,7 +1974,6 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
 
        dev->netdev_ops = &cp_netdev_ops;
-       dev->hard_start_xmit = cp_start_xmit;
        netif_napi_add(dev, &cp->napi, cp_rx_poll, 16);
        dev->ethtool_ops = &cp_ethtool_ops;
        dev->watchdog_timeo = TX_TIMEOUT;