diff mbox series

[net-next,1/3] qede: add netpoll support for qede driver

Message ID 1610701570-29496-2-git-send-email-bupadhaya@marvell.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series qede: add netpoll and per-queue coalesce support | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 2 maintainers not CCed: GR-everest-linux-l2@marvell.com davem@davemloft.net
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 36 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Bhaskar Upadhaya Jan. 15, 2021, 9:06 a.m. UTC
Add net poll controller support to transmit kernel printks
over UDP

Signed-off-by: Bhaskar Upadhaya <bupadhaya@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.com>
---
 drivers/net/ethernet/qlogic/qede/qede.h      |  4 ++++
 drivers/net/ethernet/qlogic/qede/qede_fp.c   | 14 ++++++++++++++
 drivers/net/ethernet/qlogic/qede/qede_main.c |  3 +++
 3 files changed, 21 insertions(+)

Comments

Jakub Kicinski Jan. 17, 2021, 2:26 a.m. UTC | #1
On Fri, 15 Jan 2021 01:06:08 -0800 Bhaskar Upadhaya wrote:
> Add net poll controller support to transmit kernel printks
> over UDP

Why do you need this patch? Couple years back netpoll was taught 
how to pull NAPIs by itself, and all you do is schedule NAPIs.

All the driver should do is to make sure that when napi is called 
with budget of 0 it only processes Tx completions, not Rx traffic.
Igor Russkikh Jan. 17, 2021, 4:35 p.m. UTC | #2
> On Fri, 15 Jan 2021 01:06:08 -0800 Bhaskar Upadhaya wrote:
>> Add net poll controller support to transmit kernel printks
>> over UDP
> 
> Why do you need this patch? Couple years back netpoll was taught 
> how to pull NAPIs by itself, and all you do is schedule NAPIs.
> 
> All the driver should do is to make sure that when napi is called 
> with budget of 0 it only processes Tx completions, not Rx traffic.

Hi Jakub,

Thanks for the hint, we were not aware of that.

I see our driver may not handle zero budget accordingly. Will check.

But then, all this means .ndo_poll_controller is basically deprecated?

Regards,
   Igor
Jakub Kicinski Jan. 18, 2021, 7:10 p.m. UTC | #3
On Sun, 17 Jan 2021 17:35:30 +0100 Igor Russkikh wrote:
> > On Fri, 15 Jan 2021 01:06:08 -0800 Bhaskar Upadhaya wrote:  
> >> Add net poll controller support to transmit kernel printks
> >> over UDP  
> > 
> > Why do you need this patch? Couple years back netpoll was taught 
> > how to pull NAPIs by itself, and all you do is schedule NAPIs.
> > 
> > All the driver should do is to make sure that when napi is called 
> > with budget of 0 it only processes Tx completions, not Rx traffic.  
> 
> Hi Jakub,
> 
> Thanks for the hint, we were not aware of that.
> 
> I see our driver may not handle zero budget accordingly. Will check.
> 
> But then, all this means .ndo_poll_controller is basically deprecated?

It's still needed for special devices, off the top of my head for
example bonding uses it to poll its members. But for normal NIC
drivers, yes, it's pretty much deprecated.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h
index 3efc5899f656..ac12e5beb596 100644
--- a/drivers/net/ethernet/qlogic/qede/qede.h
+++ b/drivers/net/ethernet/qlogic/qede/qede.h
@@ -582,6 +582,10 @@  int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
 
 void qede_forced_speed_maps_init(void);
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+void qede_poll_controller(struct net_device *dev);
+#endif
+
 #define RX_RING_SIZE_POW	13
 #define RX_RING_SIZE		((u16)BIT(RX_RING_SIZE_POW))
 #define NUM_RX_BDS_MAX		(RX_RING_SIZE - 1)
diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c
index a2494bf85007..a626f1f45212 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_fp.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c
@@ -1804,3 +1804,17 @@  netdev_features_t qede_features_check(struct sk_buff *skb,
 
 	return features;
 }
+
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/* This is used by netconsole to send skbs without having to re-enable
+ * interrupts.It's not called while the normal interrupt routine is executing.
+ */
+void qede_poll_controller(struct net_device *dev)
+{
+	struct qede_dev *edev = netdev_priv(dev);
+	int i;
+
+	for_each_queue(i)
+		napi_schedule(&edev->fp_array[i].napi);
+}
+#endif
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 05e3a3b60269..2ff6c49de745 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -644,6 +644,9 @@  static const struct net_device_ops qede_netdev_ops = {
 	.ndo_set_rx_mode	= qede_set_rx_mode,
 	.ndo_set_mac_address	= qede_set_mac_addr,
 	.ndo_validate_addr	= eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller = qede_poll_controller,
+#endif
 	.ndo_change_mtu		= qede_change_mtu,
 	.ndo_do_ioctl		= qede_ioctl,
 	.ndo_tx_timeout		= qede_tx_timeout,