lkml.org 
[lkml]   [2019]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH net 2/8] net: stmmac: Determine earlier the size of RX buffer
    Date
    Split Header feature needs to know the size of RX buffer but current
    code is determining it too late. Fix this by moving the RX buffer
    computation to earlier stage

    Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

    ---
    Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
    Cc: Alexandre Torgue <alexandre.torgue@st.com>
    Cc: Jose Abreu <joabreu@synopsys.com>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
    Cc: netdev@vger.kernel.org
    Cc: linux-stm32@st-md-mailman.stormreply.com
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    ---
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 24 +++++++++++------------
    1 file changed, 11 insertions(+), 13 deletions(-)

    diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    index bbc65bd332a8..dfecced43f29 100644
    --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    @@ -1293,19 +1293,9 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
    struct stmmac_priv *priv = netdev_priv(dev);
    u32 rx_count = priv->plat->rx_queues_to_use;
    int ret = -ENOMEM;
    - int bfsize = 0;
    int queue;
    int i;

    - bfsize = stmmac_set_16kib_bfsize(priv, dev->mtu);
    - if (bfsize < 0)
    - bfsize = 0;
    -
    - if (bfsize < BUF_SIZE_16KiB)
    - bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz);
    -
    - priv->dma_buf_sz = bfsize;
    -
    /* RX INITIALIZATION */
    netif_dbg(priv, probe, priv->dev,
    "SKB addresses:\nskb\t\tskb data\tdma data\n");
    @@ -1347,8 +1337,6 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
    }
    }

    - buf_sz = bfsize;
    -
    return 0;

    err_init_rx_buffers:
    @@ -2658,6 +2646,7 @@ static void stmmac_hw_teardown(struct net_device *dev)
    static int stmmac_open(struct net_device *dev)
    {
    struct stmmac_priv *priv = netdev_priv(dev);
    + int bfsize = 0;
    u32 chan;
    int ret;

    @@ -2677,7 +2666,16 @@ static int stmmac_open(struct net_device *dev)
    memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats));
    priv->xstats.threshold = tc;

    - priv->dma_buf_sz = STMMAC_ALIGN(buf_sz);
    + bfsize = stmmac_set_16kib_bfsize(priv, dev->mtu);
    + if (bfsize < 0)
    + bfsize = 0;
    +
    + if (bfsize < BUF_SIZE_16KiB)
    + bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz);
    +
    + priv->dma_buf_sz = STMMAC_ALIGN(bfsize);
    + buf_sz = bfsize;
    +
    priv->rx_copybreak = STMMAC_RX_COPYBREAK;

    ret = alloc_dma_desc_resources(priv);
    --
    2.7.4
    \
     
     \ /
      Last update: 2019-12-10 20:35    [W:5.227 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site