Esempio n. 1
0
static void ath_node_pwrsaveq_handle_ps_frames(struct ath_node *an,
                                            ath_wbuf_t athwbuf, u_int8_t frame_type)
{
#if ATH_DEBUG
    struct ath_softc *sc = an->an_sc;
#endif
    struct ath_node_pwrsaveq *mgtq;
    ath_wbuf_t tmpathwbuf;

    mgtq  = ATH_NODE_PWRSAVEQ_MGMTQ(an); 

    if (wbuf_is_pwrsaveframe(athwbuf->wbuf))  {
        /* ps frame (null (or) pspoll frame) */
        ++mgtq->nsq_num_ps_frames;
    } else {
        /* non ps frame*/
        if (mgtq->nsq_num_ps_frames) {
            struct ath_node_pwrsaveq *tmpq, temp_q;
            tmpq = &temp_q;

            ATH_NODE_PWRSAVEQ_INIT(tmpq);
            /*
             * go through the mgt queue and dump the frames with PS=1(pspoll,null).
             * accummulate the remaining frames into temp queue.
             */
            for (;;) {
                ATH_NODE_PWRSAVEQ_DEQUEUE(mgtq, tmpathwbuf);
                if (tmpathwbuf == NULL) {
                    break;
                }
                if (wbuf_is_pwrsaveframe(tmpathwbuf->wbuf))  {
                    /* complete the wbuf */
                    DPRINTF(sc, ATH_DEBUG_PWR_SAVE, "%s: send error, comple the wbuf\n", __func__);
                    ath_node_pwrsaveq_complete_athwbuf(an, tmpathwbuf);
                } else {
                    ATH_NODE_PWRSAVEQ_ADD(tmpq,tmpathwbuf);
                }
            }

            mgtq->nsq_num_ps_frames = 0;
            /*
             * move all the frames from temp queue to mgmt queue.
             */
            for (;;) {
                ATH_NODE_PWRSAVEQ_DEQUEUE(tmpq, tmpathwbuf);
                if (tmpathwbuf == NULL) {
                    break;
                }
                ATH_NODE_PWRSAVEQ_ADD(mgtq, tmpathwbuf);
            }
        }
    }
}
Esempio n. 2
0
void ath_node_pwrsaveq_attach(struct ath_node *an)
{
    ATH_NODE_PWRSAVEQ_INIT(&(an->an_dataq));
    ATH_NODE_PWRSAVEQ_INIT(&(an->an_mgmtq));
}