diff options
author | Ioana Radulescu <ruxandra.radulescu@freescale.com> | 2013-06-06 16:15:08 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-07-22 21:29:25 (GMT) |
commit | b5d1c9489b05431b8ce043895e27f9a7f013afaf (patch) | |
tree | 42f388abc7d50cf485ad62bef7622f3aa6f7744e | |
parent | 98a80ca70105a4f9df06a80318d0297119fc07bf (diff) | |
download | linux-fsl-qoriq-b5d1c9489b05431b8ce043895e27f9a7f013afaf.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: I2fd9b6a057a4e54445233730805d5dc9c8188e5a
Reviewed-on: http://git.am.freescale.net:8181/3330
Reviewed-by: Hamciuc Bogdan-BHAMCIU1 <bogdan.hamciuc@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c | 18 |
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); |