ionic: add private workqueue per-device

Instead of using the system's default workqueue, add a private
workqueue for the device to use for its little jobs.  This is
to better support the new work items we will be adding in the
next patches for PF and VF specific jobs, without inundating
the system workqueue in a couple of customer cases where our
devices get scaled out to 100-200 VFs.

Signed-off-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Link: https://lore.kernel.org/r/20240619003257.6138-4-shannon.nelson@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Shannon Nelson 2024-06-18 17:32:52 -07:00 committed by Jakub Kicinski
parent d458d4b4fd
commit 9e25450da7
5 changed files with 27 additions and 13 deletions

View File

@ -47,6 +47,7 @@ struct ionic {
struct ionic_dev_bar bars[IONIC_BARS_MAX];
unsigned int num_bars;
struct ionic_identity ident;
struct workqueue_struct *wq;
struct ionic_lif *lif;
unsigned int nnqs_per_lif;
unsigned int neqs_per_lif;

View File

@ -43,11 +43,11 @@ static void ionic_watchdog_cb(struct timer_list *t)
work->type = IONIC_DW_TYPE_RX_MODE;
netdev_dbg(lif->netdev, "deferred: rx_mode\n");
ionic_lif_deferred_enqueue(&lif->deferred, work);
ionic_lif_deferred_enqueue(lif, work);
}
}
static void ionic_watchdog_init(struct ionic *ionic)
static int ionic_watchdog_init(struct ionic *ionic)
{
struct ionic_dev *idev = &ionic->idev;
@ -63,6 +63,15 @@ static void ionic_watchdog_init(struct ionic *ionic)
idev->fw_status_ready = true;
idev->fw_generation = IONIC_FW_STS_F_GENERATION &
ioread8(&idev->dev_info_regs->fw_status);
ionic->wq = alloc_workqueue("%s-wq", WQ_UNBOUND, 0,
dev_name(ionic->dev));
if (!ionic->wq) {
dev_err(ionic->dev, "alloc_workqueue failed");
return -ENOMEM;
}
return 0;
}
void ionic_init_devinfo(struct ionic *ionic)
@ -94,6 +103,7 @@ int ionic_dev_setup(struct ionic *ionic)
struct device *dev = ionic->dev;
int size;
u32 sig;
int err;
/* BAR0: dev_cmd and interrupts */
if (num_bars < 1) {
@ -129,7 +139,9 @@ int ionic_dev_setup(struct ionic *ionic)
return -EFAULT;
}
ionic_watchdog_init(ionic);
err = ionic_watchdog_init(ionic);
if (err)
return err;
idev->db_pages = bar->vaddr;
idev->phy_db_pages = bar->bus_addr;
@ -161,6 +173,7 @@ void ionic_dev_teardown(struct ionic *ionic)
idev->phy_cmb_pages = 0;
idev->cmb_npages = 0;
destroy_workqueue(ionic->wq);
mutex_destroy(&idev->cmb_inuse_lock);
}
@ -273,7 +286,7 @@ int ionic_heartbeat_check(struct ionic *ionic)
if (work) {
work->type = IONIC_DW_TYPE_LIF_RESET;
work->fw_status = fw_status_ready;
ionic_lif_deferred_enqueue(&lif->deferred, work);
ionic_lif_deferred_enqueue(lif, work);
}
}
}

View File

@ -126,13 +126,13 @@ static void ionic_lif_deferred_work(struct work_struct *work)
} while (true);
}
void ionic_lif_deferred_enqueue(struct ionic_deferred *def,
void ionic_lif_deferred_enqueue(struct ionic_lif *lif,
struct ionic_deferred_work *work)
{
spin_lock_bh(&def->lock);
list_add_tail(&work->list, &def->list);
spin_unlock_bh(&def->lock);
schedule_work(&def->work);
spin_lock_bh(&lif->deferred.lock);
list_add_tail(&work->list, &lif->deferred.list);
spin_unlock_bh(&lif->deferred.lock);
queue_work(lif->ionic->wq, &lif->deferred.work);
}
static void ionic_link_status_check(struct ionic_lif *lif)
@ -207,7 +207,7 @@ void ionic_link_status_check_request(struct ionic_lif *lif, bool can_sleep)
}
work->type = IONIC_DW_TYPE_LINK_STATUS;
ionic_lif_deferred_enqueue(&lif->deferred, work);
ionic_lif_deferred_enqueue(lif, work);
} else {
ionic_link_status_check(lif);
}
@ -1389,7 +1389,7 @@ static void ionic_ndo_set_rx_mode(struct net_device *netdev)
}
work->type = IONIC_DW_TYPE_RX_MODE;
netdev_dbg(lif->netdev, "deferred: rx_mode\n");
ionic_lif_deferred_enqueue(&lif->deferred, work);
ionic_lif_deferred_enqueue(lif, work);
}
static __le64 ionic_netdev_features_to_nic(netdev_features_t features)

View File

@ -331,7 +331,7 @@ static inline bool ionic_txq_hwstamp_enabled(struct ionic_queue *q)
void ionic_link_status_check_request(struct ionic_lif *lif, bool can_sleep);
void ionic_get_stats64(struct net_device *netdev,
struct rtnl_link_stats64 *ns);
void ionic_lif_deferred_enqueue(struct ionic_deferred *def,
void ionic_lif_deferred_enqueue(struct ionic_lif *lif,
struct ionic_deferred_work *work);
int ionic_lif_alloc(struct ionic *ionic);
int ionic_lif_init(struct ionic_lif *lif);

View File

@ -287,7 +287,7 @@ bool ionic_notifyq_service(struct ionic_cq *cq)
clear_bit(IONIC_LIF_F_FW_STOPPING, lif->state);
} else {
work->type = IONIC_DW_TYPE_LIF_RESET;
ionic_lif_deferred_enqueue(&lif->deferred, work);
ionic_lif_deferred_enqueue(lif, work);
}
}
break;