Commit 48fa57ac authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'infiniband-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband

infiniband changes for 3.3 merge window

* tag 'infiniband-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
  rdma/core: Fix sparse warnings
  RDMA/cma: Fix endianness bugs
  RDMA/nes: Fix terminate during AE
  RDMA/nes: Make unnecessarily global nes_set_pau() static
  RDMA/nes: Change MDIO bus clock to 2.5MHz
  IB/cm: Fix layout of APR message
  IB/mlx4: Fix SL to 802.1Q priority-bits mapping for IBoE
  IB/qib: Default some module parameters optimally
  IB/qib: Optimize locking for get_txreq()
  IB/qib: Fix a possible data corruption when receiving packets
  IB/qib: Eliminate 64-bit jiffies use
  IB/qib: Fix style issues
  IB/uverbs: Protect QP multicast list
parents 8e369672 1583676d
...@@ -799,6 +799,7 @@ struct cm_apr_msg { ...@@ -799,6 +799,7 @@ struct cm_apr_msg {
u8 info_length; u8 info_length;
u8 ap_status; u8 ap_status;
__be16 rsvd;
u8 info[IB_CM_APR_INFO_LENGTH]; u8 info[IB_CM_APR_INFO_LENGTH];
u8 private_data[IB_CM_APR_PRIVATE_DATA_SIZE]; u8 private_data[IB_CM_APR_PRIVATE_DATA_SIZE];
......
...@@ -1110,7 +1110,7 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id, ...@@ -1110,7 +1110,7 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
if (cma_any_addr((struct sockaddr *) &rt->addr.src_addr)) { if (cma_any_addr((struct sockaddr *) &rt->addr.src_addr)) {
rt->addr.dev_addr.dev_type = ARPHRD_INFINIBAND; rt->addr.dev_addr.dev_type = ARPHRD_INFINIBAND;
rdma_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid); rdma_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid);
ib_addr_set_pkey(&rt->addr.dev_addr, rt->path_rec[0].pkey); ib_addr_set_pkey(&rt->addr.dev_addr, be16_to_cpu(rt->path_rec[0].pkey));
} else { } else {
ret = rdma_translate_ip((struct sockaddr *) &rt->addr.src_addr, ret = rdma_translate_ip((struct sockaddr *) &rt->addr.src_addr,
&rt->addr.dev_addr); &rt->addr.dev_addr);
...@@ -2926,7 +2926,7 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast) ...@@ -2926,7 +2926,7 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast)
mutex_lock(&id_priv->qp_mutex); mutex_lock(&id_priv->qp_mutex);
if (!status && id_priv->id.qp) if (!status && id_priv->id.qp)
status = ib_attach_mcast(id_priv->id.qp, &multicast->rec.mgid, status = ib_attach_mcast(id_priv->id.qp, &multicast->rec.mgid,
multicast->rec.mlid); be16_to_cpu(multicast->rec.mlid));
mutex_unlock(&id_priv->qp_mutex); mutex_unlock(&id_priv->qp_mutex);
memset(&event, 0, sizeof event); memset(&event, 0, sizeof event);
...@@ -3187,7 +3187,7 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr) ...@@ -3187,7 +3187,7 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr)
if (id->qp) if (id->qp)
ib_detach_mcast(id->qp, ib_detach_mcast(id->qp,
&mc->multicast.ib->rec.mgid, &mc->multicast.ib->rec.mgid,
mc->multicast.ib->rec.mlid); be16_to_cpu(mc->multicast.ib->rec.mlid));
if (rdma_node_get_transport(id_priv->cma_dev->device->node_type) == RDMA_TRANSPORT_IB) { if (rdma_node_get_transport(id_priv->cma_dev->device->node_type) == RDMA_TRANSPORT_IB) {
switch (rdma_port_get_link_layer(id->device, id->port_num)) { switch (rdma_port_get_link_layer(id->device, id->port_num)) {
case IB_LINK_LAYER_INFINIBAND: case IB_LINK_LAYER_INFINIBAND:
......
...@@ -106,9 +106,6 @@ enum { ...@@ -106,9 +106,6 @@ enum {
IB_UCM_MAX_DEVICES = 32 IB_UCM_MAX_DEVICES = 32
}; };
/* ib_cm and ib_user_cm modules share /sys/class/infiniband_cm */
extern struct class cm_class;
#define IB_UCM_BASE_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_BASE_MINOR) #define IB_UCM_BASE_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_BASE_MINOR)
static void ib_ucm_add_one(struct ib_device *device); static void ib_ucm_add_one(struct ib_device *device);
......
...@@ -241,11 +241,24 @@ static struct ib_qp *idr_read_qp(int qp_handle, struct ib_ucontext *context) ...@@ -241,11 +241,24 @@ static struct ib_qp *idr_read_qp(int qp_handle, struct ib_ucontext *context)
return idr_read_obj(&ib_uverbs_qp_idr, qp_handle, context, 0); return idr_read_obj(&ib_uverbs_qp_idr, qp_handle, context, 0);
} }
static struct ib_qp *idr_write_qp(int qp_handle, struct ib_ucontext *context)
{
struct ib_uobject *uobj;
uobj = idr_write_uobj(&ib_uverbs_qp_idr, qp_handle, context);
return uobj ? uobj->object : NULL;
}
static void put_qp_read(struct ib_qp *qp) static void put_qp_read(struct ib_qp *qp)
{ {
put_uobj_read(qp->uobject); put_uobj_read(qp->uobject);
} }
static void put_qp_write(struct ib_qp *qp)
{
put_uobj_write(qp->uobject);
}
static struct ib_srq *idr_read_srq(int srq_handle, struct ib_ucontext *context) static struct ib_srq *idr_read_srq(int srq_handle, struct ib_ucontext *context)
{ {
return idr_read_obj(&ib_uverbs_srq_idr, srq_handle, context, 0); return idr_read_obj(&ib_uverbs_srq_idr, srq_handle, context, 0);
...@@ -2375,7 +2388,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file, ...@@ -2375,7 +2388,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file,
if (copy_from_user(&cmd, buf, sizeof cmd)) if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT; return -EFAULT;
qp = idr_read_qp(cmd.qp_handle, file->ucontext); qp = idr_write_qp(cmd.qp_handle, file->ucontext);
if (!qp) if (!qp)
return -EINVAL; return -EINVAL;
...@@ -2404,7 +2417,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file, ...@@ -2404,7 +2417,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file,
kfree(mcast); kfree(mcast);
out_put: out_put:
put_qp_read(qp); put_qp_write(qp);
return ret ? ret : in_len; return ret ? ret : in_len;
} }
...@@ -2422,7 +2435,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file, ...@@ -2422,7 +2435,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
if (copy_from_user(&cmd, buf, sizeof cmd)) if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT; return -EFAULT;
qp = idr_read_qp(cmd.qp_handle, file->ucontext); qp = idr_write_qp(cmd.qp_handle, file->ucontext);
if (!qp) if (!qp)
return -EINVAL; return -EINVAL;
...@@ -2441,14 +2454,14 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file, ...@@ -2441,14 +2454,14 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
} }
out_put: out_put:
put_qp_read(qp); put_qp_write(qp);
return ret ? ret : in_len; return ret ? ret : in_len;
} }
int __uverbs_create_xsrq(struct ib_uverbs_file *file, static int __uverbs_create_xsrq(struct ib_uverbs_file *file,
struct ib_uverbs_create_xsrq *cmd, struct ib_uverbs_create_xsrq *cmd,
struct ib_udata *udata) struct ib_udata *udata)
{ {
struct ib_uverbs_create_srq_resp resp; struct ib_uverbs_create_srq_resp resp;
struct ib_usrq_object *obj; struct ib_usrq_object *obj;
......
...@@ -126,7 +126,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr ...@@ -126,7 +126,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr
ah->av.ib.dlid = cpu_to_be16(0xc000); ah->av.ib.dlid = cpu_to_be16(0xc000);
memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16); memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16);
ah->av.eth.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28); ah->av.eth.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 29);
return &ah->ibah; return &ah->ibah;
} }
......
...@@ -715,13 +715,17 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, ...@@ -715,13 +715,17 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
} }
wc->slid = be16_to_cpu(cqe->rlid); wc->slid = be16_to_cpu(cqe->rlid);
wc->sl = be16_to_cpu(cqe->sl_vid) >> 12;
g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn); g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn);
wc->src_qp = g_mlpath_rqpn & 0xffffff; wc->src_qp = g_mlpath_rqpn & 0xffffff;
wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f;
wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IB_WC_GRH : 0; wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IB_WC_GRH : 0;
wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f; wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f;
wc->csum_ok = mlx4_ib_ipoib_csum_ok(cqe->status, cqe->checksum); wc->csum_ok = mlx4_ib_ipoib_csum_ok(cqe->status, cqe->checksum);
if (rdma_port_get_link_layer(wc->qp->device,
(*cur_qp)->port) == IB_LINK_LAYER_ETHERNET)
wc->sl = be16_to_cpu(cqe->sl_vid) >> 13;
else
wc->sl = be16_to_cpu(cqe->sl_vid) >> 12;
} }
return 0; return 0;
......
...@@ -962,7 +962,7 @@ static int mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_ah_attr *ah, ...@@ -962,7 +962,7 @@ static int mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_ah_attr *ah,
if (is_eth) { if (is_eth) {
path->sched_queue = MLX4_IB_DEFAULT_SCHED_QUEUE | path->sched_queue = MLX4_IB_DEFAULT_SCHED_QUEUE |
((port - 1) << 6) | ((ah->sl & 7) << 3) | ((ah->sl & 8) >> 1); ((port - 1) << 6) | ((ah->sl & 7) << 3);
if (!(ah->ah_flags & IB_AH_GRH)) if (!(ah->ah_flags & IB_AH_GRH))
return -1; return -1;
...@@ -1437,7 +1437,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, ...@@ -1437,7 +1437,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr,
u16 pcp; u16 pcp;
sqp->ud_header.vlan.type = cpu_to_be16(MLX4_IB_IBOE_ETHERTYPE); sqp->ud_header.vlan.type = cpu_to_be16(MLX4_IB_IBOE_ETHERTYPE);
pcp = (be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 27 & 3) << 13; pcp = (be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 29) << 13;
sqp->ud_header.vlan.tag = cpu_to_be16(vlan | pcp); sqp->ud_header.vlan.tag = cpu_to_be16(vlan | pcp);
} }
} else { } else {
......
...@@ -2834,6 +2834,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp) ...@@ -2834,6 +2834,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
issue_disconn = 1; issue_disconn = 1;
issue_close = 1; issue_close = 1;
nesqp->cm_id = NULL; nesqp->cm_id = NULL;
del_timer(&nesqp->terminate_timer);
if (nesqp->flush_issued == 0) { if (nesqp->flush_issued == 0) {
nesqp->flush_issued = 1; nesqp->flush_issued = 1;
issue_flush = 1; issue_flush = 1;
......
...@@ -1529,7 +1529,7 @@ int nes_init_phy(struct nes_device *nesdev) ...@@ -1529,7 +1529,7 @@ int nes_init_phy(struct nes_device *nesdev)
} else { } else {
/* setup 10G MDIO operation */ /* setup 10G MDIO operation */
tx_config &= 0xFFFFFFE3; tx_config &= 0xFFFFFFE3;
tx_config |= 0x15; tx_config |= 0x1D;
} }
nes_write_indexed(nesdev, NES_IDX_MAC_TX_CONFIG, tx_config); nes_write_indexed(nesdev, NES_IDX_MAC_TX_CONFIG, tx_config);
...@@ -3619,10 +3619,6 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, ...@@ -3619,10 +3619,6 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev,
} }
break; break;
case NES_AEQE_AEID_LLP_CLOSE_COMPLETE: case NES_AEQE_AEID_LLP_CLOSE_COMPLETE:
if (nesqp->term_flags) {
nes_terminate_done(nesqp, 0);
return;
}
spin_lock_irqsave(&nesqp->lock, flags); spin_lock_irqsave(&nesqp->lock, flags);
nesqp->hw_iwarp_state = iwarp_state; nesqp->hw_iwarp_state = iwarp_state;
nesqp->hw_tcp_state = tcp_state; nesqp->hw_tcp_state = tcp_state;
......
...@@ -56,7 +56,7 @@ static u16 nes_read16_eeprom(void __iomem *addr, u16 offset); ...@@ -56,7 +56,7 @@ static u16 nes_read16_eeprom(void __iomem *addr, u16 offset);
u32 mh_detected; u32 mh_detected;
u32 mh_pauses_sent; u32 mh_pauses_sent;
u32 nes_set_pau(struct nes_device *nesdev) static u32 nes_set_pau(struct nes_device *nesdev)
{ {
u32 ret = 0; u32 ret = 0;
u32 counter; u32 counter;
......
...@@ -97,7 +97,7 @@ struct qib_chippport_specific { ...@@ -97,7 +97,7 @@ struct qib_chippport_specific {
u64 iblnkerrsnap; u64 iblnkerrsnap;
u64 ibcctrl; /* kr_ibcctrl shadow */ u64 ibcctrl; /* kr_ibcctrl shadow */
u64 ibcddrctrl; /* kr_ibcddrctrl shadow */ u64 ibcddrctrl; /* kr_ibcddrctrl shadow */
u64 chase_end; unsigned long chase_end;
u32 last_delay_mult; u32 last_delay_mult;
}; };
......
...@@ -371,9 +371,8 @@ static u32 qib_rcv_hdrerr(struct qib_ctxtdata *rcd, struct qib_pportdata *ppd, ...@@ -371,9 +371,8 @@ static u32 qib_rcv_hdrerr(struct qib_ctxtdata *rcd, struct qib_pportdata *ppd,
lnh == QIB_LRH_GRH, lnh == QIB_LRH_GRH,
qp, qp,
be32_to_cpu(ohdr->bth[0])); be32_to_cpu(ohdr->bth[0]));
if (ruc_res) { if (ruc_res)
goto unlock; goto unlock;
}
/* Only deal with RDMA Writes for now */ /* Only deal with RDMA Writes for now */
if (opcode < if (opcode <
......
...@@ -2076,9 +2076,11 @@ static void qib_6120_config_ctxts(struct qib_devdata *dd) ...@@ -2076,9 +2076,11 @@ static void qib_6120_config_ctxts(struct qib_devdata *dd)
static void qib_update_6120_usrhead(struct qib_ctxtdata *rcd, u64 hd, static void qib_update_6120_usrhead(struct qib_ctxtdata *rcd, u64 hd,
u32 updegr, u32 egrhd, u32 npkts) u32 updegr, u32 egrhd, u32 npkts)
{ {
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
if (updegr) if (updegr)
qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt); qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
mmiowb();
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
mmiowb();
} }
static u32 qib_6120_hdrqempty(struct qib_ctxtdata *rcd) static u32 qib_6120_hdrqempty(struct qib_ctxtdata *rcd)
......
...@@ -1051,7 +1051,7 @@ static void reenable_7220_chase(unsigned long opaque) ...@@ -1051,7 +1051,7 @@ static void reenable_7220_chase(unsigned long opaque)
static void handle_7220_chase(struct qib_pportdata *ppd, u64 ibcst) static void handle_7220_chase(struct qib_pportdata *ppd, u64 ibcst)
{ {
u8 ibclt; u8 ibclt;
u64 tnow; unsigned long tnow;
ibclt = (u8)SYM_FIELD(ibcst, IBCStatus, LinkTrainingState); ibclt = (u8)SYM_FIELD(ibcst, IBCStatus, LinkTrainingState);
...@@ -1066,9 +1066,9 @@ static void handle_7220_chase(struct qib_pportdata *ppd, u64 ibcst) ...@@ -1066,9 +1066,9 @@ static void handle_7220_chase(struct qib_pportdata *ppd, u64 ibcst)
case IB_7220_LT_STATE_CFGWAITRMT: case IB_7220_LT_STATE_CFGWAITRMT:
case IB_7220_LT_STATE_TXREVLANES: case IB_7220_LT_STATE_TXREVLANES:
case IB_7220_LT_STATE_CFGENH: case IB_7220_LT_STATE_CFGENH:
tnow = get_jiffies_64(); tnow = jiffies;
if (ppd->cpspec->chase_end && if (ppd->cpspec->chase_end &&
time_after64(tnow, ppd->cpspec->chase_end)) { time_after(tnow, ppd->cpspec->chase_end)) {
ppd->cpspec->chase_end = 0; ppd->cpspec->chase_end = 0;
qib_set_ib_7220_lstate(ppd, qib_set_ib_7220_lstate(ppd,
QLOGIC_IB_IBCC_LINKCMD_DOWN, QLOGIC_IB_IBCC_LINKCMD_DOWN,
...@@ -2725,9 +2725,11 @@ static int qib_7220_set_loopback(struct qib_pportdata *ppd, const char *what) ...@@ -2725,9 +2725,11 @@ static int qib_7220_set_loopback(struct qib_pportdata *ppd, const char *what)
static void qib_update_7220_usrhead(struct qib_ctxtdata *rcd, u64 hd, static void qib_update_7220_usrhead(struct qib_ctxtdata *rcd, u64 hd,
u32 updegr, u32 egrhd, u32 npkts) u32 updegr, u32 egrhd, u32 npkts)
{ {
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
if (updegr) if (updegr)
qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt); qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
mmiowb();
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
mmiowb();
} }
static u32 qib_7220_hdrqempty(struct qib_ctxtdata *rcd) static u32 qib_7220_hdrqempty(struct qib_ctxtdata *rcd)
......
...@@ -615,8 +615,8 @@ struct qib_chippport_specific { ...@@ -615,8 +615,8 @@ struct qib_chippport_specific {
u64 ibmalfsnap; u64 ibmalfsnap;
u64 ibcctrl_a; /* krp_ibcctrl_a shadow */ u64 ibcctrl_a; /* krp_ibcctrl_a shadow */
u64 ibcctrl_b; /* krp_ibcctrl_b shadow */ u64 ibcctrl_b; /* krp_ibcctrl_b shadow */
u64 qdr_dfe_time; unsigned long qdr_dfe_time;
u64 chase_end; unsigned long chase_end;
u32 autoneg_tries; u32 autoneg_tries;
u32 recovery_init; u32 recovery_init;
u32 qdr_dfe_on; u32 qdr_dfe_on;
...@@ -1672,7 +1672,8 @@ static void reenable_chase(unsigned long opaque) ...@@ -1672,7 +1672,8 @@ static void reenable_chase(unsigned long opaque)
QLOGIC_IB_IBCC_LINKINITCMD_POLL); QLOGIC_IB_IBCC_LINKINITCMD_POLL);
} }
static void disable_chase(struct qib_pportdata *ppd, u64 tnow, u8 ibclt) static void disable_chase(struct qib_pportdata *ppd, unsigned long tnow,
u8 ibclt)
{ {
ppd->cpspec->chase_end = 0; ppd->cpspec->chase_end = 0;
...@@ -1688,7 +1689,7 @@ static void disable_chase(struct qib_pportdata *ppd, u64 tnow, u8 ibclt) ...@@ -1688,7 +1689,7 @@ static void disable_chase(struct qib_pportdata *ppd, u64 tnow, u8 ibclt)
static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst) static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst)
{ {
u8 ibclt; u8 ibclt;
u64 tnow; unsigned long tnow;
ibclt = (u8)SYM_FIELD(ibcst, IBCStatusA_0, LinkTrainingState); ibclt = (u8)SYM_FIELD(ibcst, IBCStatusA_0, LinkTrainingState);
...@@ -1703,9 +1704,9 @@ static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst) ...@@ -1703,9 +1704,9 @@ static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst)
case IB_7322_LT_STATE_CFGWAITRMT: case IB_7322_LT_STATE_CFGWAITRMT:
case IB_7322_LT_STATE_TXREVLANES: case IB_7322_LT_STATE_TXREVLANES:
case IB_7322_LT_STATE_CFGENH: case IB_7322_LT_STATE_CFGENH:
tnow = get_jiffies_64(); tnow = jiffies;
if (ppd->cpspec->chase_end && if (ppd->cpspec->chase_end &&
time_after64(tnow, ppd->cpspec->chase_end)) time_after(tnow, ppd->cpspec->chase_end))
disable_chase(ppd, tnow, ibclt); disable_chase(ppd, tnow, ibclt);
else if (!ppd->cpspec->chase_end) else if (!ppd->cpspec->chase_end)
ppd->cpspec->chase_end = tnow + QIB_CHASE_TIME; ppd->cpspec->chase_end = tnow + QIB_CHASE_TIME;
...@@ -2714,7 +2715,7 @@ static noinline void unknown_7322_gpio_intr(struct qib_devdata *dd) ...@@ -2714,7 +2715,7 @@ static noinline void unknown_7322_gpio_intr(struct qib_devdata *dd)
pins >>= SYM_LSB(EXTStatus, GPIOIn); pins >>= SYM_LSB(EXTStatus, GPIOIn);
if (!(pins & mask)) { if (!(pins & mask)) {
++handled; ++handled;
qd->t_insert = get_jiffies_64(); qd->t_insert = jiffies;
queue_work(ib_wq, &qd->work); queue_work(ib_wq, &qd->work);
} }
} }
...@@ -3602,7 +3603,7 @@ static void qib_7322_config_ctxts(struct qib_devdata *dd) ...@@ -3602,7 +3603,7 @@ static void qib_7322_config_ctxts(struct qib_devdata *dd)
if (qib_rcvhdrcnt) if (qib_rcvhdrcnt)
dd->rcvhdrcnt = max(dd->cspec->rcvegrcnt, qib_rcvhdrcnt); dd->rcvhdrcnt = max(dd->cspec->rcvegrcnt, qib_rcvhdrcnt);
else else
dd->rcvhdrcnt = max(dd->cspec->rcvegrcnt, dd->rcvhdrcnt = 2 * max(dd->cspec->rcvegrcnt,
dd->num_pports > 1 ? 1024U : 2048U); dd->num_pports > 1 ? 1024U : 2048U);
} }
...@@ -4082,10 +4083,12 @@ static void qib_update_7322_usrhead(struct qib_ctxtdata *rcd, u64 hd, ...@@ -4082,10 +4083,12 @@ static void qib_update_7322_usrhead(struct qib_ctxtdata *rcd, u64 hd,
*/ */
if (hd >> IBA7322_HDRHEAD_PKTINT_SHIFT) if (hd >> IBA7322_HDRHEAD_PKTINT_SHIFT)
adjust_rcv_timeout(rcd, npkts); adjust_rcv_timeout(rcd, npkts);
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
if (updegr) if (updegr)
qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt); qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
mmiowb();
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
mmiowb();
} }
static u32 qib_7322_hdrqempty(struct qib_ctxtdata *rcd) static u32 qib_7322_hdrqempty(struct qib_ctxtdata *rcd)
...@@ -4794,7 +4797,7 @@ static void qib_get_7322_faststats(unsigned long opaque) ...@@ -4794,7 +4797,7 @@ static void qib_get_7322_faststats(unsigned long opaque)
(ppd->lflags & (QIBL_LINKINIT | QIBL_LINKARMED | (ppd->lflags & (QIBL_LINKINIT | QIBL_LINKARMED |
QIBL_LINKACTIVE)) && QIBL_LINKACTIVE)) &&
ppd->cpspec->qdr_dfe_time && ppd->cpspec->qdr_dfe_time &&
time_after64(get_jiffies_64(), ppd->cpspec->qdr_dfe_time)) { time_is_before_jiffies(ppd->cpspec->qdr_dfe_time)) {
ppd->cpspec->qdr_dfe_on = 0; ppd->cpspec->qdr_dfe_on = 0;
qib_write_kreg_port(ppd, krp_static_adapt_dis(2), qib_write_kreg_port(ppd, krp_static_adapt_dis(2),
...@@ -5240,7 +5243,7 @@ static int qib_7322_ib_updown(struct qib_pportdata *ppd, int ibup, u64 ibcs) ...@@ -5240,7 +5243,7 @@ static int qib_7322_ib_updown(struct qib_pportdata *ppd, int ibup, u64 ibcs)
/* schedule the qsfp refresh which should turn the link /* schedule the qsfp refresh which should turn the link
off */ off */
if (ppd->dd->flags & QIB_HAS_QSFP) { if (ppd->dd->flags & QIB_HAS_QSFP) {
qd->t_insert = get_jiffies_64(); qd->t_insert = jiffies;
queue_work(ib_wq, &qd->work); queue_work(ib_wq, &qd->work);
} }
spin_lock_irqsave(&ppd->sdma_lock, flags); spin_lock_irqsave(&ppd->sdma_lock, flags);
...@@ -5592,7 +5595,7 @@ static void qsfp_7322_event(struct work_struct *work) ...@@ -5592,7 +5595,7 @@ static void qsfp_7322_event(struct work_struct *work)
{ {
struct qib_qsfp_data *qd; struct qib_qsfp_data *qd;
struct qib_pportdata *ppd; struct qib_pportdata *ppd;
u64 pwrup; unsigned long pwrup;
unsigned long flags; unsigned long flags;
int ret; int ret;
u32 le2; u32 le2;
...@@ -5620,8 +5623,7 @@ static void qsfp_7322_event(struct work_struct *work) ...@@ -5620,8 +5623,7 @@ static void qsfp_7322_event(struct work_struct *work)
* to insertion. * to insertion.
*/ */
while (1) { while (1) {
u64 now = get_jiffies_64(); if (time_is_before_jiffies(pwrup))
if (time_after64(now, pwrup))
break; break;
msleep(20); msleep(20);
} }
...@@ -7506,7 +7508,7 @@ static int serdes_7322_init_old(struct qib_pportdata *ppd) ...@@ -7506,7 +7508,7 @@ static int serdes_7322_init_old(struct qib_pportdata *ppd)
static int serdes_7322_init_new(struct qib_pportdata *ppd) static int serdes_7322_init_new(struct qib_pportdata *ppd)
{ {
u64 tstart; unsigned long tend;
u32 le_val, rxcaldone; u32 le_val, rxcaldone;
int chan, chan_done = (1 << SERDES_CHANS) - 1; int chan, chan_done = (1 << SERDES_CHANS) - 1;
...@@ -7611,10 +7613,8 @@ static int serdes_7322_init_new(struct qib_pportdata *ppd) ...@@ -7611,10 +7613,8 @@ static int serdes_7322_init_new(struct qib_pportdata *ppd)
msleep(20); msleep(20);
/* Start Calibration */ /* Start Calibration */
ibsd_wr_allchans(ppd, 4, (1 << 10), BMASK(10, 10)); ibsd_wr_allchans(ppd, 4, (1 << 10), BMASK(10, 10));
tstart = get_jiffies_64(); tend = jiffies + msecs_to_jiffies(500);
while (chan_done && while (chan_done && !time_is_before_jiffies(tend)) {
!time_after64(get_jiffies_64(),
tstart + msecs_to_jiffies(500))) {
msleep(20); msleep(20);
for (chan = 0; chan < SERDES_CHANS; ++chan) { for (chan = 0; chan < SERDES_CHANS; ++chan) {
rxcaldone = ahb_mod(ppd->dd, IBSD(ppd->hw_pidx), rxcaldone = ahb_mod(ppd->dd, IBSD(ppd->hw_pidx),
......
...@@ -1015,7 +1015,7 @@ static int __devinit qib_init_one(struct pci_dev *, ...@@ -1015,7 +1015,7 @@ static int __devinit qib_init_one(struct pci_dev *,
#define DRIVER_LOAD_MSG "QLogic " QIB_DRV_NAME " loaded: " #define DRIVER_LOAD_MSG "QLogic " QIB_DRV_NAME " loaded: "
#define PFX QIB_DRV_NAME ": " #define PFX QIB_DRV_NAME ": "
static const struct pci_device_id qib_pci_tbl[] = { static DEFINE_PCI_DEVICE_TABLE(qib_pci_tbl) = {
{ PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_QLOGIC_IB_6120) }, { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_QLOGIC_IB_6120) },
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_IB_7220) }, { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_IB_7220) },
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_IB_7322) }, { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_IB_7322) },
......
...@@ -560,9 +560,9 @@ static int qib_tune_pcie_coalesce(struct qib_devdata *dd) ...@@ -560,9 +560,9 @@ static int qib_tune_pcie_coalesce(struct qib_devdata *dd)
* BIOS may not set PCIe bus-utilization parameters for best performance. * BIOS may not set PCIe bus-utilization parameters for best performance.
* Check and optionally adjust them to maximize our throughput. * Check and optionally adjust them to maximize our throughput.
*/ */
static int qib_pcie_caps; static int qib_pcie_caps = 0x51;
module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO); module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO);
MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (4lsb), ReadReq (D4..7)"); MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (0..3), ReadReq (4..7)");
static int qib_tune_pcie_caps(struct qib_devdata *dd) static int qib_tune_pcie_caps(struct qib_devdata *dd)
{ {
......
...@@ -177,7 +177,7 @@ struct qib_qsfp_data { ...@@ -177,7 +177,7 @@ struct qib_qsfp_data {
struct qib_pportdata *ppd; struct qib_pportdata *ppd;
struct work_struct work; struct work_struct work;
struct qib_qsfp_cache cache; struct qib_qsfp_cache cache;
u64 t_insert; unsigned long t_insert;
u8 modpresent; u8 modpresent;
}; };
......
...@@ -300,7 +300,7 @@ static int qib_ibsd_reset(struct qib_devdata *dd, int assert_rst) ...@@ -300,7 +300,7 @@ static int qib_ibsd_reset(struct qib_devdata *dd, int assert_rst)
} }
static void qib_sd_trimdone_monitor(struct qib_devdata *dd, static void qib_sd_trimdone_monitor(struct qib_devdata *dd,
const char *where) const char *where)
{ {
int ret, chn, baduns; int ret, chn, baduns;
u64 val; u64 val;
......
...@@ -150,7 +150,7 @@ static ssize_t show_status(struct qib_pportdata *ppd, char *buf) ...@@ -150,7 +150,7 @@ static ssize_t show_status(struct qib_pportdata *ppd, char *buf)
* For userland compatibility, these offsets must remain fixed. * For userland compatibility, these offsets must remain fixed.
* They are strings for QIB_STATUS_* * They are strings for QIB_STATUS_*
*/ */
static const char *qib_status_str[] = { static const char * const qib_status_str[] = {
"Initted", "Initted",
"", "",
"", "",
......
...@@ -913,8 +913,8 @@ static void copy_io(u32 __iomem *piobuf, struct qib_sge_state *ss, ...@@ -913,8 +913,8 @@ static void copy_io(u32 __iomem *piobuf, struct qib_sge_state *ss,
__raw_writel(last, piobuf); __raw_writel(last, piobuf);
} }
static struct qib_verbs_txreq *get_txreq(struct qib_ibdev *dev, static noinline struct qib_verbs_txreq *__get_txreq(struct qib_ibdev *dev,
struct qib_qp *qp, int *retp) struct qib_qp *qp)
{ {
struct qib_verbs_txreq *tx; struct qib_verbs_txreq *tx;
unsigned long flags; unsigned long flags;
...@@ -926,8 +926,9 @@ static struct qib_verbs_txreq *get_txreq(struct qib_ibdev *dev, ...@@ -926,8 +926,9 @@ static struct qib_verbs_txreq *get_txreq(struct qib_ibdev *dev,
struct list_head *l = dev->txreq_free.next; struct list_head *l = dev->txreq_free.next;
list_del(l); list_del(l);
spin_unlock(&dev->pending_lock);
spin_unlock_irqrestore(&qp->s_lock, flags);
tx = list_entry(l, struct qib_verbs_txreq, txreq.list); tx = list_entry(l, struct qib_verbs_txreq, txreq.list);
*retp = 0;
} else { } else {
if (ib_qib_state_ops[qp->state] & QIB_PROCESS_RECV_OK && if (ib_qib_state_ops[qp->state] & QIB_PROCESS_RECV_OK &&
list_empty(&qp->iowait)) { list_empty(&qp->iowait)) {
...@@ -935,14 +936,33 @@ static struct qib_verbs_txreq *get_txreq(struct qib_ibdev *dev, ...@@ -935,14 +936,33 @@ static struct qib_verbs_txreq *get_txreq(struct qib_ibdev *dev,
qp->s_flags |= QIB_S_WAIT_TX; qp->s_flags |= QIB_S_WAIT_TX;
list_add_tail(&qp->iowait, &dev->txwait); list_add_tail(&qp->iowait, &dev->txwait);
} }
tx = NULL;
qp->s_flags &= ~QIB_S_BUSY; qp->s_flags &= ~QIB_S_BUSY;
*retp = -EBUSY; spin_unlock(&dev->pending_lock);
spin_unlock_irqrestore(&qp->s_lock, flags);
tx = ERR_PTR(-EBUSY);
} }
return tx;
}
spin_unlock(&dev->pending_lock); static inline struct qib_verbs_txreq *get_txreq(struct qib_ibdev *dev,
spin_unlock_irqrestore(&qp->s_lock, flags); struct qib_qp *qp)
{
struct qib_verbs_txreq *tx;
unsigned long flags;
spin_lock_irqsave(&dev->pending_lock, flags);
/* assume the list non empty */
if (likely(!list_empty(&dev->txreq_free))) {
struct list_head *l = dev->txreq_free.next;
list_del(l);
spin_unlock_irqrestore(&dev->pending_lock, flags);
tx = list_entry(l, struct qib_verbs_txreq, txreq.list);
} else {
/* call slow path to get the extra lock */
spin_unlock_irqrestore(&dev->pending_lock, flags);
tx = __get_txreq(dev, qp);
}
return tx; return tx;
} }
...@@ -1122,9 +1142,9 @@ static int qib_verbs_send_dma(struct qib_qp *qp, struct qib_ib_header *hdr, ...@@ -1122,9 +1142,9 @@ static int qib_verbs_send_dma(struct qib_qp *qp, struct qib_ib_header *hdr,
goto bail; goto bail;
} }
tx = get_txreq(dev, qp, &ret); tx = get_txreq(dev, qp);
if (!tx) if (IS_ERR(tx))
goto bail; goto bail_tx;
control = dd->f_setpbc_control(ppd, plen, qp->s_srate, control = dd->f_setpbc_control(ppd, plen, qp->s_srate,
be16_to_cpu(hdr->lrh[0]) >> 12); be16_to_cpu(hdr->lrh[0]) >> 12);
...@@ -1195,6 +1215,9 @@ static int qib_verbs_send_dma(struct qib_qp *qp, struct qib_ib_header *hdr, ...@@ -1195,6 +1215,9 @@ static int qib_verbs_send_dma(struct qib_qp *qp, struct qib_ib_header *hdr,
ibp->n_unaligned++; ibp->n_unaligned++;
bail: bail:
return ret; return ret;
bail_tx:
ret = PTR_ERR(tx);
goto bail;
} }
/* /*
......
...@@ -281,7 +281,7 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid) ...@@ -281,7 +281,7 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid)
static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev) static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev)
{ {
return dev->priv_flags & IFF_802_1Q_VLAN ? return dev->priv_flags & IFF_802_1Q_VLAN ?
vlan_dev_real_dev(dev) : 0; vlan_dev_real_dev(dev) : NULL;
} }
#endif /* IB_ADDR_H */ #endif /* IB_ADDR_H */
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
#include <rdma/ib_mad.h> #include <rdma/ib_mad.h>
#include <rdma/ib_sa.h> #include <rdma/ib_sa.h>
/* ib_cm and ib_user_cm modules share /sys/class/infiniband_cm */
extern struct class cm_class;
enum ib_cm_state { enum ib_cm_state {
IB_CM_IDLE, IB_CM_IDLE,
IB_CM_LISTEN, IB_CM_LISTEN,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment