Skip to content

Commit 7db730d

Browse files
Vadim Lomovtsevdavem330
authored andcommitted
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>
1 parent 0dd563b commit 7db730d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/net/ethernet/cavium/thunder/nicvf_main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,15 +1953,17 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,
19531953

19541954
/* flush DMAC filters and reset RX mode */
19551955
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;
19571958

19581959
if (mode & BGX_XCAST_MCAST_FILTER) {
19591960
/* once enabling filtering, we need to signal to PF to add
19601961
* its' own LMAC to the filter to accept packets for it.
19611962
*/
19621963
mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST;
19631964
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;
19651967
}
19661968

19671969
/* check if we have any specific MACs to be added to PF DMAC filter */
@@ -1970,16 +1972,18 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,
19701972
for (idx = 0; idx < mc_addrs->count; idx++) {
19711973
mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST;
19721974
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;
19741977
}
1975-
kfree(mc_addrs);
19761978
}
19771979

19781980
/* and finally set rx mode for PF accordingly */
19791981
mbx.xcast.msg = NIC_MBOX_MSG_SET_XCAST;
19801982
mbx.xcast.data.mode = mode;
19811983

19821984
nicvf_send_msg_to_pf(nic, &mbx);
1985+
free_mc:
1986+
kfree(mc_addrs);
19831987
}
19841988

19851989
static void nicvf_set_rx_mode_task(struct work_struct *work_arg)

0 commit comments

Comments
 (0)