]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: ngbevf: init interrupts and request irqs
authorMengyuan Lou <mengyuanlou@net-swift.com>
Fri, 4 Jul 2025 09:49:22 +0000 (17:49 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 10 Jul 2025 01:39:14 +0000 (18:39 -0700)
Add specific parameters for irq alloc, then use
wx_init_interrupt_scheme to initialize interrupt
allocation in probe.
Add .ndo_start_xmit support and start all queues.

Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
Link: https://patch.msgid.link/20250704094923.652-12-mengyuanlou@net-swift.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/wangxun/ngbevf/ngbevf_main.c
drivers/net/ethernet/wangxun/ngbevf/ngbevf_type.h

index 4eea682f024b92171040fd7eef380eee4ee0a7e8..a629b645d3a12755567a28e0029f578e2e8e717b 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "../libwx/wx_type.h"
 #include "../libwx/wx_hw.h"
+#include "../libwx/wx_lib.h"
 #include "../libwx/wx_mbx.h"
 #include "../libwx/wx_vf.h"
 #include "../libwx/wx_vf_common.h"
@@ -43,10 +44,18 @@ static const struct pci_device_id ngbevf_pci_tbl[] = {
 static const struct net_device_ops ngbevf_netdev_ops = {
        .ndo_open               = wxvf_open,
        .ndo_stop               = wxvf_close,
+       .ndo_start_xmit         = wx_xmit_frame,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = wx_set_mac_vf,
 };
 
+static void ngbevf_set_num_queues(struct wx *wx)
+{
+       /* Start with base case */
+       wx->num_rx_queues = 1;
+       wx->num_tx_queues = 1;
+}
+
 static int ngbevf_sw_init(struct wx *wx)
 {
        struct net_device *netdev = wx->netdev;
@@ -65,6 +74,7 @@ static int ngbevf_sw_init(struct wx *wx)
 
        /* Initialize the device type */
        wx->mac.type = wx_mac_em;
+       wx->mac.max_msix_vectors = NGBEVF_MAX_MSIX_VECTORS;
        /* lock to protect mailbox accesses */
        spin_lock_init(&wx->mbx.mbx_lock);
 
@@ -98,6 +108,7 @@ static int ngbevf_sw_init(struct wx *wx)
        /* set default work limits */
        wx->tx_work_limit = NGBEVF_DEFAULT_TX_WORK;
        wx->rx_work_limit = NGBEVF_DEFAULT_RX_WORK;
+       wx->set_num_queues = ngbevf_set_num_queues;
 
        return 0;
 err_reset_hw:
@@ -186,15 +197,22 @@ static int ngbevf_probe(struct pci_dev *pdev,
        eth_hw_addr_set(netdev, wx->mac.perm_addr);
        ether_addr_copy(netdev->perm_addr, wx->mac.addr);
 
+       err = wx_init_interrupt_scheme(wx);
+       if (err)
+               goto err_free_sw_init;
+
        err = register_netdev(netdev);
        if (err)
                goto err_register;
 
        pci_set_drvdata(pdev, wx);
+       netif_tx_stop_all_queues(netdev);
 
        return 0;
 
 err_register:
+       wx_clear_interrupt_scheme(wx);
+err_free_sw_init:
        kfree(wx->vfinfo);
        kfree(wx->rss_key);
        kfree(wx->mac_table);
index dc29349304f1f56faad4b4a42805e731d90d1f32..67e761089e997664d43a1225da94fa73f024088e 100644 (file)
@@ -18,6 +18,7 @@
 #define NGBEVF_DEV_ID_EM_WX1860A1               0x011a
 #define NGBEVF_DEV_ID_EM_WX1860AL1              0x011b
 
+#define NGBEVF_MAX_MSIX_VECTORS               1
 #define NGBEVF_MAX_RX_QUEUES                  1
 #define NGBEVF_MAX_TX_QUEUES                  1
 #define NGBEVF_DEFAULT_TXD                    128