diff options
Diffstat (limited to 'drivers/net/vxge/vxge-traffic.c')
-rw-r--r-- | drivers/net/vxge/vxge-traffic.c | 116 |
1 files changed, 108 insertions, 8 deletions
diff --git a/drivers/net/vxge/vxge-traffic.c b/drivers/net/vxge/vxge-traffic.c index 4c10d6c4075f..8674f331311c 100644 --- a/drivers/net/vxge/vxge-traffic.c +++ b/drivers/net/vxge/vxge-traffic.c | |||
@@ -218,6 +218,68 @@ exit: | |||
218 | return status; | 218 | return status; |
219 | } | 219 | } |
220 | 220 | ||
221 | void vxge_hw_vpath_tti_ci_set(struct __vxge_hw_fifo *fifo) | ||
222 | { | ||
223 | struct vxge_hw_vpath_reg __iomem *vp_reg; | ||
224 | struct vxge_hw_vp_config *config; | ||
225 | u64 val64; | ||
226 | |||
227 | if (fifo->config->enable != VXGE_HW_FIFO_ENABLE) | ||
228 | return; | ||
229 | |||
230 | vp_reg = fifo->vp_reg; | ||
231 | config = container_of(fifo->config, struct vxge_hw_vp_config, fifo); | ||
232 | |||
233 | if (config->tti.timer_ci_en != VXGE_HW_TIM_TIMER_CI_ENABLE) { | ||
234 | config->tti.timer_ci_en = VXGE_HW_TIM_TIMER_CI_ENABLE; | ||
235 | val64 = readq(&vp_reg->tim_cfg1_int_num[VXGE_HW_VPATH_INTR_TX]); | ||
236 | val64 |= VXGE_HW_TIM_CFG1_INT_NUM_TIMER_CI; | ||
237 | fifo->tim_tti_cfg1_saved = val64; | ||
238 | writeq(val64, &vp_reg->tim_cfg1_int_num[VXGE_HW_VPATH_INTR_TX]); | ||
239 | } | ||
240 | } | ||
241 | |||
242 | void vxge_hw_vpath_dynamic_rti_ci_set(struct __vxge_hw_ring *ring) | ||
243 | { | ||
244 | u64 val64 = ring->tim_rti_cfg1_saved; | ||
245 | |||
246 | val64 |= VXGE_HW_TIM_CFG1_INT_NUM_TIMER_CI; | ||
247 | ring->tim_rti_cfg1_saved = val64; | ||
248 | writeq(val64, &ring->vp_reg->tim_cfg1_int_num[VXGE_HW_VPATH_INTR_RX]); | ||
249 | } | ||
250 | |||
251 | void vxge_hw_vpath_dynamic_tti_rtimer_set(struct __vxge_hw_fifo *fifo) | ||
252 | { | ||
253 | u64 val64 = fifo->tim_tti_cfg3_saved; | ||
254 | u64 timer = (fifo->rtimer * 1000) / 272; | ||
255 | |||
256 | val64 &= ~VXGE_HW_TIM_CFG3_INT_NUM_RTIMER_VAL(0x3ffffff); | ||
257 | if (timer) | ||
258 | val64 |= VXGE_HW_TIM_CFG3_INT_NUM_RTIMER_VAL(timer) | | ||
259 | VXGE_HW_TIM_CFG3_INT_NUM_RTIMER_EVENT_SF(5); | ||
260 | |||
261 | writeq(val64, &fifo->vp_reg->tim_cfg3_int_num[VXGE_HW_VPATH_INTR_TX]); | ||
262 | /* tti_cfg3_saved is not updated again because it is | ||
263 | * initialized at one place only - init time. | ||
264 | */ | ||
265 | } | ||
266 | |||
267 | void vxge_hw_vpath_dynamic_rti_rtimer_set(struct __vxge_hw_ring *ring) | ||
268 | { | ||
269 | u64 val64 = ring->tim_rti_cfg3_saved; | ||
270 | u64 timer = (ring->rtimer * 1000) / 272; | ||
271 | |||
272 | val64 &= ~VXGE_HW_TIM_CFG3_INT_NUM_RTIMER_VAL(0x3ffffff); | ||
273 | if (timer) | ||
274 | val64 |= VXGE_HW_TIM_CFG3_INT_NUM_RTIMER_VAL(timer) | | ||
275 | VXGE_HW_TIM_CFG3_INT_NUM_RTIMER_EVENT_SF(4); | ||
276 | |||
277 | writeq(val64, &ring->vp_reg->tim_cfg3_int_num[VXGE_HW_VPATH_INTR_RX]); | ||
278 | /* rti_cfg3_saved is not updated again because it is | ||
279 | * initialized at one place only - init time. | ||
280 | */ | ||
281 | } | ||
282 | |||
221 | /** | 283 | /** |
222 | * vxge_hw_channel_msix_mask - Mask MSIX Vector. | 284 | * vxge_hw_channel_msix_mask - Mask MSIX Vector. |
223 | * @channeh: Channel for rx or tx handle | 285 | * @channeh: Channel for rx or tx handle |
@@ -254,6 +316,23 @@ vxge_hw_channel_msix_unmask(struct __vxge_hw_channel *channel, int msix_id) | |||
254 | } | 316 | } |
255 | 317 | ||
256 | /** | 318 | /** |
319 | * vxge_hw_channel_msix_clear - Unmask the MSIX Vector. | ||
320 | * @channel: Channel for rx or tx handle | ||
321 | * @msix_id: MSI ID | ||
322 | * | ||
323 | * The function unmasks the msix interrupt for the given msix_id | ||
324 | * if configured in MSIX oneshot mode | ||
325 | * | ||
326 | * Returns: 0 | ||
327 | */ | ||
328 | void vxge_hw_channel_msix_clear(struct __vxge_hw_channel *channel, int msix_id) | ||
329 | { | ||
330 | __vxge_hw_pio_mem_write32_upper( | ||
331 | (u32) vxge_bVALn(vxge_mBIT(msix_id >> 2), 0, 32), | ||
332 | &channel->common_reg->clr_msix_one_shot_vec[msix_id % 4]); | ||
333 | } | ||
334 | |||
335 | /** | ||
257 | * vxge_hw_device_set_intr_type - Updates the configuration | 336 | * vxge_hw_device_set_intr_type - Updates the configuration |
258 | * with new interrupt type. | 337 | * with new interrupt type. |
259 | * @hldev: HW device handle. | 338 | * @hldev: HW device handle. |
@@ -2191,19 +2270,14 @@ vxge_hw_vpath_msix_set(struct __vxge_hw_vpath_handle *vp, int *tim_msix_id, | |||
2191 | if (vpath->hldev->config.intr_mode == | 2270 | if (vpath->hldev->config.intr_mode == |
2192 | VXGE_HW_INTR_MODE_MSIX_ONE_SHOT) { | 2271 | VXGE_HW_INTR_MODE_MSIX_ONE_SHOT) { |
2193 | __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn( | 2272 | __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn( |
2273 | VXGE_HW_ONE_SHOT_VECT0_EN_ONE_SHOT_VECT0_EN, | ||
2274 | 0, 32), &vp_reg->one_shot_vect0_en); | ||
2275 | __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn( | ||
2194 | VXGE_HW_ONE_SHOT_VECT1_EN_ONE_SHOT_VECT1_EN, | 2276 | VXGE_HW_ONE_SHOT_VECT1_EN_ONE_SHOT_VECT1_EN, |
2195 | 0, 32), &vp_reg->one_shot_vect1_en); | 2277 | 0, 32), &vp_reg->one_shot_vect1_en); |
2196 | } | ||
2197 | |||
2198 | if (vpath->hldev->config.intr_mode == | ||
2199 | VXGE_HW_INTR_MODE_MSIX_ONE_SHOT) { | ||
2200 | __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn( | 2278 | __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn( |
2201 | VXGE_HW_ONE_SHOT_VECT2_EN_ONE_SHOT_VECT2_EN, | 2279 | VXGE_HW_ONE_SHOT_VECT2_EN_ONE_SHOT_VECT2_EN, |
2202 | 0, 32), &vp_reg->one_shot_vect2_en); | 2280 | 0, 32), &vp_reg->one_shot_vect2_en); |
2203 | |||
2204 | __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn( | ||
2205 | VXGE_HW_ONE_SHOT_VECT3_EN_ONE_SHOT_VECT3_EN, | ||
2206 | 0, 32), &vp_reg->one_shot_vect3_en); | ||
2207 | } | 2281 | } |
2208 | } | 2282 | } |
2209 | 2283 | ||
@@ -2229,6 +2303,32 @@ vxge_hw_vpath_msix_mask(struct __vxge_hw_vpath_handle *vp, int msix_id) | |||
2229 | } | 2303 | } |
2230 | 2304 | ||
2231 | /** | 2305 | /** |
2306 | * vxge_hw_vpath_msix_clear - Clear MSIX Vector. | ||
2307 | * @vp: Virtual Path handle. | ||
2308 | * @msix_id: MSI ID | ||
2309 | * | ||
2310 | * The function clears the msix interrupt for the given msix_id | ||
2311 | * | ||
2312 | * Returns: 0, | ||
2313 | * Otherwise, VXGE_HW_ERR_WRONG_IRQ if the msix index is out of range | ||
2314 | * status. | ||
2315 | * See also: | ||
2316 | */ | ||
2317 | void vxge_hw_vpath_msix_clear(struct __vxge_hw_vpath_handle *vp, int msix_id) | ||
2318 | { | ||
2319 | struct __vxge_hw_device *hldev = vp->vpath->hldev; | ||
2320 | |||
2321 | if ((hldev->config.intr_mode == VXGE_HW_INTR_MODE_MSIX_ONE_SHOT)) | ||
2322 | __vxge_hw_pio_mem_write32_upper( | ||
2323 | (u32) vxge_bVALn(vxge_mBIT((msix_id >> 2)), 0, 32), | ||
2324 | &hldev->common_reg->clr_msix_one_shot_vec[msix_id % 4]); | ||
2325 | else | ||
2326 | __vxge_hw_pio_mem_write32_upper( | ||
2327 | (u32) vxge_bVALn(vxge_mBIT((msix_id >> 2)), 0, 32), | ||
2328 | &hldev->common_reg->clear_msix_mask_vect[msix_id % 4]); | ||
2329 | } | ||
2330 | |||
2331 | /** | ||
2232 | * vxge_hw_vpath_msix_unmask - Unmask the MSIX Vector. | 2332 | * vxge_hw_vpath_msix_unmask - Unmask the MSIX Vector. |
2233 | * @vp: Virtual Path handle. | 2333 | * @vp: Virtual Path handle. |
2234 | * @msix_id: MSI ID | 2334 | * @msix_id: MSI ID |