Commit 29046f9b1e36f6e3332ce2d8e366005fd177b37a

Authored by Vasanthy Kolluri
Committed by David S. Miller
1 parent 506e119841

enic: Clean ups

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>

Showing 25 changed files with 41 additions and 53 deletions Side-by-side Diff

drivers/net/enic/cq_desc.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/cq_enet_desc.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
... ... @@ -82,7 +82,7 @@
82 82 ((1 << CQ_ENET_RQ_DESC_VLAN_TCI_USER_PRIO_BITS) - 1)
83 83 #define CQ_ENET_RQ_DESC_VLAN_TCI_USER_PRIO_SHIFT 13
84 84  
85   -#define CQ_ENET_RQ_DESC_FCOE_SOF_BITS 4
  85 +#define CQ_ENET_RQ_DESC_FCOE_SOF_BITS 8
86 86 #define CQ_ENET_RQ_DESC_FCOE_SOF_MASK \
87 87 ((1 << CQ_ENET_RQ_DESC_FCOE_SOF_BITS) - 1)
88 88 #define CQ_ENET_RQ_DESC_FCOE_EOF_BITS 8
drivers/net/enic/enic.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
... ... @@ -33,7 +33,7 @@
33 33 #define DRV_NAME "enic"
34 34 #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
35 35 #define DRV_VERSION "1.4.1.1"
36   -#define DRV_COPYRIGHT "Copyright 2008-2009 Cisco Systems, Inc"
  36 +#define DRV_COPYRIGHT "Copyright 2008-2010 Cisco Systems, Inc"
37 37  
38 38 #define ENIC_BARS_MAX 6
39 39  
drivers/net/enic/enic_main.c
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
6 6  
... ... @@ -29,12 +29,12 @@
29 29 #include <linux/etherdevice.h>
30 30 #include <linux/if_ether.h>
31 31 #include <linux/if_vlan.h>
32   -#include <linux/if_link.h>
33 32 #include <linux/ethtool.h>
34 33 #include <linux/in.h>
35 34 #include <linux/ip.h>
36 35 #include <linux/ipv6.h>
37 36 #include <linux/tcp.h>
  37 +#include <linux/rtnetlink.h>
38 38 #include <net/ip6_checksum.h>
39 39  
40 40 #include "cq_enet_desc.h"
41 41  
... ... @@ -1799,8 +1799,10 @@
1799 1799 unsigned int i;
1800 1800 int err;
1801 1801  
1802   - for (i = 0; i < enic->intr_count; i++)
  1802 + for (i = 0; i < enic->intr_count; i++) {
1803 1803 vnic_intr_mask(&enic->intr[i]);
  1804 + (void)vnic_intr_masked(&enic->intr[i]); /* flush write */
  1805 + }
1804 1806  
1805 1807 enic_synchronize_irqs(enic);
1806 1808  
... ... @@ -1810,7 +1812,6 @@
1810 1812 napi_disable(&enic->napi);
1811 1813 netif_carrier_off(netdev);
1812 1814 netif_tx_disable(netdev);
1813   -
1814 1815 enic_dev_del_station_addr(enic);
1815 1816  
1816 1817 for (i = 0; i < enic->wq_count; i++) {
... ... @@ -2299,7 +2300,7 @@
2299 2300 /* Setup PCI resources
2300 2301 */
2301 2302  
2302   - err = pci_enable_device(pdev);
  2303 + err = pci_enable_device_mem(pdev);
2303 2304 if (err) {
2304 2305 dev_err(dev, "Cannot enable PCI device, aborting\n");
2305 2306 goto err_out_free_netdev;
drivers/net/enic/enic_res.c
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/enic_res.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/rq_enet_desc.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_cq.c
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_cq.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_dev.c
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
... ... @@ -23,7 +23,6 @@
23 23 #include <linux/pci.h>
24 24 #include <linux/delay.h>
25 25 #include <linux/if_ether.h>
26   -#include <linux/slab.h>
27 26  
28 27 #include "vnic_resource.h"
29 28 #include "vnic_devcmd.h"
... ... @@ -41,8 +40,6 @@
41 40 unsigned int count;
42 41 };
43 42  
44   -#define VNIC_DEV_CAP_INIT 0x0001
45   -
46 43 struct vnic_dev {
47 44 void *priv;
48 45 struct pci_dev *pdev;
49 46  
... ... @@ -53,13 +50,11 @@
53 50 struct vnic_devcmd_notify notify_copy;
54 51 dma_addr_t notify_pa;
55 52 u32 notify_sz;
56   - u32 *linkstatus;
57 53 dma_addr_t linkstatus_pa;
58 54 struct vnic_stats *stats;
59 55 dma_addr_t stats_pa;
60 56 struct vnic_devcmd_fw_info *fw_info;
61 57 dma_addr_t fw_info_pa;
62   - u32 cap_flags;
63 58 enum vnic_proxy_type proxy;
64 59 u32 proxy_index;
65 60 u64 args[VNIC_DEVCMD_NARGS];
... ... @@ -279,7 +274,6 @@
279 274 /* PCI-e target device is gone */
280 275 return -ENODEV;
281 276 }
282   -
283 277 if (status & STAT_BUSY) {
284 278 pr_err("Busy devcmd %d\n", _CMD_N(cmd));
285 279 return -EBUSY;
... ... @@ -852,7 +846,7 @@
852 846 int wait = 1000;
853 847 int r = 0;
854 848  
855   - if (vdev->cap_flags & VNIC_DEV_CAP_INIT)
  849 + if (vnic_dev_capable(vdev, CMD_INIT))
856 850 r = vnic_dev_cmd(vdev, CMD_INIT, &a0, &a1, wait);
857 851 else {
858 852 vnic_dev_cmd(vdev, CMD_INIT_v1, &a0, &a1, wait);
... ... @@ -919,9 +913,6 @@
919 913  
920 914 int vnic_dev_link_status(struct vnic_dev *vdev)
921 915 {
922   - if (vdev->linkstatus)
923   - return *vdev->linkstatus;
924   -
925 916 if (!vnic_dev_notify_ready(vdev))
926 917 return 0;
927 918  
928 919  
... ... @@ -996,14 +987,9 @@
996 987 sizeof(struct vnic_devcmd_notify),
997 988 vdev->notify,
998 989 vdev->notify_pa);
999   - if (vdev->linkstatus)
1000   - pci_free_consistent(vdev->pdev,
1001   - sizeof(u32),
1002   - vdev->linkstatus,
1003   - vdev->linkstatus_pa);
1004 990 if (vdev->stats)
1005 991 pci_free_consistent(vdev->pdev,
1006   - sizeof(struct vnic_dev),
  992 + sizeof(struct vnic_stats),
1007 993 vdev->stats, vdev->stats_pa);
1008 994 if (vdev->fw_info)
1009 995 pci_free_consistent(vdev->pdev,
... ... @@ -1032,11 +1018,6 @@
1032 1018 vdev->devcmd = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD, 0);
1033 1019 if (!vdev->devcmd)
1034 1020 goto err_out;
1035   -
1036   - vdev->cap_flags = 0;
1037   -
1038   - if (vnic_dev_capable(vdev, CMD_INIT))
1039   - vdev->cap_flags |= VNIC_DEV_CAP_INIT;
1040 1021  
1041 1022 return vdev;
1042 1023  
drivers/net/enic/vnic_dev.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_devcmd.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_enet.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_intr.c
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_intr.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
... ... @@ -61,7 +61,11 @@
61 61 static inline void vnic_intr_mask(struct vnic_intr *intr)
62 62 {
63 63 iowrite32(1, &intr->ctrl->mask);
64   - (void)ioread32(&intr->ctrl->mask);
  64 +}
  65 +
  66 +static inline int vnic_intr_masked(struct vnic_intr *intr)
  67 +{
  68 + return ioread32(&intr->ctrl->mask);
65 69 }
66 70  
67 71 static inline void vnic_intr_return_credits(struct vnic_intr *intr,
drivers/net/enic/vnic_nic.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_resource.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_rq.c
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
... ... @@ -209,7 +209,6 @@
209 209 /* Hardware surprise removal: reset fetch_index */
210 210 fetch_index = 0;
211 211 }
212   -
213 212 rq->to_use = rq->to_clean =
214 213 &rq->bufs[fetch_index / VNIC_RQ_BUF_BLK_ENTRIES(count)]
215 214 [fetch_index % VNIC_RQ_BUF_BLK_ENTRIES(count)];
drivers/net/enic/vnic_rq.h
1 1 /*
2   - * Copyright 2008, 2009 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_rss.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_stats.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_vic.c
... ... @@ -27,6 +27,9 @@
27 27 {
28 28 struct vic_provinfo *vp;
29 29  
  30 + if (!oui)
  31 + return NULL;
  32 +
30 33 vp = kzalloc(VIC_PROVINFO_MAX_DATA, flags);
31 34 if (!vp)
32 35 return NULL;
drivers/net/enic/vnic_wq.c
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/vnic_wq.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify
drivers/net/enic/wq_enet_desc.h
1 1 /*
2   - * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  2 + * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
3 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4 4 *
5 5 * This program is free software; you may redistribute it and/or modify