Skip to content

Commit 65ecee1

Browse files
Kalesh APrleon
authored andcommitted
RDMA/bnxt_re: Fail probe early when not enough MSI-x vectors are reserved
L2 driver allocates and populates the MSI-x vector details for RoCE in the en_dev structure. RoCE driver requires minimum 2 MSIx vectors. Hence during probe, driver has to check and bail out if there are not enough MSI-x vectors reserved for it before proceeding further initialization. Reviewed-by: Andy Gospodarek <[email protected]> Reviewed-by: Ajit Khaparde <[email protected]> Reviewed-by: Hongguang Gao <[email protected]> Reviewed-by: Bhargava Chenna Marreddy <[email protected]> Reviewed-by: Kashyap Desai <[email protected]> Reviewed-by: Chandramohan Akula <[email protected]> Signed-off-by: Kalesh AP <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent faa6244 commit 65ecee1

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

drivers/infiniband/hw/bnxt_re/bnxt_re.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ struct bnxt_re_pacing {
154154

155155
#define BNXT_RE_GRC_FIFO_REG_BASE 0x2000
156156

157+
#define BNXT_RE_MIN_MSIX 2
158+
157159
#define MAX_CQ_HASH_BITS (16)
158160
#define MAX_SRQ_HASH_BITS (16)
159161

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,6 +1936,18 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)
19361936
}
19371937
set_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags);
19381938

1939+
if (rdev->en_dev->ulp_tbl->msix_requested < BNXT_RE_MIN_MSIX) {
1940+
ibdev_err(&rdev->ibdev,
1941+
"RoCE requires minimum 2 MSI-X vectors, but only %d reserved\n",
1942+
rdev->en_dev->ulp_tbl->msix_requested);
1943+
bnxt_unregister_dev(rdev->en_dev);
1944+
clear_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags);
1945+
return -EINVAL;
1946+
}
1947+
ibdev_dbg(&rdev->ibdev, "Got %d MSI-X vectors\n",
1948+
rdev->en_dev->ulp_tbl->msix_requested);
1949+
rdev->num_msix = rdev->en_dev->ulp_tbl->msix_requested;
1950+
19391951
rc = bnxt_re_setup_chip_ctx(rdev);
19401952
if (rc) {
19411953
bnxt_unregister_dev(rdev->en_dev);
@@ -1947,16 +1959,6 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)
19471959
/* Check whether VF or PF */
19481960
bnxt_re_get_sriov_func_type(rdev);
19491961

1950-
if (!rdev->en_dev->ulp_tbl->msix_requested) {
1951-
ibdev_err(&rdev->ibdev,
1952-
"Failed to get MSI-X vectors: %#x\n", rc);
1953-
rc = -EINVAL;
1954-
goto fail;
1955-
}
1956-
ibdev_dbg(&rdev->ibdev, "Got %d MSI-X vectors\n",
1957-
rdev->en_dev->ulp_tbl->msix_requested);
1958-
rdev->num_msix = rdev->en_dev->ulp_tbl->msix_requested;
1959-
19601962
bnxt_re_query_hwrm_intf_version(rdev);
19611963

19621964
/* Establish RCFW Communication Channel to initialize the context

0 commit comments

Comments
 (0)