Skip to content

Commit 184fe6f

Browse files
Michael Chanrleon
authored andcommitted
bnxt_en: Add ULP call to notify async events
When the driver receives an async event notification from the Firmware, we make the new ulp_async_notifier() call to inform the RDMA driver that a firmware async event has been received. RDMA driver can then take necessary actions based on the event type. In the next patch, we will implement the ulp_async_notifier() callbacks in the RDMA driver. Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Link: https://patch.msgid.link/20250107024553.2926983-2-kalesh-anakkur.purayil@broadcom.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 235f238 commit 184fe6f

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,6 +2857,7 @@ static int bnxt_async_event_process(struct bnxt *bp,
28572857
}
28582858
__bnxt_queue_sp_work(bp);
28592859
async_event_process_exit:
2860+
bnxt_ulp_async_events(bp, cmpl);
28602861
return 0;
28612862
}
28622863

drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,34 @@ void bnxt_ulp_irq_restart(struct bnxt *bp, int err)
345345
}
346346
}
347347

348+
void bnxt_ulp_async_events(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl)
349+
{
350+
u16 event_id = le16_to_cpu(cmpl->event_id);
351+
struct bnxt_en_dev *edev = bp->edev;
352+
struct bnxt_ulp_ops *ops;
353+
struct bnxt_ulp *ulp;
354+
355+
if (!bnxt_ulp_registered(edev))
356+
return;
357+
ulp = edev->ulp_tbl;
358+
359+
rcu_read_lock();
360+
361+
ops = rcu_dereference(ulp->ulp_ops);
362+
if (!ops || !ops->ulp_async_notifier)
363+
goto exit_unlock_rcu;
364+
if (!ulp->async_events_bmap || event_id > ulp->max_async_event_id)
365+
goto exit_unlock_rcu;
366+
367+
/* Read max_async_event_id first before testing the bitmap. */
368+
smp_rmb();
369+
370+
if (test_bit(event_id, ulp->async_events_bmap))
371+
ops->ulp_async_notifier(ulp->handle, cmpl);
372+
exit_unlock_rcu:
373+
rcu_read_unlock();
374+
}
375+
348376
int bnxt_register_async_events(struct bnxt_en_dev *edev,
349377
unsigned long *events_bmap,
350378
u16 max_id)

drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ struct bnxt_msix_entry {
3030
};
3131

3232
struct bnxt_ulp_ops {
33+
/* async_notifier() cannot sleep (in BH context) */
34+
void (*ulp_async_notifier)(void *, struct hwrm_async_event_cmpl *);
3335
void (*ulp_irq_stop)(void *);
3436
void (*ulp_irq_restart)(void *, struct bnxt_msix_entry *);
3537
};

0 commit comments

Comments
 (0)