netdev: bfin_mac: add support for wake-on-lan magic packets
[safe/jmp/linux-2.6] / drivers / net / iseries_veth.c
index e36e951..ba1de59 100644 (file)
@@ -69,6 +69,7 @@
 #include <linux/mm.h>
 #include <linux/ethtool.h>
 #include <linux/if_ether.h>
+#include <linux/slab.h>
 
 #include <asm/abs_addr.h>
 #include <asm/iseries/mf.h>
@@ -384,7 +385,7 @@ static struct attribute *veth_cnx_default_attrs[] = {
        NULL
 };
 
-static struct sysfs_ops veth_cnx_sysfs_ops = {
+static const struct sysfs_ops veth_cnx_sysfs_ops = {
                .show = veth_cnx_attribute_show
 };
 
@@ -441,7 +442,7 @@ static struct attribute *veth_port_default_attrs[] = {
        NULL
 };
 
-static struct sysfs_ops veth_port_sysfs_ops = {
+static const struct sysfs_ops veth_port_sysfs_ops = {
        .show = veth_port_attribute_show
 };
 
@@ -495,7 +496,7 @@ static void veth_take_cap_ack(struct veth_lpar_connection *cnx,
                           cnx->remote_lp);
        } else {
                memcpy(&cnx->cap_ack_event, event,
-                      sizeof(&cnx->cap_ack_event));
+                      sizeof(cnx->cap_ack_event));
                cnx->state |= VETH_STATE_GOTCAPACK;
                veth_kick_statemachine(cnx);
        }
@@ -604,10 +605,10 @@ static int veth_process_caps(struct veth_lpar_connection *cnx)
        /* Convert timer to jiffies */
        cnx->ack_timeout = remote_caps->ack_timeout * HZ / 1000000;
 
-       if ( (remote_caps->num_buffers == 0)
-            || (remote_caps->ack_threshold > VETH_MAX_ACKS_PER_MSG)
-            || (remote_caps->ack_threshold == 0)
-            || (cnx->ack_timeout == 0) ) {
+       if ( (remote_caps->num_buffers == 0) ||
+            (remote_caps->ack_threshold > VETH_MAX_ACKS_PER_MSG) ||
+            (remote_caps->ack_threshold == 0) ||
+            (cnx->ack_timeout == 0) ) {
                veth_error("Received incompatible capabilities from LPAR %d.\n",
                                cnx->remote_lp);
                return HvLpEvent_Rc_InvalidSubtypeData;
@@ -714,8 +715,8 @@ static void veth_statemachine(struct work_struct *work)
                cnx->state |= VETH_STATE_OPEN;
        }
 
-       if ( (cnx->state & VETH_STATE_OPEN)
-            && !(cnx->state & VETH_STATE_SENTMON) ) {
+       if ( (cnx->state & VETH_STATE_OPEN) &&
+            !(cnx->state & VETH_STATE_SENTMON) ) {
                rc = veth_signalevent(cnx, VETH_EVENT_MONITOR,
                                      HvLpEvent_AckInd_DoAck,
                                      HvLpEvent_AckType_DeferredAck,
@@ -724,8 +725,8 @@ static void veth_statemachine(struct work_struct *work)
                if (rc == HvLpEvent_Rc_Good) {
                        cnx->state |= VETH_STATE_SENTMON;
                } else {
-                       if ( (rc != HvLpEvent_Rc_PartitionDead)
-                            && (rc != HvLpEvent_Rc_PathClosed) )
+                       if ( (rc != HvLpEvent_Rc_PartitionDead) &&
+                            (rc != HvLpEvent_Rc_PathClosed) )
                                veth_error("Error sending monitor to LPAR %d, "
                                                "rc = %d\n", rlp, rc);
 
@@ -735,8 +736,8 @@ static void veth_statemachine(struct work_struct *work)
                }
        }
 
-       if ( (cnx->state & VETH_STATE_OPEN)
-            && !(cnx->state & VETH_STATE_SENTCAPS)) {
+       if ( (cnx->state & VETH_STATE_OPEN) &&
+            !(cnx->state & VETH_STATE_SENTCAPS)) {
                u64 *rawcap = (u64 *)&cnx->local_caps;
 
                rc = veth_signalevent(cnx, VETH_EVENT_CAP,
@@ -748,8 +749,8 @@ static void veth_statemachine(struct work_struct *work)
                if (rc == HvLpEvent_Rc_Good) {
                        cnx->state |= VETH_STATE_SENTCAPS;
                } else {
-                       if ( (rc != HvLpEvent_Rc_PartitionDead)
-                            && (rc != HvLpEvent_Rc_PathClosed) )
+                       if ( (rc != HvLpEvent_Rc_PartitionDead) &&
+                            (rc != HvLpEvent_Rc_PathClosed) )
                                veth_error("Error sending caps to LPAR %d, "
                                                "rc = %d\n", rlp, rc);
 
@@ -759,8 +760,8 @@ static void veth_statemachine(struct work_struct *work)
                }
        }
 
-       if ((cnx->state & VETH_STATE_GOTCAPS)
-           && !(cnx->state & VETH_STATE_SENTCAPACK)) {
+       if ((cnx->state & VETH_STATE_GOTCAPS) &&
+           !(cnx->state & VETH_STATE_SENTCAPACK)) {
                struct veth_cap_data *remote_caps = &cnx->remote_caps;
 
                memcpy(remote_caps, &cnx->cap_event.u.caps_data,
@@ -783,9 +784,9 @@ static void veth_statemachine(struct work_struct *work)
                        goto cant_cope;
        }
 
-       if ((cnx->state & VETH_STATE_GOTCAPACK)
-           && (cnx->state & VETH_STATE_GOTCAPS)
-           && !(cnx->state & VETH_STATE_READY)) {
+       if ((cnx->state & VETH_STATE_GOTCAPACK) &&
+           (cnx->state & VETH_STATE_GOTCAPS) &&
+           !(cnx->state & VETH_STATE_READY)) {
                if (cnx->cap_ack_event.base_event.xRc == HvLpEvent_Rc_Good) {
                        /* Start the ACK timer */
                        cnx->ack_timer.expires = jiffies + cnx->ack_timeout;
@@ -818,8 +819,8 @@ static int veth_init_connection(u8 rlp)
        struct veth_msg *msgs;
        int i;
 
-       if ( (rlp == this_lp)
-            || ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) )
+       if ( (rlp == this_lp) ||
+            ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) )
                return 0;
 
        cnx = kzalloc(sizeof(*cnx), GFP_KERNEL);
@@ -958,19 +959,18 @@ static void veth_set_multicast_list(struct net_device *dev)
        write_lock_irqsave(&port->mcast_gate, flags);
 
        if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI) ||
-                       (dev->mc_count > VETH_MAX_MCAST)) {
+                       (netdev_mc_count(dev) > VETH_MAX_MCAST)) {
                port->promiscuous = 1;
        } else {
-               struct dev_mc_list *dmi = dev->mc_list;
-               int i;
+               struct netdev_hw_addr *ha;
 
                port->promiscuous = 0;
 
                /* Update table */
                port->num_mcast = 0;
 
-               for (i = 0; i < dev->mc_count; i++) {
-                       u8 *addr = dmi->dmi_addr;
+               netdev_for_each_mc_addr(ha, dev) {
+                       u8 *addr = ha->addr;
                        u64 xaddr = 0;
 
                        if (addr[0] & 0x01) {/* multicast address? */
@@ -978,7 +978,6 @@ static void veth_set_multicast_list(struct net_device *dev)
                                port->mcast_addr[port->num_mcast] = xaddr;
                                port->num_mcast++;
                        }
-                       dmi = dmi->next;
                }
        }
 
@@ -1384,7 +1383,7 @@ static inline void veth_build_dma_list(struct dma_chunk *list,
        unsigned long done;
        int i = 1;
 
-       /* FIXME: skbs are continguous in real addresses.  Do we
+       /* FIXME: skbs are contiguous in real addresses.  Do we
         * really need to break it into PAGE_SIZE chunks, or can we do
         * it just at the granularity of iSeries real->absolute
         * mapping?  Indeed, given the way the allocator works, can we
@@ -1538,8 +1537,8 @@ static void veth_receive(struct veth_lpar_connection *cnx,
        cnx->pending_acks[cnx->num_pending_acks++] =
                event->base_event.xCorrelationToken;
 
-       if ( (cnx->num_pending_acks >= cnx->remote_caps.ack_threshold)
-            || (cnx->num_pending_acks >= VETH_MAX_ACKS_PER_MSG) )
+       if ( (cnx->num_pending_acks >= cnx->remote_caps.ack_threshold) ||
+            (cnx->num_pending_acks >= VETH_MAX_ACKS_PER_MSG) )
                veth_flush_acks(cnx);
 
        spin_unlock_irqrestore(&cnx->lock, flags);