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