mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 03:27:03 +02:00
RDMA/bnxt_re: Add support for mirror vnic
Added below support: - Querying the pre-reserved mirror_vnic_id - Allocating/freeing mirror_vnic - Configuring mirror vnic to associate it with raw qp These functions will be used in the subsequent patch in this series. Signed-off-by: Saravanan Vajravel <saravanan.vajravel@broadcom.com> Reviewed-by: Kashyap Desai <kashyap.desai@broadcom.com> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Link: https://patch.msgid.link/20250822040801.776196-7-kalesh-anakkur.purayil@broadcom.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
af7f9d0d57
commit
fd6c9ae7c1
|
|
@ -248,6 +248,10 @@ int bnxt_re_assign_pma_port_counters(struct bnxt_re_dev *rdev, struct ib_mad *ou
|
|||
int bnxt_re_assign_pma_port_ext_counters(struct bnxt_re_dev *rdev,
|
||||
struct ib_mad *out_mad);
|
||||
|
||||
void bnxt_re_hwrm_free_vnic(struct bnxt_re_dev *rdev);
|
||||
int bnxt_re_hwrm_alloc_vnic(struct bnxt_re_dev *rdev);
|
||||
int bnxt_re_hwrm_cfg_vnic(struct bnxt_re_dev *rdev, u32 qp_id);
|
||||
|
||||
static inline struct device *rdev_to_dev(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
if (rdev)
|
||||
|
|
|
|||
|
|
@ -540,6 +540,72 @@ static void bnxt_re_fill_fw_msg(struct bnxt_fw_msg *fw_msg, void *msg,
|
|||
fw_msg->timeout = timeout;
|
||||
}
|
||||
|
||||
void bnxt_re_hwrm_free_vnic(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
struct bnxt_en_dev *en_dev = rdev->en_dev;
|
||||
struct hwrm_vnic_free_input req = {};
|
||||
struct bnxt_fw_msg fw_msg = {};
|
||||
int rc;
|
||||
|
||||
bnxt_re_init_hwrm_hdr((void *)&req, HWRM_VNIC_FREE);
|
||||
|
||||
req.vnic_id = cpu_to_le32(rdev->mirror_vnic_id);
|
||||
bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), NULL,
|
||||
0, DFLT_HWRM_CMD_TIMEOUT);
|
||||
rc = bnxt_send_msg(en_dev, &fw_msg);
|
||||
if (rc)
|
||||
ibdev_dbg(&rdev->ibdev,
|
||||
"Failed to free vnic, rc = %d\n", rc);
|
||||
}
|
||||
|
||||
int bnxt_re_hwrm_alloc_vnic(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
struct bnxt_en_dev *en_dev = rdev->en_dev;
|
||||
struct hwrm_vnic_alloc_output resp = {};
|
||||
struct hwrm_vnic_alloc_input req = {};
|
||||
struct bnxt_fw_msg fw_msg = {};
|
||||
int rc;
|
||||
|
||||
bnxt_re_init_hwrm_hdr((void *)&req, HWRM_VNIC_ALLOC);
|
||||
|
||||
req.vnic_id = cpu_to_le16(rdev->mirror_vnic_id);
|
||||
req.flags = cpu_to_le32(VNIC_ALLOC_REQ_FLAGS_VNIC_ID_VALID);
|
||||
bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
|
||||
sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
|
||||
rc = bnxt_send_msg(en_dev, &fw_msg);
|
||||
if (rc)
|
||||
ibdev_dbg(&rdev->ibdev,
|
||||
"Failed to alloc vnic, rc = %d\n", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int bnxt_re_hwrm_cfg_vnic(struct bnxt_re_dev *rdev, u32 qp_id)
|
||||
{
|
||||
struct bnxt_en_dev *en_dev = rdev->en_dev;
|
||||
struct hwrm_vnic_cfg_input req = {};
|
||||
struct bnxt_fw_msg fw_msg = {};
|
||||
int rc;
|
||||
|
||||
bnxt_re_init_hwrm_hdr((void *)&req, HWRM_VNIC_CFG);
|
||||
|
||||
req.flags = cpu_to_le32(VNIC_CFG_REQ_FLAGS_ROCE_ONLY_VNIC_MODE);
|
||||
req.enables = cpu_to_le32(VNIC_CFG_REQ_ENABLES_RAW_QP_ID |
|
||||
VNIC_CFG_REQ_ENABLES_MRU);
|
||||
req.vnic_id = cpu_to_le16(rdev->mirror_vnic_id);
|
||||
req.raw_qp_id = cpu_to_le32(qp_id);
|
||||
req.mru = cpu_to_le16(rdev->netdev->mtu + VLAN_ETH_HLEN);
|
||||
|
||||
bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), NULL,
|
||||
0, DFLT_HWRM_CMD_TIMEOUT);
|
||||
rc = bnxt_send_msg(en_dev, &fw_msg);
|
||||
if (rc)
|
||||
ibdev_dbg(&rdev->ibdev,
|
||||
"Failed to cfg vnic, rc = %d\n", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Query device config using common hwrm */
|
||||
static int bnxt_re_hwrm_qcfg(struct bnxt_re_dev *rdev, u32 *db_len,
|
||||
u32 *offset)
|
||||
|
|
@ -558,6 +624,7 @@ static int bnxt_re_hwrm_qcfg(struct bnxt_re_dev *rdev, u32 *db_len,
|
|||
if (!rc) {
|
||||
*db_len = PAGE_ALIGN(le16_to_cpu(resp.l2_doorbell_bar_size_kb) * 1024);
|
||||
*offset = PAGE_ALIGN(le16_to_cpu(resp.legacy_l2_db_size_kb) * 1024);
|
||||
rdev->mirror_vnic_id = le16_to_cpu(resp.mirror_vnic_id);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user