Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4424104ybl; Mon, 26 Aug 2019 10:12:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxeznWSAKPI/9vrhfo4aIDkXCKTNAxgxbSyaiubbcFQXJwh17GW345uRE6ua/eCExxLbN/6 X-Received: by 2002:a17:902:b406:: with SMTP id x6mr19335205plr.114.1566839565654; Mon, 26 Aug 2019 10:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566839565; cv=none; d=google.com; s=arc-20160816; b=iBYFaQaP0XIqux1XfnMaojSo+YdvWHkfEyujFBipNpBAK4sP3zYGe3mTC3rGh17Khw QLQQETBqKQqeESx3NLlL3Zaogi8IHILtTexGewrGEXVoIgborY8TcniaAojkEQtodKQ9 u5FTbfD4H9Qz6CEMjO6OV8HPl+DCBzzt7+yd0oRFJ/mCvl9PNvB7OmtUe0RCY7tJMv2H EjPK3VBx+GJxBC2MKV0RpHlEGVrI/y2C1AtiUprRlnr0R7uMKVL7XNCxk6S06apz0UNs 2YY8/wjRR26a/ca67TLhfzvfRvfyEKo3ZpitilYYo+7ztnp3lbPDwyrcYszEZ/Af56lQ Oqng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rV/QxiLUfmMPgKwGt5WE0he8vOLvp0R3y7oyfz3sl9k=; b=TABpSjuuqcF604lPPXLLeU1SvAS/FZ1/5NjI0w/XFi+fyMhTZbF5NrjiC5askONCqv maYh+9Bxvoi1DQ6OlC8lGIBw7fhe8hLIID6ExW2vVVxjoGcTOd9ju23dOT9miBP6giUU RsIXEiIewb56KYH/ltD/ZXx/PqnNtdpChbg35jW2yzvjvAxK+gdgHtd0qI76kVRgqZcC Fvg7eE0vPf6HM/xVN3LQnpRzTRUZUOeWJ/mmxy5ApSLJ6cKqV86RXZeceMqZZRpClrml I72fLYYTXMdaCvXPkYlKYfYjljt3mWRZJUPADVjX8u1djfIdVhlOeRGVTH2bvyABmXMj jIbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iWVJcKiT; 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 1si9958080plv.44.2019.08.26.10.12.30; Mon, 26 Aug 2019 10:12: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=iWVJcKiT; 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 S1732820AbfHZRE5 (ORCPT + 99 others); Mon, 26 Aug 2019 13:04:57 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:34551 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732202AbfHZRE4 (ORCPT ); Mon, 26 Aug 2019 13:04:56 -0400 Received: by mail-pg1-f196.google.com with SMTP id n9so10986834pgc.1; Mon, 26 Aug 2019 10:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rV/QxiLUfmMPgKwGt5WE0he8vOLvp0R3y7oyfz3sl9k=; b=iWVJcKiTJXGckIV/C6XHfB+VJvjeXB5tiWkVWU/goCNQkAKMDwUgLKSjU8iKtWnYYH Yx2CrNttKkdr8yOQrtu/3NonWPm11zzHAueIAKk9t/RbAaPM//SY67IS531OqHI2nvdq /c8hkEH64Cw0vYplLq1rzVdEV3gdwjQG9kn0EVs2X1zTBAPaTd/DL5reEFyNtSFjA2nI gEaRlK5n4IGDJnynh+TuMKaz/E5qX1/fChu9hn3IaT9HcxE47wZIEHd4UyznO9lN4i+0 3vrK7D5H4oslSZ1uJP+DAHF2ftOOKPOcTuav/r6leBa5VbAMT59DqA85K9QZaYZEfO8p bZvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=rV/QxiLUfmMPgKwGt5WE0he8vOLvp0R3y7oyfz3sl9k=; b=ahxLy5RzYMGRXIbbhHiJCkG7fzvrZ++BUU2O0TpW0znUkzX80ZZ+FZJOu5NiJ6nk0s 8NpHF5XuIxEJ1OJghpx3N+P0rMAELJxmwv1vPO03cMsJm+GwnsaC5cyVckQ/5olNuksh JzarJXx5lrYld6b8IKe241nM/EsVVboENEm16hY4UDMSP62qLamzYQIH2xXgrkVY3qpn 2mo6lSStzS699cZO0ysIGXpLzox8O1BgxsT9Y2BlhSmrwP9ni9zt4mcSi8ME7GaEcjQt 1KRlHEMXvWPyWqF6aIUKkMa/2iS1hFZnlCqY3mcoL9k4dA7MD910hj7YbC8m5QlUyzRo fY9Q== X-Gm-Message-State: APjAAAVVvigKeUWrQcpNpiG6PvcSnIQHCKwSJWaYNdhWoL0b2mjEts8z fsHeTa2R9Pww9mfhLoRb5gA= X-Received: by 2002:a17:90a:be06:: with SMTP id a6mr21081325pjs.92.1566839095647; Mon, 26 Aug 2019 10:04:55 -0700 (PDT) Received: from localhost.localdomain ([221.155.202.134]) by smtp.gmail.com with ESMTPSA id k14sm9688345pfi.98.2019.08.26.10.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 10:04:55 -0700 (PDT) Date: Tue, 27 Aug 2019 02:04:50 +0900 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 Subject: Re: [PATCH v7] usbip: Implement SG support to vhci-hcd and stub driver Message-ID: <20190826170450.GA2314@localhost.localdomain> References: <20190826150007.12187-1-suwan.kim027@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190826150007.12187-1-suwan.kim027@gmail.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 27, 2019 at 12:00:07AM +0900, Suwan Kim wrote: > There are bugs on vhci with usb 3.0 storage device. In USB, each SG > list entry buffer should be divisible by the bulk max packet size. > But with native SG support, this problem doesn't matter because the > SG buffer is treated as contiguous buffer. But without native SG > support, USB storage driver breaks SG list into several URBs and the > error occurs because of a buffer size of URB that cannot be divided > by the bulk max packet size. The error situation is as follows. > > When USB Storage driver requests 31.5 KB data and has SG list which > has 3584 bytes buffer followed by 7 4096 bytes buffer for some > reason. USB Storage driver splits this SG list into several URBs > because VHCI doesn't support SG and sends them separately. So the > first URB buffer size is 3584 bytes. When receiving data from device, > USB 3.0 device sends data packet of 1024 bytes size because the max > packet size of BULK pipe is 1024 bytes. So device sends 4096 bytes. > But the first URB buffer has only 3584 bytes buffer size. So host > controller terminates the transfer even though there is more data to > receive. So, vhci needs to support SG transfer to prevent this error. > > 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 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. After receiving urb from stub driver, vhci clear URB_DMA_MAP_SG > flag to avoid dma unmapping in HCD. I have a mistake not modifying this commit log according to the change of the code. I will resend v8. Regards Suwan Kim