aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorArend van Spriel <arend@broadcom.com>2013-01-02 09:22:43 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-01-07 15:16:56 -0500
commita43af515f6252e62604a1bfc139d43fa43ef5b6f (patch)
treedc9fd15a79f4cfc7fffb5b61a0176b2771dda7af /drivers/net
parent3aa7aad2b2da32dd897900ab3eb62348a54d2dc1 (diff)
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: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd.h4
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h7
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c6
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c19
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c19
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.c17
6 files changed, 29 insertions, 43 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
index 7245b171190a..4937bf4d5506 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
@@ -577,6 +577,10 @@ extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx,
577extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, 577extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
578 void *buf, uint len); 578 void *buf, uint len);
579 579
580/* Remove any protocol-specific data header. */
581extern int brcmf_proto_hdrpull(struct brcmf_pub *drvr, u8 *ifidx,
582 struct sk_buff *rxp);
583
580extern int brcmf_net_attach(struct brcmf_if *ifp); 584extern int brcmf_net_attach(struct brcmf_if *ifp);
581extern struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx, 585extern struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx,
582 s32 bssidx, char *name, u8 *mac_addr); 586 s32 bssidx, char *name, u8 *mac_addr);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
index 639bc2a2d03c..64c38f4226a3 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
@@ -130,16 +130,11 @@ int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
130 * interface functions from common layer 130 * interface functions from common layer
131 */ 131 */
132 132
133/* Remove any protocol-specific data header. */
134extern int brcmf_proto_hdrpull(struct device *dev, int *ifidx,
135 struct sk_buff *rxp);
136
137extern bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, 133extern bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
138 struct sk_buff *pkt, int prec); 134 struct sk_buff *pkt, int prec);
139 135
140/* Receive frame for delivery to OS. Callee disposes of rxp. */ 136/* Receive frame for delivery to OS. Callee disposes of rxp. */
141extern void brcmf_rx_frames(struct device *dev, u8 ifidx, 137extern void brcmf_rx_frames(struct device *dev, struct sk_buff_head *rxlist);
142 struct sk_buff_head *rxlist);
143 138
144/* Indication from bus module regarding presence/insertion of dongle. */ 139/* Indication from bus module regarding presence/insertion of dongle. */
145extern int brcmf_attach(uint bus_hdrlen, struct device *dev); 140extern int brcmf_attach(uint bus_hdrlen, struct device *dev);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
index 0c83998af181..aa37f3e614b6 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
@@ -303,12 +303,10 @@ void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx,
303 BDC_SET_IF_IDX(h, ifidx); 303 BDC_SET_IF_IDX(h, ifidx);
304} 304}
305 305
306int brcmf_proto_hdrpull(struct device *dev, int *ifidx, 306int brcmf_proto_hdrpull(struct brcmf_pub *drvr, u8 *ifidx,
307 struct sk_buff *pktbuf) 307 struct sk_buff *pktbuf)
308{ 308{
309 struct brcmf_proto_bdc_header *h; 309 struct brcmf_proto_bdc_header *h;
310 struct brcmf_bus *bus_if = dev_get_drvdata(dev);
311 struct brcmf_pub *drvr = bus_if->drvr;
312 310
313 brcmf_dbg(TRACE, "Enter\n"); 311 brcmf_dbg(TRACE, "Enter\n");
314 312
@@ -346,6 +344,8 @@ int brcmf_proto_hdrpull(struct device *dev, int *ifidx,
346 skb_pull(pktbuf, BDC_HEADER_LEN); 344 skb_pull(pktbuf, BDC_HEADER_LEN);
347 skb_pull(pktbuf, h->data_offset << 2); 345 skb_pull(pktbuf, h->data_offset << 2);
348 346
347 if (pktbuf->len == 0)
348 return -ENODATA;
349 return 0; 349 return 0;
350} 350}
351 351
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index a820f58100b7..682cb02a4674 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -248,8 +248,7 @@ void brcmf_txflowblock(struct device *dev, bool state)
248 } 248 }
249} 249}
250 250
251void brcmf_rx_frames(struct device *dev, u8 ifidx, 251void brcmf_rx_frames(struct device *dev, struct sk_buff_head *skb_list)
252 struct sk_buff_head *skb_list)
253{ 252{
254 unsigned char *eth; 253 unsigned char *eth;
255 uint len; 254 uint len;
@@ -257,12 +256,24 @@ void brcmf_rx_frames(struct device *dev, u8 ifidx,
257 struct brcmf_if *ifp; 256 struct brcmf_if *ifp;
258 struct brcmf_bus *bus_if = dev_get_drvdata(dev); 257 struct brcmf_bus *bus_if = dev_get_drvdata(dev);
259 struct brcmf_pub *drvr = bus_if->drvr; 258 struct brcmf_pub *drvr = bus_if->drvr;
259 u8 ifidx;
260 int ret;
260 261
261 brcmf_dbg(TRACE, "Enter\n"); 262 brcmf_dbg(TRACE, "Enter\n");
262 263
263 skb_queue_walk_safe(skb_list, skb, pnext) { 264 skb_queue_walk_safe(skb_list, skb, pnext) {
264 skb_unlink(skb, skb_list); 265 skb_unlink(skb, skb_list);
265 266
267 /* process and remove protocol-specific header
268 */
269 ret = brcmf_proto_hdrpull(drvr, &ifidx, skb);
270 if (ret < 0) {
271 if (ret != -ENODATA)
272 bus_if->dstats.rx_errors++;
273 brcmu_pkt_buf_free_skb(skb);
274 continue;
275 }
276
266 /* Get the protocol, maintain skb around eth_type_trans() 277 /* Get the protocol, maintain skb around eth_type_trans()
267 * The main reason for this hack is for the limitation of 278 * The main reason for this hack is for the limitation of
268 * Linux 2.4 where 'eth_type_trans' uses the 279 * Linux 2.4 where 'eth_type_trans' uses the
@@ -326,13 +337,13 @@ void brcmf_rx_frames(struct device *dev, u8 ifidx,
326 337
327void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success) 338void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)
328{ 339{
329 uint ifidx; 340 u8 ifidx;
330 struct ethhdr *eh; 341 struct ethhdr *eh;
331 u16 type; 342 u16 type;
332 struct brcmf_bus *bus_if = dev_get_drvdata(dev); 343 struct brcmf_bus *bus_if = dev_get_drvdata(dev);
333 struct brcmf_pub *drvr = bus_if->drvr; 344 struct brcmf_pub *drvr = bus_if->drvr;
334 345
335 brcmf_proto_hdrpull(dev, &ifidx, txp); 346 brcmf_proto_hdrpull(drvr, &ifidx, txp);
336 347
337 eh = (struct ethhdr *)(txp->data); 348 eh = (struct ethhdr *)(txp->data);
338 type = ntohs(eh->h_proto); 349 type = ntohs(eh->h_proto);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index 13ea9b48acdb..7fef9b5ba003 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -1167,7 +1167,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1167 int errcode; 1167 int errcode;
1168 u8 doff, sfdoff; 1168 u8 doff, sfdoff;
1169 1169
1170 int ifidx = 0;
1171 bool usechain = bus->use_rxchain; 1170 bool usechain = bus->use_rxchain;
1172 1171
1173 struct brcmf_sdio_read rd_new; 1172 struct brcmf_sdio_read rd_new;
@@ -1386,13 +1385,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1386 skb_unlink(pfirst, &bus->glom); 1385 skb_unlink(pfirst, &bus->glom);
1387 brcmu_pkt_buf_free_skb(pfirst); 1386 brcmu_pkt_buf_free_skb(pfirst);
1388 continue; 1387 continue;
1389 } else if (brcmf_proto_hdrpull(bus->sdiodev->dev,
1390 &ifidx, pfirst) != 0) {
1391 brcmf_err("rx protocol error\n");
1392 bus->sdiodev->bus_if->dstats.rx_errors++;
1393 skb_unlink(pfirst, &bus->glom);
1394 brcmu_pkt_buf_free_skb(pfirst);
1395 continue;
1396 } 1388 }
1397 1389
1398 brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), 1390 brcmf_dbg_hex_dump(BRCMF_GLOM_ON(),
@@ -1405,7 +1397,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1405 } 1397 }
1406 /* sent any remaining packets up */ 1398 /* sent any remaining packets up */
1407 if (bus->glom.qlen) 1399 if (bus->glom.qlen)
1408 brcmf_rx_frames(bus->sdiodev->dev, ifidx, &bus->glom); 1400 brcmf_rx_frames(bus->sdiodev->dev, &bus->glom);
1409 1401
1410 bus->sdcnt.rxglomframes++; 1402 bus->sdcnt.rxglomframes++;
1411 bus->sdcnt.rxglompkts += bus->glom.qlen; 1403 bus->sdcnt.rxglompkts += bus->glom.qlen;
@@ -1560,7 +1552,6 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1560 u16 pad; /* Number of pad bytes to read */ 1552 u16 pad; /* Number of pad bytes to read */
1561 uint rxleft = 0; /* Remaining number of frames allowed */ 1553 uint rxleft = 0; /* Remaining number of frames allowed */
1562 int sdret; /* Return code from calls */ 1554 int sdret; /* Return code from calls */
1563 int ifidx = 0;
1564 uint rxcount = 0; /* Total frames read */ 1555 uint rxcount = 0; /* Total frames read */
1565 struct brcmf_sdio_read *rd = &bus->cur_read, rd_new; 1556 struct brcmf_sdio_read *rd = &bus->cur_read, rd_new;
1566 u8 head_read = 0; 1557 u8 head_read = 0;
@@ -1759,17 +1750,11 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1759 if (pkt->len == 0) { 1750 if (pkt->len == 0) {
1760 brcmu_pkt_buf_free_skb(pkt); 1751 brcmu_pkt_buf_free_skb(pkt);
1761 continue; 1752 continue;
1762 } else if (brcmf_proto_hdrpull(bus->sdiodev->dev, &ifidx,
1763 pkt) != 0) {
1764 brcmf_err("rx protocol error\n");
1765 brcmu_pkt_buf_free_skb(pkt);
1766 bus->sdiodev->bus_if->dstats.rx_errors++;
1767 continue;
1768 } 1753 }
1769 1754
1770 skb_queue_head_init(&pktlist); 1755 skb_queue_head_init(&pktlist);
1771 skb_queue_tail(&pktlist, pkt); 1756 skb_queue_tail(&pktlist, pkt);
1772 brcmf_rx_frames(bus->sdiodev->dev, ifidx, &pktlist); 1757 brcmf_rx_frames(bus->sdiodev->dev, &pktlist);
1773 } 1758 }
1774 1759
1775 rxcount = maxframes - rxleft; 1760 rxcount = maxframes - rxleft;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index 34342ff718db..e15630cc3889 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -444,14 +444,14 @@ static void brcmf_usb_rx_complete(struct urb *urb)
444 struct brcmf_usbdev_info *devinfo = req->devinfo; 444 struct brcmf_usbdev_info *devinfo = req->devinfo;
445 struct sk_buff *skb; 445 struct sk_buff *skb;
446 struct sk_buff_head skbq; 446 struct sk_buff_head skbq;
447 int ifidx = 0;
448 447
449 brcmf_dbg(USB, "Enter, urb->status=%d\n", urb->status); 448 brcmf_dbg(USB, "Enter, urb->status=%d\n", urb->status);
450 brcmf_usb_del_fromq(devinfo, req); 449 brcmf_usb_del_fromq(devinfo, req);
451 skb = req->skb; 450 skb = req->skb;
452 req->skb = NULL; 451 req->skb = NULL;
453 452
454 if (urb->status == 0) { 453 /* zero lenght packets indicate usb "failure". Do not refill */
454 if (urb->status == 0 && urb->actual_length) {
455 devinfo->bus_pub.bus->dstats.rx_packets++; 455 devinfo->bus_pub.bus->dstats.rx_packets++;
456 } else { 456 } else {
457 devinfo->bus_pub.bus->dstats.rx_errors++; 457 devinfo->bus_pub.bus->dstats.rx_errors++;
@@ -464,17 +464,8 @@ static void brcmf_usb_rx_complete(struct urb *urb)
464 skb_queue_head_init(&skbq); 464 skb_queue_head_init(&skbq);
465 skb_queue_tail(&skbq, skb); 465 skb_queue_tail(&skbq, skb);
466 skb_put(skb, urb->actual_length); 466 skb_put(skb, urb->actual_length);
467 if (brcmf_proto_hdrpull(devinfo->dev, &ifidx, skb) != 0) { 467 brcmf_rx_frames(devinfo->dev, &skbq);
468 brcmf_err("rx protocol error\n"); 468 brcmf_usb_rx_refill(devinfo, req);
469 brcmu_pkt_buf_free_skb(skb);
470 devinfo->bus_pub.bus->dstats.rx_errors++;
471 } else
472 brcmf_rx_frames(devinfo->dev, ifidx, &skbq);
473 /* zero lenght packets indicate usb "failure". Do not refill */
474 if (urb->actual_length)
475 brcmf_usb_rx_refill(devinfo, req);
476 else
477 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL);
478 } else { 469 } else {
479 brcmu_pkt_buf_free_skb(skb); 470 brcmu_pkt_buf_free_skb(skb);
480 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); 471 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL);