Commit 89dcaa36 authored by Grzegorz Andrejczuk's avatar Grzegorz Andrejczuk Committed by Jason Gunthorpe
Browse files

IB/hfi1: Rename num_vnic_contexts as num_netdev_contexts

Rename num_vnic_contexts as num_ndetdev_contexts since VNIC and ipoib
will share the same set of receive contexts.

Link: https://lore.kernel.org/r/20200511160625.173205.53306.stgit@awfm-01.aw.intel.com


Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarSadanand Warrier <sadanand.warrier@intel.com>
Signed-off-by: default avatarGrzegorz Andrejczuk <grzegorz.andrejczuk@intel.com>
Signed-off-by: default avatarKaike Wan <kaike.wan@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 6d72344c
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -13347,12 +13347,12 @@ static int set_up_interrupts(struct hfi1_devdata *dd)
 *                             in array of contexts
 *	freectxts  - number of free user contexts
 *	num_send_contexts - number of PIO send contexts being used
 *	num_vnic_contexts - number of contexts reserved for VNIC
 *	num_netdev_contexts - number of contexts reserved for netdev
 */
static int set_up_context_variables(struct hfi1_devdata *dd)
{
	unsigned long num_kernel_contexts;
	u16 num_vnic_contexts = HFI1_NUM_VNIC_CTXT;
	u16 num_netdev_contexts = HFI1_NUM_VNIC_CTXT;
	int total_contexts;
	int ret;
	unsigned ngroups;
@@ -13391,11 +13391,11 @@ static int set_up_context_variables(struct hfi1_devdata *dd)
	}

	/* Accommodate VNIC contexts if possible */
	if ((num_kernel_contexts + num_vnic_contexts) > rcv_contexts) {
	if ((num_kernel_contexts + num_netdev_contexts) > rcv_contexts) {
		dd_dev_err(dd, "No receive contexts available for VNIC\n");
		num_vnic_contexts = 0;
		num_netdev_contexts = 0;
	}
	total_contexts = num_kernel_contexts + num_vnic_contexts;
	total_contexts = num_kernel_contexts + num_netdev_contexts;

	/*
	 * User contexts:
@@ -13422,15 +13422,15 @@ static int set_up_context_variables(struct hfi1_devdata *dd)
	 * The RMT entries are currently allocated as shown below:
	 * 1. QOS (0 to 128 entries);
	 * 2. FECN (num_kernel_context - 1 + num_user_contexts +
	 *    num_vnic_contexts);
	 * 3. VNIC (num_vnic_contexts).
	 * It should be noted that FECN oversubscribe num_vnic_contexts
	 * entries of RMT because both VNIC and PSM could allocate any receive
	 *    num_netdev_contexts);
	 * 3. netdev (num_netdev_contexts).
	 * It should be noted that FECN oversubscribe num_netdev_contexts
	 * entries of RMT because both netdev and PSM could allocate any receive
	 * context between dd->first_dyn_alloc_text and dd->num_rcv_contexts,
	 * and PSM FECN must reserve an RMT entry for each possible PSM receive
	 * context.
	 */
	rmt_count = qos_rmt_entries(dd, NULL, NULL) + (num_vnic_contexts * 2);
	rmt_count = qos_rmt_entries(dd, NULL, NULL) + (num_netdev_contexts * 2);
	if (HFI1_CAP_IS_KSET(TID_RDMA))
		rmt_count += num_kernel_contexts - 1;
	if (rmt_count + n_usr_ctxts > NUM_MAP_ENTRIES) {
@@ -13449,7 +13449,7 @@ static int set_up_context_variables(struct hfi1_devdata *dd)
	dd->num_rcv_contexts = total_contexts;
	dd->n_krcv_queues = num_kernel_contexts;
	dd->first_dyn_alloc_ctxt = num_kernel_contexts;
	dd->num_vnic_contexts = num_vnic_contexts;
	dd->num_netdev_contexts = num_netdev_contexts;
	dd->num_user_contexts = n_usr_ctxts;
	dd->freectxts = n_usr_ctxts;
	dd_dev_info(dd,
@@ -13457,7 +13457,7 @@ static int set_up_context_variables(struct hfi1_devdata *dd)
		    rcv_contexts,
		    (int)dd->num_rcv_contexts,
		    (int)dd->n_krcv_queues,
		    dd->num_vnic_contexts,
		    dd->num_netdev_contexts,
		    dd->num_user_contexts);

	/*
+2 −2
Original line number Diff line number Diff line
@@ -1167,8 +1167,8 @@ struct hfi1_devdata {
	u64 z_send_schedule;

	u64 __percpu *send_schedule;
	/* number of reserved contexts for VNIC usage */
	u16 num_vnic_contexts;
	/* number of reserved contexts for netdev usage */
	u16 num_netdev_contexts;
	/* number of receive contexts in use by the driver */
	u32 num_rcv_contexts;
	/* number of pio send contexts in use by the driver */
+2 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
/*
 * Copyright(c) 2018 Intel Corporation.
 * Copyright(c) 2018 - 2020 Intel Corporation.
 *
 * This file is provided under a dual BSD/GPLv2 license.  When using or
 * redistributing this file, you may do so under either license.
@@ -69,7 +69,7 @@ int msix_initialize(struct hfi1_devdata *dd)
	 *	one for each VNIC context
	 *      ...any new IRQs should be added here.
	 */
	total = 1 + dd->num_sdma + dd->n_krcv_queues + dd->num_vnic_contexts;
	total = 1 + dd->num_sdma + dd->n_krcv_queues + dd->num_netdev_contexts;

	if (total >= CCE_NUM_MSIX_VECTORS)
		return -EINVAL;
+4 −4
Original line number Diff line number Diff line
/*
 * Copyright(c) 2017 - 2018 Intel Corporation.
 * Copyright(c) 2017 - 2020 Intel Corporation.
 *
 * This file is provided under a dual BSD/GPLv2 license.  When using or
 * redistributing this file, you may do so under either license.
@@ -804,7 +804,7 @@ struct net_device *hfi1_vnic_alloc_rn(struct ib_device *device,
	struct rdma_netdev *rn;
	int i, size, rc;

	if (!dd->num_vnic_contexts)
	if (!dd->num_netdev_contexts)
		return ERR_PTR(-ENOMEM);

	if (!port_num || (port_num > dd->num_pports))
@@ -815,7 +815,7 @@ struct net_device *hfi1_vnic_alloc_rn(struct ib_device *device,

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

@@ -823,7 +823,7 @@ struct net_device *hfi1_vnic_alloc_rn(struct ib_device *device,
	vinfo = opa_vnic_dev_priv(netdev);
	vinfo->dd = dd;
	vinfo->num_tx_q = dd->num_sdma;
	vinfo->num_rx_q = dd->num_vnic_contexts;
	vinfo->num_rx_q = dd->num_netdev_contexts;
	vinfo->netdev = netdev;
	rn->free_rdma_netdev = hfi1_vnic_free_rn;
	rn->set_id = hfi1_vnic_set_vesw_id;