summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
diff options
context:
space:
mode:
authorGiuseppe Cavallaro <peppe.cavallaro@st.com>2016-02-29 14:27:35 +0100
committerDavid S. Miller <davem@davemloft.net>2016-03-02 14:21:32 -0500
commitbe434d5075d6be0cda996200b2a20035e1565215 (patch)
treec00deb31fdcdc2547ab67c84dbb9cfab718bdac9 /drivers/net/ethernet/stmicro/stmmac/norm_desc.c
parentc1fa3212be5503d802a5c4c451dd4e673fdc603a (diff)
stmmac: optimize tx desc management
This patch is to optimize the way to manage the TDES inside the xmit function. When prepare the frame, some settings (e.g. OWN bit) can be merged. This has been reworked to improve the tx performances. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/norm_desc.c')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/norm_desc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index 5a91932ff639..19cc12dd0f17 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -185,7 +185,8 @@ static void ndesc_release_tx_desc(struct dma_desc *p, int mode)
}
static void ndesc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
- int csum_flag, int mode)
+ bool csum_flag, int mode, bool tx_own,
+ bool ls_ic)
{
unsigned int tdes1 = p->des1;
@@ -199,6 +200,12 @@ static void ndesc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
else
tdes1 &= ~(TX_CIC_FULL << TDES1_CHECKSUM_INSERTION_SHIFT);
+ if (tx_own)
+ tdes1 |= TDES0_OWN;
+
+ if (ls_ic)
+ tdes1 |= TDES1_LAST_SEGMENT | TDES1_INTERRUPT;
+
p->des1 = tdes1;
if (mode == STMMAC_CHAIN_MODE)
@@ -212,11 +219,6 @@ static void ndesc_clear_tx_ic(struct dma_desc *p)
p->des1 &= ~TDES1_INTERRUPT;
}
-static void ndesc_close_tx_desc(struct dma_desc *p)
-{
- p->des1 |= TDES1_LAST_SEGMENT | TDES1_INTERRUPT;
-}
-
static int ndesc_get_rx_frame_len(struct dma_desc *p, int rx_coe_type)
{
unsigned int csum = 0;
@@ -278,7 +280,6 @@ const struct stmmac_desc_ops ndesc_ops = {
.release_tx_desc = ndesc_release_tx_desc,
.prepare_tx_desc = ndesc_prepare_tx_desc,
.clear_tx_ic = ndesc_clear_tx_ic,
- .close_tx_desc = ndesc_close_tx_desc,
.get_tx_ls = ndesc_get_tx_ls,
.set_tx_owner = ndesc_set_tx_owner,
.set_rx_owner = ndesc_set_rx_owner,