[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200910133806.25077-2-manivannan.sadhasivam@linaro.org>
Date: Thu, 10 Sep 2020 19:08:01 +0530
From: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To: wg@...ndegger.com, mkl@...gutronix.de, robh+dt@...nel.org
Cc: linux-can@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, dev.kurt@...dijck-laurijssen.be,
o.rempel@...gutronix.de,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Subject: [PATCH 1/6] can: rx-offload: can_rx_offload_add_manual(): add new initialization function
From: Marc Kleine-Budde <mkl@...gutronix.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@...gutronix.de>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
---
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.17.1
Powered by blists - more mailing lists