Commit b9a7696a authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: rndis (3/4) Big Endian support for gadget RNDIS

Add byteswapping.  Original version partially worked on PPC with Net2280,
this version applies to the latest RNDIS code but hasn't been retested on
big-endian.  Ping should be working in at least one one direction.

Also added a handful of other things from my BK:  track suspend/resume
(to eventually implement wake-on-lan), give a better rndis error
message, and add missing declarations for PM-related OIDs (usage is
#ifdeffed out by previous patch).

    From:	   Jon Neal <jon@ballardtech.com>
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 9f86f9fb
......@@ -118,6 +118,7 @@ struct eth_dev {
unsigned zlp:1;
unsigned cdc:1;
unsigned rndis:1;
unsigned suspended:1;
u16 cdc_filter;
unsigned long todo;
#define WORK_RX_MEMORY 0
......@@ -1355,11 +1356,13 @@ static void rndis_response_complete (struct usb_ep *ep, struct usb_request *req)
static void rndis_command_complete (struct usb_ep *ep, struct usb_request *req)
{
struct eth_dev *dev = ep->driver_data;
int status;
/* received RNDIS command from CDC_SEND_ENCAPSULATED_COMMAND */
spin_lock(&dev->lock);
if (rndis_msg_parser (dev->rndis_config, (u8 *) req->buf))
ERROR(dev, "%s: rndis parse error\n", __FUNCTION__ );
status = rndis_msg_parser (dev->rndis_config, (u8 *) req->buf);
if (status < 0)
ERROR(dev, "%s: rndis parse error %d\n", __FUNCTION__, status);
spin_unlock(&dev->lock);
}
......@@ -2561,6 +2564,26 @@ eth_bind (struct usb_gadget *gadget)
/*-------------------------------------------------------------------------*/
static void
eth_suspend (struct usb_gadget *gadget)
{
struct eth_dev *dev = get_gadget_data (gadget);
DEBUG (dev, "suspend\n");
dev->suspended = 1;
}
static void
eth_resume (struct usb_gadget *gadget)
{
struct eth_dev *dev = get_gadget_data (gadget);
DEBUG (dev, "resume\n");
dev->suspended = 0;
}
/*-------------------------------------------------------------------------*/
static struct usb_gadget_driver eth_driver = {
#ifdef CONFIG_USB_GADGET_DUALSPEED
.speed = USB_SPEED_HIGH,
......@@ -2574,6 +2597,9 @@ static struct usb_gadget_driver eth_driver = {
.setup = eth_setup,
.disconnect = eth_disconnect,
.suspend = eth_suspend,
.resume = eth_resume,
.driver = {
.name = (char *) shortname,
// .shutdown = ...
......
......@@ -26,11 +26,41 @@
#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A
#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
enum NDIS_DEVICE_POWER_STATE {
NdisDeviceStateUnspecified = 0,
NdisDeviceStateD0,
NdisDeviceStateD1,
NdisDeviceStateD2,
NdisDeviceStateD3,
NdisDeviceStateMaximum
};
struct NDIS_PM_WAKE_UP_CAPABILITIES {
enum NDIS_DEVICE_POWER_STATE MinMagicPacketWakeUp;
enum NDIS_DEVICE_POWER_STATE MinPatternWakeUp;
enum NDIS_DEVICE_POWER_STATE MinLinkChangeWakeUp;
};
/* NDIS_PNP_CAPABILITIES.Flags constants */
#define NDIS_DEVICE_WAKE_UP_ENABLE 0x00000001
#define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002
#define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004
struct NDIS_PNP_CAPABILITIES {
u32 Flags;
struct NDIS_PM_WAKE_UP_CAPABILITIES WakeUpCapabilities;
};
struct NDIS_PM_PACKET_PATTERN {
u32 Priority;
u32 Reserved;
u32 MaskSize;
u32 PatternOffset;
u32 PatternSize;
u32 PatternFlags;
};
/* Required Object IDs (OIDs) */
#define OID_GEN_SUPPORTED_LIST 0x00010101
#define OID_GEN_HARDWARE_STATUS 0x00010102
......
This diff is collapsed.
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