^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2003-2008 Takahiro Hirofuchi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/kthread.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/socket.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/scatterlist.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "usbip_common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "stub.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /* be in spin_lock_irqsave(&sdev->priv_lock, flags) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) void stub_enqueue_ret_unlink(struct stub_device *sdev, __u32 seqnum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) __u32 status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct stub_unlink *unlink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unlink = kzalloc(sizeof(struct stub_unlink), GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) if (!unlink) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) usbip_event_add(&sdev->ud, VDEV_EVENT_ERROR_MALLOC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) unlink->seqnum = seqnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) unlink->status = status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) list_add_tail(&unlink->list, &sdev->unlink_tx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * stub_complete - completion handler of a usbip urb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * @urb: pointer to the urb completed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * When a urb has completed, the USB core driver calls this function mostly in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * the interrupt context. To return the result of a urb, the completed urb is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * linked to the pending list of returning.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void stub_complete(struct urb *urb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct stub_priv *priv = (struct stub_priv *) urb->context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct stub_device *sdev = priv->sdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) usbip_dbg_stub_tx("complete! status %d\n", urb->status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) switch (urb->status) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) case 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /* OK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) case -ENOENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) dev_info(&urb->dev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) "stopped by a call to usb_kill_urb() because of cleaning up a virtual connection\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) case -ECONNRESET:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) dev_info(&urb->dev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) "unlinked by a call to usb_unlink_urb()\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) case -EPIPE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) dev_info(&urb->dev->dev, "endpoint %d is stalled\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) usb_pipeendpoint(urb->pipe));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) case -ESHUTDOWN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) dev_info(&urb->dev->dev, "device removed?\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) dev_info(&urb->dev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) "urb completion with non-zero status %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) urb->status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * If the server breaks single SG request into the several URBs, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * URBs must be reassembled before sending completed URB to the vhci.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * Don't wake up the tx thread until all the URBs are completed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) if (priv->sgl) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) priv->completed_urbs++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /* Only save the first error status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) if (urb->status && !priv->urb_status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) priv->urb_status = urb->status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) if (priv->completed_urbs < priv->num_urbs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) /* link a urb to the queue of tx. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) spin_lock_irqsave(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) if (sdev->ud.tcp_socket == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) usbip_dbg_stub_tx("ignore urb for closed connection\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) /* It will be freed in stub_device_cleanup_urbs(). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) } else if (priv->unlinking) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) stub_enqueue_ret_unlink(sdev, priv->seqnum, urb->status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) stub_free_priv_and_urb(priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) list_move_tail(&priv->list, &sdev->priv_tx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) spin_unlock_irqrestore(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* wake up tx_thread */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) wake_up(&sdev->tx_waitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) static inline void setup_base_pdu(struct usbip_header_basic *base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) __u32 command, __u32 seqnum)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) base->command = command;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) base->seqnum = seqnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) base->devid = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) base->ep = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) base->direction = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static void setup_ret_submit_pdu(struct usbip_header *rpdu, struct urb *urb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct stub_priv *priv = (struct stub_priv *) urb->context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) setup_base_pdu(&rpdu->base, USBIP_RET_SUBMIT, priv->seqnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) usbip_pack_pdu(rpdu, urb, USBIP_RET_SUBMIT, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static void setup_ret_unlink_pdu(struct usbip_header *rpdu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) struct stub_unlink *unlink)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) setup_base_pdu(&rpdu->base, USBIP_RET_UNLINK, unlink->seqnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) rpdu->u.ret_unlink.status = unlink->status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) static struct stub_priv *dequeue_from_priv_tx(struct stub_device *sdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) struct stub_priv *priv, *tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) spin_lock_irqsave(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) list_for_each_entry_safe(priv, tmp, &sdev->priv_tx, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) list_move_tail(&priv->list, &sdev->priv_free);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) spin_unlock_irqrestore(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) return priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) spin_unlock_irqrestore(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static int stub_send_ret_submit(struct stub_device *sdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct stub_priv *priv, *tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) struct msghdr msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) size_t txsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) size_t total_size = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) while ((priv = dequeue_from_priv_tx(sdev)) != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) struct urb *urb = priv->urbs[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct usbip_header pdu_header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct usbip_iso_packet_descriptor *iso_buffer = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) struct kvec *iov = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct scatterlist *sg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) u32 actual_length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) int iovnum = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) txsize = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) memset(&pdu_header, 0, sizeof(pdu_header));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) memset(&msg, 0, sizeof(msg));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) if (urb->actual_length > 0 && !urb->transfer_buffer &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) !urb->num_sgs) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) dev_err(&sdev->udev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) "urb: actual_length %d transfer_buffer null\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) urb->actual_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) iovnum = 2 + urb->number_of_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) else if (usb_pipein(urb->pipe) && urb->actual_length > 0 &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) urb->num_sgs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) iovnum = 1 + urb->num_sgs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) else if (usb_pipein(urb->pipe) && priv->sgl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) iovnum = 1 + priv->num_urbs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) iovnum = 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) iov = kcalloc(iovnum, sizeof(struct kvec), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) if (!iov) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) usbip_event_add(&sdev->ud, SDEV_EVENT_ERROR_MALLOC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) iovnum = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) /* 1. setup usbip_header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) setup_ret_submit_pdu(&pdu_header, urb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) usbip_dbg_stub_tx("setup txdata seqnum: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) pdu_header.base.seqnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) if (priv->sgl) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) for (i = 0; i < priv->num_urbs; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) actual_length += priv->urbs[i]->actual_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) pdu_header.u.ret_submit.status = priv->urb_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) pdu_header.u.ret_submit.actual_length = actual_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) usbip_header_correct_endian(&pdu_header, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) iov[iovnum].iov_base = &pdu_header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) iov[iovnum].iov_len = sizeof(pdu_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) iovnum++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) txsize += sizeof(pdu_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) /* 2. setup transfer buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) if (usb_pipein(urb->pipe) && priv->sgl) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) /* If the server split a single SG request into several
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) * URBs because the server's HCD doesn't support SG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) * reassemble the split URB buffers into a single
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) * return command.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) for (i = 0; i < priv->num_urbs; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) iov[iovnum].iov_base =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) priv->urbs[i]->transfer_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) iov[iovnum].iov_len =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) priv->urbs[i]->actual_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) iovnum++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) txsize += actual_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) } else if (usb_pipein(urb->pipe) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) usb_pipetype(urb->pipe) != PIPE_ISOCHRONOUS &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) urb->actual_length > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) if (urb->num_sgs) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) unsigned int copy = urb->actual_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) for_each_sg(urb->sg, sg, urb->num_sgs, i) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) if (copy == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) if (copy < sg->length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) size = copy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) size = sg->length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) iov[iovnum].iov_base = sg_virt(sg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) iov[iovnum].iov_len = size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) iovnum++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) copy -= size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) iov[iovnum].iov_base = urb->transfer_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) iov[iovnum].iov_len = urb->actual_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) iovnum++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) txsize += urb->actual_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) } else if (usb_pipein(urb->pipe) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) * For isochronous packets: actual length is the sum of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * the actual length of the individual, packets, but as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * the packet offsets are not changed there will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * padding between the packets. To optimally use the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) * bandwidth the padding is not transmitted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) for (i = 0; i < urb->number_of_packets; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) iov[iovnum].iov_base = urb->transfer_buffer +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) urb->iso_frame_desc[i].offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) iov[iovnum].iov_len =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) urb->iso_frame_desc[i].actual_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) iovnum++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) txsize += urb->iso_frame_desc[i].actual_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) if (txsize != sizeof(pdu_header) + urb->actual_length) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) dev_err(&sdev->udev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) "actual length of urb %d does not match iso packet sizes %zu\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) urb->actual_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) txsize-sizeof(pdu_header));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) kfree(iov);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) usbip_event_add(&sdev->ud,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) SDEV_EVENT_ERROR_TCP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) /* 3. setup iso_packet_descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) ssize_t len = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) iso_buffer = usbip_alloc_iso_desc_pdu(urb, &len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) if (!iso_buffer) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) usbip_event_add(&sdev->ud,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) SDEV_EVENT_ERROR_MALLOC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) kfree(iov);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) iov[iovnum].iov_base = iso_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) iov[iovnum].iov_len = len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) txsize += len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) iovnum++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) ret = kernel_sendmsg(sdev->ud.tcp_socket, &msg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) iov, iovnum, txsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) if (ret != txsize) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) dev_err(&sdev->udev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) "sendmsg failed!, retval %d for %zd\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) ret, txsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) kfree(iov);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) kfree(iso_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) usbip_event_add(&sdev->ud, SDEV_EVENT_ERROR_TCP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) kfree(iov);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) kfree(iso_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) total_size += txsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) spin_lock_irqsave(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) list_for_each_entry_safe(priv, tmp, &sdev->priv_free, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) stub_free_priv_and_urb(priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) spin_unlock_irqrestore(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) return total_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) static struct stub_unlink *dequeue_from_unlink_tx(struct stub_device *sdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) struct stub_unlink *unlink, *tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) spin_lock_irqsave(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) list_for_each_entry_safe(unlink, tmp, &sdev->unlink_tx, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) list_move_tail(&unlink->list, &sdev->unlink_free);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) spin_unlock_irqrestore(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) return unlink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) spin_unlock_irqrestore(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) static int stub_send_ret_unlink(struct stub_device *sdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) struct stub_unlink *unlink, *tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) struct msghdr msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) struct kvec iov[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) size_t txsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) size_t total_size = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) while ((unlink = dequeue_from_unlink_tx(sdev)) != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) struct usbip_header pdu_header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) txsize = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) memset(&pdu_header, 0, sizeof(pdu_header));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) memset(&msg, 0, sizeof(msg));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) memset(&iov, 0, sizeof(iov));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) usbip_dbg_stub_tx("setup ret unlink %lu\n", unlink->seqnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) /* 1. setup usbip_header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) setup_ret_unlink_pdu(&pdu_header, unlink);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) usbip_header_correct_endian(&pdu_header, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) iov[0].iov_base = &pdu_header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) iov[0].iov_len = sizeof(pdu_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) txsize += sizeof(pdu_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) ret = kernel_sendmsg(sdev->ud.tcp_socket, &msg, iov,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 1, txsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) if (ret != txsize) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) dev_err(&sdev->udev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) "sendmsg failed!, retval %d for %zd\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) ret, txsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) usbip_event_add(&sdev->ud, SDEV_EVENT_ERROR_TCP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) usbip_dbg_stub_tx("send txdata\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) total_size += txsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) spin_lock_irqsave(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) list_for_each_entry_safe(unlink, tmp, &sdev->unlink_free, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) list_del(&unlink->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) kfree(unlink);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) spin_unlock_irqrestore(&sdev->priv_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) return total_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) int stub_tx_loop(void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) struct usbip_device *ud = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) struct stub_device *sdev = container_of(ud, struct stub_device, ud);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) while (!kthread_should_stop()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) if (usbip_event_happened(ud))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) * send_ret_submit comes earlier than send_ret_unlink. stub_rx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) * looks at only priv_init queue. If the completion of a URB is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * earlier than the receive of CMD_UNLINK, priv is moved to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) * priv_tx queue and stub_rx does not find the target priv. In
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * this case, vhci_rx receives the result of the submit request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * and then receives the result of the unlink request. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * result of the submit is given back to the usbcore as the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * completion of the unlink request. The request of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * unlink is ignored. This is ok because a driver who calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) * usb_unlink_urb() understands the unlink was too late by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) * getting the status of the given-backed URB which has the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) * status of usb_submit_urb().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) if (stub_send_ret_submit(sdev) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) if (stub_send_ret_unlink(sdev) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) wait_event_interruptible(sdev->tx_waitq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) (!list_empty(&sdev->priv_tx) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) !list_empty(&sdev->unlink_tx) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) kthread_should_stop()));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) }