diff options
author | Radoslaw Biernacki <rad@semihalf.com> | 2016-08-12 07:21:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-13 14:59:32 -0400 |
commit | ecae29cb15c1a9502bb24f44ff9b84075c0b1dcd (patch) | |
tree | 70b7278d3a54c82bdb4db148e84db996c436691b /drivers | |
parent | a8671acca87267ad8b583b6e5cf9f6bcb09ff77a (diff) |
net: thunderx: Improvement for MBX interface debug messages
Adding debug messages in case of NACK for a mailbox message, also
did small cleanups.
Signed-off-by: Radoslaw Biernacki <rad@semihalf.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nic_main.c | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nicvf_main.c | 8 |
2 files changed, 16 insertions, 8 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index b982e5ff7bbe..c706b2e31598 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c | |||
@@ -831,7 +831,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf) | |||
831 | mbx_addr += sizeof(u64); | 831 | mbx_addr += sizeof(u64); |
832 | } | 832 | } |
833 | 833 | ||
834 | dev_dbg(&nic->pdev->dev, "%s: Mailbox msg %d from VF%d\n", | 834 | dev_dbg(&nic->pdev->dev, "%s: Mailbox msg 0x%02x from VF%d\n", |
835 | __func__, mbx.msg.msg, vf); | 835 | __func__, mbx.msg.msg, vf); |
836 | switch (mbx.msg.msg) { | 836 | switch (mbx.msg.msg) { |
837 | case NIC_MBOX_MSG_READY: | 837 | case NIC_MBOX_MSG_READY: |
@@ -841,8 +841,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf) | |||
841 | nic->duplex[vf] = 0; | 841 | nic->duplex[vf] = 0; |
842 | nic->speed[vf] = 0; | 842 | nic->speed[vf] = 0; |
843 | } | 843 | } |
844 | ret = 1; | 844 | goto unlock; |
845 | break; | ||
846 | case NIC_MBOX_MSG_QS_CFG: | 845 | case NIC_MBOX_MSG_QS_CFG: |
847 | reg_addr = NIC_PF_QSET_0_127_CFG | | 846 | reg_addr = NIC_PF_QSET_0_127_CFG | |
848 | (mbx.qs.num << NIC_QS_ID_SHIFT); | 847 | (mbx.qs.num << NIC_QS_ID_SHIFT); |
@@ -891,8 +890,10 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf) | |||
891 | nic_tx_channel_cfg(nic, mbx.qs.num, &mbx.sq); | 890 | nic_tx_channel_cfg(nic, mbx.qs.num, &mbx.sq); |
892 | break; | 891 | break; |
893 | case NIC_MBOX_MSG_SET_MAC: | 892 | case NIC_MBOX_MSG_SET_MAC: |
894 | if (vf >= nic->num_vf_en) | 893 | if (vf >= nic->num_vf_en) { |
894 | ret = -1; /* NACK */ | ||
895 | break; | 895 | break; |
896 | } | ||
896 | lmac = mbx.mac.vf_id; | 897 | lmac = mbx.mac.vf_id; |
897 | bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]); | 898 | bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]); |
898 | lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]); | 899 | lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]); |
@@ -947,10 +948,13 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf) | |||
947 | break; | 948 | break; |
948 | } | 949 | } |
949 | 950 | ||
950 | if (!ret) | 951 | if (!ret) { |
951 | nic_mbx_send_ack(nic, vf); | 952 | nic_mbx_send_ack(nic, vf); |
952 | else if (mbx.msg.msg != NIC_MBOX_MSG_READY) | 953 | } else if (mbx.msg.msg != NIC_MBOX_MSG_READY) { |
954 | dev_err(&nic->pdev->dev, "NACK for MBOX 0x%02x from VF %d\n", | ||
955 | mbx.msg.msg, vf); | ||
953 | nic_mbx_send_nack(nic, vf); | 956 | nic_mbx_send_nack(nic, vf); |
957 | } | ||
954 | unlock: | 958 | unlock: |
955 | nic->mbx_lock[vf] = false; | 959 | nic->mbx_lock[vf] = false; |
956 | } | 960 | } |
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 5335ff1bf69a..dd57361aa3fc 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c | |||
@@ -144,15 +144,19 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx) | |||
144 | 144 | ||
145 | /* Wait for previous message to be acked, timeout 2sec */ | 145 | /* Wait for previous message to be acked, timeout 2sec */ |
146 | while (!nic->pf_acked) { | 146 | while (!nic->pf_acked) { |
147 | if (nic->pf_nacked) | 147 | if (nic->pf_nacked) { |
148 | netdev_err(nic->netdev, | ||
149 | "PF NACK to mbox msg 0x%02x from VF%d\n", | ||
150 | (mbx->msg.msg & 0xFF), nic->vf_id); | ||
148 | return -EINVAL; | 151 | return -EINVAL; |
152 | } | ||
149 | msleep(sleep); | 153 | msleep(sleep); |
150 | if (nic->pf_acked) | 154 | if (nic->pf_acked) |
151 | break; | 155 | break; |
152 | timeout -= sleep; | 156 | timeout -= sleep; |
153 | if (!timeout) { | 157 | if (!timeout) { |
154 | netdev_err(nic->netdev, | 158 | netdev_err(nic->netdev, |
155 | "PF didn't ack to mbox msg %d from VF%d\n", | 159 | "PF didn't ACK to mbox msg 0x%02x from VF%d\n", |
156 | (mbx->msg.msg & 0xFF), nic->vf_id); | 160 | (mbx->msg.msg & 0xFF), nic->vf_id); |
157 | return -EBUSY; | 161 | return -EBUSY; |
158 | } | 162 | } |