Linux-Can Archive on lore.kernel.org
 help / color / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-can@vger.kernel.org
Cc: kernel@pengutronix.de, Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 32/37] can: rx-offload: can_rx_offload_add_manual(): add new initialization function
Date: Wed, 16 Sep 2020 00:35:22 +0200
Message-ID: <20200915223527.1417033-33-mkl@pengutronix.de> (raw)
In-Reply-To: <20200915223527.1417033-1-mkl@pengutronix.de>

This patch adds a new initialization function:
can_rx_offload_add_manual()

It should be used to add support rx-offload to a driver, if the callback
mechanism should not be used. Use e.g. can_rx_offload_queue_sorted() to queue
skbs into rx-offload.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/rx-offload.c   | 11 +++++++++++
 include/linux/can/rx-offload.h |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c
index e8328910a234..3b180269a92d 100644
--- a/drivers/net/can/rx-offload.c
+++ b/drivers/net/can/rx-offload.c
@@ -351,6 +351,17 @@ int can_rx_offload_add_fifo(struct net_device *dev,
 }
 EXPORT_SYMBOL_GPL(can_rx_offload_add_fifo);
 
+int can_rx_offload_add_manual(struct net_device *dev,
+			      struct can_rx_offload *offload,
+			      unsigned int weight)
+{
+	if (offload->mailbox_read)
+		return -EINVAL;
+
+	return can_rx_offload_init_queue(dev, offload, weight);
+}
+EXPORT_SYMBOL_GPL(can_rx_offload_add_manual);
+
 void can_rx_offload_enable(struct can_rx_offload *offload)
 {
 	napi_enable(&offload->napi);
diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h
index 1b78a0cfb615..f1b38088b765 100644
--- a/include/linux/can/rx-offload.h
+++ b/include/linux/can/rx-offload.h
@@ -35,6 +35,9 @@ int can_rx_offload_add_timestamp(struct net_device *dev,
 int can_rx_offload_add_fifo(struct net_device *dev,
 			    struct can_rx_offload *offload,
 			    unsigned int weight);
+int can_rx_offload_add_manual(struct net_device *dev,
+			      struct can_rx_offload *offload,
+			      unsigned int weight);
 int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload,
 					 u64 reg);
 int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload);
-- 
2.28.0


  parent reply index

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 22:34 [RFC]: can-next 2020-09-16 Marc Kleine-Budde
2020-09-15 22:34 ` [PATCH 01/37] can: grcan: fix spelling mistake "buss" -> "bus" Marc Kleine-Budde
2020-09-15 22:34 ` [PATCH 02/37] can: flexcan: fix spelling mistake "reserverd" -> "reserved" Marc Kleine-Budde
2020-09-15 22:34 ` [PATCH 03/37] can: include: fix spelling mistakes Marc Kleine-Budde
2020-09-15 22:34 ` [PATCH 04/37] can: net: " Marc Kleine-Budde
2020-09-15 22:34 ` [PATCH 05/37] can: drivers: " Marc Kleine-Budde
2020-09-15 22:34 ` [PATCH 06/37] can: raw: fix indention Marc Kleine-Budde
2020-09-15 22:34 ` [PATCH 07/37] can: slcan: update dead link Marc Kleine-Budde
2020-09-15 22:34 ` [PATCH 08/37] can: softing: " Marc Kleine-Budde
2020-09-15 22:34 ` [PATCH 09/37] can: remove "WITH Linux-syscall-note" from SPDX tag of C files Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 10/37] can: dev: can_put_echo_skb(): print number of echo_skb that is occupied Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 11/37] can: dev: can_put_echo_skb(): propagate error in case of errors Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 12/37] can: dev: can_change_state(): print human readable state change messages Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 13/37] can: dev: can_bus_off(): print scheduling of restart if activated Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 14/37] can: c_can: Remove unused inline function Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 15/37] can: mcba_usb: remove redundant initialization of variable err Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 16/37] can: mscan: mark expected switch fall-through Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 17/37] can: ti_hecc: convert to devm_platform_ioremap_resource_byname() Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 18/37] can: peak_usb: convert to use le32_add_cpu() Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 19/37] can: peak_canfd: Remove unused macros Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 20/37] can: pch_can: use generic power management Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 21/37] can: pcan_usb: Document the commands sent to the device Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 22/37] can: pcan_usb: add support of rxerr/txerr counters Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 23/37] can: spi: Kconfig: remove unneeded dependencies form Kconfig symbols Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 24/37] dt-bindings: can: mcp251x: change example interrupt type to IRQ_TYPE_LEVEL_LOW Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 25/37] dt-bindings: can: mcp251x: document GPIO support Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 26/37] can: mcp251x: sort include files alphabetically Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 27/37] can: mcp251x: add GPIO support Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 28/37] can: mcp251x: Use readx_poll_timeout() helper Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 29/37] can: mcp251x: add support for half duplex controllers Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 30/37] can: mscan: mpc5xxx_can: update contact email Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 31/37] can: mscan: simplify clock enable/disable Marc Kleine-Budde
2020-09-15 22:35 ` Marc Kleine-Budde [this message]
2020-09-15 22:35 ` [PATCH 33/37] dt-binding: can: mcp25xxfd: document device tree bindings Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 34/37] can: mcp25xxfd: add regmap infrastructure Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 35/37] can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 36/37] can: mcp25xxfd: add listen-only mode Marc Kleine-Budde
2020-09-15 22:35 ` [PATCH 37/37] MAINTAINERS: Add entry for Microchip MCP25XXFD SPI-CAN network driver 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=20200915223527.1417033-33-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@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

Linux-Can Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-can/0 linux-can/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-can linux-can/ https://lore.kernel.org/linux-can \
		linux-can@vger.kernel.org
	public-inbox-index linux-can

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-can


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git