RDMA/bnxt_re: Add Async event handling support
Using the option provided by Ethernet driver, register for FW Async event. During probe, while registeriung with Ethernet driver, provide the ulp hook 'ulp_async_notifier' for receiving the firmware events. 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-3-kalesh-anakkur.purayil@broadcom.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
184fe6f238
commit
7fea327840
4 changed files with 44 additions and 6 deletions
|
@ -229,6 +229,7 @@ struct bnxt_re_dev {
|
|||
DECLARE_HASHTABLE(srq_hash, MAX_SRQ_HASH_BITS);
|
||||
struct dentry *dbg_root;
|
||||
struct dentry *qp_debugfs;
|
||||
unsigned long event_bitmap;
|
||||
};
|
||||
|
||||
#define to_bnxt_re_dev(ptr, member) \
|
||||
|
|
|
@ -295,6 +295,20 @@ static void bnxt_re_vf_res_config(struct bnxt_re_dev *rdev)
|
|||
&rdev->qplib_ctx);
|
||||
}
|
||||
|
||||
static void bnxt_re_async_notifier(void *handle, struct hwrm_async_event_cmpl *cmpl)
|
||||
{
|
||||
struct bnxt_re_dev *rdev = (struct bnxt_re_dev *)handle;
|
||||
u32 data1, data2;
|
||||
u16 event_id;
|
||||
|
||||
event_id = le16_to_cpu(cmpl->event_id);
|
||||
data1 = le32_to_cpu(cmpl->event_data1);
|
||||
data2 = le32_to_cpu(cmpl->event_data2);
|
||||
|
||||
ibdev_dbg(&rdev->ibdev, "Async event_id = %d data1 = %d data2 = %d",
|
||||
event_id, data1, data2);
|
||||
}
|
||||
|
||||
static void bnxt_re_stop_irq(void *handle)
|
||||
{
|
||||
struct bnxt_re_en_dev_info *en_info = auxiliary_get_drvdata(handle);
|
||||
|
@ -361,6 +375,7 @@ static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent)
|
|||
}
|
||||
|
||||
static struct bnxt_ulp_ops bnxt_re_ulp_ops = {
|
||||
.ulp_async_notifier = bnxt_re_async_notifier,
|
||||
.ulp_irq_stop = bnxt_re_stop_irq,
|
||||
.ulp_irq_restart = bnxt_re_start_irq
|
||||
};
|
||||
|
@ -1785,6 +1800,26 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void bnxt_re_net_unregister_async_event(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
if (rdev->is_virtfn)
|
||||
return;
|
||||
|
||||
memset(&rdev->event_bitmap, 0, sizeof(rdev->event_bitmap));
|
||||
bnxt_register_async_events(rdev->en_dev, &rdev->event_bitmap,
|
||||
ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE);
|
||||
}
|
||||
|
||||
static void bnxt_re_net_register_async_event(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
if (rdev->is_virtfn)
|
||||
return;
|
||||
|
||||
rdev->event_bitmap |= (1 << ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE);
|
||||
bnxt_register_async_events(rdev->en_dev, &rdev->event_bitmap,
|
||||
ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE);
|
||||
}
|
||||
|
||||
static void bnxt_re_query_hwrm_intf_version(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
struct bnxt_en_dev *en_dev = rdev->en_dev;
|
||||
|
@ -1864,6 +1899,8 @@ static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev, u8 op_type)
|
|||
|
||||
bnxt_re_debugfs_rem_pdev(rdev);
|
||||
|
||||
bnxt_re_net_unregister_async_event(rdev);
|
||||
|
||||
if (test_and_clear_bit(BNXT_RE_FLAG_QOS_WORK_REG, &rdev->flags))
|
||||
cancel_delayed_work_sync(&rdev->worker);
|
||||
|
||||
|
@ -2077,6 +2114,8 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)
|
|||
|
||||
bnxt_re_debugfs_add_pdev(rdev);
|
||||
|
||||
bnxt_re_net_register_async_event(rdev);
|
||||
|
||||
return 0;
|
||||
free_sctx:
|
||||
bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id);
|
||||
|
|
|
@ -373,9 +373,8 @@ exit_unlock_rcu:
|
|||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
int bnxt_register_async_events(struct bnxt_en_dev *edev,
|
||||
unsigned long *events_bmap,
|
||||
u16 max_id)
|
||||
void bnxt_register_async_events(struct bnxt_en_dev *edev,
|
||||
unsigned long *events_bmap, u16 max_id)
|
||||
{
|
||||
struct net_device *dev = edev->net;
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
|
@ -387,7 +386,6 @@ int bnxt_register_async_events(struct bnxt_en_dev *edev,
|
|||
smp_wmb();
|
||||
ulp->max_async_event_id = max_id;
|
||||
bnxt_hwrm_func_drv_rgtr(bp, events_bmap, max_id + 1, true);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(bnxt_register_async_events);
|
||||
|
||||
|
|
|
@ -126,6 +126,6 @@ int bnxt_register_dev(struct bnxt_en_dev *edev, struct bnxt_ulp_ops *ulp_ops,
|
|||
void *handle);
|
||||
void bnxt_unregister_dev(struct bnxt_en_dev *edev);
|
||||
int bnxt_send_msg(struct bnxt_en_dev *edev, struct bnxt_fw_msg *fw_msg);
|
||||
int bnxt_register_async_events(struct bnxt_en_dev *edev,
|
||||
unsigned long *events_bmap, u16 max_id);
|
||||
void bnxt_register_async_events(struct bnxt_en_dev *edev,
|
||||
unsigned long *events_bmap, u16 max_id);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue