Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1274819
| From | Shunqian Zheng <zhengsq@rock-chips.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v1] net: stmmac: Free rx_skbufs before realloc |
| Date | 2015-11-22 09:50 +0100 |
| Message-ID | <qxyvn-1fD-1@gated-at.bofh.it> (permalink) |
| References | <qxyvn-1fD-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: ZhengShunQian <zhengsq@rock-chips.com>
The init_dma_desc_rings() may realloc the rx_skbuff[] when
suspend and resume. This patch free the rx_skbuff[] before
reallocing memory.
Signed-off-by: ZhengShunQian <zhengsq@rock-chips.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 64d8aa4..2af1ed9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1022,6 +1022,14 @@ static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i)
priv->rx_skbuff[i] = NULL;
}
+static void dma_free_rx_skbufs(struct stmmac_priv *priv)
+{
+ int i;
+
+ for (i = 0; i < priv->dma_rx_size; i++)
+ stmmac_free_rx_buffers(priv, i);
+}
+
/**
* init_dma_desc_rings - init the RX/TX descriptor rings
* @dev: net device structure
@@ -1058,6 +1066,8 @@ static int init_dma_desc_rings(struct net_device *dev, gfp_t flags)
/* RX INITIALIZATION */
pr_debug("\tSKB addresses:\nskb\t\tskb data\tdma data\n");
}
+
+ dma_free_rx_skbufs(priv);
for (i = 0; i < rxsize; i++) {
struct dma_desc *p;
if (priv->extend_desc)
@@ -1122,14 +1132,6 @@ err_init_rx_buffers:
return ret;
}
-static void dma_free_rx_skbufs(struct stmmac_priv *priv)
-{
- int i;
-
- for (i = 0; i < priv->dma_rx_size; i++)
- stmmac_free_rx_buffers(priv, i);
-}
-
static void dma_free_tx_skbufs(struct stmmac_priv *priv)
{
int i;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v1] net: stmmac: Free rx_skbufs before realloc Shunqian Zheng <zhengsq@rock-chips.com> - 2015-11-22 09:50 +0100
Re: [PATCH v1] net: stmmac: Free rx_skbufs before realloc David Miller <davem@davemloft.net> - 2015-11-24 19:10 +0100
Re: [PATCH v1] net: stmmac: Free rx_skbufs before realloc Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2015-11-25 16:20 +0100
Re: [PATCH v1] net: stmmac: Free rx_skbufs before realloc Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2015-11-26 11:30 +0100
csiph-web