Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [net-next 06/13] ice: PTP: move setting of tstamp_config
Date: Wed, 30 Jun 2021 17:27:06 -0700	[thread overview]
Message-ID: <20210701002713.3486336-7-jacob.e.keller@intel.com> (raw)
In-Reply-To: <20210701002713.3486336-1-jacob.e.keller@intel.com>

The tstamp_config structure is being set inside of
ice_ptp_cfg_timestamp, which is the function used to set Tx and
Rx timestamping during initialization.

This function is also used in order to set the PHY port timestamping
status. However, it makes sense to always set the tstamp_config directly
whenever the ice_set_tx_tstamp or ice_set_rx_tstamp functions are
called.

Move assignment of tstamp_config into the related functions and out of
ice_ptp_cfg_timestamp.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 4a6ab36411fa..049257f00809 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -35,6 +35,11 @@ static void ice_set_tx_tstamp(struct ice_pf *pf, bool on)
 	else
 		val &= ~PFINT_OICR_TSYN_TX_M;
 	wr32(&pf->hw, PFINT_OICR_ENA, val);
+
+	if (on)
+		pf->ptp.tstamp_config.tx_type = HWTSTAMP_TX_ON;
+	else
+		pf->ptp.tstamp_config.tx_type = HWTSTAMP_TX_OFF;
 }
 
 /**
@@ -57,6 +62,11 @@ static void ice_set_rx_tstamp(struct ice_pf *pf, bool on)
 			continue;
 		vsi->rx_rings[i]->ptp_rx = on;
 	}
+
+	if (on)
+		pf->ptp.tstamp_config.rx_filter = HWTSTAMP_FILTER_ALL;
+	else
+		pf->ptp.tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
 }
 
 /**
@@ -71,14 +81,6 @@ static void ice_ptp_cfg_timestamp(struct ice_pf *pf, bool ena)
 {
 	ice_set_tx_tstamp(pf, ena);
 	ice_set_rx_tstamp(pf, ena);
-
-	if (ena) {
-		pf->ptp.tstamp_config.rx_filter = HWTSTAMP_FILTER_ALL;
-		pf->ptp.tstamp_config.tx_type = HWTSTAMP_TX_ON;
-	} else {
-		pf->ptp.tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
-		pf->ptp.tstamp_config.tx_type = HWTSTAMP_TX_OFF;
-	}
 }
 
 /**
@@ -954,7 +956,6 @@ ice_ptp_set_timestamp_mode(struct ice_pf *pf, struct hwtstamp_config *config)
 	case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
 	case HWTSTAMP_FILTER_NTP_ALL:
 	case HWTSTAMP_FILTER_ALL:
-		config->rx_filter = HWTSTAMP_FILTER_ALL;
 		ice_set_rx_tstamp(pf, true);
 		break;
 	default:
-- 
2.31.1.331.gb0c09ab8796f


  parent reply	other threads:[~2021-07-01  0:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  0:27 [Intel-wired-lan] [net-next 00/13] ice: implement support for PTP on E822 hardware Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 01/13] ice: fix Tx queue iteration for Tx timestamp enablement Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 02/13] ice: remove dead code for allocating pin_config Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 03/13] ice: add lock around Tx timestamp tracker flush Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 04/13] ice: restart periodic outputs around time changes Jacob Keller
2021-07-05  7:52   ` Paul Menzel
2021-07-06 19:54     ` Keller, Jacob E
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 05/13] ice: introduce ice_base_incval function Jacob Keller
2021-07-01  0:27 ` Jacob Keller [this message]
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 07/13] ice: use 'int err' instead of 'int status' Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 08/13] ice: introduce ice_ptp_init_phc function Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 09/13] ice: convert clk_freq capability into time_ref Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 10/13] ice: implement basic E822 PTP support Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 11/13] ice: ensure the hardware Clock Generation Unit is configured Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 12/13] ice: exit bypass mode once hardware finishes timestamp calibration Jacob Keller
2021-07-01  0:27 ` [Intel-wired-lan] [net-next 13/13] ice: support crosstimestamping on E822 devices if supported Jacob Keller
2021-07-01 18:32   ` kernel test robot
2021-07-05  7:47 ` [Intel-wired-lan] [net-next 00/13] ice: implement support for PTP on E822 hardware Paul Menzel
2021-07-06 19:53   ` Keller, Jacob E
2021-07-07  7:52     ` Paul Menzel
2021-07-07 23:10       ` Keller, Jacob E

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210701002713.3486336-7-jacob.e.keller@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox