]> git.baikalelectronics.ru Git - kernel.git/commit
cxgb3: Fix sparse warning and micro-optimize is_pure_response()
authorRoland Dreier <rolandd@cisco.com>
Sat, 29 Nov 2008 05:55:42 +0000 (21:55 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 29 Nov 2008 05:55:42 +0000 (21:55 -0800)
commit2235b0edb00e81b0121332248377f38f35c27281
tree23f31f5387304a49dc768b503356671523611c86
parentdc1ec4189c8e68e9fef4b1eb82fa6b5667a3d919
cxgb3: Fix sparse warning and micro-optimize is_pure_response()

The function is_pure_response() does "ntohl(var) & const" and then
essentially just tests whether the result is 0 or not; this can be done
more efficiently by computing "var & htonl(const)" instead and doing the
byte swap at compile time instead of run time.

This change slightly shrinks the compiled code; eg on x86-64 we save a
couple of bswapl instructions:

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8 (-8)
function                                     old     new   delta
t3_sge_intr_msix_napi                        544     536      -8

and this also has the pleasant side effect of fixing a sparse warning:

    drivers/net/cxgb3/sge.c:2313:15: warning: restricted degrades to integer

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/cxgb3/sge.c