brcmfmac: (clean) Move sdio related function.
authorHante Meuleman <meuleman@broadcom.com>
Tue, 28 Oct 2014 13:56:19 +0000 (14:56 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 30 Oct 2014 19:26:48 +0000 (15:26 -0400)
prec_enq is a sdio specific function. Move it to sdio.c.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/common.c
drivers/net/wireless/brcm80211/brcmfmac/core.h
drivers/net/wireless/brcm80211/brcmfmac/sdio.c

index 183cec9939eaffb47b937bff17970739be783289..1861a13e8d03d6157455001ac5a37fb18de1dc63 100644 (file)
 /* boost value for RSSI_DELTA in preferred join selection */
 #define BRCMF_JOIN_PREF_RSSI_BOOST     8
 
-
-bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
-                     struct sk_buff *pkt, int prec)
-{
-       struct sk_buff *p;
-       int eprec = -1;         /* precedence to evict from */
-       bool discard_oldest;
-       struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-       struct brcmf_pub *drvr = bus_if->drvr;
-
-       /* Fast case, precedence queue is not full and we are also not
-        * exceeding total queue length
-        */
-       if (!pktq_pfull(q, prec) && !pktq_full(q)) {
-               brcmu_pktq_penq(q, prec, pkt);
-               return true;
-       }
-
-       /* Determine precedence from which to evict packet, if any */
-       if (pktq_pfull(q, prec)) {
-               eprec = prec;
-       } else if (pktq_full(q)) {
-               p = brcmu_pktq_peek_tail(q, &eprec);
-               if (eprec > prec)
-                       return false;
-       }
-
-       /* Evict if needed */
-       if (eprec >= 0) {
-               /* Detect queueing to unconfigured precedence */
-               discard_oldest = ac_bitmap_tst(drvr->wme_dp, eprec);
-               if (eprec == prec && !discard_oldest)
-                       return false;   /* refuse newer (incoming) packet */
-               /* Evict packet according to discard policy */
-               p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) :
-                       brcmu_pktq_pdeq_tail(q, eprec);
-               if (p == NULL)
-                       brcmf_err("brcmu_pktq_penq() failed, oldest %d\n",
-                                 discard_oldest);
-
-               brcmu_pkt_buf_free_skb(p);
-       }
-
-       /* Enqueue */
-       p = brcmu_pktq_penq(q, prec, pkt);
-       if (p == NULL)
-               brcmf_err("brcmu_pktq_penq() failed\n");
-
-       return p != NULL;
-}
-
 int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
 {
        s8 eventmask[BRCMF_EVENTING_MASK_LEN];
index 7df22bdb19a29b2e8df8b5a83e108bc765a36744..98228e922d3ae3dffd83e38b328c960700008db1 100644 (file)
@@ -83,7 +83,6 @@ struct brcmf_pub {
        /* Internal brcmf items */
        uint hdrlen;            /* Total BRCMF header length (proto + bus) */
        uint rxsz;              /* Rx buffer size bus module should use */
-       u8 wme_dp;              /* wme discard priority */
 
        /* Dongle media info */
        char fwver[BRCMF_DRIVER_FIRMWARE_VERSION_LEN];
index 73ac0c38a32a5dd863bec118e7d1ef473519be4e..72e87b51f9993c0f1d896bdb9f06644cfafd7678 100644 (file)
@@ -2763,6 +2763,48 @@ static struct pktq *brcmf_sdio_bus_gettxq(struct device *dev)
        return &bus->txq;
 }
 
+static bool brcmf_sdio_prec_enq(struct pktq *q, struct sk_buff *pkt, int prec)
+{
+       struct sk_buff *p;
+       int eprec = -1;         /* precedence to evict from */
+
+       /* Fast case, precedence queue is not full and we are also not
+        * exceeding total queue length
+        */
+       if (!pktq_pfull(q, prec) && !pktq_full(q)) {
+               brcmu_pktq_penq(q, prec, pkt);
+               return true;
+       }
+
+       /* Determine precedence from which to evict packet, if any */
+       if (pktq_pfull(q, prec)) {
+               eprec = prec;
+       } else if (pktq_full(q)) {
+               p = brcmu_pktq_peek_tail(q, &eprec);
+               if (eprec > prec)
+                       return false;
+       }
+
+       /* Evict if needed */
+       if (eprec >= 0) {
+               /* Detect queueing to unconfigured precedence */
+               if (eprec == prec)
+                       return false;   /* refuse newer (incoming) packet */
+               /* Evict packet according to discard policy */
+               p = brcmu_pktq_pdeq_tail(q, eprec);
+               if (p == NULL)
+                       brcmf_err("brcmu_pktq_pdeq_tail() failed\n");
+               brcmu_pkt_buf_free_skb(p);
+       }
+
+       /* Enqueue */
+       p = brcmu_pktq_penq(q, prec, pkt);
+       if (p == NULL)
+               brcmf_err("brcmu_pktq_penq() failed\n");
+
+       return p != NULL;
+}
+
 static int brcmf_sdio_bus_txdata(struct device *dev, struct sk_buff *pkt)
 {
        int ret = -EBADE;
@@ -2788,7 +2830,7 @@ static int brcmf_sdio_bus_txdata(struct device *dev, struct sk_buff *pkt)
        spin_lock_bh(&bus->txq_lock);
        /* reset bus_flags in packet cb */
        *(u16 *)(pkt->cb) = 0;
-       if (!brcmf_c_prec_enq(bus->sdiodev->dev, &bus->txq, pkt, prec)) {
+       if (!brcmf_sdio_prec_enq(&bus->txq, pkt, prec)) {
                skb_pull(pkt, bus->tx_hdrlen);
                brcmf_err("out of bus->txq !!!\n");
                ret = -ENOSR;
@@ -2798,7 +2840,7 @@ static int brcmf_sdio_bus_txdata(struct device *dev, struct sk_buff *pkt)
 
        if (pktq_len(&bus->txq) >= TXHI) {
                bus->txoff = true;
-               brcmf_txflowblock(bus->sdiodev->dev, true);
+               brcmf_txflowblock(dev, true);
        }
        spin_unlock_bh(&bus->txq_lock);