IB/hfi1,rdmavt,core: Patches for-next
Subsystems (4)
v2 cover IB/hfi1,rdmavt,core: Patches for-next
Doug,
Here are some patches for the next release. It includes the core fix that did not apply from my last series. Other than that this is the usual bug fixes and some minor clean ups.
Patches apply on top of your for-4.12 branch and can also be found in my GitHub repo at: https://github.com/ddalessa/kernel/tree/for-4.12
---
Changes since V1:
* Dropped: [02/20] IB/hfi1: Remove hyper-thread siblings by walking CPU mask
* Fixed a scheduling while atomic bug in update_synth_timer
---
Dasaratharaman Chandramouli (1):
IB/hfi1: Rename hdr2sc to hfi1_9B_get_sc5
Dennis Dalessandro (4):
IB/hfi1: Fix misspelling in comment
IB/hfi1: Convert %Lx to %llx
IB/hfi1: Fix unbalanced braces around else
IB/hfi1: Use bool in process_ecn
Don Hiatt (2):
IB/hfi1: Add functions to parse 9B headers
IB/hfi1: Use defines from common headers
Ira Weiny (1):
IB/hfi: Protect against writable mmap
Michael J. Ruhl (5):
IB/core: If the MGID/MLID pair is not on the list return an error IB/hfi1: Correct MulticastMask/CollectiveMask info to SMA output IB/core: For multicast functions, verify that LIDs are multicast LIDs IB/rdmavt/hfi1/qib: Use the MGID and MLID for multicast addressing IB/hfi1: Validate the TID count before using it
Mike Marciniszyn (1):
IB/hfi1: Prevent kernel QP post send hard lockups
Neel Desai (2):
IB/hfi1: Adjust high temperature warning for QSFP cable IB/hfi1: Permanently enable P_Key checking in HFI
Sebastian Sanchez (1):
IB/hfi1: Return SC2VL mappings to FM with VL15 instead of ILLEGAL_VL
Stuart Summers (1):
IB/hfi1: Cache neighbor secure data after link up
Tadeusz Struk (1):
IB/hfi1: Fix softlockup issue
drivers/infiniband/core/uverbs_cmd.c | 13 ++- drivers/infiniband/core/verbs.c | 8 +- drivers/infiniband/hw/hfi1/chip.c | 121 ++++++++++++++--------------- drivers/infiniband/hw/hfi1/common.h | 15 ++-- drivers/infiniband/hw/hfi1/driver.c | 28 +++---- drivers/infiniband/hw/hfi1/file_ops.c | 4 + drivers/infiniband/hw/hfi1/hfi.h | 27 ++++-- drivers/infiniband/hw/hfi1/init.c | 11 ++- drivers/infiniband/hw/hfi1/intr.c | 27 ++++-- drivers/infiniband/hw/hfi1/mad.c | 56 +++++++------ drivers/infiniband/hw/hfi1/pcie.c | 2 drivers/infiniband/hw/hfi1/rc.c | 19 ++--- drivers/infiniband/hw/hfi1/ruc.c | 52 +++++++----- drivers/infiniband/hw/hfi1/trace.c | 5 - drivers/infiniband/hw/hfi1/trace_ibhdrs.h | 8 +- drivers/infiniband/hw/hfi1/uc.c | 8 +- drivers/infiniband/hw/hfi1/ud.c | 18 ++-- drivers/infiniband/hw/hfi1/user_exp_rcv.c | 3 + drivers/infiniband/hw/hfi1/verbs.c | 16 ++-- drivers/infiniband/hw/hfi1/verbs.h | 6 + drivers/infiniband/hw/qib/qib_verbs.c | 2 drivers/infiniband/sw/rdmavt/mcast.c | 61 +++++++++++---- include/rdma/ib_hdrs.h | 66 ++++++++++++++++ include/rdma/rdma_vt.h | 3 - include/rdma/rdmavt_qp.h | 7 +- 25 files changed, 363 insertions(+), 223 deletions(-)
A message that is not in the archive (sent off-list or not yet received): 20170428173443.23960.32602.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org
PATCH v2 1/19 IB/core: If the MGID/MLID pair is not on the list return an error
From: Michael J. Ruhl <[email protected]>
A list of MGID/MLID pairs is built when doing a multicast attach. When the multicast detach is called, the list is searched, and regardless of the search outcome, the driver detach is called.
If an MGID/MLID pair is not on the list, driver detach should not be called, and an error should be returned. Calling the driver without removing an MGID/MLID pair from the list can leave the core and driver out of sync.
--- drivers/infiniband/core/uverbs_cmd.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +9 -4
@@ -2647,6 +2647,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,struct ib_qp *qp;struct ib_uverbs_mcast_entry *mcast;int ret = -EINVAL ; +bool found = false;if (copy_from_user (&cmd, buf,sizeof cmd))return -EFAULT ;
@@ -2658,18 +2659,22 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file, obj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject);mutex_lock (&obj->mcast_lock); - ret =ib_detach_mcast (qp, (union ib_gid *) cmd.gid, cmd.mlid); -if (ret) - goto out_put; -list_for_each_entry (mcast, &obj->mcast_list, list)if (cmd.mlid == mcast->lid && !memcmp (cmd.gid, mcast->gid.raw,sizeof mcast->gid.raw)) {list_del (&mcast->list);kfree (mcast); + found = true;break ; } +if (!found) { + ret = -EINVAL ; + goto out_put; + } + + ret =ib_detach_mcast (qp, (union ib_gid *)cmd.gid, cmd.mlid); + out_put:mutex_unlock (&obj->mcast_lock);uobj_put_obj_read (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 v2 2/19 IB/hfi1: Correct MulticastMask/CollectiveMask info to SMA output
In reply to a message not in the archiveFrom: Michael J. Ruhl <[email protected]>
The FM uses the values of MulticastMask and CollectiveMask to determine the number of bits for net masks. The current values of 0 and 0 are incorrect. The values should be 4 and 1. Updated the necessary code to reflect the specified values.
--- drivers/infiniband/hw/hfi1/common.h | 9 +++++++++ drivers/infiniband/hw/hfi1/mad.c | 5 +++++ 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/infiniband/hw/hfi1/common.h +9 -0
@@ -338,6 +338,15 @@ struct diag_pkt {#define HFI1_BECN_MASK 1#define HFI1_BECN_SMASK BIT(HFI1_BECN_SHIFT) +/** +* 0xF8 - 4 bits of multicast range and 1 bit for collective range +* Example: For 24 bit LID space, +* Multicast range: 0xF00000 to 0xF7FFFF +* Collective range: 0xF80000 to 0xFFFFFE +*/ +#define HFI1_MCAST_NR 0x4/* Number of top bits set */ +#define HFI1_COLLECTIVE_NR 0x1/* Number of bits after MCAST_NR */ +#define HFI1_PSM_IOC_BASE_SEQ 0x0static inline __u64 rhf_to_cpu (const __le32 *rbuf)
drivers/infiniband/hw/hfi1/mad.c +5 -0
@@ -702,6 +702,11 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, pi->buffer_units =cpu_to_be32 (buffer_units); pi->opa_cap_mask =cpu_to_be16 (OPA_CAP_MASK3_IsSharedSpaceSupported); +/* Driver does not support mcast/collective configuration */ + pi->opa_cap_mask &= +cpu_to_be16 (~OPA_CAP_MASK3_IsAddrRangeConfigSupported); + pi->collectivemask_multicastmask = ((HFI1_COLLECTIVE_NR &0x7 ) + <<3 | (HFI1_MCAST_NR &0x7 ));/* HFI supports a replay buffer 128 LTPs in size */ pi->replay_depth.buffer =0x80 ;
--
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 v2 4/19 IB/rdmavt/hfi1/qib: Use the MGID and MLID for multicast addressing
In reply to a message not in the archiveFrom: Michael J. Ruhl <[email protected]>
The Infiniband spec defines "A multicast address is defined by a MGID and a MLID" (section 10.5).
The current code only uses the MGID for identifying multicast groups. Update the driver to be compliant with this definition.
--- drivers/infiniband/hw/hfi1/verbs.c | 2 + drivers/infiniband/hw/qib/qib_verbs.c | 2 + drivers/infiniband/sw/rdmavt/mcast.c | 61 ++++++++++++++++++++++++--------- include/rdma/rdma_vt.h | 3 +- include/rdma/rdmavt_qp.h | 7 +++- 5 files changed, 54 insertions(+), 21 deletions(-)
drivers/infiniband/hw/hfi1/verbs.c +1 -1
@@ -603,7 +603,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)if (lnh !=HFI1_LRH_GRH ) goto drop; - mcast =rvt_mcast_find (&ibp->rvp, &hdr->u.l.grh.dgid); + mcast =rvt_mcast_find (&ibp->rvp, &hdr->u.l.grh.dgid, lid);if (!mcast) goto drop;list_for_each_entry_rcu (p, &mcast->qp_list, list) {
drivers/infiniband/hw/qib/qib_verbs.c +1 -1
@@ -356,7 +356,7 @@ void qib_ib_rcv(struct qib_ctxtdata *rcd, void *rhdr, void *data, u32 tlen)if (lnh !=QIB_LRH_GRH ) goto drop; - mcast =rvt_mcast_find (&ibp->rvp, &hdr->u.l.grh.dgid); + mcast =rvt_mcast_find (&ibp->rvp, &hdr->u.l.grh.dgid, lid);if (mcast ==NULL ) goto drop;this_cpu_inc (ibp->pmastats->n_multicast_rcv);
drivers/infiniband/sw/rdmavt/mcast.c +44 -17
139 lines not on this page · raw message
include/rdma/rdma_vt.h +2 -1
@@ -516,6 +516,7 @@ int rvt_rkey_ok(struct rvt_qp *qp, struct rvt_sge *sge, u32 len, u64 vaddr, u32 rkey, int acc);int rvt_lkey_ok (struct rvt_lkey_table *rkt,struct rvt_pd *pd,struct rvt_sge *isge,struct ib_sge *sge,int acc); -struct rvt_mcast *rvt_mcast_find (struct rvt_ibport *ibp,union ib_gid *mgid); +struct rvt_mcast *rvt_mcast_find (struct rvt_ibport *ibp,union ib_gid *mgid, +u16 lid);#endif /* DEF_RDMA_VT_H */
include/rdma/rdmavt_qp.h +6 -1
@@ -435,9 +435,14 @@ struct rvt_mcast_qp {struct rvt_qp *qp; }; +struct rvt_mcast_addr { +union ib_gid mgid; +u16 lid; +}; +struct rvt_mcast {struct rb_node rb_node; -union ib_gid mgid; +struct rvt_mcast_addr mcast_addr;struct list_head qp_list;wait_queue_head_t wait;atomic_t refcount;
--
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 v2 5/19 IB/hfi1: Validate the TID count before using it
In reply to a message not in the archiveFrom: Michael J. Ruhl <[email protected]>
Improve the safety of the code by validating the user supplied tidcnt before use.
--- drivers/infiniband/hw/hfi1/user_exp_rcv.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/infiniband/hw/hfi1/user_exp_rcv.c +3 -0
@@ -578,6 +578,9 @@ int hfi1_user_exp_rcv_clear(struct file *fp, struct hfi1_tid_info *tinfo)u32 *tidinfo;unsigned tididx; +if (unlikely (tinfo->tidcnt > fd->tid_used)) +return -EINVAL ; + tidinfo =memdup_user ((void __user *)(unsigned long )tinfo->tidlist,sizeof (tidinfo[0 ]) * tinfo->tidcnt);if (IS_ERR (tidinfo))
--
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 v2 6/19 IB/hfi1: Return SC2VL mappings to FM with VL15 instead of ILLEGAL_VL
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
VL15 in the SC2VL table is used to indicate an invalid SC for the FM, however, internally the driver remaps SCs from VL15 to ILLEGAL_VL to prevent error counts. This mapping confuses the FM when performing a sweep, making it return a table mismatch error. Have SMA convert ILLEGAL_VL to VL15 entries for the SC2VL table queries.
--- drivers/infiniband/hw/hfi1/mad.c | 41 +++++++++++++++++++++++--------------- 1 files changed, 25 insertions(+), 16 deletions(-)
drivers/infiniband/hw/hfi1/mad.c +25 -16
@@ -1,5 +1,5 @@/* -* Copyright(c) 2015, 2016 Intel Corporation. +* Copyright(c) 2015-2017 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license.
@@ -1470,25 +1470,15 @@ static int __subn_set_opa_pkeytable(struct opa_smp *smp, u32 am, u8 *data,return __subn_get_opa_pkeytable (smp, am, data, ibdev, port, resp_len); } -static int get_sc2vlt_tables (struct hfi1_devdata *dd,void *data) -{ -u64 *val = data; - - *val++ =read_csr (dd,SEND_SC2VLT0 ); - *val++ =read_csr (dd,SEND_SC2VLT1 ); - *val++ =read_csr (dd,SEND_SC2VLT2 ); - *val++ =read_csr (dd,SEND_SC2VLT3 ); -return 0 ; -} -#define ILLEGAL_VL 12/* * filter_sc2vlt changes mappings to VL15 to ILLEGAL_VL (except * for SC15, which must map to VL15). If we don't remap things this * way it is possible for VL15 counters to increment when we try to * send on a SC which is mapped to an invalid VL. +* When getting the table convert ILLEGAL_VL back to VL15. */ -static void filter_sc2vlt (void *data) +static void filter_sc2vlt (void *data,bool set) {int i;u8 *pd = data;
@@ -1496,8 +1486,14 @@ static void filter_sc2vlt(void *data)for (i =0 ; i <OPA_MAX_SCS ; i++) {if (i ==15 )continue ; -if ((pd[i] &0x1f ) ==0xf ) - pd[i] =ILLEGAL_VL ; + +if (set) { +if ((pd[i] &0x1f ) ==0xf ) + pd[i] =ILLEGAL_VL ; + }else { +if ((pd[i] &0x1f ) ==ILLEGAL_VL ) + pd[i] =0xf ; + } } }
@@ -1505,7 +1501,7 @@ static int set_sc2vlt_tables(struct hfi1_devdata *dd, void *data) {u64 *val = data; -filter_sc2vlt (data); +filter_sc2vlt (data, true);write_csr (dd,SEND_SC2VLT0 , *val++);write_csr (dd,SEND_SC2VLT1 , *val++);
@@ -1517,6 +1513,19 @@ static int set_sc2vlt_tables(struct hfi1_devdata *dd, void *data)return 0 ; } +static int get_sc2vlt_tables (struct hfi1_devdata *dd,void *data) +{ +u64 *val = (u64 *)data; + + *val++ =read_csr (dd,SEND_SC2VLT0 ); + *val++ =read_csr (dd,SEND_SC2VLT1 ); + *val++ =read_csr (dd,SEND_SC2VLT2 ); + *val++ =read_csr (dd,SEND_SC2VLT3 ); + +filter_sc2vlt ((u64 *)data, false); +return 0 ; +} +static int __subn_get_opa_sl_to_sc (struct opa_smp *smp,u32 am,u8 *data,struct ib_device *ibdev,u8 port,u32 *resp_len)
--
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 v2 7/19 IB/hfi1: Rename hdr2sc to hfi1_9B_get_sc5
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
The function really returned the 5-bit sc value from the header and rhf. hdr2sc didn't quite describe what it did.
--- drivers/infiniband/hw/hfi1/driver.c | 7 ++++--- drivers/infiniband/hw/hfi1/hfi.h | 2 +- drivers/infiniband/hw/hfi1/ud.c | 2 +- drivers/infiniband/hw/hfi1/verbs.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +4 -3
@@ -397,7 +397,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,u16 rlid;u8 svc_type, sl, sc5; - sc5 =hdr2sc (rhdr, packet->rhf); + sc5 =hfi1_9B_get_sc5 (rhdr, packet->rhf); sl = ibp->sc_to_sl[sc5]; lqpn =be32_to_cpu (bth[1 ]) &RVT_QPN_MASK ;
@@ -492,7 +492,7 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,return ; } - sc =hdr2sc (hdr, pkt->rhf); + sc =hfi1_9B_get_sc5 (hdr, pkt->rhf); bth1 =be32_to_cpu (ohdr->bth[1 ]);if (do_cnp && (bth1 &HFI1_FECN_SMASK )) {
@@ -909,7 +909,8 @@ static inline int set_armed_to_active(struct hfi1_ctxtdata *rcd, packet->rhf_addr);u8 etype =rhf_rcv_type (packet->rhf); -if (etype ==RHF_RCV_TYPE_IB &&hdr2sc (hdr, packet->rhf) !=0xf ) { +if (etype ==RHF_RCV_TYPE_IB && +hfi1_9B_get_sc5 (hdr, packet->rhf) !=0xf ) {int hwstate =read_logical_state (dd);if (hwstate !=LSTATE_ACTIVE ) {
drivers/infiniband/hw/hfi1/hfi.h +1 -1
@@ -1261,7 +1261,7 @@ static inline u32 driver_lstate(struct hfi1_pportdata *ppd)void receive_interrupt_work (struct work_struct *work);/* extract service channel from header and rhf */ -static inline int hdr2sc (struct ib_header *hdr,u64 rhf) +static inline int hfi1_9B_get_sc5 (struct ib_header *hdr,u64 rhf) {return ((be16_to_cpu (hdr->lrh[0 ]) >>12 ) &0xf ) | ((!!(rhf_dc_info (rhf))) <<4 );
drivers/infiniband/hw/hfi1/ud.c +1 -1
@@ -680,7 +680,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)u32 tlen = packet->tlen;struct rvt_qp *qp = packet->qp;bool has_grh = rcv_flags &HFI1_HAS_GRH ; -u8 sc5 =hdr2sc (hdr, packet->rhf); +u8 sc5 =hfi1_9B_get_sc5 (hdr, packet->rhf);u32 bth1;u8 sl_from_sc, sl;u16 slid;
drivers/infiniband/hw/hfi1/verbs.c +1 -1
@@ -1928,7 +1928,7 @@ void hfi1_cnp_rcv(struct hfi1_packet *packet)return ; } - sc5 =hdr2sc (hdr, packet->rhf); + sc5 =hfi1_9B_get_sc5 (hdr, packet->rhf); sl = ibp->sc_to_sl[sc5]; lqpn = qp->ibqp.qp_num;
--
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 v2 8/19 IB/hfi1: Add functions to parse 9B headers
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
These inline functions improve code readability by enabling callers to read specific fields from the header without knowledge of byte offsets.
--- drivers/infiniband/hw/hfi1/driver.c | 13 ++++---- drivers/infiniband/hw/hfi1/hfi.h | 3 +- drivers/infiniband/hw/hfi1/rc.c | 14 ++++---- drivers/infiniband/hw/hfi1/ruc.c | 24 +++++++------- drivers/infiniband/hw/hfi1/trace.c | 5 +-- drivers/infiniband/hw/hfi1/uc.c | 8 ++--- drivers/infiniband/hw/hfi1/ud.c | 14 ++++---- drivers/infiniband/hw/hfi1/verbs.c | 8 ++--- include/rdma/ib_hdrs.h | 60 +++++++++++++++++++++++++++++++++++ 9 files changed, 102 insertions(+), 47 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +6 -7
@@ -284,7 +284,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, {struct ib_header *rhdr = packet->hdr;u32 rte =rhf_rcv_type_err (packet->rhf); -int lnh =be16_to_cpu (rhdr->lrh[0 ]) &3 ; +int lnh =ib_get_lnh (rhdr);struct hfi1_ibport *ibp =rcd_to_iport (rcd);struct hfi1_devdata *dd = ppd->dd;struct rvt_dev_info *rdi = &dd->verbs_dev.rdi;
@@ -296,7 +296,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,/* For TIDERR and RC QPs preemptively schedule a NAK */ struct ib_other_headers *ohdr =NULL ;u32 tlen =rhf_pkt_len (packet->rhf);/* in bytes */ -u16 lid =be16_to_cpu (rhdr->lrh[1 ]); +u16 lid =ib_get_dlid (rhdr);u32 qp_num;u32 rcv_flags =0 ;
@@ -415,7 +415,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, svc_type =IB_CC_SVCTYPE_UD ;break ;case IB_QPT_UC : - rlid =be16_to_cpu (rhdr->lrh[3 ]); + rlid =ib_get_slid (rhdr); rqpn = qp->remote_qpn; svc_type =IB_CC_SVCTYPE_UC ;break ;
@@ -461,7 +461,7 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,struct ib_other_headers *ohdr = pkt->ohdr;struct ib_grh *grh =NULL ;u32 rqpn =0 , bth1; -u16 rlid, dlid =be16_to_cpu (hdr->lrh[1 ]); +u16 rlid, dlid =ib_get_dlid (hdr);u8 sc, svc_type;bool is_mcast = false;
@@ -472,7 +472,7 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,case IB_QPT_SMI :case IB_QPT_GSI :case IB_QPT_UD : - rlid =be16_to_cpu (hdr->lrh[3 ]); + rlid =ib_get_slid (hdr); rqpn =be32_to_cpu (ohdr->u.ud.deth[1 ]) &RVT_QPN_MASK ; svc_type =IB_CC_SVCTYPE_UD ; is_mcast = (dlid > be16_to_cpu(IB_MULTICAST_LID_BASE)) &&
@@ -622,8 +622,7 @@ static void __prescan_rxq(struct hfi1_packet *packet) packet->hdr =hfi1_get_msgheader (dd, rhf_addr); hdr = packet->hdr; - - lnh =be16_to_cpu (hdr->lrh[0 ]) &3 ; + lnh =ib_get_lnh (hdr);if (lnh ==HFI1_LRH_BTH ) { packet->ohdr = &hdr->u.oth;
drivers/infiniband/hw/hfi1/hfi.h +1 -2
@@ -1263,8 +1263,7 @@ static inline u32 driver_lstate(struct hfi1_pportdata *ppd)/* extract service channel from header and rhf */ static inline int hfi1_9B_get_sc5 (struct ib_header *hdr,u64 rhf) { -return ((be16_to_cpu (hdr->lrh[0 ]) >>12 ) &0xf ) | - ((!!(rhf_dc_info (rhf))) <<4 ); +return ib_get_sc (hdr) | ((!!(rhf_dc_info (rhf))) <<4 ); }#define HFI1_JKEY_WIDTH 16
drivers/infiniband/hw/hfi1/rc.c +7 -7
@@ -994,12 +994,12 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr)return ;/* Find out where the BTH is */ -if ((be16_to_cpu (hdr->lrh[0 ]) &3 ) ==HFI1_LRH_BTH ) +if (ib_get_lnh (hdr) ==HFI1_LRH_BTH ) ohdr = &hdr->u.oth;else ohdr = &hdr->u.l.oth; - opcode =be32_to_cpu (ohdr->bth[0 ]) >>24 ; + opcode =ib_bth_get_opcode (ohdr);if (opcode >=OP (RDMA_READ_RESPONSE_FIRST ) && opcode <=OP (ATOMIC_ACKNOWLEDGE )) {WARN_ON (!qp->s_rdma_ack_cnt);
@@ -1524,7 +1524,7 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp,if (!do_rc_ack (qp, aeth, psn, opcode,0 , rcd)) goto ack_done;/* Get the number of bytes the message was padded by. */ - pad = (be32_to_cpu (ohdr->bth[0 ]) >>20 ) &3 ; + pad =ib_bth_get_pad (ohdr);/* * Check that the data size is >= 0 && <= pmtu. * Remember to account for ICRC (4).
@@ -1548,7 +1548,7 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp,if (unlikely (wqe->wr.opcode !=IB_WR_RDMA_READ )) goto ack_op_err;/* Get the number of bytes the message was padded by. */ - pad = (be32_to_cpu (ohdr->bth[0 ]) >>20 ) &3 ; + pad =ib_bth_get_pad (ohdr);/* * Check that the data size is >= 1 && <= pmtu. * Remember to account for ICRC (4).
@@ -1942,7 +1942,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) is_fecn =process_ecn (qp, packet, false); psn =be32_to_cpu (ohdr->bth[2 ]); - opcode = (bth0 >>24 ) &0xff ; + opcode =ib_bth_get_opcode (ohdr);/* * Process responses (ACKs) before anything else. Note that the
@@ -2073,7 +2073,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) wc.ex.imm_data =0 ; send_last:/* Get the number of bytes the message was padded by. */ - pad = (bth0 >>20 ) &3 ; + pad =ib_bth_get_pad (ohdr);/* Check for invalid length. */ /* LAST len should be >= 1 */ if (unlikely (tlen < (hdrsize + pad +4 )))
@@ -2386,7 +2386,7 @@ void hfi1_rc_hdrerr(return ; psn =be32_to_cpu (ohdr->bth[2 ]); - opcode = (bth0 >>24 ) &0xff ; + opcode =ib_bth_get_opcode (ohdr);/* Only deal with RDMA Writes for now */ if (opcode <IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST ) {
drivers/infiniband/hw/hfi1/ruc.c +12 -12
@@ -238,18 +238,18 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct ib_header *hdr, qp->alt_ah_attr.grh.dgid.global.interface_id)) goto err; } -if (unlikely (rcv_pkey_check (ppd_from_ibp (ibp), (u16 )bth0, - sc5,be16_to_cpu (hdr->lrh[3 ])))) { +if (unlikely (rcv_pkey_check (ppd_from_ibp (ibp), (u16 )bth0, sc5, +ib_get_slid (hdr)))) {hfi1_bad_pqkey (ibp,OPA_TRAP_BAD_P_KEY , (u16 )bth0, - (be16_to_cpu (hdr->lrh[0 ]) >>4 ) &0xF , +ib_get_sl (hdr),0 , qp->ibqp.qp_num, -be16_to_cpu (hdr->lrh[3 ]), -be16_to_cpu (hdr->lrh[1 ])); +ib_get_slid (hdr), +ib_get_dlid (hdr)); goto err; }/* Validate the SLID. See Ch. 9.6.1.5 and 17.2.8 */ -if (be16_to_cpu (hdr->lrh[3 ]) != qp->alt_ah_attr.dlid || +if (ib_get_slid (hdr) != qp->alt_ah_attr.dlid ||ppd_from_ibp (ibp)->port != qp->alt_ah_attr.port_num) goto err;spin_lock_irqsave (&qp->s_lock, flags);
@@ -273,18 +273,18 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct ib_header *hdr, qp->remote_ah_attr.grh.dgid.global.interface_id)) goto err; } -if (unlikely (rcv_pkey_check (ppd_from_ibp (ibp), (u16 )bth0, - sc5,be16_to_cpu (hdr->lrh[3 ])))) { +if (unlikely (rcv_pkey_check (ppd_from_ibp (ibp), (u16 )bth0, sc5, +ib_get_slid (hdr)))) {hfi1_bad_pqkey (ibp,OPA_TRAP_BAD_P_KEY , (u16 )bth0, - (be16_to_cpu (hdr->lrh[0 ]) >>4 ) &0xF , +ib_get_sl (hdr),0 , qp->ibqp.qp_num, -be16_to_cpu (hdr->lrh[3 ]), -be16_to_cpu (hdr->lrh[1 ])); +ib_get_slid (hdr), +ib_get_dlid (hdr)); goto err; }/* Validate the SLID. See Ch. 9.6.1.5 */ -if (be16_to_cpu (hdr->lrh[3 ]) != qp->remote_ah_attr.dlid || +if (ib_get_slid (hdr) != qp->remote_ah_attr.dlid ||ppd_from_ibp (ibp)->port != qp->port_num) goto err; if (qp->s_mig_state == IB_MIG_REARM &&
drivers/infiniband/hw/hfi1/trace.c +2 -3
@@ -51,13 +51,12 @@ u8 ibhdr_exhdr_len(struct ib_header *hdr) {struct ib_other_headers *ohdr;u8 opcode; -u8 lnh = (u8)(be16_to_cpu (hdr->lrh[0 ]) &3 ); -if (lnh ==HFI1_LRH_BTH ) +if (ib_get_lnh (hdr) ==HFI1_LRH_BTH ) ohdr = &hdr->u.oth;else ohdr = &hdr->u.l.oth; - opcode =be32_to_cpu (ohdr->bth[0 ]) >>24 ; + opcode =ib_bth_get_opcode (ohdr);return hdr_len_by_opcode[opcode] ==0 ?0 : hdr_len_by_opcode[opcode] - (12 +8 ); }
drivers/infiniband/hw/hfi1/uc.c +4 -4
@@ -320,7 +320,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)process_ecn (qp, packet, true); psn =be32_to_cpu (ohdr->bth[2 ]); - opcode = (bth0 >>24 ) &0xff ; + opcode =ib_bth_get_opcode (ohdr);/* Compare the PSN verses the expected PSN. */ if (unlikely (cmp_psn (psn, qp->r_psn) !=0 )) {
@@ -433,7 +433,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) wc.wc_flags =0 ; send_last:/* Get the number of bytes the message was padded by. */ - pad = (be32_to_cpu (ohdr->bth[0 ]) >>20 ) &3 ; + pad =ib_bth_get_pad (ohdr);/* Check for invalid length. */ /* LAST len should be >= 1 */ if (unlikely (tlen < (hdrsize + pad +4 )))
@@ -528,7 +528,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) wc.wc_flags =IB_WC_WITH_IMM ;/* Get the number of bytes the message was padded by. */ - pad = (be32_to_cpu (ohdr->bth[0 ]) >>20 ) &3 ; + pad =ib_bth_get_pad (ohdr);/* Check for invalid length. */ /* LAST len should be >= 1 */ if (unlikely (tlen < (hdrsize + pad +4 )))
@@ -555,7 +555,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)case OP (RDMA_WRITE_LAST ): rdma_last:/* Get the number of bytes the message was padded by. */ - pad = (be32_to_cpu (ohdr->bth[0 ]) >>20 ) &3 ; + pad =ib_bth_get_pad (ohdr);/* Check for invalid length. */ /* LAST len should be >= 1 */ if (unlikely (tlen < (hdrsize + pad +4 )))
drivers/infiniband/hw/hfi1/ud.c +6 -8
@@ -688,18 +688,16 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) qkey =be32_to_cpu (ohdr->u.ud.deth[0 ]); src_qp =be32_to_cpu (ohdr->u.ud.deth[1 ]) &RVT_QPN_MASK ; - dlid =be16_to_cpu (hdr->lrh[1 ]); + dlid =ib_get_dlid (hdr); bth1 =be32_to_cpu (ohdr->bth[1 ]); - slid =be16_to_cpu (hdr->lrh[3 ]); - pkey = (u16 )be32_to_cpu (ohdr->bth[0 ]); - sl = (be16_to_cpu (hdr->lrh[0 ]) >>4 ) &0xf ; - extra_bytes = (be32_to_cpu (ohdr->bth[0 ]) >>20 ) &3 ; + slid =ib_get_slid (hdr); + pkey =ib_bth_get_pkey (ohdr); + opcode =ib_bth_get_opcode (ohdr); + sl =ib_get_sl (hdr); + extra_bytes =ib_bth_get_pad (ohdr); extra_bytes += (SIZE_OF_CRC <<2 ); sl_from_sc = ibp->sc_to_sl[sc5]; - opcode =be32_to_cpu (ohdr->bth[0 ]) >>24 ; - opcode &=0xff ; -process_ecn (qp, packet, (opcode !=IB_OPCODE_CNP ));/* * Get the number of bytes the message was padded by
drivers/infiniband/hw/hfi1/verbs.c +4 -4
@@ -571,7 +571,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)u16 lid;/* Check for GRH */ - lnh =be16_to_cpu (hdr->lrh[0 ]) &3 ; + lnh =ib_get_lnh (hdr);if (lnh ==HFI1_LRH_BTH ) { packet->ohdr = &hdr->u.oth; }else if (lnh ==HFI1_LRH_GRH ) {
@@ -590,12 +590,12 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)trace_input_ibhdr (rcd->dd, hdr); - opcode = (be32_to_cpu (packet->ohdr->bth[0 ]) >>24 ); + opcode =ib_bth_get_opcode (packet->ohdr);inc_opstats (tlen, &rcd->opstats->stats[opcode]);/* Get the destination QP number. */ qp_num =be32_to_cpu (packet->ohdr->bth[1 ]) &RVT_QPN_MASK ; - lid =be16_to_cpu (hdr->lrh[1 ]); + lid =ib_get_dlid (hdr);if (unlikely ((lid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) && (lid !=be16_to_cpu (IB_LID_PERMISSIVE )))) {struct rvt_mcast *mcast;
@@ -1230,7 +1230,7 @@ int hfi1_verbs_send(struct rvt_qp *qp, struct hfi1_pkt_state *ps) hdr = &ps->s_txreq->phdr.hdr;/* locate the pkey within the headers */ - lnh =be16_to_cpu (hdr->lrh[0 ]) &3 ; + lnh =ib_get_lnh (hdr);if (lnh ==HFI1_LRH_GRH ) ohdr = &hdr->u.l.oth;else
include/rdma/ib_hdrs.h +60 -0
64 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 v2 9/19 IB/hfi1: Use defines from common headers
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
Move FECN and BECN related defines to common header files
--- drivers/infiniband/hw/hfi1/common.h | 6 ------ drivers/infiniband/hw/hfi1/driver.c | 8 ++++---- drivers/infiniband/hw/hfi1/hfi.h | 4 ++-- drivers/infiniband/hw/hfi1/rc.c | 2 +- drivers/infiniband/hw/hfi1/ruc.c | 2 +- drivers/infiniband/hw/hfi1/trace_ibhdrs.h | 8 ++++---- drivers/infiniband/hw/hfi1/ud.c | 2 +- include/rdma/ib_hdrs.h | 6 ++++++ 8 files changed, 19 insertions(+), 19 deletions(-)
drivers/infiniband/hw/hfi1/common.h +0 -6
@@ -331,12 +331,6 @@ struct diag_pkt {#define FULL_MGMT_P_KEY 0xFFFF#define DEFAULT_P_KEY LIM_MGMT_P_KEY -#define HFI1_FECN_SHIFT 31 -#define HFI1_FECN_MASK 1 -#define HFI1_FECN_SMASK BIT(HFI1_FECN_SHIFT) -#define HFI1_BECN_SHIFT 30 -#define HFI1_BECN_MASK 1 -#define HFI1_BECN_SMASK BIT(HFI1_BECN_SHIFT)/** * 0xF8 - 4 bits of multicast range and 1 bit for collective range
drivers/infiniband/hw/hfi1/driver.c +4 -4
@@ -495,13 +495,13 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt, sc =hfi1_9B_get_sc5 (hdr, pkt->rhf); bth1 =be32_to_cpu (ohdr->bth[1 ]); -if (do_cnp && (bth1 &HFI1_FECN_SMASK )) { +if (do_cnp && (bth1 &IB_FECN_SMASK )) {u16 pkey = (u16 )be32_to_cpu (ohdr->bth[0 ]);return_cnp (ibp, qp, rqpn, pkey, dlid, rlid, sc, grh); } -if (!is_mcast && (bth1 &HFI1_BECN_SMASK )) { +if (!is_mcast && (bth1 &IB_BECN_SMASK )) {struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);u32 lqpn = bth1 &RVT_QPN_MASK ;u8 sl = ibp->sc_to_sl[sc];
@@ -634,7 +634,7 @@ static void __prescan_rxq(struct hfi1_packet *packet) } bth1 =be32_to_cpu (packet->ohdr->bth[1 ]); - is_ecn = !!(bth1 & (HFI1_FECN_SMASK |HFI1_BECN_SMASK )); + is_ecn = !!(bth1 & (IB_FECN_SMASK |IB_BECN_SMASK ));if (!is_ecn) goto next;
@@ -652,7 +652,7 @@ static void __prescan_rxq(struct hfi1_packet *packet)rcu_read_unlock ();/* turn off BECN, FECN */ - bth1 &= ~(HFI1_FECN_SMASK |HFI1_BECN_SMASK ); + bth1 &= ~(IB_FECN_SMASK |IB_BECN_SMASK ); packet->ohdr->bth[1 ] =cpu_to_be32 (bth1); next:update_ps_mdata (&mdata, rcd);
drivers/infiniband/hw/hfi1/hfi.h +2 -2
@@ -1597,9 +1597,9 @@ static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt,u32 bth1; bth1 =be32_to_cpu (ohdr->bth[1 ]); -if (unlikely (bth1 & (HFI1_BECN_SMASK |HFI1_FECN_SMASK ))) { +if (unlikely (bth1 & (IB_BECN_SMASK |IB_FECN_SMASK ))) {hfi1_process_ecn_slowpath (qp, pkt, do_cnp); -return bth1 &HFI1_FECN_SMASK ; +return bth1 &IB_FECN_SMASK ; }return false; }
drivers/infiniband/hw/hfi1/rc.c +1 -1
@@ -773,7 +773,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp, hdr.lrh[3 ] =cpu_to_be16 (ppd->lid | qp->remote_ah_attr.src_path_bits); ohdr->bth[0 ] =cpu_to_be32 (bth0); ohdr->bth[1 ] =cpu_to_be32 (qp->remote_qpn); - ohdr->bth[1 ] |=cpu_to_be32 ((!!is_fecn) <<HFI1_BECN_SHIFT ); + ohdr->bth[1 ] |=cpu_to_be32 ((!!is_fecn) <<IB_BECN_SHIFT ); ohdr->bth[2 ] =cpu_to_be32 (mask_psn (qp->r_ack_psn));/* Don't try to send ACKs if the link isn't ACTIVE */
drivers/infiniband/hw/hfi1/ruc.c +1 -1
@@ -775,7 +775,7 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr,if (qp->s_flags &RVT_S_ECN ) { qp->s_flags &= ~RVT_S_ECN ;/* we recently received a FECN, so return a BECN */ - bth1 |= (HFI1_BECN_MASK <<HFI1_BECN_SHIFT ); + bth1 |= (IB_BECN_MASK <<IB_BECN_SHIFT ); } ohdr->bth[1 ] =cpu_to_be32 (bth1); ohdr->bth[2 ] =cpu_to_be32 (bth2);
drivers/infiniband/hw/hfi1/trace_ibhdrs.h +4 -4
@@ -139,11 +139,11 @@ __entry->pkey =be32_to_cpu (ohdr->bth[0 ]) &0xffff ; __entry->f = - (be32_to_cpu (ohdr->bth[1 ]) >>HFI1_FECN_SHIFT ) & -HFI1_FECN_MASK ; + (be32_to_cpu (ohdr->bth[1 ]) >>IB_FECN_SHIFT ) & +IB_FECN_MASK ; __entry->b = - (be32_to_cpu (ohdr->bth[1 ]) >>HFI1_BECN_SHIFT ) & -HFI1_BECN_MASK ; + (be32_to_cpu (ohdr->bth[1 ]) >>IB_BECN_SHIFT ) & +IB_BECN_MASK ; __entry->qpn =be32_to_cpu (ohdr->bth[1 ]) &RVT_QPN_MASK ; __entry->a =
drivers/infiniband/hw/hfi1/ud.c +1 -1
@@ -537,7 +537,7 @@ void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, bth0 = pkey | (IB_OPCODE_CNP <<24 ); ohdr->bth[0 ] =cpu_to_be32 (bth0); - ohdr->bth[1 ] =cpu_to_be32 (remote_qpn | (1 <<HFI1_BECN_SHIFT )); + ohdr->bth[1 ] =cpu_to_be32 (remote_qpn | (1 <<IB_BECN_SHIFT )); ohdr->bth[2 ] =0 ;/* PSN 0 */ hdr.lrh[0 ] =cpu_to_be16 (lrh0);
include/rdma/ib_hdrs.h +6 -0
@@ -74,6 +74,12 @@#define IB_GRH_FLOW_MASK 0xFFFFF#define IB_GRH_FLOW_SHIFT 0#define IB_GRH_NEXT_HDR 0x1B +#define IB_FECN_SHIFT 31 +#define IB_FECN_MASK 1 +#define IB_FECN_SMASK BIT(IB_FECN_SHIFT) +#define IB_BECN_SHIFT 30 +#define IB_BECN_MASK 1 +#define IB_BECN_SMASK BIT(IB_BECN_SHIFT)#define IB_AETH_CREDIT_SHIFT 24#define IB_AETH_CREDIT_MASK 0x1F
--
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 v2 10/19 IB/hfi1: Prevent kernel QP post send hard lockups
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The driver progress routines can call cond_resched() when a timeslice is exhausted and irqs are enabled.
If the ULP had been holding a spin lock without disabling irqs and the post send directly called the progress routine, the cond_resched() could yield allowing another thread from the same ULP to deadlock on that same lock.
Correct by replacing the current hfi1_do_send() calldown with a unique one for post send and adding an argument to hfi1_do_send() to indicate
that the send engine is running in a thread. If the routine is not
running in a thread, avoid calling cond_resched().
--- drivers/infiniband/hw/hfi1/ruc.c | 26 ++++++++++++++++---------- drivers/infiniband/hw/hfi1/verbs.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs.h | 6 ++++-- 3 files changed, 22 insertions(+), 14 deletions(-)
drivers/infiniband/hw/hfi1/ruc.c +16 -10
@@ -1,5 +1,5 @@/* -* Copyright(c) 2015, 2016 Intel Corporation. +* Copyright(c) 2015 - 2017 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license.
@@ -784,23 +784,29 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr,/* when sending, force a reschedule every one of these periods */ #define SEND_RESCHED_TIMEOUT (5 * HZ)/* 5s in jiffies */ +void hfi1_do_send_from_rvt (struct rvt_qp *qp) +{ +hfi1_do_send (qp, false); +} +void _hfi1_do_send (struct work_struct *work) { struct iowait *wait = container_of(work, struct iowait, iowork);struct rvt_qp *qp =iowait_to_qp (wait); -hfi1_do_send (qp); +hfi1_do_send (qp, true); }/** * hfi1_do_send - perform a send on a QP * @work: contains a pointer to the QP +* @in_thread: true if in a workqueue thread * * Process entries in the send work queue until credit or queue is * exhausted. Only allow one CPU to send a packet per QP. * Otherwise, two threads could send packets out of order. */ -void hfi1_do_send (struct rvt_qp *qp) +void hfi1_do_send (struct rvt_qp *qp,bool in_thread) {struct hfi1_pkt_state ps;struct hfi1_qp_priv *priv = qp->priv;
@@ -868,8 +874,10 @@ void hfi1_do_send(struct rvt_qp *qp) qp->s_hdrwords =0 ;/* allow other tasks to run */ if (unlikely (time_after (jiffies, timeout))) { -if (workqueue_congested (cpu, - ps.ppd->hfi1_wq)) { +if (!in_thread || +workqueue_congested ( + cpu, + ps.ppd->hfi1_wq)) {spin_lock_irqsave ( &qp->s_lock, ps.flags);
@@ -882,11 +890,9 @@ void hfi1_do_send(struct rvt_qp *qp) *ps.ppd->dd->send_schedule);return ; } -if (!irqs_disabled ()) { -cond_resched (); -this_cpu_inc ( - *ps.ppd->dd->send_schedule); - } +cond_resched (); +this_cpu_inc ( + *ps.ppd->dd->send_schedule); timeout = jiffies + (timeout_int) /8 ; }spin_lock_irqsave (&qp->s_lock, ps.flags);
drivers/infiniband/hw/hfi1/verbs.c +2 -2
@@ -1,5 +1,5 @@/* -* Copyright(c) 2015, 2016 Intel Corporation. +* Copyright(c) 2015 - 2017 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license.
@@ -1816,7 +1816,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) dd->verbs_dev.rdi.driver_f.qp_priv_free = qp_priv_free; dd->verbs_dev.rdi.driver_f.free_all_qps = free_all_qps; dd->verbs_dev.rdi.driver_f.notify_qp_reset = notify_qp_reset; - dd->verbs_dev.rdi.driver_f.do_send = hfi1_do_send; + dd->verbs_dev.rdi.driver_f.do_send = hfi1_do_send_from_rvt; dd->verbs_dev.rdi.driver_f.schedule_send = hfi1_schedule_send; dd->verbs_dev.rdi.driver_f.schedule_send_no_lock = _hfi1_schedule_send; dd->verbs_dev.rdi.driver_f.get_pmtu_from_attr = get_pmtu_from_attr;
drivers/infiniband/hw/hfi1/verbs.h +4 -2
@@ -1,5 +1,5 @@/* -* Copyright(c) 2015, 2016 Intel Corporation. +* Copyright(c) 2015 - 2017 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license.
@@ -355,7 +355,9 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr,void _hfi1_do_send (struct work_struct *work); -void hfi1_do_send (struct rvt_qp *qp); +void hfi1_do_send_from_rvt (struct rvt_qp *qp); + +void hfi1_do_send (struct rvt_qp *qp,bool in_thread);void hfi1_send_complete (struct rvt_qp *qp,struct rvt_swqe *wqe,enum ib_wc_status status);
--
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 v2 11/19 IB/hfi1: Fix softlockup issue
In reply to a message not in the archiveFrom: Tadeusz Struk <[email protected]>
Soft lockups can occur because the mad processing on different CPUs acquire the spin lock dc8051_lock:
[534552.835870] [<ffffffffa026f993>] ? read_dev_port_cntr.isra.37+0x23/0x160 [hfi1] [534552.835880] [<ffffffffa02775af>] read_dev_cntr+0x4f/0x60 [hfi1] [534552.835893] [<ffffffffa028d7cd>] pma_get_opa_portstatus+0x64d/0x8c0 [hfi1] [534552.835904] [<ffffffffa0290e7d>] hfi1_process_mad+0x48d/0x18c0 [hfi1] [534552.835908] [<ffffffff811dc1f1>] ? __slab_free+0x81/0x2f0 [534552.835936] [<ffffffffa024c34e>] ? ib_mad_recv_done+0x21e/0xa30 [ib_core] [534552.835939] [<ffffffff811dd153>] ? __kmalloc+0x1f3/0x240 [534552.835947] [<ffffffffa024c3fb>] ib_mad_recv_done+0x2cb/0xa30 [ib_core] [534552.835955] [<ffffffffa0237c85>] __ib_process_cq+0x55/0xd0 [ib_core] [534552.835962] [<ffffffffa0237d70>] ib_cq_poll_work+0x20/0x60 [ib_core] [534552.835964] [<ffffffff810a7f3b>] process_one_work+0x17b/0x470 [534552.835966] [<ffffffff810a8d76>] worker_thread+0x126/0x410 [534552.835969] [<ffffffff810a8c50>] ? rescuer_thread+0x460/0x460 [534552.835971] [<ffffffff810b052f>] kthread+0xcf/0xe0 [534552.835974] [<ffffffff810b0460>] ? kthread_create_on_node+0x140/0x140 [534552.835977] [<ffffffff81696418>] ret_from_fork+0x58/0x90 [534552.835980] [<ffffffff810b0460>] ? kthread_create_on_node+0x140/0x140
This issue is made worse when the 8051 is busy and the reads take longer. Fix by using a non-spinning lock procure.
--- drivers/infiniband/hw/hfi1/chip.c | 86 ++++++++++++++++++++++--------------- drivers/infiniband/hw/hfi1/hfi.h | 7 ++- drivers/infiniband/hw/hfi1/init.c | 2 - 3 files changed, 57 insertions(+), 38 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +52 -34
@@ -6381,18 +6381,17 @@ static void lcb_shutdown(struct hfi1_devdata *dd, int abort)* * The expectation is that the caller of this routine would have taken * care of properly transitioning the link into the correct state. +* NOTE: the caller needs to acquire the dd->dc8051_lock lock +* before calling this function. */ -static void dc_shutdown (struct hfi1_devdata *dd) +static void _dc_shutdown (struct hfi1_devdata *dd) { -unsigned long flags; +lockdep_assert_held (&dd->dc8051_lock); -spin_lock_irqsave (&dd->dc8051_lock, flags); -if (dd->dc_shutdown) { -spin_unlock_irqrestore (&dd->dc8051_lock, flags); +if (dd->dc_shutdown)return ; - } + dd->dc_shutdown =1 ; -spin_unlock_irqrestore (&dd->dc8051_lock, flags);/* Shutdown the LCB */ lcb_shutdown (dd,1 );/*
@@ -6403,35 +6402,45 @@ static void dc_shutdown(struct hfi1_devdata *dd)write_csr (dd,DC_DC8051_CFG_RST ,0x1 ); } +static void dc_shutdown (struct hfi1_devdata *dd) +{ +mutex_lock (&dd->dc8051_lock); +_dc_shutdown (dd); +mutex_unlock (&dd->dc8051_lock); +} +/* * Calling this after the DC has been brought out of reset should not * do any damage. +* NOTE: the caller needs to acquire the dd->dc8051_lock lock +* before calling this function. */ -static void dc_start (struct hfi1_devdata *dd) +static void _dc_start (struct hfi1_devdata *dd) { -unsigned long flags; -int ret; +lockdep_assert_held (&dd->dc8051_lock); -spin_lock_irqsave (&dd->dc8051_lock, flags);if (!dd->dc_shutdown) - goto done; -spin_unlock_irqrestore (&dd->dc8051_lock, flags); +return ; +/* Take the 8051 out of reset */ write_csr (dd,DC_DC8051_CFG_RST ,0ull );/* Wait until 8051 is ready */ - ret =wait_fm_ready (dd,TIMEOUT_8051_START ); -if (ret) { +if (wait_fm_ready (dd,TIMEOUT_8051_START ))dd_dev_err (dd,"%s: timeout starting 8051 firmware\n" , __func__); - } +/* Take away reset for LCB and RX FPE (set in lcb_shutdown). */ write_csr (dd,DCC_CFG_RESET ,0x10 );/* lcb_shutdown() with abort=1 does not restore these */ write_csr (dd,DC_LCB_ERR_EN , dd->lcb_err_en); -spin_lock_irqsave (&dd->dc8051_lock, flags); dd->dc_shutdown =0 ; -done: -spin_unlock_irqrestore (&dd->dc8051_lock, flags); +} + +static void dc_start (struct hfi1_devdata *dd) +{ +mutex_lock (&dd->dc8051_lock); +_dc_start (dd); +mutex_unlock (&dd->dc8051_lock); }/*
@@ -8475,16 +8484,11 @@ static int do_8051_command( {u64 reg, completed;int return_code; -unsigned long flags;unsigned long timeout;hfi1_cdbg (DC8051 ,"type %d, data 0x%012llx" , type, in_data); -/* -* Alternative to holding the lock for a long time: -* - keep busy wait - have other users bounce off -*/ -spin_lock_irqsave (&dd->dc8051_lock, flags); +mutex_lock (&dd->dc8051_lock);/* We can't send any commands to the 8051 if it's in reset */ if (dd->dc_shutdown) {
@@ -8510,10 +8514,8 @@ static int do_8051_command( return_code = -ENXIO ; goto fail; } -spin_unlock_irqrestore (&dd->dc8051_lock, flags); -dc_shutdown (dd); -dc_start (dd); -spin_lock_irqsave (&dd->dc8051_lock, flags); +_dc_shutdown (dd); +_dc_start (dd); }/*
@@ -8594,8 +8596,7 @@ static int do_8051_command(write_csr (dd,DC_DC8051_CFG_HOST_CMD_0 ,0 ); fail: -spin_unlock_irqrestore (&dd->dc8051_lock, flags); - +mutex_unlock (&dd->dc8051_lock);return return_code; }
@@ -11969,6 +11970,10 @@ static void free_cntrs(struct hfi1_devdata *dd) dd->scntrs =NULL ;kfree (dd->cntrnames); dd->cntrnames =NULL ; +if (dd->update_cntr_wq) { +destroy_workqueue (dd->update_cntr_wq); + dd->update_cntr_wq =NULL ; + } } static u64 read_dev_port_cntr(struct hfi1_devdata *dd, struct cntr_entry *entry,
@@ -12124,7 +12129,7 @@ u64 write_port_cntr(struct hfi1_pportdata *ppd, int index, int vl, u64 data)return write_dev_port_cntr (ppd->dd, entry, sval, ppd, vl, data); } -static void update_synth_timer (unsigned long opaque) +static void do_update_synth_timer (struct work_struct *work) {u64 cur_tx;u64 cur_rx;
@@ -12133,8 +12138,8 @@ static void update_synth_timer(unsigned long opaque)int i, j, vl;struct hfi1_pportdata *ppd;struct cntr_entry *entry; - -struct hfi1_devdata *dd = (struct hfi1_devdata *)opaque; + struct hfi1_devdata *dd = container_of(work, struct hfi1_devdata, + update_cntr_work);/* * Rather than keep beating on the CSRs pick a minimal set that we can
@@ -12217,7 +12222,13 @@ static void update_synth_timer(unsigned long opaque) }else {hfi1_cdbg (CNTR ,"[%d] No update necessary" , dd->unit); } +} +static void update_synth_timer (unsigned long opaque) +{ +struct hfi1_devdata *dd = (struct hfi1_devdata *)opaque; + +queue_work (dd->update_cntr_wq, &dd->update_cntr_work);mod_timer (&dd->synth_stats_timer, jiffies +HZ *SYNTH_CNT_TIME ); }
@@ -12453,6 +12464,13 @@ static int init_cntrs(struct hfi1_devdata *dd)if (init_cpu_counters (dd)) goto bail; + dd->update_cntr_wq =alloc_ordered_workqueue ("hfi1_update_cntr_%d" , +WQ_MEM_RECLAIM , dd->unit); +if (!dd->update_cntr_wq) + goto bail; + +INIT_WORK (&dd->update_cntr_work, do_update_synth_timer); +mod_timer (&dd->synth_stats_timer, jiffies +HZ *SYNTH_CNT_TIME );return 0 ; bail:
drivers/infiniband/hw/hfi1/hfi.h +4 -3
@@ -474,7 +474,7 @@ struct hfi1_packet {#define HFI1_PART_ENFORCE_OUT 0x2/* how often we check for synthetic counter wrap around */ -#define SYNTH_CNT_TIME 2 +#define SYNTH_CNT_TIME 3/* Counter flags */ #define CNTR_NORMAL 0x0/* Normal counters, just read register */
@@ -926,8 +926,9 @@ struct hfi1_devdata {spinlock_t rcvctrl_lock;/* protect changes to RcvCtrl */ /* around rcd and (user ctxts) ctxt_cnt use (intr vs free) */ spinlock_t uctxt_lock;/* rcd and user context changes */ -/* exclusive access to 8051 */ -spinlock_t dc8051_lock; +struct mutex dc8051_lock;/* exclusive access to 8051 */ +struct workqueue_struct *update_cntr_wq; +struct work_struct update_cntr_work;/* exclusive access to 8051 memory */ spinlock_t dc8051_memlock;int dc8051_timed_out;/* remember if the 8051 timed out */
drivers/infiniband/hw/hfi1/init.c +1 -1
@@ -1078,11 +1078,11 @@ struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra)spin_lock_init (&dd->uctxt_lock);spin_lock_init (&dd->hfi1_diag_trans_lock);spin_lock_init (&dd->sc_init_lock); -spin_lock_init (&dd->dc8051_lock);spin_lock_init (&dd->dc8051_memlock);seqlock_init (&dd->sc2vl_lock);spin_lock_init (&dd->sde_map_lock);spin_lock_init (&dd->pio_map_lock); +mutex_init (&dd->dc8051_lock);init_waitqueue_head (&dd->event_queue); dd->int_counter =alloc_percpu (u64);
--
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 v2 12/19 IB/hfi1: Adjust high temperature warning for QSFP cable
In reply to a message not in the archiveFrom: Neel Desai <[email protected]>
When we receive a QSFP_HIGH_TEMP_ALARM or QSFP_HIGH_TEMP_WARNING interrupt, print a "QSFP cable temperature too high" message.
--- drivers/infiniband/hw/hfi1/chip.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +1 -1
@@ -9325,7 +9325,7 @@ static int handle_qsfp_error_conditions(struct hfi1_pportdata *ppd,if ((qsfp_interrupt_status[0 ] &QSFP_HIGH_TEMP_ALARM ) || (qsfp_interrupt_status[0 ] &QSFP_HIGH_TEMP_WARNING )) -dd_dev_info (dd,"%s: QSFP cable on fire\n" , +dd_dev_info (dd,"%s: QSFP cable temperature too high\n" , __func__); if ((qsfp_interrupt_status[0] & QSFP_LOW_TEMP_ALARM) ||
--
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 v2 13/19 IB/hfi1: Cache neighbor secure data after link up
In reply to a message not in the archiveFrom: Stuart Summers <[email protected]>
Secure data is transferred across the link during verify cap. This includes Neighbor Guid, Type, and Port Number. This transfer is not guaranteed to complete until the 8051 firmware has completed processing of the state_complete frame. Move the consumption of this data from verify cap handling to link up handling to ensure the data is finalized.
Additionally, do not notify the SM that the link is up until after this data is actually available.
--- drivers/infiniband/hw/hfi1/chip.c | 27 +-------------------------- drivers/infiniband/hw/hfi1/hfi.h | 11 ++++++++++- drivers/infiniband/hw/hfi1/intr.c | 27 ++++++++++++++++----------- 3 files changed, 27 insertions(+), 38 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +1 -26
@@ -7288,15 +7288,6 @@ void handle_verify_cap(struct work_struct *work)lcb_shutdown (dd,0 );adjust_lcb_for_fpga_serdes (dd); -/* -* These are now valid: -* remote VerifyCap fields in the general LNI config -* CSR DC8051_STS_REMOTE_GUID -* CSR DC8051_STS_REMOTE_NODE_TYPE -* CSR DC8051_STS_REMOTE_FM_SECURITY -* CSR DC8051_STS_REMOTE_PORT_NO -*/ -read_vc_remote_phy (dd, &power_management, &continious);read_vc_remote_fabric (dd, &vau, &z, &vcu, &vl15buf, &partner_supported_crc);
@@ -7427,20 +7418,6 @@ void handle_verify_cap(struct work_struct *work)write_csr (dd,DC_LCB_ERR_EN ,0 );/* mask LCB errors */ set_8051_lcb_access (dd); - ppd->neighbor_guid = -read_csr (dd,DC_DC8051_STS_REMOTE_GUID ); - ppd->neighbor_port_number =read_csr (dd,DC_DC8051_STS_REMOTE_PORT_NO ) & -DC_DC8051_STS_REMOTE_PORT_NO_VAL_SMASK ; - ppd->neighbor_type = -read_csr (dd,DC_DC8051_STS_REMOTE_NODE_TYPE ) & -DC_DC8051_STS_REMOTE_NODE_TYPE_VAL_MASK ; - ppd->neighbor_fm_security = -read_csr (dd,DC_DC8051_STS_REMOTE_FM_SECURITY ) & -DC_DC8051_STS_LOCAL_FM_SECURITY_DISABLED_MASK ; -dd_dev_info (dd, -"Neighbor Guid: %llx Neighbor type %d MgmtAllowed %d FM security bypass %d\n" , - ppd->neighbor_guid, ppd->neighbor_type, - ppd->mgmt_allowed, ppd->neighbor_fm_security);if (ppd->mgmt_allowed)add_full_mgmt_pkey (ppd);
@@ -10497,11 +10474,8 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state) goto unexpected; } - ppd->host_link_state =HLS_UP_INIT ; ret =wait_logical_linkstate (ppd,IB_PORT_INIT ,1000 );if (ret) { -/* logical state didn't change, stay at going_up */ - ppd->host_link_state =HLS_GOING_UP ;dd_dev_err (dd,"%s: logical state did not change to INIT\n" , __func__);
@@ -10515,6 +10489,7 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state)add_rcvctrl (dd,RCV_CTRL_RCV_PORT_ENABLE_SMASK );handle_linkup_change (dd,1 ); + ppd->host_link_state =HLS_UP_INIT ; }break ;case HLS_UP_ARMED :
drivers/infiniband/hw/hfi1/hfi.h +10 -1
@@ -1256,7 +1256,16 @@ void hfi1_init_pportdata(struct pci_dev *, struct hfi1_pportdata *,/* return the driver's idea of the logical OPA port state */ static inline u32 driver_lstate (struct hfi1_pportdata *ppd) { -return ppd->lstate;/* use the cached value */ +/* +* The driver does some processing from the time the logical +* link state is at INIT to the time the SM can be notified +* as such. Return IB_PORT_DOWN until the software state +* is ready. +*/ +if (ppd->lstate ==IB_PORT_INIT && !(ppd->host_link_state &HLS_UP )) +return IB_PORT_DOWN ; +else +return ppd->lstate; }void receive_interrupt_work (struct work_struct *work);
drivers/infiniband/hw/hfi1/intr.c +16 -11
@@ -131,19 +131,24 @@ void handle_linkup_change(struct hfi1_devdata *dd, u32 linkup)if (quick_linkup || dd->icode ==ICODE_FUNCTIONAL_SIMULATOR ) {set_up_vl15 (dd, dd->vau, dd->vl15_init);assign_remote_cm_au_table (dd, dd->vcu); - ppd->neighbor_guid = -read_csr (dd,DC_DC8051_STS_REMOTE_GUID ); - ppd->neighbor_type = -read_csr (dd,DC_DC8051_STS_REMOTE_NODE_TYPE ) & -DC_DC8051_STS_REMOTE_NODE_TYPE_VAL_MASK ; - ppd->neighbor_port_number = -read_csr (dd,DC_DC8051_STS_REMOTE_PORT_NO ) & -DC_DC8051_STS_REMOTE_PORT_NO_VAL_SMASK ; -dd_dev_info (dd,"Neighbor GUID: %llx Neighbor type %d\n" , - ppd->neighbor_guid, - ppd->neighbor_type); } + ppd->neighbor_guid = +read_csr (dd,DC_DC8051_STS_REMOTE_GUID ); + ppd->neighbor_type = +read_csr (dd,DC_DC8051_STS_REMOTE_NODE_TYPE ) & +DC_DC8051_STS_REMOTE_NODE_TYPE_VAL_MASK ; + ppd->neighbor_port_number = +read_csr (dd,DC_DC8051_STS_REMOTE_PORT_NO ) & +DC_DC8051_STS_REMOTE_PORT_NO_VAL_SMASK ; + ppd->neighbor_fm_security = +read_csr (dd,DC_DC8051_STS_REMOTE_FM_SECURITY ) & +DC_DC8051_STS_LOCAL_FM_SECURITY_DISABLED_MASK ; +dd_dev_info (dd, +"Neighbor Guid %llx, Type %d, Port Num %d\n" , + ppd->neighbor_guid, ppd->neighbor_type, + ppd->neighbor_port_number); +/* physical link went up */ ppd->linkup =1 ; ppd->offline_disabled_reason =
--
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 v2 14/19 IB/hfi1: Permanently enable P_Key checking in HFI
In reply to a message not in the archiveFrom: Neel Desai <[email protected]>
Ingress and egress port P_Key checking should always be performed for HFIs. This patch will enable ingress and egress P_Key checking when the port is initialized and will ignore the P_Key information sent by the FM in the port info structure which is meant to be used only by the switch.
--- drivers/infiniband/hw/hfi1/init.c | 3 +++ drivers/infiniband/hw/hfi1/mad.c | 10 ---------- 2 files changed, 3 insertions(+), 10 deletions(-)
drivers/infiniband/hw/hfi1/init.c +3 -0
@@ -482,6 +482,9 @@ void hfi1_init_pportdata(struct pci_dev *pdev, struct hfi1_pportdata *ppd, default_pkey_idx =1 ; ppd->pkeys[default_pkey_idx] =DEFAULT_P_KEY ; + ppd->part_enforce |=HFI1_PART_ENFORCE_IN ; + ppd->part_enforce |=HFI1_PART_ENFORCE_OUT ; +if (loopback) { hfi1_early_err(&pdev->dev, "Faking data partition 0x8001 in idx %u\n",
drivers/infiniband/hw/hfi1/mad.c +0 -10
@@ -1151,16 +1151,6 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ppd->linkinit_reason = (pi->partenforce_filterraw &OPA_PI_MASK_LINKINIT_REASON ); -/* enable/disable SW pkey checking as per FM control */ -if (pi->partenforce_filterraw &OPA_PI_MASK_PARTITION_ENFORCE_IN ) - ppd->part_enforce |=HFI1_PART_ENFORCE_IN ; -else - ppd->part_enforce &= ~HFI1_PART_ENFORCE_IN ; - -if (pi->partenforce_filterraw &OPA_PI_MASK_PARTITION_ENFORCE_OUT ) - ppd->part_enforce |=HFI1_PART_ENFORCE_OUT ; -else - ppd->part_enforce &= ~HFI1_PART_ENFORCE_OUT ;/* Must be a valid unicast LID address. */ if ((smlid == 0 && ls_old > IB_PORT_INIT) ||
--
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 v2 15/19 IB/hfi1: Fix misspelling in comment
In reply to a message not in the archiveCheckpatch flagged a misspelled word. Fix it.
--- drivers/infiniband/hw/hfi1/chip.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +1 -1
@@ -7088,7 +7088,7 @@ static void add_full_mgmt_pkey(struct hfi1_pportdata *ppd) {struct hfi1_devdata *dd = ppd->dd; -/* Sanity check - ppd->pkeys[2] should be 0, or already initalized */ +/* Sanity check - ppd->pkeys[2] should be 0, or already initialized */ if (!((ppd->pkeys[2 ] ==0 ) || (ppd->pkeys[2 ] ==FULL_MGMT_P_KEY )))dd_dev_warn (dd,"%s pkey[2] already set to 0x%x, resetting it to 0x%x\n" , __func__, ppd->pkeys[2 ],FULL_MGMT_P_KEY );
--
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 v2 16/19 IB/hfi1: Convert %Lx to %llx
In reply to a message not in the archiveAccording to checkpatch %Lx is not standard C so remove it and use the suggested %llx.
--- drivers/infiniband/hw/hfi1/pcie.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/pcie.c +1 -1
@@ -583,7 +583,7 @@ static void tune_pcie_caps(struct hfi1_devdata *dd)if (words == ~0ULL ) ret =PCI_ERS_RESULT_NEED_RESET ;dd_dev_info (dd, -"HFI1 mmio_enabled function called, read wordscntr %Lx, returning %d\n" , +"HFI1 mmio_enabled function called, read wordscntr %llx, returning %d\n" , words, ret); }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 v2 17/19 IB/hfi1: Fix unbalanced braces around else
In reply to a message not in the archiveAdd missing braces around else blocks in a few places to make checkpatch happy.
--- drivers/infiniband/hw/hfi1/chip.c | 4 ++-- drivers/infiniband/hw/hfi1/init.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +2 -2
@@ -8147,10 +8147,10 @@ static irqreturn_t sdma_interrupt(int irq, void *data)/* handle the interrupt(s) */ sdma_engine_interrupt (sde, status); - }else + }else {dd_dev_err (dd,"SDMA engine %u interrupt, but no status bits set\n" , sde->this_idx); - + }return IRQ_HANDLED ; }
drivers/infiniband/hw/hfi1/init.c +4 -2
@@ -245,9 +245,10 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt,if (ctxt < kctxt_ngroups) { base = ctxt * (dd->rcv_entries.ngroups +1 ); rcd->rcv_array_groups++; - }else + }else { base = kctxt_ngroups + (ctxt * dd->rcv_entries.ngroups); + } }else {u16 ct = ctxt - dd->first_user_ctxt;
@@ -256,9 +257,10 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt,if (ct < dd->rcv_entries.nctxt_extra) { base += ct * (dd->rcv_entries.ngroups +1 ); rcd->rcv_array_groups++; - }else + }else { base += dd->rcv_entries.nctxt_extra + (ct * dd->rcv_entries.ngroups); + } } rcd->eager_base = base * dd->rcv_entries.group_size;
--
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 v2 18/19 IB/hfi: Protect against writable mmap
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
The device/port status is not intended to be changed from user space. Prevent a user from mapping them as write or execute.
--- drivers/infiniband/hw/hfi1/file_ops.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/infiniband/hw/hfi1/file_ops.c +4 -0
@@ -597,6 +597,10 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) vmf =1 ;break ;case STATUS : +if (flags & (unsigned long )(VM_WRITE |VM_EXEC )) { + ret = -EPERM ; + goto done; + } memaddr =kvirt_to_phys ((void *)dd->status); memlen =PAGE_SIZE ; flags |=VM_IO |VM_DONTEXPAND ;
--
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 v2 3/19 IB/core: For multicast functions, verify that LIDs are multicast LIDs
In reply to Dennis DalessandroFrom: Michael J. Ruhl <[email protected]>
The Infiniband spec defines "A multicast address is defined by a MGID and a MLID" (section 10.5). Currently the MLID value is not validated.
Add check to verify that the MLID value is in the correct address range.
--- drivers/infiniband/core/verbs.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/core/verbs.c +6 -2
@@ -1519,7 +1519,9 @@ int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)if (!qp->device->attach_mcast)return -ENOSYS ; -if (gid->raw[0 ] !=0xff || qp->qp_type !=IB_QPT_UD ) +if (gid->raw[0 ] !=0xff || qp->qp_type !=IB_QPT_UD || + lid <be16_to_cpu (IB_MULTICAST_LID_BASE ) || + lid ==be16_to_cpu (IB_LID_PERMISSIVE ))return -EINVAL ; ret = qp->device->attach_mcast (qp, gid, lid);
@@ -1535,7 +1537,9 @@ int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)if (!qp->device->detach_mcast)return -ENOSYS ; -if (gid->raw[0 ] !=0xff || qp->qp_type !=IB_QPT_UD ) +if (gid->raw[0 ] !=0xff || qp->qp_type !=IB_QPT_UD || + lid <be16_to_cpu (IB_MULTICAST_LID_BASE ) || + lid ==be16_to_cpu (IB_LID_PERMISSIVE ))return -EINVAL ; ret = qp->device->detach_mcast (qp, gid, lid);
PATCH v2 19/19 IB/hfi1: Use bool in process_ecn
In reply to Dennis DalessandroThe process_ecn intends to return a bool value. However it is doing so incorrectly by ANDing the fecn mask. The fecn bit is bit 31. Bool is not a native data type and is up to the compiler to implement how it sees fit. It is conceivable that this upper bit gets washed out.
Fix by converting to a bool properly.
--- drivers/infiniband/hw/hfi1/hfi.h | 2 +- drivers/infiniband/hw/hfi1/rc.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/hfi.h +1 -1
@@ -1609,7 +1609,7 @@ static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt, bth1 =be32_to_cpu (ohdr->bth[1 ]);if (unlikely (bth1 & (IB_BECN_SMASK |IB_FECN_SMASK ))) {hfi1_process_ecn_slowpath (qp, pkt, do_cnp); -return bth1 &IB_FECN_SMASK ; +return !!(bth1 &IB_FECN_SMASK ); }return false; }
drivers/infiniband/hw/hfi1/rc.c +2 -1
@@ -1930,7 +1930,8 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)int diff;struct ib_reth *reth;unsigned long flags; -int ret, is_fecn =0 ; +int ret; +bool is_fecn = false;bool copy_last = false;u32 rkey;