RE: [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
Envoyé : lundi 18 octobre 2021 14:32
À : linux-can@xxxxxxxxxxxxxxx
Cc : Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>; Stéphane Grosjean <s.grosjean@xxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx>
Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux