linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* question about drivers/net/ethernet/renesas/ravb_main.c
@ 2020-04-03 14:04 Julia Lawall
  2020-04-06 21:14 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2020-04-03 14:04 UTC (permalink / raw)
  To: sergei.shtylyov, horms+renesas, tho.vu.wh, uli+renesas
  Cc: netdev, linux-renesas-soc, linux-kernel, joe

Hello,

In the function ravb_hwtstamp_get in ravb_main.c, the following code looks
suspicious:

        if (priv->tstamp_rx_ctrl & RAVB_RXTSTAMP_TYPE_V2_L2_EVENT)
                config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
        else if (priv->tstamp_rx_ctrl & RAVB_RXTSTAMP_TYPE_ALL)
                config.rx_filter = HWTSTAMP_FILTER_ALL;
        else
                config.rx_filter = HWTSTAMP_FILTER_NONE;

According to drivers/net/ethernet/renesas/ravb.h,
RAVB_RXTSTAMP_TYPE_V2_L2_EVENT is 0x00000002 and RAVB_RXTSTAMP_TYPE_ALL is
0x00000006.  Therefore, if the test on RAVB_RXTSTAMP_TYPE_ALL should be
true, it will never be reached.  How should the code be changed?

thanks,
julia

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question about drivers/net/ethernet/renesas/ravb_main.c
  2020-04-03 14:04 question about drivers/net/ethernet/renesas/ravb_main.c Julia Lawall
@ 2020-04-06 21:14 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2020-04-06 21:14 UTC (permalink / raw)
  To: Julia Lawall, horms+renesas, tho.vu.wh, uli+renesas
  Cc: netdev, linux-renesas-soc, linux-kernel, joe

Hello!

On 04/03/2020 05:04 PM, Julia Lawall wrote:

> In the function ravb_hwtstamp_get in ravb_main.c, the following code looks
> suspicious:
> 
>         if (priv->tstamp_rx_ctrl & RAVB_RXTSTAMP_TYPE_V2_L2_EVENT)
>                 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
>         else if (priv->tstamp_rx_ctrl & RAVB_RXTSTAMP_TYPE_ALL)
>                 config.rx_filter = HWTSTAMP_FILTER_ALL;
>         else
>                 config.rx_filter = HWTSTAMP_FILTER_NONE;
> 
> According to drivers/net/ethernet/renesas/ravb.h,
> RAVB_RXTSTAMP_TYPE_V2_L2_EVENT is 0x00000002 and RAVB_RXTSTAMP_TYPE_ALL is
> 0x00000006.  Therefore, if the test on RAVB_RXTSTAMP_TYPE_ALL should be
> true, it will never be reached.  How should the code be changed?

   After looking at the code, I think that setting RAVB_RXTSTAMP_TYPE_ALL to
0x00000004 should be enough. BTW, the RAVB_{R,T}XTSTAMP_VALID don't seem be
used anywhere...

> thanks,
> julia

MBR, Sergei

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-06 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 14:04 question about drivers/net/ethernet/renesas/ravb_main.c Julia Lawall
2020-04-06 21:14 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).