Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280605
b: refs/heads/master
c: e214a0f
h: refs/heads/master
i:
  280603: c2b9ff9
v: v3
  • Loading branch information
Eli Cohen authored and Roland Dreier committed Jan 4, 2012
1 parent 5acd8fa commit 9f14e0a
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 75 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d4548f2b7407f7212f71831bb7b457ceb752709
refs/heads/master: e214a0fe2b382fa302c036ecd6e6ffe99e3b9875
21 changes: 17 additions & 4 deletions trunk/drivers/infiniband/core/uverbs_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

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)
{
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)
{
return idr_read_obj(&ib_uverbs_srq_idr, srq_handle, context, 0);
Expand Down Expand Up @@ -2375,7 +2388,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file,
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;

qp = idr_read_qp(cmd.qp_handle, file->ucontext);
qp = idr_write_qp(cmd.qp_handle, file->ucontext);
if (!qp)
return -EINVAL;

Expand Down Expand Up @@ -2404,7 +2417,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file,
kfree(mcast);

out_put:
put_qp_read(qp);
put_qp_write(qp);

return ret ? ret : in_len;
}
Expand All @@ -2422,7 +2435,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;

qp = idr_read_qp(cmd.qp_handle, file->ucontext);
qp = idr_write_qp(cmd.qp_handle, file->ucontext);
if (!qp)
return -EINVAL;

Expand All @@ -2441,7 +2454,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
}

out_put:
put_qp_read(qp);
put_qp_write(qp);

return ret ? ret : in_len;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/infiniband/hw/qib/qib_7220.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct qib_chippport_specific {
u64 iblnkerrsnap;
u64 ibcctrl; /* kr_ibcctrl shadow */
u64 ibcddrctrl; /* kr_ibcddrctrl shadow */
unsigned long chase_end;
u64 chase_end;
u32 last_delay_mult;
};

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/infiniband/hw/qib/qib_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,9 @@ static u32 qib_rcv_hdrerr(struct qib_ctxtdata *rcd, struct qib_pportdata *ppd,
lnh == QIB_LRH_GRH,
qp,
be32_to_cpu(ohdr->bth[0]));
if (ruc_res)
if (ruc_res) {
goto unlock;
}

/* Only deal with RDMA Writes for now */
if (opcode <
Expand Down
4 changes: 1 addition & 3 deletions trunk/drivers/infiniband/hw/qib/qib_iba6120.c
Original file line number Diff line number Diff line change
Expand Up @@ -2076,11 +2076,9 @@ static void qib_6120_config_ctxts(struct qib_devdata *dd)
static void qib_update_6120_usrhead(struct qib_ctxtdata *rcd, u64 hd,
u32 updegr, u32 egrhd, u32 npkts)
{
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
if (updegr)
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)
Expand Down
10 changes: 4 additions & 6 deletions trunk/drivers/infiniband/hw/qib/qib_iba7220.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ static void reenable_7220_chase(unsigned long opaque)
static void handle_7220_chase(struct qib_pportdata *ppd, u64 ibcst)
{
u8 ibclt;
unsigned long tnow;
u64 tnow;

ibclt = (u8)SYM_FIELD(ibcst, IBCStatus, LinkTrainingState);

Expand All @@ -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_TXREVLANES:
case IB_7220_LT_STATE_CFGENH:
tnow = jiffies;
tnow = get_jiffies_64();
if (ppd->cpspec->chase_end &&
time_after(tnow, ppd->cpspec->chase_end)) {
time_after64(tnow, ppd->cpspec->chase_end)) {
ppd->cpspec->chase_end = 0;
qib_set_ib_7220_lstate(ppd,
QLOGIC_IB_IBCC_LINKCMD_DOWN,
Expand Down Expand Up @@ -2725,11 +2725,9 @@ 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,
u32 updegr, u32 egrhd, u32 npkts)
{
qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
if (updegr)
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)
Expand Down
40 changes: 20 additions & 20 deletions trunk/drivers/infiniband/hw/qib/qib_iba7322.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ struct qib_chippport_specific {
u64 ibmalfsnap;
u64 ibcctrl_a; /* krp_ibcctrl_a shadow */
u64 ibcctrl_b; /* krp_ibcctrl_b shadow */
unsigned long qdr_dfe_time;
unsigned long chase_end;
u64 qdr_dfe_time;
u64 chase_end;
u32 autoneg_tries;
u32 recovery_init;
u32 qdr_dfe_on;
Expand Down Expand Up @@ -1672,8 +1672,7 @@ static void reenable_chase(unsigned long opaque)
QLOGIC_IB_IBCC_LINKINITCMD_POLL);
}

static void disable_chase(struct qib_pportdata *ppd, unsigned long tnow,
u8 ibclt)
static void disable_chase(struct qib_pportdata *ppd, u64 tnow, u8 ibclt)
{
ppd->cpspec->chase_end = 0;

Expand All @@ -1689,7 +1688,7 @@ static void disable_chase(struct qib_pportdata *ppd, unsigned long tnow,
static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst)
{
u8 ibclt;
unsigned long tnow;
u64 tnow;

ibclt = (u8)SYM_FIELD(ibcst, IBCStatusA_0, LinkTrainingState);

Expand All @@ -1704,9 +1703,9 @@ static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst)
case IB_7322_LT_STATE_CFGWAITRMT:
case IB_7322_LT_STATE_TXREVLANES:
case IB_7322_LT_STATE_CFGENH:
tnow = jiffies;
tnow = get_jiffies_64();
if (ppd->cpspec->chase_end &&
time_after(tnow, ppd->cpspec->chase_end))
time_after64(tnow, ppd->cpspec->chase_end))
disable_chase(ppd, tnow, ibclt);
else if (!ppd->cpspec->chase_end)
ppd->cpspec->chase_end = tnow + QIB_CHASE_TIME;
Expand Down Expand Up @@ -2715,7 +2714,7 @@ static noinline void unknown_7322_gpio_intr(struct qib_devdata *dd)
pins >>= SYM_LSB(EXTStatus, GPIOIn);
if (!(pins & mask)) {
++handled;
qd->t_insert = jiffies;
qd->t_insert = get_jiffies_64();
queue_work(ib_wq, &qd->work);
}
}
Expand Down Expand Up @@ -3603,7 +3602,7 @@ static void qib_7322_config_ctxts(struct qib_devdata *dd)
if (qib_rcvhdrcnt)
dd->rcvhdrcnt = max(dd->cspec->rcvegrcnt, qib_rcvhdrcnt);
else
dd->rcvhdrcnt = 2 * max(dd->cspec->rcvegrcnt,
dd->rcvhdrcnt = max(dd->cspec->rcvegrcnt,
dd->num_pports > 1 ? 1024U : 2048U);
}

Expand Down Expand Up @@ -4083,12 +4082,10 @@ static void qib_update_7322_usrhead(struct qib_ctxtdata *rcd, u64 hd,
*/
if (hd >> IBA7322_HDRHEAD_PKTINT_SHIFT)
adjust_rcv_timeout(rcd, npkts);
if (updegr)
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();
if (updegr)
qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
}

static u32 qib_7322_hdrqempty(struct qib_ctxtdata *rcd)
Expand Down Expand Up @@ -4797,7 +4794,7 @@ static void qib_get_7322_faststats(unsigned long opaque)
(ppd->lflags & (QIBL_LINKINIT | QIBL_LINKARMED |
QIBL_LINKACTIVE)) &&
ppd->cpspec->qdr_dfe_time &&
time_is_before_jiffies(ppd->cpspec->qdr_dfe_time)) {
time_after64(get_jiffies_64(), ppd->cpspec->qdr_dfe_time)) {
ppd->cpspec->qdr_dfe_on = 0;

qib_write_kreg_port(ppd, krp_static_adapt_dis(2),
Expand Down Expand Up @@ -5243,7 +5240,7 @@ static int qib_7322_ib_updown(struct qib_pportdata *ppd, int ibup, u64 ibcs)
/* schedule the qsfp refresh which should turn the link
off */
if (ppd->dd->flags & QIB_HAS_QSFP) {
qd->t_insert = jiffies;
qd->t_insert = get_jiffies_64();
queue_work(ib_wq, &qd->work);
}
spin_lock_irqsave(&ppd->sdma_lock, flags);
Expand Down Expand Up @@ -5595,7 +5592,7 @@ static void qsfp_7322_event(struct work_struct *work)
{
struct qib_qsfp_data *qd;
struct qib_pportdata *ppd;
unsigned long pwrup;
u64 pwrup;
unsigned long flags;
int ret;
u32 le2;
Expand Down Expand Up @@ -5623,7 +5620,8 @@ static void qsfp_7322_event(struct work_struct *work)
* to insertion.
*/
while (1) {
if (time_is_before_jiffies(pwrup))
u64 now = get_jiffies_64();
if (time_after64(now, pwrup))
break;
msleep(20);
}
Expand Down Expand Up @@ -7508,7 +7506,7 @@ static int serdes_7322_init_old(struct qib_pportdata *ppd)

static int serdes_7322_init_new(struct qib_pportdata *ppd)
{
unsigned long tend;
u64 tstart;
u32 le_val, rxcaldone;
int chan, chan_done = (1 << SERDES_CHANS) - 1;

Expand Down Expand Up @@ -7613,8 +7611,10 @@ static int serdes_7322_init_new(struct qib_pportdata *ppd)
msleep(20);
/* Start Calibration */
ibsd_wr_allchans(ppd, 4, (1 << 10), BMASK(10, 10));
tend = jiffies + msecs_to_jiffies(500);
while (chan_done && !time_is_before_jiffies(tend)) {
tstart = get_jiffies_64();
while (chan_done &&
!time_after64(get_jiffies_64(),
tstart + msecs_to_jiffies(500))) {
msleep(20);
for (chan = 0; chan < SERDES_CHANS; ++chan) {
rxcaldone = ahb_mod(ppd->dd, IBSD(ppd->hw_pidx),
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/infiniband/hw/qib/qib_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ static int __devinit qib_init_one(struct pci_dev *,
#define DRIVER_LOAD_MSG "QLogic " QIB_DRV_NAME " loaded: "
#define PFX QIB_DRV_NAME ": "

static DEFINE_PCI_DEVICE_TABLE(qib_pci_tbl) = {
static const struct pci_device_id qib_pci_tbl[] = {
{ 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_7322) },
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/infiniband/hw/qib/qib_pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* Check and optionally adjust them to maximize our throughput.
*/
static int qib_pcie_caps = 0x51;
static int qib_pcie_caps;
module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO);
MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (0..3), ReadReq (4..7)");
MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (4lsb), ReadReq (D4..7)");

static int qib_tune_pcie_caps(struct qib_devdata *dd)
{
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/infiniband/hw/qib/qib_qsfp.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ struct qib_qsfp_data {
struct qib_pportdata *ppd;
struct work_struct work;
struct qib_qsfp_cache cache;
unsigned long t_insert;
u64 t_insert;
u8 modpresent;
};

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/infiniband/hw/qib/qib_sd7220.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
const char *where)
const char *where)
{
int ret, chn, baduns;
u64 val;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/infiniband/hw/qib/qib_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static ssize_t show_status(struct qib_pportdata *ppd, char *buf)
* For userland compatibility, these offsets must remain fixed.
* They are strings for QIB_STATUS_*
*/
static const char * const qib_status_str[] = {
static const char *qib_status_str[] = {
"Initted",
"",
"",
Expand Down
43 changes: 10 additions & 33 deletions trunk/drivers/infiniband/hw/qib/qib_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,8 @@ static void copy_io(u32 __iomem *piobuf, struct qib_sge_state *ss,
__raw_writel(last, piobuf);
}

static noinline struct qib_verbs_txreq *__get_txreq(struct qib_ibdev *dev,
struct qib_qp *qp)
static struct qib_verbs_txreq *get_txreq(struct qib_ibdev *dev,
struct qib_qp *qp, int *retp)
{
struct qib_verbs_txreq *tx;
unsigned long flags;
Expand All @@ -926,43 +926,23 @@ static noinline struct qib_verbs_txreq *__get_txreq(struct qib_ibdev *dev,
struct list_head *l = dev->txreq_free.next;

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);
*retp = 0;
} else {
if (ib_qib_state_ops[qp->state] & QIB_PROCESS_RECV_OK &&
list_empty(&qp->iowait)) {
dev->n_txwait++;
qp->s_flags |= QIB_S_WAIT_TX;
list_add_tail(&qp->iowait, &dev->txwait);
}
tx = NULL;
qp->s_flags &= ~QIB_S_BUSY;
spin_unlock(&dev->pending_lock);
spin_unlock_irqrestore(&qp->s_lock, flags);
tx = ERR_PTR(-EBUSY);
*retp = -EBUSY;
}
return tx;
}

static inline struct qib_verbs_txreq *get_txreq(struct qib_ibdev *dev,
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;
spin_unlock(&dev->pending_lock);
spin_unlock_irqrestore(&qp->s_lock, flags);

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;
}

Expand Down Expand Up @@ -1142,9 +1122,9 @@ static int qib_verbs_send_dma(struct qib_qp *qp, struct qib_ib_header *hdr,
goto bail;
}

tx = get_txreq(dev, qp);
if (IS_ERR(tx))
goto bail_tx;
tx = get_txreq(dev, qp, &ret);
if (!tx)
goto bail;

control = dd->f_setpbc_control(ppd, plen, qp->s_srate,
be16_to_cpu(hdr->lrh[0]) >> 12);
Expand Down Expand Up @@ -1215,9 +1195,6 @@ static int qib_verbs_send_dma(struct qib_qp *qp, struct qib_ib_header *hdr,
ibp->n_unaligned++;
bail:
return ret;
bail_tx:
ret = PTR_ERR(tx);
goto bail;
}

/*
Expand Down

0 comments on commit 9f14e0a

Please sign in to comment.