* [PATCH net-next] net: dsa: don't call ptp_classify_raw() if switch doesn't provide RX timestamping
@ 2022-12-09 17:58 Vladimir Oltean
2022-12-10 0:08 ` Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Oltean @ 2022-12-09 17:58 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Florian Fainelli, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Richard Cochran
ptp_classify_raw() is not exactly cheap, since it invokes a BPF program
for every skb in the receive path. For switches which do not provide
ds->ops->port_rxtstamp(), running ptp_classify_raw() provides precisely
nothing, so check for the presence of the function pointer first, since
that is much cheaper.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
net/dsa/tag.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/dsa/tag.c b/net/dsa/tag.c
index 383721e167d6..b2fba1a003ce 100644
--- a/net/dsa/tag.c
+++ b/net/dsa/tag.c
@@ -33,6 +33,9 @@ static bool dsa_skb_defer_rx_timestamp(struct dsa_slave_priv *p,
struct dsa_switch *ds = p->dp->ds;
unsigned int type;
+ if (!ds->ops->port_rxtstamp)
+ return false;
+
if (skb_headroom(skb) < ETH_HLEN)
return false;
@@ -45,10 +48,7 @@ static bool dsa_skb_defer_rx_timestamp(struct dsa_slave_priv *p,
if (type == PTP_CLASS_NONE)
return false;
- if (likely(ds->ops->port_rxtstamp))
- return ds->ops->port_rxtstamp(ds, p->dp->index, skb, type);
-
- return false;
+ return ds->ops->port_rxtstamp(ds, p->dp->index, skb, type);
}
static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: dsa: don't call ptp_classify_raw() if switch doesn't provide RX timestamping
2022-12-09 17:58 [PATCH net-next] net: dsa: don't call ptp_classify_raw() if switch doesn't provide RX timestamping Vladimir Oltean
@ 2022-12-10 0:08 ` Florian Fainelli
2022-12-10 10:37 ` Kurt Kanzenbach
2022-12-12 23:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2022-12-10 0:08 UTC (permalink / raw)
To: Vladimir Oltean, netdev
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Richard Cochran
On 12/9/22 09:58, Vladimir Oltean wrote:
> ptp_classify_raw() is not exactly cheap, since it invokes a BPF program
> for every skb in the receive path. For switches which do not provide
> ds->ops->port_rxtstamp(), running ptp_classify_raw() provides precisely
> nothing, so check for the presence of the function pointer first, since
> that is much cheaper.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: dsa: don't call ptp_classify_raw() if switch doesn't provide RX timestamping
2022-12-09 17:58 [PATCH net-next] net: dsa: don't call ptp_classify_raw() if switch doesn't provide RX timestamping Vladimir Oltean
2022-12-10 0:08 ` Florian Fainelli
@ 2022-12-10 10:37 ` Kurt Kanzenbach
2022-12-12 23:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Kurt Kanzenbach @ 2022-12-10 10:37 UTC (permalink / raw)
To: Vladimir Oltean, netdev
Cc: Andrew Lunn, Florian Fainelli, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Richard Cochran
[-- Attachment #1: Type: text/plain, Size: 514 bytes --]
On Fri Dec 09 2022, Vladimir Oltean wrote:
> ptp_classify_raw() is not exactly cheap, since it invokes a BPF program
> for every skb in the receive path.
Only if CONFIG_NET_PTP_CLASSIFY is set.
> For switches which do not provide ds->ops->port_rxtstamp(), running
> ptp_classify_raw() provides precisely nothing, so check for the
> presence of the function pointer first, since that is much cheaper.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: dsa: don't call ptp_classify_raw() if switch doesn't provide RX timestamping
2022-12-09 17:58 [PATCH net-next] net: dsa: don't call ptp_classify_raw() if switch doesn't provide RX timestamping Vladimir Oltean
2022-12-10 0:08 ` Florian Fainelli
2022-12-10 10:37 ` Kurt Kanzenbach
@ 2022-12-12 23:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-12 23:10 UTC (permalink / raw)
To: Vladimir Oltean
Cc: netdev, andrew, f.fainelli, davem, edumazet, kuba, pabeni,
richardcochran
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 9 Dec 2022 19:58:40 +0200 you wrote:
> ptp_classify_raw() is not exactly cheap, since it invokes a BPF program
> for every skb in the receive path. For switches which do not provide
> ds->ops->port_rxtstamp(), running ptp_classify_raw() provides precisely
> nothing, so check for the presence of the function pointer first, since
> that is much cheaper.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
>
> [...]
Here is the summary with links:
- [net-next] net: dsa: don't call ptp_classify_raw() if switch doesn't provide RX timestamping
https://git.kernel.org/netdev/net-next/c/8f18655c49eb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-12 23:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09 17:58 [PATCH net-next] net: dsa: don't call ptp_classify_raw() if switch doesn't provide RX timestamping Vladimir Oltean
2022-12-10 0:08 ` Florian Fainelli
2022-12-10 10:37 ` Kurt Kanzenbach
2022-12-12 23:10 ` patchwork-bot+netdevbpf
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).