ice: Don't allow VLAN stripping change when pvid set
Subsystems (2)
Tony Nguyen
maintainerPATCH 1/14 ice: Don't allow VLAN stripping change when pvid set
From: Brett Creeley <[email protected]>
Currently, if the PVID is set in the VLAN handling section of the VSI context the driver still allows VLAN stripping to be enabled/disabled. VLAN stripping should only be modifiable when the PVID is not set. Fix this by preventing VLAN stripping modification when PVID is set.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/ice/ice_lib.c +6 -0
@@ -1847,6 +1847,12 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)enum ice_status status;int ret =0 ; +/* do not allow modifying VLAN stripping when a port VLAN is configured +* on this VSI +*/ +if (vsi->info.pvid) +return 0 ; + ctxt =kzalloc (sizeof (*ctxt),GFP_KERNEL );if (!ctxt)return -ENOMEM ;
Signature · 1 line
2.20.1
Tony Nguyen
maintainerPATCH 2/14 ice: Handle critical FW error during admin queue initialization
From: Evan Swanson <[email protected]>
A race condition between FW and SW can occur between admin queue setup and the first command sent. A link event may occur and FW attempts to notify a non-existent queue. FW will set the critical error bit and disable the queue. When this happens retry queue setup.
--- drivers/net/ethernet/intel/ice/ice_controlq.c | 126 ++++++++++-------- drivers/net/ethernet/intel/ice/ice_controlq.h | 3 + .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 2 + drivers/net/ethernet/intel/ice/ice_status.h | 1 + 5 files changed, 80 insertions(+), 54 deletions(-)
drivers/net/ethernet/intel/ice/ice_controlq.c +72 -54
@@ -12,6 +12,7 @@ do { \ (qinfo)->sq.bal = prefix##_ATQBAL; \ (qinfo)->sq.len_mask = prefix##_ATQLEN_ATQLEN_M; \ (qinfo)->sq.len_ena_mask = prefix##_ATQLEN_ATQENABLE_M; \ + (qinfo)->sq.len_crit_mask = prefix##_ATQLEN_ATQCRIT_M; \ (qinfo)->sq.head_mask = prefix##_ATQH_ATQH_M; \ (qinfo)->rq.head = prefix##_ARQH; \ (qinfo)->rq.tail = prefix##_ARQT; \
@@ -20,6 +21,7 @@ do { \ (qinfo)->rq.bal = prefix##_ARQBAL; \ (qinfo)->rq.len_mask = prefix##_ARQLEN_ARQLEN_M; \ (qinfo)->rq.len_ena_mask = prefix##_ARQLEN_ARQENABLE_M; \ + (qinfo)->rq.len_crit_mask = prefix##_ARQLEN_ARQCRIT_M; \ (qinfo)->rq.head_mask = prefix##_ARQH_ARQH_M; \ }while (0 )
@@ -641,6 +643,50 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)return ret_code; } +/** +* ice_shutdown_ctrlq - shutdown routine for any control queue +* @hw: pointer to the hardware structure +* @q_type: specific Control queue type +* +* NOTE: this function does not destroy the control queue locks. +*/ +static void ice_shutdown_ctrlq (struct ice_hw *hw,enum ice_ctl_q q_type) +{ +struct ice_ctl_q_info *cq; + +switch (q_type) { +case ICE_CTL_Q_ADMIN : + cq = &hw->adminq; +if (ice_check_sq_alive (hw, cq)) +ice_aq_q_shutdown (hw, true); +break ; +case ICE_CTL_Q_MAILBOX : + cq = &hw->mailboxq; +break ; +default : +return ; + } + +ice_shutdown_sq (hw, cq); +ice_shutdown_rq (hw, cq); +} + +/** +* ice_shutdown_all_ctrlq - shutdown routine for all control queues +* @hw: pointer to the hardware structure +* +* NOTE: this function does not destroy the control queue locks. The driver +* may call this at runtime to shutdown and later restart control queues, such +* as in response to a reset event. +*/ +void ice_shutdown_all_ctrlq (struct ice_hw *hw) +{ +/* Shutdown FW admin queue */ +ice_shutdown_ctrlq (hw,ICE_CTL_Q_ADMIN ); +/* Shutdown PF-VF Mailbox */ +ice_shutdown_ctrlq (hw,ICE_CTL_Q_MAILBOX ); +} +/** * ice_init_all_ctrlq - main initialization routine for all control queues * @hw: pointer to the hardware structure
@@ -656,17 +702,27 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)*/ enum ice_status ice_init_all_ctrlq (struct ice_hw *hw) { -enum ice_status ret_code; +enum ice_status status; +u32 retry =0 ;/* Init FW admin queue */ - ret_code =ice_init_ctrlq (hw,ICE_CTL_Q_ADMIN ); -if (ret_code) -return ret_code; +do { + status =ice_init_ctrlq (hw,ICE_CTL_Q_ADMIN ); +if (status) +return status; - ret_code =ice_init_check_adminq (hw); -if (ret_code) -return ret_code; + status =ice_init_check_adminq (hw); +if (status !=ICE_ERR_AQ_FW_CRITICAL ) +break ; +ice_debug (hw,ICE_DBG_AQ_MSG , +"Retry Admin Queue init due to FW critical error\n" ); +ice_shutdown_ctrlq (hw,ICE_CTL_Q_ADMIN ); +msleep (ICE_CTL_Q_ADMIN_INIT_MSEC ); + }while (retry++ <ICE_CTL_Q_ADMIN_INIT_TIMEOUT ); + +if (status) +return status;/* Init Mailbox queue */ return ice_init_ctrlq (hw,ICE_CTL_Q_MAILBOX ); }
@@ -707,50 +763,6 @@ enum ice_status ice_create_all_ctrlq(struct ice_hw *hw)return ice_init_all_ctrlq (hw); } -/** -* ice_shutdown_ctrlq - shutdown routine for any control queue -* @hw: pointer to the hardware structure -* @q_type: specific Control queue type -* -* NOTE: this function does not destroy the control queue locks. -*/ -static void ice_shutdown_ctrlq (struct ice_hw *hw,enum ice_ctl_q q_type) -{ -struct ice_ctl_q_info *cq; - -switch (q_type) { -case ICE_CTL_Q_ADMIN : - cq = &hw->adminq; -if (ice_check_sq_alive (hw, cq)) -ice_aq_q_shutdown (hw, true); -break ; -case ICE_CTL_Q_MAILBOX : - cq = &hw->mailboxq; -break ; -default : -return ; - } - -ice_shutdown_sq (hw, cq); -ice_shutdown_rq (hw, cq); -} - -/** -* ice_shutdown_all_ctrlq - shutdown routine for all control queues -* @hw: pointer to the hardware structure -* -* NOTE: this function does not destroy the control queue locks. The driver -* may call this at runtime to shutdown and later restart control queues, such -* as in response to a reset event. -*/ -void ice_shutdown_all_ctrlq (struct ice_hw *hw) -{ -/* Shutdown FW admin queue */ -ice_shutdown_ctrlq (hw,ICE_CTL_Q_ADMIN ); -/* Shutdown PF-VF Mailbox */ -ice_shutdown_ctrlq (hw,ICE_CTL_Q_MAILBOX ); -} -/** * ice_destroy_ctrlq_locks - Destroy locks for a control queue * @cq: pointer to the control queue
@@ -1049,9 +1061,15 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,/* update the error if time out occurred */ if (!cmd_completed) { -ice_debug (hw,ICE_DBG_AQ_MSG , -"Control Send Queue Writeback timeout.\n" ); - status =ICE_ERR_AQ_TIMEOUT ; +if (rd32 (hw, cq->rq.len) & cq->rq.len_crit_mask || +rd32 (hw, cq->sq.len) & cq->sq.len_crit_mask) { +ice_debug (hw,ICE_DBG_AQ_MSG ,"Critical FW error.\n" ); + status =ICE_ERR_AQ_FW_CRITICAL ; + }else { +ice_debug (hw,ICE_DBG_AQ_MSG , +"Control Send Queue Writeback timeout.\n" ); + status =ICE_ERR_AQ_TIMEOUT ; + } } sq_send_command_error:
drivers/net/ethernet/intel/ice/ice_controlq.h +3 -0
@@ -34,6 +34,8 @@ enum ice_ctl_q {/* Control Queue timeout settings - max delay 250ms */ #define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500/* Count 2500 times */ #define ICE_CTL_Q_SQ_CMD_USEC 100/* Check every 100usec */ +#define ICE_CTL_Q_ADMIN_INIT_TIMEOUT 10/* Count 10 times */ +#define ICE_CTL_Q_ADMIN_INIT_MSEC 100/* Check every 100msec */ struct ice_ctl_q_ring {void *dma_head;/* Virtual address to DMA head */
@@ -59,6 +61,7 @@ struct ice_ctl_q_ring {u32 bal;u32 len_mask;u32 len_ena_mask; +u32 len_crit_mask;u32 head_mask; };
drivers/net/ethernet/intel/ice/ice_hw_autogen.h +2 -0
@@ -39,6 +39,7 @@#define PF_MBX_ARQH_ARQH_M ICE_M(0x3FF, 0)#define PF_MBX_ARQLEN 0x0022E480#define PF_MBX_ARQLEN_ARQLEN_M ICE_M(0x3FF, 0) +#define PF_MBX_ARQLEN_ARQCRIT_M BIT(30)#define PF_MBX_ARQLEN_ARQENABLE_M BIT(31)#define PF_MBX_ARQT 0x0022E580#define PF_MBX_ATQBAH 0x0022E180
@@ -47,6 +48,7 @@#define PF_MBX_ATQH_ATQH_M ICE_M(0x3FF, 0)#define PF_MBX_ATQLEN 0x0022E200#define PF_MBX_ATQLEN_ATQLEN_M ICE_M(0x3FF, 0) +#define PF_MBX_ATQLEN_ATQCRIT_M BIT(30)#define PF_MBX_ATQLEN_ATQENABLE_M BIT(31)#define PF_MBX_ATQT 0x0022E300#define PRTDCB_GENC 0x00083000
drivers/net/ethernet/intel/ice/ice_main.c +2 -0
@@ -5292,6 +5292,8 @@ const char *ice_stat_str(enum ice_status stat_err)return "ICE_ERR_AQ_NO_WORK" ;case ICE_ERR_AQ_EMPTY :return "ICE_ERR_AQ_EMPTY" ; +case ICE_ERR_AQ_FW_CRITICAL : +return "ICE_ERR_AQ_FW_CRITICAL" ; }return "ICE_ERR_UNKNOWN" ;
drivers/net/ethernet/intel/ice/ice_status.h +1 -0
@@ -37,6 +37,7 @@ enum ice_status {ICE_ERR_AQ_FULL =-102 ,ICE_ERR_AQ_NO_WORK =-103 ,ICE_ERR_AQ_EMPTY =-104 , + ICE_ERR_AQ_FW_CRITICAL = -105, };#endif /* _ICE_STATUS_H_ */
Signature · 1 line
2.20.1
Bowers
PATCH 2/14 ice: Handle critical FW error during admin queue initialization
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 02/14] ice: Handle critical FW error during admin queue initializationFrom: Evan Swanson <[email protected]>
A race condition between FW and SW can occur between admin queue setup and the first command sent. A link event may occur and FW attempts to notify a non-existent queue. FW will set the critical error bit and disable the queue. When this happens retry queue setup.
Signed-off-by Evan Swanson <[email protected]>Signed-off-by Anirudh Venkataramanan
Quoted 8 lines
Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_controlq.c | 126 ++++++++++-------- drivers/net/ethernet/intel/ice/ice_controlq.h | 3 + .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 2 + drivers/net/ethernet/intel/ice/ice_status.h | 1 + 5 files changed, 80 insertions(+), 54 deletions(-)
Tony Nguyen
maintainerPATCH 3/14 ice: Change number of XDP TxQ to 0 when destroying rings
In reply to Tony NguyenFrom: Marta Plantykow <[email protected]>
When XDP Tx rings are destroyed the number of XDP Tx queues is not changing. This patch is changing this number to 0.
--- drivers/net/ethernet/intel/ice/ice_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/ice/ice_main.c +3 -0
@@ -1906,6 +1906,9 @@ int ice_destroy_xdp_rings(struct ice_vsi *vsi)for (i =0 ; i < vsi->tc_cfg.numtc; i++) max_txqs[i] = vsi->num_txq; +/* change number of XDP Tx queues to 0 */ + vsi->num_xdp_txq =0 ; +return ice_cfg_vsi_lan (vsi->port_info, vsi->idx, vsi->tc_cfg.ena_tc, max_txqs); }
Signature · 1 line
2.20.1
Bowers
PATCH 3/14 ice: Change number of XDP TxQ to 0 when destroying rings
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 03/14] ice: Change number of XDP TxQ to 0 when destroying ringsFrom: Marta Plantykow <[email protected]>
Quoted 7 lines
When XDP Tx rings are destroyed the number of XDP Tx queues is not changing. This patch is changing this number to 0.
Signed-off-by Marta Plantykow <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 3 +++ 1 file changed, 3 insertions(+)
Tony Nguyen
maintainerPATCH 4/14 ice: Add XDP Tx to VSI ring stats
In reply to Tony NguyenFrom: Marta Plantykow <[email protected]>
When XDP Tx program is loaded and packets are sent from interface, VSI statistics are not updated. This patch adds packets sent on Tx XDP ring to VSI ring stats.
--- drivers/net/ethernet/intel/ice/ice_main.c | 42 ++++++++++++++++++----- 1 file changed, 33 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +33 -9
@@ -4281,6 +4281,33 @@ ice_fetch_u64_stats_per_ring(struct ice_ring *ring, u64 *pkts, u64 *bytes) }while (u64_stats_fetch_retry_irq (&ring->syncp, start)); } +/** +* ice_update_vsi_tx_ring_stats - Update VSI Tx ring stats counters +* @vsi: the VSI to be updated +* @rings: rings to work on +* @count: number of rings +*/ +static void +ice_update_vsi_tx_ring_stats (struct ice_vsi *vsi,struct ice_ring **rings, +u16 count) +{ +struct rtnl_link_stats64 *vsi_stats = &vsi->net_stats; +u16 i; + +for (i =0 ; i < count; i++) { +struct ice_ring *ring; +u64 pkts, bytes; + + ring =READ_ONCE (rings[i]); +ice_fetch_u64_stats_per_ring (ring, &pkts, &bytes); + vsi_stats->tx_packets += pkts; + vsi_stats->tx_bytes += bytes; + vsi->tx_restart += ring->tx_stats.restart_q; + vsi->tx_busy += ring->tx_stats.tx_busy; + vsi->tx_linearize += ring->tx_stats.tx_linearize; + } +} +/** * ice_update_vsi_ring_stats - Update VSI stats counters * @vsi: the VSI to be updated
@@ -4308,15 +4335,7 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)rcu_read_lock ();/* update Tx rings counters */ -ice_for_each_txq (vsi, i) { - ring =READ_ONCE (vsi->tx_rings[i]); -ice_fetch_u64_stats_per_ring (ring, &pkts, &bytes); - vsi_stats->tx_packets += pkts; - vsi_stats->tx_bytes += bytes; - vsi->tx_restart += ring->tx_stats.restart_q; - vsi->tx_busy += ring->tx_stats.tx_busy; - vsi->tx_linearize += ring->tx_stats.tx_linearize; - } +ice_update_vsi_tx_ring_stats (vsi, vsi->tx_rings, vsi->num_txq);/* update Rx rings counters */ ice_for_each_rxq (vsi, i) {
@@ -4328,6 +4347,11 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi) vsi->rx_page_failed += ring->rx_stats.alloc_page_failed; } +/* update XDP Tx rings counters */ +if (ice_is_xdp_ena_vsi (vsi)) +ice_update_vsi_tx_ring_stats (vsi, vsi->xdp_rings, + vsi->num_xdp_txq); +rcu_read_unlock (); }
Signature · 1 line
2.20.1
Bowers
PATCH 4/14 ice: Add XDP Tx to VSI ring stats
Quoted 9 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 04/14] ice: Add XDP Tx to VSI ring statsFrom: Marta Plantykow <[email protected]>
Quoted 8 lines
When XDP Tx program is loaded and packets are sent from interface, VSI statistics are not updated. This patch adds packets sent on Tx XDP ring to VSI ring stats.
Signed-off-by Marta Plantykow <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 42 ++++++++++++++++++----- 1 file changed, 33 insertions(+), 9 deletions(-)
Tony Nguyen
maintainerPATCH 5/14 ice: Change number of XDP Tx queues to match number of Rx queues
In reply to Tony NguyenFrom: Marta Plantykow <[email protected]>
In current implementation number of XDP Tx queues is the same as the number of transmit queues, which is not always true. This patch changes this number to match the number of receive queues. XDP programs are running on Rx rings, so what we actually need to provide is the XDP Tx ring per each Rx ring so that the whole XDP ecosystem is functional, e.g. if the result of XDP prog is XDP_TX then you have the need to access the XDP Tx ring.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +1 -1
@@ -2835,7 +2835,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)ice_vsi_map_rings_to_vectors (vsi);if (ice_is_xdp_ena_vsi (vsi)) { - vsi->num_xdp_txq = vsi->alloc_txq; + vsi->num_xdp_txq = vsi->alloc_rxq; ret =ice_prepare_xdp_rings (vsi, vsi->xdp_prog);if (ret) goto err_vectors;
drivers/net/ethernet/intel/ice/ice_main.c +1 -1
@@ -1942,7 +1942,7 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog, }if (!ice_is_xdp_ena_vsi (vsi) && prog) { - vsi->num_xdp_txq = vsi->alloc_txq; + vsi->num_xdp_txq = vsi->alloc_rxq; xdp_ring_err =ice_prepare_xdp_rings (vsi, prog);if (xdp_ring_err)NL_SET_ERR_MSG_MOD (extack,"Setting up XDP Tx resources failed" );
Signature · 1 line
2.20.1
Bowers
PATCH 5/14 ice: Change number of XDP Tx queues to match number of Rx queues
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 05/14] ice: Change number of XDP Tx queues to match number of Rx queuesFrom: Marta Plantykow <[email protected]>
In current implementation number of XDP Tx queues is the same as the number of transmit queues, which is not always true. This patch changes this number to match the number of receive queues.
XDP programs are running on Rx rings, so what we actually need to provide is the XDP Tx ring per each Rx ring so that the whole XDP ecosystem is functional, e.g. if the result of XDP prog isXDP_TXthen you have the need to access the XDP Tx ring.
Quoted 5 lines
Signed-off-by Marta Plantykow <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Tony Nguyen
maintainerPATCH 6/14 ice: avoid undefined behavior
In reply to Tony NguyenFrom: Bruce Allan <[email protected]>
When writing the driver's struct ice_tlan_ctx structure, do not write the 8-bit element int_q_state with the associated internal-to-hardware field which is 122-bits, otherwise the helper function ice_write_byte() will use undefined behavior when setting the mask used for that write. This should not cause any functional change and will avoid use of undefined behavior. Also, update a comment to highlight this structure element is not written.
--- drivers/net/ethernet/intel/ice/ice_base.c | 5 +++-- drivers/net/ethernet/intel/ice/ice_common.c | 12 ++++++++++-- drivers/net/ethernet/intel/ice/ice_common.h | 3 ++- drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +3 -2
@@ -638,6 +638,7 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,struct ice_aqc_add_txqs_perq *txq;struct ice_pf *pf = vsi->back;u8 buf_len =sizeof (*qg_buf); +struct ice_hw *hw = &pf->hw;enum ice_status status;u16 pf_q;u8 tc;
@@ -646,13 +647,13 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,ice_setup_tx_ctx (ring, &tlan_ctx, pf_q);/* copy context contents into the qg_buf */ qg_buf->txqs[0 ].txq_id =cpu_to_le16 (pf_q); -ice_set_ctx ((u8 *)&tlan_ctx, qg_buf->txqs[0 ].txq_ctx, +ice_set_ctx (hw, (u8 *)&tlan_ctx, qg_buf->txqs[0 ].txq_ctx, ice_tlan_ctx_info);/* init queue specific tail reg. It is referred as * transmit comm scheduler queue doorbell. */ - ring->tail = pf->hw.hw_addr +QTX_COMM_DBELL (pf_q); + ring->tail = hw->hw_addr +QTX_COMM_DBELL (pf_q);if (IS_ENABLED (CONFIG_DCB )) tc = ring->dcb_tc;
drivers/net/ethernet/intel/ice/ice_common.c +10 -2
@@ -1099,7 +1099,7 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx, rlan_ctx->prefena =1 ; -ice_set_ctx ((u8 *)rlan_ctx, ctx_buf, ice_rlan_ctx_info); +ice_set_ctx (hw, (u8 *)rlan_ctx, ctx_buf, ice_rlan_ctx_info);return ice_copy_rxq_ctx_to_hw (hw, ctx_buf, rxq_index); }
@@ -3268,12 +3268,14 @@ ice_write_qword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)/** * ice_set_ctx - set context bits in packed structure +* @hw: pointer to the hardware structure * @src_ctx: pointer to a generic non-packed context structure * @dest_ctx: pointer to memory for the packed structure * @ce_info: a description of the structure to be transformed */ enum ice_status -ice_set_ctx (u8 *src_ctx,u8 *dest_ctx,const struct ice_ctx_ele *ce_info) +ice_set_ctx (struct ice_hw *hw,u8 *src_ctx,u8 *dest_ctx, +const struct ice_ctx_ele *ce_info) {int f;
@@ -3282,6 +3284,12 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)* using the correct size so that we are correct regardless * of the endianness of the machine. */ +if (ce_info[f].width > (ce_info[f].size_of *BITS_PER_BYTE )) { +ice_debug (hw,ICE_DBG_QCTX , +"Field %d width of %d bits larger than size of %d byte(s) ... skipping write\n" , + f, ce_info[f].width, ce_info[f].size_of); +continue ; + }switch (ce_info[f].size_of) {case sizeof (u8):ice_write_byte (src_ctx, dest_ctx, &ce_info[f]);
drivers/net/ethernet/intel/ice/ice_common.h +2 -1
@@ -70,7 +70,8 @@ enum ice_status ice_aq_q_shutdown(struct ice_hw *hw, bool unloading);void ice_fill_dflt_direct_cmd_desc (struct ice_aq_desc *desc,u16 opcode);extern const struct ice_ctx_ele ice_tlan_ctx_info[];enum ice_status -ice_set_ctx (u8 *src_ctx,u8 *dest_ctx,const struct ice_ctx_ele *ce_info); +ice_set_ctx (struct ice_hw *hw,u8 *src_ctx,u8 *dest_ctx, +const struct ice_ctx_ele *ce_info);extern struct mutex ice_global_cfg_lock_sw;
drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +1 -1
@@ -581,7 +581,7 @@ struct ice_tlan_ctx {u8 drop_ena;u8 cache_prof_idx;u8 pkt_shaper_prof_idx; -u8 int_q_state;/* width not needed - internal do not write */ +u8 int_q_state;/* width not needed - internal - DO NOT WRITE!!! */ };/* macro to make the table lines short */
Signature · 1 line
2.20.1
Bowers
PATCH 6/14 ice: avoid undefined behavior
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 06/14] ice: avoid undefined behaviorFrom: Bruce Allan <[email protected]>
When writing the driver's struct
ice_tlan_ctxstructure, do not write the 8-bit elementint_q_statewith the associated internal-to-hardware field which is 122-bits, otherwise the helper functionice_write_byte()will use undefined behavior when setting the mask used for that write. This should not cause any functional change and will avoid use of undefined behavior. Also, update a comment to highlight this structure element is not written.
Quoted 8 lines
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_base.c | 5 +++-- drivers/net/ethernet/intel/ice/ice_common.c | 12 ++++++++++-- drivers/net/ethernet/intel/ice/ice_common.h | 3 ++- drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-)
Tony Nguyen
maintainerPATCH 7/14 ice: Refactor Rx checksum checks
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
We don't need both rx_status and rx_error parameters, as the latter is a subset of the former. Remove rx_error completely and check the right bit in rx_status.
Rename rx_status to rx_status0, and rx_status_err1 to rx_status1. This naming more closely reflects the specification.
--- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/ice/ice_txrx_lib.c +11 -16
@@ -84,17 +84,12 @@ ice_rx_csum(struct ice_ring *ring, struct sk_buff *skb, union ice_32b_rx_flex_desc *rx_desc, u8 ptype) {struct ice_rx_ptype_decoded decoded; -u16 rx_error, rx_status; -u16 rx_stat_err1; +u16 rx_status0, rx_status1;bool ipv4, ipv6; - rx_status =le16_to_cpu (rx_desc->wb.status_error0); - rx_error = rx_status & (BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_IPE_S ) | -BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_L4E_S ) | -BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S ) | -BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S )); + rx_status0 =le16_to_cpu (rx_desc->wb.status_error0); + rx_status1 =le16_to_cpu (rx_desc->wb.status_error1); - rx_stat_err1 =le16_to_cpu (rx_desc->wb.status_error1); decoded =ice_decode_rx_desc_ptype (ptype);/* Start with CHECKSUM_NONE and by default csum_level = 0 */
@@ -106,7 +101,7 @@ ice_rx_csum(struct ice_ring *ring, struct sk_buff *skb,return ;/* check if HW has decoded the packet and checksum */ -if (!(rx_status &BIT (ICE_RX_FLEX_DESC_STATUS0_L3L4P_S ))) +if (!(rx_status0 &BIT (ICE_RX_FLEX_DESC_STATUS0_L3L4P_S )))return ;if (!(decoded.known && decoded.outer_ip))
@@ -117,22 +112,22 @@ ice_rx_csum(struct ice_ring *ring, struct sk_buff *skb, ipv6 = (decoded.outer_ip ==ICE_RX_PTYPE_OUTER_IP ) && (decoded.outer_ip_ver ==ICE_RX_PTYPE_OUTER_IPV6 ); -if (ipv4 && (rx_error & (BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_IPE_S ) | -BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S )))) +if (ipv4 && (rx_status0 & (BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_IPE_S ) | +BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S )))) goto checksum_fail; -else if (ipv6 && (rx_status & - (BIT (ICE_RX_FLEX_DESC_STATUS0_IPV6EXADD_S )))) + +if (ipv6 && (rx_status0 & (BIT (ICE_RX_FLEX_DESC_STATUS0_IPV6EXADD_S )))) goto checksum_fail;/* check for L4 errors and handle packets that were not able to be * checksummed due to arrival speed */ -if (rx_error &BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_L4E_S )) +if (rx_status0 &BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_L4E_S )) goto checksum_fail;/* check for outer UDP checksum error in tunneled packets */ -if ((rx_stat_err1 &BIT (ICE_RX_FLEX_DESC_STATUS1_NAT_S )) && - (rx_error &BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S ))) +if ((rx_status1 &BIT (ICE_RX_FLEX_DESC_STATUS1_NAT_S )) && + (rx_status0 &BIT (ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S ))) goto checksum_fail;/* If there is an outer header present that might contain a checksum
Signature · 1 line
2.20.1
Bowers
PATCH 7/14 ice: Refactor Rx checksum checks
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 07/14] ice: Refactor Rx checksum checksFrom: Anirudh Venkataramanan <[email protected]>
We don't need both
rx_statusandrx_errorparameters, as the latter is a subset of the former. Removerx_errorcompletely and check the right bit inrx_status.Rename
rx_statustorx_status0, andrx_status_err1torx_status1. This naming more closely reflects the specification.
Quoted 6 lines
Signed-off-by: Anirudh Venkataramanan
<[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-)
Tony Nguyen
maintainerPATCH 8/14 ice: Check UMEM FQ size when allocating bufs
In reply to Tony NguyenFrom: Krzysztof Kazimierczak <[email protected]>
If a UMEM is present on a queue when an interface/queue pair is being enabled, the driver will try to prepare the Rx buffers in advance to improve performance. However, if fill queue is shorter than HW Rx ring, the driver will report failure after getting the last address from the fill queue.
This still lets the driver process the packets correctly during the NAPI poll, but leads to a constant NAPI rescheduling. Not allocating the buffers in advance would result in a potential performance decrease.
Commit d57d76428ae9 ("xsk: Add API to check for available entries in FQ") provides an API that lets drivers check the number of addresses that the fill queue holds.
Notify the user if fill queue is not long enough to prepare all buffers before packet processing starts, and allocate the buffers during the NAPI poll. If the fill queue size is sufficient, prepare Rx buffers in advance.
--- drivers/net/ethernet/intel/ice/ice_base.c | 30 ++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +21 -9
@@ -280,7 +280,9 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)*/ int ice_setup_rx_ctx (struct ice_ring *ring) { +struct device *dev =ice_pf_to_dev (ring->vsi->back);int chain_len =ICE_MAX_CHAINED_RX_BUFS ; +u16 num_bufs =ICE_DESC_UNUSED (ring);struct ice_vsi *vsi = ring->vsi;u32 rxdid =ICE_RXDID_FLEX_NIC ;struct ice_rlan_ctx rlan_ctx;
@@ -323,7 +325,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)if (err)return err; -dev_info (ice_pf_to_dev (vsi->back),"Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n" , +dev_info (dev,"Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n" , ring->q_index); }else { ring->zca.free =NULL ;
@@ -408,7 +410,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)/* Absolute queue number out of 2K needs to be passed */ err =ice_write_rxq_ctx (hw, &rlan_ctx, pf_q);if (err) { -dev_err (ice_pf_to_dev (vsi->back),"Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n" , +dev_err (dev,"Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n" , pf_q, err);return -EIO ; }
@@ -426,13 +428,23 @@ int ice_setup_rx_ctx(struct ice_ring *ring) ring->tail = hw->hw_addr +QRX_TAIL (pf_q);writel (0 , ring->tail); - err = ring->xsk_umem ? -ice_alloc_rx_bufs_slow_zc (ring,ICE_DESC_UNUSED (ring)) : -ice_alloc_rx_bufs (ring,ICE_DESC_UNUSED (ring)); -if (err) -dev_info (ice_pf_to_dev (vsi->back),"Failed allocate some buffers on %sRx ring %d (pf_q %d)\n" , - ring->xsk_umem ?"UMEM enabled " :"" , - ring->q_index, pf_q); +if (ring->xsk_umem) { +if (!xsk_umem_has_addrs_rq (ring->xsk_umem, num_bufs)) { +dev_warn (dev,"UMEM does not provide enough addresses to fill %d buffers on Rx ring %d\n" , + num_bufs, ring->q_index); +dev_warn (dev,"Change Rx ring/fill queue size to avoid performance issues\n" ); + +return 0 ; + } + + err =ice_alloc_rx_bufs_slow_zc (ring, num_bufs); +if (err) +dev_info (dev,"Failed to allocate some buffers on UMEM enabled Rx ring %d (pf_q %d)\n" , + ring->q_index, pf_q); +return 0 ; + } + +ice_alloc_rx_bufs (ring, num_bufs);return 0 ; }
Signature · 1 line
2.20.1
Bowers
PATCH 8/14 ice: Check UMEM FQ size when allocating bufs
Quoted 23 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 08/14] ice: Check UMEM FQ size when allocating bufsFrom: Krzysztof Kazimierczak <[email protected]>
If a UMEM is present on a queue when an interface/queue pair is being enabled, the driver will try to prepare the Rx buffers in advance to improve performance. However, if fill queue is shorter than HW Rx ring, the driver will report failure after getting the last address from the fill queue.
This still lets the driver process the packets correctly during the NAPI poll, but leads to a constant NAPI rescheduling. Not allocating the buffers in advance would result in a potential performance decrease.
Commit
d57d76428ae9("xsk: Add API to check for available entries in FQ") provides an API that lets drivers check the number of addresses that the fill queue holds.
Quoted 8 lines
Notify the user if fill queue is not long enough to prepare all buffers before packet processing starts, and allocate the buffers during the NAPI poll. If the fill queue size is sufficient, prepare Rx buffers in advance.
Signed-off-by Krzysztof Kazimierczak <[email protected]>--- drivers/net/ethernet/intel/ice/ice_base.c | 30 ++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-)
Tony Nguyen
maintainerPATCH 9/14 ice: Refactor ice_setup_rx_ctx
In reply to Tony NguyenFrom: Krzysztof Kazimierczak <[email protected]>
Move AF_XDP logic and buffer allocation out of ice_setup_rx_ctx() to a new function ice_vsi_cfg_rxq(), so the function actually sets up the Rx context.
--- drivers/net/ethernet/intel/ice/ice_base.c | 123 +++++++++++++--------- drivers/net/ethernet/intel/ice/ice_base.h | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 10 +- drivers/net/ethernet/intel/ice/ice_xsk.c | 2 +- 4 files changed, 80 insertions(+), 57 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +75 -48
@@ -278,11 +278,9 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)* * Configure the Rx descriptor ring in RLAN context. */ -int ice_setup_rx_ctx (struct ice_ring *ring) +static int ice_setup_rx_ctx (struct ice_ring *ring) { -struct device *dev =ice_pf_to_dev (ring->vsi->back);int chain_len =ICE_MAX_CHAINED_RX_BUFS ; -u16 num_bufs =ICE_DESC_UNUSED (ring);struct ice_vsi *vsi = ring->vsi;u32 rxdid =ICE_RXDID_FLEX_NIC ;struct ice_rlan_ctx rlan_ctx;
@@ -299,49 +297,6 @@ int ice_setup_rx_ctx(struct ice_ring *ring)/* clear the context structure first */ memset (&rlan_ctx,0 ,sizeof (rlan_ctx)); - ring->rx_buf_len = vsi->rx_buf_len; - -if (ring->vsi->type ==ICE_VSI_PF ) { -if (!xdp_rxq_info_is_reg (&ring->xdp_rxq)) -/* coverity[check_return] */ -xdp_rxq_info_reg (&ring->xdp_rxq, ring->netdev, - ring->q_index); - - ring->xsk_umem =ice_xsk_umem (ring); -if (ring->xsk_umem) { -xdp_rxq_info_unreg_mem_model (&ring->xdp_rxq); - - ring->rx_buf_len = ring->xsk_umem->chunk_size_nohr - -XDP_PACKET_HEADROOM ; -/* For AF_XDP ZC, we disallow packets to span on -* multiple buffers, thus letting us skip that -* handling in the fast-path. -*/ - chain_len =1 ; - ring->zca.free = ice_zca_free; - err =xdp_rxq_info_reg_mem_model (&ring->xdp_rxq, -MEM_TYPE_ZERO_COPY , - &ring->zca); -if (err) -return err; - -dev_info (dev,"Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n" , - ring->q_index); - }else { - ring->zca.free =NULL ; -if (!xdp_rxq_info_is_reg (&ring->xdp_rxq)) -/* coverity[check_return] */ -xdp_rxq_info_reg (&ring->xdp_rxq, - ring->netdev, - ring->q_index); - - err =xdp_rxq_info_reg_mem_model (&ring->xdp_rxq, -MEM_TYPE_PAGE_SHARED , -NULL ); -if (err) -return err; - } - }/* Receive Queue Base Address. * Indicates the starting address of the descriptor queue defined in * 128 Byte units.
@@ -376,6 +331,12 @@ int ice_setup_rx_ctx(struct ice_ring *ring)*/ rlan_ctx.showiv =0 ; +/* For AF_XDP ZC, we disallow packets to span on +* multiple buffers, thus letting us skip that +* handling in the fast-path. +*/ +if (ring->xsk_umem) + chain_len =1 ;/* Max packet size for this queue - must not be set to a larger value * than 5 x DBUF */
@@ -410,7 +371,8 @@ int ice_setup_rx_ctx(struct ice_ring *ring)/* Absolute queue number out of 2K needs to be passed */ err =ice_write_rxq_ctx (hw, &rlan_ctx, pf_q);if (err) { -dev_err (dev,"Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n" , +dev_err (ice_pf_to_dev (vsi->back), +"Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n" , pf_q, err);return -EIO ; }
@@ -428,6 +390,67 @@ int ice_setup_rx_ctx(struct ice_ring *ring) ring->tail = hw->hw_addr +QRX_TAIL (pf_q);writel (0 , ring->tail); +return 0 ; +} + +/** +* ice_vsi_cfg_rxq - Configure an Rx queue +* @ring: the ring being configured +* +* Return 0 on success and a negative value on error. +*/ +int ice_vsi_cfg_rxq (struct ice_ring *ring) +{ +struct device *dev =ice_pf_to_dev (ring->vsi->back); +u16 num_bufs =ICE_DESC_UNUSED (ring); +int err; + + ring->rx_buf_len = ring->vsi->rx_buf_len; + +if (ring->vsi->type ==ICE_VSI_PF ) { +if (!xdp_rxq_info_is_reg (&ring->xdp_rxq)) +/* coverity[check_return] */ +xdp_rxq_info_reg (&ring->xdp_rxq, ring->netdev, + ring->q_index); + + ring->xsk_umem =ice_xsk_umem (ring); +if (ring->xsk_umem) { +xdp_rxq_info_unreg_mem_model (&ring->xdp_rxq); + + ring->rx_buf_len = ring->xsk_umem->chunk_size_nohr - +XDP_PACKET_HEADROOM ; + ring->zca.free = ice_zca_free; + err =xdp_rxq_info_reg_mem_model (&ring->xdp_rxq, +MEM_TYPE_ZERO_COPY , + &ring->zca); +if (err) +return err; + +dev_info (dev,"Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n" , + ring->q_index); + }else { + ring->zca.free =NULL ; +if (!xdp_rxq_info_is_reg (&ring->xdp_rxq)) +/* coverity[check_return] */ +xdp_rxq_info_reg (&ring->xdp_rxq, + ring->netdev, + ring->q_index); + + err =xdp_rxq_info_reg_mem_model (&ring->xdp_rxq, +MEM_TYPE_PAGE_SHARED , +NULL ); +if (err) +return err; + } + } + + err =ice_setup_rx_ctx (ring); +if (err) { +dev_err (dev,"ice_setup_rx_ctx failed for RxQ %d, err %d\n" , + ring->q_index, err); +return err; + } +if (ring->xsk_umem) {if (!xsk_umem_has_addrs_rq (ring->xsk_umem, num_bufs)) { dev_warn(dev, "UMEM does not provide enough addresses to fill %d buffers on Rx ring %d\n",
@@ -438,9 +461,13 @@ int ice_setup_rx_ctx(struct ice_ring *ring) } err =ice_alloc_rx_bufs_slow_zc (ring, num_bufs); -if (err) +if (err) { +u16 pf_q = ring->vsi->rxq_map[ring->q_index]; +dev_info (dev,"Failed to allocate some buffers on UMEM enabled Rx ring %d (pf_q %d)\n" , ring->q_index, pf_q); + } +return 0 ; }
drivers/net/ethernet/intel/ice/ice_base.h +1 -1
@@ -6,7 +6,7 @@#include "ice.h" -int ice_setup_rx_ctx (struct ice_ring *ring); +int ice_vsi_cfg_rxq (struct ice_ring *ring);int __ice_vsi_get_qs (struct ice_qs_cfg *qs_cfg);int ice_vsi_ctrl_one_rx_ring (struct ice_vsi *vsi,bool ena,u16 rxq_idx,bool wait);
drivers/net/ethernet/intel/ice/ice_lib.c +3 -7
@@ -1648,15 +1648,11 @@ int ice_vsi_cfg_rxqs(struct ice_vsi *vsi)ice_vsi_cfg_frame_size (vsi); setup_rings:/* set up individual rings */ -for (i =0 ; i < vsi->num_rxq; i++) { -int err; +ice_for_each_rxq (vsi, i) { +int err =ice_vsi_cfg_rxq (vsi->rx_rings[i]); - err =ice_setup_rx_ctx (vsi->rx_rings[i]); -if (err) { -dev_err (ice_pf_to_dev (vsi->back),"ice_setup_rx_ctx failed for RxQ %d, err %d\n" , - i, err); +if (err)return err; - } }return 0 ;
drivers/net/ethernet/intel/ice/ice_xsk.c +1 -1
@@ -237,7 +237,7 @@ static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx) xdp_ring->xsk_umem =ice_xsk_umem (xdp_ring); } - err =ice_setup_rx_ctx (rx_ring); + err =ice_vsi_cfg_rxq (rx_ring);if (err) goto free_buf;
Signature · 1 line
2.20.1
Bowers
PATCH 9/14 ice: Refactor ice_setup_rx_ctx
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 09/14] ice: Refactorice_setup_rx_ctxFrom: Krzysztof Kazimierczak <[email protected]>
Move
AF_XDPlogic and buffer allocation out ofice_setup_rx_ctx()to a new functionice_vsi_cfg_rxq(), so the function actually sets up the Rx context.
Quoted 7 lines
Signed-off-by Krzysztof Kazimierczak <[email protected]>--- drivers/net/ethernet/intel/ice/ice_base.c | 123 +++++++++++++--------- drivers/net/ethernet/intel/ice/ice_base.h | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 10 +- drivers/net/ethernet/intel/ice/ice_xsk.c | 2 +- 4 files changed, 80 insertions(+), 57 deletions(-)
Tony Nguyen
maintainerPATCH 10/14 ice: Poll for reset completion when DDP load fails
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
There are certain cases where the DDP load fails and the FW issues a core reset. For these cases, wait for reset to complete before proceeding with reset of the driver init.
--- drivers/net/ethernet/intel/ice/ice_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/ice/ice_main.c +3 -0
@@ -3111,6 +3111,9 @@ ice_log_pkg_init(struct ice_hw *hw, enum ice_status *status)case ICE_AQ_RC_EBADMAN :case ICE_AQ_RC_EBADBUF :dev_err (dev,"An error occurred on the device while loading the DDP package. The device will be reset.\n" ); +/* poll for reset to complete */ +if (ice_check_reset (hw)) +dev_err (dev,"Error resetting device. Please reload the driver\n" );return ;default :break ;
Signature · 1 line
2.20.1
Bowers
PATCH 10/14 ice: Poll for reset completion when DDP load fails
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 10/14] ice: Poll for reset completion when DDP load failsFrom: Anirudh Venkataramanan <[email protected]>
There are certain cases where the DDP load fails and the FW issues a core reset. For these cases, wait for reset to complete before proceeding with reset of the driver init.
Quoted 5 lines
Signed-off-by: Anirudh Venkataramanan
<[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 3 +++ 1 file changed, 3 insertions(+)
Tony Nguyen
maintainerPATCH 11/14 ice: cleanup VSI context initialization
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
Remove an unnecessary copy of vsi->info into ctxt->info in ice_vsi_init. This line is essentially a no-op because ice_set_dflt_vsi_ctx performs a memset to clear the info from the context structure.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_lib.c +0 -1
@@ -949,7 +949,6 @@ static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi)if (!ctxt)return -ENOMEM ; - ctxt->info = vsi->info;switch (vsi->type) {case ICE_VSI_CTRL :case ICE_VSI_LB :
Signature · 1 line
2.20.1
Bowers
PATCH 11/14 ice: cleanup VSI context initialization
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 11/14] ice: cleanup VSI context initializationFrom: Jacob Keller <[email protected]>
Quoted 8 lines
Remove an unnecessary copy of
vsi->infointoctxt->infoinice_vsi_init. This line is essentially a no-op becauseice_set_dflt_vsi_ctxperforms a memset to clear the info from the context structure.Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 1 - 1 file changed, 1 deletion(-)
Tony Nguyen
maintainerPATCH 12/14 ice: fix potential double free in probe unrolling
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
If ice_init_interrupt_scheme fails, ice_probe will jump to clearing up the interrupts. This can lead to some static analysis tools such as the compiler sanitizers complaining about double free problems.
Since ice_init_interrupt_scheme already unrolls internally on failure, there is no need to call ice_clear_interrupt_scheme when it fails. Add a new unroll label and use that instead.
--- drivers/net/ethernet/intel/ice/ice_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +2 -1
@@ -3443,7 +3443,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)if (err) {dev_err (dev,"ice_init_interrupt_scheme failed: %d\n" , err); err = -EIO ; - goto err_init_interrupt_unroll; + goto err_init_vsi_unroll; }/* In case of MSIX we are going to setup the misc vector right here
@@ -3564,6 +3564,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)ice_free_irq_msix_misc (pf); err_init_interrupt_unroll:ice_clear_interrupt_scheme (pf); +err_init_vsi_unroll:devm_kfree (dev, pf->vsi); err_init_pf_unroll:ice_deinit_pf (pf);
Signature · 1 line
2.20.1
Bowers
PATCH 12/14 ice: fix potential double free in probe unrolling
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 12/14] ice: fix potential double free in probe unrollingFrom: Jacob Keller <[email protected]>
If
ice_init_interrupt_schemefails,ice_probewill jump to clearing up the interrupts. This can lead to some static analysis tools such as the compiler sanitizers complaining about double free problems.
Quoted 8 lines
Since
ice_init_interrupt_schemealready unrolls internally on failure, there is no need to callice_clear_interrupt_schemewhen it fails. Add a new unroll label and use that instead.Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Tony Nguyen
maintainerPATCH 13/14 ice: fix kernel BUG if register_netdev fails
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
If register_netdev() fails, the driver will attempt to cleanup the q_vectors and inadvertently trigger a kernel BUG due to a NULL pointer dereference.
This occurs because cleaning up q_vectors attempts to call netif_napi_del on napi_structs which were never initialized.
Resolve this by releasing the netdev in ice_cfg_netdev and setting vsi->netdev to NULL. This ensures that after ice_cfg_netdev fails the state is rewound to match as if ice_cfg_netdev was never called.
--- drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +4 -2
@@ -2435,7 +2435,7 @@ static int ice_cfg_netdev(struct ice_vsi *vsi) err =register_netdev (vsi->netdev);if (err) - goto err_destroy_devlink_port; + goto err_free_netdev;devlink_port_type_eth_set (&pf->devlink_port, vsi->netdev);
@@ -2446,9 +2446,11 @@ static int ice_cfg_netdev(struct ice_vsi *vsi)return 0 ; +err_free_netdev: +free_netdev (vsi->netdev); + vsi->netdev =NULL ; err_destroy_devlink_port:ice_devlink_destroy_port (pf); -return err; }
Signature · 1 line
2.20.1
Bowers
PATCH 13/14 ice: fix kernel BUG if register_netdev fails
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 13/14] ice: fix kernel BUG ifregister_netdevfailsFrom: Jacob Keller <[email protected]>
If
register_netdev()fails, the driver will attempt to cleanup theq_vectorsand inadvertently trigger a kernel BUG due to a NULL pointer dereference.This occurs because cleaning up
q_vectorsattempts to callnetif_napi_delonnapi_structswhich were never initialized.
Quoted 8 lines
Resolve this by releasing the netdev in
ice_cfg_netdevand settingvsi->netdevto NULL. This ensures that afterice_cfg_netdevfails the state is rewound to match as ifice_cfg_netdevwas never called.Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Tony Nguyen
maintainerPATCH 14/14 ice: Declare functions static
In reply to Tony Nguyenice_get_pfa_module_tlv() and ice_read_sr_word() are not being called outside of their file. Declare them as static.
--- drivers/net/ethernet/intel/ice/ice_nvm.c | 5 +++-- drivers/net/ethernet/intel/ice/ice_nvm.h | 4 ---- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_nvm.c +3 -2
@@ -172,7 +172,8 @@ void ice_release_nvm(struct ice_hw *hw)* * Reads one 16 bit word from the Shadow RAM using the ice_read_sr_word_aq. */ -enum ice_status ice_read_sr_word (struct ice_hw *hw,u16 offset,u16 *data) +static enum ice_status +ice_read_sr_word (struct ice_hw *hw,u16 offset,u16 *data) {enum ice_status status;
@@ -196,7 +197,7 @@ enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)* Area (PFA) and returns the TLV pointer and length. The caller can * use these to read the variable length TLV value. */ -enum ice_status +static enum ice_status ice_get_pfa_module_tlv (struct ice_hw *hw,u16 *module_tlv,u16 *module_tlv_len,u16 module_type) {
drivers/net/ethernet/intel/ice/ice_nvm.h +0 -4
@@ -11,10 +11,6 @@ enum ice_status ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data, bool read_shadow_ram);enum ice_status -ice_get_pfa_module_tlv (struct ice_hw *hw,u16 *module_tlv,u16 *module_tlv_len, -u16 module_type); -enum ice_status ice_read_pba_string (struct ice_hw *hw,u8 *pba_num,u32 pba_num_size);enum ice_status ice_init_nvm (struct ice_hw *hw); -enum ice_status ice_read_sr_word (struct ice_hw *hw,u16 offset,u16 *data);#endif /* _ICE_NVM_H_ */
Signature · 1 line
2.20.1
Bowers
PATCH 14/14 ice: Declare functions static
Quoted 7 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 14/14] ice: Declare functions static
Quoted 8 lines
ice_get_pfa_module_tlv()andice_read_sr_word()are not being called outside of their file. Declare them as static.Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_nvm.c | 5 +++-- drivers/net/ethernet/intel/ice/ice_nvm.h | 4 ---- 2 files changed, 3 insertions(+), 6 deletions(-)
Bowers
PATCH 1/14 ice: Don't allow VLAN stripping change when pvid set
In reply to Tony NguyenQuoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Friday, May 15, 2020 5:42 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid setFrom: Brett Creeley <[email protected]>
Currently, if the PVID is set in the VLAN handling section of the VSI context the driver still allows VLAN stripping to be enabled/disabled. VLAN stripping should only be modifiable when the PVID is not set. Fix this by preventing VLAN stripping modification when PVID is set.
Quoted 4 lines
Signed-off-by Brett Creeley <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 6 ++++++ 1 file changed, 6 insertions(+)