Commit 39a8f2a8 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'bnxt_en-Bug-fixes'



Michael Chan says:

====================
bnxt_en: Bug fixes.

5 bug fix patches covering an indexing bug for priority counters, memory
leak when retrieving DCB ETS settings, error path return code, proper
disabling of PCI before freeing context memory, and proper ring accounting
in error path.

Please also apply these to -stable.  Thanks.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents b06d072c 5d765a5e
Loading
Loading
Loading
Loading
+20 −8
Original line number Original line Diff line number Diff line
@@ -6880,12 +6880,12 @@ skip_rdma:
	}
	}
	ena |= FUNC_BACKING_STORE_CFG_REQ_DFLT_ENABLES;
	ena |= FUNC_BACKING_STORE_CFG_REQ_DFLT_ENABLES;
	rc = bnxt_hwrm_func_backing_store_cfg(bp, ena);
	rc = bnxt_hwrm_func_backing_store_cfg(bp, ena);
	if (rc)
	if (rc) {
		netdev_err(bp->dev, "Failed configuring context mem, rc = %d.\n",
		netdev_err(bp->dev, "Failed configuring context mem, rc = %d.\n",
			   rc);
			   rc);
	else
		return rc;
	}
	ctx->flags |= BNXT_CTX_FLAG_INITED;
	ctx->flags |= BNXT_CTX_FLAG_INITED;

	return 0;
	return 0;
}
}


@@ -7406,14 +7406,22 @@ static int bnxt_hwrm_port_qstats_ext(struct bnxt *bp)
		pri2cos = &resp2->pri0_cos_queue_id;
		pri2cos = &resp2->pri0_cos_queue_id;
		for (i = 0; i < 8; i++) {
		for (i = 0; i < 8; i++) {
			u8 queue_id = pri2cos[i];
			u8 queue_id = pri2cos[i];
			u8 queue_idx;


			/* Per port queue IDs start from 0, 10, 20, etc */
			queue_idx = queue_id % 10;
			if (queue_idx > BNXT_MAX_QUEUE) {
				bp->pri2cos_valid = false;
				goto qstats_done;
			}
			for (j = 0; j < bp->max_q; j++) {
			for (j = 0; j < bp->max_q; j++) {
				if (bp->q_ids[j] == queue_id)
				if (bp->q_ids[j] == queue_id)
					bp->pri2cos[i] = j;
					bp->pri2cos_idx[i] = queue_idx;
			}
			}
		}
		}
		bp->pri2cos_valid = 1;
		bp->pri2cos_valid = 1;
	}
	}
qstats_done:
	mutex_unlock(&bp->hwrm_cmd_lock);
	mutex_unlock(&bp->hwrm_cmd_lock);
	return rc;
	return rc;
}
}
@@ -11669,6 +11677,10 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
		bp->rx_nr_rings++;
		bp->rx_nr_rings++;
		bp->cp_nr_rings++;
		bp->cp_nr_rings++;
	}
	}
	if (rc) {
		bp->tx_nr_rings = 0;
		bp->rx_nr_rings = 0;
	}
	return rc;
	return rc;
}
}


@@ -11962,12 +11974,12 @@ init_err_pci_clean:
	bnxt_hwrm_func_drv_unrgtr(bp);
	bnxt_hwrm_func_drv_unrgtr(bp);
	bnxt_free_hwrm_short_cmd_req(bp);
	bnxt_free_hwrm_short_cmd_req(bp);
	bnxt_free_hwrm_resources(bp);
	bnxt_free_hwrm_resources(bp);
	bnxt_free_ctx_mem(bp);
	kfree(bp->ctx);
	bp->ctx = NULL;
	kfree(bp->fw_health);
	kfree(bp->fw_health);
	bp->fw_health = NULL;
	bp->fw_health = NULL;
	bnxt_cleanup_pci(bp);
	bnxt_cleanup_pci(bp);
	bnxt_free_ctx_mem(bp);
	kfree(bp->ctx);
	bp->ctx = NULL;


init_err_free:
init_err_free:
	free_netdev(dev);
	free_netdev(dev);
+1 −1
Original line number Original line Diff line number Diff line
@@ -1716,7 +1716,7 @@ struct bnxt {
	u16			fw_rx_stats_ext_size;
	u16			fw_rx_stats_ext_size;
	u16			fw_tx_stats_ext_size;
	u16			fw_tx_stats_ext_size;
	u16			hw_ring_stats_size;
	u16			hw_ring_stats_size;
	u8			pri2cos[8];
	u8			pri2cos_idx[8];
	u8			pri2cos_valid;
	u8			pri2cos_valid;


	u16			hwrm_max_req_len;
	u16			hwrm_max_req_len;
+10 −5
Original line number Original line Diff line number Diff line
@@ -479,24 +479,26 @@ static int bnxt_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets)
{
{
	struct bnxt *bp = netdev_priv(dev);
	struct bnxt *bp = netdev_priv(dev);
	struct ieee_ets *my_ets = bp->ieee_ets;
	struct ieee_ets *my_ets = bp->ieee_ets;
	int rc;


	ets->ets_cap = bp->max_tc;
	ets->ets_cap = bp->max_tc;


	if (!my_ets) {
	if (!my_ets) {
		int rc;

		if (bp->dcbx_cap & DCB_CAP_DCBX_HOST)
		if (bp->dcbx_cap & DCB_CAP_DCBX_HOST)
			return 0;
			return 0;


		my_ets = kzalloc(sizeof(*my_ets), GFP_KERNEL);
		my_ets = kzalloc(sizeof(*my_ets), GFP_KERNEL);
		if (!my_ets)
		if (!my_ets)
			return 0;
			return -ENOMEM;
		rc = bnxt_hwrm_queue_cos2bw_qcfg(bp, my_ets);
		rc = bnxt_hwrm_queue_cos2bw_qcfg(bp, my_ets);
		if (rc)
		if (rc)
			return 0;
			goto error;
		rc = bnxt_hwrm_queue_pri2cos_qcfg(bp, my_ets);
		rc = bnxt_hwrm_queue_pri2cos_qcfg(bp, my_ets);
		if (rc)
		if (rc)
			return 0;
			goto error;

		/* cache result */
		bp->ieee_ets = my_ets;
	}
	}


	ets->cbs = my_ets->cbs;
	ets->cbs = my_ets->cbs;
@@ -505,6 +507,9 @@ static int bnxt_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets)
	memcpy(ets->tc_tsa, my_ets->tc_tsa, sizeof(ets->tc_tsa));
	memcpy(ets->tc_tsa, my_ets->tc_tsa, sizeof(ets->tc_tsa));
	memcpy(ets->prio_tc, my_ets->prio_tc, sizeof(ets->prio_tc));
	memcpy(ets->prio_tc, my_ets->prio_tc, sizeof(ets->prio_tc));
	return 0;
	return 0;
error:
	kfree(my_ets);
	return rc;
}
}


static int bnxt_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets)
static int bnxt_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets)
+4 −4
Original line number Original line Diff line number Diff line
@@ -589,25 +589,25 @@ skip_ring_stats:
		if (bp->pri2cos_valid) {
		if (bp->pri2cos_valid) {
			for (i = 0; i < 8; i++, j++) {
			for (i = 0; i < 8; i++, j++) {
				long n = bnxt_rx_bytes_pri_arr[i].base_off +
				long n = bnxt_rx_bytes_pri_arr[i].base_off +
					 bp->pri2cos[i];
					 bp->pri2cos_idx[i];


				buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
				buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
			}
			}
			for (i = 0; i < 8; i++, j++) {
			for (i = 0; i < 8; i++, j++) {
				long n = bnxt_rx_pkts_pri_arr[i].base_off +
				long n = bnxt_rx_pkts_pri_arr[i].base_off +
					 bp->pri2cos[i];
					 bp->pri2cos_idx[i];


				buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
				buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
			}
			}
			for (i = 0; i < 8; i++, j++) {
			for (i = 0; i < 8; i++, j++) {
				long n = bnxt_tx_bytes_pri_arr[i].base_off +
				long n = bnxt_tx_bytes_pri_arr[i].base_off +
					 bp->pri2cos[i];
					 bp->pri2cos_idx[i];


				buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
				buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
			}
			}
			for (i = 0; i < 8; i++, j++) {
			for (i = 0; i < 8; i++, j++) {
				long n = bnxt_tx_pkts_pri_arr[i].base_off +
				long n = bnxt_tx_pkts_pri_arr[i].base_off +
					 bp->pri2cos[i];
					 bp->pri2cos_idx[i];


				buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
				buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
			}
			}