Date: Fri, 10 Jan 2020 02:29:22 +0000 From: <Shichun.Ma@dell.com> To: <hps@selasky.org>, <freebsd-usb@freebsd.org> Cc: <Shunchao.Hu@dell.com> Subject: minor improve for xhci_cmd_stop_ep in xhci_configure_reset_endpoint Message-ID: <1578623361805.72194@Dell.com>
index | next in thread | raw e-mail
Hi HPS,
As subject, this is just an minor improvement.
When do first xfer on one ep, it use xhci_configure_reset_endpoint to start ep, in current cases, no need send xhci_cmd_stop_ep command.
And xhci_cmd_stop_ep will return XHCI_TRB_ERROR_CONTEXT_STATE if it's not at running status.
Could you consider and below check before callxhci_cmd_stop_ep?
pcctx = &sc->sc_hw.devs[index].device_pc;
usbd_get_page(pcctx, 0, &buf_dev);
pdev = buf_dev.buffer;
ctx_ep = &pdev->ctx_ep[epno - 1];
ep_status = XHCI_EPCTX_0_EPSTATE_GET(ctx_ep->dwEpCtx0);
if ((ep_status == 0) || (ep_status == EP_STOPPED)) {
KLOGN(KDBG, "ep %x is not started yet\n", edesc->bEndpointAddress);
} else {
err = xhci_cmd_stop_ep(sc, 0, epno, index);
if (err)
KLOGN(KWARN, "stop endpoint %u, %x, %d\n",
epno, edesc->bEndpointAddress, err);
}
Thanks & Regards,
Shichun Ma
Software Engineer
Dell | Cloud Client Computing
office +86 10 82862579, Mobile +86 13241851528
shichun_ma@dell.com<https://mymail.ap.dell.com/owa/redir.aspx?C=uPOrYjgya0C5bBLwgkoWNY7P8Ilwg9MI8ATWIwmDlYQHlJ86n78H9fPUPlHLsPjzuTLRK07T_LQ.&URL=mailto%3ashichun_ma%40dell.com>
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1578623361805.72194>
