Commit 4fd64dd0 authored by Stephen Hemminger's avatar Stephen Hemminger

beceem: add network device message level control

Provide standard interface to control verbosity of debug messages
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
parent e39e3be6
...@@ -382,6 +382,8 @@ Driver adapter data structure ...@@ -382,6 +382,8 @@ Driver adapter data structure
struct _MINI_ADAPTER struct _MINI_ADAPTER
{ {
struct _MINI_ADAPTER *next; struct _MINI_ADAPTER *next;
struct net_device *dev;
u32 msg_enable;
CHAR *caDsxReqResp; CHAR *caDsxReqResp;
atomic_t ApplicationRunning; atomic_t ApplicationRunning;
...@@ -437,7 +439,6 @@ struct _MINI_ADAPTER ...@@ -437,7 +439,6 @@ struct _MINI_ADAPTER
BOOLEAN AutoLinkUp; BOOLEAN AutoLinkUp;
BOOLEAN AutoSyncup; BOOLEAN AutoSyncup;
struct net_device *dev;
int major; int major;
int minor; int minor;
wait_queue_head_t tx_packet_wait_queue; wait_queue_head_t tx_packet_wait_queue;
......
#include "headers.h" #include "headers.h"
static int debug = -1;
module_param(debug, uint, 0600);
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
static const u32 default_msg =
NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK
| NETIF_MSG_TIMER | NETIF_MSG_TX_ERR | NETIF_MSG_RX_ERR
| NETIF_MSG_IFUP | NETIF_MSG_IFDOWN;
struct net_device *gblpnetdev; struct net_device *gblpnetdev;
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; pr_notice(DRV_NAME "%s: link up failed (download in progress)\n",
dev->name);
return -EBUSY;
}
if (netif_msg_ifup(Adapter))
pr_info(DRV_NAME "%s: enabling interface\n", dev->name);
if (Adapter->LinkUpStatus) {
if (netif_msg_link(Adapter))
pr_info(DRV_NAME "%s: link up\n", dev->name);
if (Adapter->LinkUpStatus == 1) { netif_carrier_on(Adapter->dev);
if (netif_queue_stopped(Adapter->dev)) { netif_start_queue(Adapter->dev);
netif_carrier_on(Adapter->dev);
netif_start_queue(Adapter->dev);
}
} }
return 0; return 0;
...@@ -21,10 +37,14 @@ static INT bcm_open(struct net_device *dev) ...@@ -21,10 +37,14 @@ static INT bcm_open(struct net_device *dev)
static INT bcm_close(struct net_device *dev) static INT bcm_close(struct net_device *dev)
{ {
if (!netif_queue_stopped(dev)) { PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
netif_carrier_off(dev);
netif_stop_queue(dev); if (netif_msg_ifdown(Adapter))
} pr_info(DRV_NAME "%s: disabling interface\n", dev->name);
netif_carrier_off(dev);
netif_stop_queue(dev);
return 0; return 0;
} }
...@@ -70,6 +90,7 @@ static netdev_tx_t bcm_transmit(struct sk_buff *skb, struct net_device *dev) ...@@ -70,6 +90,7 @@ 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;
...@@ -84,9 +105,9 @@ static netdev_tx_t bcm_transmit(struct sk_buff *skb, struct net_device *dev) ...@@ -84,9 +105,9 @@ static netdev_tx_t bcm_transmit(struct sk_buff *skb, struct net_device *dev)
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, if (netif_msg_tx_queued(Adapter))
"bcm_transmit Enqueueing the Packet To Queue %d", pr_info(DRV_NAME "%s: enqueueing packet to queue %d\n",
qindex); dev->name, 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;
...@@ -168,10 +189,26 @@ static u32 bcm_get_link(struct net_device *dev) ...@@ -168,10 +189,26 @@ static u32 bcm_get_link(struct net_device *dev)
return Adapter->LinkUpStatus; return Adapter->LinkUpStatus;
} }
static u32 bcm_get_msglevel (struct net_device *dev)
{
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
return Adapter->msg_enable;
}
static void bcm_set_msglevel (struct net_device *dev, u32 level)
{
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
Adapter->msg_enable = level;
}
static const struct ethtool_ops bcm_ethtool_ops = { static const struct ethtool_ops bcm_ethtool_ops = {
.get_settings = bcm_get_settings, .get_settings = bcm_get_settings,
.get_drvinfo = bcm_get_drvinfo, .get_drvinfo = bcm_get_drvinfo,
.get_link = bcm_get_link, .get_link = bcm_get_link,
.get_msglevel = bcm_get_msglevel,
.set_msglevel = bcm_set_msglevel,
}; };
int register_networkdev(PMINI_ADAPTER Adapter) int register_networkdev(PMINI_ADAPTER Adapter)
...@@ -185,6 +222,7 @@ int register_networkdev(PMINI_ADAPTER Adapter) ...@@ -185,6 +222,7 @@ int register_networkdev(PMINI_ADAPTER Adapter)
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);
Adapter->msg_enable = netif_msg_init(debug, default_msg);
netif_carrier_off(net); netif_carrier_off(net);
......
...@@ -2135,8 +2135,10 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ...@@ -2135,8 +2135,10 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap
if(!Adapter->LinkUpStatus) if(!Adapter->LinkUpStatus)
{ {
netif_carrier_on(Adapter->dev); netif_carrier_on(Adapter->dev);
netif_start_queue(Adapter->dev); netif_start_queue(Adapter->dev);
Adapter->LinkUpStatus = 1; Adapter->LinkUpStatus = 1;
if (netif_msg_link(Adapter))
pr_info(DRV_NAME "%s: link up\n", Adapter->dev->name);
do_gettimeofday(&tv); do_gettimeofday(&tv);
atomic_set(&Adapter->TxPktAvail, 1); atomic_set(&Adapter->TxPktAvail, 1);
......
...@@ -11,11 +11,6 @@ static struct usb_device_id InterfaceUsbtable[] = { ...@@ -11,11 +11,6 @@ static struct usb_device_id InterfaceUsbtable[] = {
}; };
MODULE_DEVICE_TABLE(usb, InterfaceUsbtable); MODULE_DEVICE_TABLE(usb, InterfaceUsbtable);
static unsigned int debug_level = DBG_LVL_CURR;
module_param(debug_level, uint, 0644);
MODULE_PARM_DESC(debug_level, "Debug level (0=none,...,7=all)");
VOID InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter) VOID InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter)
{ {
INT i = 0; INT i = 0;
...@@ -164,7 +159,7 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -164,7 +159,7 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
/* Init default driver debug state */ /* Init default driver debug state */
psAdapter->stDebugState.debug_level = debug_level; psAdapter->stDebugState.debug_level = DBG_LVL_CURR;
psAdapter->stDebugState.type = DBG_TYPE_INITEXIT; psAdapter->stDebugState.type = DBG_TYPE_INITEXIT;
/* Technically, one can start using BCM_DEBUG_PRINT after this point. /* Technically, one can start using BCM_DEBUG_PRINT after this point.
......
...@@ -1913,13 +1913,13 @@ void flush_queue(PMINI_ADAPTER Adapter, UINT iQIndex) ...@@ -1913,13 +1913,13 @@ void flush_queue(PMINI_ADAPTER Adapter, UINT iQIndex)
void beceem_protocol_reset (PMINI_ADAPTER Adapter) void beceem_protocol_reset (PMINI_ADAPTER Adapter)
{ {
int i =0; int i;
if(NULL != Adapter->dev) if (netif_msg_link(Adapter))
{ pr_notice(DRV_NAME "%s: protocol reset\n", Adapter->dev->name);
netif_carrier_off(Adapter->dev);
netif_stop_queue(Adapter->dev); netif_carrier_off(Adapter->dev);
} netif_stop_queue(Adapter->dev);
Adapter->IdleMode = FALSE; Adapter->IdleMode = FALSE;
Adapter->LinkUpStatus = FALSE; Adapter->LinkUpStatus = FALSE;
...@@ -1937,14 +1937,14 @@ void beceem_protocol_reset (PMINI_ADAPTER Adapter) ...@@ -1937,14 +1937,14 @@ void beceem_protocol_reset (PMINI_ADAPTER Adapter)
Adapter->TimerActive = FALSE; Adapter->TimerActive = FALSE;
memset(Adapter->astFragmentedPktClassifierTable, 0, memset(Adapter->astFragmentedPktClassifierTable, 0,
sizeof(S_FRAGMENTED_PACKET_INFO) * sizeof(S_FRAGMENTED_PACKET_INFO) * MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES);
MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES);
for(i = 0;i<HiPriority;i++) for(i = 0;i<HiPriority;i++)
{ {
//resetting only the first size (S_MIBS_SERVICEFLOW_TABLE) for the SF. //resetting only the first size (S_MIBS_SERVICEFLOW_TABLE) for the SF.
// It is same between MIBs and SF. // It is same between MIBs and SF.
memset((PVOID)&Adapter->PackInfo[i],0,sizeof(S_MIBS_SERVICEFLOW_TABLE)); memset(&Adapter->PackInfo[i].stMibsExtServiceFlowTable,
0, sizeof(S_MIBS_EXTSERVICEFLOW_PARAMETERS));
} }
} }
......
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