Commit b2578431 authored by Mike Marciniszyn's avatar Mike Marciniszyn Committed by Jason Gunthorpe

IB/hfi1: Remove rcvhdrq_size

The usage of this ctxt data field is not hot path and the value can be
computed on demand to cut down the ctxtdata bloat.
Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 59d40813
...@@ -11857,7 +11857,7 @@ void hfi1_rcvctrl(struct hfi1_devdata *dd, unsigned int op, ...@@ -11857,7 +11857,7 @@ void hfi1_rcvctrl(struct hfi1_devdata *dd, unsigned int op,
* sequence numbers could land exactly on the same spot. * sequence numbers could land exactly on the same spot.
* E.g. a rcd restart before the receive header wrapped. * E.g. a rcd restart before the receive header wrapped.
*/ */
memset(rcd->rcvhdrq, 0, rcd->rcvhdrq_size); memset(rcd->rcvhdrq, 0, rcvhdrq_size(rcd));
/* starting timeout */ /* starting timeout */
rcd->rcvavail_timeout = dd->rcv_intr_timeout_csr; rcd->rcvavail_timeout = dd->rcv_intr_timeout_csr;
......
...@@ -411,7 +411,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) ...@@ -411,7 +411,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
mapio = 1; mapio = 1;
break; break;
case RCV_HDRQ: case RCV_HDRQ:
memlen = uctxt->rcvhdrq_size; memlen = rcvhdrq_size(uctxt);
memvirt = uctxt->rcvhdrq; memvirt = uctxt->rcvhdrq;
break; break;
case RCV_EGRBUF: { case RCV_EGRBUF: {
...@@ -521,7 +521,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) ...@@ -521,7 +521,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
break; break;
case SUBCTXT_RCV_HDRQ: case SUBCTXT_RCV_HDRQ:
memaddr = (u64)uctxt->subctxt_rcvhdr_base; memaddr = (u64)uctxt->subctxt_rcvhdr_base;
memlen = uctxt->rcvhdrq_size * uctxt->subctxt_cnt; memlen = rcvhdrq_size(uctxt) * uctxt->subctxt_cnt;
flags |= VM_IO | VM_DONTEXPAND; flags |= VM_IO | VM_DONTEXPAND;
vmf = 1; vmf = 1;
break; break;
...@@ -1040,7 +1040,7 @@ static int setup_subctxt(struct hfi1_ctxtdata *uctxt) ...@@ -1040,7 +1040,7 @@ static int setup_subctxt(struct hfi1_ctxtdata *uctxt)
return -ENOMEM; return -ENOMEM;
/* We can take the size of the RcvHdr Queue from the master */ /* We can take the size of the RcvHdr Queue from the master */
uctxt->subctxt_rcvhdr_base = vmalloc_user(uctxt->rcvhdrq_size * uctxt->subctxt_rcvhdr_base = vmalloc_user(rcvhdrq_size(uctxt) *
num_subctxts); num_subctxts);
if (!uctxt->subctxt_rcvhdr_base) { if (!uctxt->subctxt_rcvhdr_base) {
ret = -ENOMEM; ret = -ENOMEM;
......
...@@ -201,8 +201,6 @@ struct hfi1_ctxtdata { ...@@ -201,8 +201,6 @@ struct hfi1_ctxtdata {
volatile __le64 *rcvhdrtail_kvaddr; volatile __le64 *rcvhdrtail_kvaddr;
/* when waiting for rcv or pioavail */ /* when waiting for rcv or pioavail */
wait_queue_head_t wait; wait_queue_head_t wait;
/* rcvhdrq size (for freeing) */
size_t rcvhdrq_size;
/* number of rcvhdrq entries */ /* number of rcvhdrq entries */
u16 rcvhdrq_cnt; u16 rcvhdrq_cnt;
/* size of each of the rcvhdrq entries */ /* size of each of the rcvhdrq entries */
...@@ -324,6 +322,19 @@ struct hfi1_ctxtdata { ...@@ -324,6 +322,19 @@ struct hfi1_ctxtdata {
u8 vnic_q_idx; u8 vnic_q_idx;
}; };
/**
* rcvhdrq_size - return total size in bytes for header queue
* @rcd: the receive context
*
* rcvhdrqentsize is in DWs, so we have to convert to bytes
*
*/
static inline u32 rcvhdrq_size(struct hfi1_ctxtdata *rcd)
{
return PAGE_ALIGN(rcd->rcvhdrq_cnt *
rcd->rcvhdrqentsize * sizeof(u32));
}
/* /*
* Represents a single packet at a high level. Put commonly computed things in * Represents a single packet at a high level. Put commonly computed things in
* here so we do not have to keep doing them over and over. The rule of thumb is * here so we do not have to keep doing them over and over. The rule of thumb is
......
...@@ -1129,7 +1129,7 @@ void hfi1_free_ctxtdata(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) ...@@ -1129,7 +1129,7 @@ void hfi1_free_ctxtdata(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
return; return;
if (rcd->rcvhdrq) { if (rcd->rcvhdrq) {
dma_free_coherent(&dd->pcidev->dev, rcd->rcvhdrq_size, dma_free_coherent(&dd->pcidev->dev, rcvhdrq_size(rcd),
rcd->rcvhdrq, rcd->rcvhdrq_dma); rcd->rcvhdrq, rcd->rcvhdrq_dma);
rcd->rcvhdrq = NULL; rcd->rcvhdrq = NULL;
if (rcd->rcvhdrtail_kvaddr) { if (rcd->rcvhdrtail_kvaddr) {
...@@ -1840,12 +1840,7 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) ...@@ -1840,12 +1840,7 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
if (!rcd->rcvhdrq) { if (!rcd->rcvhdrq) {
gfp_t gfp_flags; gfp_t gfp_flags;
/* amt = rcvhdrq_size(rcd);
* rcvhdrqentsize is in DWs, so we have to convert to bytes
* (* sizeof(u32)).
*/
amt = PAGE_ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize *
sizeof(u32));
if (rcd->ctxt < dd->first_dyn_alloc_ctxt || rcd->is_vnic) if (rcd->ctxt < dd->first_dyn_alloc_ctxt || rcd->is_vnic)
gfp_flags = GFP_KERNEL; gfp_flags = GFP_KERNEL;
...@@ -1870,8 +1865,6 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) ...@@ -1870,8 +1865,6 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
if (!rcd->rcvhdrtail_kvaddr) if (!rcd->rcvhdrtail_kvaddr)
goto bail_free; goto bail_free;
} }
rcd->rcvhdrq_size = amt;
} }
/* /*
* These values are per-context: * These values are per-context:
......
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