beceem: convert to kernel coding style
Change indentation etc, to conform to acceptable kernel style Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
This commit is contained in:
parent
5afb5145a1
commit
46c3790eb5
|
@ -1,34 +1,31 @@
|
||||||
#include "headers.h"
|
#include "headers.h"
|
||||||
|
|
||||||
struct net_device *gblpnetdev;
|
struct net_device *gblpnetdev;
|
||||||
/***************************************************************************************/
|
|
||||||
/* proto-type of lower function */
|
|
||||||
|
|
||||||
static INT bcm_open(struct net_device *dev)
|
static INT bcm_open(struct net_device *dev)
|
||||||
{
|
{
|
||||||
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
|
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
|
||||||
|
|
||||||
if(Adapter->fw_download_done==FALSE)
|
if (Adapter->fw_download_done == FALSE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if(Adapter->LinkUpStatus == 1){
|
|
||||||
if(netif_queue_stopped(Adapter->dev)){
|
if (Adapter->LinkUpStatus == 1) {
|
||||||
|
if (netif_queue_stopped(Adapter->dev)) {
|
||||||
netif_carrier_on(Adapter->dev);
|
netif_carrier_on(Adapter->dev);
|
||||||
netif_start_queue(Adapter->dev);
|
netif_start_queue(Adapter->dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT bcm_close(struct net_device *dev)
|
static INT bcm_close(struct net_device *dev)
|
||||||
{
|
{
|
||||||
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
|
if (!netif_queue_stopped(dev)) {
|
||||||
|
|
||||||
if(!netif_queue_stopped(dev)) {
|
|
||||||
netif_carrier_off(dev);
|
netif_carrier_off(dev);
|
||||||
netif_stop_queue(dev);
|
netif_stop_queue(dev);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct net_device_stats *bcm_get_stats(struct net_device *dev)
|
static struct net_device_stats *bcm_get_stats(struct net_device *dev)
|
||||||
|
@ -55,52 +52,52 @@ static u16 bcm_select_queue(struct net_device *dev, struct sk_buff *skb)
|
||||||
return ClassifyPacket(netdev_priv(dev), skb);
|
return ClassifyPacket(netdev_priv(dev), skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
* Function - bcm_transmit()
|
* Function - bcm_transmit()
|
||||||
*
|
*
|
||||||
* Description - This is the main transmit function for our virtual
|
* Description - This is the main transmit function for our virtual
|
||||||
* interface(eth0). It handles the ARP packets. It
|
* interface(eth0). It handles the ARP packets. It
|
||||||
* clones this packet and then Queue it to a suitable
|
* clones this packet and then Queue it to a suitable
|
||||||
* Queue. Then calls the transmit_packet().
|
* Queue. Then calls the transmit_packet().
|
||||||
*
|
*
|
||||||
* Parameter - skb - Pointer to the socket buffer structure
|
* Parameter - skb - Pointer to the socket buffer structure
|
||||||
* dev - Pointer to the virtual net device structure
|
* dev - Pointer to the virtual net device structure
|
||||||
*
|
*
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
static netdev_tx_t bcm_transmit(struct sk_buff *skb, struct net_device *dev)
|
static netdev_tx_t bcm_transmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
{
|
{
|
||||||
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
|
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
|
||||||
u16 qindex = skb_get_queue_mapping(skb);
|
u16 qindex = skb_get_queue_mapping(skb);
|
||||||
|
|
||||||
if (Adapter->device_removed || !Adapter->LinkUpStatus)
|
if (Adapter->device_removed || !Adapter->LinkUpStatus)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
if (Adapter->TransferMode != IP_PACKET_ONLY_MODE )
|
if (Adapter->TransferMode != IP_PACKET_ONLY_MODE)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
if (INVALID_QUEUE_INDEX==qindex)
|
if (INVALID_QUEUE_INDEX == qindex)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
if (Adapter->PackInfo[qindex].uiCurrentPacketsOnHost >= SF_MAX_ALLOWED_PACKETS_TO_BACKUP)
|
if (Adapter->PackInfo[qindex].uiCurrentPacketsOnHost >=
|
||||||
|
SF_MAX_ALLOWED_PACKETS_TO_BACKUP)
|
||||||
return NETDEV_TX_BUSY;
|
return NETDEV_TX_BUSY;
|
||||||
|
|
||||||
/* Now Enqueue the packet */
|
/* Now Enqueue the packet */
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL,
|
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL,
|
||||||
"bcm_transmit Enqueueing the Packet To Queue %d",qindex);
|
"bcm_transmit Enqueueing the Packet To Queue %d",
|
||||||
|
qindex);
|
||||||
|
|
||||||
spin_lock(&Adapter->PackInfo[qindex].SFQueueLock);
|
spin_lock(&Adapter->PackInfo[qindex].SFQueueLock);
|
||||||
Adapter->PackInfo[qindex].uiCurrentBytesOnHost += skb->len;
|
Adapter->PackInfo[qindex].uiCurrentBytesOnHost += skb->len;
|
||||||
Adapter->PackInfo[qindex].uiCurrentPacketsOnHost++;
|
Adapter->PackInfo[qindex].uiCurrentPacketsOnHost++;
|
||||||
|
|
||||||
*((B_UINT32 *)skb->cb + SKB_CB_LATENCY_OFFSET ) = jiffies;
|
*((B_UINT32 *) skb->cb + SKB_CB_LATENCY_OFFSET) = jiffies;
|
||||||
ENQUEUEPACKET(Adapter->PackInfo[qindex].FirstTxQueue,
|
ENQUEUEPACKET(Adapter->PackInfo[qindex].FirstTxQueue,
|
||||||
Adapter->PackInfo[qindex].LastTxQueue, skb);
|
Adapter->PackInfo[qindex].LastTxQueue, skb);
|
||||||
atomic_inc(&Adapter->TotalPacketCount);
|
atomic_inc(&Adapter->TotalPacketCount);
|
||||||
spin_unlock(&Adapter->PackInfo[qindex].SFQueueLock);
|
spin_unlock(&Adapter->PackInfo[qindex].SFQueueLock);
|
||||||
|
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_OSAL_DBG, DBG_LVL_ALL,"ENQ: \n");
|
|
||||||
|
|
||||||
/* FIXME - this is racy and incorrect, replace with work queue */
|
/* FIXME - this is racy and incorrect, replace with work queue */
|
||||||
if (!atomic_read(&Adapter->TxPktAvail)) {
|
if (!atomic_read(&Adapter->TxPktAvail)) {
|
||||||
atomic_set(&Adapter->TxPktAvail, 1);
|
atomic_set(&Adapter->TxPktAvail, 1);
|
||||||
|
@ -182,12 +179,12 @@ int register_networkdev(PMINI_ADAPTER Adapter)
|
||||||
struct net_device *net = Adapter->dev;
|
struct net_device *net = Adapter->dev;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
net->netdev_ops = &bcmNetDevOps;
|
net->netdev_ops = &bcmNetDevOps;
|
||||||
net->ethtool_ops = &bcm_ethtool_ops;
|
net->ethtool_ops = &bcm_ethtool_ops;
|
||||||
net->mtu = MTU_SIZE; /* 1400 Bytes */
|
net->mtu = MTU_SIZE; /* 1400 Bytes */
|
||||||
net->tx_queue_len = TX_QLEN;
|
net->tx_queue_len = TX_QLEN;
|
||||||
net->flags |= IFF_NOARP;
|
net->flags |= IFF_NOARP;
|
||||||
net->flags &= ~(IFF_BROADCAST|IFF_MULTICAST);
|
net->flags &= ~(IFF_BROADCAST | IFF_MULTICAST);
|
||||||
|
|
||||||
netif_carrier_off(net);
|
netif_carrier_off(net);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue