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

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
...@@ -6816,7 +6816,8 @@ static void rxe_kernel_unfreeze(struct hfi1_devdata *dd) ...@@ -6816,7 +6816,8 @@ static void rxe_kernel_unfreeze(struct hfi1_devdata *dd)
rcd = hfi1_rcd_get_by_index(dd, i); rcd = hfi1_rcd_get_by_index(dd, i);
/* Ensure all non-user contexts(including vnic) are enabled */ /* 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); hfi1_rcd_put(rcd);
continue; continue;
} }
...@@ -8093,8 +8094,7 @@ static void is_rcv_avail_int(struct hfi1_devdata *dd, unsigned int source) ...@@ -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); rcd = hfi1_rcd_get_by_index(dd, source);
if (rcd) { if (rcd) {
/* Check for non-user contexts, including vnic */ /* Check for non-user contexts, including vnic */
if ((source < dd->first_dyn_alloc_ctxt) || if (source < dd->first_dyn_alloc_ctxt || rcd->is_vnic)
(rcd->sc && (rcd->sc->type == SC_KERNEL)))
rcd->do_interrupt(rcd, 0); rcd->do_interrupt(rcd, 0);
else else
handle_user_interrupt(rcd); handle_user_interrupt(rcd);
...@@ -8124,8 +8124,8 @@ static void is_rcv_urgent_int(struct hfi1_devdata *dd, unsigned int source) ...@@ -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); rcd = hfi1_rcd_get_by_index(dd, source);
if (rcd) { if (rcd) {
/* only pay attention to user urgent interrupts */ /* only pay attention to user urgent interrupts */
if ((source >= dd->first_dyn_alloc_ctxt) && if (source >= dd->first_dyn_alloc_ctxt &&
(!rcd->sc || (rcd->sc->type == SC_USER))) !rcd->is_vnic)
handle_user_interrupt(rcd); handle_user_interrupt(rcd);
hfi1_rcd_put(rcd); hfi1_rcd_put(rcd);
......
...@@ -929,10 +929,9 @@ void set_all_slowpath(struct hfi1_devdata *dd) ...@@ -929,10 +929,9 @@ void set_all_slowpath(struct hfi1_devdata *dd)
rcd = hfi1_rcd_get_by_index(dd, i); rcd = hfi1_rcd_get_by_index(dd, i);
if (!rcd) if (!rcd)
continue; continue;
if ((i < dd->first_dyn_alloc_ctxt) || if (i < dd->first_dyn_alloc_ctxt || rcd->is_vnic)
(rcd->sc && (rcd->sc->type == SC_KERNEL))) {
rcd->do_interrupt = &handle_receive_interrupt; rcd->do_interrupt = &handle_receive_interrupt;
}
hfi1_rcd_put(rcd); hfi1_rcd_put(rcd);
} }
} }
......
...@@ -1807,8 +1807,7 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) ...@@ -1807,8 +1807,7 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
amt = PAGE_ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize * amt = PAGE_ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize *
sizeof(u32)); sizeof(u32));
if ((rcd->ctxt < dd->first_dyn_alloc_ctxt) || if (rcd->ctxt < dd->first_dyn_alloc_ctxt || rcd->is_vnic)
(rcd->sc && (rcd->sc->type == SC_KERNEL)))
gfp_flags = GFP_KERNEL; gfp_flags = GFP_KERNEL;
else else
gfp_flags = GFP_USER; gfp_flags = GFP_USER;
......
...@@ -703,7 +703,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type, ...@@ -703,7 +703,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type,
{ {
struct send_context_info *sci; struct send_context_info *sci;
struct send_context *sc = NULL; struct send_context *sc = NULL;
int req_type = type;
dma_addr_t dma; dma_addr_t dma;
unsigned long flags; unsigned long flags;
u64 reg; u64 reg;
...@@ -730,13 +729,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type, ...@@ -730,13 +729,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type,
return NULL; 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); spin_lock_irqsave(&dd->sc_lock, flags);
ret = sc_hw_alloc(dd, type, &sw_index, &hw_context); ret = sc_hw_alloc(dd, type, &sw_index, &hw_context);
if (ret) { if (ret) {
...@@ -746,15 +738,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type, ...@@ -746,15 +738,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type,
return NULL; 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 = &dd->send_contexts[sw_index];
sci->sc = sc; sci->sc = sc;
......
...@@ -54,12 +54,6 @@ ...@@ -54,12 +54,6 @@
#define SC_USER 3 /* must be the last one: it may take all left */ #define SC_USER 3 /* must be the last one: it may take all left */
#define SC_MAX 4 /* count of send context types */ #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 */ /* invalid send context index */
#define INVALID_SCI 0xff #define INVALID_SCI 0xff
......
...@@ -67,8 +67,6 @@ static int setup_vnic_ctxt(struct hfi1_devdata *dd, struct hfi1_ctxtdata *uctxt) ...@@ -67,8 +67,6 @@ static int setup_vnic_ctxt(struct hfi1_devdata *dd, struct hfi1_ctxtdata *uctxt)
unsigned int rcvctrl_ops = 0; unsigned int rcvctrl_ops = 0;
int ret; int ret;
hfi1_init_ctxt(uctxt->sc);
uctxt->do_interrupt = &handle_receive_interrupt; uctxt->do_interrupt = &handle_receive_interrupt;
/* Now allocate the RcvHdr queue and eager buffers. */ /* Now allocate the RcvHdr queue and eager buffers. */
...@@ -96,8 +94,6 @@ static int setup_vnic_ctxt(struct hfi1_devdata *dd, struct hfi1_ctxtdata *uctxt) ...@@ -96,8 +94,6 @@ static int setup_vnic_ctxt(struct hfi1_devdata *dd, struct hfi1_ctxtdata *uctxt)
rcvctrl_ops |= HFI1_RCVCTRL_TAILUPD_ENB; rcvctrl_ops |= HFI1_RCVCTRL_TAILUPD_ENB;
hfi1_rcvctrl(uctxt->dd, rcvctrl_ops, uctxt); hfi1_rcvctrl(uctxt->dd, rcvctrl_ops, uctxt);
uctxt->is_vnic = true;
done: done:
return ret; return ret;
} }
...@@ -122,20 +118,7 @@ static int allocate_vnic_ctxt(struct hfi1_devdata *dd, ...@@ -122,20 +118,7 @@ static int allocate_vnic_ctxt(struct hfi1_devdata *dd,
HFI1_CAP_KGET(NODROP_EGR_FULL) | HFI1_CAP_KGET(NODROP_EGR_FULL) |
HFI1_CAP_KGET(DMA_RTAIL); HFI1_CAP_KGET(DMA_RTAIL);
uctxt->seq_cnt = 1; uctxt->seq_cnt = 1;
uctxt->is_vnic = true;
/* Allocate and enable a PIO send context */
uctxt->sc = sc_alloc(dd, SC_VNIC, uctxt->rcvhdrqentsize,
uctxt->numa_id);
ret = uctxt->sc ? 0 : -ENOMEM;
if (ret)
goto bail;
dd_dev_dbg(dd, "allocated vnic send context %u(%u)\n",
uctxt->sc->sw_index, uctxt->sc->hw_context);
ret = sc_enable(uctxt->sc);
if (ret)
goto bail;
if (dd->num_msix_entries) if (dd->num_msix_entries)
hfi1_set_vnic_msix_info(uctxt); hfi1_set_vnic_msix_info(uctxt);
...@@ -144,11 +127,7 @@ static int allocate_vnic_ctxt(struct hfi1_devdata *dd, ...@@ -144,11 +127,7 @@ static int allocate_vnic_ctxt(struct hfi1_devdata *dd,
dd_dev_dbg(dd, "created vnic context %d\n", uctxt->ctxt); dd_dev_dbg(dd, "created vnic context %d\n", uctxt->ctxt);
*vnic_ctxt = uctxt; *vnic_ctxt = uctxt;
return ret; return 0;
bail:
hfi1_free_ctxt(uctxt);
dd_dev_dbg(dd, "vnic allocation failed. rc %d\n", ret);
return ret;
} }
static void deallocate_vnic_ctxt(struct hfi1_devdata *dd, static void deallocate_vnic_ctxt(struct hfi1_devdata *dd,
...@@ -170,18 +149,6 @@ static void deallocate_vnic_ctxt(struct hfi1_devdata *dd, ...@@ -170,18 +149,6 @@ static void deallocate_vnic_ctxt(struct hfi1_devdata *dd,
HFI1_RCVCTRL_ONE_PKT_EGR_DIS | HFI1_RCVCTRL_ONE_PKT_EGR_DIS |
HFI1_RCVCTRL_NO_RHQ_DROP_DIS | HFI1_RCVCTRL_NO_RHQ_DROP_DIS |
HFI1_RCVCTRL_NO_EGR_DROP_DIS, uctxt); HFI1_RCVCTRL_NO_EGR_DROP_DIS, uctxt);
/*
* VNIC contexts are allocated from user context pool.
* Release them back to user context pool.
*
* Reset context integrity checks to default.
* (writes to CSRs probably belong in chip.c)
*/
write_kctxt_csr(dd, uctxt->sc->hw_context, SEND_CTXT_CHECK_ENABLE,
hfi1_pkt_default_send_ctxt_mask(dd, SC_USER));
sc_disable(uctxt->sc);
dd->send_contexts[uctxt->sc->sw_index].type = SC_USER;
uctxt->event_flags = 0; uctxt->event_flags = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment