From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
kernel@pengutronix.de, Marc Kleine-Budde <mkl@pengutronix.de>,
Dario Binacchi <dariobin@libero.it>
Subject: [PATCH net-next 18/22] can: c_can: rename IF_RX -> IF_NAPI
Date: Thu, 19 Aug 2021 15:39:09 +0200 [thread overview]
Message-ID: <20210819133913.657715-19-mkl@pengutronix.de> (raw)
In-Reply-To: <20210819133913.657715-1-mkl@pengutronix.de>
The C_CAN/D_CAN cores implement 2 interfaces to manage the message
objects. To avoid concurrency and the need for locking one interface
is used in the TX path (IF_TX). While the other one, named IF_RX is
used from NAPI context only. As this interface is not only used to
manage RX, but also TX message objects, this patch renames IF_RX to
IF_NAPI.
Link: https://lore.kernel.org/r/20210809080608.171545-1-mkl@pengutronix.de
Cc: Dario Binacchi <dariobin@libero.it>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/c_can/c_can_main.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/net/can/c_can/c_can_main.c b/drivers/net/can/c_can/c_can_main.c
index e65bd7a9cf1d..052ff35ed4dc 100644
--- a/drivers/net/can/c_can/c_can_main.c
+++ b/drivers/net/can/c_can/c_can_main.c
@@ -160,8 +160,8 @@
#define IF_MCONT_TX (IF_MCONT_TXIE | IF_MCONT_EOB)
-/* Use IF1 for RX and IF2 for TX */
-#define IF_RX 0
+/* Use IF1 in NAPI path and IF2 in TX path */
+#define IF_NAPI 0
#define IF_TX 1
/* minimum timeout for checking BUSY status */
@@ -529,13 +529,13 @@ static void c_can_configure_msg_objects(struct net_device *dev)
/* first invalidate all message objects */
for (i = priv->msg_obj_rx_first; i <= priv->msg_obj_num; i++)
- c_can_inval_msg_object(dev, IF_RX, i);
+ c_can_inval_msg_object(dev, IF_NAPI, i);
/* setup receive message objects */
for (i = priv->msg_obj_rx_first; i < priv->msg_obj_rx_last; i++)
- c_can_setup_receive_object(dev, IF_RX, i, 0, 0, IF_MCONT_RCV);
+ c_can_setup_receive_object(dev, IF_NAPI, i, 0, 0, IF_MCONT_RCV);
- c_can_setup_receive_object(dev, IF_RX, priv->msg_obj_rx_last, 0, 0,
+ c_can_setup_receive_object(dev, IF_NAPI, priv->msg_obj_rx_last, 0, 0,
IF_MCONT_RCV_EOB);
}
@@ -710,11 +710,11 @@ static void c_can_do_tx(struct net_device *dev)
pend &= ~BIT(idx);
obj = idx + priv->msg_obj_tx_first;
- /* We use IF_RX interface instead of IF_TX because we
+ /* We use IF_NAPI interface instead of IF_TX because we
* are called from c_can_poll(), which runs inside
* NAPI. We are not transmitting.
*/
- c_can_inval_tx_object(dev, IF_RX, obj);
+ c_can_inval_tx_object(dev, IF_NAPI, obj);
can_get_echo_skb(dev, idx, NULL);
bytes += priv->dlc[idx];
pkts++;
@@ -766,14 +766,14 @@ static u32 c_can_adjust_pending(u32 pend, u32 rx_mask)
static inline void c_can_rx_object_get(struct net_device *dev,
struct c_can_priv *priv, u32 obj)
{
- c_can_object_get(dev, IF_RX, obj, priv->comm_rcv_high);
+ c_can_object_get(dev, IF_NAPI, obj, priv->comm_rcv_high);
}
static inline void c_can_rx_finalize(struct net_device *dev,
struct c_can_priv *priv, u32 obj)
{
if (priv->type != BOSCH_D_CAN)
- c_can_object_get(dev, IF_RX, obj, IF_COMM_CLR_NEWDAT);
+ c_can_object_get(dev, IF_NAPI, obj, IF_COMM_CLR_NEWDAT);
}
static int c_can_read_objects(struct net_device *dev, struct c_can_priv *priv,
@@ -785,10 +785,12 @@ static int c_can_read_objects(struct net_device *dev, struct c_can_priv *priv,
pend &= ~BIT(obj - 1);
c_can_rx_object_get(dev, priv, obj);
- ctrl = priv->read_reg(priv, C_CAN_IFACE(MSGCTRL_REG, IF_RX));
+ ctrl = priv->read_reg(priv, C_CAN_IFACE(MSGCTRL_REG, IF_NAPI));
if (ctrl & IF_MCONT_MSGLST) {
- int n = c_can_handle_lost_msg_obj(dev, IF_RX, obj, ctrl);
+ int n;
+
+ n = c_can_handle_lost_msg_obj(dev, IF_NAPI, obj, ctrl);
pkts += n;
quota -= n;
@@ -803,7 +805,7 @@ static int c_can_read_objects(struct net_device *dev, struct c_can_priv *priv,
continue;
/* read the data from the message object */
- c_can_read_msg_object(dev, IF_RX, ctrl);
+ c_can_read_msg_object(dev, IF_NAPI, ctrl);
c_can_rx_finalize(dev, priv, obj);
--
2.32.0
next prev parent reply other threads:[~2021-08-19 13:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-19 13:38 pull-request: can-next 2021-08-19 Marc Kleine-Budde
2021-08-19 13:38 ` [PATCH net-next 01/22] mailmap: update email address of Matthias Fuchs and Thomas Körper Marc Kleine-Budde
2021-08-19 13:38 ` [PATCH net-next 02/22] dt-bindings: can-controller: add support for termination-gpios Marc Kleine-Budde
2021-08-19 13:38 ` [PATCH net-next 03/22] dt-bindings: can: fsl,flexcan: enable termination-* bindings Marc Kleine-Budde
2021-08-19 13:38 ` [PATCH net-next 04/22] can: dev: provide optional GPIO based termination support Marc Kleine-Budde
2021-08-19 13:38 ` [PATCH net-next 05/22] can: netlink: allow user to turn off unsupported features Marc Kleine-Budde
2021-08-19 13:38 ` [PATCH net-next 06/22] MAINTAINERS: add Vincent MAILHOL as maintainer for the ETAS ES58X CAN/USB driver Marc Kleine-Budde
2021-08-19 13:38 ` [PATCH net-next 07/22] can: etas_es58x: clean-up documentation of struct es58x_fd_tx_conf_msg Marc Kleine-Budde
2021-08-19 13:38 ` [PATCH net-next 08/22] can: mcp251xfd: mark some instances of struct mcp251xfd_priv as const Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 09/22] dt-bindings: net: can: renesas,rcar-canfd: Document RZ/G2L SoC Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 10/22] can: rcar_canfd: Add support for RZ/G2L family Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 11/22] can: tcan4x5x: cdev_to_priv(): remove stray empty line Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 12/22] can: m_can: fix block comment style Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 13/22] can: m_can: Disable IRQs on FIFO bus errors Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 14/22] can: m_can: Batch FIFO reads during CAN receive Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 15/22] can: m_can: Batch FIFO writes during CAN transmit Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 16/22] dt-bindings: net: can: c_can: convert to json-schema Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 17/22] can: c_can: c_can_do_tx(): fix typo in comment Marc Kleine-Budde
2021-08-19 13:39 ` Marc Kleine-Budde [this message]
2021-08-19 13:39 ` [PATCH net-next 19/22] can: c_can: remove struct c_can_priv::priv field Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 20/22] can: c_can: exit c_can_do_tx() early if no frames have been sent Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 21/22] can: c_can: support tx ring algorithm Marc Kleine-Budde
2021-08-19 13:39 ` [PATCH net-next 22/22] can: c_can: cache frames to operate as a true FIFO Marc Kleine-Budde
2021-08-19 19:00 ` pull-request: can-next 2021-08-19 patchwork-bot+netdevbpf
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=20210819133913.657715-19-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=dariobin@libero.it \
--cc=davem@davemloft.net \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).