minor improve for xhci_cmd_stop_ep in xhci_configure_reset_endpoint

Shichun.Ma at dell.com Shichun.Ma at dell.com
Fri Jan 10 02:29:31 UTC 2020


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 at dell.com<https://mymail.ap.dell.com/owa/redir.aspx?C=uPOrYjgya0C5bBLwgkoWNY7P8Ilwg9MI8ATWIwmDlYQHlJ86n78H9fPUPlHLsPjzuTLRK07T_LQ.&URL=mailto%3ashichun_ma%40dell.com>




More information about the freebsd-usb mailing list