Skip site navigation (1)Skip section navigation (2)
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>

next in thread | raw e-mail | index | archive | help
Hi HPS,


As subject, this is just an minor improvement.

When do first xfer on one  ep, it use xhci_configure_reset_endpoint to star=
t 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 a=
t running status.


Could you consider and below check before callxhci_cmd_stop_ep?


        pcctx =3D &sc->sc_hw.devs[index].device_pc;
        usbd_get_page(pcctx, 0, &buf_dev);
        pdev =3D buf_dev.buffer;


        ctx_ep =3D &pdev->ctx_ep[epno - 1];
        ep_status =3D XHCI_EPCTX_0_EPSTATE_GET(ctx_ep->dwEpCtx0);
        if ((ep_status =3D=3D 0) || (ep_status =3D=3D EP_STOPPED)) {
                KLOGN(KDBG, "ep %x is not started yet\n", edesc->bEndpointA=
ddress);
        } else {
                err =3D 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=3DuPOrYjgya=
0C5bBLwgkoWNY7P8Ilwg9MI8ATWIwmDlYQHlJ86n78H9fPUPlHLsPjzuTLRK07T_LQ.&URL=3Dm=
ailto%3ashichun_ma%40dell.com>





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1578623361805.72194>