diff options
Diffstat (limited to 'drivers/net/phy/dp83640.c')
-rw-r--r-- | drivers/net/phy/dp83640.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index b0c9522bb535..2cd8dc5847b4 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -543,11 +543,20 @@ static void recalibrate(struct dp83640_clock *clock) | |||
543 | 543 | ||
544 | /* time stamping methods */ | 544 | /* time stamping methods */ |
545 | 545 | ||
546 | static void decode_evnt(struct dp83640_private *dp83640, | 546 | static int decode_evnt(struct dp83640_private *dp83640, |
547 | struct phy_txts *phy_txts, u16 ests) | 547 | void *data, u16 ests) |
548 | { | 548 | { |
549 | struct phy_txts *phy_txts; | ||
549 | struct ptp_clock_event event; | 550 | struct ptp_clock_event event; |
550 | int words = (ests >> EVNT_TS_LEN_SHIFT) & EVNT_TS_LEN_MASK; | 551 | int words = (ests >> EVNT_TS_LEN_SHIFT) & EVNT_TS_LEN_MASK; |
552 | u16 ext_status = 0; | ||
553 | |||
554 | if (ests & MULT_EVNT) { | ||
555 | ext_status = *(u16 *) data; | ||
556 | data += sizeof(ext_status); | ||
557 | } | ||
558 | |||
559 | phy_txts = data; | ||
551 | 560 | ||
552 | switch (words) { /* fall through in every case */ | 561 | switch (words) { /* fall through in every case */ |
553 | case 3: | 562 | case 3: |
@@ -565,6 +574,9 @@ static void decode_evnt(struct dp83640_private *dp83640, | |||
565 | event.timestamp = phy2txts(&dp83640->edata); | 574 | event.timestamp = phy2txts(&dp83640->edata); |
566 | 575 | ||
567 | ptp_clock_event(dp83640->clock->ptp_clock, &event); | 576 | ptp_clock_event(dp83640->clock->ptp_clock, &event); |
577 | |||
578 | words = ext_status ? words + 2 : words + 1; | ||
579 | return words * sizeof(u16); | ||
568 | } | 580 | } |
569 | 581 | ||
570 | static void decode_rxts(struct dp83640_private *dp83640, | 582 | static void decode_rxts(struct dp83640_private *dp83640, |
@@ -643,9 +655,7 @@ static void decode_status_frame(struct dp83640_private *dp83640, | |||
643 | 655 | ||
644 | } else if (PSF_EVNT == type && len >= sizeof(*phy_txts)) { | 656 | } else if (PSF_EVNT == type && len >= sizeof(*phy_txts)) { |
645 | 657 | ||
646 | phy_txts = (struct phy_txts *) ptr; | 658 | size = decode_evnt(dp83640, ptr, ests); |
647 | decode_evnt(dp83640, phy_txts, ests); | ||
648 | size = sizeof(*phy_txts); | ||
649 | 659 | ||
650 | } else { | 660 | } else { |
651 | size = 0; | 661 | size = 0; |
@@ -1034,8 +1044,8 @@ static bool dp83640_rxtstamp(struct phy_device *phydev, | |||
1034 | 1044 | ||
1035 | if (is_status_frame(skb, type)) { | 1045 | if (is_status_frame(skb, type)) { |
1036 | decode_status_frame(dp83640, skb); | 1046 | decode_status_frame(dp83640, skb); |
1037 | /* Let the stack drop this frame. */ | 1047 | kfree_skb(skb); |
1038 | return false; | 1048 | return true; |
1039 | } | 1049 | } |
1040 | 1050 | ||
1041 | SKB_PTP_TYPE(skb) = type; | 1051 | SKB_PTP_TYPE(skb) = type; |