linux/drivers/infiniband/hw/nes
Roland Dreier 1ff66e8c1f RDMA/nes: Encapsulate logic nes_put_cqp_request()
The iw_nes driver repeats the logic

	if (atomic_dec_and_test(&cqp_request->refcount)) {
		if (cqp_request->dynamic) {
			kfree(cqp_request);
		} else {
			spin_lock_irqsave(&nesdev->cqp.lock, flags);
			list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
			spin_unlock_irqrestore(&nesdev->cqp.lock, flags);
		}
	}

over and over.  Wrap this up in functions nes_free_cqp_request() and
nes_put_cqp_request() to simplify such code.

In addition to making the source smaller and more readable, this shrinks
the compiled code quite a bit:

add/remove: 2/0 grow/shrink: 0/13 up/down: 164/-1692 (-1528)
function                                     old     new   delta
nes_free_cqp_request                           -     147    +147
nes_put_cqp_request                            -      17     +17
nes_modify_qp                               2316    2293     -23
nes_hw_modify_qp                             737     657     -80
nes_dereg_mr                                 945     860     -85
flush_wqes                                   501     416     -85
nes_manage_apbvt                             648     560     -88
nes_reg_mr                                  1117    1026     -91
nes_cqp_ce_handler                           927     769    -158
nes_alloc_mw                                1052     884    -168
nes_create_qp                               5314    5141    -173
nes_alloc_fmr                               2212    2035    -177
nes_destroy_cq                              1097     918    -179
nes_create_cq                               2787    2598    -189
nes_dealloc_mw                               762     566    -196

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Acked-by: Faisal Latif <flatif@neteffect.com>
2008-07-14 23:48:49 -07:00
..
Kconfig RDMA/nes: Use LRO 2008-04-29 13:46:54 -07:00
Makefile RDMA/nes: Add a driver for NetEffect RNICs 2008-02-04 20:20:45 -08:00
nes_cm.c RDMA/nes: Remove unnecessary memset() 2008-07-14 23:48:43 -07:00
nes_cm.h RDMA/nes: Remove session_id from nes_cm stuff 2008-04-16 21:09:25 -07:00
nes_context.h RDMA/nes: Add a driver for NetEffect RNICs 2008-02-04 20:20:45 -08:00
nes_hw.c RDMA/nes: Encapsulate logic nes_put_cqp_request() 2008-07-14 23:48:49 -07:00
nes_hw.h RDMA/nes: Formatting cleanup 2008-04-29 13:46:54 -07:00
nes_nic.c RDMA/nes: Formatting cleanup 2008-04-29 13:46:54 -07:00
nes_user.h RDMA/nes: Add a driver for NetEffect RNICs 2008-02-04 20:20:45 -08:00
nes_utils.c RDMA/nes: Encapsulate logic nes_put_cqp_request() 2008-07-14 23:48:49 -07:00
nes_verbs.c RDMA/nes: Encapsulate logic nes_put_cqp_request() 2008-07-14 23:48:49 -07:00
nes_verbs.h RDMA/nes: Add a driver for NetEffect RNICs 2008-02-04 20:20:45 -08:00
nes.c RDMA/nes: Fix up nes_lro_max_aggr module parameter 2008-05-13 11:27:25 -07:00
nes.h RDMA/nes: Encapsulate logic nes_put_cqp_request() 2008-07-14 23:48:49 -07:00