Commit 600307e6 authored by Alex Vesker's avatar Alex Vesker Committed by Ben Hutchings

IB/mlx4: Fix incorrect MC join state bit-masking on SR-IOV

commit e5ac40cd upstream.

Because of an incorrect bit-masking done on the join state bits, when
handling a join request we failed to detect a difference between the
group join state and the request join state when joining as send only
full member (0x8). This caused the MC join request not to be sent.
This issue is relevant only when SRIOV is enabled and SM supports
send only full member.

This fix separates scope bits and join states bits a nibble each.

Fixes: b9c5d6a6 ('IB/mlx4: Add multicast group (MCG) paravirtualization for SR-IOV')
Signed-off-by: default avatarAlex Vesker <valex@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent dfe80970
...@@ -485,7 +485,7 @@ static u8 get_leave_state(struct mcast_group *group) ...@@ -485,7 +485,7 @@ static u8 get_leave_state(struct mcast_group *group)
if (!group->members[i]) if (!group->members[i])
leave_state |= (1 << i); leave_state |= (1 << i);
return leave_state & (group->rec.scope_join_state & 7); return leave_state & (group->rec.scope_join_state & 0xf);
} }
static int join_group(struct mcast_group *group, int slave, u8 join_mask) static int join_group(struct mcast_group *group, int slave, u8 join_mask)
...@@ -560,8 +560,8 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work) ...@@ -560,8 +560,8 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work)
} else } else
mcg_warn_group(group, "DRIVER BUG\n"); mcg_warn_group(group, "DRIVER BUG\n");
} else if (group->state == MCAST_LEAVE_SENT) { } else if (group->state == MCAST_LEAVE_SENT) {
if (group->rec.scope_join_state & 7) if (group->rec.scope_join_state & 0xf)
group->rec.scope_join_state &= 0xf8; group->rec.scope_join_state &= 0xf0;
group->state = MCAST_IDLE; group->state = MCAST_IDLE;
mutex_unlock(&group->lock); mutex_unlock(&group->lock);
if (release_group(group, 1)) if (release_group(group, 1))
...@@ -601,7 +601,7 @@ static int handle_leave_req(struct mcast_group *group, u8 leave_mask, ...@@ -601,7 +601,7 @@ static int handle_leave_req(struct mcast_group *group, u8 leave_mask,
static int handle_join_req(struct mcast_group *group, u8 join_mask, static int handle_join_req(struct mcast_group *group, u8 join_mask,
struct mcast_req *req) struct mcast_req *req)
{ {
u8 group_join_state = group->rec.scope_join_state & 7; u8 group_join_state = group->rec.scope_join_state & 0xf;
int ref = 0; int ref = 0;
u16 status; u16 status;
struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
...@@ -686,8 +686,8 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work) ...@@ -686,8 +686,8 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
u8 cur_join_state; u8 cur_join_state;
resp_join_state = ((struct ib_sa_mcmember_data *) resp_join_state = ((struct ib_sa_mcmember_data *)
group->response_sa_mad.data)->scope_join_state & 7; group->response_sa_mad.data)->scope_join_state & 0xf;
cur_join_state = group->rec.scope_join_state & 7; cur_join_state = group->rec.scope_join_state & 0xf;
if (method == IB_MGMT_METHOD_GET_RESP) { if (method == IB_MGMT_METHOD_GET_RESP) {
/* successfull join */ /* successfull join */
...@@ -706,7 +706,7 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work) ...@@ -706,7 +706,7 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
req = list_first_entry(&group->pending_list, struct mcast_req, req = list_first_entry(&group->pending_list, struct mcast_req,
group_list); group_list);
sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
req_join_state = sa_data->scope_join_state & 0x7; req_join_state = sa_data->scope_join_state & 0xf;
/* For a leave request, we will immediately answer the VF, and /* For a leave request, we will immediately answer the VF, and
* update our internal counters. The actual leave will be sent * update our internal counters. The actual leave will be sent
......
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