aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxge/vxge-config.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2010-10-21 03:50:53 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-24 18:07:12 -0400
commit42821a5b393e36f5c0b267473d59d375578df7ec (patch)
treebeeaa5a6ac9211567d9b13687585959a63ba1c8a /drivers/net/vxge/vxge-config.c
parent89ff05ec553f3e70b8773c501da01bf7ad952cab (diff)
vxge: make functions local and remove dead code
Use results of make namespacecheck to make functions local and remove code that is not used. Also rename initialize_ethtool_ops to vxge_initialize_ethtool_ops. Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxge/vxge-config.c')
-rw-r--r--drivers/net/vxge/vxge-config.c332
1 files changed, 247 insertions, 85 deletions
diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index 0e6db5935609..906a3ca3676b 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -20,6 +20,179 @@
20#include "vxge-traffic.h" 20#include "vxge-traffic.h"
21#include "vxge-config.h" 21#include "vxge-config.h"
22 22
23static enum vxge_hw_status
24__vxge_hw_fifo_create(
25 struct __vxge_hw_vpath_handle *vpath_handle,
26 struct vxge_hw_fifo_attr *attr);
27
28static enum vxge_hw_status
29__vxge_hw_fifo_abort(
30 struct __vxge_hw_fifo *fifoh);
31
32static enum vxge_hw_status
33__vxge_hw_fifo_reset(
34 struct __vxge_hw_fifo *ringh);
35
36static enum vxge_hw_status
37__vxge_hw_fifo_delete(
38 struct __vxge_hw_vpath_handle *vpath_handle);
39
40static struct __vxge_hw_blockpool_entry *
41__vxge_hw_blockpool_block_allocate(struct __vxge_hw_device *hldev,
42 u32 size);
43
44static void
45__vxge_hw_blockpool_block_free(struct __vxge_hw_device *hldev,
46 struct __vxge_hw_blockpool_entry *entry);
47
48static void vxge_hw_blockpool_block_add(struct __vxge_hw_device *devh,
49 void *block_addr,
50 u32 length,
51 struct pci_dev *dma_h,
52 struct pci_dev *acc_handle);
53
54static enum vxge_hw_status
55__vxge_hw_blockpool_create(struct __vxge_hw_device *hldev,
56 struct __vxge_hw_blockpool *blockpool,
57 u32 pool_size,
58 u32 pool_max);
59
60static void
61__vxge_hw_blockpool_destroy(struct __vxge_hw_blockpool *blockpool);
62
63static void *
64__vxge_hw_blockpool_malloc(struct __vxge_hw_device *hldev,
65 u32 size,
66 struct vxge_hw_mempool_dma *dma_object);
67
68static void
69__vxge_hw_blockpool_free(struct __vxge_hw_device *hldev,
70 void *memblock,
71 u32 size,
72 struct vxge_hw_mempool_dma *dma_object);
73
74
75static struct __vxge_hw_channel*
76__vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph,
77 enum __vxge_hw_channel_type type, u32 length,
78 u32 per_dtr_space, void *userdata);
79
80static void
81__vxge_hw_channel_free(
82 struct __vxge_hw_channel *channel);
83
84static enum vxge_hw_status
85__vxge_hw_channel_initialize(
86 struct __vxge_hw_channel *channel);
87
88static enum vxge_hw_status
89__vxge_hw_channel_reset(
90 struct __vxge_hw_channel *channel);
91
92static enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_vpath_handle *vp);
93
94static enum vxge_hw_status
95__vxge_hw_device_fifo_config_check(struct vxge_hw_fifo_config *fifo_config);
96
97static enum vxge_hw_status
98__vxge_hw_device_config_check(struct vxge_hw_device_config *new_config);
99
100static void
101__vxge_hw_device_id_get(struct __vxge_hw_device *hldev);
102
103static void
104__vxge_hw_device_host_info_get(struct __vxge_hw_device *hldev);
105
106static enum vxge_hw_status
107__vxge_hw_vpath_card_info_get(
108 u32 vp_id,
109 struct vxge_hw_vpath_reg __iomem *vpath_reg,
110 struct vxge_hw_device_hw_info *hw_info);
111
112static enum vxge_hw_status
113__vxge_hw_device_initialize(struct __vxge_hw_device *hldev);
114
115static void
116__vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev);
117
118static enum vxge_hw_status
119__vxge_hw_device_reg_addr_get(struct __vxge_hw_device *hldev);
120
121static enum vxge_hw_status
122__vxge_hw_device_register_poll(
123 void __iomem *reg,
124 u64 mask, u32 max_millis);
125
126static inline enum vxge_hw_status
127__vxge_hw_pio_mem_write64(u64 val64, void __iomem *addr,
128 u64 mask, u32 max_millis)
129{
130 __vxge_hw_pio_mem_write32_lower((u32)vxge_bVALn(val64, 32, 32), addr);
131 wmb();
132
133 __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn(val64, 0, 32), addr);
134 wmb();
135
136 return __vxge_hw_device_register_poll(addr, mask, max_millis);
137}
138
139static struct vxge_hw_mempool*
140__vxge_hw_mempool_create(struct __vxge_hw_device *devh, u32 memblock_size,
141 u32 item_size, u32 private_size, u32 items_initial,
142 u32 items_max, struct vxge_hw_mempool_cbs *mp_callback,
143 void *userdata);
144static void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool);
145
146static enum vxge_hw_status
147__vxge_hw_vpath_stats_get(struct __vxge_hw_virtualpath *vpath,
148 struct vxge_hw_vpath_stats_hw_info *hw_stats);
149
150static enum vxge_hw_status
151vxge_hw_vpath_stats_enable(struct __vxge_hw_vpath_handle *vpath_handle);
152
153static enum vxge_hw_status
154__vxge_hw_legacy_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg);
155
156static u64
157__vxge_hw_vpath_pci_func_mode_get(u32 vp_id,
158 struct vxge_hw_vpath_reg __iomem *vpath_reg);
159
160static u32
161__vxge_hw_vpath_func_id_get(u32 vp_id, struct vxge_hw_vpmgmt_reg __iomem *vpmgmt_reg);
162
163static enum vxge_hw_status
164__vxge_hw_vpath_addr_get(u32 vp_id, struct vxge_hw_vpath_reg __iomem *vpath_reg,
165 u8 (macaddr)[ETH_ALEN], u8 (macaddr_mask)[ETH_ALEN]);
166
167static enum vxge_hw_status
168__vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath);
169
170
171static enum vxge_hw_status
172__vxge_hw_vpath_sw_reset(struct __vxge_hw_device *devh, u32 vp_id);
173
174static enum vxge_hw_status
175__vxge_hw_vpath_fw_ver_get(u32 vp_id, struct vxge_hw_vpath_reg __iomem *vpath_reg,
176 struct vxge_hw_device_hw_info *hw_info);
177
178static enum vxge_hw_status
179__vxge_hw_vpath_mac_configure(struct __vxge_hw_device *devh, u32 vp_id);
180
181static void
182__vxge_hw_vp_terminate(struct __vxge_hw_device *devh, u32 vp_id);
183
184static enum vxge_hw_status
185__vxge_hw_vpath_stats_access(struct __vxge_hw_virtualpath *vpath,
186 u32 operation, u32 offset, u64 *stat);
187
188static enum vxge_hw_status
189__vxge_hw_vpath_xmac_tx_stats_get(struct __vxge_hw_virtualpath *vpath,
190 struct vxge_hw_xmac_vpath_tx_stats *vpath_tx_stats);
191
192static enum vxge_hw_status
193__vxge_hw_vpath_xmac_rx_stats_get(struct __vxge_hw_virtualpath *vpath,
194 struct vxge_hw_xmac_vpath_rx_stats *vpath_rx_stats);
195
23/* 196/*
24 * __vxge_hw_channel_allocate - Allocate memory for channel 197 * __vxge_hw_channel_allocate - Allocate memory for channel
25 * This function allocates required memory for the channel and various arrays 198 * This function allocates required memory for the channel and various arrays
@@ -190,7 +363,7 @@ __vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev)
190 * Will poll certain register for specified amount of time. 363 * Will poll certain register for specified amount of time.
191 * Will poll until masked bit is not cleared. 364 * Will poll until masked bit is not cleared.
192 */ 365 */
193enum vxge_hw_status 366static enum vxge_hw_status
194__vxge_hw_device_register_poll(void __iomem *reg, u64 mask, u32 max_millis) 367__vxge_hw_device_register_poll(void __iomem *reg, u64 mask, u32 max_millis)
195{ 368{
196 u64 val64; 369 u64 val64;
@@ -221,7 +394,7 @@ __vxge_hw_device_register_poll(void __iomem *reg, u64 mask, u32 max_millis)
221 * in progress 394 * in progress
222 * This routine checks the vpath reset in progress register is turned zero 395 * This routine checks the vpath reset in progress register is turned zero
223 */ 396 */
224enum vxge_hw_status 397static enum vxge_hw_status
225__vxge_hw_device_vpath_reset_in_prog_check(u64 __iomem *vpath_rst_in_prog) 398__vxge_hw_device_vpath_reset_in_prog_check(u64 __iomem *vpath_rst_in_prog)
226{ 399{
227 enum vxge_hw_status status; 400 enum vxge_hw_status status;
@@ -236,7 +409,7 @@ __vxge_hw_device_vpath_reset_in_prog_check(u64 __iomem *vpath_rst_in_prog)
236 * This routine sets the swapper and reads the toc pointer and returns the 409 * This routine sets the swapper and reads the toc pointer and returns the
237 * memory mapped address of the toc 410 * memory mapped address of the toc
238 */ 411 */
239struct vxge_hw_toc_reg __iomem * 412static struct vxge_hw_toc_reg __iomem *
240__vxge_hw_device_toc_get(void __iomem *bar0) 413__vxge_hw_device_toc_get(void __iomem *bar0)
241{ 414{
242 u64 val64; 415 u64 val64;
@@ -779,7 +952,7 @@ exit:
779 * vxge_hw_device_xmac_aggr_stats_get - Get the Statistics on aggregate port 952 * vxge_hw_device_xmac_aggr_stats_get - Get the Statistics on aggregate port
780 * Get the Statistics on aggregate port 953 * Get the Statistics on aggregate port
781 */ 954 */
782enum vxge_hw_status 955static enum vxge_hw_status
783vxge_hw_device_xmac_aggr_stats_get(struct __vxge_hw_device *hldev, u32 port, 956vxge_hw_device_xmac_aggr_stats_get(struct __vxge_hw_device *hldev, u32 port,
784 struct vxge_hw_xmac_aggr_stats *aggr_stats) 957 struct vxge_hw_xmac_aggr_stats *aggr_stats)
785{ 958{
@@ -814,7 +987,7 @@ exit:
814 * vxge_hw_device_xmac_port_stats_get - Get the Statistics on a port 987 * vxge_hw_device_xmac_port_stats_get - Get the Statistics on a port
815 * Get the Statistics on port 988 * Get the Statistics on port
816 */ 989 */
817enum vxge_hw_status 990static enum vxge_hw_status
818vxge_hw_device_xmac_port_stats_get(struct __vxge_hw_device *hldev, u32 port, 991vxge_hw_device_xmac_port_stats_get(struct __vxge_hw_device *hldev, u32 port,
819 struct vxge_hw_xmac_port_stats *port_stats) 992 struct vxge_hw_xmac_port_stats *port_stats)
820{ 993{
@@ -952,20 +1125,6 @@ u32 vxge_hw_device_trace_level_get(struct __vxge_hw_device *hldev)
952 return 0; 1125 return 0;
953#endif 1126#endif
954} 1127}
955/*
956 * vxge_hw_device_debug_mask_get - Get the debug mask
957 * This routine returns the current debug mask set
958 */
959u32 vxge_hw_device_debug_mask_get(struct __vxge_hw_device *hldev)
960{
961#if defined(VXGE_DEBUG_TRACE_MASK) || defined(VXGE_DEBUG_ERR_MASK)
962 if (hldev == NULL)
963 return 0;
964 return hldev->debug_module_mask;
965#else
966 return 0;
967#endif
968}
969 1128
970/* 1129/*
971 * vxge_hw_getpause_data -Pause frame frame generation and reception. 1130 * vxge_hw_getpause_data -Pause frame frame generation and reception.
@@ -1090,7 +1249,7 @@ __vxge_hw_ring_block_next_pointer_set(u8 *block, dma_addr_t dma_next)
1090 * first block 1249 * first block
1091 * Returns the dma address of the first RxD block 1250 * Returns the dma address of the first RxD block
1092 */ 1251 */
1093u64 __vxge_hw_ring_first_block_address_get(struct __vxge_hw_ring *ring) 1252static u64 __vxge_hw_ring_first_block_address_get(struct __vxge_hw_ring *ring)
1094{ 1253{
1095 struct vxge_hw_mempool_dma *dma_object; 1254 struct vxge_hw_mempool_dma *dma_object;
1096 1255
@@ -1252,7 +1411,7 @@ exit:
1252 * This function creates Ring and initializes it. 1411 * This function creates Ring and initializes it.
1253 * 1412 *
1254 */ 1413 */
1255enum vxge_hw_status 1414static enum vxge_hw_status
1256__vxge_hw_ring_create(struct __vxge_hw_vpath_handle *vp, 1415__vxge_hw_ring_create(struct __vxge_hw_vpath_handle *vp,
1257 struct vxge_hw_ring_attr *attr) 1416 struct vxge_hw_ring_attr *attr)
1258{ 1417{
@@ -1363,7 +1522,7 @@ exit:
1363 * __vxge_hw_ring_abort - Returns the RxD 1522 * __vxge_hw_ring_abort - Returns the RxD
1364 * This function terminates the RxDs of ring 1523 * This function terminates the RxDs of ring
1365 */ 1524 */
1366enum vxge_hw_status __vxge_hw_ring_abort(struct __vxge_hw_ring *ring) 1525static enum vxge_hw_status __vxge_hw_ring_abort(struct __vxge_hw_ring *ring)
1367{ 1526{
1368 void *rxdh; 1527 void *rxdh;
1369 struct __vxge_hw_channel *channel; 1528 struct __vxge_hw_channel *channel;
@@ -1392,7 +1551,7 @@ enum vxge_hw_status __vxge_hw_ring_abort(struct __vxge_hw_ring *ring)
1392 * __vxge_hw_ring_reset - Resets the ring 1551 * __vxge_hw_ring_reset - Resets the ring
1393 * This function resets the ring during vpath reset operation 1552 * This function resets the ring during vpath reset operation
1394 */ 1553 */
1395enum vxge_hw_status __vxge_hw_ring_reset(struct __vxge_hw_ring *ring) 1554static enum vxge_hw_status __vxge_hw_ring_reset(struct __vxge_hw_ring *ring)
1396{ 1555{
1397 enum vxge_hw_status status = VXGE_HW_OK; 1556 enum vxge_hw_status status = VXGE_HW_OK;
1398 struct __vxge_hw_channel *channel; 1557 struct __vxge_hw_channel *channel;
@@ -1419,7 +1578,7 @@ exit:
1419 * __vxge_hw_ring_delete - Removes the ring 1578 * __vxge_hw_ring_delete - Removes the ring
1420 * This function freeup the memory pool and removes the ring 1579 * This function freeup the memory pool and removes the ring
1421 */ 1580 */
1422enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_vpath_handle *vp) 1581static enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_vpath_handle *vp)
1423{ 1582{
1424 struct __vxge_hw_ring *ring = vp->vpath->ringh; 1583 struct __vxge_hw_ring *ring = vp->vpath->ringh;
1425 1584
@@ -1438,7 +1597,7 @@ enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_vpath_handle *vp)
1438 * __vxge_hw_mempool_grow 1597 * __vxge_hw_mempool_grow
1439 * Will resize mempool up to %num_allocate value. 1598 * Will resize mempool up to %num_allocate value.
1440 */ 1599 */
1441enum vxge_hw_status 1600static enum vxge_hw_status
1442__vxge_hw_mempool_grow(struct vxge_hw_mempool *mempool, u32 num_allocate, 1601__vxge_hw_mempool_grow(struct vxge_hw_mempool *mempool, u32 num_allocate,
1443 u32 *num_allocated) 1602 u32 *num_allocated)
1444{ 1603{
@@ -1527,7 +1686,7 @@ exit:
1527 * with size enough to hold %items_initial number of items. Memory is 1686 * with size enough to hold %items_initial number of items. Memory is
1528 * DMA-able but client must map/unmap before interoperating with the device. 1687 * DMA-able but client must map/unmap before interoperating with the device.
1529 */ 1688 */
1530struct vxge_hw_mempool* 1689static struct vxge_hw_mempool*
1531__vxge_hw_mempool_create( 1690__vxge_hw_mempool_create(
1532 struct __vxge_hw_device *devh, 1691 struct __vxge_hw_device *devh,
1533 u32 memblock_size, 1692 u32 memblock_size,
@@ -1644,7 +1803,7 @@ exit:
1644/* 1803/*
1645 * vxge_hw_mempool_destroy 1804 * vxge_hw_mempool_destroy
1646 */ 1805 */
1647void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool) 1806static void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool)
1648{ 1807{
1649 u32 i, j; 1808 u32 i, j;
1650 struct __vxge_hw_device *devh = mempool->devh; 1809 struct __vxge_hw_device *devh = mempool->devh;
@@ -1700,7 +1859,7 @@ __vxge_hw_device_fifo_config_check(struct vxge_hw_fifo_config *fifo_config)
1700 * __vxge_hw_device_vpath_config_check - Check vpath configuration. 1859 * __vxge_hw_device_vpath_config_check - Check vpath configuration.
1701 * Check the vpath configuration 1860 * Check the vpath configuration
1702 */ 1861 */
1703enum vxge_hw_status 1862static enum vxge_hw_status
1704__vxge_hw_device_vpath_config_check(struct vxge_hw_vp_config *vp_config) 1863__vxge_hw_device_vpath_config_check(struct vxge_hw_vp_config *vp_config)
1705{ 1864{
1706 enum vxge_hw_status status; 1865 enum vxge_hw_status status;
@@ -1922,7 +2081,7 @@ vxge_hw_device_config_default_get(struct vxge_hw_device_config *device_config)
1922 * _hw_legacy_swapper_set - Set the swapper bits for the legacy secion. 2081 * _hw_legacy_swapper_set - Set the swapper bits for the legacy secion.
1923 * Set the swapper bits appropriately for the lagacy section. 2082 * Set the swapper bits appropriately for the lagacy section.
1924 */ 2083 */
1925enum vxge_hw_status 2084static enum vxge_hw_status
1926__vxge_hw_legacy_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg) 2085__vxge_hw_legacy_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg)
1927{ 2086{
1928 u64 val64; 2087 u64 val64;
@@ -1977,7 +2136,7 @@ __vxge_hw_legacy_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg)
1977 * __vxge_hw_vpath_swapper_set - Set the swapper bits for the vpath. 2136 * __vxge_hw_vpath_swapper_set - Set the swapper bits for the vpath.
1978 * Set the swapper bits appropriately for the vpath. 2137 * Set the swapper bits appropriately for the vpath.
1979 */ 2138 */
1980enum vxge_hw_status 2139static enum vxge_hw_status
1981__vxge_hw_vpath_swapper_set(struct vxge_hw_vpath_reg __iomem *vpath_reg) 2140__vxge_hw_vpath_swapper_set(struct vxge_hw_vpath_reg __iomem *vpath_reg)
1982{ 2141{
1983#ifndef __BIG_ENDIAN 2142#ifndef __BIG_ENDIAN
@@ -1996,7 +2155,7 @@ __vxge_hw_vpath_swapper_set(struct vxge_hw_vpath_reg __iomem *vpath_reg)
1996 * __vxge_hw_kdfc_swapper_set - Set the swapper bits for the kdfc. 2155 * __vxge_hw_kdfc_swapper_set - Set the swapper bits for the kdfc.
1997 * Set the swapper bits appropriately for the vpath. 2156 * Set the swapper bits appropriately for the vpath.
1998 */ 2157 */
1999enum vxge_hw_status 2158static enum vxge_hw_status
2000__vxge_hw_kdfc_swapper_set( 2159__vxge_hw_kdfc_swapper_set(
2001 struct vxge_hw_legacy_reg __iomem *legacy_reg, 2160 struct vxge_hw_legacy_reg __iomem *legacy_reg,
2002 struct vxge_hw_vpath_reg __iomem *vpath_reg) 2161 struct vxge_hw_vpath_reg __iomem *vpath_reg)
@@ -2021,28 +2180,6 @@ __vxge_hw_kdfc_swapper_set(
2021} 2180}
2022 2181
2023/* 2182/*
2024 * vxge_hw_mgmt_device_config - Retrieve device configuration.
2025 * Get device configuration. Permits to retrieve at run-time configuration
2026 * values that were used to initialize and configure the device.
2027 */
2028enum vxge_hw_status
2029vxge_hw_mgmt_device_config(struct __vxge_hw_device *hldev,
2030 struct vxge_hw_device_config *dev_config, int size)
2031{
2032
2033 if ((hldev == NULL) || (hldev->magic != VXGE_HW_DEVICE_MAGIC))
2034 return VXGE_HW_ERR_INVALID_DEVICE;
2035
2036 if (size != sizeof(struct vxge_hw_device_config))
2037 return VXGE_HW_ERR_VERSION_CONFLICT;
2038
2039 memcpy(dev_config, &hldev->config,
2040 sizeof(struct vxge_hw_device_config));
2041
2042 return VXGE_HW_OK;
2043}
2044
2045/*
2046 * vxge_hw_mgmt_reg_read - Read Titan register. 2183 * vxge_hw_mgmt_reg_read - Read Titan register.
2047 */ 2184 */
2048enum vxge_hw_status 2185enum vxge_hw_status
@@ -2438,7 +2575,7 @@ exit:
2438 * __vxge_hw_fifo_abort - Returns the TxD 2575 * __vxge_hw_fifo_abort - Returns the TxD
2439 * This function terminates the TxDs of fifo 2576 * This function terminates the TxDs of fifo
2440 */ 2577 */
2441enum vxge_hw_status __vxge_hw_fifo_abort(struct __vxge_hw_fifo *fifo) 2578static enum vxge_hw_status __vxge_hw_fifo_abort(struct __vxge_hw_fifo *fifo)
2442{ 2579{
2443 void *txdlh; 2580 void *txdlh;
2444 2581
@@ -2466,7 +2603,7 @@ enum vxge_hw_status __vxge_hw_fifo_abort(struct __vxge_hw_fifo *fifo)
2466 * __vxge_hw_fifo_reset - Resets the fifo 2603 * __vxge_hw_fifo_reset - Resets the fifo
2467 * This function resets the fifo during vpath reset operation 2604 * This function resets the fifo during vpath reset operation
2468 */ 2605 */
2469enum vxge_hw_status __vxge_hw_fifo_reset(struct __vxge_hw_fifo *fifo) 2606static enum vxge_hw_status __vxge_hw_fifo_reset(struct __vxge_hw_fifo *fifo)
2470{ 2607{
2471 enum vxge_hw_status status = VXGE_HW_OK; 2608 enum vxge_hw_status status = VXGE_HW_OK;
2472 2609
@@ -2501,7 +2638,7 @@ enum vxge_hw_status __vxge_hw_fifo_delete(struct __vxge_hw_vpath_handle *vp)
2501 * in pci config space. 2638 * in pci config space.
2502 * Read from the vpath pci config space. 2639 * Read from the vpath pci config space.
2503 */ 2640 */
2504enum vxge_hw_status 2641static enum vxge_hw_status
2505__vxge_hw_vpath_pci_read(struct __vxge_hw_virtualpath *vpath, 2642__vxge_hw_vpath_pci_read(struct __vxge_hw_virtualpath *vpath,
2506 u32 phy_func_0, u32 offset, u32 *val) 2643 u32 phy_func_0, u32 offset, u32 *val)
2507{ 2644{
@@ -2542,7 +2679,7 @@ exit:
2542 * __vxge_hw_vpath_func_id_get - Get the function id of the vpath. 2679 * __vxge_hw_vpath_func_id_get - Get the function id of the vpath.
2543 * Returns the function number of the vpath. 2680 * Returns the function number of the vpath.
2544 */ 2681 */
2545u32 2682static u32
2546__vxge_hw_vpath_func_id_get(u32 vp_id, 2683__vxge_hw_vpath_func_id_get(u32 vp_id,
2547 struct vxge_hw_vpmgmt_reg __iomem *vpmgmt_reg) 2684 struct vxge_hw_vpmgmt_reg __iomem *vpmgmt_reg)
2548{ 2685{
@@ -2573,7 +2710,7 @@ __vxge_hw_read_rts_ds(struct vxge_hw_vpath_reg __iomem *vpath_reg,
2573 * __vxge_hw_vpath_card_info_get - Get the serial numbers, 2710 * __vxge_hw_vpath_card_info_get - Get the serial numbers,
2574 * part number and product description. 2711 * part number and product description.
2575 */ 2712 */
2576enum vxge_hw_status 2713static enum vxge_hw_status
2577__vxge_hw_vpath_card_info_get( 2714__vxge_hw_vpath_card_info_get(
2578 u32 vp_id, 2715 u32 vp_id,
2579 struct vxge_hw_vpath_reg __iomem *vpath_reg, 2716 struct vxge_hw_vpath_reg __iomem *vpath_reg,
@@ -2695,7 +2832,7 @@ __vxge_hw_vpath_card_info_get(
2695 * __vxge_hw_vpath_fw_ver_get - Get the fw version 2832 * __vxge_hw_vpath_fw_ver_get - Get the fw version
2696 * Returns FW Version 2833 * Returns FW Version
2697 */ 2834 */
2698enum vxge_hw_status 2835static enum vxge_hw_status
2699__vxge_hw_vpath_fw_ver_get( 2836__vxge_hw_vpath_fw_ver_get(
2700 u32 vp_id, 2837 u32 vp_id,
2701 struct vxge_hw_vpath_reg __iomem *vpath_reg, 2838 struct vxge_hw_vpath_reg __iomem *vpath_reg,
@@ -2789,7 +2926,7 @@ exit:
2789 * __vxge_hw_vpath_pci_func_mode_get - Get the pci mode 2926 * __vxge_hw_vpath_pci_func_mode_get - Get the pci mode
2790 * Returns pci function mode 2927 * Returns pci function mode
2791 */ 2928 */
2792u64 2929static u64
2793__vxge_hw_vpath_pci_func_mode_get( 2930__vxge_hw_vpath_pci_func_mode_get(
2794 u32 vp_id, 2931 u32 vp_id,
2795 struct vxge_hw_vpath_reg __iomem *vpath_reg) 2932 struct vxge_hw_vpath_reg __iomem *vpath_reg)
@@ -2995,7 +3132,7 @@ exit:
2995 * __vxge_hw_vpath_addr_get - Get the hw address entry for this vpath 3132 * __vxge_hw_vpath_addr_get - Get the hw address entry for this vpath
2996 * from MAC address table. 3133 * from MAC address table.
2997 */ 3134 */
2998enum vxge_hw_status 3135static enum vxge_hw_status
2999__vxge_hw_vpath_addr_get( 3136__vxge_hw_vpath_addr_get(
3000 u32 vp_id, struct vxge_hw_vpath_reg __iomem *vpath_reg, 3137 u32 vp_id, struct vxge_hw_vpath_reg __iomem *vpath_reg,
3001 u8 (macaddr)[ETH_ALEN], u8 (macaddr_mask)[ETH_ALEN]) 3138 u8 (macaddr)[ETH_ALEN], u8 (macaddr_mask)[ETH_ALEN])
@@ -3347,7 +3484,7 @@ __vxge_hw_vpath_mgmt_read(
3347 * This routine checks the vpath_rst_in_prog register to see if 3484 * This routine checks the vpath_rst_in_prog register to see if
3348 * adapter completed the reset process for the vpath 3485 * adapter completed the reset process for the vpath
3349 */ 3486 */
3350enum vxge_hw_status 3487static enum vxge_hw_status
3351__vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath) 3488__vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath)
3352{ 3489{
3353 enum vxge_hw_status status; 3490 enum vxge_hw_status status;
@@ -3365,7 +3502,7 @@ __vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath)
3365 * __vxge_hw_vpath_reset 3502 * __vxge_hw_vpath_reset
3366 * This routine resets the vpath on the device 3503 * This routine resets the vpath on the device
3367 */ 3504 */
3368enum vxge_hw_status 3505static enum vxge_hw_status
3369__vxge_hw_vpath_reset(struct __vxge_hw_device *hldev, u32 vp_id) 3506__vxge_hw_vpath_reset(struct __vxge_hw_device *hldev, u32 vp_id)
3370{ 3507{
3371 u64 val64; 3508 u64 val64;
@@ -3383,7 +3520,7 @@ __vxge_hw_vpath_reset(struct __vxge_hw_device *hldev, u32 vp_id)
3383 * __vxge_hw_vpath_sw_reset 3520 * __vxge_hw_vpath_sw_reset
3384 * This routine resets the vpath structures 3521 * This routine resets the vpath structures
3385 */ 3522 */
3386enum vxge_hw_status 3523static enum vxge_hw_status
3387__vxge_hw_vpath_sw_reset(struct __vxge_hw_device *hldev, u32 vp_id) 3524__vxge_hw_vpath_sw_reset(struct __vxge_hw_device *hldev, u32 vp_id)
3388{ 3525{
3389 enum vxge_hw_status status = VXGE_HW_OK; 3526 enum vxge_hw_status status = VXGE_HW_OK;
@@ -3408,7 +3545,7 @@ exit:
3408 * This routine configures the prc registers of virtual path using the config 3545 * This routine configures the prc registers of virtual path using the config
3409 * passed 3546 * passed
3410 */ 3547 */
3411void 3548static void
3412__vxge_hw_vpath_prc_configure(struct __vxge_hw_device *hldev, u32 vp_id) 3549__vxge_hw_vpath_prc_configure(struct __vxge_hw_device *hldev, u32 vp_id)
3413{ 3550{
3414 u64 val64; 3551 u64 val64;
@@ -3480,7 +3617,7 @@ __vxge_hw_vpath_prc_configure(struct __vxge_hw_device *hldev, u32 vp_id)
3480 * This routine configures the kdfc registers of virtual path using the 3617 * This routine configures the kdfc registers of virtual path using the
3481 * config passed 3618 * config passed
3482 */ 3619 */
3483enum vxge_hw_status 3620static enum vxge_hw_status
3484__vxge_hw_vpath_kdfc_configure(struct __vxge_hw_device *hldev, u32 vp_id) 3621__vxge_hw_vpath_kdfc_configure(struct __vxge_hw_device *hldev, u32 vp_id)
3485{ 3622{
3486 u64 val64; 3623 u64 val64;
@@ -3553,7 +3690,7 @@ exit:
3553 * __vxge_hw_vpath_mac_configure 3690 * __vxge_hw_vpath_mac_configure
3554 * This routine configures the mac of virtual path using the config passed 3691 * This routine configures the mac of virtual path using the config passed
3555 */ 3692 */
3556enum vxge_hw_status 3693static enum vxge_hw_status
3557__vxge_hw_vpath_mac_configure(struct __vxge_hw_device *hldev, u32 vp_id) 3694__vxge_hw_vpath_mac_configure(struct __vxge_hw_device *hldev, u32 vp_id)
3558{ 3695{
3559 u64 val64; 3696 u64 val64;
@@ -3621,7 +3758,7 @@ __vxge_hw_vpath_mac_configure(struct __vxge_hw_device *hldev, u32 vp_id)
3621 * This routine configures the tim registers of virtual path using the config 3758 * This routine configures the tim registers of virtual path using the config
3622 * passed 3759 * passed
3623 */ 3760 */
3624enum vxge_hw_status 3761static enum vxge_hw_status
3625__vxge_hw_vpath_tim_configure(struct __vxge_hw_device *hldev, u32 vp_id) 3762__vxge_hw_vpath_tim_configure(struct __vxge_hw_device *hldev, u32 vp_id)
3626{ 3763{
3627 u64 val64; 3764 u64 val64;
@@ -3897,7 +4034,7 @@ vxge_hw_vpath_tti_ci_set(struct __vxge_hw_device *hldev, u32 vp_id)
3897 * This routine is the final phase of init which initializes the 4034 * This routine is the final phase of init which initializes the
3898 * registers of the vpath using the configuration passed. 4035 * registers of the vpath using the configuration passed.
3899 */ 4036 */
3900enum vxge_hw_status 4037static enum vxge_hw_status
3901__vxge_hw_vpath_initialize(struct __vxge_hw_device *hldev, u32 vp_id) 4038__vxge_hw_vpath_initialize(struct __vxge_hw_device *hldev, u32 vp_id)
3902{ 4039{
3903 u64 val64; 4040 u64 val64;
@@ -3966,7 +4103,7 @@ exit:
3966 * This routine is the initial phase of init which resets the vpath and 4103 * This routine is the initial phase of init which resets the vpath and
3967 * initializes the software support structures. 4104 * initializes the software support structures.
3968 */ 4105 */
3969enum vxge_hw_status 4106static enum vxge_hw_status
3970__vxge_hw_vp_initialize(struct __vxge_hw_device *hldev, u32 vp_id, 4107__vxge_hw_vp_initialize(struct __vxge_hw_device *hldev, u32 vp_id,
3971 struct vxge_hw_vp_config *config) 4108 struct vxge_hw_vp_config *config)
3972{ 4109{
@@ -4022,7 +4159,7 @@ exit:
4022 * __vxge_hw_vp_terminate - Terminate Virtual Path structure 4159 * __vxge_hw_vp_terminate - Terminate Virtual Path structure
4023 * This routine closes all channels it opened and freeup memory 4160 * This routine closes all channels it opened and freeup memory
4024 */ 4161 */
4025void 4162static void
4026__vxge_hw_vp_terminate(struct __vxge_hw_device *hldev, u32 vp_id) 4163__vxge_hw_vp_terminate(struct __vxge_hw_device *hldev, u32 vp_id)
4027{ 4164{
4028 struct __vxge_hw_virtualpath *vpath; 4165 struct __vxge_hw_virtualpath *vpath;
@@ -4384,7 +4521,7 @@ vxge_hw_vpath_enable(struct __vxge_hw_vpath_handle *vp)
4384 * Enable the DMA vpath statistics. The function is to be called to re-enable 4521 * Enable the DMA vpath statistics. The function is to be called to re-enable
4385 * the adapter to update stats into the host memory 4522 * the adapter to update stats into the host memory
4386 */ 4523 */
4387enum vxge_hw_status 4524static enum vxge_hw_status
4388vxge_hw_vpath_stats_enable(struct __vxge_hw_vpath_handle *vp) 4525vxge_hw_vpath_stats_enable(struct __vxge_hw_vpath_handle *vp)
4389{ 4526{
4390 enum vxge_hw_status status = VXGE_HW_OK; 4527 enum vxge_hw_status status = VXGE_HW_OK;
@@ -4409,7 +4546,7 @@ exit:
4409 * __vxge_hw_vpath_stats_access - Get the statistics from the given location 4546 * __vxge_hw_vpath_stats_access - Get the statistics from the given location
4410 * and offset and perform an operation 4547 * and offset and perform an operation
4411 */ 4548 */
4412enum vxge_hw_status 4549static enum vxge_hw_status
4413__vxge_hw_vpath_stats_access(struct __vxge_hw_virtualpath *vpath, 4550__vxge_hw_vpath_stats_access(struct __vxge_hw_virtualpath *vpath,
4414 u32 operation, u32 offset, u64 *stat) 4551 u32 operation, u32 offset, u64 *stat)
4415{ 4552{
@@ -4445,7 +4582,7 @@ vpath_stats_access_exit:
4445/* 4582/*
4446 * __vxge_hw_vpath_xmac_tx_stats_get - Get the TX Statistics of a vpath 4583 * __vxge_hw_vpath_xmac_tx_stats_get - Get the TX Statistics of a vpath
4447 */ 4584 */
4448enum vxge_hw_status 4585static enum vxge_hw_status
4449__vxge_hw_vpath_xmac_tx_stats_get( 4586__vxge_hw_vpath_xmac_tx_stats_get(
4450 struct __vxge_hw_virtualpath *vpath, 4587 struct __vxge_hw_virtualpath *vpath,
4451 struct vxge_hw_xmac_vpath_tx_stats *vpath_tx_stats) 4588 struct vxge_hw_xmac_vpath_tx_stats *vpath_tx_stats)
@@ -4478,9 +4615,9 @@ exit:
4478/* 4615/*
4479 * __vxge_hw_vpath_xmac_rx_stats_get - Get the RX Statistics of a vpath 4616 * __vxge_hw_vpath_xmac_rx_stats_get - Get the RX Statistics of a vpath
4480 */ 4617 */
4481enum vxge_hw_status 4618static enum vxge_hw_status
4482__vxge_hw_vpath_xmac_rx_stats_get(struct __vxge_hw_virtualpath *vpath, 4619__vxge_hw_vpath_xmac_rx_stats_get(struct __vxge_hw_virtualpath *vpath,
4483 struct vxge_hw_xmac_vpath_rx_stats *vpath_rx_stats) 4620 struct vxge_hw_xmac_vpath_rx_stats *vpath_rx_stats)
4484{ 4621{
4485 u64 *val64; 4622 u64 *val64;
4486 enum vxge_hw_status status = VXGE_HW_OK; 4623 enum vxge_hw_status status = VXGE_HW_OK;
@@ -4509,9 +4646,9 @@ exit:
4509/* 4646/*
4510 * __vxge_hw_vpath_stats_get - Get the vpath hw statistics. 4647 * __vxge_hw_vpath_stats_get - Get the vpath hw statistics.
4511 */ 4648 */
4512enum vxge_hw_status __vxge_hw_vpath_stats_get( 4649static enum vxge_hw_status
4513 struct __vxge_hw_virtualpath *vpath, 4650__vxge_hw_vpath_stats_get(struct __vxge_hw_virtualpath *vpath,
4514 struct vxge_hw_vpath_stats_hw_info *hw_stats) 4651 struct vxge_hw_vpath_stats_hw_info *hw_stats)
4515{ 4652{
4516 u64 val64; 4653 u64 val64;
4517 enum vxge_hw_status status = VXGE_HW_OK; 4654 enum vxge_hw_status status = VXGE_HW_OK;
@@ -4643,6 +4780,32 @@ exit:
4643 return status; 4780 return status;
4644} 4781}
4645 4782
4783
4784static void vxge_os_dma_malloc_async(struct pci_dev *pdev, void *devh,
4785 unsigned long size)
4786{
4787 gfp_t flags;
4788 void *vaddr;
4789
4790 if (in_interrupt())
4791 flags = GFP_ATOMIC | GFP_DMA;
4792 else
4793 flags = GFP_KERNEL | GFP_DMA;
4794
4795 vaddr = kmalloc((size), flags);
4796
4797 vxge_hw_blockpool_block_add(devh, vaddr, size, pdev, pdev);
4798}
4799
4800static void vxge_os_dma_free(struct pci_dev *pdev, const void *vaddr,
4801 struct pci_dev **p_dma_acch)
4802{
4803 unsigned long misaligned = *(unsigned long *)p_dma_acch;
4804 u8 *tmp = (u8 *)vaddr;
4805 tmp -= misaligned;
4806 kfree((void *)tmp);
4807}
4808
4646/* 4809/*
4647 * __vxge_hw_blockpool_create - Create block pool 4810 * __vxge_hw_blockpool_create - Create block pool
4648 */ 4811 */
@@ -4845,12 +5008,11 @@ void __vxge_hw_blockpool_blocks_remove(struct __vxge_hw_blockpool *blockpool)
4845 * vxge_hw_blockpool_block_add - callback for vxge_os_dma_malloc_async 5008 * vxge_hw_blockpool_block_add - callback for vxge_os_dma_malloc_async
4846 * Adds a block to block pool 5009 * Adds a block to block pool
4847 */ 5010 */
4848void vxge_hw_blockpool_block_add( 5011static void vxge_hw_blockpool_block_add(struct __vxge_hw_device *devh,
4849 struct __vxge_hw_device *devh, 5012 void *block_addr,
4850 void *block_addr, 5013 u32 length,
4851 u32 length, 5014 struct pci_dev *dma_h,
4852 struct pci_dev *dma_h, 5015 struct pci_dev *acc_handle)
4853 struct pci_dev *acc_handle)
4854{ 5016{
4855 struct __vxge_hw_blockpool *blockpool; 5017 struct __vxge_hw_blockpool *blockpool;
4856 struct __vxge_hw_blockpool_entry *entry = NULL; 5018 struct __vxge_hw_blockpool_entry *entry = NULL;