Commit 58608082 authored by Nikita Danilov's avatar Nikita Danilov Committed by David S. Miller

net: aquantia: create global service workqueue

We need this to schedule link interrupt handling and
various service tasks.
Signed-off-by: default avatarNikita Danilov <ndanilov@aquantia.com>
Signed-off-by: default avatarIgor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1d2a8a13
...@@ -23,8 +23,17 @@ MODULE_VERSION(AQ_CFG_DRV_VERSION); ...@@ -23,8 +23,17 @@ MODULE_VERSION(AQ_CFG_DRV_VERSION);
MODULE_AUTHOR(AQ_CFG_DRV_AUTHOR); MODULE_AUTHOR(AQ_CFG_DRV_AUTHOR);
MODULE_DESCRIPTION(AQ_CFG_DRV_DESC); MODULE_DESCRIPTION(AQ_CFG_DRV_DESC);
const char aq_ndev_driver_name[] = AQ_CFG_DRV_NAME;
static const struct net_device_ops aq_ndev_ops; static const struct net_device_ops aq_ndev_ops;
static struct workqueue_struct *aq_ndev_wq;
void aq_ndev_schedule_work(struct work_struct *work)
{
queue_work(aq_ndev_wq, work);
}
struct net_device *aq_ndev_alloc(void) struct net_device *aq_ndev_alloc(void)
{ {
struct net_device *ndev = NULL; struct net_device *ndev = NULL;
...@@ -209,3 +218,35 @@ static const struct net_device_ops aq_ndev_ops = { ...@@ -209,3 +218,35 @@ static const struct net_device_ops aq_ndev_ops = {
.ndo_vlan_rx_add_vid = aq_ndo_vlan_rx_add_vid, .ndo_vlan_rx_add_vid = aq_ndo_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = aq_ndo_vlan_rx_kill_vid, .ndo_vlan_rx_kill_vid = aq_ndo_vlan_rx_kill_vid,
}; };
static int __init aq_ndev_init_module(void)
{
int ret;
aq_ndev_wq = create_singlethread_workqueue(aq_ndev_driver_name);
if (!aq_ndev_wq) {
pr_err("Failed to create workqueue\n");
return -ENOMEM;
}
ret = aq_pci_func_register_driver();
if (ret) {
destroy_workqueue(aq_ndev_wq);
return ret;
}
return 0;
}
static void __exit aq_ndev_exit_module(void)
{
aq_pci_func_unregister_driver();
if (aq_ndev_wq) {
destroy_workqueue(aq_ndev_wq);
aq_ndev_wq = NULL;
}
}
module_init(aq_ndev_init_module);
module_exit(aq_ndev_exit_module);
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
#define AQ_MAIN_H #define AQ_MAIN_H
#include "aq_common.h" #include "aq_common.h"
#include "aq_nic.h"
void aq_ndev_schedule_work(struct work_struct *work);
struct net_device *aq_ndev_alloc(void); struct net_device *aq_ndev_alloc(void);
#endif /* AQ_MAIN_H */ #endif /* AQ_MAIN_H */
...@@ -368,4 +368,13 @@ static struct pci_driver aq_pci_ops = { ...@@ -368,4 +368,13 @@ static struct pci_driver aq_pci_ops = {
.shutdown = aq_pci_shutdown, .shutdown = aq_pci_shutdown,
}; };
module_pci_driver(aq_pci_ops); int aq_pci_func_register_driver(void)
{
return pci_register_driver(&aq_pci_ops);
}
void aq_pci_func_unregister_driver(void)
{
pci_unregister_driver(&aq_pci_ops);
}
...@@ -29,4 +29,7 @@ int aq_pci_func_alloc_irq(struct aq_nic_s *self, unsigned int i, ...@@ -29,4 +29,7 @@ int aq_pci_func_alloc_irq(struct aq_nic_s *self, unsigned int i,
void aq_pci_func_free_irqs(struct aq_nic_s *self); void aq_pci_func_free_irqs(struct aq_nic_s *self);
unsigned int aq_pci_func_get_irq_type(struct aq_nic_s *self); unsigned int aq_pci_func_get_irq_type(struct aq_nic_s *self);
int aq_pci_func_register_driver(void);
void aq_pci_func_unregister_driver(void);
#endif /* AQ_PCI_FUNC_H */ #endif /* AQ_PCI_FUNC_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment