Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3576498ybi; Fri, 5 Jul 2019 09:48:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzdjpFbZ99d2s26d4Zd0NfBlSO6P0lixngHEwDQxEz+SI45zCwxH/Nhc6o0BDp9tlnU+V4 X-Received: by 2002:a17:90a:25c8:: with SMTP id k66mr6716604pje.129.1562345325533; Fri, 05 Jul 2019 09:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562345325; cv=none; d=google.com; s=arc-20160816; b=L0JEk46kLJuPWlBdnLvdFzz8eAWwAIWHQtL3+knJKYi/APpOGyuj7r3IuDcoZIa4/T tHdCgwwx5bb7/BsKRZitHpW765yDGyMsRwvZTzvBqob6RDwdF/RxOH40yl3Wm5BPBhHp 7D4YtMaIdkvrLYZr5P/6NMTFy1cBdjmd26Rt992aNA9ig+XaQ3YjxKJ6v5nZJCIa3DCC a1MBWX+rf6bDzL7PD2w4eL4LeBglzEyzRsjsjyaavMvKwbkl99ZO6j/eK8xMcVIaeiFg Axhxc8UXFP9XXl7aXm5GxpMrbKahg9xE+xW6V5+Uh3bwcs8OlTH6bYxVX9zPB47lOubN Z7lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sJeCNY3p/cFJV5YjbkNxBrOSN1fSG/Fhqmle0nH3XgU=; b=mpYBXG2wHfyRPkSGGMy1IUXX3US/sRlEfErcgZIea4yrFiVEwVp4T10YYtljhkO8hQ ZzCDuKxI1yTvIt0ADsA0ojf09tPjh07Fm0Pi54yHOFhRIwkFU2kjbj0RynK6HmC9bVxF 9iY/UYq3HRAwrygSX3kymo7NBqNxJcj5C8MLsZ7/anC9g430N+HnARDXgBrBc3GwCZYY d227htdlJSQ/vqfDf3oHpOx8AmF2au3NvEtgYmhiI4yP6tQ1UL5QUcJCGZCzsL9MvDBi 1GcQq2mY+LgQtmOE1noRiZGYH8f4TY9SVATyLTD+gKWwRtwqB87mFdWUJm7sokCLr7Jr rCGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="nejGd5n/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si4922198pjs.16.2019.07.05.09.48.30; Fri, 05 Jul 2019 09:48:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="nejGd5n/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726519AbfGEQoT (ORCPT + 99 others); Fri, 5 Jul 2019 12:44:19 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:46860 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725681AbfGEQoS (ORCPT ); Fri, 5 Jul 2019 12:44:18 -0400 Received: by mail-pl1-f195.google.com with SMTP id c2so3275599plz.13; Fri, 05 Jul 2019 09:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sJeCNY3p/cFJV5YjbkNxBrOSN1fSG/Fhqmle0nH3XgU=; b=nejGd5n/U2KC/Kjj4rnjP9Ocyey+yeGL2V2n9eNM74mJLE5Dtq4QX+0Dl6MFotYCqs WFFVzbcpq9H+UT1h7lReJDrCEimNiuR8Xi5cUbjzTh5lyCEFrmv2h/E0MiNloi9rX3GH e88Qcl172Jpn8nEaOvKfsKxIx8I3JLgeD4IBH5hRw0wG+JNvsw73/cZm5IvIOZileahD JGWM9+BeFbSKU/+dvubpvP7rtosuv7effagK9IU1LjpoGXPJAVf2pZB33Qv446jeGMi2 DnI7uUgUeJ34vAosDhNc6c9IXmPWypcfRGH/dkukuMV98krdhN4OuNk1d7be2Fu9F2Ra 2tiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sJeCNY3p/cFJV5YjbkNxBrOSN1fSG/Fhqmle0nH3XgU=; b=VPNZJAIYDk69MAauJCP6DzHqfF9Zo8pSq4fSOZFT9cPvcj7eRJ/XmlY+hHUKJESa0f FqRF8ilXXUZXdzJWGS9gTVJEh0fWmld2AcLBdDhf/ExHGZLyjKasmA+JImFw24WBBhEu 37p9Zpl7vKj7aUAXd4IQ6WbRU5Z+O4Taf9JN+jvB/lx2zbxyvbhWJEzzecCm2v866dCd +X3RMCsKY0//2TuElWFPnLIWDNTKubHtVCrxf1yLK7BIxlAKDsCwrddcZkNp/h3op5vn pMWJhIXMCuaM1+4PLNbR5c4f92qfQMB+QnLhLmUgu6c4OZIOIVrUU9LemnyX7Eq2T7M5 6Lfw== X-Gm-Message-State: APjAAAUJrfZci5d5tYEy0Hv1hoepO1pzGglnjsYShBnHlV+RyTrGSEGw ZvzeLVWgEN+ePTJtyd5NGZ4= X-Received: by 2002:a17:902:106:: with SMTP id 6mr6861614plb.64.1562345057870; Fri, 05 Jul 2019 09:44:17 -0700 (PDT) Received: from localhost.localdomain ([125.142.23.13]) by smtp.googlemail.com with ESMTPSA id n89sm22033297pjc.0.2019.07.05.09.44.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 05 Jul 2019 09:44:17 -0700 (PDT) From: Suwan Kim To: shuah@kernel.org, valentina.manea.m@gmail.com, stern@rowland.harvard.edu, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Suwan Kim Subject: [PATCH v2 0/2] usbip: Implement SG support Date: Sat, 6 Jul 2019 01:43:53 +0900 Message-Id: <20190705164355.14025-1-suwan.kim027@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are bugs on vhci with usb 3.0 storage device. Originally, vhci doesn't supported SG, so USB storage driver on vhci breaks SG list into multiple URBs and it causes error that a transfer got terminated too early because the transfer length for one of the URBs was not divisible by the maxpacket size. To support SG, vhci doesn't map and unmap URB for DMA to use native SG list (urb->num_sgs). In DMA mapping function of vhci, it sets URB_DMA_MAP_SG flag in urb->transfer_flags if URB has SG list and this flag will tell the stub driver to use SG list. In this patch, vhci basically support SG and it sends each SG list entry to the stub driver. Then, the stub driver sees the total length of the buffer and allocates SG table and pages according to the total buffer length calling sgl_alloc(). After the stub driver receives completed URB, it again sends each SG list entry to vhci. If HCD of the server doesn't support SG, the stub driver breaks a single SG reqeust into several URBs and submit them to the server's HCD. When all the split URBs are completed, the stub driver reassembles the URBs into a single return command and sends it to vhci. Alan fixed vhci bug with the USB 3.0 storage device by modifying USB storage driver. ("usb-storage: Set virt_boundary_mask to avoid SG overflows") But the fundamental solution of it is to add SG support to vhci. This patch works well with the USB 3.0 storage devices without Alan's patch, and we can revert Alan's patch if it causes some troubles. Suwan Kim (2): usbip: Skip DMA mapping and unmapping for urb at vhci usbip: Implement SG support to vhci drivers/usb/usbip/stub.h | 7 +- drivers/usb/usbip/stub_main.c | 52 +++++--- drivers/usb/usbip/stub_rx.c | 207 ++++++++++++++++++++++--------- drivers/usb/usbip/stub_tx.c | 108 +++++++++++----- drivers/usb/usbip/usbip_common.c | 60 +++++++-- drivers/usb/usbip/vhci_hcd.c | 29 ++++- drivers/usb/usbip/vhci_tx.c | 49 ++++++-- 7 files changed, 391 insertions(+), 121 deletions(-) -- 2.20.1