Commit cc9a97ea authored by Niranjana Vishwanathapura's avatar Niranjana Vishwanathapura Committed by Doug Ledford
Browse files

IB/hfi1: Do not allocate PIO send contexts for VNIC



OPA VNIC does not use PIO contexts and instead only uses SDMA
engines. Do not allocate PIO contexts for VNIC ports.

Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent e4c397ee
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -6816,7 +6816,8 @@ static void rxe_kernel_unfreeze(struct hfi1_devdata *dd)
		rcd = hfi1_rcd_get_by_index(dd, i);

		/* Ensure all non-user contexts(including vnic) are enabled */
		if (!rcd || !rcd->sc || (rcd->sc->type == SC_USER)) {
		if (!rcd ||
		    (i >= dd->first_dyn_alloc_ctxt && !rcd->is_vnic)) {
			hfi1_rcd_put(rcd);
			continue;
		}
@@ -8093,8 +8094,7 @@ static void is_rcv_avail_int(struct hfi1_devdata *dd, unsigned int source)
		rcd = hfi1_rcd_get_by_index(dd, source);
		if (rcd) {
			/* Check for non-user contexts, including vnic */
			if ((source < dd->first_dyn_alloc_ctxt) ||
			    (rcd->sc && (rcd->sc->type == SC_KERNEL)))
			if (source < dd->first_dyn_alloc_ctxt || rcd->is_vnic)
				rcd->do_interrupt(rcd, 0);
			else
				handle_user_interrupt(rcd);
@@ -8124,8 +8124,8 @@ static void is_rcv_urgent_int(struct hfi1_devdata *dd, unsigned int source)
		rcd = hfi1_rcd_get_by_index(dd, source);
		if (rcd) {
			/* only pay attention to user urgent interrupts */
			if ((source >= dd->first_dyn_alloc_ctxt) &&
			    (!rcd->sc || (rcd->sc->type == SC_USER)))
			if (source >= dd->first_dyn_alloc_ctxt &&
			    !rcd->is_vnic)
				handle_user_interrupt(rcd);

			hfi1_rcd_put(rcd);
+2 −3
Original line number Diff line number Diff line
@@ -929,10 +929,9 @@ void set_all_slowpath(struct hfi1_devdata *dd)
		rcd = hfi1_rcd_get_by_index(dd, i);
		if (!rcd)
			continue;
		if ((i < dd->first_dyn_alloc_ctxt) ||
		    (rcd->sc && (rcd->sc->type == SC_KERNEL))) {
		if (i < dd->first_dyn_alloc_ctxt || rcd->is_vnic)
			rcd->do_interrupt = &handle_receive_interrupt;
		}

		hfi1_rcd_put(rcd);
	}
}
+1 −2
Original line number Diff line number Diff line
@@ -1807,8 +1807,7 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
		amt = PAGE_ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize *
				 sizeof(u32));

		if ((rcd->ctxt < dd->first_dyn_alloc_ctxt) ||
		    (rcd->sc && (rcd->sc->type == SC_KERNEL)))
		if (rcd->ctxt < dd->first_dyn_alloc_ctxt || rcd->is_vnic)
			gfp_flags = GFP_KERNEL;
		else
			gfp_flags = GFP_USER;
+0 −17
Original line number Diff line number Diff line
@@ -703,7 +703,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type,
{
	struct send_context_info *sci;
	struct send_context *sc = NULL;
	int req_type = type;
	dma_addr_t dma;
	unsigned long flags;
	u64 reg;
@@ -730,13 +729,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type,
		return NULL;
	}

	/*
	 * VNIC contexts are dynamically allocated.
	 * Hence, pick a user context for VNIC.
	 */
	if (type == SC_VNIC)
		type = SC_USER;

	spin_lock_irqsave(&dd->sc_lock, flags);
	ret = sc_hw_alloc(dd, type, &sw_index, &hw_context);
	if (ret) {
@@ -746,15 +738,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type,
		return NULL;
	}

	/*
	 * VNIC contexts are used by kernel driver.
	 * Hence, mark them as kernel contexts.
	 */
	if (req_type == SC_VNIC) {
		dd->send_contexts[sw_index].type = SC_KERNEL;
		type = SC_KERNEL;
	}

	sci = &dd->send_contexts[sw_index];
	sci->sc = sc;

+0 −6
Original line number Diff line number Diff line
@@ -54,12 +54,6 @@
#define SC_USER   3	/* must be the last one: it may take all left */
#define SC_MAX    4	/* count of send context types */

/*
 * SC_VNIC types are allocated (dynamically) from the user context pool,
 * (SC_USER) and used by kernel driver as kernel contexts (SC_KERNEL).
 */
#define SC_VNIC   SC_MAX

/* invalid send context index */
#define INVALID_SCI 0xff

Loading