Skip to content

Commit 4bd27ee

Browse files
committed
Merge branch 'bnxt_en-Updates-to-devlink-info_get-cb'
Vasundhara Volam says: ==================== bnxt_en: Updates to devlink info_get cb This series adds support for a generic macro to devlink info_get cb. Adds support for fw.mgmt.api and board.id info to bnxt_en driver info_get cb. Also, updates the devlink-info.rst and bnxt.rst documentation accordingly. This series adds a patch to fix few macro names that maps to bnxt_en firmware versions. v1->v2: Remove ECN dev param, base_mh_addr and serial number info support in this series. Rename drv.spec macro to fw.api. --- v2->v3: Remove hw.addr info as it is per netdev but not per device info. --- v3->v4: Rename "fw.api" to "fw.mgmt.api". Also, add a patch that modifies few macro names in info_get command, to match the devlink documentation. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents a1c7a53 + 2013d03 commit 4bd27ee

File tree

7 files changed

+113
-7
lines changed

7 files changed

+113
-7
lines changed

Documentation/networking/devlink/bnxt.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ The ``bnxt_en`` driver reports the following versions
5151
* - Name
5252
- Type
5353
- Description
54+
* - ``board.id``
55+
- fixed
56+
- Part number identifying the board design
5457
* - ``asic.id``
5558
- fixed
5659
- ASIC design identifier
@@ -63,12 +66,15 @@ The ``bnxt_en`` driver reports the following versions
6366
* - ``fw``
6467
- stored, running
6568
- Overall board firmware version
66-
* - ``fw.app``
67-
- stored, running
68-
- Data path firmware version
6969
* - ``fw.mgmt``
7070
- stored, running
71-
- Management firmware version
71+
- NIC hardware resource management firmware version
72+
* - ``fw.mgmt.api``
73+
- running
74+
- Minimum firmware interface spec version supported between driver and firmware
75+
* - ``fw.nsci``
76+
- stored, running
77+
- General platform management firmware version
7278
* - ``fw.roce``
7379
- stored, running
7480
- RoCE management firmware version

Documentation/networking/devlink/devlink-info.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ Control unit firmware version. This firmware is responsible for house
157157
keeping tasks, PHY control etc. but not the packet-by-packet data path
158158
operation.
159159

160+
fw.mgmt.api
161+
-----------
162+
163+
Firmware interface specification version of the software interfaces between
164+
driver and firmware.
165+
160166
fw.app
161167
------
162168

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7223,7 +7223,7 @@ static int __bnxt_hwrm_ver_get(struct bnxt *bp, bool silent)
72237223
static int bnxt_hwrm_ver_get(struct bnxt *bp)
72247224
{
72257225
struct hwrm_ver_get_output *resp = bp->hwrm_cmd_resp_addr;
7226-
u32 dev_caps_cfg;
7226+
u32 dev_caps_cfg, hwrm_ver;
72277227
int rc;
72287228

72297229
bp->hwrm_max_req_len = HWRM_MAX_REQ_LEN;
@@ -7243,6 +7243,19 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp)
72437243
resp->hwrm_intf_upd_8b);
72447244
netdev_warn(bp->dev, "Please update firmware with HWRM interface 1.0.0 or newer.\n");
72457245
}
7246+
7247+
hwrm_ver = HWRM_VERSION_MAJOR << 16 | HWRM_VERSION_MINOR << 8 |
7248+
HWRM_VERSION_UPDATE;
7249+
7250+
if (bp->hwrm_spec_code > hwrm_ver)
7251+
snprintf(bp->hwrm_ver_supp, FW_VER_STR_LEN, "%d.%d.%d",
7252+
HWRM_VERSION_MAJOR, HWRM_VERSION_MINOR,
7253+
HWRM_VERSION_UPDATE);
7254+
else
7255+
snprintf(bp->hwrm_ver_supp, FW_VER_STR_LEN, "%d.%d.%d",
7256+
resp->hwrm_intf_maj_8b, resp->hwrm_intf_min_8b,
7257+
resp->hwrm_intf_upd_8b);
7258+
72467259
snprintf(bp->fw_ver_str, BC_HWRM_STR_LEN, "%d.%d.%d.%d",
72477260
resp->hwrm_fw_maj_8b, resp->hwrm_fw_min_8b,
72487261
resp->hwrm_fw_bld_8b, resp->hwrm_fw_rsvd_8b);
@@ -11739,6 +11752,63 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
1173911752
return rc;
1174011753
}
1174111754

11755+
#define BNXT_VPD_LEN 512
11756+
static void bnxt_vpd_read_info(struct bnxt *bp)
11757+
{
11758+
struct pci_dev *pdev = bp->pdev;
11759+
int i, len, pos, ro_size;
11760+
ssize_t vpd_size;
11761+
u8 *vpd_data;
11762+
11763+
vpd_data = kmalloc(BNXT_VPD_LEN, GFP_KERNEL);
11764+
if (!vpd_data)
11765+
return;
11766+
11767+
vpd_size = pci_read_vpd(pdev, 0, BNXT_VPD_LEN, vpd_data);
11768+
if (vpd_size <= 0) {
11769+
netdev_err(bp->dev, "Unable to read VPD\n");
11770+
goto exit;
11771+
}
11772+
11773+
i = pci_vpd_find_tag(vpd_data, 0, vpd_size, PCI_VPD_LRDT_RO_DATA);
11774+
if (i < 0) {
11775+
netdev_err(bp->dev, "VPD READ-Only not found\n");
11776+
goto exit;
11777+
}
11778+
11779+
ro_size = pci_vpd_lrdt_size(&vpd_data[i]);
11780+
i += PCI_VPD_LRDT_TAG_SIZE;
11781+
if (i + ro_size > vpd_size)
11782+
goto exit;
11783+
11784+
pos = pci_vpd_find_info_keyword(vpd_data, i, ro_size,
11785+
PCI_VPD_RO_KEYWORD_PARTNO);
11786+
if (pos < 0)
11787+
goto read_sn;
11788+
11789+
len = pci_vpd_info_field_size(&vpd_data[pos]);
11790+
pos += PCI_VPD_INFO_FLD_HDR_SIZE;
11791+
if (len + pos > vpd_size)
11792+
goto read_sn;
11793+
11794+
strlcpy(bp->board_partno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN));
11795+
11796+
read_sn:
11797+
pos = pci_vpd_find_info_keyword(vpd_data, i, ro_size,
11798+
PCI_VPD_RO_KEYWORD_SERIALNO);
11799+
if (pos < 0)
11800+
goto exit;
11801+
11802+
len = pci_vpd_info_field_size(&vpd_data[pos]);
11803+
pos += PCI_VPD_INFO_FLD_HDR_SIZE;
11804+
if (len + pos > vpd_size)
11805+
goto exit;
11806+
11807+
strlcpy(bp->board_serialno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN));
11808+
exit:
11809+
kfree(vpd_data);
11810+
}
11811+
1174211812
static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])
1174311813
{
1174411814
struct pci_dev *pdev = bp->pdev;
@@ -11796,6 +11866,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1179611866
dev->ethtool_ops = &bnxt_ethtool_ops;
1179711867
pci_set_drvdata(pdev, dev);
1179811868

11869+
bnxt_vpd_read_info(bp);
11870+
1179911871
rc = bnxt_alloc_hwrm_resources(bp);
1180011872
if (rc)
1180111873
goto init_err_pci_clean;

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,10 @@ struct bnxt {
15001500
(chip_num) == CHIP_NUM_58804 || \
15011501
(chip_num) == CHIP_NUM_58808)
15021502

1503+
#define BNXT_VPD_FLD_LEN 32
1504+
char board_partno[BNXT_VPD_FLD_LEN];
1505+
char board_serialno[BNXT_VPD_FLD_LEN];
1506+
15031507
struct net_device *dev;
15041508
struct pci_dev *pdev;
15051509

@@ -1730,6 +1734,7 @@ struct bnxt {
17301734
#define BC_HWRM_STR_LEN 21
17311735
#define PHY_VER_STR_LEN (FW_VER_STR_LEN - BC_HWRM_STR_LEN)
17321736
char fw_ver_str[FW_VER_STR_LEN];
1737+
char hwrm_ver_supp[FW_VER_STR_LEN];
17331738
__be16 vxlan_port;
17341739
u8 vxlan_port_cnt;
17351740
__le16 vxlan_fw_dst_port_id;

drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,14 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
403403
if (rc)
404404
return rc;
405405

406+
if (strlen(bp->board_partno)) {
407+
rc = devlink_info_version_fixed_put(req,
408+
DEVLINK_INFO_VERSION_GENERIC_BOARD_ID,
409+
bp->board_partno);
410+
if (rc)
411+
return rc;
412+
}
413+
406414
sprintf(buf, "%X", bp->chip_num);
407415
rc = devlink_info_version_fixed_put(req,
408416
DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, buf);
@@ -471,13 +479,19 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
471479
ver_resp->roce_fw_bld_8b, ver_resp->roce_fw_rsvd_8b);
472480
}
473481
rc = devlink_info_version_running_put(req,
474-
DEVLINK_INFO_VERSION_GENERIC_FW_APP, fw_ver);
482+
DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, fw_ver);
483+
if (rc)
484+
return rc;
485+
486+
rc = devlink_info_version_running_put(req,
487+
DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API,
488+
bp->hwrm_ver_supp);
475489
if (rc)
476490
return rc;
477491

478492
if (!(bp->flags & BNXT_FLAG_CHIP_P5)) {
479493
rc = devlink_info_version_running_put(req,
480-
DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, mgmt_ver);
494+
DEVLINK_INFO_VERSION_GENERIC_FW_NCSI, mgmt_ver);
481495
if (rc)
482496
return rc;
483497

include/linux/pci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,6 +2184,7 @@ int pci_enable_atomic_ops_to_root(struct pci_dev *dev, u32 cap_mask);
21842184
#define PCI_VPD_INFO_FLD_HDR_SIZE 3
21852185

21862186
#define PCI_VPD_RO_KEYWORD_PARTNO "PN"
2187+
#define PCI_VPD_RO_KEYWORD_SERIALNO "SN"
21872188
#define PCI_VPD_RO_KEYWORD_MFR_ID "MN"
21882189
#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0"
21892190
#define PCI_VPD_RO_KEYWORD_CHKSUM "RV"

include/net/devlink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ enum devlink_param_generic_id {
481481
#define DEVLINK_INFO_VERSION_GENERIC_FW "fw"
482482
/* Control processor FW version */
483483
#define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT "fw.mgmt"
484+
/* FW interface specification version */
485+
#define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API "fw.mgmt.api"
484486
/* Data path microcode controlling high-speed packet processing */
485487
#define DEVLINK_INFO_VERSION_GENERIC_FW_APP "fw.app"
486488
/* UNDI software version */

0 commit comments

Comments
 (0)