linux_dsm_epyc7002/drivers/infiniband/hw
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
..
amso1100 IB/core: Remove IB_DEVICE_SEND_W_INV capability flag 2008-06-09 09:58:42 -07:00
cxgb3 RDMA/cxgb3: Add support for protocol statistics 2008-07-14 23:48:48 -07:00
ehca IB/ehca: Make device table externally visible 2008-07-14 23:48:49 -07:00
ipath RDMA/core: Add memory management extensions support 2008-07-14 23:48:45 -07:00
mlx4 IB/mlx4: Add support for blocking multicast loopback packets 2008-07-14 23:48:48 -07:00
mthca IB/mthca: Remove extra code for RESET->ERR QP state transition 2008-07-14 23:48:46 -07:00
nes RDMA/nes: Encapsulate logic nes_put_cqp_request() 2008-07-14 23:48:49 -07:00