brcmfmac: initialize fws(ignal) for BCDC protocol only
PATCH 1/2 brcmfmac: initialize fws(ignal) for BCDC protocol only
From: Rafał Miłecki <[email protected]>
There are two protocols used by Broadcom FullMAC devices: BCDC and msgbuf. They use different ways for (some part of) communication with the firmware. Firmware Signaling is required for the first one only (BCDC).
So far we were always initializing fws and always calling it's skb processing function. It was fws that was passing skb processing to the protocol specific function. It was redundant for the msgbuf case.
Simply taking few lines of code out of fws allows us to totally avoid using it. This simplifies code flow, saves some memory & will allow further optimizations like not compiling fwsignal.c.
--- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 24 ++++++++++++++++------ .../broadcom/brcm80211/brcmfmac/fwsignal.c | 17 ++++++--------- .../broadcom/brcm80211/brcmfmac/fwsignal.h | 1 + 3 files changed, 25 insertions(+), 17 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +18 -6
@@ -250,7 +250,17 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,if (eh->h_proto ==htons (ETH_P_PAE ))atomic_inc (&ifp->pend_8021x_cnt); - ret =brcmf_fws_process_skb (ifp, skb); +/* determine the priority */ +if (skb->priority ==0 || skb->priority >7 ) + skb->priority =cfg80211_classify8021d (skb,NULL ); + +if (drvr->fws &&brcmf_fws_skbs_queueing (drvr->fws)) { + ret =brcmf_fws_process_skb (ifp, skb); + }else { + ret =brcmf_proto_txdata (drvr, ifp->ifidx,0 , skb); +if (ret <0 ) +brcmf_txfinalize (ifp, skb, false); + } done:if (ret) {
@@ -405,7 +415,7 @@ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)struct brcmf_if *ifp;/* await txstatus signal for firmware if active */ -if (brcmf_fws_fc_active (drvr->fws)) { +if (drvr->fws &&brcmf_fws_fc_active (drvr->fws)) {if (!success)brcmf_fws_bustxfail (drvr->fws, txp); }else {
@@ -1006,11 +1016,13 @@ int brcmf_bus_start(struct device *dev) }brcmf_feat_attach (drvr); - ret =brcmf_fws_init (drvr); -if (ret <0 ) - goto fail; +if (bus_if->proto_type ==BRCMF_PROTO_BCDC ) { + ret =brcmf_fws_init (drvr); +if (ret <0 ) + goto fail; -brcmf_fws_add_interface (ifp); +brcmf_fws_add_interface (ifp); + } drvr->config =brcmf_cfg80211_attach (drvr, bus_if->dev, drvr->settings->p2p_enable);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +6 -11
@@ -2100,16 +2100,6 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)int rc =0 ;brcmf_dbg (DATA ,"tx proto=0x%X\n" ,ntohs (eh->h_proto)); -/* determine the priority */ -if ((skb->priority ==0 ) || (skb->priority >7 )) - skb->priority =cfg80211_classify8021d (skb,NULL ); - -if (fws->avoid_queueing) { - rc =brcmf_proto_txdata (drvr, ifp->ifidx,0 , skb); -if (rc <0 ) -brcmf_txfinalize (ifp, skb, false); -return rc; - }/* set control buffer information */ skcb->if_flags =0 ;
@@ -2155,7 +2145,7 @@ void brcmf_fws_add_interface(struct brcmf_if *ifp)struct brcmf_fws_info *fws = ifp->drvr->fws;struct brcmf_fws_mac_descriptor *entry; -if (!ifp->ndev) +if (!fws || !ifp->ndev)return ; entry = &fws->desc.iface[ifp->ifidx];
@@ -2442,6 +2432,11 @@ void brcmf_fws_deinit(struct brcmf_pub *drvr)kfree (fws); } +bool brcmf_fws_skbs_queueing (struct brcmf_fws_info *fws) +{ +return !fws->avoid_queueing; +} +bool brcmf_fws_fc_active (struct brcmf_fws_info *fws) {if (!fws->creditmap_received)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h +1 -0
@@ -20,6 +20,7 @@int brcmf_fws_init (struct brcmf_pub *drvr);void brcmf_fws_deinit (struct brcmf_pub *drvr); +bool brcmf_fws_skbs_queueing (struct brcmf_fws_info *fws);bool brcmf_fws_fc_active (struct brcmf_fws_info *fws);void brcmf_fws_hdrpull (struct brcmf_if *ifp,s16 siglen,struct sk_buff *skb);int brcmf_fws_process_skb (struct brcmf_if *ifp,struct sk_buff *skb);
Signature · 1 line
2.9.3
PATCH 2/2 brcmfmac: compile fws(ignal) code only with BCDC support enabled
From: Rafał Miłecki <[email protected]>
It's not needed by the other (msgbuf) protocol, so let's save some size and compile it conditionally.
--- .../wireless/broadcom/brcm80211/brcmfmac/Makefile | 4 +- .../broadcom/brcm80211/brcmfmac/fwsignal.h | 59 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile +2 -2
@@ -27,7 +27,6 @@ brcmfmac-objs += \ chip.o \ fwil.o \ fweh.o \ - fwsignal.o \ p2p.o \ proto.o \ common.o \
@@ -37,7 +36,8 @@ brcmfmac-objs += \ btcoex.o \ vendor.o brcmfmac-$(CONFIG_BRCMFMAC_PROTO_BCDC) += \ - bcdc.o + bcdc.o \ + fwsignal.o brcmfmac-$(CONFIG_BRCMFMAC_PROTO_MSGBUF) += \ commonring.o \ flowring.o \
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h +59 -0
70 lines not on this page · raw message
Signature · 1 line
2.9.3
Arend Van Spriel
maintainerQuoted 7 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
There are two protocols used by Broadcom FullMAC devices: BCDC and msgbuf. They use different ways for (some part of) communication with the firmware. Firmware Signaling is required for the first one only (BCDC).
Quoted 7 lines
So far we were always initializing fws and always calling it's skb processing function. It was fws that was passing skb processing to the protocol specific function. It was redundant for the msgbuf case.
Simply taking few lines of code out of fws allows us to totally avoid using it. This simplifies code flow, saves some memory & will allow further optimizations like not compiling
fwsignal.c.
Hi Rafał,
Conceptually fwsignal is part of BCDC so you are indeed right when saying it is not needed for msgbuf. The signalling is actually part of the BCDC message overhead so I would rather see fwsignal only being used in BCDC code. Could try and do that on top of this patch, but I would prefer dropping these patches.
Regards,
Arend
Quoted 112 lines
Signed-off-by Rafał Miłecki <[email protected]>--- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 24 ++++++++++++++++------ .../broadcom/brcm80211/brcmfmac/fwsignal.c | 17 ++++++--------- .../broadcom/brcm80211/brcmfmac/fwsignal.h | 1 + 3 files changed, 25 insertions(+), 17 deletions(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +18
-6@@ -250,7 +250,17 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,if (eh->h_proto ==htons (ETH_P_PAE ))atomic_inc (&ifp->pend_8021x_cnt); - ret =brcmf_fws_process_skb (ifp, skb); +/* determine the priority */ +if (skb->priority ==0 || skb->priority >7 ) + skb->priority =cfg80211_classify8021d (skb,NULL ); + +if (drvr->fws &&brcmf_fws_skbs_queueing (drvr->fws)) { + ret =brcmf_fws_process_skb (ifp, skb); + }else { + ret =brcmf_proto_txdata (drvr, ifp->ifidx,0 , skb); +if (ret <0 ) +brcmf_txfinalize (ifp, skb, false); + } done:if (ret) {@@ -405,7 +415,7 @@ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)struct brcmf_if *ifp;/* await txstatus signal for firmware if active */ -if (brcmf_fws_fc_active (drvr->fws)) { +if (drvr->fws &&brcmf_fws_fc_active (drvr->fws)) {if (!success)brcmf_fws_bustxfail (drvr->fws, txp); }else {@@ -1006,11 +1016,13 @@ int brcmf_bus_start(struct device *dev) }brcmf_feat_attach (drvr); - ret =brcmf_fws_init (drvr); -if (ret <0 ) - goto fail; +if (bus_if->proto_type ==BRCMF_PROTO_BCDC ) { + ret =brcmf_fws_init (drvr); +if (ret <0 ) + goto fail; -brcmf_fws_add_interface (ifp); +brcmf_fws_add_interface (ifp); + } drvr->config =brcmf_cfg80211_attach (drvr, bus_if->dev, drvr->settings->p2p_enable);drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +6
-11@@ -2100,16 +2100,6 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)int rc =0 ;brcmf_dbg (DATA ,"tx proto=0x%X\n" ,ntohs (eh->h_proto)); -/* determine the priority */ -if ((skb->priority ==0 ) || (skb->priority >7 )) - skb->priority =cfg80211_classify8021d (skb,NULL ); - -if (fws->avoid_queueing) { - rc =brcmf_proto_txdata (drvr, ifp->ifidx,0 , skb); -if (rc <0 ) -brcmf_txfinalize (ifp, skb, false); -return rc; - }/* set control buffer information */ skcb->if_flags =0 ;@@ -2155,7 +2145,7 @@ void brcmf_fws_add_interface(struct brcmf_if *ifp)struct brcmf_fws_info *fws = ifp->drvr->fws;struct brcmf_fws_mac_descriptor *entry; -if (!ifp->ndev) +if (!fws || !ifp->ndev)return ; entry = &fws->desc.iface[ifp->ifidx];@@ -2442,6 +2432,11 @@ void brcmf_fws_deinit(struct brcmf_pub *drvr)kfree (fws); } +bool brcmf_fws_skbs_queueing (struct brcmf_fws_info *fws) +{ +return !fws->avoid_queueing; +} +bool brcmf_fws_fc_active (struct brcmf_fws_info *fws) {if (!fws->creditmap_received)drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h +1
-0@@ -20,6 +20,7 @@int brcmf_fws_init (struct brcmf_pub *drvr);void brcmf_fws_deinit (struct brcmf_pub *drvr); +bool brcmf_fws_skbs_queueing (struct brcmf_fws_info *fws);bool brcmf_fws_fc_active (struct brcmf_fws_info *fws);void brcmf_fws_hdrpull (struct brcmf_if *ifp,s16 siglen,struct sk_buff *skb);int brcmf_fws_process_skb (struct brcmf_if *ifp,struct sk_buff *skb);