aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxge
diff options
context:
space:
mode:
authorJon Mason <jon.mason@exar.com>2010-11-10 23:26:03 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-11 12:30:24 -0500
commit2c91308f449c6705b81bd3370a0ec647e370f35c (patch)
treeaa7939b5e6727201aacab0f6edc592ce1479beff /drivers/net/vxge
parent1901d042abf10d08a829961a63fd158f9844587e (diff)
vxge: sparse and other clean-ups
Correct issues found by running sparse on the vxge driver, as well as other miscellaneous cleanups. Signed-off-by: Jon Mason <jon.mason@exar.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxge')
-rw-r--r--drivers/net/vxge/vxge-config.c100
-rw-r--r--drivers/net/vxge/vxge-ethtool.c35
-rw-r--r--drivers/net/vxge/vxge-main.c94
3 files changed, 76 insertions, 153 deletions
diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index 14dc8c8f47ef..409c2e6053d0 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -22,19 +22,6 @@
22#include "vxge-main.h" 22#include "vxge-main.h"
23 23
24static enum vxge_hw_status 24static enum vxge_hw_status
25__vxge_hw_fifo_create(
26 struct __vxge_hw_vpath_handle *vpath_handle,
27 struct vxge_hw_fifo_attr *attr);
28
29static enum vxge_hw_status
30__vxge_hw_fifo_abort(
31 struct __vxge_hw_fifo *fifoh);
32
33static enum vxge_hw_status
34__vxge_hw_fifo_reset(
35 struct __vxge_hw_fifo *ringh);
36
37static enum vxge_hw_status
38__vxge_hw_fifo_delete( 25__vxge_hw_fifo_delete(
39 struct __vxge_hw_vpath_handle *vpath_handle); 26 struct __vxge_hw_vpath_handle *vpath_handle);
40 27
@@ -72,44 +59,15 @@ __vxge_hw_blockpool_free(struct __vxge_hw_device *hldev,
72 u32 size, 59 u32 size,
73 struct vxge_hw_mempool_dma *dma_object); 60 struct vxge_hw_mempool_dma *dma_object);
74 61
75
76static struct __vxge_hw_channel*
77__vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph,
78 enum __vxge_hw_channel_type type, u32 length,
79 u32 per_dtr_space, void *userdata);
80
81static void 62static void
82__vxge_hw_channel_free( 63__vxge_hw_channel_free(
83 struct __vxge_hw_channel *channel); 64 struct __vxge_hw_channel *channel);
84 65
85static enum vxge_hw_status
86__vxge_hw_channel_initialize(
87 struct __vxge_hw_channel *channel);
88
89static enum vxge_hw_status
90__vxge_hw_channel_reset(
91 struct __vxge_hw_channel *channel);
92
93static enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_vpath_handle *vp); 66static enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_vpath_handle *vp);
94 67
95static enum vxge_hw_status 68static enum vxge_hw_status
96__vxge_hw_device_fifo_config_check(struct vxge_hw_fifo_config *fifo_config);
97
98static enum vxge_hw_status
99__vxge_hw_device_config_check(struct vxge_hw_device_config *new_config); 69__vxge_hw_device_config_check(struct vxge_hw_device_config *new_config);
100 70
101static void
102__vxge_hw_device_host_info_get(struct __vxge_hw_device *hldev);
103
104static enum vxge_hw_status
105__vxge_hw_device_initialize(struct __vxge_hw_device *hldev);
106
107static void
108__vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev);
109
110static enum vxge_hw_status
111__vxge_hw_device_reg_addr_get(struct __vxge_hw_device *hldev);
112
113static enum vxge_hw_status 71static enum vxge_hw_status
114__vxge_hw_device_register_poll( 72__vxge_hw_device_register_poll(
115 void __iomem *reg, 73 void __iomem *reg,
@@ -130,9 +88,10 @@ __vxge_hw_pio_mem_write64(u64 val64, void __iomem *addr,
130 88
131static struct vxge_hw_mempool* 89static struct vxge_hw_mempool*
132__vxge_hw_mempool_create(struct __vxge_hw_device *devh, u32 memblock_size, 90__vxge_hw_mempool_create(struct __vxge_hw_device *devh, u32 memblock_size,
133 u32 item_size, u32 private_size, u32 items_initial, 91 u32 item_size, u32 private_size, u32 items_initial,
134 u32 items_max, struct vxge_hw_mempool_cbs *mp_callback, 92 u32 items_max, struct vxge_hw_mempool_cbs *mp_callback,
135 void *userdata); 93 void *userdata);
94
136static void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool); 95static void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool);
137 96
138static enum vxge_hw_status 97static enum vxge_hw_status
@@ -145,24 +104,10 @@ vxge_hw_vpath_stats_enable(struct __vxge_hw_vpath_handle *vpath_handle);
145static enum vxge_hw_status 104static enum vxge_hw_status
146__vxge_hw_legacy_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg); 105__vxge_hw_legacy_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg);
147 106
148static enum vxge_hw_status
149__vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath);
150
151
152static enum vxge_hw_status
153__vxge_hw_vpath_sw_reset(struct __vxge_hw_device *devh, u32 vp_id);
154
155static enum vxge_hw_status
156__vxge_hw_vpath_mac_configure(struct __vxge_hw_device *devh, u32 vp_id);
157
158static void 107static void
159__vxge_hw_vp_terminate(struct __vxge_hw_device *devh, u32 vp_id); 108__vxge_hw_vp_terminate(struct __vxge_hw_device *devh, u32 vp_id);
160 109
161static enum vxge_hw_status 110static enum vxge_hw_status
162__vxge_hw_vpath_stats_access(struct __vxge_hw_virtualpath *vpath,
163 u32 operation, u32 offset, u64 *stat);
164
165static enum vxge_hw_status
166__vxge_hw_vpath_xmac_tx_stats_get(struct __vxge_hw_virtualpath *vpath, 111__vxge_hw_vpath_xmac_tx_stats_get(struct __vxge_hw_virtualpath *vpath,
167 struct vxge_hw_xmac_vpath_tx_stats *vpath_tx_stats); 112 struct vxge_hw_xmac_vpath_tx_stats *vpath_tx_stats);
168 113
@@ -505,7 +450,7 @@ vxge_hw_vpath_eprom_img_ver_get(struct __vxge_hw_device *hldev,
505 * This function allocates required memory for the channel and various arrays 450 * This function allocates required memory for the channel and various arrays
506 * in the channel 451 * in the channel
507 */ 452 */
508struct __vxge_hw_channel* 453static struct __vxge_hw_channel *
509__vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph, 454__vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph,
510 enum __vxge_hw_channel_type type, 455 enum __vxge_hw_channel_type type,
511 u32 length, u32 per_dtr_space, void *userdata) 456 u32 length, u32 per_dtr_space, void *userdata)
@@ -576,7 +521,7 @@ exit0:
576 * This function deallocates memory from the channel and various arrays 521 * This function deallocates memory from the channel and various arrays
577 * in the channel 522 * in the channel
578 */ 523 */
579void __vxge_hw_channel_free(struct __vxge_hw_channel *channel) 524static void __vxge_hw_channel_free(struct __vxge_hw_channel *channel)
580{ 525{
581 kfree(channel->work_arr); 526 kfree(channel->work_arr);
582 kfree(channel->free_arr); 527 kfree(channel->free_arr);
@@ -590,7 +535,7 @@ void __vxge_hw_channel_free(struct __vxge_hw_channel *channel)
590 * This function initializes a channel by properly setting the 535 * This function initializes a channel by properly setting the
591 * various references 536 * various references
592 */ 537 */
593enum vxge_hw_status 538static enum vxge_hw_status
594__vxge_hw_channel_initialize(struct __vxge_hw_channel *channel) 539__vxge_hw_channel_initialize(struct __vxge_hw_channel *channel)
595{ 540{
596 u32 i; 541 u32 i;
@@ -625,7 +570,7 @@ __vxge_hw_channel_initialize(struct __vxge_hw_channel *channel)
625 * __vxge_hw_channel_reset - Resets a channel 570 * __vxge_hw_channel_reset - Resets a channel
626 * This function resets a channel by properly setting the various references 571 * This function resets a channel by properly setting the various references
627 */ 572 */
628enum vxge_hw_status 573static enum vxge_hw_status
629__vxge_hw_channel_reset(struct __vxge_hw_channel *channel) 574__vxge_hw_channel_reset(struct __vxge_hw_channel *channel)
630{ 575{
631 u32 i; 576 u32 i;
@@ -652,8 +597,7 @@ __vxge_hw_channel_reset(struct __vxge_hw_channel *channel)
652 * Initialize certain PCI/PCI-X configuration registers 597 * Initialize certain PCI/PCI-X configuration registers
653 * with recommended values. Save config space for future hw resets. 598 * with recommended values. Save config space for future hw resets.
654 */ 599 */
655void 600static void __vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev)
656__vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev)
657{ 601{
658 u16 cmd = 0; 602 u16 cmd = 0;
659 603
@@ -742,7 +686,7 @@ exit:
742 * register location pointers in the device object. It waits until the ric is 686 * register location pointers in the device object. It waits until the ric is
743 * completed initializing registers. 687 * completed initializing registers.
744 */ 688 */
745enum vxge_hw_status 689static enum vxge_hw_status
746__vxge_hw_device_reg_addr_get(struct __vxge_hw_device *hldev) 690__vxge_hw_device_reg_addr_get(struct __vxge_hw_device *hldev)
747{ 691{
748 u64 val64; 692 u64 val64;
@@ -938,7 +882,8 @@ __vxge_hw_verify_pci_e_info(struct __vxge_hw_device *hldev)
938 * __vxge_hw_device_initialize 882 * __vxge_hw_device_initialize
939 * Initialize Titan-V hardware. 883 * Initialize Titan-V hardware.
940 */ 884 */
941enum vxge_hw_status __vxge_hw_device_initialize(struct __vxge_hw_device *hldev) 885static enum vxge_hw_status
886__vxge_hw_device_initialize(struct __vxge_hw_device *hldev)
942{ 887{
943 enum vxge_hw_status status = VXGE_HW_OK; 888 enum vxge_hw_status status = VXGE_HW_OK;
944 889
@@ -2337,7 +2282,7 @@ static void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool)
2337 * __vxge_hw_device_fifo_config_check - Check fifo configuration. 2282 * __vxge_hw_device_fifo_config_check - Check fifo configuration.
2338 * Check the fifo configuration 2283 * Check the fifo configuration
2339 */ 2284 */
2340enum vxge_hw_status 2285static enum vxge_hw_status
2341__vxge_hw_device_fifo_config_check(struct vxge_hw_fifo_config *fifo_config) 2286__vxge_hw_device_fifo_config_check(struct vxge_hw_fifo_config *fifo_config)
2342{ 2287{
2343 if ((fifo_config->fifo_blocks < VXGE_HW_MIN_FIFO_BLOCKS) || 2288 if ((fifo_config->fifo_blocks < VXGE_HW_MIN_FIFO_BLOCKS) ||
@@ -2385,7 +2330,7 @@ __vxge_hw_device_vpath_config_check(struct vxge_hw_vp_config *vp_config)
2385 * __vxge_hw_device_config_check - Check device configuration. 2330 * __vxge_hw_device_config_check - Check device configuration.
2386 * Check the device configuration 2331 * Check the device configuration
2387 */ 2332 */
2388enum vxge_hw_status 2333static enum vxge_hw_status
2389__vxge_hw_device_config_check(struct vxge_hw_device_config *new_config) 2334__vxge_hw_device_config_check(struct vxge_hw_device_config *new_config)
2390{ 2335{
2391 u32 i; 2336 u32 i;
@@ -2945,7 +2890,7 @@ __vxge_hw_fifo_mempool_item_alloc(
2945 * __vxge_hw_fifo_create - Create a FIFO 2890 * __vxge_hw_fifo_create - Create a FIFO
2946 * This function creates FIFO and initializes it. 2891 * This function creates FIFO and initializes it.
2947 */ 2892 */
2948enum vxge_hw_status 2893static enum vxge_hw_status
2949__vxge_hw_fifo_create(struct __vxge_hw_vpath_handle *vp, 2894__vxge_hw_fifo_create(struct __vxge_hw_vpath_handle *vp,
2950 struct vxge_hw_fifo_attr *attr) 2895 struct vxge_hw_fifo_attr *attr)
2951{ 2896{
@@ -3109,7 +3054,8 @@ static enum vxge_hw_status __vxge_hw_fifo_reset(struct __vxge_hw_fifo *fifo)
3109 * __vxge_hw_fifo_delete - Removes the FIFO 3054 * __vxge_hw_fifo_delete - Removes the FIFO
3110 * This function freeup the memory pool and removes the FIFO 3055 * This function freeup the memory pool and removes the FIFO
3111 */ 3056 */
3112enum vxge_hw_status __vxge_hw_fifo_delete(struct __vxge_hw_vpath_handle *vp) 3057static enum vxge_hw_status
3058__vxge_hw_fifo_delete(struct __vxge_hw_vpath_handle *vp)
3113{ 3059{
3114 struct __vxge_hw_fifo *fifo = vp->vpath->fifoh; 3060 struct __vxge_hw_fifo *fifo = vp->vpath->fifoh;
3115 3061
@@ -4897,7 +4843,7 @@ static void vxge_os_dma_free(struct pci_dev *pdev, const void *vaddr,
4897 * __vxge_hw_blockpool_create - Create block pool 4843 * __vxge_hw_blockpool_create - Create block pool
4898 */ 4844 */
4899 4845
4900enum vxge_hw_status 4846static enum vxge_hw_status
4901__vxge_hw_blockpool_create(struct __vxge_hw_device *hldev, 4847__vxge_hw_blockpool_create(struct __vxge_hw_device *hldev,
4902 struct __vxge_hw_blockpool *blockpool, 4848 struct __vxge_hw_blockpool *blockpool,
4903 u32 pool_size, 4849 u32 pool_size,
@@ -4997,7 +4943,7 @@ blockpool_create_exit:
4997 * __vxge_hw_blockpool_destroy - Deallocates the block pool 4943 * __vxge_hw_blockpool_destroy - Deallocates the block pool
4998 */ 4944 */
4999 4945
5000void __vxge_hw_blockpool_destroy(struct __vxge_hw_blockpool *blockpool) 4946static void __vxge_hw_blockpool_destroy(struct __vxge_hw_blockpool *blockpool)
5001{ 4947{
5002 4948
5003 struct __vxge_hw_device *hldev; 4949 struct __vxge_hw_device *hldev;
@@ -5163,7 +5109,7 @@ exit:
5163 * Allocates a block of memory of given size, either from block pool 5109 * Allocates a block of memory of given size, either from block pool
5164 * or by calling vxge_os_dma_malloc() 5110 * or by calling vxge_os_dma_malloc()
5165 */ 5111 */
5166void * 5112static void *
5167__vxge_hw_blockpool_malloc(struct __vxge_hw_device *devh, u32 size, 5113__vxge_hw_blockpool_malloc(struct __vxge_hw_device *devh, u32 size,
5168 struct vxge_hw_mempool_dma *dma_object) 5114 struct vxge_hw_mempool_dma *dma_object)
5169{ 5115{
@@ -5227,7 +5173,7 @@ exit:
5227 * __vxge_hw_blockpool_free - Frees the memory allcoated with 5173 * __vxge_hw_blockpool_free - Frees the memory allcoated with
5228 __vxge_hw_blockpool_malloc 5174 __vxge_hw_blockpool_malloc
5229 */ 5175 */
5230void 5176static void
5231__vxge_hw_blockpool_free(struct __vxge_hw_device *devh, 5177__vxge_hw_blockpool_free(struct __vxge_hw_device *devh,
5232 void *memblock, u32 size, 5178 void *memblock, u32 size,
5233 struct vxge_hw_mempool_dma *dma_object) 5179 struct vxge_hw_mempool_dma *dma_object)
@@ -5279,7 +5225,7 @@ __vxge_hw_blockpool_free(struct __vxge_hw_device *devh,
5279 * __vxge_hw_blockpool_block_allocate - Allocates a block from block pool 5225 * __vxge_hw_blockpool_block_allocate - Allocates a block from block pool
5280 * This function allocates a block from block pool or from the system 5226 * This function allocates a block from block pool or from the system
5281 */ 5227 */
5282struct __vxge_hw_blockpool_entry * 5228static struct __vxge_hw_blockpool_entry *
5283__vxge_hw_blockpool_block_allocate(struct __vxge_hw_device *devh, u32 size) 5229__vxge_hw_blockpool_block_allocate(struct __vxge_hw_device *devh, u32 size)
5284{ 5230{
5285 struct __vxge_hw_blockpool_entry *entry = NULL; 5231 struct __vxge_hw_blockpool_entry *entry = NULL;
@@ -5314,7 +5260,7 @@ __vxge_hw_blockpool_block_allocate(struct __vxge_hw_device *devh, u32 size)
5314 * 5260 *
5315 * This function frees a block from block pool 5261 * This function frees a block from block pool
5316 */ 5262 */
5317void 5263static void
5318__vxge_hw_blockpool_block_free(struct __vxge_hw_device *devh, 5264__vxge_hw_blockpool_block_free(struct __vxge_hw_device *devh,
5319 struct __vxge_hw_blockpool_entry *entry) 5265 struct __vxge_hw_blockpool_entry *entry)
5320{ 5266{
diff --git a/drivers/net/vxge/vxge-ethtool.c b/drivers/net/vxge/vxge-ethtool.c
index 3d2cd6acf30a..09f721e10517 100644
--- a/drivers/net/vxge/vxge-ethtool.c
+++ b/drivers/net/vxge/vxge-ethtool.c
@@ -11,7 +11,7 @@
11 * Virtualized Server Adapter. 11 * Virtualized Server Adapter.
12 * Copyright(c) 2002-2010 Exar Corp. 12 * Copyright(c) 2002-2010 Exar Corp.
13 ******************************************************************************/ 13 ******************************************************************************/
14#include<linux/ethtool.h> 14#include <linux/ethtool.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <linux/etherdevice.h> 17#include <linux/etherdevice.h>
@@ -29,7 +29,6 @@
29 * Return value: 29 * Return value:
30 * 0 on success. 30 * 0 on success.
31 */ 31 */
32
33static int vxge_ethtool_sset(struct net_device *dev, struct ethtool_cmd *info) 32static int vxge_ethtool_sset(struct net_device *dev, struct ethtool_cmd *info)
34{ 33{
35 /* We currently only support 10Gb/FULL */ 34 /* We currently only support 10Gb/FULL */
@@ -79,10 +78,9 @@ static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
79 * Returns driver specefic information like name, version etc.. to ethtool. 78 * Returns driver specefic information like name, version etc.. to ethtool.
80 */ 79 */
81static void vxge_ethtool_gdrvinfo(struct net_device *dev, 80static void vxge_ethtool_gdrvinfo(struct net_device *dev,
82 struct ethtool_drvinfo *info) 81 struct ethtool_drvinfo *info)
83{ 82{
84 struct vxgedev *vdev; 83 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
85 vdev = (struct vxgedev *)netdev_priv(dev);
86 strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(VXGE_DRIVER_NAME)); 84 strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(VXGE_DRIVER_NAME));
87 strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION)); 85 strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION));
88 strlcpy(info->fw_version, vdev->fw_version, VXGE_HW_FW_STRLEN); 86 strlcpy(info->fw_version, vdev->fw_version, VXGE_HW_FW_STRLEN);
@@ -104,15 +102,14 @@ static void vxge_ethtool_gdrvinfo(struct net_device *dev,
104 * buffer area. 102 * buffer area.
105 */ 103 */
106static void vxge_ethtool_gregs(struct net_device *dev, 104static void vxge_ethtool_gregs(struct net_device *dev,
107 struct ethtool_regs *regs, void *space) 105 struct ethtool_regs *regs, void *space)
108{ 106{
109 int index, offset; 107 int index, offset;
110 enum vxge_hw_status status; 108 enum vxge_hw_status status;
111 u64 reg; 109 u64 reg;
112 u64 *reg_space = (u64 *) space; 110 u64 *reg_space = (u64 *)space;
113 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev); 111 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
114 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *) 112 struct __vxge_hw_device *hldev = vdev->devh;
115 pci_get_drvdata(vdev->pdev);
116 113
117 regs->len = sizeof(struct vxge_hw_vpath_reg) * vdev->no_of_vpath; 114 regs->len = sizeof(struct vxge_hw_vpath_reg) * vdev->no_of_vpath;
118 regs->version = vdev->pdev->subsystem_device; 115 regs->version = vdev->pdev->subsystem_device;
@@ -148,8 +145,7 @@ static void vxge_ethtool_gregs(struct net_device *dev,
148static int vxge_ethtool_idnic(struct net_device *dev, u32 data) 145static int vxge_ethtool_idnic(struct net_device *dev, u32 data)
149{ 146{
150 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev); 147 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
151 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *) 148 struct __vxge_hw_device *hldev = vdev->devh;
152 pci_get_drvdata(vdev->pdev);
153 149
154 vxge_hw_device_flick_link_led(hldev, VXGE_FLICKER_ON); 150 vxge_hw_device_flick_link_led(hldev, VXGE_FLICKER_ON);
155 msleep_interruptible(data ? (data * HZ) : VXGE_MAX_FLICKER_TIME); 151 msleep_interruptible(data ? (data * HZ) : VXGE_MAX_FLICKER_TIME);
@@ -168,11 +164,10 @@ static int vxge_ethtool_idnic(struct net_device *dev, u32 data)
168 * void 164 * void
169 */ 165 */
170static void vxge_ethtool_getpause_data(struct net_device *dev, 166static void vxge_ethtool_getpause_data(struct net_device *dev,
171 struct ethtool_pauseparam *ep) 167 struct ethtool_pauseparam *ep)
172{ 168{
173 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev); 169 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
174 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *) 170 struct __vxge_hw_device *hldev = vdev->devh;
175 pci_get_drvdata(vdev->pdev);
176 171
177 vxge_hw_device_getpause_data(hldev, 0, &ep->tx_pause, &ep->rx_pause); 172 vxge_hw_device_getpause_data(hldev, 0, &ep->tx_pause, &ep->rx_pause);
178} 173}
@@ -188,11 +183,10 @@ static void vxge_ethtool_getpause_data(struct net_device *dev,
188 * int, returns 0 on Success 183 * int, returns 0 on Success
189 */ 184 */
190static int vxge_ethtool_setpause_data(struct net_device *dev, 185static int vxge_ethtool_setpause_data(struct net_device *dev,
191 struct ethtool_pauseparam *ep) 186 struct ethtool_pauseparam *ep)
192{ 187{
193 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev); 188 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
194 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *) 189 struct __vxge_hw_device *hldev = vdev->devh;
195 pci_get_drvdata(vdev->pdev);
196 190
197 vxge_hw_device_setpause_data(hldev, 0, ep->tx_pause, ep->rx_pause); 191 vxge_hw_device_setpause_data(hldev, 0, ep->tx_pause, ep->rx_pause);
198 192
@@ -209,9 +203,8 @@ static void vxge_get_ethtool_stats(struct net_device *dev,
209 enum vxge_hw_status status; 203 enum vxge_hw_status status;
210 enum vxge_hw_status swstatus; 204 enum vxge_hw_status swstatus;
211 struct vxge_vpath *vpath = NULL; 205 struct vxge_vpath *vpath = NULL;
212
213 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev); 206 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
214 struct __vxge_hw_device *hldev = vdev->devh; 207 struct __vxge_hw_device *hldev = vdev->devh;
215 struct vxge_hw_xmac_stats *xmac_stats; 208 struct vxge_hw_xmac_stats *xmac_stats;
216 struct vxge_hw_device_stats_sw_info *sw_stats; 209 struct vxge_hw_device_stats_sw_info *sw_stats;
217 struct vxge_hw_device_stats_hw_info *hw_stats; 210 struct vxge_hw_device_stats_hw_info *hw_stats;
@@ -574,8 +567,8 @@ static void vxge_get_ethtool_stats(struct net_device *dev,
574 kfree(hw_stats); 567 kfree(hw_stats);
575} 568}
576 569
577static void vxge_ethtool_get_strings(struct net_device *dev, 570static void vxge_ethtool_get_strings(struct net_device *dev, u32 stringset,
578 u32 stringset, u8 *data) 571 u8 *data)
579{ 572{
580 int stat_size = 0; 573 int stat_size = 0;
581 int i, j; 574 int i, j;
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index b8806a15bcaf..3f2d6ed13d3e 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -688,7 +688,7 @@ static int vxge_learn_mac(struct vxgedev *vdev, u8 *mac_header)
688 struct vxge_vpath *vpath = NULL; 688 struct vxge_vpath *vpath = NULL;
689 struct __vxge_hw_device *hldev; 689 struct __vxge_hw_device *hldev;
690 690
691 hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev); 691 hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
692 692
693 mac_address = (u8 *)&mac_addr; 693 mac_address = (u8 *)&mac_addr;
694 memcpy(mac_address, mac_header, ETH_ALEN); 694 memcpy(mac_address, mac_header, ETH_ALEN);
@@ -1112,7 +1112,7 @@ static void vxge_set_multicast(struct net_device *dev)
1112 /* Delete previous MC's */ 1112 /* Delete previous MC's */
1113 for (i = 0; i < mcast_cnt; i++) { 1113 for (i = 0; i < mcast_cnt; i++) {
1114 list_for_each_safe(entry, next, list_head) { 1114 list_for_each_safe(entry, next, list_head) {
1115 mac_entry = (struct vxge_mac_addrs *) entry; 1115 mac_entry = (struct vxge_mac_addrs *)entry;
1116 /* Copy the mac address to delete */ 1116 /* Copy the mac address to delete */
1117 mac_address = (u8 *)&mac_entry->macaddr; 1117 mac_address = (u8 *)&mac_entry->macaddr;
1118 memcpy(mac_info.macaddr, mac_address, ETH_ALEN); 1118 memcpy(mac_info.macaddr, mac_address, ETH_ALEN);
@@ -1155,7 +1155,7 @@ _set_all_mcast:
1155 /* Delete previous MC's */ 1155 /* Delete previous MC's */
1156 for (i = 0; i < mcast_cnt; i++) { 1156 for (i = 0; i < mcast_cnt; i++) {
1157 list_for_each_safe(entry, next, list_head) { 1157 list_for_each_safe(entry, next, list_head) {
1158 mac_entry = (struct vxge_mac_addrs *) entry; 1158 mac_entry = (struct vxge_mac_addrs *)entry;
1159 /* Copy the mac address to delete */ 1159 /* Copy the mac address to delete */
1160 mac_address = (u8 *)&mac_entry->macaddr; 1160 mac_address = (u8 *)&mac_entry->macaddr;
1161 memcpy(mac_info.macaddr, mac_address, ETH_ALEN); 1161 memcpy(mac_info.macaddr, mac_address, ETH_ALEN);
@@ -1202,7 +1202,7 @@ static int vxge_set_mac_addr(struct net_device *dev, void *p)
1202{ 1202{
1203 struct sockaddr *addr = p; 1203 struct sockaddr *addr = p;
1204 struct vxgedev *vdev; 1204 struct vxgedev *vdev;
1205 struct __vxge_hw_device *hldev; 1205 struct __vxge_hw_device *hldev;
1206 enum vxge_hw_status status = VXGE_HW_OK; 1206 enum vxge_hw_status status = VXGE_HW_OK;
1207 struct macInfo mac_info_new, mac_info_old; 1207 struct macInfo mac_info_new, mac_info_old;
1208 int vpath_idx = 0; 1208 int vpath_idx = 0;
@@ -1632,7 +1632,7 @@ static int vxge_poll_inta(struct napi_struct *napi, int budget)
1632 int budget_org = budget; 1632 int budget_org = budget;
1633 struct vxge_ring *ring; 1633 struct vxge_ring *ring;
1634 1634
1635 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *) 1635 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
1636 pci_get_drvdata(vdev->pdev); 1636 pci_get_drvdata(vdev->pdev);
1637 1637
1638 for (i = 0; i < vdev->no_of_vpath; i++) { 1638 for (i = 0; i < vdev->no_of_vpath; i++) {
@@ -1669,7 +1669,7 @@ static int vxge_poll_inta(struct napi_struct *napi, int budget)
1669 */ 1669 */
1670static void vxge_netpoll(struct net_device *dev) 1670static void vxge_netpoll(struct net_device *dev)
1671{ 1671{
1672 struct __vxge_hw_device *hldev; 1672 struct __vxge_hw_device *hldev;
1673 struct vxgedev *vdev; 1673 struct vxgedev *vdev;
1674 1674
1675 vdev = (struct vxgedev *)netdev_priv(dev); 1675 vdev = (struct vxgedev *)netdev_priv(dev);
@@ -1821,7 +1821,7 @@ static int vxge_mac_list_del(struct vxge_vpath *vpath, struct macInfo *mac)
1821{ 1821{
1822 struct list_head *entry, *next; 1822 struct list_head *entry, *next;
1823 u64 del_mac = 0; 1823 u64 del_mac = 0;
1824 u8 *mac_address = (u8 *) (&del_mac); 1824 u8 *mac_address = (u8 *)(&del_mac);
1825 1825
1826 /* Copy the mac address to delete from the list */ 1826 /* Copy the mac address to delete from the list */
1827 memcpy(mac_address, mac->macaddr, ETH_ALEN); 1827 memcpy(mac_address, mac->macaddr, ETH_ALEN);
@@ -2102,7 +2102,7 @@ static irqreturn_t vxge_isr_napi(int irq, void *dev_id)
2102 struct __vxge_hw_device *hldev; 2102 struct __vxge_hw_device *hldev;
2103 u64 reason; 2103 u64 reason;
2104 enum vxge_hw_status status; 2104 enum vxge_hw_status status;
2105 struct vxgedev *vdev = (struct vxgedev *) dev_id;; 2105 struct vxgedev *vdev = (struct vxgedev *)dev_id;
2106 2106
2107 vxge_debug_intr(VXGE_TRACE, "%s:%d", __func__, __LINE__); 2107 vxge_debug_intr(VXGE_TRACE, "%s:%d", __func__, __LINE__);
2108 2108
@@ -2341,8 +2341,8 @@ static void vxge_rem_msix_isr(struct vxgedev *vdev)
2341 2341
2342static void vxge_rem_isr(struct vxgedev *vdev) 2342static void vxge_rem_isr(struct vxgedev *vdev)
2343{ 2343{
2344 struct __vxge_hw_device *hldev; 2344 struct __vxge_hw_device *hldev;
2345 hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev); 2345 hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
2346 2346
2347#ifdef CONFIG_PCI_MSI 2347#ifdef CONFIG_PCI_MSI
2348 if (vdev->config.intr_type == MSI_X) { 2348 if (vdev->config.intr_type == MSI_X) {
@@ -2583,7 +2583,7 @@ vxge_open(struct net_device *dev)
2583 "%s: %s:%d", dev->name, __func__, __LINE__); 2583 "%s: %s:%d", dev->name, __func__, __LINE__);
2584 2584
2585 vdev = (struct vxgedev *)netdev_priv(dev); 2585 vdev = (struct vxgedev *)netdev_priv(dev);
2586 hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev); 2586 hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
2587 function_mode = vdev->config.device_hw_info.function_mode; 2587 function_mode = vdev->config.device_hw_info.function_mode;
2588 2588
2589 /* make sure you have link off by default every time Nic is 2589 /* make sure you have link off by default every time Nic is
@@ -2811,7 +2811,7 @@ static int do_vxge_close(struct net_device *dev, int do_io)
2811 dev->name, __func__, __LINE__); 2811 dev->name, __func__, __LINE__);
2812 2812
2813 vdev = (struct vxgedev *)netdev_priv(dev); 2813 vdev = (struct vxgedev *)netdev_priv(dev);
2814 hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev); 2814 hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
2815 2815
2816 if (unlikely(!is_vxge_card_up(vdev))) 2816 if (unlikely(!is_vxge_card_up(vdev)))
2817 return 0; 2817 return 0;
@@ -3440,36 +3440,29 @@ _out0:
3440 * 3440 *
3441 * This function will unregister and free network device 3441 * This function will unregister and free network device
3442 */ 3442 */
3443static void 3443static void vxge_device_unregister(struct __vxge_hw_device *hldev)
3444vxge_device_unregister(struct __vxge_hw_device *hldev)
3445{ 3444{
3446 struct vxgedev *vdev; 3445 struct vxgedev *vdev;
3447 struct net_device *dev; 3446 struct net_device *dev;
3448 char buf[IFNAMSIZ]; 3447 char buf[IFNAMSIZ];
3449#if ((VXGE_DEBUG_INIT & VXGE_DEBUG_MASK) || \
3450 (VXGE_DEBUG_ENTRYEXIT & VXGE_DEBUG_MASK))
3451 u32 level_trace;
3452#endif
3453 3448
3454 dev = hldev->ndev; 3449 dev = hldev->ndev;
3455 vdev = netdev_priv(dev); 3450 vdev = netdev_priv(dev);
3456#if ((VXGE_DEBUG_INIT & VXGE_DEBUG_MASK) || \
3457 (VXGE_DEBUG_ENTRYEXIT & VXGE_DEBUG_MASK))
3458 level_trace = vdev->level_trace;
3459#endif
3460 vxge_debug_entryexit(level_trace,
3461 "%s: %s:%d", vdev->ndev->name, __func__, __LINE__);
3462 3451
3463 memcpy(buf, vdev->ndev->name, IFNAMSIZ); 3452 vxge_debug_entryexit(vdev->level_trace, "%s: %s:%d", vdev->ndev->name,
3453 __func__, __LINE__);
3454
3455 memcpy(buf, dev->name, IFNAMSIZ);
3464 3456
3465 /* in 2.6 will call stop() if device is up */ 3457 /* in 2.6 will call stop() if device is up */
3466 unregister_netdev(dev); 3458 unregister_netdev(dev);
3467 3459
3468 flush_scheduled_work(); 3460 flush_scheduled_work();
3469 3461
3470 vxge_debug_init(level_trace, "%s: ethernet device unregistered", buf); 3462 vxge_debug_init(vdev->level_trace, "%s: ethernet device unregistered",
3471 vxge_debug_entryexit(level_trace, 3463 buf);
3472 "%s: %s:%d Exiting...", buf, __func__, __LINE__); 3464 vxge_debug_entryexit(vdev->level_trace, "%s: %s:%d Exiting...", buf,
3465 __func__, __LINE__);
3473} 3466}
3474 3467
3475/* 3468/*
@@ -3992,8 +3985,8 @@ static int vxge_pm_resume(struct pci_dev *pdev)
3992static pci_ers_result_t vxge_io_error_detected(struct pci_dev *pdev, 3985static pci_ers_result_t vxge_io_error_detected(struct pci_dev *pdev,
3993 pci_channel_state_t state) 3986 pci_channel_state_t state)
3994{ 3987{
3995 struct __vxge_hw_device *hldev = 3988 struct __vxge_hw_device *hldev =
3996 (struct __vxge_hw_device *) pci_get_drvdata(pdev); 3989 (struct __vxge_hw_device *)pci_get_drvdata(pdev);
3997 struct net_device *netdev = hldev->ndev; 3990 struct net_device *netdev = hldev->ndev;
3998 3991
3999 netif_device_detach(netdev); 3992 netif_device_detach(netdev);
@@ -4022,8 +4015,8 @@ static pci_ers_result_t vxge_io_error_detected(struct pci_dev *pdev,
4022 */ 4015 */
4023static pci_ers_result_t vxge_io_slot_reset(struct pci_dev *pdev) 4016static pci_ers_result_t vxge_io_slot_reset(struct pci_dev *pdev)
4024{ 4017{
4025 struct __vxge_hw_device *hldev = 4018 struct __vxge_hw_device *hldev =
4026 (struct __vxge_hw_device *) pci_get_drvdata(pdev); 4019 (struct __vxge_hw_device *)pci_get_drvdata(pdev);
4027 struct net_device *netdev = hldev->ndev; 4020 struct net_device *netdev = hldev->ndev;
4028 4021
4029 struct vxgedev *vdev = netdev_priv(netdev); 4022 struct vxgedev *vdev = netdev_priv(netdev);
@@ -4048,8 +4041,8 @@ static pci_ers_result_t vxge_io_slot_reset(struct pci_dev *pdev)
4048 */ 4041 */
4049static void vxge_io_resume(struct pci_dev *pdev) 4042static void vxge_io_resume(struct pci_dev *pdev)
4050{ 4043{
4051 struct __vxge_hw_device *hldev = 4044 struct __vxge_hw_device *hldev =
4052 (struct __vxge_hw_device *) pci_get_drvdata(pdev); 4045 (struct __vxge_hw_device *)pci_get_drvdata(pdev);
4053 struct net_device *netdev = hldev->ndev; 4046 struct net_device *netdev = hldev->ndev;
4054 4047
4055 if (netif_running(netdev)) { 4048 if (netif_running(netdev)) {
@@ -4243,7 +4236,7 @@ static int vxge_probe_fw_update(struct vxgedev *vdev)
4243static int __devinit 4236static int __devinit
4244vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) 4237vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4245{ 4238{
4246 struct __vxge_hw_device *hldev; 4239 struct __vxge_hw_device *hldev;
4247 enum vxge_hw_status status; 4240 enum vxge_hw_status status;
4248 int ret; 4241 int ret;
4249 int high_dma = 0; 4242 int high_dma = 0;
@@ -4689,34 +4682,25 @@ _exit0:
4689 * Description: This function is called by the Pci subsystem to release a 4682 * Description: This function is called by the Pci subsystem to release a
4690 * PCI device and free up all resource held up by the device. 4683 * PCI device and free up all resource held up by the device.
4691 */ 4684 */
4692static void __devexit 4685static void __devexit vxge_remove(struct pci_dev *pdev)
4693vxge_remove(struct pci_dev *pdev)
4694{ 4686{
4695 struct __vxge_hw_device *hldev; 4687 struct __vxge_hw_device *hldev;
4696 struct vxgedev *vdev = NULL; 4688 struct vxgedev *vdev = NULL;
4697 struct net_device *dev; 4689 struct net_device *dev;
4698 int i = 0; 4690 int i = 0;
4699#if ((VXGE_DEBUG_INIT & VXGE_DEBUG_MASK) || \
4700 (VXGE_DEBUG_ENTRYEXIT & VXGE_DEBUG_MASK))
4701 u32 level_trace;
4702#endif
4703 4691
4704 hldev = (struct __vxge_hw_device *) pci_get_drvdata(pdev); 4692 hldev = (struct __vxge_hw_device *)pci_get_drvdata(pdev);
4705 4693
4706 if (hldev == NULL) 4694 if (hldev == NULL)
4707 return; 4695 return;
4696
4708 dev = hldev->ndev; 4697 dev = hldev->ndev;
4709 vdev = netdev_priv(dev); 4698 vdev = netdev_priv(dev);
4710 4699
4711#if ((VXGE_DEBUG_INIT & VXGE_DEBUG_MASK) || \ 4700 vxge_debug_entryexit(vdev->level_trace, "%s:%d", __func__, __LINE__);
4712 (VXGE_DEBUG_ENTRYEXIT & VXGE_DEBUG_MASK))
4713 level_trace = vdev->level_trace;
4714#endif
4715 vxge_debug_entryexit(level_trace,
4716 "%s:%d", __func__, __LINE__);
4717 4701
4718 vxge_debug_init(level_trace, 4702 vxge_debug_init(vdev->level_trace, "%s : removing PCI device...",
4719 "%s : removing PCI device...", __func__); 4703 __func__);
4720 vxge_device_unregister(hldev); 4704 vxge_device_unregister(hldev);
4721 4705
4722 for (i = 0; i < vdev->no_of_vpath; i++) { 4706 for (i = 0; i < vdev->no_of_vpath; i++) {
@@ -4734,16 +4718,16 @@ vxge_remove(struct pci_dev *pdev)
4734 /* we are safe to free it now */ 4718 /* we are safe to free it now */
4735 free_netdev(dev); 4719 free_netdev(dev);
4736 4720
4737 vxge_debug_init(level_trace, 4721 vxge_debug_init(vdev->level_trace, "%s:%d Device unregistered",
4738 "%s:%d Device unregistered", __func__, __LINE__); 4722 __func__, __LINE__);
4739 4723
4740 vxge_hw_device_terminate(hldev); 4724 vxge_hw_device_terminate(hldev);
4741 4725
4742 pci_disable_device(pdev); 4726 pci_disable_device(pdev);
4743 pci_release_regions(pdev); 4727 pci_release_regions(pdev);
4744 pci_set_drvdata(pdev, NULL); 4728 pci_set_drvdata(pdev, NULL);
4745 vxge_debug_entryexit(level_trace, 4729 vxge_debug_entryexit(vdev->level_trace, "%s:%d Exiting...", __func__,
4746 "%s:%d Exiting...", __func__, __LINE__); 4730 __LINE__);
4747} 4731}
4748 4732
4749static struct pci_error_handlers vxge_err_handler = { 4733static struct pci_error_handlers vxge_err_handler = {