bnxt_en: Bug fixes.
Michael Chan
maintainerv2 cover bnxt_en: Bug fixes.
2 Bug fixes related to 57500 shutdown sequence and doorbell sequence, 2 TC Flower bug fixes related to the setting of the flow direction, 1 NVRAM update bug fix, and a minor fix to suppress an unnecessary error message. Please queue for -stable as well. Thanks.
v2: Fix compile warning reported by kbuild test robot on patch #6.
Michael Chan (2):
bnxt_en: Fix VNIC clearing logic for 57500 chips.
bnxt_en: Improve RX doorbell sequence.
Somnath Kotur (1):
bnxt_en: Fix to include flow direction in L2 key
Vasundhara Volam (2):
bnxt_en: Fix handling FRAG_ERR when NVM_INSTALL_UPDATE cmd fails
bnxt_en: Suppress HWRM errors for HWRM_NVM_GET_VARIABLE command
Venkat Duvvuru (1):
bnxt_en: Use correct src_fid to determine direction of the flow
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 36 ++++++++++++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 9 ++++-- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 12 ++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 8 ++--- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h | 6 ++-- 5 files changed, 42 insertions(+), 29 deletions(-)
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH v2 1/6 bnxt_en: Fix VNIC clearing logic for 57500 chips.
During device shutdown, the VNIC clearing sequence needs to be modified to free the VNIC first before freeing the RSS contexts. The current code is doing the reverse and we can get mis-directed RX completions to CP ring ID 0 when the RSS contexts are freed and zeroed. The clearing of RSS contexts is not required with the new sequence.
Refactor the VNIC clearing logic into a new function bnxt_clear_vnic() and do the chip specific VNIC clearing sequence.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +18 -8
@@ -7016,19 +7016,29 @@ static void bnxt_hwrm_clear_vnic_rss(struct bnxt *bp)bnxt_hwrm_vnic_set_rss (bp, i, false); } -static void bnxt_hwrm_resource_free (struct bnxt *bp,bool close_path, -bool irq_re_init) +static void bnxt_clear_vnic (struct bnxt *bp) { -if (bp->vnic_info) { -bnxt_hwrm_clear_vnic_filter (bp); +if (!bp->vnic_info) +return ; + +bnxt_hwrm_clear_vnic_filter (bp); +if (!(bp->flags &BNXT_FLAG_CHIP_P5 )) {/* clear all RSS setting before free vnic ctx */ bnxt_hwrm_clear_vnic_rss (bp);bnxt_hwrm_vnic_ctx_free (bp); -/* before free the vnic, undo the vnic tpa settings */ -if (bp->flags &BNXT_FLAG_TPA ) -bnxt_set_tpa (bp, false); -bnxt_hwrm_vnic_free (bp); } +/* before free the vnic, undo the vnic tpa settings */ +if (bp->flags &BNXT_FLAG_TPA ) +bnxt_set_tpa (bp, false); +bnxt_hwrm_vnic_free (bp); +if (bp->flags &BNXT_FLAG_CHIP_P5 ) +bnxt_hwrm_vnic_ctx_free (bp); +} + +static void bnxt_hwrm_resource_free (struct bnxt *bp,bool close_path, +bool irq_re_init) +{ +bnxt_clear_vnic (bp);bnxt_hwrm_ring_free (bp, close_path);bnxt_hwrm_ring_grp_free (bp);if (irq_re_init) {
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH v2 2/6 bnxt_en: Improve RX doorbell sequence.
In reply to Michael ChanWhen both RX buffers and RX aggregation buffers have to be replenished at the end of NAPI, post the RX aggregation buffers first before RX buffers. Otherwise, we may run into a situation where there are only RX buffers without RX aggregation buffers for a split second. This will cause the hardware to abort the RX packet and report buffer errors, which will cause unnecessary cleanup by the driver.
Ringing the Aggregation ring doorbell first before the RX ring doorbell will prevent some of these buffer errors. Use the same sequence during ring initialization as well.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +7 -3
@@ -2021,9 +2021,9 @@ static void __bnxt_poll_work_done(struct bnxt *bp, struct bnxt_napi *bnapi)if (bnapi->events &BNXT_RX_EVENT ) {struct bnxt_rx_ring_info *rxr = bnapi->rx_ring; -bnxt_db_write (bp, &rxr->rx_db, rxr->rx_prod);if (bnapi->events &BNXT_AGG_EVENT )bnxt_db_write (bp, &rxr->rx_agg_db, rxr->rx_agg_prod); +bnxt_db_write (bp, &rxr->rx_db, rxr->rx_prod); } bnapi->events =0 ; }
@@ -5064,6 +5064,7 @@ static void bnxt_set_db(struct bnxt *bp, struct bnxt_db_info *db, u32 ring_type,static int bnxt_hwrm_ring_alloc (struct bnxt *bp) { +bool agg_rings = !!(bp->flags &BNXT_FLAG_AGG_RINGS );int i, rc =0 ;u32 type;
@@ -5139,7 +5140,9 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)if (rc) goto err_out;bnxt_set_db (bp, &rxr->rx_db, type, map_idx, ring->fw_ring_id); -bnxt_db_write (bp, &rxr->rx_db, rxr->rx_prod); +/* If we have agg rings, post agg buffers first. */ +if (!agg_rings) +bnxt_db_write (bp, &rxr->rx_db, rxr->rx_prod); bp->grp_info[map_idx].rx_fw_ring_id = ring->fw_ring_id;if (bp->flags &BNXT_FLAG_CHIP_P5 ) {struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
@@ -5158,7 +5161,7 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp) } } -if (bp->flags &BNXT_FLAG_AGG_RINGS ) { +if (agg_rings) { type =HWRM_RING_ALLOC_AGG ;for (i =0 ; i < bp->rx_nr_rings; i++) {struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i];
@@ -5174,6 +5177,7 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)bnxt_set_db (bp, &rxr->rx_agg_db, type, map_idx, ring->fw_ring_id);bnxt_db_write (bp, &rxr->rx_agg_db, rxr->rx_agg_prod); +bnxt_db_write (bp, &rxr->rx_db, rxr->rx_prod); bp->grp_info[grp_idx].agg_fw_ring_id = ring->fw_ring_id; } }
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH v2 3/6 bnxt_en: Fix handling FRAG_ERR when NVM_INSTALL_UPDATE cmd fails
In reply to Michael ChanFrom: Vasundhara Volam <[email protected]>
If FW returns FRAG_ERR in response error code, driver is resending the command only when HWRM command returns success. Fix the code to resend NVM_INSTALL_UPDATE command with DEFRAG install flags, if FW returns FRAG_ERR in its response error code.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +5 -7
@@ -2016,21 +2016,19 @@ static int bnxt_flash_package_from_file(struct net_device *dev,mutex_lock (&bp->hwrm_cmd_lock); hwrm_err =_hwrm_send_message (bp, &install,sizeof (install),INSTALL_PACKAGE_TIMEOUT ); -if (hwrm_err) - goto flash_pkg_exit; - -if (resp->error_code) { +if (hwrm_err) {u8 error_code = ((struct hwrm_err_output *)resp)->cmd_err; -if (error_code ==NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR ) { +if (resp->error_code && error_code == +NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR ) { install.flags |=cpu_to_le16 (NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG ); hwrm_err =_hwrm_send_message (bp, &install,sizeof (install),INSTALL_PACKAGE_TIMEOUT ); -if (hwrm_err) - goto flash_pkg_exit; } +if (hwrm_err) + goto flash_pkg_exit; }if (resp->result) {
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH v2 4/6 bnxt_en: Suppress HWRM errors for HWRM_NVM_GET_VARIABLE command
In reply to Michael ChanFrom: Vasundhara Volam <[email protected]>
For newly added NVM parameters, older firmware may not have the support. Suppress the error message to avoid the unncessary error message which is triggered when devlink calls the driver during initialization.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +6 -3
@@ -98,10 +98,13 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,if (idx) req->dimensions =cpu_to_le16 (1 ); -if (req->req_type ==cpu_to_le16 (HWRM_NVM_SET_VARIABLE )) +if (req->req_type ==cpu_to_le16 (HWRM_NVM_SET_VARIABLE )) {memcpy (data_addr, buf, bytesize); - - rc =hwrm_send_message (bp, msg, msg_len,HWRM_CMD_TIMEOUT ); + rc =hwrm_send_message (bp, msg, msg_len,HWRM_CMD_TIMEOUT ); + }else { + rc =hwrm_send_message_silent (bp, msg, msg_len, +HWRM_CMD_TIMEOUT ); + }if (!rc && req->req_type ==cpu_to_le16 (HWRM_NVM_GET_VARIABLE ))memcpy (buf, data_addr, bytesize);
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH v2 5/6 bnxt_en: Use correct src_fid to determine direction of the flow
In reply to Michael ChanFrom: Venkat Duvvuru <[email protected]>
Direction of the flow is determined using src_fid. For an RX flow, src_fid is PF's fid and for TX flow, src_fid is VF's fid. Direction of the flow must be specified, when getting statistics for that flow. Currently, for DECAP flow, direction is determined incorrectly, i.e., direction is initialized as TX for DECAP flow, instead of RX. Because of which, stats are not reported for this DECAP flow, though it is offloaded and there is traffic for that flow, resulting in flow age out.
This patch fixes the problem by determining the DECAP flow's direction using correct fid. Set the flow direction in all cases for consistency even if 64-bit flow handle is not used.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +1 -3
@@ -1285,9 +1285,7 @@ static int bnxt_tc_add_flow(struct bnxt *bp, u16 src_fid, goto free_node;bnxt_tc_set_src_fid (bp, flow, src_fid); - -if (bp->fw_cap &BNXT_FW_CAP_OVS_64BIT_HANDLE ) -bnxt_tc_set_flow_dir (bp, flow, src_fid); +bnxt_tc_set_flow_dir (bp, flow, flow->src_fid);if (!bnxt_tc_can_offload (bp, flow)) { rc = -EOPNOTSUPP ;
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH v2 6/6 bnxt_en: Fix to include flow direction in L2 key
In reply to Michael ChanFrom: Somnath Kotur <[email protected]>
FW expects the driver to provide unique flow reference handles for Tx or Rx flows. When a Tx flow and an Rx flow end up sharing a reference handle, flow offload does not seem to work. This could happen in the case of 2 flows having their L2 fields wildcarded but in different direction.
Fix to incorporate the flow direction as part of the L2 key
v2: Move the dir field to the end of the bnxt_tc_l2_key struct to fix the warning reported by kbuild test robot <[email protected]>. There is existing code that initializes the structure using nested initializer and will warn with the new u8 field added to the beginning. The structure also packs nicer when this new u8 is added to the end of the structure [MChan].
--- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 4 ++-- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +2 -2
@@ -1236,7 +1236,7 @@ static int __bnxt_tc_del_flow(struct bnxt *bp,static void bnxt_tc_set_flow_dir (struct bnxt *bp,struct bnxt_tc_flow *flow,u16 src_fid) { - flow->dir = (bp->pf.fw_fid == src_fid) ?BNXT_DIR_RX :BNXT_DIR_TX ; + flow->l2_key.dir = (bp->pf.fw_fid == src_fid) ?BNXT_DIR_RX :BNXT_DIR_TX ; } static void bnxt_tc_set_src_fid(struct bnxt *bp, struct bnxt_tc_flow *flow,
@@ -1405,7 +1405,7 @@ static void bnxt_fill_cfa_stats_req(struct bnxt *bp,* 2. 15th bit of flow_handle must specify the flow * direction (TX/RX). */ -if (flow_node->flow.dir ==BNXT_DIR_RX ) +if (flow_node->flow.l2_key.dir ==BNXT_DIR_RX ) handle =CFA_FLOW_INFO_REQ_FLOW_HANDLE_DIR_RX |CFA_FLOW_INFO_REQ_FLOW_HANDLE_MAX_MASK ;else
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h +3 -3
@@ -23,6 +23,9 @@ struct bnxt_tc_l2_key {__be16 inner_vlan_tci;__be16 ether_type;u8 num_vlans; +u8 dir; +#define BNXT_DIR_RX 1 +#define BNXT_DIR_TX 0 };struct bnxt_tc_l3_key {
@@ -98,9 +101,6 @@ struct bnxt_tc_flow {/* flow applicable to pkts ingressing on this fid */ u16 src_fid; -u8 dir; -#define BNXT_DIR_RX 1 -#define BNXT_DIR_TX 0struct bnxt_tc_l2_key l2_key;struct bnxt_tc_l2_key l2_mask;struct bnxt_tc_l3_key l3_key;
Signature · 1 line
2.5.1