Skip to content

Commit 0570654

Browse files
committed
Merge: RDMA/bnxt_re: driver update for RHEL 9.7
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6715 JIRA: https://issues.redhat.com/browse/RHEL-76569 JIRA: https://issues.redhat.com/browse/RHEL-80075 JIRA: https://issues.redhat.com/browse/RHEL-72652 Tested: Complied and Tested locally Upstream Status: Accepted. update bnxt_re driver with upstream commits through 6.14. and * "RDMA/bnxt_re: Support perf management counters" is from v6.15-rc1. * "RDMA/bnxt_re: Fix budget handling of notification queue" is from rdma.git/for-rc. Signed-off-by: Sreekanth Reddy <sreeredd@redhat.com> Approved-by: Kamal Heib <kheib@redhat.com> Approved-by: Michal Schmidt <mschmidt@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents b94c74b + 3fdf047 commit 0570654

File tree

22 files changed

+1578
-326
lines changed

22 files changed

+1578
-326
lines changed

drivers/infiniband/hw/bnxt_re/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ ccflags-y := -I $(srctree)/drivers/net/ethernet/broadcom/bnxt
44
obj-$(CONFIG_INFINIBAND_BNXT_RE) += bnxt_re.o
55
bnxt_re-y := main.o ib_verbs.o \
66
qplib_res.o qplib_rcfw.o \
7-
qplib_sp.o qplib_fp.o hw_counters.o
7+
qplib_sp.o qplib_fp.o hw_counters.o \
8+
debugfs.o

drivers/infiniband/hw/bnxt_re/bnxt_re.h

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@
5353
#define BNXT_RE_MAX_MR_SIZE_HIGH BIT_ULL(39)
5454
#define BNXT_RE_MAX_MR_SIZE BNXT_RE_MAX_MR_SIZE_HIGH
5555

56-
#define BNXT_RE_MAX_QPC_COUNT (64 * 1024)
57-
#define BNXT_RE_MAX_MRW_COUNT (64 * 1024)
58-
#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024)
59-
#define BNXT_RE_MAX_CQ_COUNT (64 * 1024)
60-
#define BNXT_RE_MAX_MRW_COUNT_64K (64 * 1024)
61-
#define BNXT_RE_MAX_MRW_COUNT_256K (256 * 1024)
6256

6357
/* Number of MRs to reserve for PF, leaving remainder for VFs */
6458
#define BNXT_RE_RESVD_MR_FOR_PF (32 * 1024)
@@ -154,8 +148,25 @@ struct bnxt_re_pacing {
154148

155149
#define BNXT_RE_GRC_FIFO_REG_BASE 0x2000
156150

151+
#define BNXT_RE_MIN_MSIX 2
152+
#define BNXT_RE_MAX_MSIX BNXT_MAX_ROCE_MSIX
153+
struct bnxt_re_nq_record {
154+
struct bnxt_msix_entry msix_entries[BNXT_RE_MAX_MSIX];
155+
struct bnxt_qplib_nq nq[BNXT_RE_MAX_MSIX];
156+
int num_msix;
157+
/* serialize NQ access */
158+
struct mutex load_lock;
159+
};
160+
157161
#define MAX_CQ_HASH_BITS (16)
158162
#define MAX_SRQ_HASH_BITS (16)
163+
164+
static inline bool bnxt_re_chip_gen_p7(u16 chip_num)
165+
{
166+
return (chip_num == CHIP_NUM_58818 ||
167+
chip_num == CHIP_NUM_57608);
168+
}
169+
159170
struct bnxt_re_dev {
160171
struct ib_device ibdev;
161172
struct list_head list;
@@ -170,31 +181,27 @@ struct bnxt_re_dev {
170181
#define BNXT_RE_FLAG_ISSUE_ROCE_STATS 29
171182
struct net_device *netdev;
172183
struct auxiliary_device *adev;
173-
struct notifier_block nb;
174184
unsigned int version, major, minor;
175185
struct bnxt_qplib_chip_ctx *chip_ctx;
176186
struct bnxt_en_dev *en_dev;
177-
int num_msix;
178187

179188
int id;
180189

181190
struct delayed_work worker;
182191
u8 cur_prio_map;
183192

184-
/* FP Notification Queue (CQ & SRQ) */
185-
struct tasklet_struct nq_task;
186-
187193
/* RCFW Channel */
188194
struct bnxt_qplib_rcfw rcfw;
189195

190-
/* NQ */
191-
struct bnxt_qplib_nq nq[BNXT_MAX_ROCE_MSIX];
196+
/* NQ record */
197+
struct bnxt_re_nq_record *nqr;
192198

193199
/* Device Resources */
194-
struct bnxt_qplib_dev_attr dev_attr;
200+
struct bnxt_qplib_dev_attr *dev_attr;
195201
struct bnxt_qplib_ctx qplib_ctx;
196202
struct bnxt_qplib_res qplib_res;
197203
struct bnxt_qplib_dpi dpi_privileged;
204+
struct bnxt_qplib_cq_coal_param cq_coalescing;
198205

199206
struct mutex qp_lock; /* protect qp list */
200207
struct list_head qp_list;
@@ -213,6 +220,11 @@ struct bnxt_re_dev {
213220
struct delayed_work dbq_pacing_work;
214221
DECLARE_HASHTABLE(cq_hash, MAX_CQ_HASH_BITS);
215222
DECLARE_HASHTABLE(srq_hash, MAX_SRQ_HASH_BITS);
223+
struct dentry *dbg_root;
224+
struct dentry *qp_debugfs;
225+
unsigned long event_bitmap;
226+
struct bnxt_qplib_cc_param cc_param;
227+
struct workqueue_struct *dcb_wq;
216228
};
217229

218230
#define to_bnxt_re_dev(ptr, member) \
@@ -225,6 +237,10 @@ struct bnxt_re_dev {
225237
#define BNXT_RE_CHECK_RC(x) ((x) && ((x) != -ETIMEDOUT))
226238
void bnxt_re_pacing_alert(struct bnxt_re_dev *rdev);
227239

240+
int bnxt_re_assign_pma_port_counters(struct bnxt_re_dev *rdev, struct ib_mad *out_mad);
241+
int bnxt_re_assign_pma_port_ext_counters(struct bnxt_re_dev *rdev,
242+
struct ib_mad *out_mad);
243+
228244
static inline struct device *rdev_to_dev(struct bnxt_re_dev *rdev)
229245
{
230246
if (rdev)
@@ -239,4 +255,23 @@ static inline void bnxt_re_set_pacing_dev_state(struct bnxt_re_dev *rdev)
239255
rdev->qplib_res.pacing_data->dev_err_state =
240256
test_bit(BNXT_RE_FLAG_ERR_DEVICE_DETACHED, &rdev->flags);
241257
}
258+
259+
static inline int bnxt_re_read_context_allowed(struct bnxt_re_dev *rdev)
260+
{
261+
if (!bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx) ||
262+
rdev->rcfw.res->cctx->hwrm_intf_ver < HWRM_VERSION_READ_CTX)
263+
return -EOPNOTSUPP;
264+
return 0;
265+
}
266+
267+
#define BNXT_RE_CONTEXT_TYPE_QPC_SIZE_P5 1088
268+
#define BNXT_RE_CONTEXT_TYPE_CQ_SIZE_P5 128
269+
#define BNXT_RE_CONTEXT_TYPE_MRW_SIZE_P5 128
270+
#define BNXT_RE_CONTEXT_TYPE_SRQ_SIZE_P5 192
271+
272+
#define BNXT_RE_CONTEXT_TYPE_QPC_SIZE_P7 1088
273+
#define BNXT_RE_CONTEXT_TYPE_CQ_SIZE_P7 192
274+
#define BNXT_RE_CONTEXT_TYPE_MRW_SIZE_P7 192
275+
#define BNXT_RE_CONTEXT_TYPE_SRQ_SIZE_P7 192
276+
242277
#endif
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
2+
/*
3+
* Copyright (c) 2024, Broadcom. All rights reserved. The term
4+
* Broadcom refers to Broadcom Limited and/or its subsidiaries.
5+
*
6+
* Description: Debugfs component of the bnxt_re driver
7+
*/
8+
9+
#include <linux/debugfs.h>
10+
#include <linux/pci.h>
11+
#include <rdma/ib_addr.h>
12+
13+
#include "bnxt_ulp.h"
14+
#include "roce_hsi.h"
15+
#include "qplib_res.h"
16+
#include "qplib_sp.h"
17+
#include "qplib_fp.h"
18+
#include "qplib_rcfw.h"
19+
#include "bnxt_re.h"
20+
#include "ib_verbs.h"
21+
#include "debugfs.h"
22+
23+
static struct dentry *bnxt_re_debugfs_root;
24+
25+
static inline const char *bnxt_re_qp_state_str(u8 state)
26+
{
27+
switch (state) {
28+
case CMDQ_MODIFY_QP_NEW_STATE_RESET:
29+
return "RST";
30+
case CMDQ_MODIFY_QP_NEW_STATE_INIT:
31+
return "INIT";
32+
case CMDQ_MODIFY_QP_NEW_STATE_RTR:
33+
return "RTR";
34+
case CMDQ_MODIFY_QP_NEW_STATE_RTS:
35+
return "RTS";
36+
case CMDQ_MODIFY_QP_NEW_STATE_SQE:
37+
return "SQER";
38+
case CMDQ_MODIFY_QP_NEW_STATE_SQD:
39+
return "SQD";
40+
case CMDQ_MODIFY_QP_NEW_STATE_ERR:
41+
return "ERR";
42+
default:
43+
return "Invalid QP state";
44+
}
45+
}
46+
47+
static inline const char *bnxt_re_qp_type_str(u8 type)
48+
{
49+
switch (type) {
50+
case CMDQ_CREATE_QP1_TYPE_GSI: return "QP1";
51+
case CMDQ_CREATE_QP_TYPE_GSI: return "QP1";
52+
case CMDQ_CREATE_QP_TYPE_RC: return "RC";
53+
case CMDQ_CREATE_QP_TYPE_UD: return "UD";
54+
case CMDQ_CREATE_QP_TYPE_RAW_ETHERTYPE: return "RAW_ETHERTYPE";
55+
default: return "Invalid transport type";
56+
}
57+
}
58+
59+
static ssize_t qp_info_read(struct file *filep,
60+
char __user *buffer,
61+
size_t count, loff_t *ppos)
62+
{
63+
struct bnxt_re_qp *qp = filep->private_data;
64+
char *buf;
65+
int len;
66+
67+
if (*ppos)
68+
return 0;
69+
70+
buf = kasprintf(GFP_KERNEL,
71+
"QPN\t\t: %d\n"
72+
"transport\t: %s\n"
73+
"state\t\t: %s\n"
74+
"mtu\t\t: %d\n"
75+
"timeout\t\t: %d\n"
76+
"remote QPN\t: %d\n",
77+
qp->qplib_qp.id,
78+
bnxt_re_qp_type_str(qp->qplib_qp.type),
79+
bnxt_re_qp_state_str(qp->qplib_qp.state),
80+
qp->qplib_qp.mtu,
81+
qp->qplib_qp.timeout,
82+
qp->qplib_qp.dest_qpn);
83+
if (!buf)
84+
return -ENOMEM;
85+
if (count < strlen(buf)) {
86+
kfree(buf);
87+
return -ENOSPC;
88+
}
89+
len = simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
90+
kfree(buf);
91+
return len;
92+
}
93+
94+
static const struct file_operations debugfs_qp_fops = {
95+
.owner = THIS_MODULE,
96+
.open = simple_open,
97+
.read = qp_info_read,
98+
};
99+
100+
void bnxt_re_debug_add_qpinfo(struct bnxt_re_dev *rdev, struct bnxt_re_qp *qp)
101+
{
102+
char resn[32];
103+
104+
sprintf(resn, "0x%x", qp->qplib_qp.id);
105+
qp->dentry = debugfs_create_file(resn, 0400, rdev->qp_debugfs, qp, &debugfs_qp_fops);
106+
}
107+
108+
void bnxt_re_debug_rem_qpinfo(struct bnxt_re_dev *rdev, struct bnxt_re_qp *qp)
109+
{
110+
debugfs_remove(qp->dentry);
111+
}
112+
113+
void bnxt_re_debugfs_add_pdev(struct bnxt_re_dev *rdev)
114+
{
115+
struct pci_dev *pdev = rdev->en_dev->pdev;
116+
117+
rdev->dbg_root = debugfs_create_dir(dev_name(&pdev->dev), bnxt_re_debugfs_root);
118+
119+
rdev->qp_debugfs = debugfs_create_dir("QPs", rdev->dbg_root);
120+
}
121+
122+
void bnxt_re_debugfs_rem_pdev(struct bnxt_re_dev *rdev)
123+
{
124+
debugfs_remove_recursive(rdev->qp_debugfs);
125+
126+
debugfs_remove_recursive(rdev->dbg_root);
127+
rdev->dbg_root = NULL;
128+
}
129+
130+
void bnxt_re_register_debugfs(void)
131+
{
132+
bnxt_re_debugfs_root = debugfs_create_dir("bnxt_re", NULL);
133+
}
134+
135+
void bnxt_re_unregister_debugfs(void)
136+
{
137+
debugfs_remove(bnxt_re_debugfs_root);
138+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
2+
/*
3+
* Copyright (c) 2024, Broadcom. All rights reserved. The term
4+
* Broadcom refers to Broadcom Limited and/or its subsidiaries.
5+
*
6+
* Description: Debugfs header
7+
*/
8+
9+
#ifndef __BNXT_RE_DEBUGFS__
10+
#define __BNXT_RE_DEBUGFS__
11+
12+
void bnxt_re_debug_add_qpinfo(struct bnxt_re_dev *rdev, struct bnxt_re_qp *qp);
13+
void bnxt_re_debug_rem_qpinfo(struct bnxt_re_dev *rdev, struct bnxt_re_qp *qp);
14+
15+
void bnxt_re_debugfs_add_pdev(struct bnxt_re_dev *rdev);
16+
void bnxt_re_debugfs_rem_pdev(struct bnxt_re_dev *rdev);
17+
18+
void bnxt_re_register_debugfs(void);
19+
void bnxt_re_unregister_debugfs(void);
20+
21+
#endif

0 commit comments

Comments
 (0)