dev->driver_info->indication(dev, msg, buflen);
} else {
switch (msg->status) {
- case RNDIS_STATUS_MEDIA_CONNECT:
+ case cpu_to_le32(RNDIS_STATUS_MEDIA_CONNECT):
dev_info(udev, "rndis media connect\n");
break;
- case RNDIS_STATUS_MEDIA_DISCONNECT:
+ case cpu_to_le32(RNDIS_STATUS_MEDIA_DISCONNECT):
dev_info(udev, "rndis media disconnect\n");
break;
default:
*/
/* Issue the request; xid is unique, don't bother byteswapping it */
- if (likely(buf->msg_type != RNDIS_MSG_HALT &&
- buf->msg_type != RNDIS_MSG_RESET)) {
+ if (likely(buf->msg_type != cpu_to_le32(RNDIS_MSG_HALT) &&
+ buf->msg_type != cpu_to_le32(RNDIS_MSG_RESET))) {
xid = dev->xid++;
if (!xid)
xid = dev->xid++;
}
/* Poll the control channel; the request probably completed immediately */
- rsp = buf->msg_type | RNDIS_MSG_COMPLETION;
+ rsp = buf->msg_type | cpu_to_le32(RNDIS_MSG_COMPLETION);
for (count = 0; count < 10; count++) {
memset(buf, 0, CONTROL_BUFFER_SIZE);
retval = usb_control_msg(dev->udev,
request_id = (__force u32) buf->request_id;
if (likely(buf->msg_type == rsp)) {
if (likely(request_id == xid)) {
- if (unlikely(rsp == RNDIS_MSG_RESET_C))
+ if (unlikely(rsp ==
+ cpu_to_le32(RNDIS_MSG_RESET_C)))
return 0;
- if (likely(RNDIS_STATUS_SUCCESS
+ if (likely(cpu_to_le32(RNDIS_STATUS_SUCCESS)
== buf->status))
return 0;
dev_dbg(&info->control->dev,
request_id, xid);
/* then likely retry */
} else switch (buf->msg_type) {
- case RNDIS_MSG_INDICATE: /* fault/event */
+ case cpu_to_le32(RNDIS_MSG_INDICATE): /* fault/event */
rndis_msg_indicate(dev, (void *)buf, buflen);
-
break;
- case RNDIS_MSG_KEEPALIVE: { /* ping */
+ case cpu_to_le32(RNDIS_MSG_KEEPALIVE): { /* ping */
struct rndis_keepalive_c *msg = (void *)buf;
- msg->msg_type = RNDIS_MSG_KEEPALIVE_C;
+ msg->msg_type = cpu_to_le32(RNDIS_MSG_KEEPALIVE_C);
msg->msg_len = cpu_to_le32(sizeof *msg);
- msg->status = RNDIS_STATUS_SUCCESS;
+ msg->status = cpu_to_le32(RNDIS_STATUS_SUCCESS);
retval = usb_control_msg(dev->udev,
usb_sndctrlpipe(dev->udev, 0),
USB_CDC_SEND_ENCAPSULATED_COMMAND,
u.buf = buf;
memset(u.get, 0, sizeof *u.get + in_len);
- u.get->msg_type = RNDIS_MSG_QUERY;
+ u.get->msg_type = cpu_to_le32(RNDIS_MSG_QUERY);
u.get->msg_len = cpu_to_le32(sizeof *u.get + in_len);
u.get->oid = oid;
u.get->len = cpu_to_le32(in_len);
if (retval < 0)
goto fail;
- u.init->msg_type = RNDIS_MSG_INIT;
+ u.init->msg_type = cpu_to_le32(RNDIS_MSG_INIT);
u.init->msg_len = cpu_to_le32(sizeof *u.init);
u.init->major_version = cpu_to_le32(1);
u.init->minor_version = cpu_to_le32(0);
/* Check physical medium */
phym = NULL;
reply_len = sizeof *phym;
- retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM,
+ retval = rndis_query(dev, intf, u.buf,
+ cpu_to_le32(OID_GEN_PHYSICAL_MEDIUM),
0, (void **) &phym, &reply_len);
if (retval != 0 || !phym) {
/* OID is optional so don't fail here. */
- phym_unspec = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED;
+ phym_unspec = cpu_to_le32(RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED);
phym = &phym_unspec;
}
if ((flags & FLAG_RNDIS_PHYM_WIRELESS) &&
- *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
+ *phym != cpu_to_le32(RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN)) {
netif_dbg(dev, probe, dev->net,
"driver requires wireless physical medium, but device is not\n");
retval = -ENODEV;
goto halt_fail_and_release;
}
if ((flags & FLAG_RNDIS_PHYM_NOT_WIRELESS) &&
- *phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
+ *phym == cpu_to_le32(RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN)) {
netif_dbg(dev, probe, dev->net,
"driver requires non-wireless physical medium, but device is wireless.\n");
retval = -ENODEV;
/* Get designated host ethernet address */
reply_len = ETH_ALEN;
- retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS,
+ retval = rndis_query(dev, intf, u.buf,
+ cpu_to_le32(OID_802_3_PERMANENT_ADDRESS),
48, (void **) &bp, &reply_len);
if (unlikely(retval< 0)) {
dev_err(&intf->dev, "rndis get ethaddr, %d\n", retval);
/* set a nonzero filter to enable data transfers */
memset(u.set, 0, sizeof *u.set);
- u.set->msg_type = RNDIS_MSG_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 = OID_GEN_CURRENT_PACKET_FILTER;
+ u.set->oid = cpu_to_le32(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) = RNDIS_DEFAULT_FILTER;
+ *(__le32 *)(u.buf + sizeof *u.set) = cpu_to_le32(RNDIS_DEFAULT_FILTER);
retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
if (unlikely(retval < 0)) {
halt_fail_and_release:
memset(u.halt, 0, sizeof *u.halt);
- u.halt->msg_type = RNDIS_MSG_HALT;
+ u.halt->msg_type = cpu_to_le32(RNDIS_MSG_HALT);
u.halt->msg_len = cpu_to_le32(sizeof *u.halt);
(void) rndis_command(dev, (void *)u.halt, CONTROL_BUFFER_SIZE);
fail_and_release:
/* try to clear any rndis state/activity (no i/o from stack!) */
halt = kzalloc(CONTROL_BUFFER_SIZE, GFP_KERNEL);
if (halt) {
- halt->msg_type = RNDIS_MSG_HALT;
+ halt->msg_type = cpu_to_le32(RNDIS_MSG_HALT);
halt->msg_len = cpu_to_le32(sizeof *halt);
(void) rndis_command(dev, (void *)halt, CONTROL_BUFFER_SIZE);
kfree(halt);
data_len = le32_to_cpu(hdr->data_len);
/* don't choke if we see oob, per-packet data, etc */
- if (unlikely(hdr->msg_type != RNDIS_MSG_PACKET ||
+ if (unlikely(hdr->msg_type != cpu_to_le32(RNDIS_MSG_PACKET) ||
skb->len < msg_len ||
(data_offset + data_len + 8) > msg_len)) {
dev->net->stats.rx_frame_errors++;
fill:
hdr = (void *) __skb_push(skb, sizeof *hdr);
memset(hdr, 0, sizeof *hdr);
- hdr->msg_type = RNDIS_MSG_PACKET;
+ hdr->msg_type = cpu_to_le32(RNDIS_MSG_PACKET);
hdr->msg_len = cpu_to_le32(skb->len);
hdr->data_offset = cpu_to_le32(sizeof(*hdr) - 8);
hdr->data_len = cpu_to_le32(len);
/* various RNDIS OID defs */
-#define OID_GEN_LINK_SPEED cpu_to_le32(0x00010107)
-#define OID_GEN_RNDIS_CONFIG_PARAMETER cpu_to_le32(0x0001021b)
-
-#define OID_GEN_XMIT_OK cpu_to_le32(0x00020101)
-#define OID_GEN_RCV_OK cpu_to_le32(0x00020102)
-#define OID_GEN_XMIT_ERROR cpu_to_le32(0x00020103)
-#define OID_GEN_RCV_ERROR cpu_to_le32(0x00020104)
-#define OID_GEN_RCV_NO_BUFFER cpu_to_le32(0x00020105)
-
-#define OID_802_3_CURRENT_ADDRESS cpu_to_le32(0x01010102)
-#define OID_802_3_MULTICAST_LIST cpu_to_le32(0x01010103)
-#define OID_802_3_MAXIMUM_LIST_SIZE cpu_to_le32(0x01010104)
-
-#define OID_802_11_BSSID cpu_to_le32(0x0d010101)
-#define OID_802_11_SSID cpu_to_le32(0x0d010102)
-#define OID_802_11_INFRASTRUCTURE_MODE cpu_to_le32(0x0d010108)
-#define OID_802_11_ADD_WEP cpu_to_le32(0x0d010113)
-#define OID_802_11_REMOVE_WEP cpu_to_le32(0x0d010114)
-#define OID_802_11_DISASSOCIATE cpu_to_le32(0x0d010115)
-#define OID_802_11_AUTHENTICATION_MODE cpu_to_le32(0x0d010118)
-#define OID_802_11_PRIVACY_FILTER cpu_to_le32(0x0d010119)
-#define OID_802_11_BSSID_LIST_SCAN cpu_to_le32(0x0d01011a)
-#define OID_802_11_ENCRYPTION_STATUS cpu_to_le32(0x0d01011b)
-#define OID_802_11_ADD_KEY cpu_to_le32(0x0d01011d)
-#define OID_802_11_REMOVE_KEY cpu_to_le32(0x0d01011e)
-#define OID_802_11_ASSOCIATION_INFORMATION cpu_to_le32(0x0d01011f)
-#define OID_802_11_CAPABILITY cpu_to_le32(0x0d010122)
-#define OID_802_11_PMKID cpu_to_le32(0x0d010123)
-#define OID_802_11_NETWORK_TYPES_SUPPORTED cpu_to_le32(0x0d010203)
-#define OID_802_11_NETWORK_TYPE_IN_USE cpu_to_le32(0x0d010204)
-#define OID_802_11_TX_POWER_LEVEL cpu_to_le32(0x0d010205)
-#define OID_802_11_RSSI cpu_to_le32(0x0d010206)
-#define OID_802_11_RSSI_TRIGGER cpu_to_le32(0x0d010207)
-#define OID_802_11_FRAGMENTATION_THRESHOLD cpu_to_le32(0x0d010209)
-#define OID_802_11_RTS_THRESHOLD cpu_to_le32(0x0d01020a)
-#define OID_802_11_SUPPORTED_RATES cpu_to_le32(0x0d01020e)
-#define OID_802_11_CONFIGURATION cpu_to_le32(0x0d010211)
-#define OID_802_11_POWER_MODE cpu_to_le32(0x0d010216)
-#define OID_802_11_BSSID_LIST cpu_to_le32(0x0d010217)
+#define OID_GEN_LINK_SPEED 0x00010107
+#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021b
+
+#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
+
+#define OID_802_11_BSSID 0x0d010101
+#define OID_802_11_SSID 0x0d010102
+#define OID_802_11_INFRASTRUCTURE_MODE 0x0d010108
+#define OID_802_11_ADD_WEP 0x0d010113
+#define OID_802_11_REMOVE_WEP 0x0d010114
+#define OID_802_11_DISASSOCIATE 0x0d010115
+#define OID_802_11_AUTHENTICATION_MODE 0x0d010118
+#define OID_802_11_PRIVACY_FILTER 0x0d010119
+#define OID_802_11_BSSID_LIST_SCAN 0x0d01011a
+#define OID_802_11_ENCRYPTION_STATUS 0x0d01011b
+#define OID_802_11_ADD_KEY 0x0d01011d
+#define OID_802_11_REMOVE_KEY 0x0d01011e
+#define OID_802_11_ASSOCIATION_INFORMATION 0x0d01011f
+#define OID_802_11_CAPABILITY 0x0d010122
+#define OID_802_11_PMKID 0x0d010123
+#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0d010203
+#define OID_802_11_NETWORK_TYPE_IN_USE 0x0d010204
+#define OID_802_11_TX_POWER_LEVEL 0x0d010205
+#define OID_802_11_RSSI 0x0d010206
+#define OID_802_11_RSSI_TRIGGER 0x0d010207
+#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0d010209
+#define OID_802_11_RTS_THRESHOLD 0x0d01020a
+#define OID_802_11_SUPPORTED_RATES 0x0d01020e
+#define OID_802_11_CONFIGURATION 0x0d010211
+#define OID_802_11_POWER_MODE 0x0d010216
+#define OID_802_11_BSSID_LIST 0x0d010217
/* Typical noise/maximum signal level values taken from ndiswrapper iw_ndis.h */
/* codes for "status" field of completion messages */
-#define RNDIS_STATUS_ADAPTER_NOT_READY cpu_to_le32(0xc0010011)
-#define RNDIS_STATUS_ADAPTER_NOT_OPEN cpu_to_le32(0xc0010012)
+#define RNDIS_STATUS_ADAPTER_NOT_READY 0xc0010011
+#define RNDIS_STATUS_ADAPTER_NOT_OPEN 0xc0010012
/* Known device types */
static const char *oid_to_string(__le32 oid)
{
switch (oid) {
-#define OID_STR(oid) case oid: return(#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);
{
int ret = -EINVAL;
switch (rndis_status) {
- case RNDIS_STATUS_SUCCESS:
+ case cpu_to_le32(RNDIS_STATUS_SUCCESS):
ret = 0;
break;
- case RNDIS_STATUS_FAILURE:
- case RNDIS_STATUS_INVALID_DATA:
+ case cpu_to_le32(RNDIS_STATUS_FAILURE):
+ case cpu_to_le32(RNDIS_STATUS_INVALID_DATA):
ret = -EINVAL;
break;
- case RNDIS_STATUS_NOT_SUPPORTED:
+ case cpu_to_le32(RNDIS_STATUS_NOT_SUPPORTED):
ret = -EOPNOTSUPP;
break;
- case RNDIS_STATUS_ADAPTER_NOT_READY:
- case RNDIS_STATUS_ADAPTER_NOT_OPEN:
+ case cpu_to_le32(RNDIS_STATUS_ADAPTER_NOT_READY):
+ case cpu_to_le32(RNDIS_STATUS_ADAPTER_NOT_OPEN):
ret = -EBUSY;
break;
}
mutex_lock(&priv->command_lock);
memset(u.get, 0, sizeof *u.get);
- u.get->msg_type = RNDIS_MSG_QUERY;
+ u.get->msg_type = cpu_to_le32(RNDIS_MSG_QUERY);
u.get->msg_len = cpu_to_le32(sizeof *u.get);
u.get->oid = oid;
mutex_lock(&priv->command_lock);
memset(u.set, 0, sizeof *u.set);
- u.set->msg_type = RNDIS_MSG_SET;
+ u.set->msg_type = cpu_to_le32(RNDIS_MSG_SET);
u.set->msg_len = cpu_to_le32(sizeof(*u.set) + len);
u.set->oid = oid;
u.set->len = cpu_to_le32(len);
reset = (void *)priv->command_buffer;
memset(reset, 0, sizeof(*reset));
- reset->msg_type = RNDIS_MSG_RESET;
+ reset->msg_type = cpu_to_le32(RNDIS_MSG_RESET);
reset->msg_len = cpu_to_le32(sizeof(*reset));
priv->current_command_oid = 0;
ret = rndis_command(usbdev, (void *)reset, CONTROL_BUFFER_SIZE);
}
#endif
- ret = rndis_set_oid(dev, OID_GEN_RNDIS_CONFIG_PARAMETER,
+ ret = rndis_set_oid(dev, cpu_to_le32(OID_GEN_RNDIS_CONFIG_PARAMETER),
infobuf, info_len);
if (ret != 0)
netdev_dbg(dev->net, "setting rndis config parameter failed, %d\n",
/* Note: OID_802_11_BSSID_LIST_SCAN clears internal BSS list. */
tmp = cpu_to_le32(1);
- return rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp,
+ return rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_BSSID_LIST_SCAN), &tmp,
sizeof(tmp));
}
struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
int ret;
- ret = rndis_set_oid(usbdev, OID_802_11_SSID, ssid, sizeof(*ssid));
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_SSID), ssid, sizeof(*ssid));
if (ret < 0) {
netdev_warn(usbdev->net, "setting SSID failed (%08X)\n", ret);
return ret;
{
int ret;
- ret = rndis_set_oid(usbdev, OID_802_11_BSSID, bssid, ETH_ALEN);
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_BSSID), bssid, ETH_ALEN);
if (ret < 0) {
netdev_warn(usbdev->net, "setting BSSID[%pM] failed (%08X)\n",
bssid, ret);
int ret, len;
len = ETH_ALEN;
- ret = rndis_query_oid(usbdev, OID_802_11_BSSID, bssid, &len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_BSSID), bssid, &len);
if (ret != 0)
memset(bssid, 0, ETH_ALEN);
static int get_association_info(struct usbnet *usbdev,
struct ndis_80211_assoc_info *info, int len)
{
- return rndis_query_oid(usbdev, OID_802_11_ASSOCIATION_INFORMATION,
+ return rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_ASSOCIATION_INFORMATION),
info, &len);
}
int i, ret = 0;
if (priv->radio_on) {
- ret = rndis_set_oid(usbdev, OID_802_11_DISASSOCIATE, NULL, 0);
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_DISASSOCIATE), NULL, 0);
if (ret == 0) {
priv->radio_on = false;
netdev_dbg(usbdev->net, "%s(): radio_on = false\n",
return -ENOTSUPP;
tmp = cpu_to_le32(auth_mode);
- ret = rndis_set_oid(usbdev, OID_802_11_AUTHENTICATION_MODE, &tmp,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_AUTHENTICATION_MODE), &tmp,
sizeof(tmp));
if (ret != 0) {
netdev_warn(usbdev->net, "setting auth mode failed (%08X)\n",
else
tmp = cpu_to_le32(NDIS_80211_PRIV_ACCEPT_ALL);
- return rndis_set_oid(usbdev, OID_802_11_PRIVACY_FILTER, &tmp,
+ return rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_PRIVACY_FILTER), &tmp,
sizeof(tmp));
}
encr_mode = NDIS_80211_ENCR_DISABLED;
tmp = cpu_to_le32(encr_mode);
- ret = rndis_set_oid(usbdev, OID_802_11_ENCRYPTION_STATUS, &tmp,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_ENCRYPTION_STATUS), &tmp,
sizeof(tmp));
if (ret != 0) {
netdev_warn(usbdev->net, "setting encr mode failed (%08X)\n",
__func__, priv->infra_mode);
tmp = cpu_to_le32(mode);
- ret = rndis_set_oid(usbdev, OID_802_11_INFRASTRUCTURE_MODE, &tmp,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_INFRASTRUCTURE_MODE), &tmp,
sizeof(tmp));
if (ret != 0) {
netdev_warn(usbdev->net, "setting infra mode failed (%08X)\n",
rts_threshold = 2347;
tmp = cpu_to_le32(rts_threshold);
- return rndis_set_oid(usbdev, OID_802_11_RTS_THRESHOLD, &tmp,
+ return rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_RTS_THRESHOLD), &tmp,
sizeof(tmp));
}
frag_threshold = 2346;
tmp = cpu_to_le32(frag_threshold);
- return rndis_set_oid(usbdev, OID_802_11_FRAGMENTATION_THRESHOLD, &tmp,
+ return rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_FRAGMENTATION_THRESHOLD), &tmp,
sizeof(tmp));
}
dsconfig = ieee80211_dsss_chan_to_freq(channel) * 1000;
len = sizeof(config);
- ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_CONFIGURATION), &config, &len);
if (ret < 0) {
netdev_dbg(usbdev->net, "%s(): querying configuration failed\n",
__func__);
}
config.ds_config = cpu_to_le32(dsconfig);
- ret = rndis_set_oid(usbdev, OID_802_11_CONFIGURATION, &config,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_CONFIGURATION), &config,
sizeof(config));
netdev_dbg(usbdev->net, "%s(): %d -> %d\n", __func__, channel, ret);
/* Get channel and beacon interval */
len = sizeof(config);
- ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_CONFIGURATION), &config, &len);
netdev_dbg(usbdev->net, "%s(): OID_802_11_CONFIGURATION -> %d\n",
__func__, ret);
if (ret < 0)
ret);
}
- ret = rndis_set_oid(usbdev, OID_802_11_ADD_WEP, &ndis_key,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_ADD_WEP), &ndis_key,
sizeof(ndis_key));
if (ret != 0) {
netdev_warn(usbdev->net, "adding encryption key %d failed (%08X)\n",
get_bssid(usbdev, ndis_key.bssid);
}
- ret = rndis_set_oid(usbdev, OID_802_11_ADD_KEY, &ndis_key,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_ADD_KEY), &ndis_key,
le32_to_cpu(ndis_key.size));
netdev_dbg(usbdev->net, "%s(): OID_802_11_ADD_KEY -> %08X\n",
__func__, ret);
memset(remove_key.bssid, 0xff,
sizeof(remove_key.bssid));
- ret = rndis_set_oid(usbdev, OID_802_11_REMOVE_KEY, &remove_key,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_REMOVE_KEY), &remove_key,
sizeof(remove_key));
if (ret != 0)
return ret;
} else {
keyindex = cpu_to_le32(index);
- ret = rndis_set_oid(usbdev, OID_802_11_REMOVE_WEP, &keyindex,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_REMOVE_WEP), &keyindex,
sizeof(keyindex));
if (ret != 0) {
netdev_warn(usbdev->net,
char *mc_addrs = NULL;
int mc_count;
- basefilter = filter = RNDIS_PACKET_TYPE_DIRECTED |
- RNDIS_PACKET_TYPE_BROADCAST;
+ basefilter = filter = cpu_to_le32(RNDIS_PACKET_TYPE_DIRECTED |
+ RNDIS_PACKET_TYPE_BROADCAST);
if (usbdev->net->flags & IFF_PROMISC) {
- filter |= RNDIS_PACKET_TYPE_PROMISCUOUS |
- RNDIS_PACKET_TYPE_ALL_LOCAL;
+ filter |= cpu_to_le32(RNDIS_PACKET_TYPE_PROMISCUOUS |
+ RNDIS_PACKET_TYPE_ALL_LOCAL);
} else if (usbdev->net->flags & IFF_ALLMULTI) {
- filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST;
+ filter |= cpu_to_le32(RNDIS_PACKET_TYPE_ALL_MULTICAST);
}
if (filter != basefilter)
netif_addr_lock_bh(usbdev->net);
mc_count = netdev_mc_count(usbdev->net);
if (mc_count > priv->multicast_size) {
- filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST;
+ filter |= cpu_to_le32(RNDIS_PACKET_TYPE_ALL_MULTICAST);
} else if (mc_count) {
int i = 0;
goto set_filter;
if (mc_count) {
- ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, mc_addrs,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_3_MULTICAST_LIST), mc_addrs,
mc_count * ETH_ALEN);
kfree(mc_addrs);
if (ret == 0)
- filter |= RNDIS_PACKET_TYPE_MULTICAST;
+ filter |= cpu_to_le32(RNDIS_PACKET_TYPE_MULTICAST);
else
- filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST;
+ filter |= cpu_to_le32(RNDIS_PACKET_TYPE_ALL_MULTICAST);
netdev_dbg(usbdev->net, "OID_802_3_MULTICAST_LIST(%d, max: %d) -> %d\n",
mc_count, priv->multicast_size, ret);
}
set_filter:
- ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_GEN_CURRENT_PACKET_FILTER), &filter,
sizeof(filter));
if (ret < 0) {
netdev_warn(usbdev->net, "couldn't set packet filter: %08x\n",
pmkids->length = cpu_to_le32(len);
pmkids->bssid_info_count = cpu_to_le32(max_pmkids);
- ret = rndis_query_oid(usbdev, OID_802_11_PMKID, pmkids, &len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_PMKID), pmkids, &len);
if (ret < 0) {
netdev_dbg(usbdev->net, "%s(): OID_802_11_PMKID(%d, %d)"
" -> %d\n", __func__, len, max_pmkids, ret);
debug_print_pmkids(usbdev, pmkids, __func__);
- ret = rndis_set_oid(usbdev, OID_802_11_PMKID, pmkids,
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_PMKID), pmkids,
le32_to_cpu(pmkids->length));
if (ret < 0) {
netdev_dbg(usbdev->net, "%s(): OID_802_11_PMKID(%d, %d) -> %d"
* resizing until it won't get any bigger.
*/
new_len = len;
- ret = rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &new_len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_BSSID_LIST), buf, &new_len);
if (ret != 0 || new_len < sizeof(struct ndis_80211_bssid_list_ex))
goto out;
memset(sinfo, 0, sizeof(*sinfo));
len = sizeof(linkspeed);
- ret = rndis_query_oid(usbdev, OID_GEN_LINK_SPEED, &linkspeed, &len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_GEN_LINK_SPEED), &linkspeed, &len);
if (ret == 0) {
sinfo->txrate.legacy = le32_to_cpu(linkspeed) / 1000;
sinfo->filled |= STATION_INFO_TX_BITRATE;
}
len = sizeof(rssi);
- ret = rndis_query_oid(usbdev, OID_802_11_RSSI, &rssi, &len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_RSSI), &rssi, &len);
if (ret == 0) {
sinfo->signal = level_to_qual(le32_to_cpu(rssi));
sinfo->filled |= STATION_INFO_SIGNAL;
pmkid.length = cpu_to_le32(sizeof(pmkid));
pmkid.bssid_info_count = cpu_to_le32(0);
- return rndis_set_oid(usbdev, OID_802_11_PMKID, &pmkid, sizeof(pmkid));
+ return rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_PMKID), &pmkid, sizeof(pmkid));
}
static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
priv->power_mode = power_mode;
mode = cpu_to_le32(power_mode);
- ret = rndis_set_oid(usbdev, OID_802_11_POWER_MODE, &mode, sizeof(mode));
+ ret = rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_POWER_MODE), &mode, sizeof(mode));
netdev_dbg(usbdev->net, "%s(): OID_802_11_POWER_MODE -> %d\n",
__func__, ret);
/* Get signal quality, in case of error use rssi=0 and ignore error. */
len = sizeof(rssi);
rssi = 0;
- ret = rndis_query_oid(usbdev, OID_802_11_RSSI, &rssi, &len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_RSSI), &rssi, &len);
signal = level_to_qual(le32_to_cpu(rssi));
netdev_dbg(usbdev->net, "%s(): OID_802_11_RSSI -> %d, "
/* Get SSID, in case of error, use zero length SSID and ignore error. */
len = sizeof(ssid);
memset(&ssid, 0, sizeof(ssid));
- ret = rndis_query_oid(usbdev, OID_802_11_SSID, &ssid, &len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_SSID), &ssid, &len);
netdev_dbg(usbdev->net, "%s(): OID_802_11_SSID -> %d, len: %d, ssid: "
"'%.32s'\n", __func__, ret,
le32_to_cpu(ssid.length), ssid.essid);
struct rndis_indicate *msg = ind;
switch (msg->status) {
- case RNDIS_STATUS_MEDIA_CONNECT:
- if (priv->current_command_oid == OID_802_11_ADD_KEY) {
+ case cpu_to_le32(RNDIS_STATUS_MEDIA_CONNECT):
+ if (priv->current_command_oid == cpu_to_le32(OID_802_11_ADD_KEY)) {
/* OID_802_11_ADD_KEY causes sometimes extra
* "media connect" indications which confuses driver
* and userspace to think that device is
queue_work(priv->workqueue, &priv->work);
break;
- case RNDIS_STATUS_MEDIA_DISCONNECT:
+ case cpu_to_le32(RNDIS_STATUS_MEDIA_DISCONNECT):
netdev_info(usbdev->net, "media disconnect\n");
/* queue work to avoid recursive calls into rndis_command */
queue_work(priv->workqueue, &priv->work);
break;
- case RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION:
+ case cpu_to_le32(RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION):
rndis_wlan_media_specific_indication(usbdev, msg, buflen);
break;
/* determine supported modes */
len = sizeof(networks_supported);
- retval = rndis_query_oid(usbdev, OID_802_11_NETWORK_TYPES_SUPPORTED,
+ retval = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_NETWORK_TYPES_SUPPORTED),
&networks_supported, &len);
if (retval >= 0) {
n = le32_to_cpu(networks_supported.num_items);
/* get device 802.11 capabilities, number of PMKIDs */
caps = (struct ndis_80211_capability *)caps_buf;
len = sizeof(caps_buf);
- retval = rndis_query_oid(usbdev, OID_802_11_CAPABILITY, caps, &len);
+ retval = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_CAPABILITY), caps, &len);
if (retval >= 0) {
netdev_dbg(usbdev->net, "OID_802_11_CAPABILITY -> len %d, "
"ver %d, pmkids %d, auth-encr-pairs %d\n",
}
len = sizeof(rssi);
- ret = rndis_query_oid(usbdev, OID_802_11_RSSI, &rssi, &len);
+ ret = rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_RSSI), &rssi, &len);
if (ret == 0) {
priv->last_qual = level_to_qual(le32_to_cpu(rssi));
rndis_do_cqm(usbdev, le32_to_cpu(rssi));
* working.
*/
tmp = cpu_to_le32(1);
- rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp,
+ rndis_set_oid(usbdev, cpu_to_le32(OID_802_11_BSSID_LIST_SCAN), &tmp,
sizeof(tmp));
len = CONTROL_BUFFER_SIZE;
if (!buf)
goto end;
- rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &len);
+ rndis_query_oid(usbdev, cpu_to_le32(OID_802_11_BSSID_LIST), buf, &len);
kfree(buf);
}
*/
usbdev->net->netdev_ops = &rndis_wlan_netdev_ops;
- tmp = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST;
- retval = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &tmp,
- sizeof(tmp));
+ 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),
+ &tmp, sizeof(tmp));
len = sizeof(tmp);
- retval = rndis_query_oid(usbdev, OID_802_3_MAXIMUM_LIST_SIZE, &tmp,
- &len);
+ retval = rndis_query_oid(usbdev,
+ cpu_to_le32(OID_802_3_MAXIMUM_LIST_SIZE),
+ &tmp, &len);
priv->multicast_size = le32_to_cpu(tmp);
if (retval < 0 || priv->multicast_size < 0)
priv->multicast_size = 0;
/* Set current packet filter zero to block receiving data packets from
device. */
filter = 0;
- rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter,
+ rndis_set_oid(usbdev, cpu_to_le32(OID_GEN_CURRENT_PACKET_FILTER), &filter,
sizeof(filter));
return retval;
*/
#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
-#define RNDIS_MSG_COMPLETION cpu_to_le32(0x80000000)
+#define RNDIS_MSG_COMPLETION 0x80000000
/* codes for "msg_type" field of rndis messages;
* only the data channel uses packet messages (maybe batched);
* everything else goes on the control channel.
*/
-#define RNDIS_MSG_PACKET cpu_to_le32(0x00000001) /* 1-N packets */
-#define RNDIS_MSG_INIT cpu_to_le32(0x00000002)
+#define RNDIS_MSG_PACKET 0x00000001 /* 1-N packets */
+#define RNDIS_MSG_INIT 0x00000002
#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
-#define RNDIS_MSG_HALT cpu_to_le32(0x00000003)
-#define RNDIS_MSG_QUERY cpu_to_le32(0x00000004)
+#define RNDIS_MSG_HALT 0x00000003
+#define RNDIS_MSG_QUERY 0x00000004
#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
-#define RNDIS_MSG_SET cpu_to_le32(0x00000005)
+#define RNDIS_MSG_SET 0x00000005
#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
-#define RNDIS_MSG_RESET cpu_to_le32(0x00000006)
+#define RNDIS_MSG_RESET 0x00000006
#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
-#define RNDIS_MSG_INDICATE cpu_to_le32(0x00000007)
-#define RNDIS_MSG_KEEPALIVE cpu_to_le32(0x00000008)
+#define RNDIS_MSG_INDICATE 0x00000007
+#define RNDIS_MSG_KEEPALIVE 0x00000008
#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
/* codes for "status" field of completion messages */
-#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000)
-#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001)
-#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015)
-#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb)
-#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b)
-#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c)
-#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION cpu_to_le32(0x40010012)
+#define RNDIS_STATUS_SUCCESS 0x00000000
+#define RNDIS_STATUS_FAILURE 0xc0000001
+#define RNDIS_STATUS_INVALID_DATA 0xc0010015
+#define RNDIS_STATUS_NOT_SUPPORTED 0xc00000bb
+#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000b
+#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000c
+#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
/* codes for OID_GEN_PHYSICAL_MEDIUM */
-#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000)
-#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN cpu_to_le32(0x00000001)
-#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM cpu_to_le32(0x00000002)
-#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE cpu_to_le32(0x00000003)
-#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE cpu_to_le32(0x00000004)
-#define RNDIS_PHYSICAL_MEDIUM_DSL cpu_to_le32(0x00000005)
-#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL cpu_to_le32(0x00000006)
-#define RNDIS_PHYSICAL_MEDIUM_1394 cpu_to_le32(0x00000007)
-#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN cpu_to_le32(0x00000008)
-#define RNDIS_PHYSICAL_MEDIUM_MAX cpu_to_le32(0x00000009)
+#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED 0x00000000
+#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN 0x00000001
+#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM 0x00000002
+#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE 0x00000003
+#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE 0x00000004
+#define RNDIS_PHYSICAL_MEDIUM_DSL 0x00000005
+#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL 0x00000006
+#define RNDIS_PHYSICAL_MEDIUM_1394 0x00000007
+#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN 0x00000008
+#define RNDIS_PHYSICAL_MEDIUM_MAX 0x00000009
struct rndis_data_hdr {
__le32 msg_type; /* RNDIS_MSG_PACKET */
* 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 cpu_to_le32(0x01010101)
-#define OID_GEN_MAXIMUM_FRAME_SIZE cpu_to_le32(0x00010106)
-#define OID_GEN_CURRENT_PACKET_FILTER cpu_to_le32(0x0001010e)
-#define OID_GEN_PHYSICAL_MEDIUM cpu_to_le32(0x00010202)
+#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 */
-#define RNDIS_PACKET_TYPE_DIRECTED cpu_to_le32(0x00000001)
-#define RNDIS_PACKET_TYPE_MULTICAST cpu_to_le32(0x00000002)
-#define RNDIS_PACKET_TYPE_ALL_MULTICAST cpu_to_le32(0x00000004)
-#define RNDIS_PACKET_TYPE_BROADCAST cpu_to_le32(0x00000008)
-#define RNDIS_PACKET_TYPE_SOURCE_ROUTING cpu_to_le32(0x00000010)
-#define RNDIS_PACKET_TYPE_PROMISCUOUS cpu_to_le32(0x00000020)
-#define RNDIS_PACKET_TYPE_SMT cpu_to_le32(0x00000040)
-#define RNDIS_PACKET_TYPE_ALL_LOCAL cpu_to_le32(0x00000080)
-#define RNDIS_PACKET_TYPE_GROUP cpu_to_le32(0x00001000)
-#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL cpu_to_le32(0x00002000)
-#define RNDIS_PACKET_TYPE_FUNCTIONAL cpu_to_le32(0x00004000)
-#define RNDIS_PACKET_TYPE_MAC_FRAME cpu_to_le32(0x00008000)
+#define RNDIS_PACKET_TYPE_DIRECTED 0x00000001
+#define RNDIS_PACKET_TYPE_MULTICAST 0x00000002
+#define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
+#define RNDIS_PACKET_TYPE_BROADCAST 0x00000008
+#define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
+#define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
+#define RNDIS_PACKET_TYPE_SMT 0x00000040
+#define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
+#define RNDIS_PACKET_TYPE_GROUP 0x00001000
+#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
+#define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
+#define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000
/* default filter used with RNDIS devices */
#define RNDIS_DEFAULT_FILTER ( \