1 From b9f964fbd4cb099b9b4e5b3fc5839f4f2c678b30 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
7 [ Upstream commit 0dd563b9a62c4cbabf5d4fd6596440c2491e72b1 ]
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.
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>
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(-)
23 diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
24 index d89ec4724efd..819f38a3225d 100644
25 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c
26 +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
27 @@ -1030,7 +1030,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);
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 f13256af8031..59b62b49ad48 100644
38 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
39 +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
40 @@ -166,6 +166,17 @@ static int nicvf_check_pf_ready(struct nicvf *nic)
44 +static void nicvf_send_cfg_done(struct nicvf *nic)
46 + union nic_mbx mbx = {};
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");
55 static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx)
58 @@ -1329,7 +1340,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 = {};
64 netif_carrier_off(netdev);
66 @@ -1419,8 +1429,7 @@ int nicvf_open(struct net_device *netdev)
67 nicvf_enable_intr(nic, NICVF_INTR_RBDR, qidx);
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);