brcm80211: fmac: move dongle statistics to struct brcmf_bus
authorFranky Lin <frankyl@broadcom.com>
Sat, 17 Dec 2011 02:37:06 +0000 (18:37 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 19 Dec 2011 19:40:45 +0000 (14:40 -0500)
Dongle statistics are shared data between common layer and bus
layer. This patch places them in bus interface structure brcmf_bus
as part of the fullmac bus interface refactoring.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/dhd.h
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c

index 44cad9b03dfc761c3407abbf325640f55fb038d1..86cb197e82cdaec183f5e7498e4725a66515abed 100644 (file)
@@ -578,6 +578,7 @@ struct brcmf_bus {
        enum brcmf_bus_state state;
        uint maxctl;            /* Max size rxctl request from proto to bus */
        bool drvr_up;           /* Status flag of driver up/down */
+       struct dngl_stats dstats;       /* Stats for dongle-based data */
 };
 
 /* Forward decls for struct brcmf_pub (see below) */
@@ -604,7 +605,6 @@ struct brcmf_pub {
        bool iswl;              /* Dongle-resident driver is wl */
        unsigned long drv_version;      /* Version of dongle-resident driver */
        u8 mac[ETH_ALEN];               /* MAC address obtained from dongle */
-       struct dngl_stats dstats;       /* Stats for dongle-based data */
 
        /* Additional stats for the bus level */
 
index 4f5ec431294e5a2047839296f3d628657da9a53e..e45609947ce137febad5c7e90e3e96ba097a09c5 100644 (file)
@@ -340,9 +340,9 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 
 done:
        if (ret)
-               drvr->dstats.tx_dropped++;
+               drvr->bus_if->dstats.tx_dropped++;
        else
-               drvr->dstats.tx_packets++;
+               drvr->bus_if->dstats.tx_packets++;
 
        /* Return ok: we always eat the packet */
        return 0;
@@ -427,7 +427,7 @@ void brcmf_rx_frame(struct device *dev, int ifidx,
                skb->protocol = eth_type_trans(skb, skb->dev);
 
                if (skb->pkt_type == PACKET_MULTICAST)
-                       drvr->dstats.multicast++;
+                       bus_if->dstats.multicast++;
 
                skb->data = eth;
                skb->len = len;
@@ -446,8 +446,8 @@ void brcmf_rx_frame(struct device *dev, int ifidx,
                        ifp->ndev->last_rx = jiffies;
                }
 
-               drvr->dstats.rx_bytes += skb->len;
-               drvr->dstats.rx_packets++;      /* Local count */
+               bus_if->dstats.rx_bytes += skb->len;
+               bus_if->dstats.rx_packets++;    /* Local count */
 
                if (in_interrupt())
                        netif_rx(skb);
@@ -483,20 +483,20 @@ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)
 static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev)
 {
        struct brcmf_if *ifp = netdev_priv(ndev);
-       struct brcmf_pub *drvr = ifp->drvr;
+       struct brcmf_bus *bus_if = ifp->drvr->bus_if;
 
        brcmf_dbg(TRACE, "Enter\n");
 
        /* Copy dongle stats to net device stats */
-       ifp->stats.rx_packets = drvr->dstats.rx_packets;
-       ifp->stats.tx_packets = drvr->dstats.tx_packets;
-       ifp->stats.rx_bytes = drvr->dstats.rx_bytes;
-       ifp->stats.tx_bytes = drvr->dstats.tx_bytes;
-       ifp->stats.rx_errors = drvr->dstats.rx_errors;
-       ifp->stats.tx_errors = drvr->dstats.tx_errors;
-       ifp->stats.rx_dropped = drvr->dstats.rx_dropped;
-       ifp->stats.tx_dropped = drvr->dstats.tx_dropped;
-       ifp->stats.multicast = drvr->dstats.multicast;
+       ifp->stats.rx_packets = bus_if->dstats.rx_packets;
+       ifp->stats.tx_packets = bus_if->dstats.tx_packets;
+       ifp->stats.rx_bytes = bus_if->dstats.rx_bytes;
+       ifp->stats.tx_bytes = bus_if->dstats.tx_bytes;
+       ifp->stats.rx_errors = bus_if->dstats.rx_errors;
+       ifp->stats.tx_errors = bus_if->dstats.tx_errors;
+       ifp->stats.rx_dropped = bus_if->dstats.rx_dropped;
+       ifp->stats.tx_dropped = bus_if->dstats.tx_dropped;
+       ifp->stats.multicast = bus_if->dstats.multicast;
 
        return &ifp->stats;
 }
index 255861b28fd2603048c62953d5b721406a03480c..4b0a87d9497b6cf9d0417b225eb614dde4683c26 100644 (file)
@@ -1263,7 +1263,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
                if (errcode < 0) {
                        brcmf_dbg(ERROR, "glom read of %d bytes failed: %d\n",
                                  dlen, errcode);
-                       bus->drvr->dstats.rx_errors++;
+                       bus->sdiodev->bus_if->dstats.rx_errors++;
 
                        if (bus->glomerr++ < 3) {
                                brcmf_sdbrcm_rxfail(bus, true, true);
@@ -1447,7 +1447,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
                        } else if (brcmf_proto_hdrpull(bus->sdiodev->dev,
                                                       &ifidx, pfirst) != 0) {
                                brcmf_dbg(ERROR, "rx protocol error\n");
-                               bus->drvr->dstats.rx_errors++;
+                               bus->sdiodev->bus_if->dstats.rx_errors++;
                                skb_unlink(pfirst, &bus->glom);
                                brcmu_pkt_buf_free_skb(pfirst);
                                continue;
@@ -1548,7 +1548,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
        if ((rdlen + BRCMF_FIRSTREAD) > bus->sdiodev->bus_if->maxctl) {
                brcmf_dbg(ERROR, "%d-byte control read exceeds %d-byte buffer\n",
                          rdlen, bus->sdiodev->bus_if->maxctl);
-               bus->drvr->dstats.rx_errors++;
+               bus->sdiodev->bus_if->dstats.rx_errors++;
                brcmf_sdbrcm_rxfail(bus, false, false);
                goto done;
        }
@@ -1556,7 +1556,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
        if ((len - doff) > bus->sdiodev->bus_if->maxctl) {
                brcmf_dbg(ERROR, "%d-byte ctl frame (%d-byte ctl data) exceeds %d-byte limit\n",
                          len, len - doff, bus->sdiodev->bus_if->maxctl);
-               bus->drvr->dstats.rx_errors++;
+               bus->sdiodev->bus_if->dstats.rx_errors++;
                bus->rx_toolong++;
                brcmf_sdbrcm_rxfail(bus, false, false);
                goto done;
@@ -1630,7 +1630,7 @@ brcmf_alloc_pkt_and_read(struct brcmf_sdio *bus, u16 rdlen,
                brcmf_dbg(ERROR, "(nextlen): read %d bytes failed: %d\n",
                          rdlen, sdret);
                brcmu_pkt_buf_free_skb(*pkt);
-               bus->drvr->dstats.rx_errors++;
+               bus->sdiodev->bus_if->dstats.rx_errors++;
                /* Force retry w/normal header read.
                 * Don't attempt NAK for
                 * gSPI
@@ -1979,7 +1979,7 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished)
                        /* Too long -- skip this frame */
                        brcmf_dbg(ERROR, "too long: len %d rdlen %d\n",
                                  len, rdlen);
-                       bus->drvr->dstats.rx_errors++;
+                       bus->sdiodev->bus_if->dstats.rx_errors++;
                        bus->rx_toolong++;
                        brcmf_sdbrcm_rxfail(bus, false, false);
                        continue;
@@ -1991,7 +1991,7 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished)
                        /* Give up on data, request rtx of events */
                        brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed: rdlen %d chan %d\n",
                                  rdlen, chan);
-                       bus->drvr->dstats.rx_dropped++;
+                       bus->sdiodev->bus_if->dstats.rx_dropped++;
                        brcmf_sdbrcm_rxfail(bus, false, RETRYCHAN(chan));
                        continue;
                }
@@ -2011,7 +2011,7 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished)
                                   : ((chan == SDPCM_DATA_CHANNEL) ? "data"
                                      : "test")), sdret);
                        brcmu_pkt_buf_free_skb(pkt);
-                       bus->drvr->dstats.rx_errors++;
+                       bus->sdiodev->bus_if->dstats.rx_errors++;
                        brcmf_sdbrcm_rxfail(bus, true, RETRYCHAN(chan));
                        continue;
                }
@@ -2064,7 +2064,7 @@ deliver:
                           pkt) != 0) {
                        brcmf_dbg(ERROR, "rx protocol error\n");
                        brcmu_pkt_buf_free_skb(pkt);
-                       bus->drvr->dstats.rx_errors++;
+                       bus->sdiodev->bus_if->dstats.rx_errors++;
                        continue;
                }
 
@@ -2276,9 +2276,9 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes)
 
                ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
                if (ret)
-                       bus->drvr->dstats.tx_errors++;
+                       bus->sdiodev->bus_if->dstats.tx_errors++;
                else
-                       bus->drvr->dstats.tx_bytes += datalen;
+                       bus->sdiodev->bus_if->dstats.tx_bytes += datalen;
 
                /* In poll mode, need to check for other events */
                if (!bus->intr && cnt) {