All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stéphane Grosjean" <s.grosjean@peak-system.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: RE: [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure
Date: Wed, 20 Oct 2021 07:14:20 +0000	[thread overview]
Message-ID: <PA4PR03MB67977F6773983F04C7F0EB5DD6BE9@PA4PR03MB6797.eurprd03.prod.outlook.com> (raw)
In-Reply-To: <20211018123203.2234904-1-mkl@pengutronix.de>

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

  reply	other threads:[~2021-10-20  7:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-10-29 12:54   ` Marc Kleine-Budde

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=PA4PR03MB67977F6773983F04C7F0EB5DD6BE9@PA4PR03MB6797.eurprd03.prod.outlook.com \
    --to=s.grosjean@peak-system.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /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 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.