Commit 8cdddc3f authored by Linus Walleij's avatar Linus Walleij Committed by David S. Miller

usb/net: rndis: eliminate first set of duplicate OIDs

The RNDIS protocol contains a vast number of Object ID:s (OIDs).
The current definitions had multiple definitions of these ID:s,
let's use the nicely RNDIS_*-prefixed defines from the HyperV
implementation, rename everywhere they're used, and copy+rename
the few that were missing from this list of objects.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 007e5c8e
......@@ -396,7 +396,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
phym = NULL;
reply_len = sizeof *phym;
retval = rndis_query(dev, intf, u.buf,
cpu_to_le32(OID_GEN_PHYSICAL_MEDIUM),
cpu_to_le32(RNDIS_OID_GEN_PHYSICAL_MEDIUM),
0, (void **) &phym, &reply_len);
if (retval != 0 || !phym) {
/* OID is optional so don't fail here. */
......@@ -421,7 +421,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
/* Get designated host ethernet address */
reply_len = ETH_ALEN;
retval = rndis_query(dev, intf, u.buf,
cpu_to_le32(OID_802_3_PERMANENT_ADDRESS),
cpu_to_le32(RNDIS_OID_802_3_PERMANENT_ADDRESS),
48, (void **) &bp, &reply_len);
if (unlikely(retval< 0)) {
dev_err(&intf->dev, "rndis get ethaddr, %d\n", retval);
......@@ -434,7 +434,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
memset(u.set, 0, sizeof *u.set);
u.set->msg_type = cpu_to_le32(RNDIS_MSG_SET);
u.set->msg_len = cpu_to_le32(4 + sizeof *u.set);
u.set->oid = cpu_to_le32(OID_GEN_CURRENT_PACKET_FILTER);
u.set->oid = cpu_to_le32(RNDIS_OID_GEN_CURRENT_PACKET_FILTER);
u.set->len = cpu_to_le32(4);
u.set->offset = cpu_to_le32((sizeof *u.set) - 8);
*(__le32 *)(u.buf + sizeof *u.set) = cpu_to_le32(RNDIS_DEFAULT_FILTER);
......
......@@ -626,20 +626,20 @@ static const char *oid_to_string(__le32 oid)
switch (oid) {
#define OID_STR(oid) case cpu_to_le32(oid): return(#oid)
/* from rndis_host.h */
OID_STR(OID_802_3_PERMANENT_ADDRESS);
OID_STR(OID_GEN_MAXIMUM_FRAME_SIZE);
OID_STR(OID_GEN_CURRENT_PACKET_FILTER);
OID_STR(OID_GEN_PHYSICAL_MEDIUM);
OID_STR(RNDIS_OID_802_3_PERMANENT_ADDRESS);
OID_STR(RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE);
OID_STR(RNDIS_OID_GEN_CURRENT_PACKET_FILTER);
OID_STR(RNDIS_OID_GEN_PHYSICAL_MEDIUM);
/* from rndis_wlan.c */
OID_STR(OID_GEN_LINK_SPEED);
OID_STR(OID_GEN_RNDIS_CONFIG_PARAMETER);
OID_STR(RNDIS_OID_GEN_LINK_SPEED);
OID_STR(RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER);
OID_STR(OID_GEN_XMIT_OK);
OID_STR(OID_GEN_RCV_OK);
OID_STR(OID_GEN_XMIT_ERROR);
OID_STR(OID_GEN_RCV_ERROR);
OID_STR(OID_GEN_RCV_NO_BUFFER);
OID_STR(RNDIS_OID_GEN_XMIT_OK);
OID_STR(RNDIS_OID_GEN_RCV_OK);
OID_STR(RNDIS_OID_GEN_XMIT_ERROR);
OID_STR(RNDIS_OID_GEN_RCV_ERROR);
OID_STR(RNDIS_OID_GEN_RCV_NO_BUFFER);
OID_STR(OID_802_3_CURRENT_ADDRESS);
OID_STR(OID_802_3_MULTICAST_LIST);
......@@ -945,7 +945,7 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param,
}
#endif
ret = rndis_set_oid(dev, cpu_to_le32(OID_GEN_RNDIS_CONFIG_PARAMETER),
ret = rndis_set_oid(dev, cpu_to_le32(RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER),
infobuf, info_len);
if (ret != 0)
netdev_dbg(dev->net, "setting rndis config parameter failed, %d\n",
......@@ -1633,14 +1633,14 @@ static void set_multicast_list(struct usbnet *usbdev)
}
set_filter:
ret = rndis_set_oid(usbdev, cpu_to_le32(OID_GEN_CURRENT_PACKET_FILTER), &filter,
ret = rndis_set_oid(usbdev, cpu_to_le32(RNDIS_OID_GEN_CURRENT_PACKET_FILTER), &filter,
sizeof(filter));
if (ret < 0) {
netdev_warn(usbdev->net, "couldn't set packet filter: %08x\n",
le32_to_cpu(filter));
}
netdev_dbg(usbdev->net, "OID_GEN_CURRENT_PACKET_FILTER(%08x) -> %d\n",
netdev_dbg(usbdev->net, "RNDIS_OID_GEN_CURRENT_PACKET_FILTER(%08x) -> %d\n",
le32_to_cpu(filter), ret);
}
......@@ -2462,7 +2462,7 @@ static void rndis_fill_station_info(struct usbnet *usbdev,
memset(sinfo, 0, sizeof(*sinfo));
len = sizeof(linkspeed);
ret = rndis_query_oid(usbdev, cpu_to_le32(OID_GEN_LINK_SPEED), &linkspeed, &len);
ret = rndis_query_oid(usbdev, cpu_to_le32(RNDIS_OID_GEN_LINK_SPEED), &linkspeed, &len);
if (ret == 0) {
sinfo->txrate.legacy = le32_to_cpu(linkspeed) / 1000;
sinfo->filled |= STATION_INFO_TX_BITRATE;
......@@ -3418,7 +3418,7 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
tmp = cpu_to_le32(RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST);
retval = rndis_set_oid(usbdev,
cpu_to_le32(OID_GEN_CURRENT_PACKET_FILTER),
cpu_to_le32(RNDIS_OID_GEN_CURRENT_PACKET_FILTER),
&tmp, sizeof(tmp));
len = sizeof(tmp);
......@@ -3554,7 +3554,7 @@ static int rndis_wlan_stop(struct usbnet *usbdev)
/* Set current packet filter zero to block receiving data packets from
device. */
filter = 0;
rndis_set_oid(usbdev, cpu_to_le32(OID_GEN_CURRENT_PACKET_FILTER), &filter,
rndis_set_oid(usbdev, cpu_to_le32(RNDIS_OID_GEN_CURRENT_PACKET_FILTER), &filter,
sizeof(filter));
return retval;
......
This diff is collapsed.
......@@ -30,7 +30,7 @@
#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000c
#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
/* codes for OID_GEN_PHYSICAL_MEDIUM */
/* codes for RNDIS_OID_GEN_PHYSICAL_MEDIUM */
#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED 0x00000000
#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN 0x00000001
#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM 0x00000002
......@@ -42,16 +42,7 @@
#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN 0x00000008
#define RNDIS_PHYSICAL_MEDIUM_MAX 0x00000009
/* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and
* there are gobs more that may optionally be supported. We'll avoid as much
* of that mess as possible.
*/
#define OID_802_3_PERMANENT_ADDRESS 0x01010101
#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010e
#define OID_GEN_PHYSICAL_MEDIUM 0x00010202
/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
/* packet filter bits used by RNDIS_OID_GEN_CURRENT_PACKET_FILTER */
#define RNDIS_PACKET_TYPE_DIRECTED 0x00000001
#define RNDIS_PACKET_TYPE_MULTICAST 0x00000002
#define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
......@@ -76,70 +67,6 @@
#define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002
#define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004
/* Required Object IDs (OIDs) */
#define OID_GEN_SUPPORTED_LIST 0x00010101
#define OID_GEN_HARDWARE_STATUS 0x00010102
#define OID_GEN_MEDIA_SUPPORTED 0x00010103
#define OID_GEN_MEDIA_IN_USE 0x00010104
#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
#define OID_GEN_LINK_SPEED 0x00010107
#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
#define OID_GEN_VENDOR_ID 0x0001010C
#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
#define OID_GEN_DRIVER_VERSION 0x00010110
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
#define OID_GEN_PROTOCOL_OPTIONS 0x00010112
#define OID_GEN_MAC_OPTIONS 0x00010113
#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
#define OID_GEN_SUPPORTED_GUIDS 0x00010117
#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
#define OID_GEN_MACHINE_NAME 0x0001021A
#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
#define OID_GEN_VLAN_ID 0x0001021C
/* Optional OIDs */
#define OID_GEN_MEDIA_CAPABILITIES 0x00010201
/* Required statistics OIDs */
#define OID_GEN_XMIT_OK 0x00020101
#define OID_GEN_RCV_OK 0x00020102
#define OID_GEN_XMIT_ERROR 0x00020103
#define OID_GEN_RCV_ERROR 0x00020104
#define OID_GEN_RCV_NO_BUFFER 0x00020105
/* Optional statistics OIDs */
#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207
#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209
#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
#define OID_GEN_RCV_CRC_ERROR 0x0002020D
#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
#define OID_GEN_GET_TIME_CAPS 0x0002020F
#define OID_GEN_GET_NETCARD_TIME 0x00020210
#define OID_GEN_NETCARD_LOAD 0x00020211
#define OID_GEN_DEVICE_PROFILE 0x00020212
#define OID_GEN_INIT_TIME_MS 0x00020213
#define OID_GEN_RESET_COUNTS 0x00020214
#define OID_GEN_MEDIA_SENSE_COUNTS 0x00020215
#define OID_GEN_FRIENDLY_NAME 0x00020216
#define OID_GEN_MINIPORT_INFO 0x00020217
#define OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218
/* IEEE 802.3 (Ethernet) OIDs */
#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
......@@ -158,7 +85,7 @@
#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
/* OID_GEN_MINIPORT_INFO constants */
/* RNDIS_OID_GEN_MINIPORT_INFO constants */
#define NDIS_MINIPORT_BUS_MASTER 0x00000001
#define NDIS_MINIPORT_WDM_DRIVER 0x00000002
#define NDIS_MINIPORT_SG_LIST 0x00000004
......@@ -339,12 +266,13 @@
#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR (0xC0011000L)
/* Object Identifiers used by NdisRequest Query/Set Information */
/* General Objects */
/* General (Required) Objects */
#define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
#define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
#define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
#define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
#define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
#define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
#define RNDIS_OID_GEN_LINK_SPEED 0x00010107
#define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
#define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
......@@ -361,16 +289,25 @@
#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
#define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
#define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
#define RNDIS_OID_GEN_SUPPORTED_GUIDS 0x00010117
#define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
#define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
#define RNDIS_OID_GEN_PHYSICAL_MEDIUM 0x00010202
#define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
#define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
#define RNDIS_OID_GEN_VLAN_ID 0x0001021C
/* Optional OIDs */
#define OID_GEN_MEDIA_CAPABILITIES 0x00010201
/* Required statistics OIDs */
#define RNDIS_OID_GEN_XMIT_OK 0x00020101
#define RNDIS_OID_GEN_RCV_OK 0x00020102
#define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
#define RNDIS_OID_GEN_RCV_ERROR 0x00020104
#define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
/* Optional statistics OIDs */
#define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
#define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
#define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
......@@ -390,6 +327,15 @@
#define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
#define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
#define RNDIS_OID_GEN_NETCARD_LOAD 0x00020211
#define RNDIS_OID_GEN_DEVICE_PROFILE 0x00020212
#define RNDIS_OID_GEN_INIT_TIME_MS 0x00020213
#define RNDIS_OID_GEN_RESET_COUNTS 0x00020214
#define RNDIS_OID_GEN_MEDIA_SENSE_COUNTS 0x00020215
#define RNDIS_OID_GEN_FRIENDLY_NAME 0x00020216
#define RNDIS_OID_GEN_MINIPORT_INFO 0x00020217
#define RNDIS_OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218
/* These are connection-oriented general OIDs. */
/* These replace the above OIDs for connection-oriented media. */
#define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
......@@ -496,14 +442,6 @@
/* From drivers/net/wireless/rndis_wlan.c */
/* various RNDIS OID defs */
#define OID_GEN_LINK_SPEED 0x00010107
#define OID_GEN_XMIT_OK 0x00020101
#define OID_GEN_RCV_OK 0x00020102
#define OID_GEN_XMIT_ERROR 0x00020103
#define OID_GEN_RCV_ERROR 0x00020104
#define OID_GEN_RCV_NO_BUFFER 0x00020105
#define OID_802_3_CURRENT_ADDRESS 0x01010102
#define OID_802_3_MULTICAST_LIST 0x01010103
#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
......
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