]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[hermon] Use circular event queue
authorItay Gazit <itaygazit@gmail.com>
Mon, 7 Feb 2011 07:39:59 +0000 (09:39 +0200)
committerMichael Brown <mcb30@ipxe.org>
Thu, 17 Feb 2011 01:25:09 +0000 (01:25 +0000)
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>
src/drivers/infiniband/hermon.c
src/drivers/infiniband/hermon.h

index cba92cefec27ee19a8d417703c9b47a915faed11..6a1ca8e504d9ecf93bb4d6fc9f94cf82d97c54d4 100644 (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 ) );
index 28ab34afac048f6da7db05cf9b8356ba8e8fd291..86553936537bd76a2490d682208f4323bb1972c5 100644 (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;