aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Lomovtsev <vlomovtsev@marvell.com>2019-02-20 06:02:44 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-22 14:43:44 -0500
commit7db730d9d2f7b6af6aeac621b1890ea477a0cb8d (patch)
treeec2f077791ab6106b60f5801c40f8e2e03637143
parent0dd563b9a62c4cbabf5d4fd6596440c2491e72b1 (diff)
net: thunderx: add nicvf_send_msg_to_pf result check for set_rx_mode_task
The rx_set_mode invokes number of messages to be send to PF for receive mode configuration. In case if there any issues we need to stop sending messages and release allocated memory. This commit is to implement check of nicvf_msg_send_to_pf() result. Signed-off-by: Vadim Lomovtsev <vlomovtsev@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/cavium/thunder/nicvf_main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index 19b58fc3ca41..45f06504a61b 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -1953,7 +1953,8 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,
1953 1953
1954 /* flush DMAC filters and reset RX mode */ 1954 /* flush DMAC filters and reset RX mode */
1955 mbx.xcast.msg = NIC_MBOX_MSG_RESET_XCAST; 1955 mbx.xcast.msg = NIC_MBOX_MSG_RESET_XCAST;
1956 nicvf_send_msg_to_pf(nic, &mbx); 1956 if (nicvf_send_msg_to_pf(nic, &mbx) < 0)
1957 goto free_mc;
1957 1958
1958 if (mode & BGX_XCAST_MCAST_FILTER) { 1959 if (mode & BGX_XCAST_MCAST_FILTER) {
1959 /* once enabling filtering, we need to signal to PF to add 1960 /* once enabling filtering, we need to signal to PF to add
@@ -1961,7 +1962,8 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,
1961 */ 1962 */
1962 mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST; 1963 mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST;
1963 mbx.xcast.data.mac = 0; 1964 mbx.xcast.data.mac = 0;
1964 nicvf_send_msg_to_pf(nic, &mbx); 1965 if (nicvf_send_msg_to_pf(nic, &mbx) < 0)
1966 goto free_mc;
1965 } 1967 }
1966 1968
1967 /* check if we have any specific MACs to be added to PF DMAC filter */ 1969 /* check if we have any specific MACs to be added to PF DMAC filter */
@@ -1970,9 +1972,9 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,
1970 for (idx = 0; idx < mc_addrs->count; idx++) { 1972 for (idx = 0; idx < mc_addrs->count; idx++) {
1971 mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST; 1973 mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST;
1972 mbx.xcast.data.mac = mc_addrs->mc[idx]; 1974 mbx.xcast.data.mac = mc_addrs->mc[idx];
1973 nicvf_send_msg_to_pf(nic, &mbx); 1975 if (nicvf_send_msg_to_pf(nic, &mbx) < 0)
1976 goto free_mc;
1974 } 1977 }
1975 kfree(mc_addrs);
1976 } 1978 }
1977 1979
1978 /* and finally set rx mode for PF accordingly */ 1980 /* and finally set rx mode for PF accordingly */
@@ -1980,6 +1982,8 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,
1980 mbx.xcast.data.mode = mode; 1982 mbx.xcast.data.mode = mode;
1981 1983
1982 nicvf_send_msg_to_pf(nic, &mbx); 1984 nicvf_send_msg_to_pf(nic, &mbx);
1985free_mc:
1986 kfree(mc_addrs);
1983} 1987}
1984 1988
1985static void nicvf_set_rx_mode_task(struct work_struct *work_arg) 1989static void nicvf_set_rx_mode_task(struct work_struct *work_arg)