summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorIoana Radulescu <ruxandra.radulescu@freescale.com>2013-06-06 16:15:08 (GMT)
committerFleming Andrew-AFLEMING <AFLEMING@freescale.com>2013-06-07 21:36:35 (GMT)
commit252b622b8058a309d2429a33c2e0de089be896ac (patch)
treed9dbbebbce3e2cb9ffd1e0d8651307c8b0ab1cb7 /drivers/net
parenta3b310dbe6d25132698a88618e7ef52bc6749177 (diff)
downloadlinux-fsl-qoriq-252b622b8058a309d2429a33c2e0de089be896ac.tar.xz
dpaa_eth: Set a fixed upper limit for recycleable buffer size
Until now we considered a buffer recycleable if its size didn't exceed the buffer pool size by more than a certain amount. Recent changes in the stack however allow the allocation of skb buffers much larger than the requested size, which impacts our ability to recycle forwarded frames, especially when jumbo frame support is enabled. Make the recycling size upper limit a fixed and sufficiently large value, regardless of the default size of the buffer pool, in order to simplify recycling logic and guard against unfavourable cases. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@freescale.com> Change-Id: I311903357335492e821f51fac8a448d67fd73433 Reviewed-on: http://git.am.freescale.net:8181/2899 Reviewed-by: Bucur Madalin-Cristian-B32716 <madalin.bucur@freescale.com> Reviewed-by: Sovaiala Cristian-Constantin-B39531 <Cristian.Sovaiala@freescale.com> Reviewed-by: Hamciuc Bogdan-BHAMCIU1 <bogdan.hamciuc@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/freescale/dpa/dpaa_eth.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c
index 2106553..9294c80 100644
--- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c
@@ -130,13 +130,17 @@
#define DPA_MAX_FD_OFFSET ((1 << 9) - 1)
/*
- * 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
/* For MAC-based interfaces, we compute the tx needed headroom from the
* associated Tx port's buffer layout settings.
@@ -1944,8 +1948,7 @@ static int skb_to_contig_fd(struct dpa_priv_s *priv,
* - there's enough room in the buffer pool
*/
if (likely(skb_is_recycleable(skb, dpa_bp->size) &&
- (skb_end_pointer(skb) - skb->head <=
- dpa_bp->size + DPA_RECYCLE_EXTRA_SIZE) &&
+ (skb_end_pointer(skb) - skb->head <= 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);