]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
fwctl/bnxt_en: Move common definitions to include/linux/bnxt/
authorPavan Chebbi <pavan.chebbi@broadcom.com>
Sat, 14 Mar 2026 15:16:01 +0000 (08:16 -0700)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 27 Mar 2026 12:12:36 +0000 (09:12 -0300)
We have common definitions that are now going to be used
by more than one component outside of bnxt (bnxt_re and
fwctl)

Move bnxt_ulp.h to include/linux/bnxt/ as ulp.h.

Link: https://patch.msgid.link/r/20260314151605.932749-2-pavan.chebbi@broadcom.com
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/bnxt_re/debugfs.c
drivers/infiniband/hw/bnxt_re/main.c
drivers/infiniband/hw/bnxt_re/qplib_fp.c
drivers/infiniband/hw/bnxt_re/qplib_res.h
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h [deleted file]
include/linux/bnxt/ulp.h [new file with mode: 0644]

index a2ad79c3bbd0217fd9ac385d41df101b95343db9..5fed2cf66be30a1094badf025bfacf234a50c4f7 100644 (file)
@@ -10,8 +10,8 @@
 #include <linux/pci.h>
 #include <linux/seq_file.h>
 #include <rdma/ib_addr.h>
+#include <linux/bnxt/ulp.h>
 
-#include "bnxt_ulp.h"
 #include "roce_hsi.h"
 #include "qplib_res.h"
 #include "qplib_sp.h"
index b576f05e3b26b28d1960259835608f3a7ebaa884..47afccddf55e575b1af76e111a1d3daee8cdc9fe 100644 (file)
@@ -55,8 +55,8 @@
 #include <rdma/ib_umem.h>
 #include <rdma/ib_addr.h>
 #include <linux/hashtable.h>
+#include <linux/bnxt/ulp.h>
 
-#include "bnxt_ulp.h"
 #include "roce_hsi.h"
 #include "qplib_res.h"
 #include "qplib_sp.h"
index 2d7932b3c492fa50900fbc44ea8bbd70097fb86e..b4c7b8f582ba9ff9a9f6e287ac44f44e5b1fbbd7 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/delay.h>
 #include <linux/prefetch.h>
 #include <linux/if_ether.h>
+#include <linux/bnxt/ulp.h>
 #include <rdma/ib_mad.h>
 
 #include "roce_hsi.h"
@@ -55,7 +56,6 @@
 #include "qplib_sp.h"
 #include "qplib_fp.h"
 #include <rdma/ib_addr.h>
-#include "bnxt_ulp.h"
 #include "bnxt_re.h"
 #include "ib_verbs.h"
 
index 9a5dcf97b6f440a2444af3eff40b2429c7819d3a..0a4a03efeb0bab6c44bc9f40a433e697c160c96b 100644 (file)
@@ -39,7 +39,7 @@
 #ifndef __BNXT_QPLIB_RES_H__
 #define __BNXT_QPLIB_RES_H__
 
-#include "bnxt_ulp.h"
+#include <linux/bnxt/ulp.h>
 
 extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero;
 
index 0751c0e4581a21730e676dabbdee604f2b7d0b0b..ed56dba327b4f7af05bf47d6566ae9cd2d396e05 100644 (file)
 #include <net/netdev_rx_queue.h>
 #include <linux/pci-tph.h>
 #include <linux/bnxt/hsi.h>
+#include <linux/bnxt/ulp.h>
 
 #include "bnxt.h"
 #include "bnxt_hwrm.h"
-#include "bnxt_ulp.h"
 #include "bnxt_sriov.h"
 #include "bnxt_ethtool.h"
 #include "bnxt_dcb.h"
index 15de802bbac48e421b3964de547022c017f315a6..230cd95d30a26994d59a312f12912897d9f8d9c9 100644 (file)
 #include <net/devlink.h>
 #include <net/netdev_lock.h>
 #include <linux/bnxt/hsi.h>
+#include <linux/bnxt/ulp.h>
 #include "bnxt.h"
 #include "bnxt_hwrm.h"
 #include "bnxt_vfr.h"
 #include "bnxt_devlink.h"
 #include "bnxt_ethtool.h"
-#include "bnxt_ulp.h"
 #include "bnxt_ptp.h"
 #include "bnxt_coredump.h"
 #include "bnxt_nvm_defs.h"
index 28d0ece2e7b1fbf203496b94027d090e59c5b348..c78a5b161cb59ad6fa873c939c316fd12886f9b7 100644 (file)
@@ -27,9 +27,9 @@
 #include <net/netdev_queues.h>
 #include <net/netlink.h>
 #include <linux/bnxt/hsi.h>
+#include <linux/bnxt/ulp.h>
 #include "bnxt.h"
 #include "bnxt_hwrm.h"
-#include "bnxt_ulp.h"
 #include "bnxt_xdp.h"
 #include "bnxt_ptp.h"
 #include "bnxt_ethtool.h"
index 7f9829287c4950788bc10f67d1c6b6af62eaa5cd..edcc002e4ca3587a63690c6981ef380014ae1fad 100644 (file)
@@ -17,9 +17,9 @@
 #include <linux/etherdevice.h>
 #include <net/dcbnl.h>
 #include <linux/bnxt/hsi.h>
+#include <linux/bnxt/ulp.h>
 #include "bnxt.h"
 #include "bnxt_hwrm.h"
-#include "bnxt_ulp.h"
 #include "bnxt_sriov.h"
 #include "bnxt_vfr.h"
 #include "bnxt_ethtool.h"
index e1e82a72cf1bb85419590ae65f3f4d427bf98ff0..11ced44ead29b39eb48b3ba21c5562a94dd313ed 100644 (file)
 #include <linux/auxiliary_bus.h>
 #include <net/netdev_lock.h>
 #include <linux/bnxt/hsi.h>
+#include <linux/bnxt/ulp.h>
 
 #include "bnxt.h"
 #include "bnxt_hwrm.h"
-#include "bnxt_ulp.h"
 
 static DEFINE_IDA(bnxt_aux_dev_ids);
 
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h
deleted file mode 100644 (file)
index 3c5b8a5..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Broadcom NetXtreme-C/E network driver.
- *
- * Copyright (c) 2016-2018 Broadcom Limited
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation.
- */
-
-#ifndef BNXT_ULP_H
-#define BNXT_ULP_H
-
-#define BNXT_MIN_ROCE_CP_RINGS 2
-#define BNXT_MIN_ROCE_STAT_CTXS        1
-
-#define BNXT_MAX_ROCE_MSIX_VF          2
-#define BNXT_MAX_ROCE_MSIX_NPAR_PF     5
-#define BNXT_MAX_ROCE_MSIX             64
-
-struct hwrm_async_event_cmpl;
-struct bnxt;
-
-struct bnxt_msix_entry {
-       u32     vector;
-       u32     ring_idx;
-       u32     db_offset;
-};
-
-struct bnxt_ulp_ops {
-       /* async_notifier() cannot sleep (in BH context) */
-       void (*ulp_async_notifier)(void *, struct hwrm_async_event_cmpl *);
-       void (*ulp_irq_stop)(void *, bool);
-       void (*ulp_irq_restart)(void *, struct bnxt_msix_entry *);
-};
-
-struct bnxt_fw_msg {
-       void    *msg;
-       int     msg_len;
-       void    *resp;
-       int     resp_max_len;
-       int     timeout;
-};
-
-struct bnxt_ulp {
-       void            *handle;
-       struct bnxt_ulp_ops __rcu *ulp_ops;
-       unsigned long   *async_events_bmap;
-       u16             max_async_event_id;
-       u16             msix_requested;
-};
-
-struct bnxt_en_dev {
-       struct net_device *net;
-       struct pci_dev *pdev;
-       struct bnxt_msix_entry                  msix_entries[BNXT_MAX_ROCE_MSIX];
-       u32 flags;
-       #define BNXT_EN_FLAG_ROCEV1_CAP         0x1
-       #define BNXT_EN_FLAG_ROCEV2_CAP         0x2
-       #define BNXT_EN_FLAG_ROCE_CAP           (BNXT_EN_FLAG_ROCEV1_CAP | \
-                                                BNXT_EN_FLAG_ROCEV2_CAP)
-       #define BNXT_EN_FLAG_ULP_STOPPED        0x8
-       #define BNXT_EN_FLAG_VF                 0x10
-#define BNXT_EN_VF(edev)       ((edev)->flags & BNXT_EN_FLAG_VF)
-       #define BNXT_EN_FLAG_ROCE_VF_RES_MGMT   0x20
-       #define BNXT_EN_FLAG_SW_RES_LMT         0x40
-#define BNXT_EN_SW_RES_LMT(edev) ((edev)->flags & BNXT_EN_FLAG_SW_RES_LMT)
-
-       struct bnxt_ulp                 *ulp_tbl;
-       int                             l2_db_size;     /* Doorbell BAR size in
-                                                        * bytes mapped by L2
-                                                        * driver.
-                                                        */
-       int                             l2_db_size_nc;  /* Doorbell BAR size in
-                                                        * bytes mapped as non-
-                                                        * cacheable.
-                                                        */
-       int                             l2_db_offset;   /* Doorbell offset in
-                                                        * bytes within
-                                                        * l2_db_size_nc.
-                                                        */
-       u16                             chip_num;
-       u16                             hw_ring_stats_size;
-       u16                             pf_port_id;
-       unsigned long                   en_state;       /* Could be checked in
-                                                        * RoCE driver suspend
-                                                        * mode only. Will be
-                                                        * updated in resume.
-                                                        */
-       void __iomem                    *bar0;
-
-       u16                             ulp_num_msix_vec;
-       u16                             ulp_num_ctxs;
-
-                                       /* serialize ulp operations */
-       struct mutex                    en_dev_lock;
-};
-
-static inline bool bnxt_ulp_registered(struct bnxt_en_dev *edev)
-{
-       if (edev && rcu_access_pointer(edev->ulp_tbl->ulp_ops))
-               return true;
-       return false;
-}
-
-int bnxt_get_ulp_msix_num(struct bnxt *bp);
-int bnxt_get_ulp_msix_num_in_use(struct bnxt *bp);
-void bnxt_set_ulp_msix_num(struct bnxt *bp, int num);
-int bnxt_get_ulp_stat_ctxs(struct bnxt *bp);
-void bnxt_set_ulp_stat_ctxs(struct bnxt *bp, int num_ctxs);
-int bnxt_get_ulp_stat_ctxs_in_use(struct bnxt *bp);
-void bnxt_set_dflt_ulp_stat_ctxs(struct bnxt *bp);
-void bnxt_ulp_stop(struct bnxt *bp);
-void bnxt_ulp_start(struct bnxt *bp, int err);
-void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs);
-void bnxt_ulp_irq_stop(struct bnxt *bp);
-void bnxt_ulp_irq_restart(struct bnxt *bp, int err);
-void bnxt_ulp_async_events(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl);
-void bnxt_rdma_aux_device_uninit(struct bnxt *bp);
-void bnxt_rdma_aux_device_del(struct bnxt *bp);
-void bnxt_rdma_aux_device_add(struct bnxt *bp);
-void bnxt_rdma_aux_device_init(struct bnxt *bp);
-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);
-void bnxt_register_async_events(struct bnxt_en_dev *edev,
-                               unsigned long *events_bmap, u16 max_id);
-#endif
diff --git a/include/linux/bnxt/ulp.h b/include/linux/bnxt/ulp.h
new file mode 100644 (file)
index 0000000..3c5b8a5
--- /dev/null
@@ -0,0 +1,128 @@
+/* Broadcom NetXtreme-C/E network driver.
+ *
+ * Copyright (c) 2016-2018 Broadcom Limited
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ */
+
+#ifndef BNXT_ULP_H
+#define BNXT_ULP_H
+
+#define BNXT_MIN_ROCE_CP_RINGS 2
+#define BNXT_MIN_ROCE_STAT_CTXS        1
+
+#define BNXT_MAX_ROCE_MSIX_VF          2
+#define BNXT_MAX_ROCE_MSIX_NPAR_PF     5
+#define BNXT_MAX_ROCE_MSIX             64
+
+struct hwrm_async_event_cmpl;
+struct bnxt;
+
+struct bnxt_msix_entry {
+       u32     vector;
+       u32     ring_idx;
+       u32     db_offset;
+};
+
+struct bnxt_ulp_ops {
+       /* async_notifier() cannot sleep (in BH context) */
+       void (*ulp_async_notifier)(void *, struct hwrm_async_event_cmpl *);
+       void (*ulp_irq_stop)(void *, bool);
+       void (*ulp_irq_restart)(void *, struct bnxt_msix_entry *);
+};
+
+struct bnxt_fw_msg {
+       void    *msg;
+       int     msg_len;
+       void    *resp;
+       int     resp_max_len;
+       int     timeout;
+};
+
+struct bnxt_ulp {
+       void            *handle;
+       struct bnxt_ulp_ops __rcu *ulp_ops;
+       unsigned long   *async_events_bmap;
+       u16             max_async_event_id;
+       u16             msix_requested;
+};
+
+struct bnxt_en_dev {
+       struct net_device *net;
+       struct pci_dev *pdev;
+       struct bnxt_msix_entry                  msix_entries[BNXT_MAX_ROCE_MSIX];
+       u32 flags;
+       #define BNXT_EN_FLAG_ROCEV1_CAP         0x1
+       #define BNXT_EN_FLAG_ROCEV2_CAP         0x2
+       #define BNXT_EN_FLAG_ROCE_CAP           (BNXT_EN_FLAG_ROCEV1_CAP | \
+                                                BNXT_EN_FLAG_ROCEV2_CAP)
+       #define BNXT_EN_FLAG_ULP_STOPPED        0x8
+       #define BNXT_EN_FLAG_VF                 0x10
+#define BNXT_EN_VF(edev)       ((edev)->flags & BNXT_EN_FLAG_VF)
+       #define BNXT_EN_FLAG_ROCE_VF_RES_MGMT   0x20
+       #define BNXT_EN_FLAG_SW_RES_LMT         0x40
+#define BNXT_EN_SW_RES_LMT(edev) ((edev)->flags & BNXT_EN_FLAG_SW_RES_LMT)
+
+       struct bnxt_ulp                 *ulp_tbl;
+       int                             l2_db_size;     /* Doorbell BAR size in
+                                                        * bytes mapped by L2
+                                                        * driver.
+                                                        */
+       int                             l2_db_size_nc;  /* Doorbell BAR size in
+                                                        * bytes mapped as non-
+                                                        * cacheable.
+                                                        */
+       int                             l2_db_offset;   /* Doorbell offset in
+                                                        * bytes within
+                                                        * l2_db_size_nc.
+                                                        */
+       u16                             chip_num;
+       u16                             hw_ring_stats_size;
+       u16                             pf_port_id;
+       unsigned long                   en_state;       /* Could be checked in
+                                                        * RoCE driver suspend
+                                                        * mode only. Will be
+                                                        * updated in resume.
+                                                        */
+       void __iomem                    *bar0;
+
+       u16                             ulp_num_msix_vec;
+       u16                             ulp_num_ctxs;
+
+                                       /* serialize ulp operations */
+       struct mutex                    en_dev_lock;
+};
+
+static inline bool bnxt_ulp_registered(struct bnxt_en_dev *edev)
+{
+       if (edev && rcu_access_pointer(edev->ulp_tbl->ulp_ops))
+               return true;
+       return false;
+}
+
+int bnxt_get_ulp_msix_num(struct bnxt *bp);
+int bnxt_get_ulp_msix_num_in_use(struct bnxt *bp);
+void bnxt_set_ulp_msix_num(struct bnxt *bp, int num);
+int bnxt_get_ulp_stat_ctxs(struct bnxt *bp);
+void bnxt_set_ulp_stat_ctxs(struct bnxt *bp, int num_ctxs);
+int bnxt_get_ulp_stat_ctxs_in_use(struct bnxt *bp);
+void bnxt_set_dflt_ulp_stat_ctxs(struct bnxt *bp);
+void bnxt_ulp_stop(struct bnxt *bp);
+void bnxt_ulp_start(struct bnxt *bp, int err);
+void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs);
+void bnxt_ulp_irq_stop(struct bnxt *bp);
+void bnxt_ulp_irq_restart(struct bnxt *bp, int err);
+void bnxt_ulp_async_events(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl);
+void bnxt_rdma_aux_device_uninit(struct bnxt *bp);
+void bnxt_rdma_aux_device_del(struct bnxt *bp);
+void bnxt_rdma_aux_device_add(struct bnxt *bp);
+void bnxt_rdma_aux_device_init(struct bnxt *bp);
+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);
+void bnxt_register_async_events(struct bnxt_en_dev *edev,
+                               unsigned long *events_bmap, u16 max_id);
+#endif