Commit cd6e9b7e authored by Erez Shitrit's avatar Erez Shitrit Committed by Doug Ledford

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: default avatarErez Shitrit <erezsh@mellanox.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Reviewed-by: default avatarChristoph Lameter <cl@linux.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 628e6f75
...@@ -93,6 +93,18 @@ enum { ...@@ -93,6 +93,18 @@ enum {
struct mcast_member; struct mcast_member;
/*
* There are 4 types of join states:
* FullMember, NonMember, SendOnlyNonMember, SendOnlyFullMember.
*/
enum {
FULLMEMBER_JOIN,
NONMEMBER_JOIN,
SENDONLY_NONMEBER_JOIN,
SENDONLY_FULLMEMBER_JOIN,
NUM_JOIN_MEMBERSHIP_TYPES,
};
struct mcast_group { struct mcast_group {
struct ib_sa_mcmember_rec rec; struct ib_sa_mcmember_rec rec;
struct rb_node node; struct rb_node node;
...@@ -102,7 +114,7 @@ struct mcast_group { ...@@ -102,7 +114,7 @@ struct mcast_group {
struct list_head pending_list; struct list_head pending_list;
struct list_head active_list; struct list_head active_list;
struct mcast_member *last_join; struct mcast_member *last_join;
int members[3]; int members[NUM_JOIN_MEMBERSHIP_TYPES];
atomic_t refcount; atomic_t refcount;
enum mcast_group_state state; enum mcast_group_state state;
struct ib_sa_query *query; struct ib_sa_query *query;
...@@ -220,8 +232,9 @@ static void queue_join(struct mcast_member *member) ...@@ -220,8 +232,9 @@ static void queue_join(struct mcast_member *member)
} }
/* /*
* A multicast group has three types of members: full member, non member, and * A multicast group has four types of members: full member, non member,
* send only member. We need to keep track of the number of members of each * sendonly non member and sendonly full member.
* We need to keep track of the number of members of each
* type based on their join state. Adjust the number of members the belong to * type based on their join state. Adjust the number of members the belong to
* the specified join states. * the specified join states.
*/ */
...@@ -229,7 +242,7 @@ static void adjust_membership(struct mcast_group *group, u8 join_state, int inc) ...@@ -229,7 +242,7 @@ static void adjust_membership(struct mcast_group *group, u8 join_state, int inc)
{ {
int i; int i;
for (i = 0; i < 3; i++, join_state >>= 1) for (i = 0; i < NUM_JOIN_MEMBERSHIP_TYPES; i++, join_state >>= 1)
if (join_state & 0x1) if (join_state & 0x1)
group->members[i] += inc; group->members[i] += inc;
} }
...@@ -245,7 +258,7 @@ static u8 get_leave_state(struct mcast_group *group) ...@@ -245,7 +258,7 @@ static u8 get_leave_state(struct mcast_group *group)
u8 leave_state = 0; u8 leave_state = 0;
int i; int i;
for (i = 0; i < 3; i++) for (i = 0; i < NUM_JOIN_MEMBERSHIP_TYPES; i++)
if (!group->members[i]) if (!group->members[i])
leave_state |= (0x1 << i); leave_state |= (0x1 << i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment