linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbip: vhci-hcd: return correct port ENABLE status
@ 2017-12-06  3:41 Pei Zhang
  2017-12-15  8:44 ` Zhang, Pei
  0 siblings, 1 reply; 5+ messages in thread
From: Pei Zhang @ 2017-12-06  3:41 UTC (permalink / raw)
  To: linux-kernel, usbip-devel; +Cc: Pei Zhang

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 <pei.zhang@intel.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] usbip: vhci-hcd: return correct port ENABLE status
  2017-12-06  3:41 [PATCH] usbip: vhci-hcd: return correct port ENABLE status Pei Zhang
@ 2017-12-15  8:44 ` Zhang, Pei
  2017-12-15 21:33   ` Shuah Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang, Pei @ 2017-12-15  8:44 UTC (permalink / raw)
  To: shuahkh, valentina.manea.m; +Cc: linux-kernel, usbip-devel

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 <pei.zhang@intel.com>
> 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 <pei.zhang@intel.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usbip: vhci-hcd: return correct port ENABLE status
  2017-12-15  8:44 ` Zhang, Pei
@ 2017-12-15 21:33   ` Shuah Khan
  0 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2017-12-15 21:33 UTC (permalink / raw)
  To: Zhang, Pei, valentina.manea.m; +Cc: linux-kernel, usbip-devel, Shuah Khan

On 12/15/2017 01:44 AM, Zhang, Pei wrote:
> Add maintainers
> 
> *********  ***** 
> BRs, 
> Pei Zhang
> 

Please resend the patch to include everybody get_maintainers.pl
lists.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] usbip: vhci-hcd: return correct port ENABLE status
@ 2017-12-06  3:38 Pei Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Pei Zhang @ 2017-12-06  3:38 UTC (permalink / raw)
  To: linux-kernel, usbip-devel; +Cc: Pei Zhang

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 <pei.zhang@intel.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] usbip: vhci-hcd: return correct port ENABLE status
@ 2017-12-05  5:39 Pei Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Pei Zhang @ 2017-12-05  5:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pei Zhang

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 <pei.zhang@intel.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-15 21:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06  3:41 [PATCH] usbip: vhci-hcd: return correct port ENABLE status Pei Zhang
2017-12-15  8:44 ` Zhang, Pei
2017-12-15 21:33   ` Shuah Khan
  -- strict thread matches above, loose matches on Subject: below --
2017-12-06  3:38 Pei Zhang
2017-12-05  5:39 Pei Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).