aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErez Shitrit <erezsh@mellanox.com>2016-05-25 15:02:06 -0400
committerDoug Ledford <dledford@redhat.com>2016-05-25 15:39:03 -0400
commitcd6e9b7ef90515cb90962059ffb03b679de27f99 (patch)
tree8323f3df898312b8f81c561f52bd1c059e4fb8fb
parent628e6f75156eac6979eacc2e9383e41f6432beb4 (diff)
IB/core: Support new type of join-state for multicast
There are four types for MCG, FullMember, NonMember, SendOnlyNonMember, and the new added type: SendOnlyFullMember. Add support for the new SendOnlyFullMember join state. The new type allows host to send join request as sendonly, it will cause the group to be created but without getting packets from this multicast back to the host. Signed-off-by: Erez Shitrit <erezsh@mellanox.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Christoph Lameter <cl@linux.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/core/multicast.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c
index 250937cb9a1a..a83ec28a147b 100644
--- a/drivers/infiniband/core/multicast.c
+++ b/drivers/infiniband/core/multicast.c
@@ -93,6 +93,18 @@ enum {
93 93
94struct mcast_member; 94struct mcast_member;
95 95
96/*
97* There are 4 types of join states:
98* FullMember, NonMember, SendOnlyNonMember, SendOnlyFullMember.
99*/
100enum {
101 FULLMEMBER_JOIN,
102 NONMEMBER_JOIN,
103 SENDONLY_NONMEBER_JOIN,
104 SENDONLY_FULLMEMBER_JOIN,
105 NUM_JOIN_MEMBERSHIP_TYPES,
106};
107
96struct mcast_group { 108struct mcast_group {
97 struct ib_sa_mcmember_rec rec; 109 struct ib_sa_mcmember_rec rec;
98 struct rb_node node; 110 struct rb_node node;
@@ -102,7 +114,7 @@ struct mcast_group {
102 struct list_head pending_list; 114 struct list_head pending_list;
103 struct list_head active_list; 115 struct list_head active_list;
104 struct mcast_member *last_join; 116 struct mcast_member *last_join;
105 int members[3]; 117 int members[NUM_JOIN_MEMBERSHIP_TYPES];
106 atomic_t refcount; 118 atomic_t refcount;
107 enum mcast_group_state state; 119 enum mcast_group_state state;
108 struct ib_sa_query *query; 120 struct ib_sa_query *query;
@@ -220,8 +232,9 @@ static void queue_join(struct mcast_member *member)
220} 232}
221 233
222/* 234/*
223 * A multicast group has three types of members: full member, non member, and 235 * A multicast group has four types of members: full member, non member,
224 * send only member. We need to keep track of the number of members of each 236 * sendonly non member and sendonly full member.
237 * We need to keep track of the number of members of each
225 * type based on their join state. Adjust the number of members the belong to 238 * type based on their join state. Adjust the number of members the belong to
226 * the specified join states. 239 * the specified join states.
227 */ 240 */
@@ -229,7 +242,7 @@ static void adjust_membership(struct mcast_group *group, u8 join_state, int inc)
229{ 242{
230 int i; 243 int i;
231 244
232 for (i = 0; i < 3; i++, join_state >>= 1) 245 for (i = 0; i < NUM_JOIN_MEMBERSHIP_TYPES; i++, join_state >>= 1)
233 if (join_state & 0x1) 246 if (join_state & 0x1)
234 group->members[i] += inc; 247 group->members[i] += inc;
235} 248}
@@ -245,7 +258,7 @@ static u8 get_leave_state(struct mcast_group *group)
245 u8 leave_state = 0; 258 u8 leave_state = 0;
246 int i; 259 int i;
247 260
248 for (i = 0; i < 3; i++) 261 for (i = 0; i < NUM_JOIN_MEMBERSHIP_TYPES; i++)
249 if (!group->members[i]) 262 if (!group->members[i])
250 leave_state |= (0x1 << i); 263 leave_state |= (0x1 << i);
251 264