Thread (12 messages) 12 messages, 4 authors, 2014-06-11

RE: [PATCH v4 5/6] net: fec: Add Scatter/gather support

From: David Laight <hidden>
Date: 2014-06-10 11:11:31

From: Fugang Duan
Add Scatter/gather support for FEC.
This feature allows to improve outbound throughput performance.
...
+static int fec_enet_get_free_txdesc_num(struct fec_enet_private *fep)
+{
+	int entries;
+
+	entries = ((const char *)fep->dirty_tx -
+			(const char *)fep->cur_tx) / fep->bufdesc_size;
+
+	return (fep->cur_tx >= fep->dirty_tx) ?
+		entries += fep->tx_ring_size : entries;
+}
That is a strange return statement - why += ??

You could also check the sign of 'entries'.
Say:
	return entries > 0 ? entries : entries + fep->tx_ring_size;

Actually do you ever use the last entry?
If you do then the full and empty conditions are not separated.

	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