* [PATCH net] ixgbe: fix timestamp configuration code
@ 2023-08-23 22:15 Vadim Fedorenko
2023-08-24 14:49 ` Simon Horman
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Vadim Fedorenko @ 2023-08-23 22:15 UTC (permalink / raw)
To: Jesse Brandeburg, Tony Nguyen, Jakub Kicinski, Alexander Duyck,
Mark Rustad, Darin Miller, Jeff Kirsher, Richard Cochran
Cc: Vadim Fedorenko, netdev, intel-wired-lan
The commit in fixes introduced flags to control the status of hardware
configuration while processing packets. At the same time another structure
is used to provide configuration of timestamper to user-space applications.
The way it was coded makes this structures go out of sync easily. The
repro is easy for 82599 chips:
[root@hostname ~]# hwstamp_ctl -i eth0 -r 12 -t 1
current settings:
tx_type 0
rx_filter 0
new settings:
tx_type 1
rx_filter 12
The eth0 device is properly configured to timestamp any PTPv2 events.
[root@hostname ~]# hwstamp_ctl -i eth0 -r 1 -t 1
current settings:
tx_type 1
rx_filter 12
SIOCSHWTSTAMP failed: Numerical result out of range
The requested time stamping mode is not supported by the hardware.
The error is properly returned because HW doesn't support all packets
timestamping. But the adapter->flags is cleared of timestamp flags
even though no HW configuration was done. From that point no RX timestamps
are received by user-space application. But configuration shows good
values:
[root@hostname ~]# hwstamp_ctl -i eth0
current settings:
tx_type 1
rx_filter 12
Fix the issue by applying new flags only when the HW was actually
configured.
Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices")
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 28 +++++++++++---------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
index 0310af851086..9339edbd9082 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
@@ -979,6 +979,7 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
u32 tsync_tx_ctl = IXGBE_TSYNCTXCTL_ENABLED;
u32 tsync_rx_ctl = IXGBE_TSYNCRXCTL_ENABLED;
u32 tsync_rx_mtrl = PTP_EV_PORT << 16;
+ u32 aflags = adapter->flags;
bool is_l2 = false;
u32 regval;
@@ -996,20 +997,20 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
case HWTSTAMP_FILTER_NONE:
tsync_rx_ctl = 0;
tsync_rx_mtrl = 0;
- adapter->flags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
+ aflags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
break;
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
tsync_rx_mtrl |= IXGBE_RXMTRL_V1_SYNC_MSG;
- adapter->flags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
+ aflags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
break;
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
tsync_rx_mtrl |= IXGBE_RXMTRL_V1_DELAY_REQ_MSG;
- adapter->flags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
+ aflags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
break;
case HWTSTAMP_FILTER_PTP_V2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
@@ -1023,8 +1024,8 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_EVENT_V2;
is_l2 = true;
config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
- adapter->flags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
+ aflags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
break;
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
case HWTSTAMP_FILTER_NTP_ALL:
@@ -1035,7 +1036,7 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
if (hw->mac.type >= ixgbe_mac_X550) {
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_ALL;
config->rx_filter = HWTSTAMP_FILTER_ALL;
- adapter->flags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
+ aflags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
break;
}
fallthrough;
@@ -1046,8 +1047,6 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
* Delay_Req messages and hardware does not support
* timestamping all packets => return error
*/
- adapter->flags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
config->rx_filter = HWTSTAMP_FILTER_NONE;
return -ERANGE;
}
@@ -1079,8 +1078,8 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
IXGBE_TSYNCRXCTL_TYPE_ALL |
IXGBE_TSYNCRXCTL_TSIP_UT_EN;
config->rx_filter = HWTSTAMP_FILTER_ALL;
- adapter->flags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
- adapter->flags &= ~IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER;
+ aflags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
+ aflags &= ~IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER;
is_l2 = true;
break;
default:
@@ -1113,6 +1112,9 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
IXGBE_WRITE_FLUSH(hw);
+ /* configure adapter flags only when HW is actually configured */
+ adapter->flags = aflags;
+
/* clear TX/RX time stamp registers, just to be sure */
ixgbe_ptp_clear_tx_timestamp(adapter);
IXGBE_READ_REG(hw, IXGBE_RXSTMPH);
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net] ixgbe: fix timestamp configuration code
2023-08-23 22:15 [PATCH net] ixgbe: fix timestamp configuration code Vadim Fedorenko
@ 2023-08-24 14:49 ` Simon Horman
2023-08-31 5:18 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
2023-09-07 6:39 ` Pucha, HimasekharX Reddy
2 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2023-08-24 14:49 UTC (permalink / raw)
To: Vadim Fedorenko
Cc: Jesse Brandeburg, Tony Nguyen, Jakub Kicinski, Alexander Duyck,
Mark Rustad, Darin Miller, Jeff Kirsher, Richard Cochran, netdev,
intel-wired-lan
On Wed, Aug 23, 2023 at 11:15:37PM +0100, Vadim Fedorenko wrote:
> The commit in fixes introduced flags to control the status of hardware
> configuration while processing packets. At the same time another structure
> is used to provide configuration of timestamper to user-space applications.
> The way it was coded makes this structures go out of sync easily. The
> repro is easy for 82599 chips:
>
> [root@hostname ~]# hwstamp_ctl -i eth0 -r 12 -t 1
> current settings:
> tx_type 0
> rx_filter 0
> new settings:
> tx_type 1
> rx_filter 12
>
> The eth0 device is properly configured to timestamp any PTPv2 events.
>
> [root@hostname ~]# hwstamp_ctl -i eth0 -r 1 -t 1
> current settings:
> tx_type 1
> rx_filter 12
> SIOCSHWTSTAMP failed: Numerical result out of range
> The requested time stamping mode is not supported by the hardware.
>
> The error is properly returned because HW doesn't support all packets
> timestamping. But the adapter->flags is cleared of timestamp flags
> even though no HW configuration was done. From that point no RX timestamps
> are received by user-space application. But configuration shows good
> values:
>
> [root@hostname ~]# hwstamp_ctl -i eth0
> current settings:
> tx_type 1
> rx_filter 12
>
> Fix the issue by applying new flags only when the HW was actually
> configured.
>
> Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices")
> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [Intel-wired-lan] [PATCH net] ixgbe: fix timestamp configuration code
2023-08-23 22:15 [PATCH net] ixgbe: fix timestamp configuration code Vadim Fedorenko
2023-08-24 14:49 ` Simon Horman
@ 2023-08-31 5:18 ` Pucha, HimasekharX Reddy
2023-08-31 12:50 ` Vadim Fedorenko
2023-09-07 6:39 ` Pucha, HimasekharX Reddy
2 siblings, 1 reply; 7+ messages in thread
From: Pucha, HimasekharX Reddy @ 2023-08-31 5:18 UTC (permalink / raw)
To: Vadim Fedorenko, Brandeburg, Jesse, Nguyen, Anthony L,
Jakub Kicinski, Alexander Duyck, Rustad, Mark D, Darin Miller,
Jeff Kirsher, Richard Cochran
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Vadim Fedorenko
> Sent: Thursday, August 24, 2023 3:46 AM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Jakub Kicinski <kuba@kernel.org>; Alexander Duyck <alexander.duyck@gmail.com>; Rustad, Mark D <mark.d.rustad@intel.com>; Darin Miller <darin.j.miller@intel.com>; Jeff Kirsher <jeffrey.t.kirsher@intel.com>; Richard Cochran <richardcochran@gmail.com>
> Cc: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org; Vadim Fedorenko <vadim.fedorenko@linux.dev>
> Subject: [Intel-wired-lan] [PATCH net] ixgbe: fix timestamp configuration code
>
> The commit in fixes introduced flags to control the status of hardware
> configuration while processing packets. At the same time another structure
> is used to provide configuration of timestamper to user-space applications.
> The way it was coded makes this structures go out of sync easily. The
> repro is easy for 82599 chips:
>
> [root@hostname ~]# hwstamp_ctl -i eth0 -r 12 -t 1
> current settings:
> tx_type 0
> rx_filter 0
> new settings:
> tx_type 1
> rx_filter 12
>
> The eth0 device is properly configured to timestamp any PTPv2 events.
>
> [root@hostname ~]# hwstamp_ctl -i eth0 -r 1 -t 1
> current settings:
> tx_type 1
> rx_filter 12
> SIOCSHWTSTAMP failed: Numerical result out of range
> The requested time stamping mode is not supported by the hardware.
>
> The error is properly returned because HW doesn't support all packets
> timestamping. But the adapter->flags is cleared of timestamp flags
> even though no HW configuration was done. From that point no RX timestamps
> are received by user-space application. But configuration shows good
> values:
>
> [root@hostname ~]# hwstamp_ctl -i eth0
> current settings:
> tx_type 1
> rx_filter 12
>
> Fix the issue by applying new flags only when the HW was actually
> configured.
>
> Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices")
> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 28 +++++++++++---------
> 1 file changed, 15 insertions(+), 13 deletions(-)
>
Hi,
With patch also we are observing same issue.
# ./hwstamp_ctl -i eth10
current settings:
tx_type 1
rx_filter 12
# ./hwstamp_ctl -i eth10 -r 1 -t 1
current settings:
tx_type 1
rx_filter 12
SIOCSHWTSTAMP failed: Numerical result out of range
The requested time stamping mode is not supported by the hardware.
Adapter details: Niantic (Spring Fountain)
SUT info:
H/W:
Manufacturer: Intel Corporation
Product Name: S2600STQ
RAM: [62G/8G/49G]
CPU: Intel(R) Xeon(R) Platinum 8180 CPU @ 2.50GHz [112/112]
PF bus-info: 0000:d8:00.1 0x8086:0x10fb 0x8086 0x000c (0x01)
S/W:
OS: "Red Hat Enterprise Linux 8.6 (Ootpa)" 6.5.0-rc7_next-queue_28-Aug-2023-01755-g938672aefaeb
CMD: BOOT_IMAGE=(hd0,msdos2)/vmlinuz-6.5.0-rc7_next-queue_28-Aug-2023-01755-g938672aefaeb root=/dev/mapper/rhel_os--delivery-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel_os--delivery-swap rd.lvm.lv=rhel_os-delivery/root rd.lvm.lv=rhel_os-delivery/swap selinux=0 biosdevname=0 net.ifnames=0 rhgb quiet
FW firmware-version: 0x000161bf
PF version: 6.5.0-rc7_next-queue_28-Aug-202
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH net] ixgbe: fix timestamp configuration code
2023-08-31 5:18 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
@ 2023-08-31 12:50 ` Vadim Fedorenko
0 siblings, 0 replies; 7+ messages in thread
From: Vadim Fedorenko @ 2023-08-31 12:50 UTC (permalink / raw)
To: Pucha, HimasekharX Reddy, Brandeburg, Jesse, Nguyen, Anthony L,
Jakub Kicinski, Alexander Duyck, Rustad, Mark D, Darin Miller,
Jeff Kirsher, Richard Cochran
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
On 31/08/2023 06:18, Pucha, HimasekharX Reddy wrote:
>> -----Original Message-----
>> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Vadim Fedorenko
>> Sent: Thursday, August 24, 2023 3:46 AM
>> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Jakub Kicinski <kuba@kernel.org>; Alexander Duyck <alexander.duyck@gmail.com>; Rustad, Mark D <mark.d.rustad@intel.com>; Darin Miller <darin.j.miller@intel.com>; Jeff Kirsher <jeffrey.t.kirsher@intel.com>; Richard Cochran <richardcochran@gmail.com>
>> Cc: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org; Vadim Fedorenko <vadim.fedorenko@linux.dev>
>> Subject: [Intel-wired-lan] [PATCH net] ixgbe: fix timestamp configuration code
>>
>> The commit in fixes introduced flags to control the status of hardware
>> configuration while processing packets. At the same time another structure
>> is used to provide configuration of timestamper to user-space applications.
>> The way it was coded makes this structures go out of sync easily. The
>> repro is easy for 82599 chips:
>>
>> [root@hostname ~]# hwstamp_ctl -i eth0 -r 12 -t 1
>> current settings:
>> tx_type 0
>> rx_filter 0
>> new settings:
>> tx_type 1
>> rx_filter 12
>>
>> The eth0 device is properly configured to timestamp any PTPv2 events.
>>
>> [root@hostname ~]# hwstamp_ctl -i eth0 -r 1 -t 1
>> current settings:
>> tx_type 1
>> rx_filter 12
>> SIOCSHWTSTAMP failed: Numerical result out of range
>> The requested time stamping mode is not supported by the hardware.
>>
>> The error is properly returned because HW doesn't support all packets
>> timestamping. But the adapter->flags is cleared of timestamp flags
>> even though no HW configuration was done. From that point no RX timestamps
>> are received by user-space application. But configuration shows good
>> values:
>>
>> [root@hostname ~]# hwstamp_ctl -i eth0
>> current settings:
>> tx_type 1
>> rx_filter 12
>>
>> Fix the issue by applying new flags only when the HW was actually
>> configured.
>>
>> Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices")
>> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
>> ---
>> drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 28 +++++++++++---------
>> 1 file changed, 15 insertions(+), 13 deletions(-)
>>
>
> Hi,
> With patch also we are observing same issue.
Hi,
What kind of issue do you observe? The hardware doesn't support
timestamping of all packets. The issue this patch fixes is that
after failed attempt to setup the timestamping of all RX packets,
the driver stops reading timestamps at all even though it reports
that timestamping of PTP RX packets is enabled.
>
> # ./hwstamp_ctl -i eth10
> current settings:
> tx_type 1
> rx_filter 12
> # ./hwstamp_ctl -i eth10 -r 1 -t 1
> current settings:
> tx_type 1
> rx_filter 12
> SIOCSHWTSTAMP failed: Numerical result out of range
> The requested time stamping mode is not supported by the hardware.
>
> Adapter details: Niantic (Spring Fountain)
>
> SUT info:
> H/W:
> Manufacturer: Intel Corporation
> Product Name: S2600STQ
> RAM: [62G/8G/49G]
> CPU: Intel(R) Xeon(R) Platinum 8180 CPU @ 2.50GHz [112/112]
> PF bus-info: 0000:d8:00.1 0x8086:0x10fb 0x8086 0x000c (0x01)
> S/W:
> OS: "Red Hat Enterprise Linux 8.6 (Ootpa)" 6.5.0-rc7_next-queue_28-Aug-2023-01755-g938672aefaeb
> CMD: BOOT_IMAGE=(hd0,msdos2)/vmlinuz-6.5.0-rc7_next-queue_28-Aug-2023-01755-g938672aefaeb root=/dev/mapper/rhel_os--delivery-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel_os--delivery-swap rd.lvm.lv=rhel_os-delivery/root rd.lvm.lv=rhel_os-delivery/swap selinux=0 biosdevname=0 net.ifnames=0 rhgb quiet
> FW firmware-version: 0x000161bf
> PF version: 6.5.0-rc7_next-queue_28-Aug-202
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [Intel-wired-lan] [PATCH net] ixgbe: fix timestamp configuration code
2023-08-23 22:15 [PATCH net] ixgbe: fix timestamp configuration code Vadim Fedorenko
2023-08-24 14:49 ` Simon Horman
2023-08-31 5:18 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
@ 2023-09-07 6:39 ` Pucha, HimasekharX Reddy
2 siblings, 0 replies; 7+ messages in thread
From: Pucha, HimasekharX Reddy @ 2023-09-07 6:39 UTC (permalink / raw)
To: Vadim Fedorenko, Brandeburg, Jesse, Nguyen, Anthony L,
Jakub Kicinski, Alexander Duyck, Rustad, Mark D, Darin Miller,
Jeff Kirsher, Richard Cochran
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Vadim Fedorenko
> Sent: Thursday, August 24, 2023 3:46 AM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Jakub Kicinski <kuba@kernel.org>; Alexander Duyck <alexander.duyck@gmail.com>; Rustad, Mark D <mark.d.rustad@intel.com>; Darin Miller <darin.j.miller@intel.com>; Jeff Kirsher <jeffrey.t.kirsher@intel.com>; Richard Cochran <richardcochran@gmail.com>
> Cc: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org; Vadim Fedorenko <vadim.fedorenko@linux.dev>
> Subject: [Intel-wired-lan] [PATCH net] ixgbe: fix timestamp configuration code
>
> The commit in fixes introduced flags to control the status of hardware
> configuration while processing packets. At the same time another structure
> is used to provide configuration of timestamper to user-space applications.
> The way it was coded makes this structures go out of sync easily. The
> repro is easy for 82599 chips:
>
> [root@hostname ~]# hwstamp_ctl -i eth0 -r 12 -t 1
> current settings:
> tx_type 0
> rx_filter 0
> new settings:
> tx_type 1
> rx_filter 12
>
> The eth0 device is properly configured to timestamp any PTPv2 events.
>
> [root@hostname ~]# hwstamp_ctl -i eth0 -r 1 -t 1
> current settings:
> tx_type 1
> rx_filter 12
> SIOCSHWTSTAMP failed: Numerical result out of range
> The requested time stamping mode is not supported by the hardware.
>
> The error is properly returned because HW doesn't support all packets
> timestamping. But the adapter->flags is cleared of timestamp flags
> even though no HW configuration was done. From that point no RX timestamps
> are received by user-space application. But configuration shows good
> values:
>
> [root@hostname ~]# hwstamp_ctl -i eth0
> current settings:
> tx_type 1
> rx_filter 12
>
> Fix the issue by applying new flags only when the HW was actually
> configured.
>
> Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices")
> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 28 +++++++++++---------
> 1 file changed, 15 insertions(+), 13 deletions(-)
>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net] ixgbe: fix timestamp configuration code
@ 2023-09-11 20:28 Tony Nguyen
2023-09-13 11:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 7+ messages in thread
From: Tony Nguyen @ 2023-09-11 20:28 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev
Cc: Vadim Fedorenko, anthony.l.nguyen, richardcochran, Simon Horman,
Pucha Himasekhar Reddy
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
The commit in fixes introduced flags to control the status of hardware
configuration while processing packets. At the same time another structure
is used to provide configuration of timestamper to user-space applications.
The way it was coded makes this structures go out of sync easily. The
repro is easy for 82599 chips:
[root@hostname ~]# hwstamp_ctl -i eth0 -r 12 -t 1
current settings:
tx_type 0
rx_filter 0
new settings:
tx_type 1
rx_filter 12
The eth0 device is properly configured to timestamp any PTPv2 events.
[root@hostname ~]# hwstamp_ctl -i eth0 -r 1 -t 1
current settings:
tx_type 1
rx_filter 12
SIOCSHWTSTAMP failed: Numerical result out of range
The requested time stamping mode is not supported by the hardware.
The error is properly returned because HW doesn't support all packets
timestamping. But the adapter->flags is cleared of timestamp flags
even though no HW configuration was done. From that point no RX timestamps
are received by user-space application. But configuration shows good
values:
[root@hostname ~]# hwstamp_ctl -i eth0
current settings:
tx_type 1
rx_filter 12
Fix the issue by applying new flags only when the HW was actually
configured.
Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices")
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 28 +++++++++++---------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
index 0310af851086..9339edbd9082 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
@@ -979,6 +979,7 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
u32 tsync_tx_ctl = IXGBE_TSYNCTXCTL_ENABLED;
u32 tsync_rx_ctl = IXGBE_TSYNCRXCTL_ENABLED;
u32 tsync_rx_mtrl = PTP_EV_PORT << 16;
+ u32 aflags = adapter->flags;
bool is_l2 = false;
u32 regval;
@@ -996,20 +997,20 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
case HWTSTAMP_FILTER_NONE:
tsync_rx_ctl = 0;
tsync_rx_mtrl = 0;
- adapter->flags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
+ aflags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
break;
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
tsync_rx_mtrl |= IXGBE_RXMTRL_V1_SYNC_MSG;
- adapter->flags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
+ aflags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
break;
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
tsync_rx_mtrl |= IXGBE_RXMTRL_V1_DELAY_REQ_MSG;
- adapter->flags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
+ aflags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
break;
case HWTSTAMP_FILTER_PTP_V2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
@@ -1023,8 +1024,8 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_EVENT_V2;
is_l2 = true;
config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
- adapter->flags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
+ aflags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
break;
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
case HWTSTAMP_FILTER_NTP_ALL:
@@ -1035,7 +1036,7 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
if (hw->mac.type >= ixgbe_mac_X550) {
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_ALL;
config->rx_filter = HWTSTAMP_FILTER_ALL;
- adapter->flags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
+ aflags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
break;
}
fallthrough;
@@ -1046,8 +1047,6 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
* Delay_Req messages and hardware does not support
* timestamping all packets => return error
*/
- adapter->flags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
- IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
config->rx_filter = HWTSTAMP_FILTER_NONE;
return -ERANGE;
}
@@ -1079,8 +1078,8 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
IXGBE_TSYNCRXCTL_TYPE_ALL |
IXGBE_TSYNCRXCTL_TSIP_UT_EN;
config->rx_filter = HWTSTAMP_FILTER_ALL;
- adapter->flags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
- adapter->flags &= ~IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER;
+ aflags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
+ aflags &= ~IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER;
is_l2 = true;
break;
default:
@@ -1113,6 +1112,9 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
IXGBE_WRITE_FLUSH(hw);
+ /* configure adapter flags only when HW is actually configured */
+ adapter->flags = aflags;
+
/* clear TX/RX time stamp registers, just to be sure */
ixgbe_ptp_clear_tx_timestamp(adapter);
IXGBE_READ_REG(hw, IXGBE_RXSTMPH);
--
2.38.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net] ixgbe: fix timestamp configuration code
2023-09-11 20:28 Tony Nguyen
@ 2023-09-13 11:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-13 11:30 UTC (permalink / raw)
To: Tony Nguyen
Cc: davem, kuba, pabeni, edumazet, netdev, vadim.fedorenko,
richardcochran, horms, himasekharx.reddy.pucha
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Mon, 11 Sep 2023 13:28:14 -0700 you wrote:
> From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
>
> The commit in fixes introduced flags to control the status of hardware
> configuration while processing packets. At the same time another structure
> is used to provide configuration of timestamper to user-space applications.
> The way it was coded makes this structures go out of sync easily. The
> repro is easy for 82599 chips:
>
> [...]
Here is the summary with links:
- [net] ixgbe: fix timestamp configuration code
https://git.kernel.org/netdev/net/c/3c44191dd76c
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] 7+ messages in thread
end of thread, other threads:[~2023-09-13 11:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-23 22:15 [PATCH net] ixgbe: fix timestamp configuration code Vadim Fedorenko
2023-08-24 14:49 ` Simon Horman
2023-08-31 5:18 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
2023-08-31 12:50 ` Vadim Fedorenko
2023-09-07 6:39 ` Pucha, HimasekharX Reddy
-- strict thread matches above, loose matches on Subject: below --
2023-09-11 20:28 Tony Nguyen
2023-09-13 11:30 ` 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).