Commit 071e4fec authored by Mike Marciniszyn's avatar Mike Marciniszyn Committed by Jason Gunthorpe

IB/hfi1: Reorg ctxtdata and rightsize fields

Many fields in ctxtdata are incorrectly sized and the organization of the
fields within the structure is a jumble.

Fix by:
- Correcting oversize fields.
- Putting fields common to all contexts at the top with hot fields
  at the top.
- Moving PSM fields to the bottom of the structure.
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 06e81e3e
...@@ -197,36 +197,78 @@ struct hfi1_ctxtdata { ...@@ -197,36 +197,78 @@ struct hfi1_ctxtdata {
void *rcvhdrq; void *rcvhdrq;
/* kernel virtual address where hdrqtail is updated */ /* kernel virtual address where hdrqtail is updated */
volatile __le64 *rcvhdrtail_kvaddr; volatile __le64 *rcvhdrtail_kvaddr;
/* when waiting for rcv or pioavail */ /* so functions that need physical port can get it easily */
wait_queue_head_t wait; struct hfi1_pportdata *ppd;
/* so file ops can get at unit */
struct hfi1_devdata *dd;
/* this receive context's assigned PIO ACK send context */
struct send_context *sc;
/* per context recv functions */
const rhf_rcv_function_ptr *rhf_rcv_function_map;
/*
* The interrupt handler for a particular receive context can vary
* throughout it's lifetime. This is not a lock protected data member so
* it must be updated atomically and the prev and new value must always
* be valid. Worst case is we process an extra interrupt and up to 64
* packets with the wrong interrupt handler.
*/
int (*do_interrupt)(struct hfi1_ctxtdata *rcd, int threaded);
/* verbs rx_stats per rcd */
struct hfi1_opcode_stats_perctx *opstats;
/* clear interrupt mask */
u64 imask;
/* ctxt rcvhdrq head offset */
u32 head;
/* number of rcvhdrq entries */ /* number of rcvhdrq entries */
u16 rcvhdrq_cnt; u16 rcvhdrq_cnt;
u8 ireg; /* clear interrupt register */
/* receive packet sequence counter */
u8 seq_cnt;
/* size of each of the rcvhdrq entries */ /* size of each of the rcvhdrq entries */
u8 rcvhdrqentsize; u8 rcvhdrqentsize;
/* offset of RHF within receive header entry */ /* offset of RHF within receive header entry */
u8 rhf_offset; u8 rhf_offset;
/* dynamic receive available interrupt timeout */
u8 rcvavail_timeout;
/* Indicates that this is vnic context */
bool is_vnic;
/* vnic queue index this context is mapped to */
u8 vnic_q_idx;
/* Is ASPM interrupt supported for this context */
bool aspm_intr_supported;
/* ASPM state (enabled/disabled) for this context */
bool aspm_enabled;
/* Is ASPM processing enabled for this context (in intr context) */
bool aspm_intr_enable;
struct ctxt_eager_bufs egrbufs;
/* QPs waiting for context processing */
struct list_head qp_wait_list;
/* tid allocation lists */
struct exp_tid_set tid_group_list;
struct exp_tid_set tid_used_list;
struct exp_tid_set tid_full_list;
/* Timer for re-enabling ASPM if interrupt activity quiets down */
struct timer_list aspm_timer;
/* per-context configuration flags */
unsigned long flags;
/* array of tid_groups */
struct tid_group *groups;
/* mmap of hdrq, must fit in 44 bits */ /* mmap of hdrq, must fit in 44 bits */
dma_addr_t rcvhdrq_dma; dma_addr_t rcvhdrq_dma;
dma_addr_t rcvhdrqtailaddr_dma; dma_addr_t rcvhdrqtailaddr_dma;
struct ctxt_eager_bufs egrbufs; /* Last interrupt timestamp */
/* this receive context's assigned PIO ACK send context */ ktime_t aspm_ts_last_intr;
struct send_context *sc; /* Last timestamp at which we scheduled a timer for this context */
ktime_t aspm_ts_timer_sched;
/* dynamic receive available interrupt timeout */ /* Lock to serialize between intr, timer intr and user threads */
u32 rcvavail_timeout; spinlock_t aspm_lock;
/* Reference count the base context usage */ /* Reference count the base context usage */
struct kref kref; struct kref kref;
/* numa node of this context */
/* Device context index */ int numa_id;
u16 ctxt; /* associated msix interrupt. */
/* s16 msix_intr;
* non-zero if ctxt can be shared, and defines the maximum number of
* sub-contexts for this device context.
*/
u16 subctxt_cnt;
/* non-zero if ctxt is being shared. */
u16 subctxt_id;
u8 uuid[16];
/* job key */ /* job key */
u16 jkey; u16 jkey;
/* number of RcvArray groups for this context. */ /* number of RcvArray groups for this context. */
...@@ -237,87 +279,44 @@ struct hfi1_ctxtdata { ...@@ -237,87 +279,44 @@ struct hfi1_ctxtdata {
u16 expected_count; u16 expected_count;
/* index of first expected TID entry. */ /* index of first expected TID entry. */
u16 expected_base; u16 expected_base;
/* array of tid_groups */ /* Device context index */
struct tid_group *groups; u8 ctxt;
struct exp_tid_set tid_group_list;
struct exp_tid_set tid_used_list;
struct exp_tid_set tid_full_list;
/* lock protecting all Expected TID data of user contexts */ /* PSM Specific fields */
/* lock protecting all Expected TID data */
struct mutex exp_mutex; struct mutex exp_mutex;
/* per-context configuration flags */ /* when waiting for rcv or pioavail */
unsigned long flags; wait_queue_head_t wait;
/* per-context event flags for fileops/intr communication */ /* uuid from PSM */
unsigned long event_flags; u8 uuid[16];
/* total number of polled urgent packets */
u32 urgent;
/* saved total number of polled urgent packets for poll edge trigger */
u32 urgent_poll;
/* same size as task_struct .comm[], command that opened context */ /* same size as task_struct .comm[], command that opened context */
char comm[TASK_COMM_LEN]; char comm[TASK_COMM_LEN];
/* so file ops can get at unit */ /* Bitmask of in use context(s) */
struct hfi1_devdata *dd; DECLARE_BITMAP(in_use_ctxts, HFI1_MAX_SHARED_CTXTS);
/* per context recv functions */ /* per-context event flags for fileops/intr communication */
const rhf_rcv_function_ptr *rhf_rcv_function_map; unsigned long event_flags;
/* so functions that need physical port can get it easily */
struct hfi1_pportdata *ppd;
/* associated msix interrupt */
u32 msix_intr;
/* A page of memory for rcvhdrhead, rcvegrhead, rcvegrtail * N */ /* A page of memory for rcvhdrhead, rcvegrhead, rcvegrtail * N */
void *subctxt_uregbase; void *subctxt_uregbase;
/* An array of pages for the eager receive buffers * N */ /* An array of pages for the eager receive buffers * N */
void *subctxt_rcvegrbuf; void *subctxt_rcvegrbuf;
/* An array of pages for the eager header queue entries * N */ /* An array of pages for the eager header queue entries * N */
void *subctxt_rcvhdr_base; void *subctxt_rcvhdr_base;
/* Bitmask of in use context(s) */ /* total number of polled urgent packets */
DECLARE_BITMAP(in_use_ctxts, HFI1_MAX_SHARED_CTXTS); u32 urgent;
/* The version of the library which opened this ctxt */ /* saved total number of polled urgent packets for poll edge trigger */
u32 userversion; u32 urgent_poll;
/* Type of packets or conditions we want to poll for */ /* Type of packets or conditions we want to poll for */
u16 poll_type; u16 poll_type;
/* receive packet sequence counter */ /* non-zero if ctxt is being shared. */
u8 seq_cnt; u16 subctxt_id;
/* ctxt rcvhdrq head offset */ /* The version of the library which opened this ctxt */
u32 head; u32 userversion;
/* QPs waiting for context processing */
struct list_head qp_wait_list;
/* interrupt handling */
u64 imask; /* clear interrupt mask */
int ireg; /* clear interrupt register */
int numa_id; /* numa node of this context */
/* verbs rx_stats per rcd */
struct hfi1_opcode_stats_perctx *opstats;
/* Is ASPM interrupt supported for this context */
bool aspm_intr_supported;
/* ASPM state (enabled/disabled) for this context */
bool aspm_enabled;
/* Timer for re-enabling ASPM if interrupt activity quietens down */
struct timer_list aspm_timer;
/* Lock to serialize between intr, timer intr and user threads */
spinlock_t aspm_lock;
/* Is ASPM processing enabled for this context (in intr context) */
bool aspm_intr_enable;
/* Last interrupt timestamp */
ktime_t aspm_ts_last_intr;
/* Last timestamp at which we scheduled a timer for this context */
ktime_t aspm_ts_timer_sched;
/* /*
* The interrupt handler for a particular receive context can vary * non-zero if ctxt can be shared, and defines the maximum number of
* throughout it's lifetime. This is not a lock protected data member so * sub-contexts for this device context.
* it must be updated atomically and the prev and new value must always
* be valid. Worst case is we process an extra interrupt and up to 64
* packets with the wrong interrupt handler.
*/ */
int (*do_interrupt)(struct hfi1_ctxtdata *rcd, int threaded); u8 subctxt_cnt;
/* Indicates that this is vnic context */
bool is_vnic;
/* vnic queue index this context is mapped to */
u8 vnic_q_idx;
}; };
/** /**
......
...@@ -1913,9 +1913,9 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) ...@@ -1913,9 +1913,9 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd) int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd)
{ {
struct hfi1_devdata *dd = rcd->dd; struct hfi1_devdata *dd = rcd->dd;
u32 max_entries, egrtop, alloced_bytes = 0, idx = 0; u32 max_entries, egrtop, alloced_bytes = 0;
gfp_t gfp_flags; gfp_t gfp_flags;
u16 order; u16 order, idx = 0;
int ret = 0; int ret = 0;
u16 round_mtu = roundup_pow_of_two(hfi1_max_mtu); u16 round_mtu = roundup_pow_of_two(hfi1_max_mtu);
......
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