beceem: change startup messages
Change the regsister/unregister routines to generate better messages, and control arrival of new frames when USB device is unplugged. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
This commit is contained in:
parent
9c5d77009d
commit
4ea4f7a0d3
5 changed files with 57 additions and 64 deletions
|
@ -1,14 +1,5 @@
|
||||||
#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)
|
||||||
|
@ -194,6 +185,10 @@ static const struct ethtool_ops bcm_ethtool_ops = {
|
||||||
int register_networkdev(PMINI_ADAPTER Adapter)
|
int register_networkdev(PMINI_ADAPTER Adapter)
|
||||||
{
|
{
|
||||||
struct net_device *net = Adapter->dev;
|
struct net_device *net = Adapter->dev;
|
||||||
|
PS_INTERFACE_ADAPTER IntfAdapter = Adapter->pvInterfaceAdapter;
|
||||||
|
struct usb_interface *udev = IntfAdapter->interface;
|
||||||
|
struct usb_device *xdev = IntfAdapter->udev;
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
net->netdev_ops = &bcmNetDevOps;
|
net->netdev_ops = &bcmNetDevOps;
|
||||||
|
@ -201,22 +196,43 @@ int register_networkdev(PMINI_ADAPTER Adapter)
|
||||||
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;
|
||||||
Adapter->msg_enable = netif_msg_init(debug, default_msg);
|
|
||||||
|
|
||||||
netif_carrier_off(net);
|
netif_carrier_off(net);
|
||||||
|
|
||||||
SET_NETDEV_DEVTYPE(net, &wimax_type);
|
SET_NETDEV_DEVTYPE(net, &wimax_type);
|
||||||
|
|
||||||
/* Read the MAC Address from EEPROM */
|
/* Read the MAC Address from EEPROM */
|
||||||
ReadMacAddressFromNVM(Adapter);
|
result = ReadMacAddressFromNVM(Adapter);
|
||||||
|
if (result != STATUS_SUCCESS) {
|
||||||
|
dev_err(&udev->dev,
|
||||||
|
PFX "Error in Reading the mac Address: %d", result);
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
result = register_netdev(net);
|
result = register_netdev(net);
|
||||||
if (result == 0)
|
if (result)
|
||||||
gblpnetdev = Adapter->dev = net;
|
return result;
|
||||||
else {
|
|
||||||
Adapter->dev = NULL;
|
gblpnetdev = Adapter->dev;
|
||||||
free_netdev(net);
|
|
||||||
|
if (netif_msg_probe(Adapter))
|
||||||
|
dev_info(&udev->dev, PFX "%s: register usb-%s-%s %pM\n",
|
||||||
|
net->name, xdev->bus->bus_name, xdev->devpath,
|
||||||
|
net->dev_addr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
void unregister_networkdev(PMINI_ADAPTER Adapter)
|
||||||
|
{
|
||||||
|
struct net_device *net = Adapter->dev;
|
||||||
|
PS_INTERFACE_ADAPTER IntfAdapter = Adapter->pvInterfaceAdapter;
|
||||||
|
struct usb_interface *udev = IntfAdapter->interface;
|
||||||
|
struct usb_device *xdev = IntfAdapter->udev;
|
||||||
|
|
||||||
|
if (netif_msg_probe(Adapter))
|
||||||
|
dev_info(&udev->dev, PFX "%s: unregister usb-%s%s\n",
|
||||||
|
net->name, xdev->bus->bus_name, xdev->devpath);
|
||||||
|
|
||||||
|
unregister_netdev(Adapter->dev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,15 @@ static struct usb_device_id InterfaceUsbtable[] = {
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(usb, InterfaceUsbtable);
|
MODULE_DEVICE_TABLE(usb, InterfaceUsbtable);
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
static INT InterfaceAdapterInit(PS_INTERFACE_ADAPTER Adapter);
|
static INT InterfaceAdapterInit(PS_INTERFACE_ADAPTER Adapter);
|
||||||
|
|
||||||
static VOID InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter)
|
static VOID InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter)
|
||||||
|
@ -158,6 +167,7 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
||||||
|
|
||||||
psAdapter = netdev_priv(ndev);
|
psAdapter = netdev_priv(ndev);
|
||||||
psAdapter->dev = ndev;
|
psAdapter->dev = ndev;
|
||||||
|
psAdapter->msg_enable = netif_msg_init(debug, default_msg);
|
||||||
|
|
||||||
/* Init default driver debug state */
|
/* Init default driver debug state */
|
||||||
|
|
||||||
|
@ -269,32 +279,22 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
||||||
|
|
||||||
static void usbbcm_disconnect (struct usb_interface *intf)
|
static void usbbcm_disconnect (struct usb_interface *intf)
|
||||||
{
|
{
|
||||||
PS_INTERFACE_ADAPTER psIntfAdapter = NULL;
|
PS_INTERFACE_ADAPTER psIntfAdapter = usb_get_intfdata(intf);
|
||||||
PMINI_ADAPTER psAdapter = NULL;
|
PMINI_ADAPTER psAdapter;
|
||||||
struct usb_device *udev = NULL;
|
struct usb_device *udev = interface_to_usbdev (intf);
|
||||||
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
|
||||||
|
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Usb disconnected");
|
|
||||||
if(intf == NULL)
|
|
||||||
{
|
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "intf pointer is NULL");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
psIntfAdapter = usb_get_intfdata(intf);
|
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "psIntfAdapter 0x%p",psIntfAdapter);
|
|
||||||
if(psIntfAdapter == NULL)
|
if(psIntfAdapter == NULL)
|
||||||
{
|
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "InterfaceAdapter pointer is NULL");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
psAdapter = psIntfAdapter->psAdapter;
|
psAdapter = psIntfAdapter->psAdapter;
|
||||||
|
netif_device_detach(psAdapter->dev);
|
||||||
|
|
||||||
if(psAdapter->bDoSuspend)
|
if(psAdapter->bDoSuspend)
|
||||||
intf->needs_remote_wakeup = 0;
|
intf->needs_remote_wakeup = 0;
|
||||||
|
|
||||||
psAdapter->device_removed = TRUE ;
|
psAdapter->device_removed = TRUE ;
|
||||||
usb_set_intfdata(intf, NULL);
|
usb_set_intfdata(intf, NULL);
|
||||||
InterfaceAdapterFree(psIntfAdapter);
|
InterfaceAdapterFree(psIntfAdapter);
|
||||||
udev = interface_to_usbdev (intf);
|
|
||||||
usb_put_dev(udev);
|
usb_put_dev(udev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ VOID AdapterFree(PMINI_ADAPTER Adapter)
|
||||||
if(Adapter->LEDInfo.led_thread_running & (BCM_LED_THREAD_RUNNING_ACTIVELY | BCM_LED_THREAD_RUNNING_INACTIVELY))
|
if(Adapter->LEDInfo.led_thread_running & (BCM_LED_THREAD_RUNNING_ACTIVELY | BCM_LED_THREAD_RUNNING_INACTIVELY))
|
||||||
kthread_stop (Adapter->LEDInfo.led_cntrl_threadid);
|
kthread_stop (Adapter->LEDInfo.led_cntrl_threadid);
|
||||||
|
|
||||||
unregister_netdev(Adapter->dev);
|
unregister_networkdev(Adapter);
|
||||||
|
|
||||||
/* FIXME: use proper wait_event and refcounting */
|
/* FIXME: use proper wait_event and refcounting */
|
||||||
while(atomic_read(&Adapter->ApplicationRunning))
|
while(atomic_read(&Adapter->ApplicationRunning))
|
||||||
|
|
|
@ -52,6 +52,7 @@ INT SendControlPacket(PMINI_ADAPTER Adapter, /**<Logical Adapter*/
|
||||||
|
|
||||||
|
|
||||||
int register_networkdev(PMINI_ADAPTER Adapter);
|
int register_networkdev(PMINI_ADAPTER Adapter);
|
||||||
|
void unregister_networkdev(PMINI_ADAPTER Adapter);
|
||||||
|
|
||||||
INT AllocAdapterDsxBuffer(PMINI_ADAPTER Adapter);
|
INT AllocAdapterDsxBuffer(PMINI_ADAPTER Adapter);
|
||||||
|
|
||||||
|
|
|
@ -287,42 +287,18 @@ INT ReadBeceemEEPROM( PMINI_ADAPTER Adapter,
|
||||||
|
|
||||||
INT ReadMacAddressFromNVM(PMINI_ADAPTER Adapter)
|
INT ReadMacAddressFromNVM(PMINI_ADAPTER Adapter)
|
||||||
{
|
{
|
||||||
INT Status=0, i;
|
INT Status;
|
||||||
unsigned char puMacAddr[6] = {0};
|
unsigned char puMacAddr[6];
|
||||||
INT AllZeroMac = 0;
|
|
||||||
INT AllFFMac = 0;
|
|
||||||
|
|
||||||
Status = BeceemNVMRead(Adapter,
|
Status = BeceemNVMRead(Adapter,
|
||||||
(PUINT)&puMacAddr[0],
|
(PUINT)&puMacAddr[0],
|
||||||
INIT_PARAMS_1_MACADDRESS_ADDRESS,
|
INIT_PARAMS_1_MACADDRESS_ADDRESS,
|
||||||
MAC_ADDRESS_SIZE);
|
MAC_ADDRESS_SIZE);
|
||||||
|
|
||||||
if(Status != STATUS_SUCCESS)
|
if(Status == STATUS_SUCCESS)
|
||||||
{
|
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Error in Reading the mac Addres with status :%d", Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(Adapter->dev->dev_addr, puMacAddr, MAC_ADDRESS_SIZE);
|
memcpy(Adapter->dev->dev_addr, puMacAddr, MAC_ADDRESS_SIZE);
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Modem MAC Addr :");
|
|
||||||
BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_PRINTK, 0, DBG_LVL_ALL,&Adapter->dev->dev_addr[0],MAC_ADDRESS_SIZE);
|
|
||||||
for(i=0;i<MAC_ADDRESS_SIZE;i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(Adapter->dev->dev_addr[i] == 0x00)
|
|
||||||
AllZeroMac++;
|
|
||||||
if(Adapter->dev->dev_addr[i] == 0xFF)
|
|
||||||
AllFFMac++;
|
|
||||||
|
|
||||||
}
|
|
||||||
//BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\n");
|
|
||||||
if(AllZeroMac == MAC_ADDRESS_SIZE)
|
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Warning :: MAC Address has all 00's");
|
|
||||||
if(AllFFMac == MAC_ADDRESS_SIZE)
|
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Warning :: MAC Address has all FF's");
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Reference in a new issue