Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754695AbdLOIoo convert rfc822-to-8bit (ORCPT ); Fri, 15 Dec 2017 03:44:44 -0500 Received: from mga17.intel.com ([192.55.52.151]:19232 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753744AbdLOIom (ORCPT ); Fri, 15 Dec 2017 03:44:42 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,404,1508828400"; d="scan'208";a="12509187" From: "Zhang, Pei" To: "shuahkh@osg.samsung.com" , "valentina.manea.m@gmail.com" CC: "linux-kernel@vger.kernel.org" , "usbip-devel@lists.sourceforge.net" Subject: RE: [PATCH] usbip: vhci-hcd: return correct port ENABLE status Thread-Topic: [PATCH] usbip: vhci-hcd: return correct port ENABLE status Thread-Index: AQHTbkL6RwfiahnFgE2+gRqHFgjSY6NEJP9g Date: Fri, 15 Dec 2017 08:44:35 +0000 Message-ID: <63B7FEB9EC4F4E41BEFE1617C2ED301363517075@shsmsx102.ccr.corp.intel.com> References: <1512531681-10554-1-git-send-email-pei.zhang@intel.com> In-Reply-To: <1512531681-10554-1-git-send-email-pei.zhang@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODIwZGYwMGYtM2E5Mi00NGRkLWIzZDQtMGU2ZjAyZmU0YzZiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJrcVdyaWkxZ0dRZjlDMjRYcGNtM08yRE9KYnhsT1JlUGprT2syZjN3RXdDQjRnTU1uV2pqWHlXXC9ldVVwNUp5ZCJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2689 Lines: 83 Add maintainers ********* ***** BRs, Pei Zhang > -----Original Message----- > From: Zhang, Pei > Sent: Wednesday, December 6, 2017 11:41 AM > To: linux-kernel@vger.kernel.org; usbip-devel@lists.sourceforge.net > Cc: Zhang, Pei > Subject: [PATCH] usbip: vhci-hcd: return correct port ENABLE status > > USB system will clear port's ENABLE feature for some USB devices when > vdev is already assigned port address. This cause getPortStatus reports > to system that this device is not enabled, client OS will failed to use > this usb device. > > The failure devices include a SAMSUNG SSD storage, and a Logitech webcam. > > Signed-off-by: Pei Zhang > --- > drivers/usb/usbip/vhci_hcd.c | 38 +++++++++++++++++++++++-------------- > - > 1 file changed, 23 insertions(+), 15 deletions(-) > > diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c > index e4cb9f0..7b8cf70 100644 > --- a/drivers/usb/usbip/vhci_hcd.c > +++ b/drivers/usb/usbip/vhci_hcd.c > @@ -350,24 +350,32 @@ static int vhci_hub_control(struct usb_hcd *hcd, > u16 typeReq, u16 wValue, > dum->re_timeout = 0; > } > > - if ((dum->port_status[rhport] & (1 << USB_PORT_FEAT_RESET)) != > - 0 && time_after(jiffies, dum->re_timeout)) { > - dum->port_status[rhport] |= > - (1 << USB_PORT_FEAT_C_RESET); > - dum->port_status[rhport] &= > - ~(1 << USB_PORT_FEAT_RESET); > - dum->re_timeout = 0; > - > - if (dum->vdev[rhport].ud.status == > - VDEV_ST_NOTASSIGNED) { > - usbip_dbg_vhci_rh( > - " enable rhport %d (status %u)\n", > - rhport, > - dum->vdev[rhport].ud.status); > + if (dum->port_status[rhport] & (1 << USB_PORT_FEAT_RESET)) { > + if (time_after(jiffies, dum->re_timeout)) { > dum->port_status[rhport] |= > - USB_PORT_STAT_ENABLE; > + (1 << USB_PORT_FEAT_C_RESET); > + dum->port_status[rhport] &= > + ~(1 << USB_PORT_FEAT_RESET); > + dum->re_timeout = 0; > + > + if (dum->vdev[rhport].ud.status == > + VDEV_ST_NOTASSIGNED) { > + usbip_dbg_vhci_rh( > + " enable rhport %d (status %u)\n", > + rhport, > + dum->vdev[rhport].ud.status); > + dum->port_status[rhport] |= > + USB_PORT_STAT_ENABLE; > + } > } > + } else { > + /* Port would be disabled by clearing FEAT_ENABLE bit, > + * make it enabled here. No more thing should be done. > */ > + if (dum->vdev[rhport].ud.status == VDEV_ST_USED) > + dum->port_status[rhport] |= > + USB_PORT_STAT_ENABLE; > } > + > ((__le16 *) buf)[0] = cpu_to_le16(dum->port_status[rhport]); > ((__le16 *) buf)[1] = > cpu_to_le16(dum->port_status[rhport] >> 16); > -- > 2.7.4