]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.7.7/ib-mlx4-fix-incorrect-mc-join-state-bit-masking-on-sr-iov.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.7.7 / ib-mlx4-fix-incorrect-mc-join-state-bit-masking-on-sr-iov.patch
1 From e5ac40cd66c2f3cd11bc5edc658f012661b16347 Mon Sep 17 00:00:00 2001
2 From: Alex Vesker <valex@mellanox.com>
3 Date: Mon, 12 Sep 2016 19:16:18 +0300
4 Subject: IB/mlx4: Fix incorrect MC join state bit-masking on SR-IOV
5
6 From: Alex Vesker <valex@mellanox.com>
7
8 commit e5ac40cd66c2f3cd11bc5edc658f012661b16347 upstream.
9
10 Because of an incorrect bit-masking done on the join state bits, when
11 handling a join request we failed to detect a difference between the
12 group join state and the request join state when joining as send only
13 full member (0x8). This caused the MC join request not to be sent.
14 This issue is relevant only when SRIOV is enabled and SM supports
15 send only full member.
16
17 This fix separates scope bits and join states bits a nibble each.
18
19 Fixes: b9c5d6a64358 ('IB/mlx4: Add multicast group (MCG) paravirtualization for SR-IOV')
20 Signed-off-by: Alex Vesker <valex@mellanox.com>
21 Signed-off-by: Leon Romanovsky <leon@kernel.org>
22 Signed-off-by: Doug Ledford <dledford@redhat.com>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25 ---
26 drivers/infiniband/hw/mlx4/mcg.c | 14 +++++++-------
27 1 file changed, 7 insertions(+), 7 deletions(-)
28
29 --- a/drivers/infiniband/hw/mlx4/mcg.c
30 +++ b/drivers/infiniband/hw/mlx4/mcg.c
31 @@ -489,7 +489,7 @@ static u8 get_leave_state(struct mcast_g
32 if (!group->members[i])
33 leave_state |= (1 << i);
34
35 - return leave_state & (group->rec.scope_join_state & 7);
36 + return leave_state & (group->rec.scope_join_state & 0xf);
37 }
38
39 static int join_group(struct mcast_group *group, int slave, u8 join_mask)
40 @@ -564,8 +564,8 @@ static void mlx4_ib_mcg_timeout_handler(
41 } else
42 mcg_warn_group(group, "DRIVER BUG\n");
43 } else if (group->state == MCAST_LEAVE_SENT) {
44 - if (group->rec.scope_join_state & 7)
45 - group->rec.scope_join_state &= 0xf8;
46 + if (group->rec.scope_join_state & 0xf)
47 + group->rec.scope_join_state &= 0xf0;
48 group->state = MCAST_IDLE;
49 mutex_unlock(&group->lock);
50 if (release_group(group, 1))
51 @@ -605,7 +605,7 @@ static int handle_leave_req(struct mcast
52 static int handle_join_req(struct mcast_group *group, u8 join_mask,
53 struct mcast_req *req)
54 {
55 - u8 group_join_state = group->rec.scope_join_state & 7;
56 + u8 group_join_state = group->rec.scope_join_state & 0xf;
57 int ref = 0;
58 u16 status;
59 struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
60 @@ -690,8 +690,8 @@ static void mlx4_ib_mcg_work_handler(str
61 u8 cur_join_state;
62
63 resp_join_state = ((struct ib_sa_mcmember_data *)
64 - group->response_sa_mad.data)->scope_join_state & 7;
65 - cur_join_state = group->rec.scope_join_state & 7;
66 + group->response_sa_mad.data)->scope_join_state & 0xf;
67 + cur_join_state = group->rec.scope_join_state & 0xf;
68
69 if (method == IB_MGMT_METHOD_GET_RESP) {
70 /* successfull join */
71 @@ -710,7 +710,7 @@ process_requests:
72 req = list_first_entry(&group->pending_list, struct mcast_req,
73 group_list);
74 sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
75 - req_join_state = sa_data->scope_join_state & 0x7;
76 + req_join_state = sa_data->scope_join_state & 0xf;
77
78 /* For a leave request, we will immediately answer the VF, and
79 * update our internal counters. The actual leave will be sent