git: 507389a35a41 - main - ibcore: Fail early if unsupported QP is provided.

Hans Petter Selasky hselasky at FreeBSD.org
Mon Jul 12 13:09:39 UTC 2021


The branch main has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=507389a35a41f5f15592d2156d34039e3ee1c3e5

commit 507389a35a41f5f15592d2156d34039e3ee1c3e5
Author:     Hans Petter Selasky <hselasky at FreeBSD.org>
AuthorDate: 2021-06-16 13:01:44 +0000
Commit:     Hans Petter Selasky <hselasky at FreeBSD.org>
CommitDate: 2021-07-12 12:22:31 +0000

    ibcore: Fail early if unsupported QP is provided.
    
    When requested QP type is not supported for a {device, port}, return the
    error right away before validating all parameters during mad agent
    registration time.
    
    Linux commit:
    798bba01b44b0ddf8cd6e542635b37cc9a9b739c
    
    MFC after:      1 week
    Reviewed by:    kib
    Sponsored by:   Mellanox Technologies // NVIDIA Networking
---
 sys/ofed/drivers/infiniband/core/ib_mad.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c
index 7bb6323a4c53..2f14535688aa 100644
--- a/sys/ofed/drivers/infiniband/core/ib_mad.c
+++ b/sys/ofed/drivers/infiniband/core/ib_mad.c
@@ -219,6 +219,10 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
 	unsigned long flags;
 	u8 mgmt_class, vclass;
 
+	if ((qp_type == IB_QPT_SMI && !rdma_cap_ib_smi(device, port_num)) ||
+	    (qp_type == IB_QPT_GSI && !rdma_cap_ib_cm(device, port_num)))
+		return ERR_PTR(-EPROTONOSUPPORT);
+
 	/* Validate parameters */
 	qpn = get_spl_qp_index(qp_type);
 	if (qpn == -1) {


More information about the dev-commits-src-main mailing list