david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[hermon] Use circular event queue

Avoid memory leak of untreated events by having circular event queue
operation.

Signed-off-by: Itay Gazit <itaygazit@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Itay Gazit 2011-02-07 09:39:59 +02:00 committed by Michael Brown
parent 399be05865
commit 1b84a80442
2 changed files with 10 additions and 4 deletions

View File

@ -1778,7 +1778,9 @@ static int hermon_create_eq ( struct hermon *hermon ) {
/* Hand queue over to hardware */
memset ( &eqctx, 0, sizeof ( eqctx ) );
MLX_FILL_1 ( &eqctx, 0, st, 0xa /* "Fired" */ );
MLX_FILL_2 ( &eqctx, 0,
st, 0xa /* "Fired" */,
oi, 1 );
MLX_FILL_1 ( &eqctx, 2,
page_offset, ( hermon_eq->mtt.page_offset >> 5 ) );
MLX_FILL_1 ( &eqctx, 3, log_eq_size, fls ( HERMON_NUM_EQES - 1 ) );
@ -1831,8 +1833,7 @@ static void hermon_destroy_eq ( struct hermon *hermon ) {
int rc;
/* Unmap events from event queue */
memset ( &mask, 0, sizeof ( mask ) );
MLX_FILL_1 ( &mask, 1, port_state_change, 1 );
memset ( &mask, 0xff, sizeof ( mask ) );
if ( ( rc = hermon_cmd_map_eq ( hermon,
( HERMON_UNMAP_EQ | hermon_eq->eqn ),
&mask ) ) != 0 ) {
@ -2879,6 +2880,11 @@ static int hermon_get_cap ( struct hermon *hermon ) {
( 1 << MLX_GET ( &dev_cap, log2_rsvd_cqs ) );
hermon->cap.cqc_entry_size = MLX_GET ( &dev_cap, cqc_entry_sz );
hermon->cap.reserved_eqs = MLX_GET ( &dev_cap, num_rsvd_eqs );
if ( hermon->cap.reserved_eqs == 0 ) {
/* Backward compatibility */
hermon->cap.reserved_eqs =
( 1 << MLX_GET ( &dev_cap, log2_rsvd_eqs ) );
}
hermon->cap.eqc_entry_size = MLX_GET ( &dev_cap, eqc_entry_sz );
hermon->cap.reserved_mtts =
( 1 << MLX_GET ( &dev_cap, log2_rsvd_mtts ) );

View File

@ -724,7 +724,7 @@ struct hermon_event_queue {
*
* This is a policy decision.
*/
#define HERMON_NUM_EQES 4
#define HERMON_NUM_EQES 8
/** A Hermon resource bitmask */
typedef uint32_t hermon_bitmask_t;