67 #include <linux/module.h>
68 #include <linux/slab.h>
69 #include <linux/types.h>
70 #include <linux/kernel.h>
84 #include <linux/netdevice.h>
85 #include <linux/ethtool.h>
106 #include <wl_profile.h>
122 extern dbg_info_t *DbgInfo;
127 #define MTU_MAX (HCF_MAX_MSG - ETH_HLEN - 8)
129 #define MTU_MAX (HCF_MAX_MSG - ETH_HLEN)
139 #define BLOCK_INPUT(buf, len) \
140 desc->buf_addr = buf; \
141 desc->BUF_SIZE = len; \
142 status = hcf_rcv_msg(&(lp->hcfCtx), desc, 0)
144 #define BLOCK_INPUT_DMA(buf, len) memcpy( buf, desc_next->buf_addr, pktlen )
215 DBG_PARAM( DbgInfo,
"map",
"0x%p", map );
260 wl_lock( lp, &flags );
263 if( lp->useRTS == 1 ) {
264 wl_unlock( lp, &flags );
275 if( dev == lp->wds_port[count].
dev ) {
283 if( pStats ==
NULL ) {
284 pStats = &( lp->
stats );
287 wl_unlock( lp, &flags );
323 wl_lock( lp, &flags );
326 if( lp->useRTS == 1 ) {
327 DBG_TRACE( DbgInfo,
"Skipping device open, in RTS mode\n" );
328 wl_unlock( lp, &flags );
339 DBG_TRACE( DbgInfo,
"Enabling Port 0\n" );
343 DBG_TRACE( DbgInfo,
"Enable port 0 failed: 0x%x\n", status );
348 wl_unlock(lp, &flags);
349 wl_lock( lp, &flags );
352 DBG_TRACE( DbgInfo,
";???? Kludgy way to force a download\n" );
353 status =
wl_go( lp );
359 wl_unlock(lp, &flags);
360 wl_lock( lp, &flags );
368 wl_unlock(lp, &flags);
369 wl_lock( lp, &flags );
378 netif_start_queue( dev );
385 wl_unlock( lp, &flags );
421 netif_stop_queue( dev );
434 wl_lock( lp, &flags );
440 if( lp->useRTS == 1 ) {
441 DBG_TRACE( DbgInfo,
"Skipping device close, in RTS mode\n" );
442 wl_unlock( lp, &flags );
451 wl_unlock( lp, &flags );
465 if (dev->
dev.parent) {
477 .get_drvinfo = wl_get_drvinfo,
513 DBG_PARAM(DbgInfo,
"cmd",
"0x%04x", cmd);
515 wl_lock( lp, &flags );
520 if( lp->useRTS == 1 ) {
523 DBG_TRACE( DbgInfo,
"IOCTL: WL_IOCTL_RTS\n" );
526 DBG_TRACE( DbgInfo,
"IOCTL not supported in RTS mode: 0x%X\n", cmd );
530 goto out_act_int_on_unlock;
544 DBG_TRACE( DbgInfo,
"IOCTL: WVLAN2_IOCTL_UIL\n" );
545 ret = wvlan_uil( urq, lp );
550 DBG_TRACE(DbgInfo,
"IOCTL CODE NOT SUPPORTED: 0x%X\n", cmd );
555 DBG_WARNING( DbgInfo,
"DEVICE IS BUSY, CANNOT PROCESS REQUEST\n" );
560 out_act_int_on_unlock:
564 wl_unlock( lp, &flags );
571 #ifdef CONFIG_NET_POLL_CONTROLLER
578 wl_lock( lp, &flags );
580 wl_unlock( lp, &flags );
616 wl_lock( lp, &flags );
619 if( lp->useRTS == 1 ) {
620 DBG_TRACE( DbgInfo,
"Skipping tx_timeout handler, in RTS mode\n" );
621 wl_unlock( lp, &flags );
633 if( dev == lp->wds_port[count].
dev ) {
645 if( pStats ==
NULL ) {
646 pStats = &( lp->
stats );
652 wl_unlock( lp, &flags );
689 DBG_ERROR( DbgInfo,
"Private adapter struct is NULL\n" );
693 DBG_ERROR( DbgInfo,
"net_device struct in wl_private is NULL\n" );
704 if( !list_empty( &( lp->
txQ[0] ))) {
705 element = lp->
txQ[0].next;
716 list_add( element, &( lp->
txFree ));
723 netif_wake_queue( lp->
dev );
749 DBG_TX( DbgInfo,
"Transmit...\n" );
752 lp->
stats.tx_packets++;
759 lp->wds_port[(( lp->
txF.
port >> 8 ) - 1)].
stats.tx_packets++;
767 dev_kfree_skb( lp->
txF.
skb );
807 wl_lock( lp, &flags );
810 DBG_WARNING( DbgInfo,
"UIL has device blocked\n" );
812 wl_unlock( lp, &flags );
817 if( lp->useRTS == 1 ) {
818 DBG_PRINT(
"RTS: we're getting a Tx...\n" );
819 wl_unlock( lp, &flags );
826 element = lp->
txFree.next;
829 DBG_ERROR( DbgInfo,
"Problem with list_entry\n" );
830 wl_unlock( lp, &flags );
838 list_move(&(txF->
node), &(lp->
txQ[0]));
844 netif_stop_queue( lp->
dev );
855 wl_send_dma( lp, skb, port );
864 wl_unlock( lp, &flags );
904 if( lp->useRTS == 1 ) {
905 DBG_PRINT(
"RTS: We're getting an Rx...\n" );
916 DBG_WARNING( DbgInfo,
"HFS_STAT_ERROR (0x%x) in Rx Packet\n",
922 port = ( hfs_stat >> 8 ) & 0x0007;
923 DBG_RX( DbgInfo,
"Rx frame for port %d\n", port );
938 skb->
dev = lp->wds_port[port-1].
dev;
965 lp->
stats.rx_packets++;
971 lp->wds_port[port-1].
stats.rx_packets++;
980 if( lp->spydata.spy_number > 0 ) {
981 char *srcaddr = skb->mac.raw + MAC_ADDR_SIZE;
988 DBG_ERROR( DbgInfo,
"Rx request to card FAILED\n" );
991 lp->
stats.rx_dropped++;
996 lp->wds_port[port-1].
stats.rx_dropped++;
1000 dev_kfree_skb( skb );
1003 DBG_ERROR( DbgInfo,
"Could not alloc skb\n" );
1006 lp->
stats.rx_dropped++;
1011 lp->wds_port[port-1].
stats.rx_dropped++;
1039 #ifdef NEW_MULTICAST
1043 #if 1 //;? (HCF_TYPE) & HCF_TYPE_STA //;?should we return an error status in AP mode
1049 unsigned long flags;
1062 if( DBG_FLAGS( DbgInfo ) & DBG_PARAM_ON ) {
1078 if( lp->useRTS == 1 ) {
1079 DBG_TRACE( DbgInfo,
"Skipping multicast, in RTS mode\n" );
1086 wl_lock( lp, &flags );
1095 DBG_PRINT(
"Enabling Promiscuous mode (IFF_PROMISC)\n" );
1106 DBG_PRINT(
"Enabling all multicast mode (IFF_ALLMULTI)\n" );
1118 ha->addr, ETH_ALEN);
1126 DBG_PRINT(
"Disabling Promiscuous mode\n" );
1132 DBG_PRINT(
"Disabling Multicast mode\n" );
1141 DBG_PRINT(
"Disabling all multicast mode (IFF_ALLMULTI)\n" );
1147 wl_unlock( lp, &flags );
1162 DBG_PARAM( DbgInfo,
"num_addrs",
"%d", num_addrs );
1163 DBG_PARAM( DbgInfo,
"addrs",
"0x%p", addrs );
1165 #error Obsolete set multicast interface!
1188 #ifdef CONFIG_NET_POLL_CONTROLLER
1189 .ndo_poll_controller = wl_poll,
1222 dev = alloc_etherdev(
sizeof(
struct wl_private));
1234 DBG_WARNING( DbgInfo,
"%s: MTU set too high, limiting to %d.\n",
1242 lp->wireless_data.spy_data = &lp->spy_data;
1243 dev->wireless_data = &lp->wireless_data;
1251 netif_stop_queue( dev );
1316 DBG_TX( DbgInfo,
"Tx on Port 0\n" );
1347 DBG_TX( DbgInfo,
"Tx on Port 1\n" );
1348 return wl_tx( skb, dev, HCF_PORT_1 );
1372 DBG_TX( DbgInfo,
"Tx on Port 2\n" );
1373 return wl_tx( skb, dev, HCF_PORT_2 );
1397 DBG_TX( DbgInfo,
"Tx on Port 3\n" );
1398 return wl_tx( skb, dev, HCF_PORT_3 );
1422 DBG_TX( DbgInfo,
"Tx on Port 4\n" );
1423 return wl_tx( skb, dev, HCF_PORT_4 );
1447 DBG_TX( DbgInfo,
"Tx on Port 5\n" );
1448 return wl_tx( skb, dev, HCF_PORT_5 );
1472 DBG_TX( DbgInfo,
"Tx on Port 6\n" );
1473 return wl_tx( skb, dev, HCF_PORT_6 );
1496 void wl_wds_device_alloc(
struct wl_private *lp )
1531 lp->wds_port[
count].
dev->priv = lp;
1533 sprintf( lp->wds_port[count].
dev->name,
"wds%d", count );
1537 lp->wds_port[0].
dev->hard_start_xmit = &wl_tx_port1;
1538 lp->wds_port[1].
dev->hard_start_xmit = &wl_tx_port2;
1539 lp->wds_port[2].
dev->hard_start_xmit = &wl_tx_port3;
1540 lp->wds_port[3].
dev->hard_start_xmit = &wl_tx_port4;
1541 lp->wds_port[4].
dev->hard_start_xmit = &wl_tx_port5;
1542 lp->wds_port[5].
dev->hard_start_xmit = &wl_tx_port6;
1567 void wl_wds_device_dealloc(
struct wl_private *lp )
1572 DBG_FUNC(
"wl_wds_device_dealloc" );
1580 if( dev_wds !=
NULL ) {
1613 void wl_wds_netif_start_queue(
struct wl_private *lp )
1622 netif_start_queue( lp->wds_port[count].
dev );
1648 void wl_wds_netif_stop_queue(
struct wl_private *lp )
1657 netif_stop_queue( lp->wds_port[count].
dev );
1683 void wl_wds_netif_wake_queue(
struct wl_private *lp )
1692 netif_wake_queue( lp->wds_port[count].
dev );
1718 void wl_wds_netif_carrier_on(
struct wl_private *lp )
1751 void wl_wds_netif_carrier_off(
struct wl_private *lp )
1798 DBG_ERROR( DbgInfo,
"Private adapter struct is NULL\n" );
1803 DBG_ERROR( DbgInfo,
"net_device struct in wl_private is NULL\n" );
1817 desc = wl_pci_dma_get_tx_packet( lp );
1819 if( desc ==
NULL ) {
1821 netif_stop_queue( lp->
dev );
1825 dev_kfree_skb( skb );
1836 DBG_ERROR( DbgInfo,
"DMA descriptor buf_addr is NULL\n" );
1846 hcf_dma_tx_put( &( lp->
hcfCtx ), desc, 0 );
1850 dev_kfree_skb( skb );
1892 if( lp->useRTS == 1 ) {
1893 DBG_PRINT(
"RTS: We're getting an Rx...\n" );
1900 desc = hcf_dma_rx_get( &( lp->
hcfCtx ));
1931 hcf_dma_rx_put( &( lp->
hcfCtx ), desc );
1941 DBG_WARNING( DbgInfo,
"HFS_STAT_ERROR (0x%x) in Rx Packet\n",
1945 hcf_dma_rx_put( &( lp->
hcfCtx ), desc );
1950 port = ( hfs_stat >> 8 ) & 0x0007;
1951 DBG_RX( DbgInfo,
"Rx frame for port %d\n", port );
1965 skb->
dev = lp->wds_port[port-1].
dev;
1978 hcf_dma_rx_put( &( lp->
hcfCtx ), desc );
1983 lp->
stats.rx_packets++;
1989 lp->wds_port[port-1].
stats.rx_packets++;
1997 DBG_ERROR( DbgInfo,
"Could not alloc skb\n" );
2001 lp->
stats.rx_dropped++;
2006 lp->wds_port[port-1].
stats.rx_dropped++;
2018 #endif // ENABLE_DMA