* [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure
@ 2021-10-18 12:32 Marc Kleine-Budde
2021-10-20 7:14 ` Stéphane Grosjean
0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-10-18 12:32 UTC (permalink / raw)
To: linux-can; +Cc: Marc Kleine-Budde, Stephane Grosjean
With the support for full 64 bit timestamps the old timestamping
infrastructure is obsolete. This patch removes the left over bits.
Cc: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/peak_usb/pcan_usb_core.c | 13 -----------
drivers/net/can/usb/peak_usb/pcan_usb_core.h | 2 --
drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 23 --------------------
3 files changed, 38 deletions(-)
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index 6107fef9f4a0..9411a76f315c 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -192,19 +192,6 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time)
}
}
-/*
- * post received skb after having set any hw timestamp
- */
-int peak_usb_netif_rx(struct sk_buff *skb,
- struct peak_time_ref *time_ref, u32 ts_low)
-{
- struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
-
- peak_usb_get_ts_time(time_ref, ts_low, &hwts->hwtstamp);
-
- return netif_rx(skb);
-}
-
/* post received skb with native 64-bit hw timestamp */
int peak_usb_netif_rx_64(struct sk_buff *skb, u32 ts_low, u32 ts_high)
{
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
index daa19f57e742..ffc2be6ef881 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
@@ -141,8 +141,6 @@ void peak_usb_init_time_ref(struct peak_time_ref *time_ref,
void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *tv);
-int peak_usb_netif_rx(struct sk_buff *skb,
- struct peak_time_ref *time_ref, u32 ts_low);
int peak_usb_netif_rx_64(struct sk_buff *skb, u32 ts_low, u32 ts_high);
void peak_usb_async_complete(struct urb *urb);
void peak_usb_restart_complete(struct peak_usb_device *dev);
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
index 2770087d4d5d..394f4959a515 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
@@ -50,8 +50,6 @@ struct __packed pcan_ufd_fw_info {
struct pcan_usb_fd_if {
struct peak_usb_device *dev[PCAN_USB_MAX_CHANNEL];
struct pcan_ufd_fw_info fw_info;
- struct peak_time_ref time_ref;
- int cm_ignore_count;
int dev_opened_count;
};
@@ -642,19 +640,6 @@ static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if,
return 0;
}
-/* handle USB calibration message */
-static void pcan_usb_fd_decode_ts(struct pcan_usb_fd_if *usb_if,
- struct pucan_msg *rx_msg)
-{
- struct pcan_ufd_ts_msg *ts = (struct pcan_ufd_ts_msg *)rx_msg;
-
- /* should wait until clock is stabilized */
- if (usb_if->cm_ignore_count > 0)
- usb_if->cm_ignore_count--;
- else
- peak_usb_set_ts_now(&usb_if->time_ref, le32_to_cpu(ts->ts_low));
-}
-
/* callback for bulk IN urb */
static int pcan_usb_fd_decode_buf(struct peak_usb_device *dev, struct urb *urb)
{
@@ -695,7 +680,6 @@ static int pcan_usb_fd_decode_buf(struct peak_usb_device *dev, struct urb *urb)
break;
case PCAN_UFD_MSG_CALIBRATION:
- pcan_usb_fd_decode_ts(usb_if, rx_msg);
break;
case PUCAN_MSG_ERROR:
@@ -811,10 +795,6 @@ static int pcan_usb_fd_start(struct peak_usb_device *dev)
/* opening first device: */
if (pdev->usb_if->dev_opened_count == 0) {
- /* reset time_ref */
- peak_usb_init_time_ref(&pdev->usb_if->time_ref,
- &pcan_usb_pro_fd);
-
/* enable USB calibration messages */
err = pcan_usb_fd_set_options(dev, 1,
PUCAN_OPTION_ERROR,
@@ -880,9 +860,6 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
if (!pdev->cmd_buffer_addr)
goto err_out_1;
- /* number of ts msgs to ignore before taking one into account */
- pdev->usb_if->cm_ignore_count = 5;
-
err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO,
PCAN_USBPRO_INFO_FW,
&pdev->usb_if->fw_info,
--
2.33.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure
2021-10-18 12:32 [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure Marc Kleine-Budde
@ 2021-10-20 7:14 ` Stéphane Grosjean
2021-10-29 12:54 ` Marc Kleine-Budde
0 siblings, 1 reply; 3+ messages in thread
From: Stéphane Grosjean @ 2021-10-20 7:14 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-can
Hello Marc,
Nice shot! I confirm that all of this stuff that converted 32 bit timestamps into self-made 64 bit ones is now obsolete for the CANFD - USB interfaces from PEAK-System. However, note that requesting those PCAN_UFD_MSG_CALIBRATION messages is still mandatory to get valid hw timestamps from them.
Thank you,
Stéphane
-----Message d'origine-----
De : Marc Kleine-Budde <mkl@pengutronix.de>
Envoyé : lundi 18 octobre 2021 14:32
À : linux-can@vger.kernel.org
Cc : Marc Kleine-Budde <mkl@pengutronix.de>; Stéphane Grosjean <s.grosjean@peak-system.com>
Objet : [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure
With the support for full 64 bit timestamps the old timestamping infrastructure is obsolete. This patch removes the left over bits.
Cc: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/peak_usb/pcan_usb_core.c | 13 ----------- drivers/net/can/usb/peak_usb/pcan_usb_core.h | 2 --
drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 23 --------------------
3 files changed, 38 deletions(-)
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index 6107fef9f4a0..9411a76f315c 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -192,19 +192,6 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time)
}
}
-/*
- * post received skb after having set any hw timestamp
- */
-int peak_usb_netif_rx(struct sk_buff *skb,
- struct peak_time_ref *time_ref, u32 ts_low)
-{
- struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
-
- peak_usb_get_ts_time(time_ref, ts_low, &hwts->hwtstamp);
-
- return netif_rx(skb);
-}
-
/* post received skb with native 64-bit hw timestamp */ int peak_usb_netif_rx_64(struct sk_buff *skb, u32 ts_low, u32 ts_high) { diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
index daa19f57e742..ffc2be6ef881 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
@@ -141,8 +141,6 @@ void peak_usb_init_time_ref(struct peak_time_ref *time_ref, void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now); void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now); void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *tv); -int peak_usb_netif_rx(struct sk_buff *skb,
- struct peak_time_ref *time_ref, u32 ts_low);
int peak_usb_netif_rx_64(struct sk_buff *skb, u32 ts_low, u32 ts_high); void peak_usb_async_complete(struct urb *urb); void peak_usb_restart_complete(struct peak_usb_device *dev); diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
index 2770087d4d5d..394f4959a515 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
@@ -50,8 +50,6 @@ struct __packed pcan_ufd_fw_info { struct pcan_usb_fd_if {
struct peak_usb_device *dev[PCAN_USB_MAX_CHANNEL];
struct pcan_ufd_fw_info fw_info;
- struct peak_time_ref time_ref;
- int cm_ignore_count;
int dev_opened_count;
};
@@ -642,19 +640,6 @@ static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if,
return 0;
}
-/* handle USB calibration message */
-static void pcan_usb_fd_decode_ts(struct pcan_usb_fd_if *usb_if,
- struct pucan_msg *rx_msg)
-{
- struct pcan_ufd_ts_msg *ts = (struct pcan_ufd_ts_msg *)rx_msg;
-
- /* should wait until clock is stabilized */
- if (usb_if->cm_ignore_count > 0)
- usb_if->cm_ignore_count--;
- else
- peak_usb_set_ts_now(&usb_if->time_ref, le32_to_cpu(ts->ts_low));
-}
-
/* callback for bulk IN urb */
static int pcan_usb_fd_decode_buf(struct peak_usb_device *dev, struct urb *urb) { @@ -695,7 +680,6 @@ static int pcan_usb_fd_decode_buf(struct peak_usb_device *dev, struct urb *urb)
break;
case PCAN_UFD_MSG_CALIBRATION:
- pcan_usb_fd_decode_ts(usb_if, rx_msg);
break;
case PUCAN_MSG_ERROR:
@@ -811,10 +795,6 @@ static int pcan_usb_fd_start(struct peak_usb_device *dev)
/* opening first device: */
if (pdev->usb_if->dev_opened_count == 0) {
- /* reset time_ref */
- peak_usb_init_time_ref(&pdev->usb_if->time_ref,
- &pcan_usb_pro_fd);
-
/* enable USB calibration messages */
err = pcan_usb_fd_set_options(dev, 1,
PUCAN_OPTION_ERROR,
@@ -880,9 +860,6 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
if (!pdev->cmd_buffer_addr)
goto err_out_1;
- /* number of ts msgs to ignore before taking one into account */
- pdev->usb_if->cm_ignore_count = 5;
-
err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO,
PCAN_USBPRO_INFO_FW,
&pdev->usb_if->fw_info,
--
2.33.0
--
PEAK-System Technik GmbH
Sitz der Gesellschaft Darmstadt - HRB 9183
Geschaeftsfuehrung: Alexander Gach / Uwe Wilhelm
Unsere Datenschutzerklaerung mit wichtigen Hinweisen
zur Behandlung personenbezogener Daten finden Sie unter
www.peak-system.com/Datenschutz.483.0.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure
2021-10-20 7:14 ` Stéphane Grosjean
@ 2021-10-29 12:54 ` Marc Kleine-Budde
0 siblings, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-10-29 12:54 UTC (permalink / raw)
To: Stéphane Grosjean; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 724 bytes --]
On 20.10.2021 07:14:20, Stéphane Grosjean wrote:
> Nice shot! I confirm that all of this stuff that converted 32 bit
> timestamps into self-made 64 bit ones is now obsolete for the CANFD -
> USB interfaces from PEAK-System. However, note that requesting those
> PCAN_UFD_MSG_CALIBRATION messages is still mandatory to get valid hw
> timestamps from them.
Can you clean up the patch for me, so the device still gives valid
timestamps?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-29 12:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 12:32 [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure Marc Kleine-Budde
2021-10-20 7:14 ` Stéphane Grosjean
2021-10-29 12:54 ` Marc Kleine-Budde
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.