summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c
index 8b5e945..1d4d323 100644
--- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c
+++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c
@@ -42,13 +42,17 @@
#ifndef CONFIG_FSL_DPAA_ETH_SG_SUPPORT
-/* Extra size of a buffer (beyond the size of the buffers that are seeded into
- * the global pool) for which recycling is allowed.
- * The value is arbitrary, but tries to reach a balance such that originating
- * frames may get recycled, while forwarded skbs that get reallocated on Tx
- * aren't allowed to grow unboundedly.
+/* Maximum size of a buffer for which recycling is allowed.
+ * We need an upper limit such that forwarded skbs that get reallocated on Tx
+ * aren't allowed to grow unboundedly. On the other hand, we need to make sure
+ * that skbs allocated by us will not fail to be recycled due to their size.
+ *
+ * For a requested size, the kernel allocator provides the next power of two
+ * sized block, which the stack will use as is, regardless of the actual size
+ * it required; since we must acommodate at most 9.6K buffers (L2 maximum
+ * supported frame size), set the recycling upper limit to 16K.
*/
-#define DPA_RECYCLE_EXTRA_SIZE 1024
+#define DPA_RECYCLE_MAX_SIZE 16384
/* Maximum offset value for a contig or sg FD (represented on 9bits) */
#define DPA_MAX_FD_OFFSET ((1 << 9) - 1)
@@ -498,7 +502,7 @@ static int skb_to_contig_fd(struct dpa_priv_s *priv,
*/
if (likely(skb_is_recycleable(skb, dpa_bp->size) &&
(skb_end_pointer(skb) - skb->head <=
- dpa_bp->size + DPA_RECYCLE_EXTRA_SIZE) &&
+ DPA_RECYCLE_MAX_SIZE) &&
(*percpu_priv->dpa_bp_count < dpa_bp->target_count))) {
/* Compute the minimum necessary fd offset */
offset = dpa_bp->size - skb->len - skb_tailroom(skb);