diff options
Diffstat (limited to 'drivers/net/vxge/vxge-config.c')
-rw-r--r-- | drivers/net/vxge/vxge-config.c | 332 |
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 | ||
23 | static 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 | |||
28 | static enum vxge_hw_status | ||
29 | __vxge_hw_fifo_abort( | ||
30 | struct __vxge_hw_fifo *fifoh); | ||
31 | |||
32 | static enum vxge_hw_status | ||
33 | __vxge_hw_fifo_reset( | ||
34 | struct __vxge_hw_fifo *ringh); | ||
35 | |||
36 | static enum vxge_hw_status | ||
37 | __vxge_hw_fifo_delete( | ||
38 | struct __vxge_hw_vpath_handle *vpath_handle); | ||
39 | |||
40 | static struct __vxge_hw_blockpool_entry * | ||
41 | __vxge_hw_blockpool_block_allocate(struct __vxge_hw_device *hldev, | ||
42 | u32 size); | ||
43 | |||
44 | static void | ||
45 | __vxge_hw_blockpool_block_free(struct __vxge_hw_device *hldev, | ||
46 | struct __vxge_hw_blockpool_entry *entry); | ||
47 | |||
48 | static 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 | |||
54 | static 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 | |||
60 | static void | ||
61 | __vxge_hw_blockpool_destroy(struct __vxge_hw_blockpool *blockpool); | ||
62 | |||
63 | static void * | ||
64 | __vxge_hw_blockpool_malloc(struct __vxge_hw_device *hldev, | ||
65 | u32 size, | ||
66 | struct vxge_hw_mempool_dma *dma_object); | ||
67 | |||
68 | static 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 | |||
75 | static 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 | |||
80 | static void | ||
81 | __vxge_hw_channel_free( | ||
82 | struct __vxge_hw_channel *channel); | ||
83 | |||
84 | static enum vxge_hw_status | ||
85 | __vxge_hw_channel_initialize( | ||
86 | struct __vxge_hw_channel *channel); | ||
87 | |||
88 | static enum vxge_hw_status | ||
89 | __vxge_hw_channel_reset( | ||
90 | struct __vxge_hw_channel *channel); | ||
91 | |||
92 | static enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_vpath_handle *vp); | ||
93 | |||
94 | static enum vxge_hw_status | ||
95 | __vxge_hw_device_fifo_config_check(struct vxge_hw_fifo_config *fifo_config); | ||
96 | |||
97 | static enum vxge_hw_status | ||
98 | __vxge_hw_device_config_check(struct vxge_hw_device_config *new_config); | ||
99 | |||
100 | static void | ||
101 | __vxge_hw_device_id_get(struct __vxge_hw_device *hldev); | ||
102 | |||
103 | static void | ||
104 | __vxge_hw_device_host_info_get(struct __vxge_hw_device *hldev); | ||
105 | |||
106 | static 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 | |||
112 | static enum vxge_hw_status | ||
113 | __vxge_hw_device_initialize(struct __vxge_hw_device *hldev); | ||
114 | |||
115 | static void | ||
116 | __vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev); | ||
117 | |||
118 | static enum vxge_hw_status | ||
119 | __vxge_hw_device_reg_addr_get(struct __vxge_hw_device *hldev); | ||
120 | |||
121 | static enum vxge_hw_status | ||
122 | __vxge_hw_device_register_poll( | ||
123 | void __iomem *reg, | ||
124 | u64 mask, u32 max_millis); | ||
125 | |||
126 | static 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 | |||
139 | static 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); | ||
144 | static void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool); | ||
145 | |||
146 | static 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 | |||
150 | static enum vxge_hw_status | ||
151 | vxge_hw_vpath_stats_enable(struct __vxge_hw_vpath_handle *vpath_handle); | ||
152 | |||
153 | static enum vxge_hw_status | ||
154 | __vxge_hw_legacy_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg); | ||
155 | |||
156 | static u64 | ||
157 | __vxge_hw_vpath_pci_func_mode_get(u32 vp_id, | ||
158 | struct vxge_hw_vpath_reg __iomem *vpath_reg); | ||
159 | |||
160 | static u32 | ||
161 | __vxge_hw_vpath_func_id_get(u32 vp_id, struct vxge_hw_vpmgmt_reg __iomem *vpmgmt_reg); | ||
162 | |||
163 | static 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 | |||
167 | static enum vxge_hw_status | ||
168 | __vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath); | ||
169 | |||
170 | |||
171 | static enum vxge_hw_status | ||
172 | __vxge_hw_vpath_sw_reset(struct __vxge_hw_device *devh, u32 vp_id); | ||
173 | |||
174 | static 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 | |||
178 | static enum vxge_hw_status | ||
179 | __vxge_hw_vpath_mac_configure(struct __vxge_hw_device *devh, u32 vp_id); | ||
180 | |||
181 | static void | ||
182 | __vxge_hw_vp_terminate(struct __vxge_hw_device *devh, u32 vp_id); | ||
183 | |||
184 | static enum vxge_hw_status | ||
185 | __vxge_hw_vpath_stats_access(struct __vxge_hw_virtualpath *vpath, | ||
186 | u32 operation, u32 offset, u64 *stat); | ||
187 | |||
188 | static 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 | |||
192 | static 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 | */ |
193 | enum vxge_hw_status | 366 | static 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 | */ |
224 | enum vxge_hw_status | 397 | static 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 | */ |
239 | struct vxge_hw_toc_reg __iomem * | 412 | static 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 | */ |
782 | enum vxge_hw_status | 955 | static enum vxge_hw_status |
783 | vxge_hw_device_xmac_aggr_stats_get(struct __vxge_hw_device *hldev, u32 port, | 956 | vxge_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 | */ |
817 | enum vxge_hw_status | 990 | static enum vxge_hw_status |
818 | vxge_hw_device_xmac_port_stats_get(struct __vxge_hw_device *hldev, u32 port, | 991 | vxge_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 | */ | ||
959 | u32 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 | */ |
1093 | u64 __vxge_hw_ring_first_block_address_get(struct __vxge_hw_ring *ring) | 1252 | static 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 | */ |
1255 | enum vxge_hw_status | 1414 | static 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 | */ |
1366 | enum vxge_hw_status __vxge_hw_ring_abort(struct __vxge_hw_ring *ring) | 1525 | static 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 | */ |
1395 | enum vxge_hw_status __vxge_hw_ring_reset(struct __vxge_hw_ring *ring) | 1554 | static 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 | */ |
1422 | enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_vpath_handle *vp) | 1581 | static 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 | */ |
1441 | enum vxge_hw_status | 1600 | static 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 | */ |
1530 | struct vxge_hw_mempool* | 1689 | static 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 | */ |
1647 | void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool) | 1806 | static 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 | */ |
1703 | enum vxge_hw_status | 1862 | static 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 | */ |
1925 | enum vxge_hw_status | 2084 | static 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 | */ |
1980 | enum vxge_hw_status | 2139 | static 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 | */ |
1999 | enum vxge_hw_status | 2158 | static 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 | */ | ||
2028 | enum vxge_hw_status | ||
2029 | vxge_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 | */ |
2048 | enum vxge_hw_status | 2185 | enum 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 | */ |
2441 | enum vxge_hw_status __vxge_hw_fifo_abort(struct __vxge_hw_fifo *fifo) | 2578 | static 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 | */ |
2469 | enum vxge_hw_status __vxge_hw_fifo_reset(struct __vxge_hw_fifo *fifo) | 2606 | static 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 | */ |
2504 | enum vxge_hw_status | 2641 | static 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 | */ |
2545 | u32 | 2682 | static 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 | */ |
2576 | enum vxge_hw_status | 2713 | static 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 | */ |
2698 | enum vxge_hw_status | 2835 | static 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 | */ |
2792 | u64 | 2929 | static 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 | */ |
2998 | enum vxge_hw_status | 3135 | static 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 | */ |
3350 | enum vxge_hw_status | 3487 | static 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 | */ |
3368 | enum vxge_hw_status | 3505 | static 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 | */ |
3386 | enum vxge_hw_status | 3523 | static 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 | */ |
3411 | void | 3548 | static 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 | */ |
3483 | enum vxge_hw_status | 3620 | static 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 | */ |
3556 | enum vxge_hw_status | 3693 | static 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 | */ |
3624 | enum vxge_hw_status | 3761 | static 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 | */ |
3900 | enum vxge_hw_status | 4037 | static 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 | */ |
3969 | enum vxge_hw_status | 4106 | static 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 | */ |
4025 | void | 4162 | static 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 | */ |
4387 | enum vxge_hw_status | 4524 | static enum vxge_hw_status |
4388 | vxge_hw_vpath_stats_enable(struct __vxge_hw_vpath_handle *vp) | 4525 | vxge_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 | */ |
4412 | enum vxge_hw_status | 4549 | static 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 | */ |
4448 | enum vxge_hw_status | 4585 | static 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 | */ |
4481 | enum vxge_hw_status | 4618 | static 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 | */ |
4512 | enum vxge_hw_status __vxge_hw_vpath_stats_get( | 4649 | static 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 | |||
4784 | static 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 | |||
4800 | static 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 | */ |
4848 | void vxge_hw_blockpool_block_add( | 5011 | static 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; |