summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2013-03-26 04:43:06 +0000
committerDavid S. Miller <davem@davemloft.net>2013-03-26 12:53:36 -0400
commitc24602ef86649376e9d71ea808cd877e414d340b (patch)
tree3bf58e08f64c7a01b191eab5927886ccce77045c /drivers/net/ethernet/stmicro/stmmac/norm_desc.c
parent4a7d666a7202744af32d4da31fb52857b7d86850 (diff)
stmmac: support extend descriptors
This patch is to support the extend descriptors available in the chips newer than the 3.50. In case of the extend descriptors cannot be supported, at runtime, the driver will continue to work using the old style. In detail, this support extends the main descriptor structure adding new descriptors: 4, 5, 6, 7. The desc4 gives us extra information about the received ethernet payload when it is carrying PTP packets or TCP/UDP/ICMP over IP packets. The descriptors 6 and 7 are used for saving HW L/H timestamps (PTP). V2: this new version removes the Koption added in the first implementation because all the checks now to verify if the extended descriptors are actually supported happen at probe time. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@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.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index 88df0b48e35b..47d509435ebb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -122,37 +122,28 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
return ret;
}
-static void ndesc_init_rx_desc(struct dma_desc *p, unsigned int ring_size,
- int disable_rx_ic, int mode)
+static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode,
+ int end)
{
- int i;
- for (i = 0; i < ring_size; i++) {
- p->des01.rx.own = 1;
- p->des01.rx.buffer1_size = BUF_SIZE_2KiB - 1;
-
- if (mode == STMMAC_CHAIN_MODE)
- ndesc_rx_set_on_chain(p, (i == ring_size - 1));
- else
- ndesc_rx_set_on_ring(p, (i == ring_size - 1));
-
- if (disable_rx_ic)
- p->des01.rx.disable_ic = 1;
- p++;
- }
+ p->des01.rx.own = 1;
+ p->des01.rx.buffer1_size = BUF_SIZE_2KiB - 1;
+
+ if (mode == STMMAC_CHAIN_MODE)
+ ndesc_rx_set_on_chain(p, end);
+ else
+ ndesc_rx_set_on_ring(p, end);
+
+ if (disable_rx_ic)
+ p->des01.rx.disable_ic = 1;
}
-static void ndesc_init_tx_desc(struct dma_desc *p, unsigned int ring_size,
- int mode)
+static void ndesc_init_tx_desc(struct dma_desc *p, int mode, int end)
{
- int i;
- for (i = 0; i < ring_size; i++) {
- p->des01.tx.own = 0;
- if (mode == STMMAC_CHAIN_MODE)
- ndesc_tx_set_on_chain(p, (i == (ring_size - 1)));
- else
- ndesc_tx_set_on_ring(p, (i == (ring_size - 1)));
- p++;
- }
+ p->des01.tx.own = 0;
+ if (mode == STMMAC_CHAIN_MODE)
+ ndesc_tx_set_on_chain(p, end);
+ else
+ ndesc_tx_set_on_ring(p, end);
}
static int ndesc_get_tx_owner(struct dma_desc *p)