bnxt_en: Updates for net-next
Subsystems (6)
Michael Chan
maintainerv2 cover bnxt_en: Updates for net-next
This patchset updates the driver with a FW interface update to support FEC stats histogram and NVRAM defragmentation. Patch #2 adds PTP cross timestamps [1]. Patch #3 adds FEC histogram stats. Patch #4 adds NVRAM defragmentation support that prevents FW update failure when NVRAM is fragmented. Patch #5 improves RSS distribution accuracy when certain number of rings is in use. The last patch adds ethtool .get_link_ext_state() support.
v2: Updated patches #4 and #6
v1 of the patchset:
https://lore.kernel.org/netdev/[email protected]/
[1] v1 of patch #3 posted earlier:
https://lore.kernel.org/netdev/[email protected]/
Michael Chan (4):
bnxt_en: Update FW interface to 1.10.3.151
bnxt_en: Add support for FEC bin histograms
bnxt_en: Use a larger RSS indirection table on P5_PLUS chips
bnxt_en: Implement ethtool_ops -> get_link_ext_state()
Pavan Chebbi (2):
bnxt_en: Add PTP .getcrosststamp() interface to get device/host times
bnxt_en: Defrag the NVRAM region when resizing UPDATE region fails
drivers/infiniband/hw/bnxt_re/main.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 39 +++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 6 + .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 118 ++++++++++++- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 47 +++++ include/linux/bnxt/hsi.h | 167 ++++++++++++++++-- include/uapi/linux/ethtool.h | 2 + 7 files changed, 361 insertions(+), 22 deletions(-)
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH v2 1/6 bnxt_en: Update FW interface to 1.10.3.151
The main changes are the new HWRM_PORT_PHY_FDRSTAT command to collect FEC histogram bins and the new HWRM_NVM_DEFRAG command to defragment the NVRAM. There is also a minor name change in struct hwrm_vnic_cfg_input that requires updating the bnxt_re driver's main.c.
--- drivers/infiniband/hw/bnxt_re/main.c | 4 +- include/linux/bnxt/hsi.h | 167 ++++++++++++++++++++++++--- 2 files changed, 153 insertions(+), 18 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +2 -2
@@ -595,10 +595,10 @@ int bnxt_re_hwrm_cfg_vnic(struct bnxt_re_dev *rdev, u32 qp_id)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 | + req.enables =cpu_to_le32 (VNIC_CFG_REQ_ENABLES_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.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,
include/linux/bnxt/hsi.h +151 -16
323 lines not on this page · raw message
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH v2 2/6 bnxt_en: Add PTP .getcrosststamp() interface to get device/host times
In reply to Michael ChanFrom: Pavan Chebbi <[email protected]>
.getcrosststamp() helps the applications to obtain a snapshot of device and host time almost taken at the same time. This function will report PCIe PTM device and host times to any application using the ioctl PTP_SYS_OFFSET_PRECISE. The device time from the HW is 48-bit and needs to be converted to 64-bit.
---
v2: Add check for x86 support
v1: https://lore.kernel.org/netdev/[email protected]/
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 + drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 47 +++++++++++++++++++ 3 files changed, 50 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -0
@@ -9691,6 +9691,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->fw_cap |=BNXT_FW_CAP_EXT_HW_STATS_SUPPORTED ;if (BNXT_PF (bp) && (flags_ext &FUNC_QCAPS_RESP_FLAGS_EXT_PTP_PPS_SUPPORTED )) bp->fw_cap |=BNXT_FW_CAP_PTP_PPS ; +if (flags_ext &FUNC_QCAPS_RESP_FLAGS_EXT_PTP_PTM_SUPPORTED ) + bp->fw_cap |=BNXT_FW_CAP_PTP_PTM ;if (flags_ext &FUNC_QCAPS_RESP_FLAGS_EXT_PTP_64BIT_RTC_SUPPORTED ) bp->fw_cap |=BNXT_FW_CAP_PTP_RTC ;if (BNXT_PF (bp) && (flags_ext &FUNC_QCAPS_RESP_FLAGS_EXT_HOT_RESET_IF_SUPPORT ))
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -0
@@ -2518,6 +2518,7 @@ struct bnxt {#define BNXT_FW_CAP_SW_MAX_RESOURCE_LIMITS BIT_ULL(41)#define BNXT_FW_CAP_NPAR_1_2 BIT_ULL(42)#define BNXT_FW_CAP_MIRROR_ON_ROCE BIT_ULL(43) +#define BNXT_FW_CAP_PTP_PTM BIT_ULL(44)u32 fw_dbg_cap;
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +47 -0
59 lines not on this page · raw message
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH v2 3/6 bnxt_en: Add support for FEC bin histograms
In reply to Michael ChanFill in the struct ethtool_fec_hist passed to the bnxt_get_fec_stats() callback if the FW supports the feature. Bins 0 to 15 inclusive are available when the feature is supported.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -0
@@ -2704,6 +2704,7 @@ struct bnxt {#define BNXT_PHY_FL_NO_PFC (PORT_PHY_QCAPS_RESP_FLAGS2_PFC_UNSUPPORTED << 8)#define BNXT_PHY_FL_BANK_SEL (PORT_PHY_QCAPS_RESP_FLAGS2_BANK_ADDR_SUPPORTED << 8)#define BNXT_PHY_FL_SPEEDS2 (PORT_PHY_QCAPS_RESP_FLAGS2_SPEEDS2_SUPPORTED << 8) +#define BNXT_PHY_FL_FDRSTATS (PORT_PHY_QCAPS_RESP_FLAGS2_FDRSTAT_CMD_SUPPORTED << 8)/* copied from flags in hwrm_port_mac_qcaps_output */ u8 mac_flags;
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +51 -0
63 lines not on this page · raw message
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH v2 4/6 bnxt_en: Defrag the NVRAM region when resizing UPDATE region fails
In reply to Michael ChanFrom: Pavan Chebbi <[email protected]>
When updating to a new firmware pkg, the driver checks if the UPDATE region is big enough for the pkg and if it's not big enough, it issues an NVM_WRITE cmd to update with the requested size.
This NVM_WRITE cmd can fail indicating fragmented region. Currently the driver fails the fw update when this happens. We can improve the situation by defragmenting the region and try the NVM_WRITE cmd again. This will make firmware update more reliable.
---
v2: Simplify the do-while loop.
v1: https://lore.kernel.org/netdev/[email protected]/
--- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +29 -3
@@ -3848,9 +3848,25 @@ static int nvm_update_err_to_stderr(struct net_device *dev, u8 result,#define BNXT_NVM_MORE_FLAG (cpu_to_le16(NVM_MODIFY_REQ_FLAGS_BATCH_MODE))#define BNXT_NVM_LAST_FLAG (cpu_to_le16(NVM_MODIFY_REQ_FLAGS_BATCH_LAST)) +static int bnxt_hwrm_nvm_defrag (struct bnxt *bp) +{ +struct hwrm_nvm_defrag_input *req; +int rc; + + rc =hwrm_req_init (bp, req,HWRM_NVM_DEFRAG ); +if (rc) +return rc; + req->flags =cpu_to_le32 (NVM_DEFRAG_REQ_FLAGS_DEFRAG ); +hwrm_req_timeout (bp, req, bp->hwrm_cmd_max_timeout); + +return hwrm_req_send (bp, req); +} +static int bnxt_resize_update_entry (struct net_device *dev,size_t fw_size,struct netlink_ext_ack *extack) { +struct bnxt *bp =netdev_priv (dev); +bool retry = false;u32 item_len;int rc;
@@ -3863,9 +3879,19 @@ static int bnxt_resize_update_entry(struct net_device *dev, size_t fw_size, }if (fw_size > item_len) { - rc =bnxt_flash_nvram (dev,BNX_DIR_TYPE_UPDATE , -BNX_DIR_ORDINAL_FIRST ,0 ,1 , -round_up (fw_size,4096 ),NULL ,0 ); +do { + rc =bnxt_flash_nvram (dev,BNX_DIR_TYPE_UPDATE , +BNX_DIR_ORDINAL_FIRST ,0 ,1 , +round_up (fw_size,4096 ),NULL , +0 ); + +if (rc == -ENOSPC ) { +if (retry ||bnxt_hwrm_nvm_defrag (bp)) +break ; + retry = true; + } + }while (rc == -ENOSPC ); +if (rc) {BNXT_NVM_ERR_MSG (dev, extack,MSG_RESIZE_UPDATE_ERR );return rc;
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH v2 5/6 bnxt_en: Use a larger RSS indirection table on P5_PLUS chips
In reply to Michael ChanThe driver currently uses a chip supported RSS indirection table size just big enough to cover the number of RX rings. Each table with 64 entries requires one HW RSS context. The HW supported table sizes are 64, 128, 256, and 512 entries. Using the smallest table size can cause unbalanced RSS packet distributions. For example, if the number of rings is 48, the table size using existing logic will be 64. 32 rings will have a weight of 1 and 16 rings will have a weight of 2 when set to default even distribution. This represents a 100% difference in weights between some of the rings.
Newer FW has increased the RSS indirection table resource. When the increased resource is detected, use the largest RSS indirection table size (512 entries) supported by the chip. Using the same example above, the weights of the 48 rings will be either 10 or 11 when set to default even distribution. The weight difference is only 10%.
If there are thousands of VFs, there is a possiblity that we may not be able to allocate this larger RSS indirection table from the FW, so we add a check to fall back to the legacy scheme.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 ++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 +++ 2 files changed, 15 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +12 -0
@@ -6558,6 +6558,9 @@ int bnxt_get_nr_rss_ctxs(struct bnxt *bp, int rx_rings)if (bp->flags &BNXT_FLAG_CHIP_P5_PLUS ) {if (!rx_rings)return 0 ; +if (bp->rss_cap &BNXT_RSS_CAP_LARGE_RSS_CTX ) +return BNXT_RSS_TABLE_MAX_TBL_P5 ; +return bnxt_calc_nr_ring_pages (rx_rings -1 ,BNXT_RSS_TABLE_ENTRIES_P5 ); }
@@ -8068,6 +8071,11 @@ static int __bnxt_reserve_rings(struct bnxt *bp) bp->rx_nr_rings = rx_rings; bp->cp_nr_rings = hwr.cp; +/* Fall back if we cannot reserve enough HW RSS contexts */ +if ((bp->rss_cap &BNXT_RSS_CAP_LARGE_RSS_CTX ) && + hwr.rss_ctx <bnxt_get_total_rss_ctxs (bp, &hwr)) + bp->rss_cap &= ~BNXT_RSS_CAP_LARGE_RSS_CTX ; +if (!bnxt_rings_ok (bp, &hwr))return -ENOMEM ;
@@ -9558,6 +9566,10 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all) hw_resc->min_stat_ctxs =le16_to_cpu (resp->min_stat_ctx); hw_resc->max_stat_ctxs =le16_to_cpu (resp->max_stat_ctx); +if (hw_resc->max_rsscos_ctxs >= + hw_resc->max_vnics *BNXT_LARGE_RSS_TO_VNIC_RATIO ) + bp->rss_cap |=BNXT_RSS_CAP_LARGE_RSS_CTX ; +if (bp->flags &BNXT_FLAG_CHIP_P5_PLUS ) {u16 max_msix =le16_to_cpu (resp->max_msix);
drivers/net/ethernet/broadcom/bnxt/bnxt.h +3 -0
@@ -1369,6 +1369,8 @@ struct bnxt_hw_resc {u32 max_rx_wm_flows; }; +#define BNXT_LARGE_RSS_TO_VNIC_RATIO 7 + #if defined(CONFIG_BNXT_SRIOV) struct bnxt_vf_info { u16 fw_fid;
@@ -2412,6 +2414,7 @@ struct bnxt {#define BNXT_RSS_CAP_ESP_V6_RSS_CAP BIT(7)#define BNXT_RSS_CAP_MULTI_RSS_CTX BIT(8)#define BNXT_RSS_CAP_IPV6_FLOW_LABEL_RSS_CAP BIT(9) +#define BNXT_RSS_CAP_LARGE_RSS_CTX BIT(10)u8 rss_hash_key[HW_HASH_KEY_SIZE ]; u8 rss_hash_key_valid:1;
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH v2 6/6 bnxt_en: Implement ethtool_ops -> get_link_ext_state()
In reply to Michael ChanMap the link_down_reason from the FW to the ethtool link_ext_state when it is available. Also log it to the link down dmesg when it is available. Add 2 new link_ext_state enums to the UAPI:
ETHTOOL_LINK_EXT_STATE_OTP_SPEED_VIOLATIONETHTOOL_LINK_EXT_STATE_BMC_REQUEST_DOWN
to cover OTP (one-time-programmable) speed restrictions and BMC (Baseboard management controller) forcing the link down.
---
v2: Add new UAPIs, remove spurious semi-colon, remove an invalid TX_LASER_DISABLE reason.
v1: https://lore.kernel.org/netdev/[email protected]/
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 25 ++++++++++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 35 +++++++++++++++++++ include/uapi/linux/ethtool.h | 2 ++ 4 files changed, 62 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +24 -1
@@ -11906,6 +11906,26 @@ static char *bnxt_report_fec(struct bnxt_link_info *link_info) } } +static char *bnxt_link_down_reason (struct bnxt_link_info *link_info) +{ +u8 reason = link_info->link_down_reason; + +/* Multiple bits can be set, we report 1 bit only in order of +* priority. +*/ +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_RF ) +return "(Remote fault)" ; +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_OTP_SPEED_VIOLATION ) +return "(OTP Speed limit violation)" ; +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_CABLE_REMOVED ) +return "(Cable removed)" ; +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_MODULE_FAULT ) +return "(Module fault)" ; +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_BMC_REQUEST ) +return "(BMC request down)" ; +return "" ; +} +void bnxt_report_link (struct bnxt *bp) {if (BNXT_LINK_IS_UP (bp)) {
@@ -11963,8 +11983,10 @@ void bnxt_report_link(struct bnxt *bp) (fec &BNXT_FEC_AUTONEG ) ?"on" :"off" , bnxt_report_fec(&bp->link_info)); }else { +char *str =bnxt_link_down_reason (&bp->link_info); +netif_carrier_off (bp->dev); -netdev_err (bp->dev,"NIC Link is Down\n" ); +netdev_err (bp->dev,"NIC Link is Down %s\n" , str); } }
@@ -12164,6 +12186,7 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state) link_info->phy_addr = resp->eee_config_phy_addr &PORT_PHY_QCFG_RESP_PHY_ADDR_MASK ; link_info->module_status = resp->module_status; + link_info->link_down_reason = resp->link_down_reason;if (bp->phy_flags &BNXT_PHY_FL_EEE_CAP ) {struct ethtool_keee *eee = &bp->eee;
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -0
@@ -1555,6 +1555,7 @@ struct bnxt_link_info {#define BNXT_LINK_STATE_DOWN 1#define BNXT_LINK_STATE_UP 2#define BNXT_LINK_IS_UP (bp) ((bp)->link_info.link_state == BNXT_LINK_STATE_UP) +u8 link_down_reason;u8 active_lanes;u8 duplex;#define BNXT_LINK_DUPLEX_HALF PORT_PHY_QCFG_RESP_DUPLEX_STATE_HALF
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +35 -0
@@ -3432,6 +3432,40 @@ static u32 bnxt_get_link(struct net_device *dev)return BNXT_LINK_IS_UP (bp); } +static int bnxt_get_link_ext_state (struct net_device *dev, +struct ethtool_link_ext_state_info *info) +{ +struct bnxt *bp =netdev_priv (dev); +u8 reason; + +if (BNXT_LINK_IS_UP (bp)) +return -ENODATA ; + + reason = bp->link_info.link_down_reason; +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_RF ) { + info->link_ext_state =ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE ; + info->link_training =ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT ; +return 0 ; + } +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_CABLE_REMOVED ) { + info->link_ext_state =ETHTOOL_LINK_EXT_STATE_NO_CABLE ; +return 0 ; + } +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_OTP_SPEED_VIOLATION ) { + info->link_ext_state =ETHTOOL_LINK_EXT_STATE_OTP_SPEED_VIOLATION ; +return 0 ; + } +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_MODULE_FAULT ) { + info->link_ext_state =ETHTOOL_LINK_EXT_STATE_MODULE ; +return 0 ; + } +if (reason &PORT_PHY_QCFG_RESP_LINK_DOWN_REASON_BMC_REQUEST ) { + info->link_ext_state =ETHTOOL_LINK_EXT_STATE_BMC_REQUEST_DOWN ; +return 0 ; + } +return -ENODATA ; +} +int bnxt_hwrm_nvm_get_dev_info (struct bnxt *bp,struct hwrm_nvm_get_dev_info_output *nvm_dev_info) {
@@ -5711,6 +5745,7 @@ const struct ethtool_ops bnxt_ethtool_ops = { .get_eeprom = bnxt_get_eeprom, .set_eeprom = bnxt_set_eeprom, .get_link = bnxt_get_link, + .get_link_ext_state = bnxt_get_link_ext_state, .get_link_ext_stats = bnxt_get_link_ext_stats, .get_eee = bnxt_get_eee, .set_eee = bnxt_set_eee,
include/uapi/linux/ethtool.h +2 -0
@@ -603,6 +603,8 @@ enum ethtool_link_ext_state {ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED ,ETHTOOL_LINK_EXT_STATE_OVERHEAT ,ETHTOOL_LINK_EXT_STATE_MODULE , +ETHTOOL_LINK_EXT_STATE_OTP_SPEED_VIOLATION , + ETHTOOL_LINK_EXT_STATE_BMC_REQUEST_DOWN, };/* More information in addition to ETHTOOL_LINK_EXT_STATE_AUTONEG. */
Signature · 1 line
2.51.0
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Thu, 8 Jan 2026 10:35:15 -0800 you wrote:
This patchset updates the driver with a FW interface update to support FEC stats histogram and NVRAM defragmentation. Patch #2 adds PTP cross timestamps [1]. Patch #3 adds FEC histogram stats. Patch #4 adds NVRAM defragmentation support that prevents FW update failure when NVRAM is fragmented. Patch #5 improves RSS distribution accuracy when certain number of rings is in use. The last patch adds ethtool .get_link_ext_state() support.
[...]
Here is the summary with links:
- [net-next,v2,1/6] bnxt_en: Update FW interface to 1.10.3.151
https://git.kernel.org/netdev/net-next/c/fdb573d675e3 - [net-next,v2,2/6] bnxt_en: Add PTP .getcrosststamp() interface to get device/host times https://git.kernel.org/netdev/net-next/c/c470195b989f - [net-next,v2,3/6] bnxt_en: Add support for FEC bin histograms https://git.kernel.org/netdev/net-next/c/e1c9c8928b5b - [net-next,v2,4/6] bnxt_en: Defrag the NVRAM region when resizing UPDATE region fails https://git.kernel.org/netdev/net-next/c/743e683596fa - [net-next,v2,5/6] bnxt_en: Use a larger RSS indirection table on P5_PLUS chips https://git.kernel.org/netdev/net-next/c/51b9d3f948b8 - [net-next,v2,6/6] bnxt_en: Implement ethtool_ops -> get_link_ext_state() https://git.kernel.org/netdev/net-next/c/bc87b14594e3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html