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

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

From: David Laight <hidden>
Date: 2012-12-07 10:55:14

 #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)

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help