Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1106168ybh; Sat, 3 Aug 2019 18:07:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyY5WQ/mZs1ZaXhQhSdVpjY0n/ZY4VbCIfg/T70felCcWzQP5ekY81PJhT041hZ3doJi5n1 X-Received: by 2002:a17:90a:8d09:: with SMTP id c9mr11597376pjo.131.1564880872788; Sat, 03 Aug 2019 18:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564880872; cv=none; d=google.com; s=arc-20160816; b=Y66S2RNuNt6D5GcNUdVttPuyXGYh96WeoLrofNff4FXUX+Vp6nWsV2VMjAMPCqgbOy PgcERfYzQwJpOogvH3p7YJ994lb2NdfaNHSq1ICPCVAisnYbh0EehSAoN0kYwCa8mrnk VcxHmTG/qerPkrgzPYkds5bZpJvfid3Fvu3cHL8WHvgTQT1uS5+PWcc690lIvdYclyQD CeZTblMWF4I3VfaX00MzZAYY/xlUXgvmCVd0aB2JOWVoRYjhmlqHLpK9kAsHwT2A0qOn m6XASKHnqbO/JtQaJWMMIDZHDsvl3L5qJeR92ZNxW6CBmbi3hT9i7TKhcnvM0W3WvNkh 7Ksg== 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=3A3pbOgwFhjFnz3NQu9aTmrqyprDDhamfU4+FFzAI/g=; b=JWfwjZU38tPAphVENHAnOF42n9KbvaxYuHOhnD4ZNgvp3LBhZHr21hUqoeobWb4Oub g5suHoTjVsOe4jw0n2fpycamlASkZcEXeeVVQB3l9NDDIdP7BpDa0a4sYEqnq+F9S4jY ddEF9UJwqqWMlZHdTHR4xqt4eb3NurmUp53rsb95gGXcFJWY2ISS0H1rDdAmUNoS9OTS sPiI0ZHZSrvQhQmHgPGSyw2H8UaVKTtOkH/+Zf5kUHlJ8Y9oO3ppM3HcPicnBbeSc6lK g5o/weGwGS8/U3BOj2Q06Xu7WdO5m+fToCNFHx+k4cHmTCKrq3gMTPvgfz2g6ryYj5ON qSaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="kN/UrSSo"; 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 z27si30090217pfj.225.2019.08.03.18.07.37; Sat, 03 Aug 2019 18:07:52 -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="kN/UrSSo"; 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 S2405544AbfHBRhB (ORCPT + 99 others); Fri, 2 Aug 2019 13:37:01 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38890 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729364AbfHBRhA (ORCPT ); Fri, 2 Aug 2019 13:37:00 -0400 Received: by mail-pf1-f196.google.com with SMTP id y15so36390436pfn.5; Fri, 02 Aug 2019 10:37:00 -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=3A3pbOgwFhjFnz3NQu9aTmrqyprDDhamfU4+FFzAI/g=; b=kN/UrSSoMHtqbF2jRZsmqb2lM8GzsO8d6QlXWREikrD+5Y6k9OWXkb9nqdBqLkaBcG ouI/jjrn6w/4pWK1nro8re5zmfvKQWuxWxCgm2pdY42eFt2U5+ynkFdL9eZfB1ZKwTGW o0m7xKyz1uSuIlFCIdWsxfMeddnP/3mWtm4gvc8AdcqGSaoLCZt9ocKIUJJ9vE0p6VzD eN37X4JfH9sgLYZEcXgB507R/s81NgcPaR1dse98YZFTpDimDZhO1kGGVYdLkvvegObG jvZhsq/pKI/XMNY67IbQUvfhzqvOq8a08wPSicRH8XBzBzIqMOwu8GANTiAmkY4CuI10 SBog== 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=3A3pbOgwFhjFnz3NQu9aTmrqyprDDhamfU4+FFzAI/g=; b=PvbIyAHhBlYA7QAaJzVkDMiYri8/4ptgvR4+DJTFYEOAvL4k4Hq3uiNbqnlSv0dMP3 OewwkpWAcS46u3+SRnJFn/ijMzii6jJdKIcSQtw9qxvRxbWZ2vCJXytRtGP3HRCqLOBs gJyOxNPKy8/exfoheDu0r3vT+G3aO9qUZq5DX/9WTmBVgzfmXtNgRNSLnEtNjuZlfh7Z 36q81+MnU8IPxmjrPgJ1nhUl0J71Ave1znwDJJlqoOKHkKSpgVqC5ykyNjPJ0Tv+spde ETtXqJ1A2QtbbVwKcO/DzgrMz95VrKsqaEezQU4Ew6LXOaDCg36TrUYuCDh5N6GM8JwB XC0Q== X-Gm-Message-State: APjAAAUr2S8EuHMaUC1ELORrtlB1IbU+hiI3c3Un/x9HaZPMaXXMCBwd 7MtOfy7+MQT7q9kuIndj0yk= X-Received: by 2002:a17:90a:3544:: with SMTP id q62mr5415998pjb.53.1564767419767; Fri, 02 Aug 2019 10:36:59 -0700 (PDT) Received: from localhost.localdomain ([125.142.23.13]) by smtp.googlemail.com with ESMTPSA id a20sm7992911pjo.0.2019.08.02.10.36.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 10:36:59 -0700 (PDT) From: Suwan Kim To: shuah@kernel.org, valentina.manea.m@gmail.com, gregkh@linuxfoundation.org, stern@rowland.harvard.edu Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Suwan Kim Subject: [PATCH v3 0/2] usbip: Implement SG support Date: Sat, 3 Aug 2019 02:36:49 +0900 Message-Id: <20190802173651.22247-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. Currently, 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. In this patch, vhci supports SG regardless of whether the server's host controller supports SG or not, because stub driver splits SG list into several URBs if the server's host controller doesn't support SG. To support SG, vhci_map_urb_for_dma() sets URB_DMA_MAP_SG flag in urb->transfer_flags if URB has SG list and this flag will tell stub driver to use SG list. vhci sends each SG list entry to stub driver. Then, 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 stub driver receives completed URB, it again sends each SG list entry to vhci. If the server's host controller doesn't support SG, stub driver breaks a single SG request into several URBs and submits them to the server's host controller. When all the split URBs are completed, 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-hcd and stub driver drivers/usb/usbip/stub.h | 7 +- drivers/usb/usbip/stub_main.c | 55 ++++++--- drivers/usb/usbip/stub_rx.c | 203 ++++++++++++++++++++++--------- drivers/usb/usbip/stub_tx.c | 99 +++++++++++---- drivers/usb/usbip/usbip_common.c | 59 ++++++--- drivers/usb/usbip/vhci_hcd.c | 34 +++++- drivers/usb/usbip/vhci_tx.c | 63 ++++++++-- 7 files changed, 394 insertions(+), 126 deletions(-) -- 2.20.1