From ed11d28c38edd4cb5dc4e178ecba5419caa595c1 Mon Sep 17 00:00:00 2001 From: "Hsu Wyatt (CSS ICW SW WFSW 2)" Date: Tue, 17 Oct 2023 06:01:42 +0000 Subject: [PATCH 187/296] brcmfmac: offload: update the brcmf_configure_arp_nd_offload --- .../broadcom/brcm80211/brcmfmac/core.c | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 9b6f2ce96f15..fe684ccd38d4 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -264,31 +264,45 @@ void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) else mode = 0; - /* Try to set and enable ARP offload feature, this may fail, then it */ - /* is simply not supported and err 0 will be returned */ - err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); - if (err) { - brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", - mode, err); + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_OFFLOADS)) { + u32 feat_set = brcmf_offload_feat & (BRCMF_OL_ARP | BRCMF_OL_ND); + + if (!feat_set) + return; + + if (enable) + brcmf_generic_offload_config(ifp, feat_set, + brcmf_offload_prof, false); + else + brcmf_generic_offload_config(ifp, feat_set, + brcmf_offload_prof, true); } else { - err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); + /* Try to set and enable ARP offload feature, this may fail, then it */ + /* is simply not supported and err 0 will be returned */ + err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); if (err) { - brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", + brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", + mode, err); + } else { + err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); + if (err) { + brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", + enable, err); + } else { + brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", + enable, mode); + } + } + + err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable); + if (err) { + brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n", enable, err); } else { - brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", + brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n", enable, mode); } } - - err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable); - if (err) { - brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n", - enable, err); - } else { - brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n", - enable, mode); - } } static void _brcmf_set_multicast_list(struct work_struct *work) -- 2.25.1