Skip to content

Commit ac8581d

Browse files
author
Roland Dreier
committed
Merge branches 'ehca', 'ipoib' and 'mlx4' into for-linus
3 parents ee96aae + 3c20962 + 0fd7e1d commit ac8581d

File tree

5 files changed

+46
-28
lines changed

5 files changed

+46
-28
lines changed

drivers/infiniband/hw/mlx4/qp.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,8 @@ static void __set_data_seg(struct mlx4_wqe_data_seg *dseg, struct ib_sge *sg)
14621462
}
14631463

14641464
static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_send_wr *wr,
1465-
struct mlx4_ib_qp *qp, unsigned *lso_seg_len)
1465+
struct mlx4_ib_qp *qp, unsigned *lso_seg_len,
1466+
__be32 *lso_hdr_sz)
14661467
{
14671468
unsigned halign = ALIGN(sizeof *wqe + wr->wr.ud.hlen, 16);
14681469

@@ -1479,12 +1480,8 @@ static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_send_wr *wr,
14791480

14801481
memcpy(wqe->header, wr->wr.ud.header, wr->wr.ud.hlen);
14811482

1482-
/* make sure LSO header is written before overwriting stamping */
1483-
wmb();
1484-
1485-
wqe->mss_hdr_size = cpu_to_be32((wr->wr.ud.mss - wr->wr.ud.hlen) << 16 |
1486-
wr->wr.ud.hlen);
1487-
1483+
*lso_hdr_sz = cpu_to_be32((wr->wr.ud.mss - wr->wr.ud.hlen) << 16 |
1484+
wr->wr.ud.hlen);
14881485
*lso_seg_len = halign;
14891486
return 0;
14901487
}
@@ -1518,13 +1515,18 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
15181515
int uninitialized_var(stamp);
15191516
int uninitialized_var(size);
15201517
unsigned uninitialized_var(seglen);
1518+
__be32 dummy;
1519+
__be32 *lso_wqe;
1520+
__be32 uninitialized_var(lso_hdr_sz);
15211521
int i;
15221522

15231523
spin_lock_irqsave(&qp->sq.lock, flags);
15241524

15251525
ind = qp->sq_next_wqe;
15261526

15271527
for (nreq = 0; wr; ++nreq, wr = wr->next) {
1528+
lso_wqe = &dummy;
1529+
15281530
if (mlx4_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) {
15291531
err = -ENOMEM;
15301532
*bad_wr = wr;
@@ -1606,11 +1608,12 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
16061608
size += sizeof (struct mlx4_wqe_datagram_seg) / 16;
16071609

16081610
if (wr->opcode == IB_WR_LSO) {
1609-
err = build_lso_seg(wqe, wr, qp, &seglen);
1611+
err = build_lso_seg(wqe, wr, qp, &seglen, &lso_hdr_sz);
16101612
if (unlikely(err)) {
16111613
*bad_wr = wr;
16121614
goto out;
16131615
}
1616+
lso_wqe = (__be32 *) wqe;
16141617
wqe += seglen;
16151618
size += seglen / 16;
16161619
}
@@ -1652,6 +1655,14 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
16521655
for (i = wr->num_sge - 1; i >= 0; --i, --dseg)
16531656
set_data_seg(dseg, wr->sg_list + i);
16541657

1658+
/*
1659+
* Possibly overwrite stamping in cacheline with LSO
1660+
* segment only after making sure all data segments
1661+
* are written.
1662+
*/
1663+
wmb();
1664+
*lso_wqe = lso_hdr_sz;
1665+
16551666
ctrl->fence_size = (wr->send_flags & IB_SEND_FENCE ?
16561667
MLX4_WQE_CTRL_FENCE : 0) | size;
16571668

@@ -1686,7 +1697,6 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
16861697
stamp_send_wqe(qp, stamp, size * 16);
16871698
ind = pad_wraparound(qp, ind);
16881699
}
1689-
16901700
}
16911701

16921702
out:

drivers/infiniband/ulp/ipoib/ipoib_main.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,17 @@ int ipoib_open(struct net_device *dev)
106106

107107
ipoib_dbg(priv, "bringing up interface\n");
108108

109-
set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
109+
if (!test_and_set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
110+
napi_enable(&priv->napi);
110111

111112
if (ipoib_pkey_dev_delay_open(dev))
112113
return 0;
113114

114-
napi_enable(&priv->napi);
115+
if (ipoib_ib_dev_open(dev))
116+
goto err_disable;
115117

116-
if (ipoib_ib_dev_open(dev)) {
117-
napi_disable(&priv->napi);
118-
return -EINVAL;
119-
}
120-
121-
if (ipoib_ib_dev_up(dev)) {
122-
ipoib_ib_dev_stop(dev, 1);
123-
napi_disable(&priv->napi);
124-
return -EINVAL;
125-
}
118+
if (ipoib_ib_dev_up(dev))
119+
goto err_stop;
126120

127121
if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
128122
struct ipoib_dev_priv *cpriv;
@@ -144,6 +138,15 @@ int ipoib_open(struct net_device *dev)
144138
netif_start_queue(dev);
145139

146140
return 0;
141+
142+
err_stop:
143+
ipoib_ib_dev_stop(dev, 1);
144+
145+
err_disable:
146+
napi_disable(&priv->napi);
147+
clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
148+
149+
return -EINVAL;
147150
}
148151

149152
static int ipoib_stop(struct net_device *dev)

drivers/infiniband/ulp/ipoib/ipoib_multicast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ static int ipoib_mcast_join_complete(int status,
409409
}
410410

411411
if (mcast->logcount++ < 20) {
412-
if (status == -ETIMEDOUT) {
412+
if (status == -ETIMEDOUT || status == -EAGAIN) {
413413
ipoib_dbg_mcast(priv, "multicast join failed for %pI6, status %d\n",
414414
mcast->mcmember.mgid.raw, status);
415415
} else {

drivers/infiniband/ulp/ipoib/ipoib_vlan.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
6161

6262
ppriv = netdev_priv(pdev);
6363

64+
rtnl_lock();
6465
mutex_lock(&ppriv->vlan_mutex);
6566

6667
/*
@@ -111,7 +112,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
111112
goto device_init_failed;
112113
}
113114

114-
result = register_netdev(priv->dev);
115+
result = register_netdevice(priv->dev);
115116
if (result) {
116117
ipoib_warn(priv, "failed to initialize; error %i", result);
117118
goto register_failed;
@@ -134,12 +135,13 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
134135
list_add_tail(&priv->list, &ppriv->child_intfs);
135136

136137
mutex_unlock(&ppriv->vlan_mutex);
138+
rtnl_unlock();
137139

138140
return 0;
139141

140142
sysfs_failed:
141143
ipoib_delete_debug_files(priv->dev);
142-
unregister_netdev(priv->dev);
144+
unregister_netdevice(priv->dev);
143145

144146
register_failed:
145147
ipoib_dev_cleanup(priv->dev);
@@ -149,6 +151,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
149151

150152
err:
151153
mutex_unlock(&ppriv->vlan_mutex);
154+
rtnl_unlock();
152155
return result;
153156
}
154157

@@ -162,10 +165,11 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
162165

163166
ppriv = netdev_priv(pdev);
164167

168+
rtnl_lock();
165169
mutex_lock(&ppriv->vlan_mutex);
166170
list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
167171
if (priv->pkey == pkey) {
168-
unregister_netdev(priv->dev);
172+
unregister_netdevice(priv->dev);
169173
ipoib_dev_cleanup(priv->dev);
170174
list_del(&priv->list);
171175
free_netdev(priv->dev);
@@ -175,6 +179,7 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
175179
}
176180
}
177181
mutex_unlock(&ppriv->vlan_mutex);
182+
rtnl_unlock();
178183

179184
return ret;
180185
}

drivers/net/mlx4/profile.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
107107
profile[MLX4_RES_AUXC].num = request->num_qp;
108108
profile[MLX4_RES_SRQ].num = request->num_srq;
109109
profile[MLX4_RES_CQ].num = request->num_cq;
110-
profile[MLX4_RES_EQ].num = min(dev_cap->max_eqs,
111-
dev_cap->reserved_eqs +
112-
num_possible_cpus() + 1);
110+
profile[MLX4_RES_EQ].num = min_t(unsigned, dev_cap->max_eqs,
111+
dev_cap->reserved_eqs +
112+
num_possible_cpus() + 1);
113113
profile[MLX4_RES_DMPT].num = request->num_mpt;
114114
profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS;
115115
profile[MLX4_RES_MTT].num = request->num_mtt;

0 commit comments

Comments
 (0)