diff options
author | Giuseppe CAVALLARO <peppe.cavallaro@st.com> | 2013-03-26 04:43:06 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-26 12:53:36 -0400 |
commit | c24602ef86649376e9d71ea808cd877e414d340b (patch) | |
tree | 3bf58e08f64c7a01b191eab5927886ccce77045c /drivers/net/ethernet/stmicro/stmmac/chain_mode.c | |
parent | 4a7d666a7202744af32d4da31fb52857b7d86850 (diff) | |
download | linux-c24602ef86649376e9d71ea808cd877e414d340b.tar.gz linux-c24602ef86649376e9d71ea808cd877e414d340b.tar.bz2 linux-c24602ef86649376e9d71ea808cd877e414d340b.zip |
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/chain_mode.c')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/chain_mode.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c index 08ff51e9c791..688c3f4f1781 100644 --- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c @@ -89,27 +89,38 @@ static unsigned int stmmac_is_jumbo_frm(int len, int enh_desc) return ret; } -static void stmmac_init_dma_chain(struct dma_desc *des, dma_addr_t phy_addr, - unsigned int size) +static void stmmac_init_dma_chain(void *des, dma_addr_t phy_addr, + unsigned int size, unsigned int extend_desc) { /* * In chained mode the des3 points to the next element in the ring. * The latest element has to point to the head. */ int i; - struct dma_desc *p = des; dma_addr_t dma_phy = phy_addr; - for (i = 0; i < (size - 1); i++) { - dma_phy += sizeof(struct dma_desc); - p->des3 = (unsigned int)dma_phy; - p++; + if (extend_desc) { + struct dma_extended_desc *p = (struct dma_extended_desc *) des; + for (i = 0; i < (size - 1); i++) { + dma_phy += sizeof(struct dma_extended_desc); + p->basic.des3 = (unsigned int)dma_phy; + p++; + } + p->basic.des3 = (unsigned int)phy_addr; + + } else { + struct dma_desc *p = (struct dma_desc *) des; + for (i = 0; i < (size - 1); i++) { + dma_phy += sizeof(struct dma_desc); + p->des3 = (unsigned int)dma_phy; + p++; + } + p->des3 = (unsigned int)phy_addr; } - p->des3 = (unsigned int)phy_addr; } const struct stmmac_chain_mode_ops chain_mode_ops = { + .init = stmmac_init_dma_chain, .is_jumbo_frm = stmmac_is_jumbo_frm, .jumbo_frm = stmmac_jumbo_frm, - .init_dma_chain = stmmac_init_dma_chain, }; |