Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dsc-drivers: update ionic drivers to 24.03.4-003 #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,18 @@ As usual, if the Linux headers are elsewhere, add the appropriate -C magic:
- fix 16bit math issue when PAGE_SIZE >= 64KB
- restrict page-cache allocation to Rx queues

23-12-14 - driver update for 23.12.2-001
2023-12-14 - driver update for 23.12.2-001
- updates from upstream kernel fixes
- updates to FLR handling
- added AER error handling

24-03-19 - driver update for 24.03.1-002
2024-03-19 - driver update for 24.03.1-002
- Add XDP support
- Refactor Tx and Rx fast paths for performance
- Refactor struct sizes, layout, and usage for memory savings and performance

2024-04-03 - driver update for 24.03.4-002
- Fix to reduce impact of missed doorbell workaround

24-04-16 - driver update for 24.03.4-003
- Doorbell workaround now uses AdminQ's last used cpu
2 changes: 1 addition & 1 deletion drivers/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ALL = eth
endif

ifeq ($(DVER),)
DVER = "24.03.1-002"
DVER = "24.03.4-003"
endif
KCFLAGS += -Ddrv_ver=\\\"$(DVER)\\\"

Expand Down
1 change: 1 addition & 0 deletions drivers/linux/eth/ionic/ionic.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct ionic {
struct rw_semaphore vf_op_lock; /* lock for VF operations */
struct ionic_vf *vfs;
int num_vfs;
struct timer_list doorbell_timer;
struct timer_list watchdog_timer;
int watchdog_period;
};
Expand Down
4 changes: 4 additions & 0 deletions drivers/linux/eth/ionic/ionic_bus_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_out_deregister_devlink;
}

mod_timer(&ionic->doorbell_timer, jiffies + IONIC_NAPI_DEADLINE);
mod_timer(&ionic->watchdog_timer,
round_jiffies(jiffies + ionic->watchdog_period));

Expand Down Expand Up @@ -470,6 +471,7 @@ static void ionic_remove(struct pci_dev *pdev)
if (ionic->lif)
set_bit(IONIC_LIF_F_IN_SHUTDOWN, ionic->lif->state);

del_timer_sync(&ionic->doorbell_timer);
del_timer_sync(&ionic->watchdog_timer);

if (ionic->lif) {
Expand Down Expand Up @@ -509,6 +511,7 @@ void ionic_reset_prepare(struct pci_dev *pdev)
* scheduled and render these del/cancel calls useless (i.e. don't mix
* device triggered resets with userspace triggered resets).
*/
del_timer_sync(&ionic->doorbell_timer);
del_timer_sync(&ionic->watchdog_timer);

mutex_lock(&lif->queue_lock);
Expand Down Expand Up @@ -542,6 +545,7 @@ void ionic_reset_done(struct pci_dev *pdev)
if (err)
goto err_out;

mod_timer(&ionic->doorbell_timer, jiffies + IONIC_NAPI_DEADLINE);
mod_timer(&ionic->watchdog_timer, jiffies + 1);

err_out:
Expand Down
4 changes: 4 additions & 0 deletions drivers/linux/eth/ionic/ionic_bus_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ static int ionic_mnic_dev_setup(struct ionic *ionic)
return -EFAULT;

ionic_init_devinfo(ionic);

timer_setup(&ionic->doorbell_timer, ionic_doorbell_cb, 0);
ionic_watchdog_init(ionic);

idev->db_pages = ionic->bars[IONIC_DOORBELL_BAR].vaddr;
Expand Down Expand Up @@ -403,6 +405,7 @@ int ionic_probe(struct platform_device *pfdev)
goto err_out_deinit_lifs;
}

mod_timer(&ionic->doorbell_timer, jiffies + IONIC_NAPI_DEADLINE);
mod_timer(&ionic->watchdog_timer,
round_jiffies(jiffies + ionic->watchdog_period));

Expand Down Expand Up @@ -430,6 +433,7 @@ int ionic_remove(struct platform_device *pfdev)
struct ionic *ionic = platform_get_drvdata(pfdev);

if (ionic) {
del_timer_sync(&ionic->doorbell_timer);
del_timer_sync(&ionic->watchdog_timer);
ionic_lif_unregister(ionic->lif);
ionic_lif_deinit(ionic->lif);
Expand Down
12 changes: 12 additions & 0 deletions drivers/linux/eth/ionic/ionic_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,16 @@ static int lif_n_txrx_alloc_show(struct seq_file *seq, void *v)
}
DEFINE_SHOW_ATTRIBUTE(lif_n_txrx_alloc);

static int lif_adminq_cpu_show(struct seq_file *seq, void *v)
{
struct ionic_lif *lif = seq->private;

seq_printf(seq, "%u\n", lif->adminq_cpu);

return 0;
}
DEFINE_SHOW_ATTRIBUTE(lif_adminq_cpu);

void ionic_debugfs_add_lif(struct ionic_lif *lif)
{
struct dentry *lif_dentry;
Expand All @@ -538,6 +548,8 @@ void ionic_debugfs_add_lif(struct ionic_lif *lif)
lif, &lif_filters_fops);
debugfs_create_file("txrx_alloc", 0400, lif->dentry,
lif, &lif_n_txrx_alloc_fops);
debugfs_create_file("adminq_cpu", 0400, lif->dentry,
lif, &lif_adminq_cpu_fops);
}

void ionic_debugfs_del_lif(struct ionic_lif *lif)
Expand Down
29 changes: 23 additions & 6 deletions drivers/linux/eth/ionic/ionic_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ 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, &lif->deferred, work);
}
}

Expand All @@ -73,6 +73,26 @@ void ionic_watchdog_init(struct ionic *ionic)
ioread8(&idev->dev_info_regs->fw_status);
}

void ionic_doorbell_cb(struct timer_list *timer)
{
struct ionic *ionic = container_of(timer, struct ionic, doorbell_timer);
struct ionic_lif *lif = ionic->lif;
struct ionic_deferred_work *work;

if (test_bit(IONIC_LIF_F_IN_SHUTDOWN, lif->state))
return;

if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) {
work = kzalloc(sizeof(*work), GFP_ATOMIC);
if (work) {
work->type = IONIC_DW_TYPE_DOORBELL;
ionic_lif_deferred_enqueue(lif, &lif->deferred, work);
}
}

mod_timer(&ionic->doorbell_timer, jiffies + IONIC_ADMIN_DOORBELL_DEADLINE);
}

void ionic_init_devinfo(struct ionic *ionic)
{
struct ionic_dev *idev = &ionic->idev;
Expand Down Expand Up @@ -137,6 +157,7 @@ int ionic_dev_setup(struct ionic *ionic)
return -EFAULT;
}

timer_setup(&ionic->doorbell_timer, ionic_doorbell_cb, 0);
ionic_watchdog_init(ionic);

idev->db_pages = bar->vaddr;
Expand Down Expand Up @@ -281,7 +302,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, &lif->deferred, work);
}
}
}
Expand Down Expand Up @@ -724,10 +745,6 @@ void ionic_q_post(struct ionic_queue *q, bool ring_doorbell)
q->dbval | q->head_idx);

q->dbell_jiffies = jiffies;

if (q_to_qcq(q)->napi_qcq)
mod_timer(&q_to_qcq(q)->napi_qcq->napi_deadline,
jiffies + IONIC_NAPI_DEADLINE);
}
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/linux/eth/ionic/ionic_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define IONIC_DEV_INFO_REG_COUNT 32
#define IONIC_DEV_CMD_REG_COUNT 32

#define IONIC_NAPI_DEADLINE (HZ / 200) /* 5ms */
#define IONIC_NAPI_DEADLINE (HZ / 50) /* 20ms */
#define IONIC_ADMIN_DOORBELL_DEADLINE (HZ / 2) /* 500ms */
#define IONIC_TX_DOORBELL_DEADLINE (HZ / 100) /* 10ms */
#define IONIC_RX_MIN_DOORBELL_DEADLINE (HZ / 100) /* 10ms */
Expand Down Expand Up @@ -423,6 +423,7 @@ bool ionic_q_is_posted(struct ionic_queue *q, unsigned int pos);

int ionic_heartbeat_check(struct ionic *ionic);
bool ionic_is_fw_running(struct ionic_dev *idev);
void ionic_doorbell_cb(struct timer_list *timer);
void ionic_watchdog_cb(struct timer_list *t);
void ionic_watchdog_init(struct ionic *ionic);

Expand Down
92 changes: 59 additions & 33 deletions drivers/linux/eth/ionic/ionic_lif.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,41 @@ static void ionic_dim_work(struct work_struct *work)
dim->state = DIM_START_MEASURE;
}

static void ionic_doorbell_check(struct ionic_lif *lif)
{
if (test_bit(IONIC_LIF_F_FW_RESET, lif->state) ||
test_bit(IONIC_LIF_F_IN_SHUTDOWN, lif->state))
return;

mutex_lock(&lif->queue_lock);

napi_schedule(&lif->adminqcq->napi);

if (test_bit(IONIC_LIF_F_UP, lif->state)) {
int i;

for (i = 0; i < lif->nxqs; i++) {
struct ionic_qcq *qcq;

qcq = lif->txqcqs[i];
if (qcq->flags & IONIC_QCQ_F_INTR)
napi_schedule(&qcq->napi);

qcq = lif->rxqcqs[i];
if (qcq->flags & IONIC_QCQ_F_INTR)
napi_schedule(&qcq->napi);
}

if (lif->hwstamp_txq &&
lif->hwstamp_txq->flags & IONIC_QCQ_F_INTR)
napi_schedule(&lif->hwstamp_txq->napi);
if (lif->hwstamp_rxq &&
lif->hwstamp_rxq->flags & IONIC_QCQ_F_INTR)
napi_schedule(&lif->hwstamp_rxq->napi);
}
mutex_unlock(&lif->queue_lock);
}

static void ionic_lif_deferred_work(struct work_struct *work)
{
struct ionic_lif *lif = container_of(work, struct ionic_lif, deferred.work);
Expand All @@ -112,6 +147,9 @@ static void ionic_lif_deferred_work(struct work_struct *work)
case IONIC_DW_TYPE_LINK_STATUS:
ionic_link_status_check(lif);
break;
case IONIC_DW_TYPE_DOORBELL:
ionic_doorbell_check(lif);
break;
case IONIC_DW_TYPE_LIF_RESET:
if (w->fw_status) {
ionic_lif_handle_fw_up(lif);
Expand All @@ -134,13 +172,14 @@ 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 *def,
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);
schedule_work_on(lif->adminq_cpu, &def->work);
}

static void ionic_link_status_check(struct ionic_lif *lif)
Expand Down Expand Up @@ -217,19 +256,12 @@ 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, &lif->deferred, work);
} else {
ionic_link_status_check(lif);
}
}

static void ionic_napi_deadline(struct timer_list *timer)
{
struct ionic_qcq *qcq = container_of(timer, struct ionic_qcq, napi_deadline);

napi_schedule(&qcq->napi);
}

static irqreturn_t ionic_isr(int irq, void *data)
{
struct napi_struct *napi = data;
Expand Down Expand Up @@ -347,7 +379,6 @@ static int ionic_qcq_disable(struct ionic_lif *lif, struct ionic_qcq *qcq, int f

if (qcq->napi.poll) {
napi_disable(&qcq->napi);
del_timer_sync(&qcq->napi_deadline);
synchronize_net();
}

Expand Down Expand Up @@ -503,7 +534,6 @@ static void ionic_link_qcq_interrupts(struct ionic_qcq *src_qcq,

n_qcq->intr.vector = src_qcq->intr.vector;
n_qcq->intr.index = src_qcq->intr.index;
n_qcq->napi_qcq = src_qcq->napi_qcq;
}

static int ionic_alloc_qcq_interrupt(struct ionic_lif *lif, struct ionic_qcq *qcq)
Expand Down Expand Up @@ -895,11 +925,8 @@ static int ionic_lif_txq_init(struct ionic_lif *lif, struct ionic_qcq *qcq)
q->dbell_deadline = IONIC_TX_DOORBELL_DEADLINE;
q->dbell_jiffies = jiffies;

if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) {
if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state))
netif_napi_add(lif->netdev, &qcq->napi, ionic_tx_napi);
qcq->napi_qcq = qcq;
timer_setup(&qcq->napi_deadline, ionic_napi_deadline, 0);
}

qcq->flags |= IONIC_QCQ_F_INITED;

Expand Down Expand Up @@ -977,9 +1004,6 @@ static int ionic_lif_rxq_init(struct ionic_lif *lif, struct ionic_qcq *qcq)
else
netif_napi_add(lif->netdev, &qcq->napi, ionic_txrx_napi);

qcq->napi_qcq = qcq;
timer_setup(&qcq->napi_deadline, ionic_napi_deadline, 0);

qcq->flags |= IONIC_QCQ_F_INITED;

return 0;
Expand Down Expand Up @@ -1234,7 +1258,6 @@ static int ionic_adminq_napi(struct napi_struct *napi, int budget)
struct ionic_dev *idev = &lif->ionic->idev;
unsigned long irqflags;
unsigned int flags = 0;
bool resched = false;
int rx_work = 0;
int tx_work = 0;
int n_work = 0;
Expand Down Expand Up @@ -1271,15 +1294,14 @@ static int ionic_adminq_napi(struct napi_struct *napi, int budget)
ionic_intr_credits(idev->intr_ctrl, intr->index, credits, flags);
}

if (!a_work && ionic_adminq_poke_doorbell(&lif->adminqcq->q))
resched = true;
if (lif->hwstamp_rxq && !rx_work && ionic_rxq_poke_doorbell(&lif->hwstamp_rxq->q))
resched = true;
if (lif->hwstamp_txq && !tx_work && ionic_txq_poke_doorbell(&lif->hwstamp_txq->q))
resched = true;
if (resched)
mod_timer(&lif->adminqcq->napi_deadline,
jiffies + IONIC_NAPI_DEADLINE);
if (!a_work)
ionic_adminq_poke_doorbell(&lif->adminqcq->q);
if (lif->hwstamp_rxq && !rx_work)
ionic_rxq_poke_doorbell(&lif->hwstamp_rxq->q);
if (lif->hwstamp_txq && !tx_work)
ionic_txq_poke_doorbell(&lif->hwstamp_txq->q);

lif->adminq_cpu = smp_processor_id();

return work_done;
}
Expand Down Expand Up @@ -1463,7 +1485,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, &lif->deferred, work);
}

static __le64 ionic_netdev_features_to_nic(netdev_features_t features)
Expand Down Expand Up @@ -3760,9 +3782,6 @@ static int ionic_lif_adminq_init(struct ionic_lif *lif)

netif_napi_add(lif->netdev, &qcq->napi, ionic_adminq_napi);

qcq->napi_qcq = qcq;
timer_setup(&qcq->napi_deadline, ionic_napi_deadline, 0);

napi_enable(&qcq->napi);

if (qcq->flags & IONIC_QCQ_F_INTR) {
Expand All @@ -3774,6 +3793,13 @@ static int ionic_lif_adminq_init(struct ionic_lif *lif)

qcq->flags |= IONIC_QCQ_F_INITED;

/* Start the tracking with the current cpu rather than the
* default 0 starting place. This helps spread the scheduled
* work item load when VFs are brought up on multiple PFs by
* userland commands that will be on various cpus.
*/
lif->adminq_cpu = smp_processor_id();

return 0;
}

Expand Down
Loading