public inbox for linux-can@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-can@vger.kernel.org
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Subject: [net-next 00/13] can: dev: cleanup and add CAN frame length handling support
Date: Sat,  9 Jan 2021 18:40:00 +0100	[thread overview]
Message-ID: <20210109174013.534145-1-mkl@pengutronix.de> (raw)

Hello,

this series splits the CAN driver related infrastructure into several files
(patches 1...6), followed by some cleanup patches (7, 8), and support for
CAN frame length handling (9...13).

I took the path and put the calculated frame length into the struct
can_skb_priv and extended the can_get_echo_skb() and
can_rx_offload_get_echo_skb() to optionally return the CAN frame length.

This patch illustrated how the new code can be used. I'll send mcp251xfd BQL
support in a separate series, once details about this code have settled.

@@ -1352,7 +1357,9 @@ static int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv)
        }
 
        for (i = 0; i < len; i++) {
-               err = mcp251xfd_handle_tefif_one(priv, &hw_tef_obj[i]);
+               unsigned int frame_len;
+
+               err = mcp251xfd_handle_tefif_one(priv, &hw_tef_obj[i], &frame_len);
                /* -EAGAIN means the Sequence Number in the TEF
                 * doesn't match our tef_tail. This can happen if we
                 * read the TEF objects too early. Leave loop let the
@@ -1362,6 +1369,8 @@ static int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv)
                        goto out_netif_wake_queue;
                if (err)
                        return err;
+
+               total_frame_len += frame_len;
        }
 
  out_netif_wake_queue:
@@ -1393,6 +1402,7 @@ static int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv)
                        return err;
 
                tx_ring->tail += len;
+               netdev_completed_queue(priv->ndev, len, total_frame_len);
 
                err = mcp251xfd_check_tef_tail(priv);
                if (err)
@@ -2433,6 +2443,7 @@ static bool mcp251xfd_tx_busy(const struct mcp251xfd_priv *priv,
 static netdev_tx_t mcp251xfd_start_xmit(struct sk_buff *skb,
                                        struct net_device *ndev)
 {
+       struct can_skb_priv *can_skb_priv = can_skb_prv(skb);
        struct mcp251xfd_priv *priv = netdev_priv(ndev);
        struct mcp251xfd_tx_ring *tx_ring = priv->tx;
        struct mcp251xfd_tx_obj *tx_obj;
@@ -2455,6 +2466,8 @@ static netdev_tx_t mcp251xfd_start_xmit(struct sk_buff *skb,
                netif_stop_queue(ndev);
 
        can_put_echo_skb(skb, ndev, tx_head);
+       can_skb_priv->frame_len = can_skb_get_frame_len(skb);
+       netdev_sent_queue(priv->ndev, can_skb_priv->frame_len);
 
        err = mcp251xfd_tx_obj_write(priv, tx_obj);
        if (err)

regards,
Marc




             reply	other threads:[~2021-01-09 17:41 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09 17:40 Marc Kleine-Budde [this message]
2021-01-09 17:40 ` [net-next 01/13] MAINTAINERS: CAN network layer: add missing header file can-ml.h Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 02/13] can: dev: move driver related infrastructure into separate subdir Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 03/13] can: dev: move bittiming related code into seperate file Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 04/13] can: dev: move length " Marc Kleine-Budde
2021-01-11  8:49   ` Oliver Hartkopp
2021-01-11  9:58     ` Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 05/13] can: dev: move skb related " Marc Kleine-Budde
2021-01-10  4:26   ` Vincent MAILHOL
2021-01-11  8:14     ` Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 06/13] can: dev: move netlink related code " Marc Kleine-Budde
2021-01-10  4:27   ` Vincent MAILHOL
2021-01-11  8:17     ` Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 07/13] can: length: convert to kernel coding style Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 08/13] can: length: can_fd_len2dlc(): simplify length calculcation Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 09/13] can: length: canfd_sanitize_len(): add function to sanitize CAN-FD data length Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 10/13] can: length: can_skb_get_frame_len(): introduce function to get data length of frame in data link layer Marc Kleine-Budde
2021-01-10  3:32   ` Vincent MAILHOL
2021-01-11  8:12     ` Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 11/13] can: dev: extend struct can_skb_priv to hold CAN frame length Marc Kleine-Budde
2021-01-10  6:52   ` Vincent MAILHOL
2021-01-10  8:38     ` Vincent MAILHOL
2021-01-11  6:13       ` [PATCH] can: dev: extend can_put_echo_skb() to handle frame_len Vincent Mailhol
2021-01-11  9:38         ` Marc Kleine-Budde
2021-01-11 10:35           ` Vincent MAILHOL
2021-01-11 10:36             ` Marc Kleine-Budde
2021-01-11 10:41             ` [PATCH v2] can: dev: can_put_echo_skb(): extend to store can frame length Vincent Mailhol
2021-01-11 10:54               ` Marc Kleine-Budde
2021-01-11 12:43                 ` Vincent MAILHOL
2021-01-11 10:26         ` [PATCH] can: dev: extend can_put_echo_skb() to handle frame_len Marc Kleine-Budde
2021-01-11  8:22     ` [net-next 11/13] can: dev: extend struct can_skb_priv to hold CAN frame length Marc Kleine-Budde
2021-01-11  8:29       ` Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 12/13] can: dev: can_get_echo_skb(): extend to return can " Marc Kleine-Budde
2021-01-09 17:40 ` [net-next 13/13] can: dev: can_rx_offload_get_echo_skb(): " Marc Kleine-Budde
2021-01-10  8:55 ` [net-next 00/13] can: dev: cleanup and add CAN frame length handling support Vincent MAILHOL
2021-01-11  8:26   ` Marc Kleine-Budde
2021-01-11  9:42     ` Vincent MAILHOL
2021-01-11 10:00       ` Marc Kleine-Budde
2021-01-11 10:25         ` Vincent MAILHOL
2021-01-11 10:34           ` 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=20210109174013.534145-1-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=socketcan@hartkopp.net \
    /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