beceem: reserve one queue for bit-bucket
authorStephen Hemminger <stephen.hemminger@vyatta.com>
Mon, 1 Nov 2010 04:04:52 +0000 (00:04 -0400)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Mon, 1 Nov 2010 13:54:47 +0000 (09:54 -0400)
This preserves the semantics of the original driver (unclassified packets
are dropped), but does it in a clean way; and fixes crash when packet
is sent to offline device.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
drivers/staging/bcm/InterfaceInit.c
drivers/staging/bcm/Macros.h

index dddf34bb7c8bb54716fd675aea4ecb7a606934e4..801ba65e978571af3b5d20d7b60e9ce5637fb476 100644 (file)
@@ -188,7 +188,8 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
        PS_INTERFACE_ADAPTER psIntfAdapter;
        struct net_device *ndev;
 
-       ndev = alloc_etherdev_mq(sizeof(MINI_ADAPTER), NO_OF_QUEUES);
+       /* Reserve one extra queue for the bit-bucket */
+       ndev = alloc_etherdev_mq(sizeof(MINI_ADAPTER), NO_OF_QUEUES+1);
        if(ndev == NULL) {
                dev_err(&udev->dev, DRV_NAME ": no memory for device\n");
                return -ENOMEM;
index 14df2f86b14e2d1ab4b71504163120a325bb2d84..f2fd60286a4cc93417c4940cee83fde0137845db 100644 (file)
@@ -261,7 +261,7 @@ typedef enum _E_PHS_DSC_ACTION
 
 #define FIRMWARE_BEGIN_ADDR 0xBFC00000
 
-#define INVALID_QUEUE_INDEX (USHORT)-1
+#define INVALID_QUEUE_INDEX (NO_OF_QUEUES+1)
 
 #define INVALID_PID (pid_t)-1
 #define DDR_80_MHZ     0