mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-03 12:24:45 +08:00
net: stmmac: handle endianness in dwmac4_get_timestamp
GMAC IP is little-endian and used on several kind of CPU (big or little
endian). Main callbacks functions of the stmmac drivers take care about
it. It was not the case for dwmac4_get_timestamp function.
Fixes: ba1ffd74df
("stmmac: fix PTP support for GMAC4")
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
31a1b8d528
commit
4012e7d09d
@ -241,15 +241,18 @@ static inline void dwmac4_get_timestamp(void *desc, u32 ats, u64 *ts)
|
|||||||
static int dwmac4_rx_check_timestamp(void *desc)
|
static int dwmac4_rx_check_timestamp(void *desc)
|
||||||
{
|
{
|
||||||
struct dma_desc *p = (struct dma_desc *)desc;
|
struct dma_desc *p = (struct dma_desc *)desc;
|
||||||
|
unsigned int rdes0 = le32_to_cpu(p->des0);
|
||||||
|
unsigned int rdes1 = le32_to_cpu(p->des1);
|
||||||
|
unsigned int rdes3 = le32_to_cpu(p->des3);
|
||||||
u32 own, ctxt;
|
u32 own, ctxt;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
own = p->des3 & RDES3_OWN;
|
own = rdes3 & RDES3_OWN;
|
||||||
ctxt = ((p->des3 & RDES3_CONTEXT_DESCRIPTOR)
|
ctxt = ((rdes3 & RDES3_CONTEXT_DESCRIPTOR)
|
||||||
>> RDES3_CONTEXT_DESCRIPTOR_SHIFT);
|
>> RDES3_CONTEXT_DESCRIPTOR_SHIFT);
|
||||||
|
|
||||||
if (likely(!own && ctxt)) {
|
if (likely(!own && ctxt)) {
|
||||||
if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff))
|
if ((rdes0 == 0xffffffff) && (rdes1 == 0xffffffff))
|
||||||
/* Corrupted value */
|
/* Corrupted value */
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user