Thread (10 messages) flat view 10 messages, 3 authors, 2012-12-07

Re: [net-next 2/7] bna: Tx and Rx Optimizations

From: David Miller <davem@davemloft.net>
Date: 2012-12-07 17:46:10

From: "David Laight" <redacted>
Date: Fri, 7 Dec 2012 10:46:22 -0000
quoted
 #define BNA_QE_INDX_ADD(_qe_idx, _qe_num, _q_depth)			\
 	((_qe_idx) = ((_qe_idx) + (_qe_num)) & ((_q_depth) - 1))

+#define BNA_QE_INDX_INC(_idx, _q_depth)					\
+do {									\
+	(_idx)++;							\
+	if ((_idx) == (_q_depth))					\
+		(_idx) = 0;						\
+} while (0)
+
If q_depth has to be a power of 2 (implied by BNA_QE_IND_ADD())
then you should mask in BNA_QE_INDX_INC() to save the conditional.
Or just:
#define BNA_QE_INDX_INC(_idx, _q_depth) BNA_QE_INDX_ADD(_idx, 1, _q_depth)
Agreed.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help