]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.165/net-thunderx-make-cfg_done-message-to-run-through-ge.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.165 / net-thunderx-make-cfg_done-message-to-run-through-ge.patch
1 From 2159f48befb4f6e4a4ef7420b1a5afd2b0bc8bad Mon Sep 17 00:00:00 2001
2 From: Vadim Lomovtsev <vlomovtsev@marvell.com>
3 Date: Wed, 20 Feb 2019 11:02:43 +0000
4 Subject: net: thunderx: make CFG_DONE message to run through generic send-ack
5 sequence
6
7 [ Upstream commit 0dd563b9a62c4cbabf5d4fd6596440c2491e72b1 ]
8
9 At the end of NIC VF initialization VF sends CFG_DONE message to PF without
10 using nicvf_msg_send_to_pf routine. This potentially could re-write data in
11 mailbox. This commit is to implement common way of sending CFG_DONE message
12 by the same way with other configuration messages by using
13 nicvf_send_msg_to_pf() routine.
14
15 Signed-off-by: Vadim Lomovtsev <vlomovtsev@marvell.com>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
17 Signed-off-by: Sasha Levin <sashal@kernel.org>
18 ---
19 drivers/net/ethernet/cavium/thunder/nic_main.c | 2 +-
20 drivers/net/ethernet/cavium/thunder/nicvf_main.c | 15 ++++++++++++---
21 2 files changed, 13 insertions(+), 4 deletions(-)
22
23 diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
24 index da142f6bd0c3..18ddd243dfa1 100644
25 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c
26 +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
27 @@ -999,7 +999,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
28 case NIC_MBOX_MSG_CFG_DONE:
29 /* Last message of VF config msg sequence */
30 nic_enable_vf(nic, vf, true);
31 - goto unlock;
32 + break;
33 case NIC_MBOX_MSG_SHUTDOWN:
34 /* First msg in VF teardown sequence */
35 if (vf >= nic->num_vf_en)
36 diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
37 index c75d4ea9342b..71f228cece03 100644
38 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
39 +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
40 @@ -162,6 +162,17 @@ static int nicvf_check_pf_ready(struct nicvf *nic)
41 return 1;
42 }
43
44 +static void nicvf_send_cfg_done(struct nicvf *nic)
45 +{
46 + union nic_mbx mbx = {};
47 +
48 + mbx.msg.msg = NIC_MBOX_MSG_CFG_DONE;
49 + if (nicvf_send_msg_to_pf(nic, &mbx)) {
50 + netdev_err(nic->netdev,
51 + "PF didn't respond to CFG DONE msg\n");
52 + }
53 +}
54 +
55 static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx)
56 {
57 if (bgx->rx)
58 @@ -1178,7 +1189,6 @@ int nicvf_open(struct net_device *netdev)
59 struct nicvf *nic = netdev_priv(netdev);
60 struct queue_set *qs = nic->qs;
61 struct nicvf_cq_poll *cq_poll = NULL;
62 - union nic_mbx mbx = {};
63
64 netif_carrier_off(netdev);
65
66 @@ -1267,8 +1277,7 @@ int nicvf_open(struct net_device *netdev)
67 nicvf_enable_intr(nic, NICVF_INTR_RBDR, qidx);
68
69 /* Send VF config done msg to PF */
70 - mbx.msg.msg = NIC_MBOX_MSG_CFG_DONE;
71 - nicvf_write_to_mbx(nic, &mbx);
72 + nicvf_send_cfg_done(nic);
73
74 return 0;
75 cleanup:
76 --
77 2.19.1
78