linux/dim: Fix overflow in dim calculation
[linux-2.6-block.git] / drivers / net / ethernet / broadcom / bnxt / bnxt.c
index 3f632028eff035b66aa1c3206b98a144374b351f..7070349915bc5412a52e556de427fb8ed6174480 100644 (file)
@@ -2136,7 +2136,7 @@ static int bnxt_poll(struct napi_struct *napi, int budget)
                }
        }
        if (bp->flags & BNXT_FLAG_DIM) {
-               struct dim_sample dim_sample;
+               struct dim_sample dim_sample = {};
 
                dim_update_sample(cpr->event_ctr,
                                  cpr->rx_packets,
@@ -2677,8 +2677,6 @@ static int bnxt_alloc_tx_rings(struct bnxt *bp)
                        mapping = txr->tx_push_mapping +
                                sizeof(struct tx_push_bd);
                        txr->data_mapping = cpu_to_le64(mapping);
-
-                       memset(txr->tx_push, 0, sizeof(struct tx_push_bd));
                }
                qidx = bp->tc_to_qidx[j];
                ring->queue_id = bp->q_info[qidx].queue_id;
@@ -3077,7 +3075,7 @@ static int bnxt_alloc_vnics(struct bnxt *bp)
        int num_vnics = 1;
 
 #ifdef CONFIG_RFS_ACCEL
-       if (bp->flags & BNXT_FLAG_RFS)
+       if ((bp->flags & (BNXT_FLAG_RFS | BNXT_FLAG_CHIP_P5)) == BNXT_FLAG_RFS)
                num_vnics += bp->rx_nr_rings;
 #endif
 
@@ -7188,6 +7186,9 @@ static int bnxt_alloc_rfs_vnics(struct bnxt *bp)
 #ifdef CONFIG_RFS_ACCEL
        int i, rc = 0;
 
+       if (bp->flags & BNXT_FLAG_CHIP_P5)
+               return 0;
+
        for (i = 0; i < bp->rx_nr_rings; i++) {
                struct bnxt_vnic_info *vnic;
                u16 vnic_id = i + 1;
@@ -9647,7 +9648,7 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
                return -ENOMEM;
 
        vnics = 1;
-       if (bp->flags & BNXT_FLAG_RFS)
+       if ((bp->flags & (BNXT_FLAG_RFS | BNXT_FLAG_CHIP_P5)) == BNXT_FLAG_RFS)
                vnics += rx_rings;
 
        if (bp->flags & BNXT_FLAG_AGG_RINGS)