netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups
@ 2021-10-20 17:42 Vladimir Oltean
  2021-10-20 17:42 ` [PATCH net-next 1/2] net: enetc: remove local "priv" variable in enetc_clean_tx_ring() Vladimir Oltean
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Vladimir Oltean @ 2021-10-20 17:42 UTC (permalink / raw)
  To: netdev, Jakub Kicinski, David S. Miller; +Cc: Claudiu Manoil, Yangbo Lu

These are two cleanup patches for some inconsistencies I noticed in the
driver's TX ring cleanup function.

Vladimir Oltean (2):
  net: enetc: remove local "priv" variable in enetc_clean_tx_ring()
  net: enetc: use the skb variable directly in enetc_clean_tx_ring()

 drivers/net/ethernet/freescale/enetc/enetc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

-- 
2.25.1


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

* [PATCH net-next 1/2] net: enetc: remove local "priv" variable in enetc_clean_tx_ring()
  2021-10-20 17:42 [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups Vladimir Oltean
@ 2021-10-20 17:42 ` Vladimir Oltean
  2021-10-20 17:42 ` [PATCH net-next 2/2] net: enetc: use the skb variable directly " Vladimir Oltean
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2021-10-20 17:42 UTC (permalink / raw)
  To: netdev, Jakub Kicinski, David S. Miller; +Cc: Claudiu Manoil, Yangbo Lu

The "priv" variable is needed in the "check_writeback" scope since
commit d39823121911 ("enetc: add hardware timestamping support").

Since commit 7294380c5211 ("enetc: support PTP Sync packet one-step
timestamping"), we also need "priv" in the larger function scope.

So the local variable from the "if" block scope is not needed, and
actually shadows the other one. Delete it.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index 8e31fe15bf3c..082b94e482ce 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -813,10 +813,7 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget)
 		bool is_eof = tx_swbd->is_eof;
 
 		if (unlikely(tx_swbd->check_wb)) {
-			struct enetc_ndev_priv *priv = netdev_priv(ndev);
-			union enetc_tx_bd *txbd;
-
-			txbd = ENETC_TXBD(*tx_ring, i);
+			union enetc_tx_bd *txbd = ENETC_TXBD(*tx_ring, i);
 
 			if (txbd->flags & ENETC_TXBD_FLAGS_W &&
 			    tx_swbd->do_twostep_tstamp) {
-- 
2.25.1


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

* [PATCH net-next 2/2] net: enetc: use the skb variable directly in enetc_clean_tx_ring()
  2021-10-20 17:42 [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups Vladimir Oltean
  2021-10-20 17:42 ` [PATCH net-next 1/2] net: enetc: remove local "priv" variable in enetc_clean_tx_ring() Vladimir Oltean
@ 2021-10-20 17:42 ` Vladimir Oltean
  2021-10-21  9:37 ` [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups Claudiu Manoil
  2021-10-21 22:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2021-10-20 17:42 UTC (permalink / raw)
  To: netdev, Jakub Kicinski, David S. Miller; +Cc: Claudiu Manoil, Yangbo Lu

The code checks whether the skb had one-step TX timestamping enabled, in
order to schedule the work item for emptying the priv->tx_skbs queue.

That code checks for "tx_swbd->skb" directly, when we already had a skb
retrieved using enetc_tx_swbd_get_skb(tx_swbd) - a TX software BD can
also hold an XDP_TX packet or an XDP frame. But since the direct tx_swbd
dereference is in an "if" block guarded by the non-NULL quality of
"skb", accessing "tx_swbd->skb" directly is not wrong, just confusing.

Just use the local variable named "skb".

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index 082b94e482ce..504e12554079 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -831,8 +831,7 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget)
 		if (xdp_frame) {
 			xdp_return_frame(xdp_frame);
 		} else if (skb) {
-			if (unlikely(tx_swbd->skb->cb[0] &
-				     ENETC_F_TX_ONESTEP_SYNC_TSTAMP)) {
+			if (unlikely(skb->cb[0] & ENETC_F_TX_ONESTEP_SYNC_TSTAMP)) {
 				/* Start work to release lock for next one-step
 				 * timestamping packet. And send one skb in
 				 * tx_skbs queue if has.
-- 
2.25.1


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

* RE: [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups
  2021-10-20 17:42 [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups Vladimir Oltean
  2021-10-20 17:42 ` [PATCH net-next 1/2] net: enetc: remove local "priv" variable in enetc_clean_tx_ring() Vladimir Oltean
  2021-10-20 17:42 ` [PATCH net-next 2/2] net: enetc: use the skb variable directly " Vladimir Oltean
@ 2021-10-21  9:37 ` Claudiu Manoil
  2021-10-21 22:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Claudiu Manoil @ 2021-10-21  9:37 UTC (permalink / raw)
  To: Vladimir Oltean, netdev, Jakub Kicinski, David S. Miller; +Cc: Y.b. Lu

> -----Original Message-----
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> Sent: Wednesday, October 20, 2021 8:42 PM
[...]
> Subject: [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping
> cleanups
> 
> These are two cleanup patches for some inconsistencies I noticed in the
> driver's TX ring cleanup function.
> 
> Vladimir Oltean (2):
>   net: enetc: remove local "priv" variable in enetc_clean_tx_ring()
>   net: enetc: use the skb variable directly in enetc_clean_tx_ring()
> 
>  drivers/net/ethernet/freescale/enetc/enetc.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> --

Reviewed-by: <Claudiu Manoil <claudiu.manoil@nxp.com>

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

* Re: [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups
  2021-10-20 17:42 [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups Vladimir Oltean
                   ` (2 preceding siblings ...)
  2021-10-21  9:37 ` [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups Claudiu Manoil
@ 2021-10-21 22:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-21 22:40 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: netdev, kuba, davem, claudiu.manoil, yangbo.lu

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 20 Oct 2021 20:42:18 +0300 you wrote:
> These are two cleanup patches for some inconsistencies I noticed in the
> driver's TX ring cleanup function.
> 
> Vladimir Oltean (2):
>   net: enetc: remove local "priv" variable in enetc_clean_tx_ring()
>   net: enetc: use the skb variable directly in enetc_clean_tx_ring()
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] net: enetc: remove local "priv" variable in enetc_clean_tx_ring()
    https://git.kernel.org/netdev/net-next/c/ae77bdbc2fc6
  - [net-next,2/2] net: enetc: use the skb variable directly in enetc_clean_tx_ring()
    https://git.kernel.org/netdev/net-next/c/520661495409

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] 5+ messages in thread

end of thread, other threads:[~2021-10-21 22:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 17:42 [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups Vladimir Oltean
2021-10-20 17:42 ` [PATCH net-next 1/2] net: enetc: remove local "priv" variable in enetc_clean_tx_ring() Vladimir Oltean
2021-10-20 17:42 ` [PATCH net-next 2/2] net: enetc: use the skb variable directly " Vladimir Oltean
2021-10-21  9:37 ` [PATCH net-next 0/2] enetc: trivial PTP one-step TX timestamping cleanups Claudiu Manoil
2021-10-21 22:40 ` 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).