Commit a43af515 authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmfmac: remove brcmf_proto_hdrpull() from bus interface

The use of the function brcmf_proto_hdrpull() is moved to the
common part of the driver and consequently it can be removed
from the bus interface.
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3aa7aad2
...@@ -577,6 +577,10 @@ extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, ...@@ -577,6 +577,10 @@ extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx,
extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
void *buf, uint len); void *buf, uint len);
/* Remove any protocol-specific data header. */
extern int brcmf_proto_hdrpull(struct brcmf_pub *drvr, u8 *ifidx,
struct sk_buff *rxp);
extern int brcmf_net_attach(struct brcmf_if *ifp); extern int brcmf_net_attach(struct brcmf_if *ifp);
extern struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx, extern struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx,
s32 bssidx, char *name, u8 *mac_addr); s32 bssidx, char *name, u8 *mac_addr);
......
...@@ -130,16 +130,11 @@ int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len) ...@@ -130,16 +130,11 @@ int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
* interface functions from common layer * interface functions from common layer
*/ */
/* Remove any protocol-specific data header. */
extern int brcmf_proto_hdrpull(struct device *dev, int *ifidx,
struct sk_buff *rxp);
extern bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, extern bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
struct sk_buff *pkt, int prec); struct sk_buff *pkt, int prec);
/* Receive frame for delivery to OS. Callee disposes of rxp. */ /* Receive frame for delivery to OS. Callee disposes of rxp. */
extern void brcmf_rx_frames(struct device *dev, u8 ifidx, extern void brcmf_rx_frames(struct device *dev, struct sk_buff_head *rxlist);
struct sk_buff_head *rxlist);
/* Indication from bus module regarding presence/insertion of dongle. */ /* Indication from bus module regarding presence/insertion of dongle. */
extern int brcmf_attach(uint bus_hdrlen, struct device *dev); extern int brcmf_attach(uint bus_hdrlen, struct device *dev);
......
...@@ -303,12 +303,10 @@ void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx, ...@@ -303,12 +303,10 @@ void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx,
BDC_SET_IF_IDX(h, ifidx); BDC_SET_IF_IDX(h, ifidx);
} }
int brcmf_proto_hdrpull(struct device *dev, int *ifidx, int brcmf_proto_hdrpull(struct brcmf_pub *drvr, u8 *ifidx,
struct sk_buff *pktbuf) struct sk_buff *pktbuf)
{ {
struct brcmf_proto_bdc_header *h; struct brcmf_proto_bdc_header *h;
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_pub *drvr = bus_if->drvr;
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
...@@ -346,6 +344,8 @@ int brcmf_proto_hdrpull(struct device *dev, int *ifidx, ...@@ -346,6 +344,8 @@ int brcmf_proto_hdrpull(struct device *dev, int *ifidx,
skb_pull(pktbuf, BDC_HEADER_LEN); skb_pull(pktbuf, BDC_HEADER_LEN);
skb_pull(pktbuf, h->data_offset << 2); skb_pull(pktbuf, h->data_offset << 2);
if (pktbuf->len == 0)
return -ENODATA;
return 0; return 0;
} }
......
...@@ -248,8 +248,7 @@ void brcmf_txflowblock(struct device *dev, bool state) ...@@ -248,8 +248,7 @@ void brcmf_txflowblock(struct device *dev, bool state)
} }
} }
void brcmf_rx_frames(struct device *dev, u8 ifidx, void brcmf_rx_frames(struct device *dev, struct sk_buff_head *skb_list)
struct sk_buff_head *skb_list)
{ {
unsigned char *eth; unsigned char *eth;
uint len; uint len;
...@@ -257,12 +256,24 @@ void brcmf_rx_frames(struct device *dev, u8 ifidx, ...@@ -257,12 +256,24 @@ void brcmf_rx_frames(struct device *dev, u8 ifidx,
struct brcmf_if *ifp; struct brcmf_if *ifp;
struct brcmf_bus *bus_if = dev_get_drvdata(dev); struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_pub *drvr = bus_if->drvr; struct brcmf_pub *drvr = bus_if->drvr;
u8 ifidx;
int ret;
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
skb_queue_walk_safe(skb_list, skb, pnext) { skb_queue_walk_safe(skb_list, skb, pnext) {
skb_unlink(skb, skb_list); skb_unlink(skb, skb_list);
/* process and remove protocol-specific header
*/
ret = brcmf_proto_hdrpull(drvr, &ifidx, skb);
if (ret < 0) {
if (ret != -ENODATA)
bus_if->dstats.rx_errors++;
brcmu_pkt_buf_free_skb(skb);
continue;
}
/* Get the protocol, maintain skb around eth_type_trans() /* Get the protocol, maintain skb around eth_type_trans()
* The main reason for this hack is for the limitation of * The main reason for this hack is for the limitation of
* Linux 2.4 where 'eth_type_trans' uses the * Linux 2.4 where 'eth_type_trans' uses the
...@@ -326,13 +337,13 @@ void brcmf_rx_frames(struct device *dev, u8 ifidx, ...@@ -326,13 +337,13 @@ void brcmf_rx_frames(struct device *dev, u8 ifidx,
void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success) void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)
{ {
uint ifidx; u8 ifidx;
struct ethhdr *eh; struct ethhdr *eh;
u16 type; u16 type;
struct brcmf_bus *bus_if = dev_get_drvdata(dev); struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_pub *drvr = bus_if->drvr; struct brcmf_pub *drvr = bus_if->drvr;
brcmf_proto_hdrpull(dev, &ifidx, txp); brcmf_proto_hdrpull(drvr, &ifidx, txp);
eh = (struct ethhdr *)(txp->data); eh = (struct ethhdr *)(txp->data);
type = ntohs(eh->h_proto); type = ntohs(eh->h_proto);
......
...@@ -1167,7 +1167,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) ...@@ -1167,7 +1167,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
int errcode; int errcode;
u8 doff, sfdoff; u8 doff, sfdoff;
int ifidx = 0;
bool usechain = bus->use_rxchain; bool usechain = bus->use_rxchain;
struct brcmf_sdio_read rd_new; struct brcmf_sdio_read rd_new;
...@@ -1386,13 +1385,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) ...@@ -1386,13 +1385,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
skb_unlink(pfirst, &bus->glom); skb_unlink(pfirst, &bus->glom);
brcmu_pkt_buf_free_skb(pfirst); brcmu_pkt_buf_free_skb(pfirst);
continue; continue;
} else if (brcmf_proto_hdrpull(bus->sdiodev->dev,
&ifidx, pfirst) != 0) {
brcmf_err("rx protocol error\n");
bus->sdiodev->bus_if->dstats.rx_errors++;
skb_unlink(pfirst, &bus->glom);
brcmu_pkt_buf_free_skb(pfirst);
continue;
} }
brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), brcmf_dbg_hex_dump(BRCMF_GLOM_ON(),
...@@ -1405,7 +1397,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) ...@@ -1405,7 +1397,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
} }
/* sent any remaining packets up */ /* sent any remaining packets up */
if (bus->glom.qlen) if (bus->glom.qlen)
brcmf_rx_frames(bus->sdiodev->dev, ifidx, &bus->glom); brcmf_rx_frames(bus->sdiodev->dev, &bus->glom);
bus->sdcnt.rxglomframes++; bus->sdcnt.rxglomframes++;
bus->sdcnt.rxglompkts += bus->glom.qlen; bus->sdcnt.rxglompkts += bus->glom.qlen;
...@@ -1560,7 +1552,6 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1560,7 +1552,6 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
u16 pad; /* Number of pad bytes to read */ u16 pad; /* Number of pad bytes to read */
uint rxleft = 0; /* Remaining number of frames allowed */ uint rxleft = 0; /* Remaining number of frames allowed */
int sdret; /* Return code from calls */ int sdret; /* Return code from calls */
int ifidx = 0;
uint rxcount = 0; /* Total frames read */ uint rxcount = 0; /* Total frames read */
struct brcmf_sdio_read *rd = &bus->cur_read, rd_new; struct brcmf_sdio_read *rd = &bus->cur_read, rd_new;
u8 head_read = 0; u8 head_read = 0;
...@@ -1759,17 +1750,11 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1759,17 +1750,11 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
if (pkt->len == 0) { if (pkt->len == 0) {
brcmu_pkt_buf_free_skb(pkt); brcmu_pkt_buf_free_skb(pkt);
continue; continue;
} else if (brcmf_proto_hdrpull(bus->sdiodev->dev, &ifidx,
pkt) != 0) {
brcmf_err("rx protocol error\n");
brcmu_pkt_buf_free_skb(pkt);
bus->sdiodev->bus_if->dstats.rx_errors++;
continue;
} }
skb_queue_head_init(&pktlist); skb_queue_head_init(&pktlist);
skb_queue_tail(&pktlist, pkt); skb_queue_tail(&pktlist, pkt);
brcmf_rx_frames(bus->sdiodev->dev, ifidx, &pktlist); brcmf_rx_frames(bus->sdiodev->dev, &pktlist);
} }
rxcount = maxframes - rxleft; rxcount = maxframes - rxleft;
......
...@@ -444,14 +444,14 @@ static void brcmf_usb_rx_complete(struct urb *urb) ...@@ -444,14 +444,14 @@ static void brcmf_usb_rx_complete(struct urb *urb)
struct brcmf_usbdev_info *devinfo = req->devinfo; struct brcmf_usbdev_info *devinfo = req->devinfo;
struct sk_buff *skb; struct sk_buff *skb;
struct sk_buff_head skbq; struct sk_buff_head skbq;
int ifidx = 0;
brcmf_dbg(USB, "Enter, urb->status=%d\n", urb->status); brcmf_dbg(USB, "Enter, urb->status=%d\n", urb->status);
brcmf_usb_del_fromq(devinfo, req); brcmf_usb_del_fromq(devinfo, req);
skb = req->skb; skb = req->skb;
req->skb = NULL; req->skb = NULL;
if (urb->status == 0) { /* zero lenght packets indicate usb "failure". Do not refill */
if (urb->status == 0 && urb->actual_length) {
devinfo->bus_pub.bus->dstats.rx_packets++; devinfo->bus_pub.bus->dstats.rx_packets++;
} else { } else {
devinfo->bus_pub.bus->dstats.rx_errors++; devinfo->bus_pub.bus->dstats.rx_errors++;
...@@ -464,17 +464,8 @@ static void brcmf_usb_rx_complete(struct urb *urb) ...@@ -464,17 +464,8 @@ static void brcmf_usb_rx_complete(struct urb *urb)
skb_queue_head_init(&skbq); skb_queue_head_init(&skbq);
skb_queue_tail(&skbq, skb); skb_queue_tail(&skbq, skb);
skb_put(skb, urb->actual_length); skb_put(skb, urb->actual_length);
if (brcmf_proto_hdrpull(devinfo->dev, &ifidx, skb) != 0) { brcmf_rx_frames(devinfo->dev, &skbq);
brcmf_err("rx protocol error\n"); brcmf_usb_rx_refill(devinfo, req);
brcmu_pkt_buf_free_skb(skb);
devinfo->bus_pub.bus->dstats.rx_errors++;
} else
brcmf_rx_frames(devinfo->dev, ifidx, &skbq);
/* zero lenght packets indicate usb "failure". Do not refill */
if (urb->actual_length)
brcmf_usb_rx_refill(devinfo, req);
else
brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL);
} else { } else {
brcmu_pkt_buf_free_skb(skb); brcmu_pkt_buf_free_skb(skb);
brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment