diff options
Diffstat (limited to 'drivers/usb/gadget/rndis.c')
-rw-r--r-- | drivers/usb/gadget/rndis.c | 115 |
1 files changed, 55 insertions, 60 deletions
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 7228e8562236..8c26f5ea2b83 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -57,11 +57,6 @@ MODULE_PARM_DESC (rndis_debug, "enable debugging"); | |||
57 | #define rndis_debug 0 | 57 | #define rndis_debug 0 |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #define DBG(str,args...) do { \ | ||
61 | if (rndis_debug) \ | ||
62 | pr_debug(str , ## args); \ | ||
63 | } while (0) | ||
64 | |||
65 | #define RNDIS_MAX_CONFIGS 1 | 60 | #define RNDIS_MAX_CONFIGS 1 |
66 | 61 | ||
67 | 62 | ||
@@ -183,9 +178,9 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
183 | if (!resp) return -ENOMEM; | 178 | if (!resp) return -ENOMEM; |
184 | 179 | ||
185 | if (buf_len && rndis_debug > 1) { | 180 | if (buf_len && rndis_debug > 1) { |
186 | DBG("query OID %08x value, len %d:\n", OID, buf_len); | 181 | pr_debug("query OID %08x value, len %d:\n", OID, buf_len); |
187 | for (i = 0; i < buf_len; i += 16) { | 182 | for (i = 0; i < buf_len; i += 16) { |
188 | DBG("%03d: %08x %08x %08x %08x\n", i, | 183 | pr_debug("%03d: %08x %08x %08x %08x\n", i, |
189 | get_unaligned_le32(&buf[i]), | 184 | get_unaligned_le32(&buf[i]), |
190 | get_unaligned_le32(&buf[i + 4]), | 185 | get_unaligned_le32(&buf[i + 4]), |
191 | get_unaligned_le32(&buf[i + 8]), | 186 | get_unaligned_le32(&buf[i + 8]), |
@@ -209,7 +204,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
209 | 204 | ||
210 | /* mandatory */ | 205 | /* mandatory */ |
211 | case OID_GEN_SUPPORTED_LIST: | 206 | case OID_GEN_SUPPORTED_LIST: |
212 | DBG("%s: OID_GEN_SUPPORTED_LIST\n", __func__); | 207 | pr_debug("%s: OID_GEN_SUPPORTED_LIST\n", __func__); |
213 | length = sizeof (oid_supported_list); | 208 | length = sizeof (oid_supported_list); |
214 | count = length / sizeof (u32); | 209 | count = length / sizeof (u32); |
215 | for (i = 0; i < count; i++) | 210 | for (i = 0; i < count; i++) |
@@ -219,7 +214,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
219 | 214 | ||
220 | /* mandatory */ | 215 | /* mandatory */ |
221 | case OID_GEN_HARDWARE_STATUS: | 216 | case OID_GEN_HARDWARE_STATUS: |
222 | DBG("%s: OID_GEN_HARDWARE_STATUS\n", __func__); | 217 | pr_debug("%s: OID_GEN_HARDWARE_STATUS\n", __func__); |
223 | /* Bogus question! | 218 | /* Bogus question! |
224 | * Hardware must be ready to receive high level protocols. | 219 | * Hardware must be ready to receive high level protocols. |
225 | * BTW: | 220 | * BTW: |
@@ -232,14 +227,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
232 | 227 | ||
233 | /* mandatory */ | 228 | /* mandatory */ |
234 | case OID_GEN_MEDIA_SUPPORTED: | 229 | case OID_GEN_MEDIA_SUPPORTED: |
235 | DBG("%s: OID_GEN_MEDIA_SUPPORTED\n", __func__); | 230 | pr_debug("%s: OID_GEN_MEDIA_SUPPORTED\n", __func__); |
236 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); | 231 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); |
237 | retval = 0; | 232 | retval = 0; |
238 | break; | 233 | break; |
239 | 234 | ||
240 | /* mandatory */ | 235 | /* mandatory */ |
241 | case OID_GEN_MEDIA_IN_USE: | 236 | case OID_GEN_MEDIA_IN_USE: |
242 | DBG("%s: OID_GEN_MEDIA_IN_USE\n", __func__); | 237 | pr_debug("%s: OID_GEN_MEDIA_IN_USE\n", __func__); |
243 | /* one medium, one transport... (maybe you do it better) */ | 238 | /* one medium, one transport... (maybe you do it better) */ |
244 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); | 239 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); |
245 | retval = 0; | 240 | retval = 0; |
@@ -247,7 +242,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
247 | 242 | ||
248 | /* mandatory */ | 243 | /* mandatory */ |
249 | case OID_GEN_MAXIMUM_FRAME_SIZE: | 244 | case OID_GEN_MAXIMUM_FRAME_SIZE: |
250 | DBG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __func__); | 245 | pr_debug("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __func__); |
251 | if (rndis_per_dev_params [configNr].dev) { | 246 | if (rndis_per_dev_params [configNr].dev) { |
252 | *outbuf = cpu_to_le32 ( | 247 | *outbuf = cpu_to_le32 ( |
253 | rndis_per_dev_params [configNr].dev->mtu); | 248 | rndis_per_dev_params [configNr].dev->mtu); |
@@ -258,7 +253,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
258 | /* mandatory */ | 253 | /* mandatory */ |
259 | case OID_GEN_LINK_SPEED: | 254 | case OID_GEN_LINK_SPEED: |
260 | if (rndis_debug > 1) | 255 | if (rndis_debug > 1) |
261 | DBG("%s: OID_GEN_LINK_SPEED\n", __func__); | 256 | pr_debug("%s: OID_GEN_LINK_SPEED\n", __func__); |
262 | if (rndis_per_dev_params [configNr].media_state | 257 | if (rndis_per_dev_params [configNr].media_state |
263 | == NDIS_MEDIA_STATE_DISCONNECTED) | 258 | == NDIS_MEDIA_STATE_DISCONNECTED) |
264 | *outbuf = __constant_cpu_to_le32 (0); | 259 | *outbuf = __constant_cpu_to_le32 (0); |
@@ -270,7 +265,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
270 | 265 | ||
271 | /* mandatory */ | 266 | /* mandatory */ |
272 | case OID_GEN_TRANSMIT_BLOCK_SIZE: | 267 | case OID_GEN_TRANSMIT_BLOCK_SIZE: |
273 | DBG("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __func__); | 268 | pr_debug("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __func__); |
274 | if (rndis_per_dev_params [configNr].dev) { | 269 | if (rndis_per_dev_params [configNr].dev) { |
275 | *outbuf = cpu_to_le32 ( | 270 | *outbuf = cpu_to_le32 ( |
276 | rndis_per_dev_params [configNr].dev->mtu); | 271 | rndis_per_dev_params [configNr].dev->mtu); |
@@ -280,7 +275,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
280 | 275 | ||
281 | /* mandatory */ | 276 | /* mandatory */ |
282 | case OID_GEN_RECEIVE_BLOCK_SIZE: | 277 | case OID_GEN_RECEIVE_BLOCK_SIZE: |
283 | DBG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __func__); | 278 | pr_debug("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __func__); |
284 | if (rndis_per_dev_params [configNr].dev) { | 279 | if (rndis_per_dev_params [configNr].dev) { |
285 | *outbuf = cpu_to_le32 ( | 280 | *outbuf = cpu_to_le32 ( |
286 | rndis_per_dev_params [configNr].dev->mtu); | 281 | rndis_per_dev_params [configNr].dev->mtu); |
@@ -290,7 +285,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
290 | 285 | ||
291 | /* mandatory */ | 286 | /* mandatory */ |
292 | case OID_GEN_VENDOR_ID: | 287 | case OID_GEN_VENDOR_ID: |
293 | DBG("%s: OID_GEN_VENDOR_ID\n", __func__); | 288 | pr_debug("%s: OID_GEN_VENDOR_ID\n", __func__); |
294 | *outbuf = cpu_to_le32 ( | 289 | *outbuf = cpu_to_le32 ( |
295 | rndis_per_dev_params [configNr].vendorID); | 290 | rndis_per_dev_params [configNr].vendorID); |
296 | retval = 0; | 291 | retval = 0; |
@@ -298,7 +293,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
298 | 293 | ||
299 | /* mandatory */ | 294 | /* mandatory */ |
300 | case OID_GEN_VENDOR_DESCRIPTION: | 295 | case OID_GEN_VENDOR_DESCRIPTION: |
301 | DBG("%s: OID_GEN_VENDOR_DESCRIPTION\n", __func__); | 296 | pr_debug("%s: OID_GEN_VENDOR_DESCRIPTION\n", __func__); |
302 | length = strlen (rndis_per_dev_params [configNr].vendorDescr); | 297 | length = strlen (rndis_per_dev_params [configNr].vendorDescr); |
303 | memcpy (outbuf, | 298 | memcpy (outbuf, |
304 | rndis_per_dev_params [configNr].vendorDescr, length); | 299 | rndis_per_dev_params [configNr].vendorDescr, length); |
@@ -306,7 +301,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
306 | break; | 301 | break; |
307 | 302 | ||
308 | case OID_GEN_VENDOR_DRIVER_VERSION: | 303 | case OID_GEN_VENDOR_DRIVER_VERSION: |
309 | DBG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __func__); | 304 | pr_debug("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __func__); |
310 | /* Created as LE */ | 305 | /* Created as LE */ |
311 | *outbuf = rndis_driver_version; | 306 | *outbuf = rndis_driver_version; |
312 | retval = 0; | 307 | retval = 0; |
@@ -314,14 +309,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
314 | 309 | ||
315 | /* mandatory */ | 310 | /* mandatory */ |
316 | case OID_GEN_CURRENT_PACKET_FILTER: | 311 | case OID_GEN_CURRENT_PACKET_FILTER: |
317 | DBG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __func__); | 312 | pr_debug("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __func__); |
318 | *outbuf = cpu_to_le32 (*rndis_per_dev_params[configNr].filter); | 313 | *outbuf = cpu_to_le32 (*rndis_per_dev_params[configNr].filter); |
319 | retval = 0; | 314 | retval = 0; |
320 | break; | 315 | break; |
321 | 316 | ||
322 | /* mandatory */ | 317 | /* mandatory */ |
323 | case OID_GEN_MAXIMUM_TOTAL_SIZE: | 318 | case OID_GEN_MAXIMUM_TOTAL_SIZE: |
324 | DBG("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __func__); | 319 | pr_debug("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __func__); |
325 | *outbuf = __constant_cpu_to_le32(RNDIS_MAX_TOTAL_SIZE); | 320 | *outbuf = __constant_cpu_to_le32(RNDIS_MAX_TOTAL_SIZE); |
326 | retval = 0; | 321 | retval = 0; |
327 | break; | 322 | break; |
@@ -329,14 +324,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
329 | /* mandatory */ | 324 | /* mandatory */ |
330 | case OID_GEN_MEDIA_CONNECT_STATUS: | 325 | case OID_GEN_MEDIA_CONNECT_STATUS: |
331 | if (rndis_debug > 1) | 326 | if (rndis_debug > 1) |
332 | DBG("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __func__); | 327 | pr_debug("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __func__); |
333 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] | 328 | *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] |
334 | .media_state); | 329 | .media_state); |
335 | retval = 0; | 330 | retval = 0; |
336 | break; | 331 | break; |
337 | 332 | ||
338 | case OID_GEN_PHYSICAL_MEDIUM: | 333 | case OID_GEN_PHYSICAL_MEDIUM: |
339 | DBG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __func__); | 334 | pr_debug("%s: OID_GEN_PHYSICAL_MEDIUM\n", __func__); |
340 | *outbuf = __constant_cpu_to_le32 (0); | 335 | *outbuf = __constant_cpu_to_le32 (0); |
341 | retval = 0; | 336 | retval = 0; |
342 | break; | 337 | break; |
@@ -346,7 +341,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
346 | * versions emit undefined RNDIS messages. DOCUMENT ALL THESE! | 341 | * versions emit undefined RNDIS messages. DOCUMENT ALL THESE! |
347 | */ | 342 | */ |
348 | case OID_GEN_MAC_OPTIONS: /* from WinME */ | 343 | case OID_GEN_MAC_OPTIONS: /* from WinME */ |
349 | DBG("%s: OID_GEN_MAC_OPTIONS\n", __func__); | 344 | pr_debug("%s: OID_GEN_MAC_OPTIONS\n", __func__); |
350 | *outbuf = __constant_cpu_to_le32( | 345 | *outbuf = __constant_cpu_to_le32( |
351 | NDIS_MAC_OPTION_RECEIVE_SERIALIZED | 346 | NDIS_MAC_OPTION_RECEIVE_SERIALIZED |
352 | | NDIS_MAC_OPTION_FULL_DUPLEX); | 347 | | NDIS_MAC_OPTION_FULL_DUPLEX); |
@@ -358,7 +353,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
358 | /* mandatory */ | 353 | /* mandatory */ |
359 | case OID_GEN_XMIT_OK: | 354 | case OID_GEN_XMIT_OK: |
360 | if (rndis_debug > 1) | 355 | if (rndis_debug > 1) |
361 | DBG("%s: OID_GEN_XMIT_OK\n", __func__); | 356 | pr_debug("%s: OID_GEN_XMIT_OK\n", __func__); |
362 | if (stats) { | 357 | if (stats) { |
363 | *outbuf = cpu_to_le32(stats->tx_packets | 358 | *outbuf = cpu_to_le32(stats->tx_packets |
364 | - stats->tx_errors - stats->tx_dropped); | 359 | - stats->tx_errors - stats->tx_dropped); |
@@ -369,7 +364,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
369 | /* mandatory */ | 364 | /* mandatory */ |
370 | case OID_GEN_RCV_OK: | 365 | case OID_GEN_RCV_OK: |
371 | if (rndis_debug > 1) | 366 | if (rndis_debug > 1) |
372 | DBG("%s: OID_GEN_RCV_OK\n", __func__); | 367 | pr_debug("%s: OID_GEN_RCV_OK\n", __func__); |
373 | if (stats) { | 368 | if (stats) { |
374 | *outbuf = cpu_to_le32(stats->rx_packets | 369 | *outbuf = cpu_to_le32(stats->rx_packets |
375 | - stats->rx_errors - stats->rx_dropped); | 370 | - stats->rx_errors - stats->rx_dropped); |
@@ -380,7 +375,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
380 | /* mandatory */ | 375 | /* mandatory */ |
381 | case OID_GEN_XMIT_ERROR: | 376 | case OID_GEN_XMIT_ERROR: |
382 | if (rndis_debug > 1) | 377 | if (rndis_debug > 1) |
383 | DBG("%s: OID_GEN_XMIT_ERROR\n", __func__); | 378 | pr_debug("%s: OID_GEN_XMIT_ERROR\n", __func__); |
384 | if (stats) { | 379 | if (stats) { |
385 | *outbuf = cpu_to_le32(stats->tx_errors); | 380 | *outbuf = cpu_to_le32(stats->tx_errors); |
386 | retval = 0; | 381 | retval = 0; |
@@ -390,7 +385,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
390 | /* mandatory */ | 385 | /* mandatory */ |
391 | case OID_GEN_RCV_ERROR: | 386 | case OID_GEN_RCV_ERROR: |
392 | if (rndis_debug > 1) | 387 | if (rndis_debug > 1) |
393 | DBG("%s: OID_GEN_RCV_ERROR\n", __func__); | 388 | pr_debug("%s: OID_GEN_RCV_ERROR\n", __func__); |
394 | if (stats) { | 389 | if (stats) { |
395 | *outbuf = cpu_to_le32(stats->rx_errors); | 390 | *outbuf = cpu_to_le32(stats->rx_errors); |
396 | retval = 0; | 391 | retval = 0; |
@@ -399,7 +394,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
399 | 394 | ||
400 | /* mandatory */ | 395 | /* mandatory */ |
401 | case OID_GEN_RCV_NO_BUFFER: | 396 | case OID_GEN_RCV_NO_BUFFER: |
402 | DBG("%s: OID_GEN_RCV_NO_BUFFER\n", __func__); | 397 | pr_debug("%s: OID_GEN_RCV_NO_BUFFER\n", __func__); |
403 | if (stats) { | 398 | if (stats) { |
404 | *outbuf = cpu_to_le32(stats->rx_dropped); | 399 | *outbuf = cpu_to_le32(stats->rx_dropped); |
405 | retval = 0; | 400 | retval = 0; |
@@ -410,7 +405,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
410 | 405 | ||
411 | /* mandatory */ | 406 | /* mandatory */ |
412 | case OID_802_3_PERMANENT_ADDRESS: | 407 | case OID_802_3_PERMANENT_ADDRESS: |
413 | DBG("%s: OID_802_3_PERMANENT_ADDRESS\n", __func__); | 408 | pr_debug("%s: OID_802_3_PERMANENT_ADDRESS\n", __func__); |
414 | if (rndis_per_dev_params [configNr].dev) { | 409 | if (rndis_per_dev_params [configNr].dev) { |
415 | length = ETH_ALEN; | 410 | length = ETH_ALEN; |
416 | memcpy (outbuf, | 411 | memcpy (outbuf, |
@@ -422,7 +417,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
422 | 417 | ||
423 | /* mandatory */ | 418 | /* mandatory */ |
424 | case OID_802_3_CURRENT_ADDRESS: | 419 | case OID_802_3_CURRENT_ADDRESS: |
425 | DBG("%s: OID_802_3_CURRENT_ADDRESS\n", __func__); | 420 | pr_debug("%s: OID_802_3_CURRENT_ADDRESS\n", __func__); |
426 | if (rndis_per_dev_params [configNr].dev) { | 421 | if (rndis_per_dev_params [configNr].dev) { |
427 | length = ETH_ALEN; | 422 | length = ETH_ALEN; |
428 | memcpy (outbuf, | 423 | memcpy (outbuf, |
@@ -434,7 +429,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
434 | 429 | ||
435 | /* mandatory */ | 430 | /* mandatory */ |
436 | case OID_802_3_MULTICAST_LIST: | 431 | case OID_802_3_MULTICAST_LIST: |
437 | DBG("%s: OID_802_3_MULTICAST_LIST\n", __func__); | 432 | pr_debug("%s: OID_802_3_MULTICAST_LIST\n", __func__); |
438 | /* Multicast base address only */ | 433 | /* Multicast base address only */ |
439 | *outbuf = __constant_cpu_to_le32 (0xE0000000); | 434 | *outbuf = __constant_cpu_to_le32 (0xE0000000); |
440 | retval = 0; | 435 | retval = 0; |
@@ -442,21 +437,21 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
442 | 437 | ||
443 | /* mandatory */ | 438 | /* mandatory */ |
444 | case OID_802_3_MAXIMUM_LIST_SIZE: | 439 | case OID_802_3_MAXIMUM_LIST_SIZE: |
445 | DBG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __func__); | 440 | pr_debug("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __func__); |
446 | /* Multicast base address only */ | 441 | /* Multicast base address only */ |
447 | *outbuf = __constant_cpu_to_le32 (1); | 442 | *outbuf = __constant_cpu_to_le32 (1); |
448 | retval = 0; | 443 | retval = 0; |
449 | break; | 444 | break; |
450 | 445 | ||
451 | case OID_802_3_MAC_OPTIONS: | 446 | case OID_802_3_MAC_OPTIONS: |
452 | DBG("%s: OID_802_3_MAC_OPTIONS\n", __func__); | 447 | pr_debug("%s: OID_802_3_MAC_OPTIONS\n", __func__); |
453 | break; | 448 | break; |
454 | 449 | ||
455 | /* ieee802.3 statistics OIDs (table 4-4) */ | 450 | /* ieee802.3 statistics OIDs (table 4-4) */ |
456 | 451 | ||
457 | /* mandatory */ | 452 | /* mandatory */ |
458 | case OID_802_3_RCV_ERROR_ALIGNMENT: | 453 | case OID_802_3_RCV_ERROR_ALIGNMENT: |
459 | DBG("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __func__); | 454 | pr_debug("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __func__); |
460 | if (stats) { | 455 | if (stats) { |
461 | *outbuf = cpu_to_le32(stats->rx_frame_errors); | 456 | *outbuf = cpu_to_le32(stats->rx_frame_errors); |
462 | retval = 0; | 457 | retval = 0; |
@@ -465,14 +460,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
465 | 460 | ||
466 | /* mandatory */ | 461 | /* mandatory */ |
467 | case OID_802_3_XMIT_ONE_COLLISION: | 462 | case OID_802_3_XMIT_ONE_COLLISION: |
468 | DBG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __func__); | 463 | pr_debug("%s: OID_802_3_XMIT_ONE_COLLISION\n", __func__); |
469 | *outbuf = __constant_cpu_to_le32 (0); | 464 | *outbuf = __constant_cpu_to_le32 (0); |
470 | retval = 0; | 465 | retval = 0; |
471 | break; | 466 | break; |
472 | 467 | ||
473 | /* mandatory */ | 468 | /* mandatory */ |
474 | case OID_802_3_XMIT_MORE_COLLISIONS: | 469 | case OID_802_3_XMIT_MORE_COLLISIONS: |
475 | DBG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __func__); | 470 | pr_debug("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __func__); |
476 | *outbuf = __constant_cpu_to_le32 (0); | 471 | *outbuf = __constant_cpu_to_le32 (0); |
477 | retval = 0; | 472 | retval = 0; |
478 | break; | 473 | break; |
@@ -504,9 +499,9 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, | |||
504 | return -ENOMEM; | 499 | return -ENOMEM; |
505 | 500 | ||
506 | if (buf_len && rndis_debug > 1) { | 501 | if (buf_len && rndis_debug > 1) { |
507 | DBG("set OID %08x value, len %d:\n", OID, buf_len); | 502 | pr_debug("set OID %08x value, len %d:\n", OID, buf_len); |
508 | for (i = 0; i < buf_len; i += 16) { | 503 | for (i = 0; i < buf_len; i += 16) { |
509 | DBG("%03d: %08x %08x %08x %08x\n", i, | 504 | pr_debug("%03d: %08x %08x %08x %08x\n", i, |
510 | get_unaligned_le32(&buf[i]), | 505 | get_unaligned_le32(&buf[i]), |
511 | get_unaligned_le32(&buf[i + 4]), | 506 | get_unaligned_le32(&buf[i + 4]), |
512 | get_unaligned_le32(&buf[i + 8]), | 507 | get_unaligned_le32(&buf[i + 8]), |
@@ -525,7 +520,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, | |||
525 | * MULTICAST, ALL_MULTICAST, BROADCAST | 520 | * MULTICAST, ALL_MULTICAST, BROADCAST |
526 | */ | 521 | */ |
527 | *params->filter = (u16)get_unaligned_le32(buf); | 522 | *params->filter = (u16)get_unaligned_le32(buf); |
528 | DBG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", | 523 | pr_debug("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", |
529 | __func__, *params->filter); | 524 | __func__, *params->filter); |
530 | 525 | ||
531 | /* this call has a significant side effect: it's | 526 | /* this call has a significant side effect: it's |
@@ -547,7 +542,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, | |||
547 | 542 | ||
548 | case OID_802_3_MULTICAST_LIST: | 543 | case OID_802_3_MULTICAST_LIST: |
549 | /* I think we can ignore this */ | 544 | /* I think we can ignore this */ |
550 | DBG("%s: OID_802_3_MULTICAST_LIST\n", __func__); | 545 | pr_debug("%s: OID_802_3_MULTICAST_LIST\n", __func__); |
551 | retval = 0; | 546 | retval = 0; |
552 | break; | 547 | break; |
553 | 548 | ||
@@ -606,7 +601,7 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf) | |||
606 | rndis_resp_t *r; | 601 | rndis_resp_t *r; |
607 | struct rndis_params *params = rndis_per_dev_params + configNr; | 602 | struct rndis_params *params = rndis_per_dev_params + configNr; |
608 | 603 | ||
609 | // DBG("%s: OID = %08X\n", __func__, cpu_to_le32(buf->OID)); | 604 | /* pr_debug("%s: OID = %08X\n", __func__, cpu_to_le32(buf->OID)); */ |
610 | if (!params->dev) | 605 | if (!params->dev) |
611 | return -ENOTSUPP; | 606 | return -ENOTSUPP; |
612 | 607 | ||
@@ -659,15 +654,15 @@ static int rndis_set_response (int configNr, rndis_set_msg_type *buf) | |||
659 | BufOffset = le32_to_cpu (buf->InformationBufferOffset); | 654 | BufOffset = le32_to_cpu (buf->InformationBufferOffset); |
660 | 655 | ||
661 | #ifdef VERBOSE_DEBUG | 656 | #ifdef VERBOSE_DEBUG |
662 | DBG("%s: Length: %d\n", __func__, BufLength); | 657 | pr_debug("%s: Length: %d\n", __func__, BufLength); |
663 | DBG("%s: Offset: %d\n", __func__, BufOffset); | 658 | pr_debug("%s: Offset: %d\n", __func__, BufOffset); |
664 | DBG("%s: InfoBuffer: ", __func__); | 659 | pr_debug("%s: InfoBuffer: ", __func__); |
665 | 660 | ||
666 | for (i = 0; i < BufLength; i++) { | 661 | for (i = 0; i < BufLength; i++) { |
667 | DBG("%02x ", *(((u8 *) buf) + i + 8 + BufOffset)); | 662 | pr_debug("%02x ", *(((u8 *) buf) + i + 8 + BufOffset)); |
668 | } | 663 | } |
669 | 664 | ||
670 | DBG("\n"); | 665 | pr_debug("\n"); |
671 | #endif | 666 | #endif |
672 | 667 | ||
673 | resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT); | 668 | resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT); |
@@ -821,14 +816,14 @@ int rndis_msg_parser (u8 configNr, u8 *buf) | |||
821 | /* For USB: responses may take up to 10 seconds */ | 816 | /* For USB: responses may take up to 10 seconds */ |
822 | switch (MsgType) { | 817 | switch (MsgType) { |
823 | case REMOTE_NDIS_INITIALIZE_MSG: | 818 | case REMOTE_NDIS_INITIALIZE_MSG: |
824 | DBG("%s: REMOTE_NDIS_INITIALIZE_MSG\n", | 819 | pr_debug("%s: REMOTE_NDIS_INITIALIZE_MSG\n", |
825 | __func__ ); | 820 | __func__ ); |
826 | params->state = RNDIS_INITIALIZED; | 821 | params->state = RNDIS_INITIALIZED; |
827 | return rndis_init_response (configNr, | 822 | return rndis_init_response (configNr, |
828 | (rndis_init_msg_type *) buf); | 823 | (rndis_init_msg_type *) buf); |
829 | 824 | ||
830 | case REMOTE_NDIS_HALT_MSG: | 825 | case REMOTE_NDIS_HALT_MSG: |
831 | DBG("%s: REMOTE_NDIS_HALT_MSG\n", | 826 | pr_debug("%s: REMOTE_NDIS_HALT_MSG\n", |
832 | __func__ ); | 827 | __func__ ); |
833 | params->state = RNDIS_UNINITIALIZED; | 828 | params->state = RNDIS_UNINITIALIZED; |
834 | if (params->dev) { | 829 | if (params->dev) { |
@@ -846,7 +841,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf) | |||
846 | (rndis_set_msg_type *) buf); | 841 | (rndis_set_msg_type *) buf); |
847 | 842 | ||
848 | case REMOTE_NDIS_RESET_MSG: | 843 | case REMOTE_NDIS_RESET_MSG: |
849 | DBG("%s: REMOTE_NDIS_RESET_MSG\n", | 844 | pr_debug("%s: REMOTE_NDIS_RESET_MSG\n", |
850 | __func__ ); | 845 | __func__ ); |
851 | return rndis_reset_response (configNr, | 846 | return rndis_reset_response (configNr, |
852 | (rndis_reset_msg_type *) buf); | 847 | (rndis_reset_msg_type *) buf); |
@@ -854,7 +849,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf) | |||
854 | case REMOTE_NDIS_KEEPALIVE_MSG: | 849 | case REMOTE_NDIS_KEEPALIVE_MSG: |
855 | /* For USB: host does this every 5 seconds */ | 850 | /* For USB: host does this every 5 seconds */ |
856 | if (rndis_debug > 1) | 851 | if (rndis_debug > 1) |
857 | DBG("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", | 852 | pr_debug("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", |
858 | __func__ ); | 853 | __func__ ); |
859 | return rndis_keepalive_response (configNr, | 854 | return rndis_keepalive_response (configNr, |
860 | (rndis_keepalive_msg_type *) | 855 | (rndis_keepalive_msg_type *) |
@@ -870,7 +865,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf) | |||
870 | { | 865 | { |
871 | unsigned i; | 866 | unsigned i; |
872 | for (i = 0; i < MsgLength; i += 16) { | 867 | for (i = 0; i < MsgLength; i += 16) { |
873 | DBG("%03d: " | 868 | pr_debug("%03d: " |
874 | " %02x %02x %02x %02x" | 869 | " %02x %02x %02x %02x" |
875 | " %02x %02x %02x %02x" | 870 | " %02x %02x %02x %02x" |
876 | " %02x %02x %02x %02x" | 871 | " %02x %02x %02x %02x" |
@@ -905,18 +900,18 @@ int rndis_register(void (*resp_avail)(void *v), void *v) | |||
905 | rndis_per_dev_params [i].used = 1; | 900 | rndis_per_dev_params [i].used = 1; |
906 | rndis_per_dev_params [i].resp_avail = resp_avail; | 901 | rndis_per_dev_params [i].resp_avail = resp_avail; |
907 | rndis_per_dev_params [i].v = v; | 902 | rndis_per_dev_params [i].v = v; |
908 | DBG("%s: configNr = %d\n", __func__, i); | 903 | pr_debug("%s: configNr = %d\n", __func__, i); |
909 | return i; | 904 | return i; |
910 | } | 905 | } |
911 | } | 906 | } |
912 | DBG("failed\n"); | 907 | pr_debug("failed\n"); |
913 | 908 | ||
914 | return -ENODEV; | 909 | return -ENODEV; |
915 | } | 910 | } |
916 | 911 | ||
917 | void rndis_deregister (int configNr) | 912 | void rndis_deregister (int configNr) |
918 | { | 913 | { |
919 | DBG("%s: \n", __func__ ); | 914 | pr_debug("%s: \n", __func__); |
920 | 915 | ||
921 | if (configNr >= RNDIS_MAX_CONFIGS) return; | 916 | if (configNr >= RNDIS_MAX_CONFIGS) return; |
922 | rndis_per_dev_params [configNr].used = 0; | 917 | rndis_per_dev_params [configNr].used = 0; |
@@ -926,7 +921,7 @@ void rndis_deregister (int configNr) | |||
926 | 921 | ||
927 | int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter) | 922 | int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter) |
928 | { | 923 | { |
929 | DBG("%s:\n", __func__ ); | 924 | pr_debug("%s:\n", __func__); |
930 | if (!dev) | 925 | if (!dev) |
931 | return -EINVAL; | 926 | return -EINVAL; |
932 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; | 927 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; |
@@ -939,7 +934,7 @@ int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter) | |||
939 | 934 | ||
940 | int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr) | 935 | int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr) |
941 | { | 936 | { |
942 | DBG("%s:\n", __func__ ); | 937 | pr_debug("%s:\n", __func__); |
943 | if (!vendorDescr) return -1; | 938 | if (!vendorDescr) return -1; |
944 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; | 939 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; |
945 | 940 | ||
@@ -951,7 +946,7 @@ int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr) | |||
951 | 946 | ||
952 | int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed) | 947 | int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed) |
953 | { | 948 | { |
954 | DBG("%s: %u %u\n", __func__, medium, speed); | 949 | pr_debug("%s: %u %u\n", __func__, medium, speed); |
955 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; | 950 | if (configNr >= RNDIS_MAX_CONFIGS) return -1; |
956 | 951 | ||
957 | rndis_per_dev_params [configNr].medium = medium; | 952 | rndis_per_dev_params [configNr].medium = medium; |
@@ -1114,7 +1109,7 @@ static ssize_t rndis_proc_write(struct file *file, const char __user *buffer, | |||
1114 | break; | 1109 | break; |
1115 | default: | 1110 | default: |
1116 | if (fl_speed) p->speed = speed; | 1111 | if (fl_speed) p->speed = speed; |
1117 | else DBG("%c is not valid\n", c); | 1112 | else pr_debug("%c is not valid\n", c); |
1118 | break; | 1113 | break; |
1119 | } | 1114 | } |
1120 | 1115 | ||
@@ -1159,12 +1154,12 @@ int __init rndis_init (void) | |||
1159 | &rndis_proc_fops, | 1154 | &rndis_proc_fops, |
1160 | (void *)(rndis_per_dev_params + i)))) | 1155 | (void *)(rndis_per_dev_params + i)))) |
1161 | { | 1156 | { |
1162 | DBG("%s :remove entries", __func__); | 1157 | pr_debug("%s :remove entries", __func__); |
1163 | while (i) { | 1158 | while (i) { |
1164 | sprintf (name, NAME_TEMPLATE, --i); | 1159 | sprintf (name, NAME_TEMPLATE, --i); |
1165 | remove_proc_entry (name, NULL); | 1160 | remove_proc_entry (name, NULL); |
1166 | } | 1161 | } |
1167 | DBG("\n"); | 1162 | pr_debug("\n"); |
1168 | return -EIO; | 1163 | return -EIO; |
1169 | } | 1164 | } |
1170 | #endif | 1165 | #endif |