Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9fa9e498 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'msix'



Alexander Gordeev says:

====================
net: Use pci_enable_msix_range() instead of pci_enable_msix()

As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range() and pci_enable_msix_range()
interfaces.

Cc: e1000-devel@lists.sourceforge.net
Cc: linux-driver@qlogic.com
Cc: linux-net-drivers@solarflare.com
Cc: linux-pci@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: pv-drivers@vmware.com
Cc: wil6210@qca.qualcomm.com
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 81206ebc b4b39061
Loading
Loading
Loading
Loading
+4 −11
Original line number Original line Diff line number Diff line
@@ -6206,7 +6206,7 @@ bnx2_free_irq(struct bnx2 *bp)
static void
static void
bnx2_enable_msix(struct bnx2 *bp, int msix_vecs)
bnx2_enable_msix(struct bnx2 *bp, int msix_vecs)
{
{
	int i, total_vecs, rc;
	int i, total_vecs;
	struct msix_entry msix_ent[BNX2_MAX_MSIX_VEC];
	struct msix_entry msix_ent[BNX2_MAX_MSIX_VEC];
	struct net_device *dev = bp->dev;
	struct net_device *dev = bp->dev;
	const int len = sizeof(bp->irq_tbl[0].name);
	const int len = sizeof(bp->irq_tbl[0].name);
@@ -6229,16 +6229,9 @@ bnx2_enable_msix(struct bnx2 *bp, int msix_vecs)
#ifdef BCM_CNIC
#ifdef BCM_CNIC
	total_vecs++;
	total_vecs++;
#endif
#endif
	rc = -ENOSPC;
	total_vecs = pci_enable_msix_range(bp->pdev, msix_ent,
	while (total_vecs >= BNX2_MIN_MSIX_VEC) {
					   BNX2_MIN_MSIX_VEC, total_vecs);
		rc = pci_enable_msix(bp->pdev, msix_ent, total_vecs);
	if (total_vecs < 0)
		if (rc <= 0)
			break;
		if (rc > 0)
			total_vecs = rc;
	}

	if (rc != 0)
		return;
		return;


	msix_vecs = total_vecs;
	msix_vecs = total_vecs;
+20 −26
Original line number Original line Diff line number Diff line
@@ -1638,36 +1638,16 @@ int bnx2x_enable_msix(struct bnx2x *bp)
	DP(BNX2X_MSG_SP, "about to request enable msix with %d vectors\n",
	DP(BNX2X_MSG_SP, "about to request enable msix with %d vectors\n",
	   msix_vec);
	   msix_vec);


	rc = pci_enable_msix(bp->pdev, &bp->msix_table[0], msix_vec);
	rc = pci_enable_msix_range(bp->pdev, &bp->msix_table[0],

				   BNX2X_MIN_MSIX_VEC_CNT(bp), msix_vec);
	/*
	/*
	 * reconfigure number of tx/rx queues according to available
	 * reconfigure number of tx/rx queues according to available
	 * MSI-X vectors
	 * MSI-X vectors
	 */
	 */
	if (rc >= BNX2X_MIN_MSIX_VEC_CNT(bp)) {
	if (rc == -ENOSPC) {
		/* how less vectors we will have? */
		int diff = msix_vec - rc;

		BNX2X_DEV_INFO("Trying to use less MSI-X vectors: %d\n", rc);

		rc = pci_enable_msix(bp->pdev, &bp->msix_table[0], rc);

		if (rc) {
			BNX2X_DEV_INFO("MSI-X is not attainable rc %d\n", rc);
			goto no_msix;
		}
		/*
		 * decrease number of queues by number of unallocated entries
		 */
		bp->num_ethernet_queues -= diff;
		bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues;

		BNX2X_DEV_INFO("New queue configuration set: %d\n",
			       bp->num_queues);
	} else if (rc > 0) {
		/* Get by with single vector */
		/* Get by with single vector */
		rc = pci_enable_msix(bp->pdev, &bp->msix_table[0], 1);
		rc = pci_enable_msix_range(bp->pdev, &bp->msix_table[0], 1, 1);
		if (rc) {
		if (rc < 0) {
			BNX2X_DEV_INFO("Single MSI-X is not attainable rc %d\n",
			BNX2X_DEV_INFO("Single MSI-X is not attainable rc %d\n",
				       rc);
				       rc);
			goto no_msix;
			goto no_msix;
@@ -1682,6 +1662,20 @@ int bnx2x_enable_msix(struct bnx2x *bp)
	} else if (rc < 0) {
	} else if (rc < 0) {
		BNX2X_DEV_INFO("MSI-X is not attainable rc %d\n", rc);
		BNX2X_DEV_INFO("MSI-X is not attainable rc %d\n", rc);
		goto no_msix;
		goto no_msix;
	} else if (rc < msix_vec) {
		/* how less vectors we will have? */
		int diff = msix_vec - rc;

		BNX2X_DEV_INFO("Trying to use less MSI-X vectors: %d\n", rc);

		/*
		 * decrease number of queues by number of unallocated entries
		 */
		bp->num_ethernet_queues -= diff;
		bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues;

		BNX2X_DEV_INFO("New queue configuration set: %d\n",
			       bp->num_queues);
	}
	}


	bp->flags |= USING_MSIX_FLAG;
	bp->flags |= USING_MSIX_FLAG;
+2 −4
Original line number Original line Diff line number Diff line
@@ -11362,12 +11362,10 @@ static bool tg3_enable_msix(struct tg3 *tp)
		msix_ent[i].vector = 0;
		msix_ent[i].vector = 0;
	}
	}


	rc = pci_enable_msix(tp->pdev, msix_ent, tp->irq_cnt);
	rc = pci_enable_msix_range(tp->pdev, msix_ent, 1, tp->irq_cnt);
	if (rc < 0) {
	if (rc < 0) {
		return false;
		return false;
	} else if (rc != 0) {
	} else if (rc < tp->irq_cnt) {
		if (pci_enable_msix(tp->pdev, msix_ent, rc))
			return false;
		netdev_notice(tp->dev, "Requested %d MSI-X vectors, received %d\n",
		netdev_notice(tp->dev, "Requested %d MSI-X vectors, received %d\n",
			      tp->irq_cnt, rc);
			      tp->irq_cnt, rc);
		tp->irq_cnt = rc;
		tp->irq_cnt = rc;
+9 −14
Original line number Original line Diff line number Diff line
@@ -2666,9 +2666,11 @@ bnad_enable_msix(struct bnad *bnad)
	for (i = 0; i < bnad->msix_num; i++)
	for (i = 0; i < bnad->msix_num; i++)
		bnad->msix_table[i].entry = i;
		bnad->msix_table[i].entry = i;


	ret = pci_enable_msix(bnad->pcidev, bnad->msix_table, bnad->msix_num);
	ret = pci_enable_msix_range(bnad->pcidev, bnad->msix_table,
	if (ret > 0) {
				    1, bnad->msix_num);
		/* Not enough MSI-X vectors. */
	if (ret < 0) {
		goto intx_mode;
	} else if (ret < bnad->msix_num) {
		pr_warn("BNA: %d MSI-X vectors allocated < %d requested\n",
		pr_warn("BNA: %d MSI-X vectors allocated < %d requested\n",
			ret, bnad->msix_num);
			ret, bnad->msix_num);


@@ -2681,18 +2683,11 @@ bnad_enable_msix(struct bnad *bnad)
		bnad->msix_num = BNAD_NUM_TXQ + BNAD_NUM_RXP +
		bnad->msix_num = BNAD_NUM_TXQ + BNAD_NUM_RXP +
			 BNAD_MAILBOX_MSIX_VECTORS;
			 BNAD_MAILBOX_MSIX_VECTORS;


		if (bnad->msix_num > ret)
		if (bnad->msix_num > ret) {
			goto intx_mode;
			pci_disable_msix(bnad->pcidev);

		/* Try once more with adjusted numbers */
		/* If this fails, fall back to INTx */
		ret = pci_enable_msix(bnad->pcidev, bnad->msix_table,
				      bnad->msix_num);
		if (ret)
			goto intx_mode;

	} else if (ret < 0)
			goto intx_mode;
			goto intx_mode;
		}
	}


	pci_intx(bnad->pcidev, 0);
	pci_intx(bnad->pcidev, 0);


+9 −17
Original line number Original line Diff line number Diff line
@@ -3088,30 +3088,22 @@ static int cxgb_enable_msix(struct adapter *adap)
{
{
	struct msix_entry entries[SGE_QSETS + 1];
	struct msix_entry entries[SGE_QSETS + 1];
	int vectors;
	int vectors;
	int i, err;
	int i;


	vectors = ARRAY_SIZE(entries);
	vectors = ARRAY_SIZE(entries);
	for (i = 0; i < vectors; ++i)
	for (i = 0; i < vectors; ++i)
		entries[i].entry = i;
		entries[i].entry = i;


	while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0)
	vectors = pci_enable_msix_range(adap->pdev, entries,
		vectors = err;
					adap->params.nports + 1, vectors);

	if (vectors < 0)
	if (err < 0)
		return vectors;
		pci_disable_msix(adap->pdev);

	if (!err && vectors < (adap->params.nports + 1)) {
		pci_disable_msix(adap->pdev);
		err = -1;
	}


	if (!err) {
	for (i = 0; i < vectors; ++i)
	for (i = 0; i < vectors; ++i)
		adap->msix_info[i].vec = entries[i].vector;
		adap->msix_info[i].vec = entries[i].vector;
	adap->msix_nvectors = vectors;
	adap->msix_nvectors = vectors;
	}


	return err;
	return 0;
}
}


static void print_port_info(struct adapter *adap, const struct adapter_info *ai)
static void print_port_info(struct adapter *adap, const struct adapter_info *ai)
Loading