Skip to content

Commit

Permalink
[hermon] Use circular event queue
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Itay Gazit authored and mcb30 committed Feb 17, 2011
1 parent 399be05 commit 1b84a80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/drivers/infiniband/hermon.c
Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 ) );
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/infiniband/hermon.h
Expand Up @@ -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;
Expand Down

0 comments on commit 1b84a80

Please sign in to comment.