Commit dd6c6a5a authored by Michael J. Ruhl's avatar Michael J. Ruhl Committed by Jason Gunthorpe
Browse files

IB/hfi1: Limit VNIC use of SDMA engines to the available count



VNIC assumes that all SDMA engines have been configured for use.  This is
not necessarily true (i.e. if the count was constrained by the module
parameter).

Update VNICs usage to use the configured count, rather than the hardware
count.

Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: default avatarGary Leshner <gary.s.leshner@intel.com>
Signed-off-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent fe4dd423
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -816,14 +816,14 @@ struct net_device *hfi1_vnic_alloc_rn(struct ib_device *device,


	size = sizeof(struct opa_vnic_rdma_netdev) + sizeof(*vinfo);
	size = sizeof(struct opa_vnic_rdma_netdev) + sizeof(*vinfo);
	netdev = alloc_netdev_mqs(size, name, name_assign_type, setup,
	netdev = alloc_netdev_mqs(size, name, name_assign_type, setup,
				  chip_sdma_engines(dd), dd->num_vnic_contexts);
				  dd->num_sdma, dd->num_vnic_contexts);
	if (!netdev)
	if (!netdev)
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);


	rn = netdev_priv(netdev);
	rn = netdev_priv(netdev);
	vinfo = opa_vnic_dev_priv(netdev);
	vinfo = opa_vnic_dev_priv(netdev);
	vinfo->dd = dd;
	vinfo->dd = dd;
	vinfo->num_tx_q = chip_sdma_engines(dd);
	vinfo->num_tx_q = dd->num_sdma;
	vinfo->num_rx_q = dd->num_vnic_contexts;
	vinfo->num_rx_q = dd->num_vnic_contexts;
	vinfo->netdev = netdev;
	vinfo->netdev = netdev;
	rn->free_rdma_netdev = hfi1_vnic_free_rn;
	rn->free_rdma_netdev = hfi1_vnic_free_rn;