]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
enic: Clean ups
authorVasanthy Kolluri <vkolluri@cisco.com>
Thu, 24 Jun 2010 10:52:26 +0000 (10:52 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Jun 2010 03:50:30 +0000 (20:50 -0700)
1) Update copyright
2) Fix hardware queue descriptor field size CQ_ENET_RQ_DESC_FCOE_SOF_BITS
3) Include rtnetlink.h instead of if_link.h
4) Selectively flush writes to interrupt mask register
5) Use pci_enable_device_mem
6) Remove unused variables and header files
7) Fix size mismatch between memory alloc and free operations of a variable
8) Check for non null arguments to vic_provinfo_alloc

Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: Vasanthy Kolluri <vkolluri@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
25 files changed:
drivers/net/enic/cq_desc.h
drivers/net/enic/cq_enet_desc.h
drivers/net/enic/enic.h
drivers/net/enic/enic_main.c
drivers/net/enic/enic_res.c
drivers/net/enic/enic_res.h
drivers/net/enic/rq_enet_desc.h
drivers/net/enic/vnic_cq.c
drivers/net/enic/vnic_cq.h
drivers/net/enic/vnic_dev.c
drivers/net/enic/vnic_dev.h
drivers/net/enic/vnic_devcmd.h
drivers/net/enic/vnic_enet.h
drivers/net/enic/vnic_intr.c
drivers/net/enic/vnic_intr.h
drivers/net/enic/vnic_nic.h
drivers/net/enic/vnic_resource.h
drivers/net/enic/vnic_rq.c
drivers/net/enic/vnic_rq.h
drivers/net/enic/vnic_rss.h
drivers/net/enic/vnic_stats.h
drivers/net/enic/vnic_vic.c
drivers/net/enic/vnic_wq.c
drivers/net/enic/vnic_wq.h
drivers/net/enic/wq_enet_desc.h

index 1eb289f773bf1b32880908d8199da790423ea13d..d6dd1b4edf6e3c80cc8e8f8fc94d5da8a89b3b28 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index f2d98bbf05aad8f174f49b568127e6ff9561f1d9..c2c0680a1146793c2bf4393dbd746835f6395aa9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
@@ -82,7 +82,7 @@ struct cq_enet_rq_desc {
        ((1 << CQ_ENET_RQ_DESC_VLAN_TCI_USER_PRIO_BITS) - 1)
 #define CQ_ENET_RQ_DESC_VLAN_TCI_USER_PRIO_SHIFT    13
 
-#define CQ_ENET_RQ_DESC_FCOE_SOF_BITS               4
+#define CQ_ENET_RQ_DESC_FCOE_SOF_BITS               8
 #define CQ_ENET_RQ_DESC_FCOE_SOF_MASK \
        ((1 << CQ_ENET_RQ_DESC_FCOE_SOF_BITS) - 1)
 #define CQ_ENET_RQ_DESC_FCOE_EOF_BITS               8
index 7280314804a383d99d895dd2be946f9260e1d392..f239aa8c6f4ce6d6e86341ab09ca461fdd76f89e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
@@ -33,7 +33,7 @@
 #define DRV_NAME               "enic"
 #define DRV_DESCRIPTION                "Cisco VIC Ethernet NIC Driver"
 #define DRV_VERSION            "1.4.1.1"
-#define DRV_COPYRIGHT          "Copyright 2008-2009 Cisco Systems, Inc"
+#define DRV_COPYRIGHT          "Copyright 2008-2010 Cisco Systems, Inc"
 
 #define ENIC_BARS_MAX          6
 
index eda5530004dc4e35c11f2fa6b59a31412a544aeb..6c6795b90fa6bb99d18aa6072c9450d21f576817 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
 #include <linux/etherdevice.h>
 #include <linux/if_ether.h>
 #include <linux/if_vlan.h>
-#include <linux/if_link.h>
 #include <linux/ethtool.h>
 #include <linux/in.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
 #include <linux/tcp.h>
+#include <linux/rtnetlink.h>
 #include <net/ip6_checksum.h>
 
 #include "cq_enet_desc.h"
@@ -1799,8 +1799,10 @@ static int enic_stop(struct net_device *netdev)
        unsigned int i;
        int err;
 
-       for (i = 0; i < enic->intr_count; i++)
+       for (i = 0; i < enic->intr_count; i++) {
                vnic_intr_mask(&enic->intr[i]);
+               (void)vnic_intr_masked(&enic->intr[i]); /* flush write */
+       }
 
        enic_synchronize_irqs(enic);
 
@@ -1810,7 +1812,6 @@ static int enic_stop(struct net_device *netdev)
        napi_disable(&enic->napi);
        netif_carrier_off(netdev);
        netif_tx_disable(netdev);
-
        enic_dev_del_station_addr(enic);
 
        for (i = 0; i < enic->wq_count; i++) {
@@ -2299,7 +2300,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
        /* Setup PCI resources
         */
 
-       err = pci_enable_device(pdev);
+       err = pci_enable_device_mem(pdev);
        if (err) {
                dev_err(dev, "Cannot enable PCI device, aborting\n");
                goto err_out_free_netdev;
index 2cc7e278caae543b23dbd3a527c9aa58936a5fae..29ede8a17a2ca5a7d99e140c0a8e0c8f43848314 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 8b25a07a67d1e326f4487c1fedaf20b76f63d8e8..83bd172c356cf329db232831d42cd3dd092f6a6d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index a06e649010cee0d061fcf5f1e3eab8587e36c30d..e6dd30988d6f5752dca6e72bf8ae100f23359d17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 326ea40297f2d01d1eabe1e55f27b2aa6d6e6a80..b86d6ef8dad38bf97db0c3cceefc09423d196bf1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 114763cbc2f8bc12e0c19241ac9569fa62d5b8f2..552d3daf250812bd839f77615e4203660f3eb096 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 662123c9581e0eb59e6f9258c7d4afff989dac3e..6a5b578a69e169501f27eca1ec31262b3fc0d3d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
@@ -23,7 +23,6 @@
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/if_ether.h>
-#include <linux/slab.h>
 
 #include "vnic_resource.h"
 #include "vnic_devcmd.h"
@@ -41,8 +40,6 @@ struct vnic_res {
        unsigned int count;
 };
 
-#define VNIC_DEV_CAP_INIT      0x0001
-
 struct vnic_dev {
        void *priv;
        struct pci_dev *pdev;
@@ -53,13 +50,11 @@ struct vnic_dev {
        struct vnic_devcmd_notify notify_copy;
        dma_addr_t notify_pa;
        u32 notify_sz;
-       u32 *linkstatus;
        dma_addr_t linkstatus_pa;
        struct vnic_stats *stats;
        dma_addr_t stats_pa;
        struct vnic_devcmd_fw_info *fw_info;
        dma_addr_t fw_info_pa;
-       u32 cap_flags;
        enum vnic_proxy_type proxy;
        u32 proxy_index;
        u64 args[VNIC_DEVCMD_NARGS];
@@ -279,7 +274,6 @@ static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
                /* PCI-e target device is gone */
                return -ENODEV;
        }
-
        if (status & STAT_BUSY) {
                pr_err("Busy devcmd %d\n", _CMD_N(cmd));
                return -EBUSY;
@@ -852,7 +846,7 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg)
        int wait = 1000;
        int r = 0;
 
-       if (vdev->cap_flags & VNIC_DEV_CAP_INIT)
+       if (vnic_dev_capable(vdev, CMD_INIT))
                r = vnic_dev_cmd(vdev, CMD_INIT, &a0, &a1, wait);
        else {
                vnic_dev_cmd(vdev, CMD_INIT_v1, &a0, &a1, wait);
@@ -919,9 +913,6 @@ int vnic_dev_deinit(struct vnic_dev *vdev)
 
 int vnic_dev_link_status(struct vnic_dev *vdev)
 {
-       if (vdev->linkstatus)
-               return *vdev->linkstatus;
-
        if (!vnic_dev_notify_ready(vdev))
                return 0;
 
@@ -996,14 +987,9 @@ void vnic_dev_unregister(struct vnic_dev *vdev)
                                sizeof(struct vnic_devcmd_notify),
                                vdev->notify,
                                vdev->notify_pa);
-               if (vdev->linkstatus)
-                       pci_free_consistent(vdev->pdev,
-                               sizeof(u32),
-                               vdev->linkstatus,
-                               vdev->linkstatus_pa);
                if (vdev->stats)
                        pci_free_consistent(vdev->pdev,
-                               sizeof(struct vnic_dev),
+                               sizeof(struct vnic_stats),
                                vdev->stats, vdev->stats_pa);
                if (vdev->fw_info)
                        pci_free_consistent(vdev->pdev,
@@ -1033,11 +1019,6 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
        if (!vdev->devcmd)
                goto err_out;
 
-       vdev->cap_flags = 0;
-
-       if (vnic_dev_capable(vdev, CMD_INIT))
-               vdev->cap_flags |= VNIC_DEV_CAP_INIT;
-
        return vdev;
 
 err_out:
index cfdaa69bf5a535eae523adfbecb29172a34d6502..3a61873138b69112b28f60de2a70fa11f2dc052c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index e6c80c77dbd8f0718804a75d3ac1c8757999ff3f..20661755df6bf4c96f9209efe4767a53c9217cdd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 42baaa13ce5909f3016460ef8b73ef8ea4727b77..3b3291248956a4d01848b635bf294f2622c175e7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 416eae73fa0a6c45e5ce276a99d0dab6da2a68a3..52ab61af2750fa9287d53f3c8e4dcbec84dca0b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 2fe6c6339e3c58a54eb9f205ac34ba6d625f4199..09dc0b73ff46aec338fc0478a52d85955ea350ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
@@ -61,7 +61,11 @@ static inline void vnic_intr_unmask(struct vnic_intr *intr)
 static inline void vnic_intr_mask(struct vnic_intr *intr)
 {
        iowrite32(1, &intr->ctrl->mask);
-       (void)ioread32(&intr->ctrl->mask);
+}
+
+static inline int vnic_intr_masked(struct vnic_intr *intr)
+{
+       return ioread32(&intr->ctrl->mask);
 }
 
 static inline void vnic_intr_return_credits(struct vnic_intr *intr,
index cf80ab46d582ac73a94ff59766c6fdf0a379cdef..995a50dd4c99ca926769e8caeb1a5fbd51c22d9b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index b61c22aec41a65968c887fa800b7062bf59dd254..810287beff149f2969e0bda67b28754d600555e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 061a26fbbbfb566b4284dc6874df5d5602d1ad7a..dbb2aca258b9087ed1734dd2b7da61e478702303 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
@@ -209,7 +209,6 @@ void vnic_rq_clean(struct vnic_rq *rq,
                /* Hardware surprise removal: reset fetch_index */
                fetch_index = 0;
        }
-
        rq->to_use = rq->to_clean =
                &rq->bufs[fetch_index / VNIC_RQ_BUF_BLK_ENTRIES(count)]
                        [fetch_index % VNIC_RQ_BUF_BLK_ENTRIES(count)];
index 8f0fb78f0cdffcbdde8679d03293e78d17bcb3a8..2dc48f91abf71dc4da9d00f863f6766dd58b6349 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008, 2009 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 5fbb3c923bcd6a0610bacda69cdc7694d4b507b4..f62d1871962983bfce011fdbb4097a3421daf9a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 9ff9614d89b122f4f653bcbdbbc4c13549fd2352..77750ec93954c31da439bacfc33870d66134da66 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 0a35085004d0f6e7716a20d7468e39bf07ca303e..197c9d24af824552a62622ec3aebfc39ec9b02cf 100644 (file)
@@ -27,6 +27,9 @@ struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, u8 *oui, u8 type)
 {
        struct vic_provinfo *vp;
 
+       if (!oui)
+               return NULL;
+
        vp = kzalloc(VIC_PROVINFO_MAX_DATA, flags);
        if (!vp)
                return NULL;
index 3ab7fa5501cd60f9952becb671442533c1bd4f31..122e33bcc57826a1ef08abf0337a3b97da014570 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 1c8213959fc46ce6f9544fc6492440e8adfd585a..94ac4621acc5ac945a7df33acc2894906d3f34ce 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify
index 483596c2d8bf8b41deff7be9a9fefd3c7063b189..c7021e3a631fe2f487c47ba282793481742a9def 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  *
  * This program is free software; you may redistribute it and/or modify