@@ -1518,7 +1518,7 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
15181518 if (TPA_START_IS_IPV6 (tpa_start1 ))
15191519 tpa_info -> gso_type = SKB_GSO_TCPV6 ;
15201520 /* RSS profiles 1 and 3 with extract code 0 for inner 4-tuple */
1521- else if (cmp_type == CMP_TYPE_RX_L2_TPA_START_CMP &&
1521+ else if (! BNXT_CHIP_P4_PLUS ( bp ) &&
15221522 TPA_START_HASH_TYPE (tpa_start ) == 3 )
15231523 tpa_info -> gso_type = SKB_GSO_TCPV6 ;
15241524 tpa_info -> rss_hash =
@@ -2212,15 +2212,13 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
22122212 if (cmp_type == CMP_TYPE_RX_L2_V3_CMP ) {
22132213 type = bnxt_rss_ext_op (bp , rxcmp );
22142214 } else {
2215- u32 hash_type = RX_CMP_HASH_TYPE (rxcmp );
2215+ u32 itypes = RX_CMP_ITYPES (rxcmp );
22162216
2217- /* RSS profiles 1 and 3 with extract code 0 for inner
2218- * 4-tuple
2219- */
2220- if (hash_type != 1 && hash_type != 3 )
2221- type = PKT_HASH_TYPE_L3 ;
2222- else
2217+ if (itypes == RX_CMP_FLAGS_ITYPE_TCP ||
2218+ itypes == RX_CMP_FLAGS_ITYPE_UDP )
22232219 type = PKT_HASH_TYPE_L4 ;
2220+ else
2221+ type = PKT_HASH_TYPE_L3 ;
22242222 }
22252223 skb_set_hash (skb , le32_to_cpu (rxcmp -> rx_cmp_rss_hash ), type );
22262224 }
@@ -2828,6 +2826,13 @@ static int bnxt_hwrm_handler(struct bnxt *bp, struct tx_cmp *txcmp)
28282826 return 0 ;
28292827}
28302828
2829+ static bool bnxt_vnic_is_active (struct bnxt * bp )
2830+ {
2831+ struct bnxt_vnic_info * vnic = & bp -> vnic_info [0 ];
2832+
2833+ return vnic -> fw_vnic_id != INVALID_HW_RING_ID && vnic -> mru > 0 ;
2834+ }
2835+
28312836static irqreturn_t bnxt_msix (int irq , void * dev_instance )
28322837{
28332838 struct bnxt_napi * bnapi = dev_instance ;
@@ -3095,7 +3100,7 @@ static int bnxt_poll(struct napi_struct *napi, int budget)
30953100 break ;
30963101 }
30973102 }
3098- if (bp -> flags & BNXT_FLAG_DIM ) {
3103+ if (( bp -> flags & BNXT_FLAG_DIM ) && bnxt_vnic_is_active ( bp ) ) {
30993104 struct dim_sample dim_sample = {};
31003105
31013106 dim_update_sample (cpr -> event_ctr ,
@@ -3226,7 +3231,7 @@ static int bnxt_poll_p5(struct napi_struct *napi, int budget)
32263231poll_done :
32273232 cpr_rx = & cpr -> cp_ring_arr [0 ];
32283233 if (cpr_rx -> cp_ring_type == BNXT_NQ_HDL_TYPE_RX &&
3229- (bp -> flags & BNXT_FLAG_DIM )) {
3234+ (bp -> flags & BNXT_FLAG_DIM ) && bnxt_vnic_is_active ( bp ) ) {
32303235 struct dim_sample dim_sample = {};
32313236
32323237 dim_update_sample (cpr -> event_ctr ,
@@ -7118,6 +7123,26 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
71187123 return rc ;
71197124}
71207125
7126+ static void bnxt_cancel_dim (struct bnxt * bp )
7127+ {
7128+ int i ;
7129+
7130+ /* DIM work is initialized in bnxt_enable_napi(). Proceed only
7131+ * if NAPI is enabled.
7132+ */
7133+ if (!bp -> bnapi || test_bit (BNXT_STATE_NAPI_DISABLED , & bp -> state ))
7134+ return ;
7135+
7136+ /* Make sure NAPI sees that the VNIC is disabled */
7137+ synchronize_net ();
7138+ for (i = 0 ; i < bp -> rx_nr_rings ; i ++ ) {
7139+ struct bnxt_rx_ring_info * rxr = & bp -> rx_ring [i ];
7140+ struct bnxt_napi * bnapi = rxr -> bnapi ;
7141+
7142+ cancel_work_sync (& bnapi -> cp_ring .dim .work );
7143+ }
7144+ }
7145+
71217146static int hwrm_ring_free_send_msg (struct bnxt * bp ,
71227147 struct bnxt_ring_struct * ring ,
71237148 u32 ring_type , int cmpl_ring_id )
@@ -7218,6 +7243,7 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
72187243 }
72197244 }
72207245
7246+ bnxt_cancel_dim (bp );
72217247 for (i = 0 ; i < bp -> rx_nr_rings ; i ++ ) {
72227248 bnxt_hwrm_rx_ring_free (bp , & bp -> rx_ring [i ], close_path );
72237249 bnxt_hwrm_rx_agg_ring_free (bp , & bp -> rx_ring [i ], close_path );
@@ -11014,8 +11040,6 @@ static void bnxt_disable_napi(struct bnxt *bp)
1101411040 if (bnapi -> in_reset )
1101511041 cpr -> sw_stats -> rx .rx_resets ++ ;
1101611042 napi_disable (& bnapi -> napi );
11017- if (bnapi -> rx_ring )
11018- cancel_work_sync (& cpr -> dim .work );
1101911043 }
1102011044}
1102111045
@@ -15271,8 +15295,10 @@ static int bnxt_queue_stop(struct net_device *dev, void *qmem, int idx)
1527115295 bnxt_hwrm_vnic_update (bp , vnic ,
1527215296 VNIC_UPDATE_REQ_ENABLES_MRU_VALID );
1527315297 }
15274-
15298+ /* Make sure NAPI sees that the VNIC is disabled */
15299+ synchronize_net ();
1527515300 rxr = & bp -> rx_ring [idx ];
15301+ cancel_work_sync (& rxr -> bnapi -> cp_ring .dim .work );
1527615302 bnxt_hwrm_rx_ring_free (bp , rxr , false);
1527715303 bnxt_hwrm_rx_agg_ring_free (bp , rxr , false);
1527815304 rxr -> rx_next_cons = 0 ;
0 commit comments