diff mbox series

net: phy: broadcom: error in rxtstamp callback?

Message ID 20230215110755.33bb9436@kmaincent-XPS-13-7390 (mailing list archive)
State RFC
Headers show
Series net: phy: broadcom: error in rxtstamp callback? | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 8 maintainers not CCed: pabeni@redhat.com hkallweit1@gmail.com linux@armlinux.org.uk kuba@kernel.org andrew@lunn.ch edumazet@google.com bcm-kernel-feedback-list@broadcom.com davem@davemloft.net
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff fail author Signed-off-by missing
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Kory Maincent Feb. 15, 2023, 10:07 a.m. UTC
Hello,

I am new to PTP API. I am currently adding the support of PTP to a PHY driver.
I looked at the other PTP supports to do it and I figured out there might be an
issue with the broadcom driver. As I am only beginner in PTP I may have wrong
and if it is the case could you explain me why.
I also don't have such broadcom PHY to test it, but I want to report it if the
issue is real.
The issue is on the rxtstamp callback, it never return true nor deliver the
skb.

Here is the patch that may fix it:

Comments

Jonathan Lemon Feb. 15, 2023, 7:39 p.m. UTC | #1
The code is correct - see Documentation/networking/timestamping.rst

The function returns true/false to indicate whether a deferral is needed
in order to receive the timestamp.  For this chip, a deferral is never
required - the timestamp is inline if it is present.
—
Jonathan


On 15 Feb 2023, at 2:07, Köry Maincent wrote:

> Hello,
>
> I am new to PTP API. I am currently adding the support of PTP to a PHY driver.
> I looked at the other PTP supports to do it and I figured out there might be an
> issue with the broadcom driver. As I am only beginner in PTP I may have wrong
> and if it is the case could you explain me why.
> I also don't have such broadcom PHY to test it, but I want to report it if the
> issue is real.
> The issue is on the rxtstamp callback, it never return true nor deliver the
> skb.
>
> Here is the patch that may fix it:
>
> diff --git a/drivers/net/phy/bcm-phy-ptp.c b/drivers/net/phy/bcm-phy-ptp.c
> index ef00d6163061..57bb63bd98c7 100644
> --- a/drivers/net/phy/bcm-phy-ptp.c
> +++ b/drivers/net/phy/bcm-phy-ptp.c
> @@ -412,7 +412,9 @@ static bool bcm_ptp_rxtstamp(struct mii_timestamper *mii_ts,
>  		__pskb_trim(skb, skb->len - 8);
>  	}
>
> -	return false;
> +	netif_rx(skb);
> +
> +	return true;
>  }
>
>  static bool bcm_ptp_get_tstamp(struct bcm_ptp_private *priv,
> -- 
> 2.25.1
>
>
> Regards,
Kory Maincent Feb. 16, 2023, 8:47 a.m. UTC | #2
Hello Jonathan,

On Wed, 15 Feb 2023 11:39:02 -0800
Jonathan Lemon <jlemon@flugsvamp.com> wrote:

> The code is correct - see Documentation/networking/timestamping.rst
> 
> The function returns true/false to indicate whether a deferral is needed
> in order to receive the timestamp.  For this chip, a deferral is never
> required - the timestamp is inline if it is present.

Alright, thanks for your reply.

Regards,
diff mbox series

Patch

diff --git a/drivers/net/phy/bcm-phy-ptp.c b/drivers/net/phy/bcm-phy-ptp.c
index ef00d6163061..57bb63bd98c7 100644
--- a/drivers/net/phy/bcm-phy-ptp.c
+++ b/drivers/net/phy/bcm-phy-ptp.c
@@ -412,7 +412,9 @@  static bool bcm_ptp_rxtstamp(struct mii_timestamper *mii_ts,
 		__pskb_trim(skb, skb->len - 8);
 	}
 
-	return false;
+	netif_rx(skb);
+
+	return true;
 }
 
 static bool bcm_ptp_get_tstamp(struct bcm_ptp_private *priv,