bnxt_re: Add support to display board_id in ibv_devinfo output
Added support to display board_id in ibv_devinfo output. ibv_devinfo util reads the board_id from below sysctl attribute, so added this sysctl attribute. sys.class.infiniband.bnxt_reX.board_id Reviewed by: ssaxena Differential Revision: https://reviews.freebsd.org/D54524 MFC after: 3 days
This commit is contained in:
committed by
Sumit Saxena
parent
b7d6334df6
commit
3a9565c2a8
@@ -1340,6 +1340,7 @@ struct bnxt_softc {
|
||||
unsigned long fw_reset_timestamp;
|
||||
|
||||
struct bnxt_fw_health *fw_health;
|
||||
char board_partno[64];
|
||||
};
|
||||
|
||||
struct bnxt_filter_info {
|
||||
|
||||
@@ -463,6 +463,7 @@ static inline void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt_soft
|
||||
edev->hwrm_bar = bp->hwrm_bar;
|
||||
edev->port_partition_type = bp->port_partition_type;
|
||||
edev->ulp_version = BNXT_ULP_VERSION;
|
||||
memcpy(edev->board_part_number, bp->board_partno, BNXT_VPD_PN_FLD_LEN - 1);
|
||||
}
|
||||
|
||||
int bnxt_rdma_aux_device_del(struct bnxt_softc *softc)
|
||||
|
||||
@@ -127,6 +127,8 @@ struct bnxt_en_dev {
|
||||
struct bnxt_bar_info hwrm_bar;
|
||||
u32 espeed;
|
||||
uint8_t lanes;
|
||||
#define BNXT_VPD_PN_FLD_LEN 32
|
||||
char board_part_number[BNXT_VPD_PN_FLD_LEN];
|
||||
};
|
||||
|
||||
struct bnxt_en_ops {
|
||||
|
||||
@@ -2674,6 +2674,13 @@ bnxt_attach_pre(if_ctx_t ctx)
|
||||
softc->state_bv = bit_alloc(BNXT_STATE_MAX, M_DEVBUF,
|
||||
M_WAITOK|M_ZERO);
|
||||
|
||||
if (BNXT_PF(softc)) {
|
||||
const char *part_num;
|
||||
|
||||
if (pci_get_vpd_readonly(softc->dev, "PN", &part_num) == 0)
|
||||
snprintf(softc->board_partno, sizeof(softc->board_partno), "%s", part_num);
|
||||
}
|
||||
|
||||
return (rc);
|
||||
|
||||
failed:
|
||||
|
||||
@@ -2031,11 +2031,30 @@ static ssize_t show_hca(struct device *device, struct device_attribute *attr,
|
||||
return scnprintf(buf, PAGE_SIZE, "%s\n", rdev->ibdev.node_desc);
|
||||
}
|
||||
|
||||
static ssize_t show_board_id(struct device *device, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct bnxt_re_dev *rdev = to_bnxt_re_dev(device, ibdev.dev);
|
||||
char buffer[BNXT_VPD_PN_FLD_LEN] = {};
|
||||
|
||||
if (!rdev->is_virtfn)
|
||||
memcpy(buffer, rdev->en_dev->board_part_number,
|
||||
BNXT_VPD_PN_FLD_LEN - 1);
|
||||
else
|
||||
scnprintf(buffer, BNXT_VPD_PN_FLD_LEN,
|
||||
"0x%x-VF", rdev->en_dev->pdev->device);
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%s\n", buffer);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(hw_rev, 0444, show_rev, NULL);
|
||||
static DEVICE_ATTR(hca_type, 0444, show_hca, NULL);
|
||||
static DEVICE_ATTR(board_id, 0444, show_board_id, NULL);
|
||||
|
||||
static struct device_attribute *bnxt_re_attributes[] = {
|
||||
&dev_attr_hw_rev,
|
||||
&dev_attr_hca_type
|
||||
&dev_attr_hca_type,
|
||||
&dev_attr_board_id
|
||||
};
|
||||
|
||||
int ib_register_device_compat(struct bnxt_re_dev *rdev)
|
||||
|
||||
Reference in New Issue
Block a user