From: Daniel Zahka <daniel.zahka@gmail.com>
To: Alexander Duyck <alexanderduyck@fb.com>,
Jakub Kicinski <kuba@kernel.org>,
kernel-team@meta.com, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 2/4] eth: mpnic: add a service task
Date: Thu, 01 Oct 2026 09:38:59 -0700 [thread overview]
Message-ID: <20261001-linux-mpnic-v1-2-6422ee74233a@gmail.com> (raw)
In-Reply-To: <20261001-linux-mpnic-v1-0-6422ee74233a@gmail.com>
Add a service task that runs while the netdevice is running. For now,
the service task does nothing besides conditionally reschedule itself.
Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
drivers/net/ethernet/meta/mpnic/mpnic.h | 3 +++
drivers/net/ethernet/meta/mpnic/mpnic_netdev.c | 3 +++
drivers/net/ethernet/meta/mpnic/mpnic_pci.c | 17 +++++++++++++++++
3 files changed, 23 insertions(+)
diff --git a/drivers/net/ethernet/meta/mpnic/mpnic.h b/drivers/net/ethernet/meta/mpnic/mpnic.h
index 78359ab6abb1..8b08af0fadcc 100644
--- a/drivers/net/ethernet/meta/mpnic/mpnic.h
+++ b/drivers/net/ethernet/meta/mpnic/mpnic.h
@@ -7,6 +7,7 @@
#include <linux/interrupt.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/types.h>
+#include <linux/workqueue.h>
#include "mpnic_csr.h"
@@ -27,6 +28,8 @@ struct mpnic_dev {
u32 __iomem *uc_addr0;
+ struct delayed_work service_task;
+
u16 num_irqs;
u64 dsn;
diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c b/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c
index 2c0309d0c221..bd10df4a9d46 100644
--- a/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c
+++ b/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c
@@ -35,6 +35,8 @@ static int mpnic_open(struct net_device *netdev)
netif_tx_wake_all_queues(netdev);
netif_carrier_on(netdev);
+ schedule_delayed_work(&mpn->mpd->service_task, HZ);
+
return 0;
err_free_resources:
@@ -48,6 +50,7 @@ static int mpnic_stop(struct net_device *netdev)
{
struct mpnic_net *mpn = netdev_priv(netdev);
+ cancel_delayed_work(&mpn->mpd->service_task);
netif_carrier_off(netdev);
mpnic_napi_disable(mpn);
diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_pci.c b/drivers/net/ethernet/meta/mpnic/mpnic_pci.c
index 968cd611b8ea..17eae5a9ba16 100644
--- a/drivers/net/ethernet/meta/mpnic/mpnic_pci.c
+++ b/drivers/net/ethernet/meta/mpnic/mpnic_pci.c
@@ -53,6 +53,20 @@ u64 mpnic_rd64(struct mpnic_dev *mpd, u32 reg)
return ~0ULL;
}
+static void mpnic_service_task(struct work_struct *work)
+{
+ struct mpnic_dev *mpd = container_of(to_delayed_work(work),
+ struct mpnic_dev, service_task);
+ struct net_device *netdev = mpd->netdev;
+
+ netdev_lock(netdev);
+
+ if (netif_running(netdev))
+ schedule_delayed_work(&mpd->service_task, HZ);
+
+ netdev_unlock(netdev);
+}
+
static struct mpnic_dev *mpnic_alloc(struct pci_dev *pdev)
{
struct mpnic_dev *mpd;
@@ -69,6 +83,8 @@ static struct mpnic_dev *mpnic_alloc(struct pci_dev *pdev)
mpd->readrq = pcie_get_readrq(pdev);
mpd->relaxed_ord = pcie_relaxed_ordering_enabled(pdev);
+ INIT_DELAYED_WORK(&mpd->service_task, mpnic_service_task);
+
return mpd;
}
@@ -162,6 +178,7 @@ static void mpnic_remove(struct pci_dev *pdev)
struct mpnic_dev *mpd = pci_get_drvdata(pdev);
unregister_netdev(mpd->netdev);
+ cancel_delayed_work_sync(&mpd->service_task);
mpnic_netdev_free(mpd);
mpnic_free_irqs(mpd);
kfree(mpd);
--
2.52.0
next prev parent reply other threads:[~2026-10-01 16:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 16:38 [PATCH net-next 0/4] mpnic: add NAPI buffer depletion check Daniel Zahka
2026-10-01 16:38 ` [PATCH net-next 1/4] eth: mpnic: use WRITE_ONCE() for BDQ head and tail updates Daniel Zahka
2026-10-01 16:38 ` Daniel Zahka [this message]
2026-10-01 16:39 ` [PATCH net-next 3/4] eth: mpnic: set Rx buffer minimums using page size and mtu Daniel Zahka
2026-10-03 0:50 ` Harshitha Ramamurthy
2026-10-01 16:39 ` [PATCH net-next 4/4] eth: mpnic: add a NAPI depletion check Daniel Zahka
2026-10-03 0:53 ` Harshitha Ramamurthy
2026-10-01 16:45 ` [PATCH net-next 0/4] mpnic: add NAPI buffer " netdev-bot+sinfo
2026-10-01 18:26 ` Daniel Zahka
2026-10-03 0:54 ` Harshitha Ramamurthy
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=20261001-linux-mpnic-v1-2-6422ee74233a@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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
all inboxes | Powered by JetHome®