2 * Copyright (C) 2003-2008 Takahiro Hirofuchi
4 * This is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 #include <asm/byteorder.h>
21 #include <linux/file.h>
23 #include <linux/kernel.h>
24 #include <linux/slab.h>
27 #include "usbip_common.h"
29 #define DRIVER_AUTHOR "Takahiro Hirofuchi <hirofuchi@users.sourceforge.net>"
30 #define DRIVER_DESC "USB/IP Core"
32 #ifdef CONFIG_USBIP_DEBUG
33 unsigned long usbip_debug_flag
= 0xffffffff;
35 unsigned long usbip_debug_flag
;
37 EXPORT_SYMBOL_GPL(usbip_debug_flag
);
40 struct device_attribute dev_attr_usbip_debug
;
41 EXPORT_SYMBOL_GPL(dev_attr_usbip_debug
);
43 static ssize_t
show_flag(struct device
*dev
, struct device_attribute
*attr
,
46 return sprintf(buf
, "%lx\n", usbip_debug_flag
);
49 static ssize_t
store_flag(struct device
*dev
, struct device_attribute
*attr
,
50 const char *buf
, size_t count
)
52 sscanf(buf
, "%lx", &usbip_debug_flag
);
55 DEVICE_ATTR(usbip_debug
, (S_IRUGO
| S_IWUSR
), show_flag
, store_flag
);
57 static void usbip_dump_buffer(char *buff
, int bufflen
)
59 print_hex_dump(KERN_DEBUG
, "usbip-core", DUMP_PREFIX_OFFSET
, 16, 4,
60 buff
, bufflen
, false);
63 static void usbip_dump_pipe(unsigned int p
)
65 unsigned char type
= usb_pipetype(p
);
66 unsigned char ep
= usb_pipeendpoint(p
);
67 unsigned char dev
= usb_pipedevice(p
);
68 unsigned char dir
= usb_pipein(p
);
70 pr_debug("dev(%d) ep(%d) [%s] ", dev
, ep
, dir
? "IN" : "OUT");
73 case PIPE_ISOCHRONOUS
:
91 static void usbip_dump_usb_device(struct usb_device
*udev
)
93 struct device
*dev
= &udev
->dev
;
96 dev_dbg(dev
, " devnum(%d) devpath(%s) ",
97 udev
->devnum
, udev
->devpath
);
99 switch (udev
->speed
) {
101 pr_debug("SPD_HIGH ");
104 pr_debug("SPD_FULL ");
107 pr_debug("SPD_LOW ");
109 case USB_SPEED_UNKNOWN
:
110 pr_debug("SPD_UNKNOWN ");
113 pr_debug("SPD_ERROR ");
117 pr_debug("tt %p, ttport %d\n", udev
->tt
, udev
->ttport
);
120 for (i
= 0; i
< 16; i
++)
124 dev_dbg(dev
, " toggle0(IN) :");
125 for (i
= 0; i
< 16; i
++)
126 pr_debug(" %2u", (udev
->toggle
[0] & (1 << i
)) ? 1 : 0);
129 dev_dbg(dev
, " toggle1(OUT):");
130 for (i
= 0; i
< 16; i
++)
131 pr_debug(" %2u", (udev
->toggle
[1] & (1 << i
)) ? 1 : 0);
134 dev_dbg(dev
, " epmaxp_in :");
135 for (i
= 0; i
< 16; i
++) {
138 le16_to_cpu(udev
->ep_in
[i
]->desc
.wMaxPacketSize
));
142 dev_dbg(dev
, " epmaxp_out :");
143 for (i
= 0; i
< 16; i
++) {
146 le16_to_cpu(udev
->ep_out
[i
]->desc
.wMaxPacketSize
));
150 dev_dbg(dev
, "parent %p, bus %p\n", udev
->parent
, udev
->bus
);
152 dev_dbg(dev
, "descriptor %p, config %p, actconfig %p, "
153 "rawdescriptors %p\n", &udev
->descriptor
, udev
->config
,
154 udev
->actconfig
, udev
->rawdescriptors
);
156 dev_dbg(dev
, "have_langid %d, string_langid %d\n",
157 udev
->have_langid
, udev
->string_langid
);
159 dev_dbg(dev
, "maxchild %d, children %p\n",
160 udev
->maxchild
, udev
->children
);
163 static void usbip_dump_request_type(__u8 rt
)
165 switch (rt
& USB_RECIP_MASK
) {
166 case USB_RECIP_DEVICE
:
169 case USB_RECIP_INTERFACE
:
172 case USB_RECIP_ENDPOINT
:
175 case USB_RECIP_OTHER
:
184 static void usbip_dump_usb_ctrlrequest(struct usb_ctrlrequest
*cmd
)
187 pr_debug(" : null pointer\n");
192 pr_debug("bRequestType(%02X) bRequest(%02X) wValue(%04X) wIndex(%04X) "
193 "wLength(%04X) ", cmd
->bRequestType
, cmd
->bRequest
,
194 cmd
->wValue
, cmd
->wIndex
, cmd
->wLength
);
197 if ((cmd
->bRequestType
& USB_TYPE_MASK
) == USB_TYPE_STANDARD
) {
198 pr_debug("STANDARD ");
199 switch (cmd
->bRequest
) {
200 case USB_REQ_GET_STATUS
:
201 pr_debug("GET_STATUS\n");
203 case USB_REQ_CLEAR_FEATURE
:
204 pr_debug("CLEAR_FEAT\n");
206 case USB_REQ_SET_FEATURE
:
207 pr_debug("SET_FEAT\n");
209 case USB_REQ_SET_ADDRESS
:
210 pr_debug("SET_ADDRRS\n");
212 case USB_REQ_GET_DESCRIPTOR
:
213 pr_debug("GET_DESCRI\n");
215 case USB_REQ_SET_DESCRIPTOR
:
216 pr_debug("SET_DESCRI\n");
218 case USB_REQ_GET_CONFIGURATION
:
219 pr_debug("GET_CONFIG\n");
221 case USB_REQ_SET_CONFIGURATION
:
222 pr_debug("SET_CONFIG\n");
224 case USB_REQ_GET_INTERFACE
:
225 pr_debug("GET_INTERF\n");
227 case USB_REQ_SET_INTERFACE
:
228 pr_debug("SET_INTERF\n");
230 case USB_REQ_SYNCH_FRAME
:
231 pr_debug("SYNC_FRAME\n");
234 pr_debug("REQ(%02X)\n", cmd
->bRequest
);
237 usbip_dump_request_type(cmd
->bRequestType
);
238 } else if ((cmd
->bRequestType
& USB_TYPE_MASK
) == USB_TYPE_CLASS
) {
240 } else if ((cmd
->bRequestType
& USB_TYPE_MASK
) == USB_TYPE_VENDOR
) {
241 pr_debug("VENDOR\n");
242 } else if ((cmd
->bRequestType
& USB_TYPE_MASK
) == USB_TYPE_RESERVED
) {
243 pr_debug("RESERVED\n");
247 void usbip_dump_urb(struct urb
*urb
)
252 pr_debug("urb: null pointer!!\n");
257 pr_debug("urb->dev: null pointer!!\n");
261 dev
= &urb
->dev
->dev
;
263 dev_dbg(dev
, " urb :%p\n", urb
);
264 dev_dbg(dev
, " dev :%p\n", urb
->dev
);
266 usbip_dump_usb_device(urb
->dev
);
268 dev_dbg(dev
, " pipe :%08x ", urb
->pipe
);
270 usbip_dump_pipe(urb
->pipe
);
272 dev_dbg(dev
, " status :%d\n", urb
->status
);
273 dev_dbg(dev
, " transfer_flags :%08X\n", urb
->transfer_flags
);
274 dev_dbg(dev
, " transfer_buffer :%p\n", urb
->transfer_buffer
);
275 dev_dbg(dev
, " transfer_buffer_length:%d\n",
276 urb
->transfer_buffer_length
);
277 dev_dbg(dev
, " actual_length :%d\n", urb
->actual_length
);
278 dev_dbg(dev
, " setup_packet :%p\n", urb
->setup_packet
);
280 if (urb
->setup_packet
&& usb_pipetype(urb
->pipe
) == PIPE_CONTROL
)
281 usbip_dump_usb_ctrlrequest(
282 (struct usb_ctrlrequest
*)urb
->setup_packet
);
284 dev_dbg(dev
, " start_frame :%d\n", urb
->start_frame
);
285 dev_dbg(dev
, " number_of_packets :%d\n", urb
->number_of_packets
);
286 dev_dbg(dev
, " interval :%d\n", urb
->interval
);
287 dev_dbg(dev
, " error_count :%d\n", urb
->error_count
);
288 dev_dbg(dev
, " context :%p\n", urb
->context
);
289 dev_dbg(dev
, " complete :%p\n", urb
->complete
);
291 EXPORT_SYMBOL_GPL(usbip_dump_urb
);
293 void usbip_dump_header(struct usbip_header
*pdu
)
295 pr_debug("BASE: cmd %u seq %u devid %u dir %u ep %u\n",
302 switch (pdu
->base
.command
) {
303 case USBIP_CMD_SUBMIT
:
304 pr_debug("USBIP_CMD_SUBMIT: "
305 "x_flags %u x_len %u sf %u #p %d iv %d\n",
306 pdu
->u
.cmd_submit
.transfer_flags
,
307 pdu
->u
.cmd_submit
.transfer_buffer_length
,
308 pdu
->u
.cmd_submit
.start_frame
,
309 pdu
->u
.cmd_submit
.number_of_packets
,
310 pdu
->u
.cmd_submit
.interval
);
312 case USBIP_CMD_UNLINK
:
313 pr_debug("USBIP_CMD_UNLINK: seq %u\n",
314 pdu
->u
.cmd_unlink
.seqnum
);
316 case USBIP_RET_SUBMIT
:
317 pr_debug("USBIP_RET_SUBMIT: st %d al %u sf %d #p %d ec %d\n",
318 pdu
->u
.ret_submit
.status
,
319 pdu
->u
.ret_submit
.actual_length
,
320 pdu
->u
.ret_submit
.start_frame
,
321 pdu
->u
.ret_submit
.number_of_packets
,
322 pdu
->u
.ret_submit
.error_count
);
324 case USBIP_RET_UNLINK
:
325 pr_debug("USBIP_RET_UNLINK: status %d\n",
326 pdu
->u
.ret_unlink
.status
);
330 pr_err("unknown command\n");
334 EXPORT_SYMBOL_GPL(usbip_dump_header
);
336 /* Send/receive messages over TCP/IP. I refer drivers/block/nbd.c */
337 int usbip_xmit(int send
, struct socket
*sock
, char *buf
, int size
,
345 /* for blocks of if (usbip_dbg_flag_xmit) */
349 usbip_dbg_xmit("enter\n");
351 if (!sock
|| !buf
|| !size
) {
352 pr_err("invalid arg, sock %p buff %p size %d\n", sock
, buf
,
357 if (usbip_dbg_flag_xmit
) {
360 pr_debug("%-10s:", current
->comm
);
362 pr_debug("interrupt :");
364 pr_debug("sending... , sock %p, buf %p, size %d, "
365 "msg_flags %d\n", sock
, buf
, size
, msg_flags
);
366 usbip_dump_buffer(buf
, size
);
371 sock
->sk
->sk_allocation
= GFP_NOIO
;
376 msg
.msg_control
= NULL
;
377 msg
.msg_controllen
= 0;
379 msg
.msg_flags
= msg_flags
| MSG_NOSIGNAL
;
382 result
= kernel_sendmsg(sock
, &msg
, &iov
, 1, size
);
384 result
= kernel_recvmsg(sock
, &msg
, &iov
, 1, size
,
388 pr_debug("%s sock %p buf %p size %u ret %d total %d\n",
389 send
? "send" : "receive", sock
, buf
, size
,
400 if (usbip_dbg_flag_xmit
) {
403 pr_debug("%-10s:", current
->comm
);
405 pr_debug("interrupt :");
407 pr_debug("receiving....\n");
408 usbip_dump_buffer(bp
, osize
);
409 pr_debug("received, osize %d ret %d size %d total %d\n",
410 osize
, result
, size
, total
);
414 pr_debug("send, total %d\n", total
);
422 EXPORT_SYMBOL_GPL(usbip_xmit
);
424 struct socket
*sockfd_to_socket(unsigned int sockfd
)
426 struct socket
*socket
;
432 pr_err("invalid sockfd\n");
436 inode
= file
->f_dentry
->d_inode
;
438 if (!inode
|| !S_ISSOCK(inode
->i_mode
))
441 socket
= SOCKET_I(inode
);
445 EXPORT_SYMBOL_GPL(sockfd_to_socket
);
447 /* there may be more cases to tweak the flags. */
448 static unsigned int tweak_transfer_flags(unsigned int flags
)
450 flags
&= ~URB_NO_TRANSFER_DMA_MAP
;
454 static void usbip_pack_cmd_submit(struct usbip_header
*pdu
, struct urb
*urb
,
457 struct usbip_header_cmd_submit
*spdu
= &pdu
->u
.cmd_submit
;
460 * Some members are not still implemented in usbip. I hope this issue
461 * will be discussed when usbip is ported to other operating systems.
465 spdu
->transfer_flags
=
466 tweak_transfer_flags(urb
->transfer_flags
);
467 spdu
->transfer_buffer_length
= urb
->transfer_buffer_length
;
468 spdu
->start_frame
= urb
->start_frame
;
469 spdu
->number_of_packets
= urb
->number_of_packets
;
470 spdu
->interval
= urb
->interval
;
473 urb
->transfer_flags
= spdu
->transfer_flags
;
475 urb
->transfer_buffer_length
= spdu
->transfer_buffer_length
;
476 urb
->start_frame
= spdu
->start_frame
;
477 urb
->number_of_packets
= spdu
->number_of_packets
;
478 urb
->interval
= spdu
->interval
;
482 static void usbip_pack_ret_submit(struct usbip_header
*pdu
, struct urb
*urb
,
485 struct usbip_header_ret_submit
*rpdu
= &pdu
->u
.ret_submit
;
490 rpdu
->status
= urb
->status
;
491 rpdu
->actual_length
= urb
->actual_length
;
492 rpdu
->start_frame
= urb
->start_frame
;
493 rpdu
->number_of_packets
= urb
->number_of_packets
;
494 rpdu
->error_count
= urb
->error_count
;
498 urb
->status
= rpdu
->status
;
499 urb
->actual_length
= rpdu
->actual_length
;
500 urb
->start_frame
= rpdu
->start_frame
;
501 urb
->number_of_packets
= rpdu
->number_of_packets
;
502 urb
->error_count
= rpdu
->error_count
;
506 void usbip_pack_pdu(struct usbip_header
*pdu
, struct urb
*urb
, int cmd
,
510 case USBIP_CMD_SUBMIT
:
511 usbip_pack_cmd_submit(pdu
, urb
, pack
);
513 case USBIP_RET_SUBMIT
:
514 usbip_pack_ret_submit(pdu
, urb
, pack
);
518 pr_err("unknown command\n");
522 EXPORT_SYMBOL_GPL(usbip_pack_pdu
);
524 static void correct_endian_basic(struct usbip_header_basic
*base
, int send
)
527 base
->command
= cpu_to_be32(base
->command
);
528 base
->seqnum
= cpu_to_be32(base
->seqnum
);
529 base
->devid
= cpu_to_be32(base
->devid
);
530 base
->direction
= cpu_to_be32(base
->direction
);
531 base
->ep
= cpu_to_be32(base
->ep
);
533 base
->command
= be32_to_cpu(base
->command
);
534 base
->seqnum
= be32_to_cpu(base
->seqnum
);
535 base
->devid
= be32_to_cpu(base
->devid
);
536 base
->direction
= be32_to_cpu(base
->direction
);
537 base
->ep
= be32_to_cpu(base
->ep
);
541 static void correct_endian_cmd_submit(struct usbip_header_cmd_submit
*pdu
,
545 pdu
->transfer_flags
= cpu_to_be32(pdu
->transfer_flags
);
547 cpu_to_be32s(&pdu
->transfer_buffer_length
);
548 cpu_to_be32s(&pdu
->start_frame
);
549 cpu_to_be32s(&pdu
->number_of_packets
);
550 cpu_to_be32s(&pdu
->interval
);
552 pdu
->transfer_flags
= be32_to_cpu(pdu
->transfer_flags
);
554 be32_to_cpus(&pdu
->transfer_buffer_length
);
555 be32_to_cpus(&pdu
->start_frame
);
556 be32_to_cpus(&pdu
->number_of_packets
);
557 be32_to_cpus(&pdu
->interval
);
561 static void correct_endian_ret_submit(struct usbip_header_ret_submit
*pdu
,
565 cpu_to_be32s(&pdu
->status
);
566 cpu_to_be32s(&pdu
->actual_length
);
567 cpu_to_be32s(&pdu
->start_frame
);
568 cpu_to_be32s(&pdu
->number_of_packets
);
569 cpu_to_be32s(&pdu
->error_count
);
571 be32_to_cpus(&pdu
->status
);
572 be32_to_cpus(&pdu
->actual_length
);
573 be32_to_cpus(&pdu
->start_frame
);
574 be32_to_cpus(&pdu
->number_of_packets
);
575 be32_to_cpus(&pdu
->error_count
);
579 static void correct_endian_cmd_unlink(struct usbip_header_cmd_unlink
*pdu
,
583 pdu
->seqnum
= cpu_to_be32(pdu
->seqnum
);
585 pdu
->seqnum
= be32_to_cpu(pdu
->seqnum
);
588 static void correct_endian_ret_unlink(struct usbip_header_ret_unlink
*pdu
,
592 cpu_to_be32s(&pdu
->status
);
594 be32_to_cpus(&pdu
->status
);
597 void usbip_header_correct_endian(struct usbip_header
*pdu
, int send
)
602 cmd
= pdu
->base
.command
;
604 correct_endian_basic(&pdu
->base
, send
);
607 cmd
= pdu
->base
.command
;
610 case USBIP_CMD_SUBMIT
:
611 correct_endian_cmd_submit(&pdu
->u
.cmd_submit
, send
);
613 case USBIP_RET_SUBMIT
:
614 correct_endian_ret_submit(&pdu
->u
.ret_submit
, send
);
616 case USBIP_CMD_UNLINK
:
617 correct_endian_cmd_unlink(&pdu
->u
.cmd_unlink
, send
);
619 case USBIP_RET_UNLINK
:
620 correct_endian_ret_unlink(&pdu
->u
.ret_unlink
, send
);
624 pr_err("unknown command\n");
628 EXPORT_SYMBOL_GPL(usbip_header_correct_endian
);
630 static void usbip_iso_packet_correct_endian(
631 struct usbip_iso_packet_descriptor
*iso
, int send
)
633 /* does not need all members. but copy all simply. */
635 iso
->offset
= cpu_to_be32(iso
->offset
);
636 iso
->length
= cpu_to_be32(iso
->length
);
637 iso
->status
= cpu_to_be32(iso
->status
);
638 iso
->actual_length
= cpu_to_be32(iso
->actual_length
);
640 iso
->offset
= be32_to_cpu(iso
->offset
);
641 iso
->length
= be32_to_cpu(iso
->length
);
642 iso
->status
= be32_to_cpu(iso
->status
);
643 iso
->actual_length
= be32_to_cpu(iso
->actual_length
);
647 static void usbip_pack_iso(struct usbip_iso_packet_descriptor
*iso
,
648 struct usb_iso_packet_descriptor
*uiso
, int pack
)
651 iso
->offset
= uiso
->offset
;
652 iso
->length
= uiso
->length
;
653 iso
->status
= uiso
->status
;
654 iso
->actual_length
= uiso
->actual_length
;
656 uiso
->offset
= iso
->offset
;
657 uiso
->length
= iso
->length
;
658 uiso
->status
= iso
->status
;
659 uiso
->actual_length
= iso
->actual_length
;
663 /* must free buffer */
664 void *usbip_alloc_iso_desc_pdu(struct urb
*urb
, ssize_t
*bufflen
)
667 struct usbip_iso_packet_descriptor
*iso
;
668 int np
= urb
->number_of_packets
;
669 ssize_t size
= np
* sizeof(*iso
);
672 buff
= kzalloc(size
, GFP_KERNEL
);
676 for (i
= 0; i
< np
; i
++) {
677 iso
= buff
+ (i
* sizeof(*iso
));
679 usbip_pack_iso(iso
, &urb
->iso_frame_desc
[i
], 1);
680 usbip_iso_packet_correct_endian(iso
, 1);
687 EXPORT_SYMBOL_GPL(usbip_alloc_iso_desc_pdu
);
689 /* some members of urb must be substituted before. */
690 int usbip_recv_iso(struct usbip_device
*ud
, struct urb
*urb
)
693 struct usbip_iso_packet_descriptor
*iso
;
694 int np
= urb
->number_of_packets
;
695 int size
= np
* sizeof(*iso
);
698 int total_length
= 0;
700 if (!usb_pipeisoc(urb
->pipe
))
703 /* my Bluetooth dongle gets ISO URBs which are np = 0 */
705 /* pr_info("iso np == 0\n"); */
706 /* usbip_dump_urb(urb); */
710 buff
= kzalloc(size
, GFP_KERNEL
);
714 ret
= usbip_xmit(0, ud
->tcp_socket
, buff
, size
, 0);
716 dev_err(&urb
->dev
->dev
, "recv iso_frame_descriptor, %d\n",
720 if (ud
->side
== USBIP_STUB
)
721 usbip_event_add(ud
, SDEV_EVENT_ERROR_TCP
);
723 usbip_event_add(ud
, VDEV_EVENT_ERROR_TCP
);
728 for (i
= 0; i
< np
; i
++) {
729 iso
= buff
+ (i
* sizeof(*iso
));
731 usbip_iso_packet_correct_endian(iso
, 0);
732 usbip_pack_iso(iso
, &urb
->iso_frame_desc
[i
], 0);
733 total_length
+= urb
->iso_frame_desc
[i
].actual_length
;
738 if (total_length
!= urb
->actual_length
) {
739 dev_err(&urb
->dev
->dev
,
740 "total length of iso packets %d not equal to actual "
741 "length of buffer %d\n",
742 total_length
, urb
->actual_length
);
744 if (ud
->side
== USBIP_STUB
)
745 usbip_event_add(ud
, SDEV_EVENT_ERROR_TCP
);
747 usbip_event_add(ud
, VDEV_EVENT_ERROR_TCP
);
754 EXPORT_SYMBOL_GPL(usbip_recv_iso
);
757 * This functions restores the padding which was removed for optimizing
758 * the bandwidth during transfer over tcp/ip
760 * buffer and iso packets need to be stored and be in propeper endian in urb
761 * before calling this function
763 int usbip_pad_iso(struct usbip_device
*ud
, struct urb
*urb
)
765 int np
= urb
->number_of_packets
;
768 int actualoffset
= urb
->actual_length
;
770 if (!usb_pipeisoc(urb
->pipe
))
773 /* if no packets or length of data is 0, then nothing to unpack */
774 if (np
== 0 || urb
->actual_length
== 0)
778 * if actual_length is transfer_buffer_length then no padding is
781 if (urb
->actual_length
== urb
->transfer_buffer_length
)
785 * loop over all packets from last to first (to prevent overwritting
786 * memory when padding) and move them into the proper place
788 for (i
= np
-1; i
> 0; i
--) {
789 actualoffset
-= urb
->iso_frame_desc
[i
].actual_length
;
790 memmove(urb
->transfer_buffer
+ urb
->iso_frame_desc
[i
].offset
,
791 urb
->transfer_buffer
+ actualoffset
,
792 urb
->iso_frame_desc
[i
].actual_length
);
797 EXPORT_SYMBOL_GPL(usbip_pad_iso
);
799 /* some members of urb must be substituted before. */
800 int usbip_recv_xbuff(struct usbip_device
*ud
, struct urb
*urb
)
805 if (ud
->side
== USBIP_STUB
) {
807 /* the direction of urb must be OUT. */
808 if (usb_pipein(urb
->pipe
))
811 size
= urb
->transfer_buffer_length
;
814 /* the direction of urb must be IN. */
815 if (usb_pipeout(urb
->pipe
))
818 size
= urb
->actual_length
;
821 /* no need to recv xbuff */
825 ret
= usbip_xmit(0, ud
->tcp_socket
, (char *)urb
->transfer_buffer
,
828 dev_err(&urb
->dev
->dev
, "recv xbuf, %d\n", ret
);
829 if (ud
->side
== USBIP_STUB
) {
830 usbip_event_add(ud
, SDEV_EVENT_ERROR_TCP
);
832 usbip_event_add(ud
, VDEV_EVENT_ERROR_TCP
);
839 EXPORT_SYMBOL_GPL(usbip_recv_xbuff
);
841 static int __init
usbip_core_init(void)
843 pr_info(DRIVER_DESC
" v" USBIP_VERSION
"\n");
847 static void __exit
usbip_core_exit(void)
852 module_init(usbip_core_init
);
853 module_exit(usbip_core_exit
);
855 MODULE_AUTHOR(DRIVER_AUTHOR
);
856 MODULE_DESCRIPTION(DRIVER_DESC
);
857 MODULE_LICENSE("GPL");
858 MODULE_VERSION(USBIP_VERSION
);