Skip to content

Commit

Permalink
Merge branches 'ehca', 'ipoib' and 'mlx4' into for-linus
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland Dreier committed Jan 16, 2009
3 parents ee96aae + 3c20962 + 0fd7e1d commit ac8581d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 28 deletions.
28 changes: 19 additions & 9 deletions drivers/infiniband/hw/mlx4/qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,8 @@ static void __set_data_seg(struct mlx4_wqe_data_seg *dseg, struct ib_sge *sg)
}

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

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

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

/* make sure LSO header is written before overwriting stamping */
wmb();

wqe->mss_hdr_size = cpu_to_be32((wr->wr.ud.mss - wr->wr.ud.hlen) << 16 |
wr->wr.ud.hlen);

*lso_hdr_sz = cpu_to_be32((wr->wr.ud.mss - wr->wr.ud.hlen) << 16 |
wr->wr.ud.hlen);
*lso_seg_len = halign;
return 0;
}
Expand Down Expand Up @@ -1518,13 +1515,18 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
int uninitialized_var(stamp);
int uninitialized_var(size);
unsigned uninitialized_var(seglen);
__be32 dummy;
__be32 *lso_wqe;
__be32 uninitialized_var(lso_hdr_sz);
int i;

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

ind = qp->sq_next_wqe;

for (nreq = 0; wr; ++nreq, wr = wr->next) {
lso_wqe = &dummy;

if (mlx4_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) {
err = -ENOMEM;
*bad_wr = wr;
Expand Down Expand Up @@ -1606,11 +1608,12 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
size += sizeof (struct mlx4_wqe_datagram_seg) / 16;

if (wr->opcode == IB_WR_LSO) {
err = build_lso_seg(wqe, wr, qp, &seglen);
err = build_lso_seg(wqe, wr, qp, &seglen, &lso_hdr_sz);
if (unlikely(err)) {
*bad_wr = wr;
goto out;
}
lso_wqe = (__be32 *) wqe;
wqe += seglen;
size += seglen / 16;
}
Expand Down Expand Up @@ -1652,6 +1655,14 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
for (i = wr->num_sge - 1; i >= 0; --i, --dseg)
set_data_seg(dseg, wr->sg_list + i);

/*
* Possibly overwrite stamping in cacheline with LSO
* segment only after making sure all data segments
* are written.
*/
wmb();
*lso_wqe = lso_hdr_sz;

ctrl->fence_size = (wr->send_flags & IB_SEND_FENCE ?
MLX4_WQE_CTRL_FENCE : 0) | size;

Expand Down Expand Up @@ -1686,7 +1697,6 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
stamp_send_wqe(qp, stamp, size * 16);
ind = pad_wraparound(qp, ind);
}

}

out:
Expand Down
27 changes: 15 additions & 12 deletions drivers/infiniband/ulp/ipoib/ipoib_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,17 @@ int ipoib_open(struct net_device *dev)

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

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

if (ipoib_pkey_dev_delay_open(dev))
return 0;

napi_enable(&priv->napi);
if (ipoib_ib_dev_open(dev))
goto err_disable;

if (ipoib_ib_dev_open(dev)) {
napi_disable(&priv->napi);
return -EINVAL;
}

if (ipoib_ib_dev_up(dev)) {
ipoib_ib_dev_stop(dev, 1);
napi_disable(&priv->napi);
return -EINVAL;
}
if (ipoib_ib_dev_up(dev))
goto err_stop;

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

return 0;

err_stop:
ipoib_ib_dev_stop(dev, 1);

err_disable:
napi_disable(&priv->napi);
clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);

return -EINVAL;
}

static int ipoib_stop(struct net_device *dev)
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/ulp/ipoib/ipoib_multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static int ipoib_mcast_join_complete(int status,
}

if (mcast->logcount++ < 20) {
if (status == -ETIMEDOUT) {
if (status == -ETIMEDOUT || status == -EAGAIN) {
ipoib_dbg_mcast(priv, "multicast join failed for %pI6, status %d\n",
mcast->mcmember.mgid.raw, status);
} else {
Expand Down
11 changes: 8 additions & 3 deletions drivers/infiniband/ulp/ipoib/ipoib_vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)

ppriv = netdev_priv(pdev);

rtnl_lock();
mutex_lock(&ppriv->vlan_mutex);

/*
Expand Down Expand Up @@ -111,7 +112,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
goto device_init_failed;
}

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

mutex_unlock(&ppriv->vlan_mutex);
rtnl_unlock();

return 0;

sysfs_failed:
ipoib_delete_debug_files(priv->dev);
unregister_netdev(priv->dev);
unregister_netdevice(priv->dev);

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

err:
mutex_unlock(&ppriv->vlan_mutex);
rtnl_unlock();
return result;
}

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

ppriv = netdev_priv(pdev);

rtnl_lock();
mutex_lock(&ppriv->vlan_mutex);
list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
if (priv->pkey == pkey) {
unregister_netdev(priv->dev);
unregister_netdevice(priv->dev);
ipoib_dev_cleanup(priv->dev);
list_del(&priv->list);
free_netdev(priv->dev);
Expand All @@ -175,6 +179,7 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
}
}
mutex_unlock(&ppriv->vlan_mutex);
rtnl_unlock();

return ret;
}
6 changes: 3 additions & 3 deletions drivers/net/mlx4/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
profile[MLX4_RES_AUXC].num = request->num_qp;
profile[MLX4_RES_SRQ].num = request->num_srq;
profile[MLX4_RES_CQ].num = request->num_cq;
profile[MLX4_RES_EQ].num = min(dev_cap->max_eqs,
dev_cap->reserved_eqs +
num_possible_cpus() + 1);
profile[MLX4_RES_EQ].num = min_t(unsigned, dev_cap->max_eqs,
dev_cap->reserved_eqs +
num_possible_cpus() + 1);
profile[MLX4_RES_DMPT].num = request->num_mpt;
profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS;
profile[MLX4_RES_MTT].num = request->num_mtt;
Expand Down

0 comments on commit ac8581d

Please sign in to comment.