IB/hfi1,qib,rdmavt: Patches for 4.10
Subsystems (3)
cover IB/hfi1,qib,rdmavt: Patches for 4.10
Doug,
Here is a set of patches for our drivers for 4.10. This is a collection of bug fixes, perf improvements, and clean ups. The patches apply on top of the last series I submitted. However if things do not apply cleanly let me know I can rebase.
Can also be found in GitHub repo at:
https://github.com/ddalessa/kernel/tree/for-4.10
---
Dean Luick (5):
IB/hfi1: Read new EPROM format
IB/hfi1: Fix dc8051 multiple qword memory reads IB/hfi1: Export 8051 memory and LCB registers via debugfs IB/hfi1: Add special setting for low power AOC IB/hfi1: Preserve external device completed bit
Dennis Dalessandro (1):
IB/rdmavt: Fix trace hierarchy
Don Hiatt (1):
IB/hfi1: Remove dependence on qp->s_cur_size
Harish Chegondi (1):
IB/hfi1: Avoid credit return allocation for cpu-less NUMA nodes
Jakub Pawlak (1):
IB/hfi1: Disable header suppression for short packets
Jianxin Xiong (1):
IB/hfi1: Show statistics counters under IB stats interface
Mike Marciniszyn (6):
IB/rdmavt: Add trace of MR segs
IB/rdmavt: Add a send completion helper IB/hfi1,IB/qib: Use new send completion helper IB/rdmavt: Add swqe mr deref helper IB/hfi1,IB/qib: use rvt swqe mr deref helper IB/rdmavt,IB/hfi1,IB/qib: Add inlines for mtu division
Mitko Haralanov (1):
IB/hfi1: Remove usage of qp->s_cur_sge
Sebastian Sanchez (5):
IB/hfi1: Use non-atomic __test_and_clear_bit in hot path IB/hfi1: Remove critical section gap in sc_buffer_alloc() IB/hfi1: Replace qp->refcount release code with standard driver wrapper IB/hfi1: Use reference count wrapper for MRs
IB/qib: Use standard refcount wrapper for QPs
Tadeusz Struk (1):
IB/hfi1: Remove definition of unused hfi1_affinity struct
drivers/infiniband/hw/hfi1/affinity.c | 3 drivers/infiniband/hw/hfi1/affinity.h | 9 - drivers/infiniband/hw/hfi1/chip.c | 5 + drivers/infiniband/hw/hfi1/debugfs.c | 110 ++++++++++++++++ drivers/infiniband/hw/hfi1/driver.c | 3 drivers/infiniband/hw/hfi1/eprom.c | 211 +++++++++++++++++++++++++++++- drivers/infiniband/hw/hfi1/firmware.c | 10 + drivers/infiniband/hw/hfi1/hfi.h | 1 drivers/infiniband/hw/hfi1/pio.c | 22 --- drivers/infiniband/hw/hfi1/platform.c | 44 ++++++ drivers/infiniband/hw/hfi1/rc.c | 60 ++------- drivers/infiniband/hw/hfi1/ruc.c | 28 +--- drivers/infiniband/hw/hfi1/uc.c | 4 - drivers/infiniband/hw/hfi1/ud.c | 4 - drivers/infiniband/hw/hfi1/user_sdma.c | 60 ++++++--- drivers/infiniband/hw/hfi1/verbs.c | 190 +++++++++++++++++++++++---- drivers/infiniband/hw/hfi1/verbs_txreq.h | 1 drivers/infiniband/hw/qib/qib_driver.c | 3 drivers/infiniband/hw/qib/qib_rc.c | 44 +----- drivers/infiniband/hw/qib/qib_ruc.c | 24 --- drivers/infiniband/hw/qib/qib_verbs.c | 33 +---- drivers/infiniband/sw/rdmavt/mcast.c | 5 - drivers/infiniband/sw/rdmavt/mr.c | 12 +- drivers/infiniband/sw/rdmavt/qp.c | 17 ++ drivers/infiniband/sw/rdmavt/trace.h | 141 +------------------- drivers/infiniband/sw/rdmavt/trace_mr.h | 112 ++++++++++++++++ drivers/infiniband/sw/rdmavt/trace_qp.h | 96 ++++++++++++++ drivers/infiniband/sw/rdmavt/trace_rvt.h | 81 ++++++++++++ drivers/infiniband/sw/rdmavt/trace_tx.h | 132 +++++++++++++++++++ include/rdma/rdmavt_qp.h | 77 +++++++++++ include/uapi/rdma/hfi/hfi1_user.h | 2 31 files changed, 1147 insertions(+), 397 deletions(-) create mode 100644 drivers/infiniband/sw/rdmavt/trace_mr.h create mode 100644 drivers/infiniband/sw/rdmavt/trace_qp.h create mode 100644 drivers/infiniband/sw/rdmavt/trace_rvt.h create mode 100644 drivers/infiniband/sw/rdmavt/trace_tx.h
--
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/23 IB/hfi1: Read new EPROM format
In reply to a message not in the archiveFrom: Dean Luick <[email protected]>
Add the ability to read the new EPROM format.
--- drivers/infiniband/hw/hfi1/eprom.c | 211 +++++++++++++++++++++++++++++++++++- 1 files changed, 203 insertions(+), 8 deletions(-)
drivers/infiniband/hw/hfi1/eprom.c +203 -8
@@ -207,6 +207,40 @@ int eprom_init(struct hfi1_devdata *dd)/* magic character sequence that trails an image */ #define IMAGE_TRAIL_MAGIC "egamiAPO" +/* EPROM file types */ +#define HFI1_EFT_PLATFORM_CONFIG 2 + +/* segment size - 128 KiB */ +#define SEG_SIZE (128 * 1024) + +struct hfi1_eprom_footer { +u32 oprom_size;/* size of the oprom, in bytes */ +u16 num_table_entries; +u16 version;/* version of this footer */ +u32 magic;/* must be last */ +}; + +struct hfi1_eprom_table_entry { +u32 type;/* file type */ +u32 offset;/* file offset from start of EPROM */ +u32 size;/* file size, in bytes */ +}; + +/* +* Calculate the max number of table entries that will fit within a directory +* buffer of size 'dir_size'. +*/ +#define MAX_TABLE_ENTRIES (dir_size) \ + (((dir_size) - sizeof(struct hfi1_eprom_footer)) / \ + sizeof(struct hfi1_eprom_table_entry)) + +#define DIRECTORY_SIZE (n) (sizeof(struct hfi1_eprom_footer) + \ + (sizeof(struct hfi1_eprom_table_entry) * (n))) + +#define MAGIC4 (a, b, c, d) ((d) << 24 | (c) << 16 | (b) << 8 | (a)) +#define FOOTER_MAGIC MAGIC4('e', 'p', 'r', 'm') +#define FOOTER_VERSION 1 +/* * Read all of partition 1. The actual file is at the front. Adjust * the returned size if a trailing image magic is found.
@@ -242,6 +276,167 @@ static int read_partition_platform_config(struct hfi1_devdata *dd, void **data, }/* +* The segment magic has been checked. There is a footer and table of +* contents present. +* +* directory is a u32 aligned buffer of size EP_PAGE_SIZE. +*/ +static int read_segment_platform_config (struct hfi1_devdata *dd, +void *directory,void **data,u32 *size) +{ +struct hfi1_eprom_footer *footer; +struct hfi1_eprom_table_entry *table; +struct hfi1_eprom_table_entry *entry; +void *buffer =NULL ; +void *table_buffer =NULL ; +int ret, i; +u32 directory_size; +u32 seg_base, seg_offset; +u32 bytes_available, ncopied, to_copy; + +/* the footer is at the end of the directory */ + footer = (struct hfi1_eprom_footer *) + (directory +EP_PAGE_SIZE -sizeof (*footer)); + +/* make sure the structure version is supported */ +if (footer->version !=FOOTER_VERSION ) +return -EINVAL ; + +/* oprom size cannot be larger than a segment */ +if (footer->oprom_size >=SEG_SIZE ) +return -EINVAL ; + +/* the file table must fit in a segment with the oprom */ +if (footer->num_table_entries > +MAX_TABLE_ENTRIES (SEG_SIZE - footer->oprom_size)) +return -EINVAL ; + +/* find the file table start, which precedes the footer */ + directory_size =DIRECTORY_SIZE (footer->num_table_entries); +if (directory_size <=EP_PAGE_SIZE ) { +/* the file table fits into the directory buffer handed in */ + table = (struct hfi1_eprom_table_entry *) + (directory +EP_PAGE_SIZE - directory_size); + }else { +/* need to allocate and read more */ + table_buffer =kmalloc (directory_size,GFP_KERNEL ); +if (!table_buffer) +return -ENOMEM ; + ret =read_length (dd,SEG_SIZE - directory_size, + directory_size, table_buffer); +if (ret) + goto done; + table = table_buffer; + } + +/* look for the platform configuration file in the table */ +for (entry =NULL , i =0 ; i < footer->num_table_entries; i++) { +if (table[i].type ==HFI1_EFT_PLATFORM_CONFIG ) { + entry = &table[i]; +break ; + } + } +if (!entry) { + ret = -ENOENT ; + goto done; + } + +/* +* Sanity check on the configuration file size - it should never +* be larger than 4 KiB. +*/ +if (entry->size > (4 *1024 )) { +dd_dev_err (dd,"Bad configuration file size 0x%x\n" , + entry->size); + ret = -EINVAL ; + goto done; + } + +/* check for bogus offset and size that wrap when added together */ +if (entry->offset + entry->size < entry->offset) { +dd_dev_err (dd, +"Bad configuration file start + size 0x%x+0x%x\n" , + entry->offset, entry->size); + ret = -EINVAL ; + goto done; + } + +/* allocate the buffer to return */ + buffer =kmalloc (entry->size,GFP_KERNEL ); +if (!buffer) { + ret = -ENOMEM ; + goto done; + } + +/* +* Extract the file by looping over segments until it is fully read. +*/ + seg_offset = entry->offset %SEG_SIZE ; + seg_base = entry->offset - seg_offset; + ncopied =0 ; +while (ncopied < entry->size) { +/* calculate data bytes available in this segment */ + +/* start with the bytes from the current offset to the end */ + bytes_available =SEG_SIZE - seg_offset; +/* subtract off footer and table from segment 0 */ +if (seg_base ==0 ) { +/* +* Sanity check: should not have a starting point +* at or within the directory. +*/ +if (bytes_available <= directory_size) { +dd_dev_err (dd, +"Bad configuration file - offset 0x%x within footer+table\n" , + entry->offset); + ret = -EINVAL ; + goto done; + } + bytes_available -= directory_size; + } + +/* calculate bytes wanted */ + to_copy = entry->size - ncopied; + +/* max out at the available bytes in this segment */ +if (to_copy > bytes_available) + to_copy = bytes_available; + +/* +* Read from the EPROM. +* +* The sanity check for entry->offset is done in read_length(). +* The EPROM offset is validated against what the hardware +* addressing supports. In addition, if the offset is larger +* than the actual EPROM, it silently wraps. It will work +* fine, though the reader may not get what they expected +* from the EPROM. +*/ + ret =read_length (dd, seg_base + seg_offset, to_copy, + buffer + ncopied); +if (ret) + goto done; + + ncopied += to_copy; + +/* set up for next segment */ + seg_offset = footer->oprom_size; + seg_base +=SEG_SIZE ; + } + +/* success */ + ret =0 ; + *data = buffer; + *size = entry->size; + +done: +kfree (table_buffer); +if (ret) +kfree (buffer); +return ret; +} + +/* * Read the platform configuration file from the EPROM. * * On success, an allocated buffer containing the data and its size are
@@ -253,6 +448,7 @@ static int read_partition_platform_config(struct hfi1_devdata *dd, void **data,* -EBUSY - not able to acquire access to the EPROM * -ENOENT - no recognizable file written * -ENOMEM - buffer could not be allocated +* -EINVAL - invalid EPROM contentents found */ int eprom_read_platform_config (struct hfi1_devdata *dd,void **data,u32 *size) {
@@ -266,21 +462,20 @@ int eprom_read_platform_config(struct hfi1_devdata *dd, void **data, u32 *size)if (ret)return -EBUSY ; -/* read the last page of P0 for the EPROM format magic */ - ret =read_length (dd,P1_START -EP_PAGE_SIZE ,EP_PAGE_SIZE , directory); +/* read the last page of the segment for the EPROM format magic */ + ret =read_length (dd,SEG_SIZE -EP_PAGE_SIZE ,EP_PAGE_SIZE , directory);if (ret) goto done; -/* last dword of P0 contains a magic indicator */ -if (directory[EP_PAGE_DWORDS -1 ] ==0 ) { +/* last dword of the segment contains a magic value */ +if (directory[EP_PAGE_DWORDS -1 ] ==FOOTER_MAGIC ) { +/* segment format */ + ret =read_segment_platform_config (dd, directory, data, size); + }else {/* partition format */ ret =read_partition_platform_config (dd, data, size); - goto done; } -/* nothing recognized */ - ret = -ENOENT ; - done:release_chip_resource (dd,CR_EPROM );return ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/23 IB/hfi1: Fix dc8051 multiple qword memory reads
In reply to a message not in the archiveFrom: Dean Luick <[email protected]>
When reading multiple dc8051 data memory locations at once, the read enabled field must be toggled at every address change. Do that by writing only the address first, then writing the enable.
--- drivers/infiniband/hw/hfi1/firmware.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/infiniband/hw/hfi1/firmware.c +6 -4
@@ -263,11 +263,13 @@ static int __read_8051_data(struct hfi1_devdata *dd, u32 addr, u64 *result)u64 reg;int count; -/* start the read at the given address */ - reg = ((addr &DC_DC8051_CFG_RAM_ACCESS_CTRL_ADDRESS_MASK ) - <<DC_DC8051_CFG_RAM_ACCESS_CTRL_ADDRESS_SHIFT ) - |DC_DC8051_CFG_RAM_ACCESS_CTRL_READ_ENA_SMASK ; +/* step 1: set the address, clear enable */ + reg = (addr &DC_DC8051_CFG_RAM_ACCESS_CTRL_ADDRESS_MASK ) + <<DC_DC8051_CFG_RAM_ACCESS_CTRL_ADDRESS_SHIFT ;write_csr (dd,DC_DC8051_CFG_RAM_ACCESS_CTRL , reg); +/* step 2: enable */ +write_csr (dd,DC_DC8051_CFG_RAM_ACCESS_CTRL , + reg |DC_DC8051_CFG_RAM_ACCESS_CTRL_READ_ENA_SMASK );/* wait until ACCESS_COMPLETED is set */ count =0 ;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/23 IB/hfi1: Use non-atomic __test_and_clear_bit in hot path
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
qp->r_aflags is already protected by qp->r_lock, therefore, test_and_clear_bit() doesn't need to be atomic. Profile shows this function call is costly.
Change the test_and_clear_bit() call to use the non-atomic variant.
--- drivers/infiniband/hw/hfi1/rc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/rc.c +1 -1
@@ -2295,7 +2295,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)hfi1_copy_sge (&qp->r_sge, data, tlen,1 , copy_last);rvt_put_ss (&qp->r_sge); qp->r_msn++; -if (!test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags)) +if (!__test_and_clear_bit (RVT_R_WRID_VALID , &qp->r_aflags))break ; wc.wr_id = qp->r_wr_id; wc.status =IB_WC_SUCCESS ;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/23 IB/hfi1: Export 8051 memory and LCB registers via debugfs
In reply to a message not in the archiveFrom: Dean Luick <[email protected]>
Both the 8051 memory and LCB register access require multiple steps and coordination with the driver. This cannot be safely done with resource0 alone.
The 8051 memory is exported read-only. LCB is exported read/write.
--- drivers/infiniband/hw/hfi1/debugfs.c | 110 ++++++++++++++++++++++++++++++++++ 1 files changed, 110 insertions(+), 0 deletions(-)
drivers/infiniband/hw/hfi1/debugfs.c +110 -0
@@ -541,6 +541,114 @@ static ssize_t asic_flags_write(struct file *file, const char __user *buf,return ret; } +/* read the dc8051 memory */ +static ssize_t dc8051_memory_read (struct file *file,char __user *buf, +size_t count,loff_t *ppos) +{ +struct hfi1_pportdata *ppd =private2ppd (file); +ssize_t rval; +void *tmp; +loff_t start, end; + +/* the checks below expect the position to be positive */ +if (*ppos <0 ) +return -EINVAL ; + + tmp =kzalloc (DC8051_DATA_MEM_SIZE ,GFP_KERNEL ); +if (!tmp) +return -ENOMEM ; + +/* +* Fill in the requested portion of the temporary buffer from the +* 8051 memory. The 8051 memory read is done in terms of 8 bytes. +* Adjust start and end to fit. Skip reading anything if out of +* range. +*/ + start = *ppos & ~0x7 ;/* round down */ +if (start <DC8051_DATA_MEM_SIZE ) { + end = (*ppos + count +7 ) & ~0x7 ;/* round up */ +if (end >DC8051_DATA_MEM_SIZE ) + end =DC8051_DATA_MEM_SIZE ; + rval =read_8051_data (ppd->dd, start, end - start, + (u64 *)(tmp + start)); +if (rval) + goto done; + } + + rval =simple_read_from_buffer (buf, count, ppos, tmp, +DC8051_DATA_MEM_SIZE ); +done: +kfree (tmp); +return rval; +} + +static ssize_t debugfs_lcb_read (struct file *file,char __user *buf, +size_t count,loff_t *ppos) +{ +struct hfi1_pportdata *ppd =private2ppd (file); +struct hfi1_devdata *dd = ppd->dd; +unsigned long total, csr_off; +u64 data; + +if (*ppos <0 ) +return -EINVAL ; +/* only read 8 byte quantities */ +if ((count %8 ) !=0 ) +return -EINVAL ; +/* offset must be 8-byte aligned */ +if ((*ppos %8 ) !=0 ) +return -EINVAL ; +/* do nothing if out of range or zero count */ +if (*ppos >= (LCB_END -LCB_START ) || !count) +return 0 ; +/* reduce count if needed */ +if (*ppos + count >LCB_END -LCB_START ) + count = (LCB_END -LCB_START ) - *ppos; + + csr_off =LCB_START + *ppos; +for (total =0 ; total < count; total +=8 , csr_off +=8 ) { +if (read_lcb_csr (dd, csr_off, (u64 *)&data)) +break ;/* failed */ +if (put_user (data, (unsigned long __user *)(buf + total))) +break ; + } + *ppos += total; +return total; +} + +static ssize_t debugfs_lcb_write (struct file *file,const char __user *buf, +size_t count,loff_t *ppos) +{ +struct hfi1_pportdata *ppd =private2ppd (file); +struct hfi1_devdata *dd = ppd->dd; +unsigned long total, csr_off, data; + +if (*ppos <0 ) +return -EINVAL ; +/* only write 8 byte quantities */ +if ((count %8 ) !=0 ) +return -EINVAL ; +/* offset must be 8-byte aligned */ +if ((*ppos %8 ) !=0 ) +return -EINVAL ; +/* do nothing if out of range or zero count */ +if (*ppos >= (LCB_END -LCB_START ) || !count) +return 0 ; +/* reduce count if needed */ +if (*ppos + count >LCB_END -LCB_START ) + count = (LCB_END -LCB_START ) - *ppos; + + csr_off =LCB_START + *ppos; +for (total =0 ; total < count; total +=8 , csr_off +=8 ) { +if (get_user (data, (unsigned long __user *)(buf + total))) +break ; +if (write_lcb_csr (dd, csr_off, data)) +break ;/* failed */ + } + *ppos += total; +return total; +} +/* * read the per-port QSFP data for ppd */
@@ -931,6 +1039,8 @@ static int qsfp2_debugfs_release(struct inode *in, struct file *fp)DEBUGFS_XOPS ("qsfp2" , qsfp2_debugfs_read, qsfp2_debugfs_write, qsfp2_debugfs_open, qsfp2_debugfs_release),DEBUGFS_OPS ("asic_flags" , asic_flags_read, asic_flags_write), +DEBUGFS_OPS ("dc8051_memory" , dc8051_memory_read,NULL ), + DEBUGFS_OPS("lcb", debugfs_lcb_read, debugfs_lcb_write), };static void *_sdma_cpu_list_seq_start (struct seq_file *s,loff_t *pos)
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/23 IB/hfi1: Disable header suppression for short packets
In reply to a message not in the archiveFrom: Jakub Pawlak <[email protected]>
For the received packets with payload less or equal 8DWS RxDmaDataFifoRdUncErr is not reported. There is set RHF.EccErr if the header is not suppressed. When such packet is detected on the send side the header suppression mechanism is disabled by clearing SH bit in the packet header.
--- drivers/infiniband/hw/hfi1/user_sdma.c | 60 +++++++++++++++++++++++--------- include/uapi/rdma/hfi/hfi1_user.h | 2 + 2 files changed, 44 insertions(+), 18 deletions(-)
drivers/infiniband/hw/hfi1/user_sdma.c +43 -17
@@ -115,6 +115,7 @@#define KDETH_HCRC_LOWER_MASK 0xff#define AHG_KDETH_INTR_SHIFT 12 +#define AHG_KDETH_SH_SHIFT 13#define PBC2LRH (x) ((((x) & 0xfff) << 2) - 4)#define LRH2PBC (x) ((((x) >> 2) + 1) & 0xfff)
@@ -144,8 +145,9 @@#define KDETH_OM_LARGE 64#define KDETH_OM_MAX_SIZE (1 << ((KDETH_OM_LARGE / KDETH_OM_SMALL) + 1)) -/* Last packet in the request */ -#define TXREQ_FLAGS_REQ_LAST_PKT BIT(0) +/* Tx request flag bits */ +#define TXREQ_FLAGS_REQ_ACK BIT(0)/* Set the ACK bit in the header */ +#define TXREQ_FLAGS_REQ_DISABLE_SH BIT(1)/* Disable header suppression */ /* SDMA request flag bits */ #define SDMA_REQ_FOR_THREAD 1
@@ -943,8 +945,13 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) tx->busycount =0 ;INIT_LIST_HEAD (&tx->list); +/* +* For the last packet set the ACK request +* and disable header suppression. +*/ if (req->seqnum == req->info.npkts -1 ) - tx->flags |=TXREQ_FLAGS_REQ_LAST_PKT ; + tx->flags |= (TXREQ_FLAGS_REQ_ACK | +TXREQ_FLAGS_REQ_DISABLE_SH );/* * Calculate the payload size - this is min of the fragment
@@ -963,11 +970,22 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) } datalen =compute_data_length (req, tx); + +/* +* Disable header suppression for the payload <= 8DWS. +* If there is an uncorrectable error in the receive +* data FIFO when the received payload size is less than +* or equal to 8DWS then the RxDmaDataFifoRdUncErr is +* not reported.There is set RHF.EccErr if the header +* is not suppressed. +*/ if (!datalen) {SDMA_DBG (req,"Request has data but pkt len is 0" ); ret = -EFAULT ; goto free_tx; + }else if (datalen <=32 ) { + tx->flags |=TXREQ_FLAGS_REQ_DISABLE_SH ; } }
@@ -990,6 +1008,10 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)LRH2PBC (lrhlen); tx->hdr.pbc[0 ] =cpu_to_le16 (pbclen); } + ret =check_header_template (req, &tx->hdr, + lrhlen, datalen); +if (ret) + goto free_tx; ret = sdma_txinit_ahg(&tx->txreq, SDMA_TXREQ_F_AHG_COPY, sizeof(tx->hdr) + datalen,
@@ -1351,7 +1373,7 @@ static int set_txreq_header(struct user_sdma_request *req, req->seqnum));/* Set ACK request on last packet */ -if (unlikely (tx->flags &TXREQ_FLAGS_REQ_LAST_PKT )) +if (unlikely (tx->flags &TXREQ_FLAGS_REQ_ACK )) hdr->bth[2 ] |=cpu_to_be32 (1UL <<31 );/* Set the new offset */
@@ -1384,8 +1406,8 @@ static int set_txreq_header(struct user_sdma_request *req,/* Set KDETH.TID based on value for this TID */ KDETH_SET (hdr->kdeth.ver_tid_offset,TID ,EXP_TID_GET (tidval,IDX )); -/* Clear KDETH.SH only on the last packet */ -if (unlikely (tx->flags &TXREQ_FLAGS_REQ_LAST_PKT )) +/* Clear KDETH.SH when DISABLE_SH flag is set */ +if (unlikely (tx->flags &TXREQ_FLAGS_REQ_DISABLE_SH ))KDETH_SET (hdr->kdeth.ver_tid_offset,SH ,0 );/* * Set the KDETH.OFFSET and KDETH.OM based on size of
@@ -1429,7 +1451,7 @@ static int set_txreq_header_ahg(struct user_sdma_request *req,/* BTH.PSN and BTH.A */ val32 = (be32_to_cpu (hdr->bth[2 ]) + req->seqnum) & (HFI1_CAP_IS_KSET (EXTENDED_PSN ) ?0x7fffffff :0xffffff ); -if (unlikely (tx->flags &TXREQ_FLAGS_REQ_LAST_PKT )) +if (unlikely (tx->flags &TXREQ_FLAGS_REQ_ACK )) val32 |=1UL <<31 ;AHG_HEADER_SET (req->ahg, diff,6 ,0 ,16 ,cpu_to_be16 (val32 >>16 ));AHG_HEADER_SET (req->ahg, diff,6 ,16 ,16 ,cpu_to_be16 (val32 &0xffff ));
@@ -1468,19 +1490,23 @@ static int set_txreq_header_ahg(struct user_sdma_request *req,AHG_HEADER_SET (req->ahg, diff,7 ,0 ,16 , ((!!(req->omfactor -KDETH_OM_SMALL )) <<15 | ((req->tidoffset / req->omfactor) &0x7fff ))); -/* KDETH.TIDCtrl, KDETH.TID */ +/* KDETH.TIDCtrl, KDETH.TID, KDETH.Intr, KDETH.SH */ val =cpu_to_le16 (((EXP_TID_GET (tidval,CTRL ) &0x3 ) <<10 ) | - (EXP_TID_GET (tidval,IDX ) &0x3ff )); -/* Clear KDETH.SH on last packet */ -if (unlikely (tx->flags &TXREQ_FLAGS_REQ_LAST_PKT )) { - val |=cpu_to_le16 (KDETH_GET (hdr->kdeth.ver_tid_offset, -INTR ) << -AHG_KDETH_INTR_SHIFT ); - val &=cpu_to_le16 (~(1U <<13 )); -AHG_HEADER_SET (req->ahg, diff,7 ,16 ,14 , val); + (EXP_TID_GET (tidval,IDX ) &0x3ff )); + +if (unlikely (tx->flags &TXREQ_FLAGS_REQ_DISABLE_SH )) { + val |=cpu_to_le16 ((KDETH_GET (hdr->kdeth.ver_tid_offset, +INTR ) << +AHG_KDETH_INTR_SHIFT )); }else { -AHG_HEADER_SET (req->ahg, diff,7 ,16 ,12 , val); + val |=KDETH_GET (hdr->kdeth.ver_tid_offset,SH ) ? +cpu_to_le16 (0x1 <<AHG_KDETH_SH_SHIFT ) : +cpu_to_le16 ((KDETH_GET (hdr->kdeth.ver_tid_offset, +INTR ) << +AHG_KDETH_INTR_SHIFT )); } + +AHG_HEADER_SET (req->ahg, diff,7 ,16 ,14 , val); } trace_hfi1_sdma_user_header_ahg(pq->dd, pq->ctxt, pq->subctxt,
include/uapi/rdma/hfi/hfi1_user.h +1 -1
@@ -75,7 +75,7 @@* may not be implemented; the user code must deal with this if it * cares, or it must abort after initialization reports the difference. */ -#define HFI1_USER_SWMINOR 2 +#define HFI1_USER_SWMINOR 3/* * We will encode the major/minor inside a single 32bit version number.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/23 IB/rdmavt: Fix trace hierarchy
In reply to a message not in the archiveSplit rdmavt traces into separate files to preserve the original hierarchy since only one trace sub system may now be defined per header file.
--- drivers/infiniband/sw/rdmavt/trace.h | 140 +----------------------------- drivers/infiniband/sw/rdmavt/trace_qp.h | 96 +++++++++++++++++++++ drivers/infiniband/sw/rdmavt/trace_rvt.h | 81 +++++++++++++++++ drivers/infiniband/sw/rdmavt/trace_tx.h | 132 ++++++++++++++++++++++++++++ 4 files changed, 312 insertions(+), 137 deletions(-) create mode 100644 drivers/infiniband/sw/rdmavt/trace_qp.h create mode 100644 drivers/infiniband/sw/rdmavt/trace_rvt.h create mode 100644 drivers/infiniband/sw/rdmavt/trace_tx.h
drivers/infiniband/sw/rdmavt/trace.h +3 -137
@@ -45,143 +45,9 @@* */ -#undef TRACE_SYSTEM_VAR -#define TRACE_SYSTEM_VAR rdmavt - -#if !defined(__RDMAVT_TRACE_H) || defined(TRACE_HEADER_MULTI_READ ) -#define __RDMAVT_TRACE_H - -#include <linux/tracepoint.h> -#include <linux/trace_seq.h> - -#include <rdma/ib_verbs.h> -#include <rdma/rdma_vt.h> -#define RDI_DEV_ENTRY (rdi) __string(dev, rdi->driver_f.get_card_name(rdi))#define RDI_DEV_ASSIGN (rdi) __assign_str(dev, rdi->driver_f.get_card_name(rdi)) -#undef TRACE_SYSTEM -#define TRACE_SYSTEM rdmavt - -TRACE_EVENT (rvt_dbg, - TP_PROTO(struct rvt_dev_info *rdi, - const char *msg), -TP_ARGS (rdi, msg), -TP_STRUCT__entry ( - RDI_DEV_ENTRY(rdi) -__string (msg, msg) - ), -TP_fast_assign ( - RDI_DEV_ASSIGN(rdi); - __assign_str(msg, msg); - ), -TP_printk ("[%s]: %s" ,__get_str (dev),__get_str (msg)) -); - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM rvt_qphash -DECLARE_EVENT_CLASS (rvt_qphash_template, - TP_PROTO(struct rvt_qp *qp, u32 bucket), -TP_ARGS (qp, bucket), -TP_STRUCT__entry ( - RDI_DEV_ENTRY(ib_to_rvt(qp->ibqp.device)) - __field(u32, qpn) -__field (u32, bucket) - ), -TP_fast_assign ( -RDI_DEV_ASSIGN (ib_to_rvt (qp->ibqp.device)) - __entry->qpn = qp->ibqp.qp_num; - __entry->bucket = bucket; - ), -TP_printk ( -"[%s] qpn 0x%x bucket %u" , -__get_str (dev), - __entry->qpn, - __entry->bucket - ) -); - -DEFINE_EVENT (rvt_qphash_template, rvt_qpinsert, - TP_PROTO(struct rvt_qp *qp, u32 bucket), -TP_ARGS (qp, bucket)); - -DEFINE_EVENT (rvt_qphash_template, rvt_qpremove, - TP_PROTO(struct rvt_qp *qp, u32 bucket), -TP_ARGS (qp, bucket)); - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM rvt_tx - -#define wr_opcode_name (opcode) { IB_WR_##opcode, #opcode } -#define show_wr_opcode (opcode) \ -__print_symbolic(opcode, \ - wr_opcode_name(RDMA_WRITE), \ - wr_opcode_name(RDMA_WRITE_WITH_IMM), \ - wr_opcode_name(SEND), \ - wr_opcode_name(SEND_WITH_IMM), \ - wr_opcode_name(RDMA_READ), \ - wr_opcode_name(ATOMIC_CMP_AND_SWP), \ - wr_opcode_name(ATOMIC_FETCH_AND_ADD), \ - wr_opcode_name(LSO), \ - wr_opcode_name(SEND_WITH_INV), \ - wr_opcode_name(RDMA_READ_WITH_INV), \ - wr_opcode_name(LOCAL_INV), \ - wr_opcode_name(MASKED_ATOMIC_CMP_AND_SWP), \ - wr_opcode_name(MASKED_ATOMIC_FETCH_AND_ADD)) - -#define POS_PRN \ -"[%s] wr_id %llx qpn %x psn 0x%x lpsn 0x%x length %u opcode 0x%.2x,%s size %u avail %u head %u last %u" - -TRACE_EVENT ( - rvt_post_one_wr, - TP_PROTO(struct rvt_qp *qp, struct rvt_swqe *wqe), -TP_ARGS (qp, wqe), -TP_STRUCT__entry ( - RDI_DEV_ENTRY(ib_to_rvt(qp->ibqp.device)) - __field(u64, wr_id) - __field(u32, qpn) - __field(u32, psn) - __field(u32, lpsn) - __field(u32, length) - __field(u32, opcode) - __field(u32, size) - __field(u32, avail) - __field(u32, head) -__field (u32, last) - ), -TP_fast_assign ( -RDI_DEV_ASSIGN (ib_to_rvt (qp->ibqp.device)) - __entry->wr_id = wqe->wr.wr_id; - __entry->qpn = qp->ibqp.qp_num; - __entry->psn = wqe->psn; - __entry->lpsn = wqe->lpsn; - __entry->length = wqe->length; - __entry->opcode = wqe->wr.opcode; - __entry->size = qp->s_size; - __entry->avail = qp->s_avail; - __entry->head = qp->s_head; - __entry->last = qp->s_last; - ), -TP_printk ( -POS_PRN , -__get_str (dev), - __entry->wr_id, - __entry->qpn, - __entry->psn, - __entry->lpsn, - __entry->length, - __entry->opcode,show_wr_opcode (__entry->opcode), - __entry->size, - __entry->avail, - __entry->head, - __entry->last - ) -); - -#endif /* __RDMAVT_TRACE_H */ - -#undef TRACE_INCLUDE_PATH -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_PATH . -#define TRACE_INCLUDE_FILE trace -#include <trace/define_trace.h> +#include "trace_rvt.h" +#include "trace_qp.h" +#include "trace_tx.h"
drivers/infiniband/sw/rdmavt/trace_qp.h new file +96 -0
96 lines not on this page · raw message
drivers/infiniband/sw/rdmavt/trace_rvt.h new file +81 -0
81 lines not on this page · raw message
drivers/infiniband/sw/rdmavt/trace_tx.h new file +132 -0
132 lines not on this page · raw message
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/23 IB/hfi1: Show statistics counters under IB stats interface
In reply to a message not in the archiveFrom: Jianxin Xiong <[email protected]>
Previously tools like hfi1stats had to access these counters through debugfs, which often caused permission issue for non-root users. It is not always acceptable to change the debugfs mounting permission due to security concerns. When exposed under the IB stats interface, the counters are universally readable by default.
--- drivers/infiniband/hw/hfi1/verbs.c | 154 ++++++++++++++++++++++++++++++++++++ 1 files changed, 154 insertions(+), 0 deletions(-)
drivers/infiniband/hw/hfi1/verbs.c +154 -0
@@ -1609,6 +1609,154 @@ static void hfi1_get_dev_fw_str(struct ib_device *ibdev, char *str, dc8051_ver_min(ver)); } +static const char *const driver_cntr_names[] = { +/* must be element 0*/ +"DRIVER_KernIntr" , +"DRIVER_ErrorIntr" , +"DRIVER_Tx_Errs" , +"DRIVER_Rcv_Errs" , +"DRIVER_HW_Errs" , +"DRIVER_NoPIOBufs" , +"DRIVER_CtxtsOpen" , +"DRIVER_RcvLen_Errs" , +"DRIVER_EgrBufFull" , +"DRIVER_EgrHdrFull" +}; + +static const char **dev_cntr_names; +static const char **port_cntr_names; +static int num_driver_cntrs =ARRAY_SIZE (driver_cntr_names); +static int num_dev_cntrs; +static int num_port_cntrs; +static int cntr_names_initialized; + +/* +* Convert a list of names separated by '\n' into an array of NULL terminated +* strings. Optionally some entries can be reserved in the array to hold extra +* external strings. +*/ +static int init_cntr_names (const char *names_in, +const int names_len, +int num_extra_names, +int *num_cntrs, +const char ***cntr_names) +{ +char *names_out, *p, **q; +int i, n; + + n =0 ; +for (i =0 ; i < names_len; i++) +if (names_in[i] =='\n' ) + n++; + + names_out =kmalloc ((n + num_extra_names) *sizeof (char *) + names_len, +GFP_KERNEL ); +if (!names_out) { + *num_cntrs =0 ; + *cntr_names =NULL ; +return -ENOMEM ; + } + + p = names_out + (n + num_extra_names) *sizeof (char *); +memcpy (p, names_in, names_len); + + q = (char **)names_out; +for (i =0 ; i < n; i++) { + q[i] = p; + p =strchr (p,'\n' ); + *p++ ='\0' ; + } + + *num_cntrs = n; + *cntr_names = (const char **)names_out; +return 0 ; +} + +static struct rdma_hw_stats *alloc_hw_stats (struct ib_device *ibdev, +u8 port_num) +{ +int i, err; + +if (!cntr_names_initialized) { +struct hfi1_devdata *dd =dd_from_ibdev (ibdev); + + err =init_cntr_names (dd->cntrnames, + dd->cntrnameslen, + num_driver_cntrs, + &num_dev_cntrs, + &dev_cntr_names); +if (err) +return NULL ; + +for (i =0 ; i < num_driver_cntrs; i++) + dev_cntr_names[num_dev_cntrs + i] = + driver_cntr_names[i]; + + err =init_cntr_names (dd->portcntrnames, + dd->portcntrnameslen, +0 , + &num_port_cntrs, + &port_cntr_names); +if (err) { +kfree (dev_cntr_names); + dev_cntr_names =NULL ; +return NULL ; + } + cntr_names_initialized =1 ; + } + +if (!port_num) +return rdma_alloc_hw_stats_struct ( + dev_cntr_names, + num_dev_cntrs + num_driver_cntrs, +RDMA_HW_STATS_DEFAULT_LIFESPAN ); +else +return rdma_alloc_hw_stats_struct ( + port_cntr_names, + num_port_cntrs, +RDMA_HW_STATS_DEFAULT_LIFESPAN ); +} + +static u64 hfi1_sps_ints (void ) +{ +unsigned long flags; +struct hfi1_devdata *dd; +u64 sps_ints =0 ; + +spin_lock_irqsave (&hfi1_devs_lock, flags); +list_for_each_entry (dd, &hfi1_dev_list, list) { + sps_ints +=get_all_cpu_total (dd->int_counter); + } +spin_unlock_irqrestore (&hfi1_devs_lock, flags); +return sps_ints; +} + +static int get_hw_stats (struct ib_device *ibdev,struct rdma_hw_stats *stats, +u8 port,int index) +{ +u64 *values; +int count; + +if (!port) { +u64 *stats = (u64 *)&hfi1_stats; +int i; + +hfi1_read_cntrs (dd_from_ibdev (ibdev),NULL , &values); + values[num_dev_cntrs] =hfi1_sps_ints (); +for (i =1 ; i < num_driver_cntrs; i++) + values[num_dev_cntrs + i] = stats[i]; + count = num_dev_cntrs + num_driver_cntrs; + }else { +struct hfi1_ibport *ibp =to_iport (ibdev, port); + +hfi1_read_portcntrs (ppd_from_ibp (ibp),NULL , &values); + count = num_port_cntrs; + } + +memcpy (stats->value, values, count *sizeof (u64)); +return count; +} +/** * hfi1_register_ib_device - register our device with the infiniband core * @dd: the device data structure
@@ -1656,6 +1804,8 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->phys_port_cnt = dd->num_pports; ibdev->dma_device = &dd->pcidev->dev; ibdev->modify_device = modify_device; + ibdev->alloc_hw_stats = alloc_hw_stats; + ibdev->get_hw_stats = get_hw_stats;/* keep process mad in the driver */ ibdev->process_mad = hfi1_process_mad;
@@ -1770,6 +1920,10 @@ void hfi1_unregister_ib_device(struct hfi1_devdata *dd)del_timer_sync (&dev->mem_timer);verbs_txreq_exit (dev); + +kfree (dev_cntr_names); +kfree (port_cntr_names); + cntr_names_initialized =0 ; }void hfi1_cnp_rcv (struct hfi1_packet *packet)
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/23 IB/hfi1: Remove dependence on qp->s_cur_size
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
The qp->s_cur_size field assumes that the S_BUSY bit protects the field from modification after the slock is dropped. Scaling the send engine to multiple cores would break that assumption.
Correct the issue by carrying the payload size in the txreq structure.
--- drivers/infiniband/hw/hfi1/rc.c | 4 ++-- drivers/infiniband/hw/hfi1/ruc.c | 4 ++-- drivers/infiniband/hw/hfi1/uc.c | 2 +- drivers/infiniband/hw/hfi1/ud.c | 2 +- drivers/infiniband/hw/hfi1/verbs.c | 6 +++--- drivers/infiniband/hw/hfi1/verbs_txreq.h | 1 + 6 files changed, 10 insertions(+), 9 deletions(-)
drivers/infiniband/hw/hfi1/rc.c +2 -2
@@ -351,7 +351,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp, qp->s_rdma_ack_cnt++; qp->s_hdrwords = hwords; ps->s_txreq->sde = priv->s_sde; - qp->s_cur_size = len; + ps->s_txreq->s_cur_size = len;hfi1_make_ruc_header (qp, ohdr, bth0, bth2, middle, ps);/* pbc */ ps->s_txreq->hdr_dwords = qp->s_hdrwords +2 ;
@@ -802,7 +802,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) qp->s_hdrwords = hwords; ps->s_txreq->sde = priv->s_sde; qp->s_cur_sge = ss; - qp->s_cur_size = len; + ps->s_txreq->s_cur_size = len; hfi1_make_ruc_header( qp, ohdr,
drivers/infiniband/hw/hfi1/ruc.c +2 -2
@@ -767,8 +767,8 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr,u32 bth1;/* Construct the header. */ - extra_bytes = -qp->s_cur_size &3 ; - nwords = (qp->s_cur_size + extra_bytes) >>2 ; + extra_bytes = -ps->s_txreq->s_cur_size &3 ; + nwords = (ps->s_txreq->s_cur_size + extra_bytes) >>2 ; lrh0 =HFI1_LRH_BTH ;if (unlikely (qp->remote_ah_attr.ah_flags &IB_AH_GRH )) { qp->s_hdrwords += hfi1_make_grh(ibp,
drivers/infiniband/hw/hfi1/uc.c +1 -1
@@ -259,7 +259,7 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) qp->s_hdrwords = hwords; ps->s_txreq->sde = priv->s_sde; qp->s_cur_sge = &qp->s_sge; - qp->s_cur_size = len; + ps->s_txreq->s_cur_size = len;hfi1_make_ruc_header (qp, ohdr, bth0 | (qp->s_state <<24 ),mask_psn (qp->s_psn++), middle, ps);/* pbc */
drivers/infiniband/hw/hfi1/ud.c +1 -1
@@ -354,7 +354,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)/* header size in 32-bit words LRH+BTH+DETH = (8+12+8)/4. */ qp->s_hdrwords =7 ; - qp->s_cur_size = wqe->length; + ps->s_txreq->s_cur_size = wqe->length; qp->s_cur_sge = &qp->s_sge; qp->s_srate = ah_attr->static_rate; qp->srate_mbps =ib_rate_to_mbps (qp->s_srate);
drivers/infiniband/hw/hfi1/verbs.c +3 -3
@@ -895,7 +895,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps,struct hfi1_ahg_info *ahg_info = priv->s_ahg;u32 hdrwords = qp->s_hdrwords;struct rvt_sge_state *ss = qp->s_cur_sge; -u32 len = qp->s_cur_size; +u32 len = ps->s_txreq->s_cur_size;u32 plen = hdrwords + ((len +3 ) >>2 ) +2 ;/* includes pbc */ struct hfi1_ibdev *dev = ps->dev;struct hfi1_pportdata *ppd = ps->ppd;
@@ -1012,7 +1012,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,struct hfi1_qp_priv *priv = qp->priv;u32 hdrwords = qp->s_hdrwords;struct rvt_sge_state *ss = qp->s_cur_sge; -u32 len = qp->s_cur_size; +u32 len = ps->s_txreq->s_cur_size;u32 dwords = (len +3 ) >>2 ;u32 plen = hdrwords + dwords +2 ;/* includes pbc */ struct hfi1_pportdata *ppd = ps->ppd;
@@ -1240,7 +1240,7 @@ static inline send_routine get_send_routine(struct rvt_qp *qp,u8 op =get_opcode (h);if (piothreshold && - qp->s_cur_size <=min (piothreshold, qp->pmtu) && + tx->s_cur_size <=min (piothreshold, qp->pmtu) && (BIT (op &OPMASK ) & pio_opmask[op >>5 ]) &&iowait_sdma_pending (&priv->s_iowait) ==0 && !sdma_txreq_built (&tx->txreq))
drivers/infiniband/hw/hfi1/verbs_txreq.h +1 -0
@@ -65,6 +65,7 @@ struct verbs_txreq {struct sdma_engine *sde;struct send_context *psc;u16 hdr_dwords; +u16 s_cur_size; };struct hfi1_ibdev ;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/23 IB/hfi1: Remove definition of unused hfi1_affinity struct
In reply to a message not in the archiveFrom: Tadeusz Struk <[email protected]>
The struct hfi1_affinity is not used anymore.
We use the struct hfi1_affinity_node and hfi1_affinity_node_list instead.
--- drivers/infiniband/hw/hfi1/affinity.h | 8 -------- drivers/infiniband/hw/hfi1/hfi.h | 1 - 2 files changed, 0 insertions(+), 9 deletions(-)
drivers/infiniband/hw/hfi1/affinity.h +0 -8
@@ -70,14 +70,6 @@ struct cpu_mask_set {uint gen; }; -struct hfi1_affinity { -struct cpu_mask_set def_intr; -struct cpu_mask_set rcv_intr; -struct cpumask real_cpu_mask; -/* spin lock to protect affinity struct */ -spinlock_t lock; -}; -struct hfi1_msix_entry ;/* Initialize non-HT cpu cores mask */
drivers/infiniband/hw/hfi1/hfi.h +0 -1
@@ -1162,7 +1162,6 @@ struct hfi1_devdata {atomic_t aspm_disabled_cnt;/* Keeps track of user space clients */ atomic_t user_refcount; -struct hfi1_affinity *affinity;/* Used to wait for outstanding user space clients before dev removal */ struct completion user_comp;bool eprom_available;/* true if EPROM is available for this device */
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/23 IB/hfi1: Add special setting for low power AOC
In reply to a message not in the archiveFrom: Dean Luick <[email protected]>
Low power QSFP AOC cables require a different SerDes Tx PLL bandwidth setting than the default. The 8051 firmware does not know the details, so the driver needs to tell the firmware through a special setting.
--- drivers/infiniband/hw/hfi1/platform.c | 44 ++++++++++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/platform.c +43 -1
@@ -637,6 +637,38 @@ static void apply_tx_lanes(struct hfi1_pportdata *ppd, u8 field_id, } } +/* +* Return a special SerDes setting for low power AOC cables. The power class +* threshold and setting being used were all found by empirical testing. +* +* Summary of the logic: +* +* if (QSFP and QSFP_TYPE == AOC and QSFP_POWER_CLASS < 4) +* return 0xe +* return 0; // leave at default +*/ +static u8 aoc_low_power_setting (struct hfi1_pportdata *ppd) +{ +u8 *cache = ppd->qsfp_info.cache; +int power_class; + +/* QSFP only */ +if (ppd->port_type !=PORT_TYPE_QSFP ) +return 0 ;/* leave at default */ + +/* active optical cables only */ +switch ((cache[QSFP_MOD_TECH_OFFS ] &0xF0 ) >>4 ) { + case 0x0 ... 0x9: /* fallthrough */ +case 0xC :/* fallthrough */ +case 0xE : +/* active AOC */ + power_class =get_qsfp_power_class (cache[QSFP_MOD_PWR_OFFS ]); +if (power_class <QSFP_POWER_CLASS_4 ) +return 0xe ; + } +return 0 ;/* leave at default */ +} +static void apply_tunings (struct hfi1_pportdata *ppd,u32 tx_preset_index,u8 tuning_method,u32 total_atten,u8 limiting_active)
@@ -705,7 +737,17 @@ static void apply_tunings( tx_preset_index, TX_PRESET_TABLE_POSTCUR, &tx_preset, 4); postcur = tx_preset; - config_data = precur | (attn <<8 ) | (postcur <<16 ); +/* +* NOTES: +* o The aoc_low_power_setting is applied to all lanes even +* though only lane 0's value is examined by the firmware. +* o A lingering low power setting after a cable swap does +* not occur. On cable unplug the 8051 is reset and +* restarted on cable insert. This resets all settings to +* their default, erasing any previous low power setting. +*/ + config_data = precur | (attn <<8 ) | (postcur <<16 ) | + (aoc_low_power_setting (ppd) <<24 );apply_tx_lanes (ppd,TX_EQ_SETTINGS , config_data,"Applying TX settings" );
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 11/23 IB/rdmavt: Add trace of MR segs
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
Add tracing of MR segment information.
--- drivers/infiniband/sw/rdmavt/mr.c | 4 + drivers/infiniband/sw/rdmavt/trace.h | 1 drivers/infiniband/sw/rdmavt/trace_mr.h | 112 +++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 0 deletions(-) create mode 100644 drivers/infiniband/sw/rdmavt/trace_mr.h
drivers/infiniband/sw/rdmavt/mr.c +4 -0
@@ -51,6 +51,7 @@#include <rdma/rdma_vt.h> #include "vt.h" #include "mr.h" +#include "trace.h" /** * rvt_driver_mr_init - Init MR resources per driver
@@ -403,6 +404,7 @@ struct ib_mr *rvt_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, } mr->mr.map[m]->segs[n].vaddr = vaddr; mr->mr.map[m]->segs[n].length = umem->page_size; +trace_rvt_mr_user_seg (&mr->mr, m, n, vaddr, umem->page_size); n++;if (n ==RVT_SEGSZ ) { m++;
@@ -507,6 +509,7 @@ static int rvt_set_page(struct ib_mr *ibmr, u64 addr) n = mapped_segs %RVT_SEGSZ ; mr->mr.map[m]->segs[n].vaddr = (void *)addr; mr->mr.map[m]->segs[n].length = ps; +trace_rvt_mr_page_seg (&mr->mr, m, n, (void *)addr, ps); mr->mr.length += ps;return 0 ;
@@ -693,6 +696,7 @@ int rvt_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,for (i =0 ; i < list_len; i++) { fmr->mr.map[m]->segs[n].vaddr = (void *)page_list[i]; fmr->mr.map[m]->segs[n].length = ps; +trace_rvt_mr_fmr_seg (&fmr->mr, m, n, (void *)page_list[i], ps);if (++n ==RVT_SEGSZ ) { m++; n =0 ;
drivers/infiniband/sw/rdmavt/trace.h +1 -0
@@ -51,3 +51,4 @@#include "trace_rvt.h" #include "trace_qp.h" #include "trace_tx.h" +#include "trace_mr.h"
drivers/infiniband/sw/rdmavt/trace_mr.h new file +112 -0
112 lines not on this page · raw message
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 12/23 IB/hfi1: Remove usage of qp->s_cur_sge
In reply to a message not in the archiveFrom: Mitko Haralanov <[email protected]>
The s_cur_sge field in the qp structure holds a pointer to the SGE of the currently processed WQE. It assumes the protection of the RVT_S_BUSY flag to prevent the changing of this field while the send engine is using it. This scheme works as long as there is only one instance of the send engine running at a time.
Scaling of the send engine to multiple cores would break this assumption as there could be multiple instances of the send engine running on different CPUs. This opens a window where the QP's RVT_S_BUSY flag is not set but the send engine is still running.
To prevent accidental changing of the s_cur_sge pointer, the QP's dependence on it is removed. The SGE pointer is now stored in the verbs_txreq, which is a per-packet data structure. This ensures that each individual packet has it's own pointer, which is setup while the RVT_S_BUSY flag is set.
--- drivers/infiniband/hw/hfi1/rc.c | 10 +++++----- drivers/infiniband/hw/hfi1/uc.c | 2 +- drivers/infiniband/hw/hfi1/ud.c | 2 +- drivers/infiniband/hw/hfi1/verbs.c | 14 ++++++-------- 4 files changed, 13 insertions(+), 15 deletions(-)
drivers/infiniband/hw/hfi1/rc.c +5 -5
@@ -276,7 +276,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp,rvt_get_mr (ps->s_txreq->mr); qp->s_ack_rdma_sge.sge = e->rdma_sge; qp->s_ack_rdma_sge.num_sge =1 ; - qp->s_cur_sge = &qp->s_ack_rdma_sge; + ps->s_txreq->ss = &qp->s_ack_rdma_sge;if (len > pmtu) { len = pmtu; qp->s_ack_state =OP (RDMA_READ_RESPONSE_FIRST );
@@ -290,7 +290,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp, bth2 =mask_psn (qp->s_ack_rdma_psn++); }else {/* COMPARE_SWAP or FETCH_ADD */ - qp->s_cur_sge =NULL ; + ps->s_txreq->ss =NULL ; len =0 ; qp->s_ack_state =OP (ATOMIC_ACKNOWLEDGE ); ohdr->u.at.aeth =hfi1_compute_aeth (qp);
@@ -306,7 +306,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp, qp->s_ack_state =OP (RDMA_READ_RESPONSE_MIDDLE );/* FALLTHROUGH */ case OP (RDMA_READ_RESPONSE_MIDDLE ): - qp->s_cur_sge = &qp->s_ack_rdma_sge; + ps->s_txreq->ss = &qp->s_ack_rdma_sge; ps->s_txreq->mr = qp->s_ack_rdma_sge.sge.mr;if (ps->s_txreq->mr)rvt_get_mr (ps->s_txreq->mr);
@@ -335,7 +335,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp,*/ qp->s_ack_state =OP (SEND_ONLY ); qp->s_flags &= ~RVT_S_ACK_PENDING ; - qp->s_cur_sge =NULL ; + ps->s_txreq->ss =NULL ;if (qp->s_nak_state) ohdr->u.aeth = cpu_to_be32((qp->r_msn & HFI1_MSN_MASK) |
@@ -801,7 +801,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) qp->s_len -= len; qp->s_hdrwords = hwords; ps->s_txreq->sde = priv->s_sde; - qp->s_cur_sge = ss; + ps->s_txreq->ss = ss; ps->s_txreq->s_cur_size = len; hfi1_make_ruc_header( qp,
drivers/infiniband/hw/hfi1/uc.c +1 -1
@@ -258,7 +258,7 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) qp->s_len -= len; qp->s_hdrwords = hwords; ps->s_txreq->sde = priv->s_sde; - qp->s_cur_sge = &qp->s_sge; + ps->s_txreq->ss = &qp->s_sge; ps->s_txreq->s_cur_size = len;hfi1_make_ruc_header (qp, ohdr, bth0 | (qp->s_state <<24 ),mask_psn (qp->s_psn++), middle, ps);
drivers/infiniband/hw/hfi1/ud.c +1 -1
@@ -355,7 +355,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)/* header size in 32-bit words LRH+BTH+DETH = (8+12+8)/4. */ qp->s_hdrwords =7 ; ps->s_txreq->s_cur_size = wqe->length; - qp->s_cur_sge = &qp->s_sge; + ps->s_txreq->ss = &qp->s_sge; qp->s_srate = ah_attr->static_rate; qp->srate_mbps =ib_rate_to_mbps (qp->s_srate); qp->s_wqe = wqe;
drivers/infiniband/hw/hfi1/verbs.c +6 -8
@@ -790,10 +790,10 @@ static int wait_kmem(struct hfi1_ibdev *dev,*/ static noinline int build_verbs_ulp_payload(struct sdma_engine *sde, -struct rvt_sge_state *ss,u32 length,struct verbs_txreq *tx) { +struct rvt_sge_state *ss = tx->ss;struct rvt_sge *sg_list = ss->sg_list;struct rvt_sge sge = ss->sge;u8 num_sge = ss->num_sge;
@@ -837,7 +837,6 @@ static noinline int build_verbs_ulp_payload(/* New API */ static int build_verbs_tx_desc( struct sdma_engine *sde, - struct rvt_sge_state *ss, u32 length, struct verbs_txreq *tx, struct hfi1_ahg_info *ahg_info,
@@ -881,9 +880,9 @@ static int build_verbs_tx_desc( goto bail_txadd; } -/* add the ulp payload - if any. ss can be NULL for acks */ -if (ss) - ret =build_verbs_ulp_payload (sde, ss, length, tx); +/* add the ulp payload - if any. tx->ss can be NULL for acks */ +if (tx->ss) + ret =build_verbs_ulp_payload (sde, length, tx); bail_txadd:return ret; }
@@ -894,7 +893,6 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps,struct hfi1_qp_priv *priv = qp->priv;struct hfi1_ahg_info *ahg_info = priv->s_ahg;u32 hdrwords = qp->s_hdrwords; -struct rvt_sge_state *ss = qp->s_cur_sge;u32 len = ps->s_txreq->s_cur_size;u32 plen = hdrwords + ((len +3 ) >>2 ) +2 ;/* includes pbc */ struct hfi1_ibdev *dev = ps->dev;
@@ -920,7 +918,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps, plen); } tx->wqe = qp->s_wqe; - ret =build_verbs_tx_desc (tx->sde, ss, len, tx, ahg_info, pbc); + ret =build_verbs_tx_desc (tx->sde, len, tx, ahg_info, pbc);if (unlikely (ret)) goto bail_build; }
@@ -1011,7 +1009,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, {struct hfi1_qp_priv *priv = qp->priv;u32 hdrwords = qp->s_hdrwords; -struct rvt_sge_state *ss = qp->s_cur_sge; +struct rvt_sge_state *ss = ps->s_txreq->ss;u32 len = ps->s_txreq->s_cur_size;u32 dwords = (len +3 ) >>2 ;u32 plen = hdrwords + dwords +2 ;/* includes pbc */
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 13/23 IB/hfi1: Remove critical section gap in sc_buffer_alloc()
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
In sc_buffer_alloc(), the sc->alloc_lock is released before calling sc_release_update(), and it is reacquired after the function call. This causes CPU lock trading. Fix it by not dropping the lock before calling sc_release_update().
--- drivers/infiniband/hw/hfi1/pio.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/pio.c +0 -2
@@ -1412,9 +1412,7 @@ struct pio_buf *sc_buffer_alloc(struct send_context *sc, u32 dw_len, (sc->fill - sc->alloc_free);if (blocks > avail) {/* still no room, actively update */ -spin_unlock_irqrestore (&sc->alloc_lock, flags);sc_release_update (sc); -spin_lock_irqsave (&sc->alloc_lock, flags); sc->alloc_free =ACCESS_ONCE (sc->free); trycount++; goto retry;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 14/23 IB/hfi1: Preserve external device completed bit
In reply to a message not in the archiveFrom: Dean Luick <[email protected]>
The driver should not change the external device request completed bit when not actually doing an external device request.
--- drivers/infiniband/hw/hfi1/chip.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +4 -1
@@ -8477,7 +8477,10 @@ static int do_8051_command(*/ if (type ==HCMD_WRITE_LCB_CSR ) { in_data |= ((*out_data) &0xffffffffffull ) <<8 ; - reg = ((((*out_data) >>40 ) &0xff ) << +/* must preserve COMPLETED - it is tied to hardware */ + reg =read_csr (dd,DC_DC8051_CFG_EXT_DEV_0 ); + reg &=DC_DC8051_CFG_EXT_DEV_0_COMPLETED_SMASK ; + reg |= ((((*out_data) >>40 ) &0xff ) <<DC_DC8051_CFG_EXT_DEV_0_RETURN_CODE_SHIFT ) | ((((*out_data) >>48 ) &0xffff ) <<DC_DC8051_CFG_EXT_DEV_0_RSP_DATA_SHIFT );
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 15/23 IB/hfi1: Replace qp->refcount release code with standard driver wrapper
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
Some parts of the code don't use the standard release wrapper rvt_put_qp() for decrementing and testing the refcount to then try to use a resource. Replace this code with the standard driver wrapper.
--- drivers/infiniband/hw/hfi1/driver.c | 3 +-- drivers/infiniband/sw/rdmavt/mcast.c | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +1 -2
@@ -795,8 +795,7 @@ static inline void process_rcv_qp_work(struct hfi1_packet *packet)hfi1_schedule_send (qp);spin_unlock_irqrestore (&qp->s_lock, flags); } -if (atomic_dec_and_test (&qp->refcount)) -wake_up (&qp->wait); +rvt_put_qp (qp); } }
drivers/infiniband/sw/rdmavt/mcast.c +2 -3
@@ -81,7 +81,7 @@ void rvt_driver_mcast_init(struct rvt_dev_info *rdi) goto bail; mqp->qp = qp; -atomic_inc (&qp->refcount); +rvt_get_qp (qp); bail:return mqp;
@@ -92,8 +92,7 @@ static void rvt_mcast_qp_free(struct rvt_mcast_qp *mqp)struct rvt_qp *qp = mqp->qp;/* Notify hfi1_destroy_qp() if it is waiting. */ -if (atomic_dec_and_test (&qp->refcount)) -wake_up (&qp->wait); +rvt_put_qp (qp);kfree (mqp); }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 16/23 IB/hfi1: Use reference count wrapper for MRs
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
Some parts of the code don't use the standard driver wrapper for memory region reference counters. Use the standard driver wrapper throughout the code.
--- drivers/infiniband/sw/rdmavt/mr.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rdmavt/mr.c +4 -4
@@ -793,7 +793,7 @@ int rvt_lkey_ok(struct rvt_lkey_table *rkt, struct rvt_pd *pd, mr =rcu_dereference (dev->dma_mr);if (!mr) goto bail; -atomic_inc (&mr->refcount); +rvt_get_mr (mr);rcu_read_unlock (); isge->mr = mr;
@@ -814,7 +814,7 @@ int rvt_lkey_ok(struct rvt_lkey_table *rkt, struct rvt_pd *pd, off + sge->length > mr->length || (mr->access_flags & acc) != acc)) goto bail; -atomic_inc (&mr->refcount); +rvt_get_mr (mr);rcu_read_unlock (); off += mr->offset;
@@ -892,7 +892,7 @@ int rvt_rkey_ok(struct rvt_qp *qp, struct rvt_sge *sge, mr =rcu_dereference (rdi->dma_mr);if (!mr) goto bail; -atomic_inc (&mr->refcount); +rvt_get_mr (mr);rcu_read_unlock (); sge->mr = mr;
@@ -913,7 +913,7 @@ int rvt_rkey_ok(struct rvt_qp *qp, struct rvt_sge *sge,if (unlikely (vaddr < mr->iova || off + len > mr->length || (mr->access_flags & acc) ==0 )) goto bail; -atomic_inc (&mr->refcount); +rvt_get_mr (mr);rcu_read_unlock (); off += mr->offset;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 17/23 IB/qib: Use standard refcount wrapper for QPs
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
Use the standard driver wrapper for QP reference counters. This makes the code more maintainable.
--- drivers/infiniband/hw/qib/qib_driver.c | 3 +-- drivers/infiniband/hw/qib/qib_verbs.c | 20 ++++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-)
drivers/infiniband/hw/qib/qib_driver.c +1 -2
@@ -420,8 +420,7 @@ static u32 qib_rcv_hdrerr(struct qib_ctxtdata *rcd, struct qib_pportdata *ppd,if (list_empty (&qp->rspwait)) { qp->r_flags |=RVT_R_RSP_NAK ; -atomic_inc ( - &qp->refcount); +rvt_get_qp (qp);list_add_tail ( &qp->rspwait, &rcd->qp_wait_list);
drivers/infiniband/hw/qib/qib_verbs.c +8 -12
@@ -464,7 +464,7 @@ static void mem_timer(unsigned long data) priv = list_entry(list->next, struct qib_qp_priv, iowait); qp = priv->owner;list_del_init (&priv->iowait); -atomic_inc (&qp->refcount); +rvt_get_qp (qp);if (!list_empty (list))mod_timer (&dev->mem_timer, jiffies +1 ); }
@@ -477,8 +477,7 @@ static void mem_timer(unsigned long data)qib_schedule_send (qp); }spin_unlock_irqrestore (&qp->s_lock, flags); -if (atomic_dec_and_test (&qp->refcount)) -wake_up (&qp->wait); +rvt_put_qp (qp); } }
@@ -762,7 +761,7 @@ void qib_put_txreq(struct qib_verbs_txreq *tx) iowait); qp = priv->owner;list_del_init (&priv->iowait); -atomic_inc (&qp->refcount); +rvt_get_qp (qp);spin_unlock_irqrestore (&dev->rdi.pending_lock, flags);spin_lock_irqsave (&qp->s_lock, flags);
@@ -772,8 +771,7 @@ void qib_put_txreq(struct qib_verbs_txreq *tx) }spin_unlock_irqrestore (&qp->s_lock, flags); -if (atomic_dec_and_test (&qp->refcount)) -wake_up (&qp->wait); +rvt_put_qp (qp); }else spin_unlock_irqrestore (&dev->rdi.pending_lock, flags); }
@@ -808,7 +806,7 @@ void qib_verbs_sdma_desc_avail(struct qib_pportdata *ppd, unsigned avail)break ; avail -= qpp->s_tx->txreq.sg_count;list_del_init (&qpp->iowait); -atomic_inc (&qp->refcount); +rvt_get_qp (qp); qps[n++] = qp; }
@@ -822,8 +820,7 @@ void qib_verbs_sdma_desc_avail(struct qib_pportdata *ppd, unsigned avail)qib_schedule_send (qp); }spin_unlock (&qp->s_lock); -if (atomic_dec_and_test (&qp->refcount)) -wake_up (&qp->wait); +rvt_put_qp (qp); } }
@@ -1288,7 +1285,7 @@ void qib_ib_piobufavail(struct qib_devdata *dd) priv = list_entry(list->next, struct qib_qp_priv, iowait); qp = priv->owner;list_del_init (&priv->iowait); -atomic_inc (&qp->refcount); +rvt_get_qp (qp); qps[n++] = qp; } dd->f_wantpiobuf_intr (dd,0 );
@@ -1306,8 +1303,7 @@ void qib_ib_piobufavail(struct qib_devdata *dd)spin_unlock_irqrestore (&qp->s_lock, flags);/* Notify qib_destroy_qp() if it is waiting. */ -if (atomic_dec_and_test (&qp->refcount)) -wake_up (&qp->wait); +rvt_put_qp (qp); } }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 18/23 IB/rdmavt: Add a send completion helper
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
This is for use by client drivers to drive
send completions into a CQ.
A new exported table allows for the mapping
of ib_wr_opcode into a ib_wc_opcode.
--- drivers/infiniband/sw/rdmavt/qp.c | 17 ++++++++++++++++ include/rdma/rdmavt_qp.h | 40 ++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletions(-)
drivers/infiniband/sw/rdmavt/qp.c +17 -0
@@ -76,6 +76,23 @@ };EXPORT_SYMBOL (ib_rvt_state_ops); +/* +* Translate ib_wr_opcode into ib_wc_opcode. +*/ +const enum ib_wc_opcode ib_rvt_wc_opcode[] = { + [IB_WR_RDMA_WRITE ] =IB_WC_RDMA_WRITE , + [IB_WR_RDMA_WRITE_WITH_IMM ] =IB_WC_RDMA_WRITE , + [IB_WR_SEND ] =IB_WC_SEND , + [IB_WR_SEND_WITH_IMM ] =IB_WC_SEND , + [IB_WR_RDMA_READ ] =IB_WC_RDMA_READ , + [IB_WR_ATOMIC_CMP_AND_SWP ] =IB_WC_COMP_SWAP , + [IB_WR_ATOMIC_FETCH_AND_ADD ] =IB_WC_FETCH_ADD , + [IB_WR_SEND_WITH_INV ] =IB_WC_SEND , + [IB_WR_LOCAL_INV ] =IB_WC_LOCAL_INV , + [IB_WR_REG_MR ] =IB_WC_REG_MR +}; +EXPORT_SYMBOL (ib_rvt_wc_opcode); +static void get_map_page (struct rvt_qpn_table *qpt,struct rvt_qpn_map *map,gfp_t gfp)
include/rdma/rdmavt_qp.h +39 -1
@@ -51,6 +51,7 @@#include <rdma/rdma_vt.h> #include <rdma/ib_pack.h> #include <rdma/ib_verbs.h> +#include <rdma/rdmavt_cq.h> /* * Atomic bit definitions for r_aflags. */
@@ -527,7 +528,44 @@ static inline void rvt_qp_wqe_unreserve( } } -extern const int ib_rvt_state_ops[]; +extern const enum ib_wc_opcode ib_rvt_wc_opcode[]; + +/** +* rvt_qp_swqe_complete() - insert send completion +* @qp - the qp +* @wqe - the send wqe +* @status - completion status +* +* Insert a send completion into the completion +* queue if the qp indicates it should be done. +* +* See IBTA 10.7.3.1 for info on completion +* control. +*/ +static inline void rvt_qp_swqe_complete ( +struct rvt_qp *qp, +struct rvt_swqe *wqe, +enum ib_wc_status status) +{ +if (unlikely (wqe->wr.send_flags &RVT_SEND_RESERVE_USED )) +return ; +if (!(qp->s_flags &RVT_S_SIGNAL_REQ_WR ) || + (wqe->wr.send_flags &IB_SEND_SIGNALED ) || + status !=IB_WC_SUCCESS ) { +struct ib_wc wc; + +memset (&wc,0 ,sizeof (wc)); + wc.wr_id = wqe->wr.wr_id; + wc.status = status; + wc.opcode = ib_rvt_wc_opcode[wqe->wr.opcode]; + wc.qp = &qp->ibqp; + wc.byte_len = wqe->length; +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc, + status !=IB_WC_SUCCESS ); + } +} + +extern const int ib_rvt_state_ops[];struct rvt_dev_info ;int rvt_error_qp (struct rvt_qp *qp,enum ib_wc_status err);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 19/23 IB/hfi1,IB/qib: Use new send completion helper
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
Convert cq completion returns in both rdmavt drivers to use the new helper.
--- drivers/infiniband/hw/hfi1/rc.c | 26 ++------------------------ drivers/infiniband/hw/hfi1/ruc.c | 17 +---------------- drivers/infiniband/hw/hfi1/verbs.c | 16 ---------------- drivers/infiniband/hw/qib/qib_rc.c | 26 ++------------------------ drivers/infiniband/hw/qib/qib_ruc.c | 17 +---------------- drivers/infiniband/hw/qib/qib_verbs.c | 13 ------------- 6 files changed, 6 insertions(+), 109 deletions(-)
drivers/infiniband/hw/hfi1/rc.c +2 -24
@@ -1146,7 +1146,6 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr) {struct ib_other_headers *ohdr;struct rvt_swqe *wqe; -struct ib_wc wc;unsigned i;u32 opcode;u32 psn;
@@ -1200,17 +1199,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr)rvt_put_mr (sge->mr); } -/* Post a send completion queue entry if requested. */ -if (!(qp->s_flags &RVT_S_SIGNAL_REQ_WR ) || - (wqe->wr.send_flags &IB_SEND_SIGNALED )) { -memset (&wc,0 ,sizeof (wc)); - wc.wr_id = wqe->wr.wr_id; - wc.status =IB_WC_SUCCESS ; - wc.opcode = ib_hfi1_wc_opcode[wqe->wr.opcode]; - wc.byte_len = wqe->length; - wc.qp = &qp->ibqp; -rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc,0 ); - } +rvt_qp_swqe_complete (qp, wqe,IB_WC_SUCCESS ); }/* * If we were waiting for sends to complete before re-sending,
@@ -1240,7 +1229,6 @@ static inline void update_last_psn(struct rvt_qp *qp, u32 psn)struct rvt_swqe *wqe, struct hfi1_ibport *ibp) { - struct ib_wc wc; unsigned i;lockdep_assert_held (&qp->s_lock);
@@ -1264,17 +1252,7 @@ static inline void update_last_psn(struct rvt_qp *qp, u32 psn) qp->s_last = s_last;/* see post_send() */ barrier (); -/* Post a send completion queue entry if requested. */ -if (!(qp->s_flags &RVT_S_SIGNAL_REQ_WR ) || - (wqe->wr.send_flags &IB_SEND_SIGNALED )) { -memset (&wc,0 ,sizeof (wc)); - wc.wr_id = wqe->wr.wr_id; - wc.status =IB_WC_SUCCESS ; - wc.opcode = ib_hfi1_wc_opcode[wqe->wr.opcode]; - wc.byte_len = wqe->length; - wc.qp = &qp->ibqp; -rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc,0 ); - } +rvt_qp_swqe_complete (qp, wqe,IB_WC_SUCCESS ); }else {struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);
drivers/infiniband/hw/hfi1/ruc.c +1 -16
@@ -964,22 +964,7 @@ void hfi1_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, qp->ibqp.qp_type == IB_QPT_GSI)atomic_dec (&ibah_to_rvtah (wqe->ud_wr.ah)->refcount); -/* See ch. 11.2.4.1 and 10.7.3.1 */ -if (!(qp->s_flags &RVT_S_SIGNAL_REQ_WR ) || - (wqe->wr.send_flags &IB_SEND_SIGNALED ) || - status !=IB_WC_SUCCESS ) { -struct ib_wc wc; - -memset (&wc,0 ,sizeof (wc)); - wc.wr_id = wqe->wr.wr_id; - wc.status = status; - wc.opcode = ib_hfi1_wc_opcode[wqe->wr.opcode]; - wc.qp = &qp->ibqp; -if (status ==IB_WC_SUCCESS ) - wc.byte_len = wqe->length; -rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc, - status !=IB_WC_SUCCESS ); - } +rvt_qp_swqe_complete (qp, wqe, status);if (qp->s_acked == old_last) qp->s_acked = last;
drivers/infiniband/hw/hfi1/verbs.c +0 -16
@@ -297,22 +297,6 @@ static inline int wss_exceeds_threshold(void) }/* -* Translate ib_wr_opcode into ib_wc_opcode. -*/ -const enum ib_wc_opcode ib_hfi1_wc_opcode[] = { - [IB_WR_RDMA_WRITE ] =IB_WC_RDMA_WRITE , - [IB_WR_RDMA_WRITE_WITH_IMM ] =IB_WC_RDMA_WRITE , - [IB_WR_SEND ] =IB_WC_SEND , - [IB_WR_SEND_WITH_IMM ] =IB_WC_SEND , - [IB_WR_RDMA_READ ] =IB_WC_RDMA_READ , - [IB_WR_ATOMIC_CMP_AND_SWP ] =IB_WC_COMP_SWAP , - [IB_WR_ATOMIC_FETCH_AND_ADD ] =IB_WC_FETCH_ADD , - [IB_WR_SEND_WITH_INV ] =IB_WC_SEND , - [IB_WR_LOCAL_INV ] =IB_WC_LOCAL_INV , - [IB_WR_REG_MR ] =IB_WC_REG_MR -}; - -/* * Length of header by opcode, 0 --> not supported */ const u8 hdr_len_by_opcode[256 ] = {
drivers/infiniband/hw/qib/qib_rc.c +2 -24
@@ -941,7 +941,6 @@ void qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr) {struct ib_other_headers *ohdr;struct rvt_swqe *wqe; -struct ib_wc wc;unsigned i;u32 opcode;u32 psn;
@@ -993,17 +992,7 @@ void qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr)rvt_put_mr (sge->mr); } -/* Post a send completion queue entry if requested. */ -if (!(qp->s_flags &RVT_S_SIGNAL_REQ_WR ) || - (wqe->wr.send_flags &IB_SEND_SIGNALED )) { -memset (&wc,0 ,sizeof (wc)); - wc.wr_id = wqe->wr.wr_id; - wc.status =IB_WC_SUCCESS ; - wc.opcode = ib_qib_wc_opcode[wqe->wr.opcode]; - wc.byte_len = wqe->length; - wc.qp = &qp->ibqp; -rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc,0 ); - } +rvt_qp_swqe_complete (qp, wqe,IB_WC_SUCCESS ); }/* * If we were waiting for sends to complete before resending,
@@ -1032,7 +1021,6 @@ static inline void update_last_psn(struct rvt_qp *qp, u32 psn)struct rvt_swqe *wqe, struct qib_ibport *ibp) { - struct ib_wc wc; unsigned i;/*
@@ -1055,17 +1043,7 @@ static inline void update_last_psn(struct rvt_qp *qp, u32 psn) qp->s_last = s_last;/* see post_send() */ barrier (); -/* Post a send completion queue entry if requested. */ -if (!(qp->s_flags &RVT_S_SIGNAL_REQ_WR ) || - (wqe->wr.send_flags &IB_SEND_SIGNALED )) { -memset (&wc,0 ,sizeof (wc)); - wc.wr_id = wqe->wr.wr_id; - wc.status =IB_WC_SUCCESS ; - wc.opcode = ib_qib_wc_opcode[wqe->wr.opcode]; - wc.byte_len = wqe->length; - wc.qp = &qp->ibqp; -rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc,0 ); - } +rvt_qp_swqe_complete (qp, wqe,IB_WC_SUCCESS ); }else this_cpu_inc (*ibp->rvp.rc_delayed_comp);
drivers/infiniband/hw/qib/qib_ruc.c +1 -16
@@ -815,22 +815,7 @@ void qib_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, qp->ibqp.qp_type == IB_QPT_GSI)atomic_dec (&ibah_to_rvtah (wqe->ud_wr.ah)->refcount); -/* See ch. 11.2.4.1 and 10.7.3.1 */ -if (!(qp->s_flags &RVT_S_SIGNAL_REQ_WR ) || - (wqe->wr.send_flags &IB_SEND_SIGNALED ) || - status !=IB_WC_SUCCESS ) { -struct ib_wc wc; - -memset (&wc,0 ,sizeof (wc)); - wc.wr_id = wqe->wr.wr_id; - wc.status = status; - wc.opcode = ib_qib_wc_opcode[wqe->wr.opcode]; - wc.qp = &qp->ibqp; -if (status ==IB_WC_SUCCESS ) - wc.byte_len = wqe->length; -rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.send_cq), &wc, - status !=IB_WC_SUCCESS ); - } +rvt_qp_swqe_complete (qp, wqe, status);if (qp->s_acked == old_last) qp->s_acked = last;
drivers/infiniband/hw/qib/qib_verbs.c +0 -13
@@ -114,19 +114,6 @@MODULE_PARM_DESC (disable_sma,"Disable the SMA" );/* -* Translate ib_wr_opcode into ib_wc_opcode. -*/ -const enum ib_wc_opcode ib_qib_wc_opcode[] = { - [IB_WR_RDMA_WRITE ] =IB_WC_RDMA_WRITE , - [IB_WR_RDMA_WRITE_WITH_IMM ] =IB_WC_RDMA_WRITE , - [IB_WR_SEND ] =IB_WC_SEND , - [IB_WR_SEND_WITH_IMM ] =IB_WC_SEND , - [IB_WR_RDMA_READ ] =IB_WC_RDMA_READ , - [IB_WR_ATOMIC_CMP_AND_SWP ] =IB_WC_COMP_SWAP , - [IB_WR_ATOMIC_FETCH_AND_ADD ] =IB_WC_FETCH_ADD -}; - -/* * System image GUID. */ __be64 ib_qib_sys_image_guid;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 20/23 IB/hfi1: Avoid credit return allocation for cpu-less NUMA nodes
In reply to a message not in the archiveFrom: Harish Chegondi <[email protected]>
Do not allocate credit return base and DMA memory for NUMA nodes without CPUs.
--- drivers/infiniband/hw/hfi1/affinity.c | 3 ++- drivers/infiniband/hw/hfi1/affinity.h | 1 + drivers/infiniband/hw/hfi1/pio.c | 20 +++----------------- 3 files changed, 6 insertions(+), 18 deletions(-)
drivers/infiniband/hw/hfi1/affinity.c +2 -1
@@ -125,6 +125,7 @@ int node_affinity_init(void)cpumask_weight (topology_sibling_cpumask (cpumask_first (&node_affinity.proc.mask) )); + node_affinity.num_possible_nodes =num_possible_nodes (); node_affinity.num_online_nodes =num_online_nodes (); node_affinity.num_online_cpus =num_online_cpus ();
@@ -135,7 +136,7 @@ int node_affinity_init(void)*/ init_real_cpu_mask (); - hfi1_per_node_cntr =kcalloc (num_possible_nodes (), + hfi1_per_node_cntr =kcalloc (node_affinity.num_possible_nodes,sizeof (*hfi1_per_node_cntr),GFP_KERNEL );if (!hfi1_per_node_cntr)return -ENOMEM ;
drivers/infiniband/hw/hfi1/affinity.h +1 -0
@@ -107,6 +107,7 @@ struct hfi1_affinity_node_list {struct cpumask real_cpu_mask;struct cpu_mask_set proc;int num_core_siblings; +int num_possible_nodes;int num_online_nodes;int num_online_cpus;struct mutex lock;/* protects affinity nodes */
drivers/infiniband/hw/hfi1/pio.c +3 -17
@@ -2029,21 +2029,10 @@ int init_pervl_scs(struct hfi1_devdata *dd)int init_credit_return (struct hfi1_devdata *dd) {int ret; -int num_numa;int i; - num_numa =num_online_nodes (); -/* enforce the expectation that the numas are compact */ -for (i =0 ; i < num_numa; i++) { -if (!node_online (i)) { -dd_dev_err (dd,"NUMA nodes are not compact\n" ); - ret = -EINVAL ; - goto done; - } - } - dd->cr_base =kcalloc ( - num_numa, + node_affinity.num_possible_nodes,sizeof (struct credit_return_base ),GFP_KERNEL );if (!dd->cr_base) {
@@ -2051,7 +2040,7 @@ int init_credit_return(struct hfi1_devdata *dd) ret = -ENOMEM ; goto done; } -for (i =0 ; i < num_numa; i++) { +for_each_node_with_cpus (i) {int bytes =TXE_NUM_CONTEXTS *sizeof (struct credit_return );set_dev_node (&dd->pcidev->dev, i);
@@ -2078,14 +2067,11 @@ int init_credit_return(struct hfi1_devdata *dd)void free_credit_return (struct hfi1_devdata *dd) { -int num_numa;int i;if (!dd->cr_base)return ; - - num_numa =num_online_nodes (); -for (i =0 ; i < num_numa; i++) { +for (i =0 ; i < node_affinity.num_possible_nodes; i++) {if (dd->cr_base[i].va) { dma_free_coherent(&dd->pcidev->dev, TXE_NUM_CONTEXTS *
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 21/23 IB/rdmavt: Add swqe mr deref helper
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
Add a helper to release mr references held by
an swqe.
--- include/rdma/rdmavt_qp.h | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
include/rdma/rdmavt_qp.h +17 -0
@@ -486,6 +486,23 @@ static inline void rvt_put_qp(struct rvt_qp *qp) }/** +* rvt_put_swqe - drop mr refs held by swqe +* @wqe - the send wqe +* +* This drops any mr references held by the swqe +*/ +static inline void rvt_put_swqe (struct rvt_swqe *wqe) +{ +int i; + +for (i =0 ; i < wqe->wr.num_sge; i++) { +struct rvt_sge *sge = &wqe->sg_list[i]; + +rvt_put_mr (sge->mr); + } +} + +/** * rvt_qp_wqe_reserve - reserve operation * @qp - the rvt qp * @wqe - the send wqe
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 22/23 IB/hfi1,IB/qib: use rvt swqe mr deref helper
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
Convert to use new swqe put routine.
--- drivers/infiniband/hw/hfi1/rc.c | 15 ++------------- drivers/infiniband/hw/hfi1/ruc.c | 7 +------ drivers/infiniband/hw/qib/qib_rc.c | 15 ++------------- drivers/infiniband/hw/qib/qib_ruc.c | 7 +------ 4 files changed, 6 insertions(+), 38 deletions(-)
drivers/infiniband/hw/hfi1/rc.c +2 -13
@@ -1146,7 +1146,6 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr) {struct ib_other_headers *ohdr;struct rvt_swqe *wqe; -unsigned i;u32 opcode;u32 psn;
@@ -1194,11 +1193,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr) qp->s_last = s_last;/* see post_send() */ barrier (); -for (i =0 ; i < wqe->wr.num_sge; i++) { -struct rvt_sge *sge = &wqe->sg_list[i]; - -rvt_put_mr (sge->mr); - } +rvt_put_swqe (wqe);rvt_qp_swqe_complete (qp, wqe,IB_WC_SUCCESS ); }/*
@@ -1229,8 +1224,6 @@ static inline void update_last_psn(struct rvt_qp *qp, u32 psn)struct rvt_swqe *wqe, struct hfi1_ibport *ibp) { - unsigned i; - lockdep_assert_held(&qp->s_lock);/* * Don't decrement refcount and don't generate a
@@ -1241,11 +1234,7 @@ static inline void update_last_psn(struct rvt_qp *qp, u32 psn) cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) > 0) {u32 s_last; -for (i =0 ; i < wqe->wr.num_sge; i++) { -struct rvt_sge *sge = &wqe->sg_list[i]; - -rvt_put_mr (sge->mr); - } +rvt_put_swqe (wqe); s_last = qp->s_last;if (++s_last >= qp->s_size) s_last =0 ;
drivers/infiniband/hw/hfi1/ruc.c +1 -6
@@ -942,7 +942,6 @@ void hfi1_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, enum ib_wc_status status) {u32 old_last, last; -unsigned i;if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_OR_FLUSH_SEND ))return ;
@@ -954,11 +953,7 @@ void hfi1_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, qp->s_last = last;/* See post_send() */ barrier (); -for (i =0 ; i < wqe->wr.num_sge; i++) { -struct rvt_sge *sge = &wqe->sg_list[i]; - -rvt_put_mr (sge->mr); - } +rvt_put_swqe (wqe);if (qp->ibqp.qp_type ==IB_QPT_UD || qp->ibqp.qp_type ==IB_QPT_SMI || qp->ibqp.qp_type ==IB_QPT_GSI )
drivers/infiniband/hw/qib/qib_rc.c +2 -13
@@ -941,7 +941,6 @@ void qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr) {struct ib_other_headers *ohdr;struct rvt_swqe *wqe; -unsigned i;u32 opcode;u32 psn;
@@ -987,11 +986,7 @@ void qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr) qp->s_last = s_last;/* see post_send() */ barrier (); -for (i =0 ; i < wqe->wr.num_sge; i++) { -struct rvt_sge *sge = &wqe->sg_list[i]; - -rvt_put_mr (sge->mr); - } +rvt_put_swqe (wqe);rvt_qp_swqe_complete (qp, wqe,IB_WC_SUCCESS ); }/*
@@ -1021,8 +1016,6 @@ static inline void update_last_psn(struct rvt_qp *qp, u32 psn)struct rvt_swqe *wqe, struct qib_ibport *ibp) { - unsigned i; -/* * Don't decrement refcount and don't generate a * completion if the SWQE is being resent until the send
@@ -1032,11 +1025,7 @@ static inline void update_last_psn(struct rvt_qp *qp, u32 psn) qib_cmp24(qp->s_sending_psn, qp->s_sending_hpsn) > 0) {u32 s_last; -for (i =0 ; i < wqe->wr.num_sge; i++) { -struct rvt_sge *sge = &wqe->sg_list[i]; - -rvt_put_mr (sge->mr); - } +rvt_put_swqe (wqe); s_last = qp->s_last;if (++s_last >= qp->s_size) s_last =0 ;
drivers/infiniband/hw/qib/qib_ruc.c +1 -6
@@ -793,7 +793,6 @@ void qib_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, enum ib_wc_status status) {u32 old_last, last; -unsigned i;if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_OR_FLUSH_SEND ))return ;
@@ -805,11 +804,7 @@ void qib_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, qp->s_last = last;/* See post_send() */ barrier (); -for (i =0 ; i < wqe->wr.num_sge; i++) { -struct rvt_sge *sge = &wqe->sg_list[i]; - -rvt_put_mr (sge->mr); - } +rvt_put_swqe (wqe);if (qp->ibqp.qp_type ==IB_QPT_UD || qp->ibqp.qp_type ==IB_QPT_SMI || qp->ibqp.qp_type ==IB_QPT_GSI )
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 23/23 IB/rdmavt, IB/hfi1, IB/qib: Add inlines for mtu division
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
Add rvt_div_round_up_mtu() and rvt_div_mtu() routines to do the computation based on the pmtu and the log_pmtu.
Change divides in qib, hfi1 to use the new inlines.
--- drivers/infiniband/hw/hfi1/rc.c | 3 +-- drivers/infiniband/hw/qib/qib_rc.c | 3 +-- include/rdma/rdmavt_qp.h | 24 +++++++++++++++++++++++- 3 files changed, 25 insertions(+), 5 deletions(-)
drivers/infiniband/hw/hfi1/rc.c +1 -2
@@ -2377,8 +2377,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)* Update the next expected PSN. We add 1 later * below, so only add the remainder here. */ -if (len > pmtu) - qp->r_psn += (len -1 ) / pmtu; + qp->r_psn +=rvt_div_mtu (qp, len -1 ); }else { e->rdma_sge.mr =NULL ; e->rdma_sge.vaddr =NULL ;
drivers/infiniband/hw/qib/qib_rc.c +1 -2
@@ -2079,8 +2079,7 @@ void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr,* Update the next expected PSN. We add 1 later * below, so only add the remainder here. */ -if (len > pmtu) - qp->r_psn += (len -1 ) / pmtu; + qp->r_psn +=rvt_div_mtu (qp, len -1 ); }else { e->rdma_sge.mr =NULL ; e->rdma_sge.vaddr =NULL ;
include/rdma/rdmavt_qp.h +23 -1
@@ -582,7 +582,29 @@ static inline void rvt_qp_swqe_complete( } } -extern const int ib_rvt_state_ops[]; +/** +* @qp - the qp pair +* @len - the length +* +* Perform a shift based mtu round up divide +*/ +static inline u32 rvt_div_round_up_mtu (struct rvt_qp *qp,u32 len) +{ +return (len + qp->pmtu -1 ) >> qp->log_pmtu; +} + +/** +* @qp - the qp pair +* @len - the length +* +* Perform a shift based mtu divide +*/ +static inline u32 rvt_div_mtu (struct rvt_qp *qp,u32 len) +{ +return len >> qp->log_pmtu; +} + +extern const int ib_rvt_state_ops[];struct rvt_dev_info ;int rvt_error_qp (struct rvt_qp *qp,enum ib_wc_status err);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Dennis Dalessandro
Doug,
Here is a set of patches for our drivers for 4.10. This is a collection of bug fixes, perf improvements, and clean ups. The patches apply on top of the last series I submitted. However if things do not apply cleanly let me know I can rebase.
Can also be found in GitHub repo at:
https://github.com/ddalessa/kernel/tree/for-4.10
Hi Dennis, I pulled all of these in plus a couple others from other people.
Signature · 2 lines
Doug Ledford <[email protected]> GPG Key ID: 0E572FDD