Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fed3ffd8 authored by Mathieu Maret's avatar Mathieu Maret Committed by Greg Kroah-Hartman
Browse files

staging: wlags49_h2: reindent wl_netdev.c



As the file is using a mix between space and tab,
and space instead of tab, use Lindent to fix the file

Signed-off-by: default avatarMathieu Maret <mathieu.maret@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 89509814
Loading
Loading
Loading
Loading
+999 −950
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@
#include <wl_pci.h>
#endif /* BUS_PCI */


#if HCF_ENCAP
#define MTU_MAX (HCF_MAX_MSG - ETH_HLEN - 8)
#else
@@ -172,6 +171,7 @@ int wl_init( struct net_device *dev )

	return 0;
}				// wl_init

/*============================================================================*/

/*******************************************************************************
@@ -204,6 +204,7 @@ int wl_config( struct net_device *dev, struct ifmap *map )

	return 0;
}				// wl_config

/*============================================================================*/

/*******************************************************************************
@@ -266,6 +267,7 @@ struct net_device_stats *wl_stats( struct net_device *dev )

	return pStats;
}				// wl_stats

/*============================================================================*/

/*******************************************************************************
@@ -311,10 +313,10 @@ int wl_open(struct net_device *dev)
		status = wl_enable(lp);

		if (status != HCF_SUCCESS) {
            DBG_TRACE( DbgInfo, "Enable port 0 failed: 0x%x\n", status );
			DBG_TRACE(DbgInfo, "Enable port 0 failed: 0x%x\n",
				  status);
		}
	}

	// Holding the lock too long, make a gap to allow other processes
	wl_unlock(lp, &flags);
	wl_lock(lp, &flags);
@@ -334,7 +336,6 @@ int wl_open(struct net_device *dev)
		// Unsuccessful, try reset of the card to recover
		status = wl_reset(dev);
	}

	// Holding the lock too long, make a gap to allow other processes
	wl_unlock(lp, &flags);
	wl_lock(lp, &flags);
@@ -357,6 +358,7 @@ int wl_open(struct net_device *dev)

	return status;
}				// wl_open

/*============================================================================*/

/*******************************************************************************
@@ -418,6 +420,7 @@ int wl_close( struct net_device *dev )

	return 0;
}				// wl_close

/*============================================================================*/

static void wl_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
@@ -443,7 +446,6 @@ static struct ethtool_ops wl_ethtool_ops = {
	.get_link = ethtool_op_get_link,
};


/*******************************************************************************
 *	wl_ioctl()
 *******************************************************************************
@@ -485,7 +487,9 @@ int wl_ioctl( struct net_device *dev, struct ifreq *rq, int cmd )
			DBG_TRACE(DbgInfo, "IOCTL: WL_IOCTL_RTS\n");
			ret = wvlan_rts((struct rtsreq *)rq, dev->base_addr);
		} else {
	    DBG_TRACE( DbgInfo, "IOCTL not supported in RTS mode: 0x%X\n", cmd );
			DBG_TRACE(DbgInfo,
				  "IOCTL not supported in RTS mode: 0x%X\n",
				  cmd);
			ret = -EOPNOTSUPP;
		}

@@ -509,12 +513,14 @@ int wl_ioctl( struct net_device *dev, struct ifreq *rq, int cmd )
#endif /* USE_UIL */

		default:
	     DBG_TRACE(DbgInfo, "IOCTL CODE NOT SUPPORTED: 0x%X\n", cmd );
			DBG_TRACE(DbgInfo, "IOCTL CODE NOT SUPPORTED: 0x%X\n",
				  cmd);
			ret = -EOPNOTSUPP;
			break;
		}
	} else {
	DBG_WARNING( DbgInfo, "DEVICE IS BUSY, CANNOT PROCESS REQUEST\n" );
		DBG_WARNING(DbgInfo,
			    "DEVICE IS BUSY, CANNOT PROCESS REQUEST\n");
		ret = -EBUSY;
	}

@@ -527,6 +533,7 @@ out_act_int_on_unlock:

	return ret;
}				// wl_ioctl

/*============================================================================*/

#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -574,7 +581,8 @@ void wl_tx_timeout( struct net_device *dev )

#ifdef USE_RTS
	if (lp->useRTS == 1) {
	DBG_TRACE( DbgInfo, "Skipping tx_timeout handler, in RTS mode\n" );
		DBG_TRACE(DbgInfo,
			  "Skipping tx_timeout handler, in RTS mode\n");
		wl_unlock(lp, &flags);
		return;
	}
@@ -606,6 +614,7 @@ void wl_tx_timeout( struct net_device *dev )

	wl_unlock(lp, &flags);
}				// wl_tx_timeout

/*============================================================================*/

/*******************************************************************************
@@ -670,7 +679,8 @@ int wl_send( struct wl_private *lp )

			if (lp->txQ_count < TX_Q_LOW_WATER_MARK) {
				if (lp->netif_queue_on == FALSE) {
                    DBG_TX( DbgInfo, "Kickstarting Q: %d\n", lp->txQ_count );
					DBG_TX(DbgInfo, "Kickstarting Q: %d\n",
					       lp->txQ_count);
					netif_wake_queue(lp->dev);
					WL_WDS_NETIF_WAKE_QUEUE(lp);
					lp->netif_queue_on = TRUE;
@@ -703,12 +713,12 @@ int wl_send( struct wl_private *lp )
			lp->stats.tx_packets++;
			lp->stats.tx_bytes += lp->txF.skb->len;
		}

#ifdef USE_WDS
        else
        {
            lp->wds_port[(( lp->txF.port >> 8 ) - 1)].stats.tx_packets++;
            lp->wds_port[(( lp->txF.port >> 8 ) - 1)].stats.tx_bytes += lp->txF.skb->len;
		else {
			lp->wds_port[((lp->txF.port >> 8) -
				      1)].stats.tx_packets++;
			lp->wds_port[((lp->txF.port >> 8) -
				      1)].stats.tx_bytes += lp->txF.skb->len;
		}

#endif /* USE_WDS */
@@ -723,6 +733,7 @@ int wl_send( struct wl_private *lp )

	return TRUE;
}				// wl_send

/*============================================================================*/

/*******************************************************************************
@@ -761,7 +772,6 @@ int wl_tx( struct sk_buff *skb, struct net_device *dev, int port )
		wl_unlock(lp, &flags);
		return 1;
	}

#ifdef USE_RTS
	if (lp->useRTS == 1) {
		DBG_PRINT("RTS: we're getting a Tx...\n");
@@ -802,8 +812,7 @@ int wl_tx( struct sk_buff *skb, struct net_device *dev, int port )
#ifdef ENABLE_DMA
	if (lp->use_dma) {
		wl_send_dma(lp, skb, port);
    }
    else
	} else
#endif
	{
		wl_send(lp);
@@ -813,6 +822,7 @@ int wl_tx( struct sk_buff *skb, struct net_device *dev, int port )
	wl_unlock(lp, &flags);
	return 0;
}				// wl_tx

/*============================================================================*/

/*******************************************************************************
@@ -861,7 +871,8 @@ int wl_rx(struct net_device *dev)

		/* Make sure the frame isn't bad */
		if ((hfs_stat & HFS_STAT_ERR) != HCF_SUCCESS) {
            DBG_WARNING( DbgInfo, "HFS_STAT_ERROR (0x%x) in Rx Packet\n",
			DBG_WARNING(DbgInfo,
				    "HFS_STAT_ERROR (0x%x) in Rx Packet\n",
				    lp->lookAheadBuf[HFS_STAT]);
			return -EIO;
		}
@@ -914,10 +925,13 @@ int wl_rx(struct net_device *dev)
						lp->stats.rx_bytes += pktlen;
					}
#ifdef USE_WDS
                    else
                    {
                        lp->wds_port[port-1].stats.rx_packets++;
                        lp->wds_port[port-1].stats.rx_bytes += pktlen;
					else {
						lp->wds_port[port -
							     1].stats.
						    rx_packets++;
						lp->wds_port[port -
							     1].stats.
						    rx_bytes += pktlen;
					}
#endif /* USE_WDS */

@@ -926,22 +940,26 @@ int wl_rx(struct net_device *dev)
#ifdef WIRELESS_EXT
#ifdef WIRELESS_SPY
					if (lp->spydata.spy_number > 0) {
                        char *srcaddr = skb->mac.raw + MAC_ADDR_SIZE;
						char *srcaddr =
						    skb->mac.raw +
						    MAC_ADDR_SIZE;

						wl_spy_gather(dev, srcaddr);
					}
#endif /* WIRELESS_SPY */
#endif /* WIRELESS_EXT */
				} else {
                    DBG_ERROR( DbgInfo, "Rx request to card FAILED\n" );
					DBG_ERROR(DbgInfo,
						  "Rx request to card FAILED\n");

					if (port == 0) {
						lp->stats.rx_dropped++;
					}
#ifdef USE_WDS
                    else
                    {
                        lp->wds_port[port-1].stats.rx_dropped++;
					else {
						lp->wds_port[port -
							     1].stats.
						    rx_dropped++;
					}
#endif /* USE_WDS */

@@ -954,9 +972,9 @@ int wl_rx(struct net_device *dev)
					lp->stats.rx_dropped++;
				}
#ifdef USE_WDS
                else
                {
                    lp->wds_port[port-1].stats.rx_dropped++;
				else {
					lp->wds_port[port -
						     1].stats.rx_dropped++;
				}
#endif /* USE_WDS */
			}
@@ -965,6 +983,7 @@ int wl_rx(struct net_device *dev)

	return 0;
}				// wl_rx

/*============================================================================*/

/*******************************************************************************
@@ -1027,51 +1046,59 @@ void wl_multicast( struct net_device *dev )
		wl_lock(lp, &flags);
		wl_act_int_off(lp);

		if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA  ) {
		if (CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) ==
		    COMP_ID_FW_STA) {
			if (dev->flags & IFF_PROMISC) {
				/* Enable promiscuous mode */
				lp->ltvRecord.len = 2;
				lp->ltvRecord.typ = CFG_PROMISCUOUS_MODE;
				lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(1);
                DBG_PRINT( "Enabling Promiscuous mode (IFF_PROMISC)\n" );
                hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord ));
            }
            else if ((netdev_mc_count(dev) > HCF_MAX_MULTICAST) ||
                    ( dev->flags & IFF_ALLMULTI )) {
				DBG_PRINT
				    ("Enabling Promiscuous mode (IFF_PROMISC)\n");
				hcf_put_info(&(lp->hcfCtx),
					     (LTVP) & (lp->ltvRecord));
			} else if ((netdev_mc_count(dev) > HCF_MAX_MULTICAST)
				   || (dev->flags & IFF_ALLMULTI)) {
				/* Shutting off this filter will enable all multicast frames to
				   be sent up from the device; however, this is a static RID, so
				   a call to wl_apply() is needed */
				lp->ltvRecord.len = 2;
				lp->ltvRecord.typ = CFG_CNF_RX_ALL_GROUP_ADDR;
				lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(0);
                DBG_PRINT( "Enabling all multicast mode (IFF_ALLMULTI)\n" );
                hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord ));
				DBG_PRINT
				    ("Enabling all multicast mode (IFF_ALLMULTI)\n");
				hcf_put_info(&(lp->hcfCtx),
					     (LTVP) & (lp->ltvRecord));
				wl_apply(lp);
            }
            else if (!netdev_mc_empty(dev)) {
			} else if (!netdev_mc_empty(dev)) {
				/* Set the multicast addresses */
                lp->ltvRecord.len = ( netdev_mc_count(dev) * 3 ) + 1;
				lp->ltvRecord.len =
				    (netdev_mc_count(dev) * 3) + 1;
				lp->ltvRecord.typ = CFG_GROUP_ADDR;

				x = 0;
				netdev_for_each_mc_addr(ha, dev)
                    memcpy(&(lp->ltvRecord.u.u8[x++ * ETH_ALEN]),
				    memcpy(&
					   (lp->ltvRecord.u.u8[x++ * ETH_ALEN]),
					   ha->addr, ETH_ALEN);
				DBG_PRINT("Setting multicast list\n");
                hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord ));
				hcf_put_info(&(lp->hcfCtx),
					     (LTVP) & (lp->ltvRecord));
			} else {
				/* Disable promiscuous mode */
				lp->ltvRecord.len = 2;
				lp->ltvRecord.typ = CFG_PROMISCUOUS_MODE;
				lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(0);
				DBG_PRINT("Disabling Promiscuous mode\n");
                hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord ));
				hcf_put_info(&(lp->hcfCtx),
					     (LTVP) & (lp->ltvRecord));

				/* Disable multicast mode */
				lp->ltvRecord.len = 2;
				lp->ltvRecord.typ = CFG_GROUP_ADDR;
				DBG_PRINT("Disabling Multicast mode\n");
                hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord ));
				hcf_put_info(&(lp->hcfCtx),
					     (LTVP) & (lp->ltvRecord));

				/* Turning on this filter will prevent all multicast frames from
				   being sent up from the device; however, this is a static RID,
@@ -1079,8 +1106,10 @@ void wl_multicast( struct net_device *dev )
				lp->ltvRecord.len = 2;
				lp->ltvRecord.typ = CFG_CNF_RX_ALL_GROUP_ADDR;
				lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(1);
                DBG_PRINT( "Disabling all multicast mode (IFF_ALLMULTI)\n" );
                hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord ));
				DBG_PRINT
				    ("Disabling all multicast mode (IFF_ALLMULTI)\n");
				hcf_put_info(&(lp->hcfCtx),
					     (LTVP) & (lp->ltvRecord));
				wl_apply(lp);
			}
		}
@@ -1089,6 +1118,7 @@ void wl_multicast( struct net_device *dev )
	}
#endif /* HCF_STA */
}				// wl_multicast

/*============================================================================*/

#else /* NEW_MULTICAST */
@@ -1101,12 +1131,12 @@ void wl_multicast( struct net_device *dev, int num_addrs, void *addrs )

#error Obsolete set multicast interface!
}				// wl_multicast

/*============================================================================*/

#endif /* NEW_MULTICAST */

static const struct net_device_ops wl_netdev_ops =
{
static const struct net_device_ops wl_netdev_ops = {
	.ndo_start_xmit = &wl_tx_port0,

	.ndo_set_config = &wl_config,
@@ -1158,10 +1188,8 @@ struct net_device * wl_device_alloc( void )
	   but do it here just in case it's used for other buses in the future */
	lp = wl_priv(dev);


	/* Check MTU */
    if( dev->mtu > MTU_MAX )
    {
	if (dev->mtu > MTU_MAX) {
		DBG_WARNING(DbgInfo, "%s: MTU set too high, limiting to %d.\n",
			    dev->name, MTU_MAX);
		dev->mtu = MTU_MAX;
@@ -1186,6 +1214,7 @@ struct net_device * wl_device_alloc( void )

	return dev;
}				// wl_device_alloc

/*============================================================================*/

/*******************************************************************************
@@ -1215,6 +1244,7 @@ void wl_device_dealloc( struct net_device *dev )

	free_netdev(dev);
}				// wl_device_dealloc

/*============================================================================*/

/*******************************************************************************
@@ -1244,6 +1274,7 @@ int wl_tx_port0( struct sk_buff *skb, struct net_device *dev )
	return wl_tx_dma(skb, dev, HCF_PORT_0);
#endif
}				// wl_tx_port0

/*============================================================================*/

#ifdef USE_WDS
@@ -1271,6 +1302,7 @@ int wl_tx_port1( struct sk_buff *skb, struct net_device *dev )
	DBG_TX(DbgInfo, "Tx on Port 1\n");
	return wl_tx(skb, dev, HCF_PORT_1);
}				// wl_tx_port1

/*============================================================================*/

/*******************************************************************************
@@ -1296,6 +1328,7 @@ int wl_tx_port2( struct sk_buff *skb, struct net_device *dev )
	DBG_TX(DbgInfo, "Tx on Port 2\n");
	return wl_tx(skb, dev, HCF_PORT_2);
}				// wl_tx_port2

/*============================================================================*/

/*******************************************************************************
@@ -1321,6 +1354,7 @@ int wl_tx_port3( struct sk_buff *skb, struct net_device *dev )
	DBG_TX(DbgInfo, "Tx on Port 3\n");
	return wl_tx(skb, dev, HCF_PORT_3);
}				// wl_tx_port3

/*============================================================================*/

/*******************************************************************************
@@ -1346,6 +1380,7 @@ int wl_tx_port4( struct sk_buff *skb, struct net_device *dev )
	DBG_TX(DbgInfo, "Tx on Port 4\n");
	return wl_tx(skb, dev, HCF_PORT_4);
}				// wl_tx_port4

/*============================================================================*/

/*******************************************************************************
@@ -1371,6 +1406,7 @@ int wl_tx_port5( struct sk_buff *skb, struct net_device *dev )
	DBG_TX(DbgInfo, "Tx on Port 5\n");
	return wl_tx(skb, dev, HCF_PORT_5);
}				// wl_tx_port5

/*============================================================================*/

/*******************************************************************************
@@ -1396,6 +1432,7 @@ int wl_tx_port6( struct sk_buff *skb, struct net_device *dev )
	DBG_TX(DbgInfo, "Tx on Port 6\n");
	return wl_tx(skb, dev, HCF_PORT_6);
}				// wl_tx_port6

/*============================================================================*/

/*******************************************************************************
@@ -1461,6 +1498,7 @@ void wl_wds_device_alloc( struct wl_private *lp )

	WL_WDS_NETIF_STOP_QUEUE(lp);
}				// wl_wds_device_alloc

/*============================================================================*/

/*******************************************************************************
@@ -1500,6 +1538,7 @@ void wl_wds_device_dealloc( struct wl_private *lp )
		}
	}
}				// wl_wds_device_dealloc

/*============================================================================*/

/*******************************************************************************
@@ -1535,6 +1574,7 @@ void wl_wds_netif_start_queue( struct wl_private *lp )
		}
	}
}				// wl_wds_netif_start_queue

/*============================================================================*/

/*******************************************************************************
@@ -1570,6 +1610,7 @@ void wl_wds_netif_stop_queue( struct wl_private *lp )
		}
	}
}				// wl_wds_netif_stop_queue

/*============================================================================*/

/*******************************************************************************
@@ -1605,6 +1646,7 @@ void wl_wds_netif_wake_queue( struct wl_private *lp )
		}
	}
}				// wl_wds_netif_wake_queue

/*============================================================================*/

/*******************************************************************************
@@ -1638,6 +1680,7 @@ void wl_wds_netif_carrier_on( struct wl_private *lp )
		}
	}
}				// wl_wds_netif_carrier_on

/*============================================================================*/

/*******************************************************************************
@@ -1670,6 +1713,7 @@ void wl_wds_netif_carrier_off( struct wl_private *lp )
	}

}				// wl_wds_netif_carrier_off

/*============================================================================*/

#endif /* USE_WDS */
@@ -1759,6 +1803,7 @@ int wl_send_dma( struct wl_private *lp, struct sk_buff *skb, int port )

	return TRUE;
}				// wl_send_dma

/*============================================================================*/

/*******************************************************************************
@@ -1792,8 +1837,7 @@ int wl_rx_dma( struct net_device *dev )

	DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev);

    if((( lp = dev->priv ) != NULL ) &&
	!( lp->flags & WVLAN2_UIL_BUSY )) {
	if (((lp = dev->priv) != NULL) && !(lp->flags & WVLAN2_UIL_BUSY)) {

#ifdef USE_RTS
		if (lp->useRTS == 1) {
@@ -1806,8 +1850,7 @@ int wl_rx_dma( struct net_device *dev )
		//{
		desc = hcf_dma_rx_get(&(lp->hcfCtx));

            if( desc != NULL )
            {
		if (desc != NULL) {
			/* Check and see if we rcvd. a WMP frame */
			/*
			   if((( *(hcf_8 *)&desc->buf_addr[HFS_STAT] ) &
@@ -1843,9 +1886,9 @@ int wl_rx_dma( struct net_device *dev )
			hfs_stat = (hcf_16) (desc->buf_addr[HFS_STAT / 2]);

			/* Make sure the frame isn't bad */
                if(( hfs_stat & HFS_STAT_ERR ) != HCF_SUCCESS )
                {
                    DBG_WARNING( DbgInfo, "HFS_STAT_ERROR (0x%x) in Rx Packet\n",
			if ((hfs_stat & HFS_STAT_ERR) != HCF_SUCCESS) {
				DBG_WARNING(DbgInfo,
					    "HFS_STAT_ERROR (0x%x) in Rx Packet\n",
					    desc->buf_addr[HFS_STAT / 2]);

				/* Give the descriptor back to the HCF */
@@ -1869,7 +1912,8 @@ int wl_rx_dma( struct net_device *dev )
					case 4:
					case 5:
					case 6:
                            skb->dev = lp->wds_port[port-1].dev;
						skb->dev =
						    lp->wds_port[port - 1].dev;
						break;
#endif /* USE_WDS */

@@ -1891,26 +1935,30 @@ int wl_rx_dma( struct net_device *dev )
						lp->stats.rx_bytes += pktlen;
					}
#ifdef USE_WDS
                        else
                        {
                            lp->wds_port[port-1].stats.rx_packets++;
                            lp->wds_port[port-1].stats.rx_bytes += pktlen;
					else {
						lp->wds_port[port -
							     1].stats.
						    rx_packets++;
						lp->wds_port[port -
							     1].stats.
						    rx_bytes += pktlen;
					}
#endif /* USE_WDS */

					dev->last_rx = jiffies;

				} else {
                        DBG_ERROR( DbgInfo, "Could not alloc skb\n" );
					DBG_ERROR(DbgInfo,
						  "Could not alloc skb\n");

                        if( port == 0 )
	                    {
					if (port == 0) {
						lp->stats.rx_dropped++;
					}
#ifdef USE_WDS
                        else
                        {
                            lp->wds_port[port-1].stats.rx_dropped++;
					else {
						lp->wds_port[port -
							     1].stats.
						    rx_dropped++;
					}
#endif /* USE_WDS */
				}
@@ -1921,5 +1969,6 @@ int wl_rx_dma( struct net_device *dev )

	return 0;
}				// wl_rx_dma

/*============================================================================*/
#endif // ENABLE_DMA