diff options
author | Ron Livne <ronli@voltaire.com> | 2008-07-15 02:48:48 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-07-15 02:48:48 -0400 |
commit | 521e575b9a7324a0bca762622139f69582a042bf (patch) | |
tree | 5962695835c6d11b424d76c64421ebd436b52a34 /drivers/net/mlx4 | |
parent | 47ee1b9f2e7bf73950602efe0b74fa1a8481f222 (diff) |
IB/mlx4: Add support for blocking multicast loopback packets
Add support for handling the IB_QP_CREATE_MULTICAST_BLOCK_LOOPBACK
flag by using the per-multicast group loopback blocking feature of
mlx4 hardware.
Signed-off-by: Ron Livne <ronli@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/net/mlx4')
-rw-r--r-- | drivers/net/mlx4/mcg.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c index 57f7f1f0d4ec..b4b57870ddfd 100644 --- a/drivers/net/mlx4/mcg.c +++ b/drivers/net/mlx4/mcg.c | |||
@@ -38,6 +38,9 @@ | |||
38 | 38 | ||
39 | #include "mlx4.h" | 39 | #include "mlx4.h" |
40 | 40 | ||
41 | #define MGM_QPN_MASK 0x00FFFFFF | ||
42 | #define MGM_BLCK_LB_BIT 30 | ||
43 | |||
41 | struct mlx4_mgm { | 44 | struct mlx4_mgm { |
42 | __be32 next_gid_index; | 45 | __be32 next_gid_index; |
43 | __be32 members_count; | 46 | __be32 members_count; |
@@ -153,7 +156,8 @@ static int find_mgm(struct mlx4_dev *dev, | |||
153 | return err; | 156 | return err; |
154 | } | 157 | } |
155 | 158 | ||
156 | int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]) | 159 | int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], |
160 | int block_mcast_loopback) | ||
157 | { | 161 | { |
158 | struct mlx4_priv *priv = mlx4_priv(dev); | 162 | struct mlx4_priv *priv = mlx4_priv(dev); |
159 | struct mlx4_cmd_mailbox *mailbox; | 163 | struct mlx4_cmd_mailbox *mailbox; |
@@ -202,13 +206,18 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]) | |||
202 | } | 206 | } |
203 | 207 | ||
204 | for (i = 0; i < members_count; ++i) | 208 | for (i = 0; i < members_count; ++i) |
205 | if (mgm->qp[i] == cpu_to_be32(qp->qpn)) { | 209 | if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) { |
206 | mlx4_dbg(dev, "QP %06x already a member of MGM\n", qp->qpn); | 210 | mlx4_dbg(dev, "QP %06x already a member of MGM\n", qp->qpn); |
207 | err = 0; | 211 | err = 0; |
208 | goto out; | 212 | goto out; |
209 | } | 213 | } |
210 | 214 | ||
211 | mgm->qp[members_count++] = cpu_to_be32(qp->qpn); | 215 | if (block_mcast_loopback) |
216 | mgm->qp[members_count++] = cpu_to_be32((qp->qpn & MGM_QPN_MASK) | | ||
217 | (1 << MGM_BLCK_LB_BIT)); | ||
218 | else | ||
219 | mgm->qp[members_count++] = cpu_to_be32(qp->qpn & MGM_QPN_MASK); | ||
220 | |||
212 | mgm->members_count = cpu_to_be32(members_count); | 221 | mgm->members_count = cpu_to_be32(members_count); |
213 | 222 | ||
214 | err = mlx4_WRITE_MCG(dev, index, mailbox); | 223 | err = mlx4_WRITE_MCG(dev, index, mailbox); |
@@ -283,7 +292,7 @@ int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]) | |||
283 | 292 | ||
284 | members_count = be32_to_cpu(mgm->members_count); | 293 | members_count = be32_to_cpu(mgm->members_count); |
285 | for (loc = -1, i = 0; i < members_count; ++i) | 294 | for (loc = -1, i = 0; i < members_count; ++i) |
286 | if (mgm->qp[i] == cpu_to_be32(qp->qpn)) | 295 | if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) |
287 | loc = i; | 296 | loc = i; |
288 | 297 | ||
289 | if (loc == -1) { | 298 | if (loc == -1) { |