모바일 오유 바로가기
http://m.todayhumor.co.kr
분류 게시판
베스트
  • 베스트오브베스트
  • 베스트
  • 오늘의베스트
  • 유머
  • 유머자료
  • 유머글
  • 이야기
  • 자유
  • 고민
  • 연애
  • 결혼생활
  • 좋은글
  • 자랑
  • 공포
  • 멘붕
  • 사이다
  • 군대
  • 밀리터리
  • 미스터리
  • 술한잔
  • 오늘있잖아요
  • 투표인증
  • 새해
  • 이슈
  • 시사
  • 시사아카이브
  • 사회면
  • 사건사고
  • 생활
  • 패션
  • 패션착샷
  • 아동패션착샷
  • 뷰티
  • 인테리어
  • DIY
  • 요리
  • 커피&차
  • 육아
  • 법률
  • 동물
  • 지식
  • 취업정보
  • 식물
  • 다이어트
  • 의료
  • 영어
  • 맛집
  • 추천사이트
  • 해외직구
  • 취미
  • 사진
  • 사진강좌
  • 카메라
  • 만화
  • 애니메이션
  • 포니
  • 자전거
  • 자동차
  • 여행
  • 바이크
  • 민물낚시
  • 바다낚시
  • 장난감
  • 그림판
  • 학술
  • 경제
  • 역사
  • 예술
  • 과학
  • 철학
  • 심리학
  • 방송연예
  • 연예
  • 음악
  • 음악찾기
  • 악기
  • 음향기기
  • 영화
  • 다큐멘터리
  • 국내드라마
  • 해외드라마
  • 예능
  • 팟케스트
  • 방송프로그램
  • 무한도전
  • 더지니어스
  • 개그콘서트
  • 런닝맨
  • 나가수
  • 디지털
  • 컴퓨터
  • 프로그래머
  • IT
  • 안티바이러스
  • 애플
  • 안드로이드
  • 스마트폰
  • 윈도우폰
  • 심비안
  • 스포츠
  • 스포츠
  • 축구
  • 야구
  • 농구
  • 바둑
  • 야구팀
  • 삼성
  • 두산
  • NC
  • 넥센
  • 한화
  • SK
  • 기아
  • 롯데
  • LG
  • KT
  • 메이저리그
  • 일본프로야구리그
  • 게임1
  • 플래시게임
  • 게임토론방
  • 엑스박스
  • 플레이스테이션
  • 닌텐도
  • 모바일게임
  • 게임2
  • 던전앤파이터
  • 마비노기
  • 마비노기영웅전
  • 하스스톤
  • 히어로즈오브더스톰
  • gta5
  • 디아블로
  • 디아블로2
  • 피파온라인2
  • 피파온라인3
  • 워크래프트
  • 월드오브워크래프트
  • 밀리언아서
  • 월드오브탱크
  • 블레이드앤소울
  • 검은사막
  • 스타크래프트
  • 스타크래프트2
  • 베틀필드3
  • 마인크래프트
  • 데이즈
  • 문명
  • 서든어택
  • 테라
  • 아이온
  • 심시티5
  • 프리스타일풋볼
  • 스페셜포스
  • 사이퍼즈
  • 도타2
  • 메이플스토리1
  • 메이플스토리2
  • 오버워치
  • 오버워치그룹모집
  • 포켓몬고
  • 파이널판타지14
  • 배틀그라운드
  • 기타
  • 종교
  • 단어장
  • 자료창고
  • 운영
  • 공지사항
  • 오유운영
  • 게시판신청
  • 보류
  • 임시게시판
  • 메르스
  • 세월호
  • 원전사고
  • 2016리오올림픽
  • 2018평창올림픽
  • 코로나19
  • 2020도쿄올림픽
  • 게시판찾기
  • 오유인페이지
    개인차단 상태
    멋진남자님의
    개인페이지입니다
    가입 : 03-11-11
    방문 : 4115회
    닉네임변경 이력
    회원차단
    회원차단해제
    게시물ID : science_42
    작성자 : 멋진남자
    추천 : 2
    조회수 : 1016
    IP : 61.74.***.77
    댓글 : 9개
    등록시간 : 2010/03/20 07:47:34
    http://todayhumor.com/?science_42 모바일
    아 다짰다.
    /*-
     * Copyright (c) 2010 , MWNL
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     * 1. Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer,
     *    without modification.
     * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
     *    redistribution must be conditioned upon including a substantially
     *    similar Disclaimer requirement for further binary redistribution.
     * 3. Neither the names of the above-listed copyright holders nor the names
     *    of any contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * Alternatively, this software may be distributed under the terms of the
     * GNU General Public License ("GPL") version 2 as published by the Free
     * Software Foundation.
     *
     * NO WARRANTY
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
     * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
     * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
     * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
     * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     * THE POSSIBILITY OF SUCH DAMAGES.
     *
     */

    /* Automatic rate fallback */


    /*-------------------------INCLUDE FILES--------------------------------*/
    #include <linux/config.h>
    #include <linux/version.h>
    #include <linux/module.h>
    #include <linux/init.h>
    #include <linux/skbuff.h>
    #include <linux/netdevice.h>
    #include <linux/random.h>
    #include <linux/delay.h>
    #include <linux/cache.h>
    #include <linux/sysctl.h>
    #include <linux/proc_fs.h>
    #include <linux/if_arp.h>
    #include <linux/vmalloc.h>
    #include <asm/uaccess.h>

    #include <net80211/if_media.h>
    #include <net80211/ieee80211_var.h>

    #include "if_athrate.h"
    #include "if_athvar.h"
    #include "ah_desc.h"

    #include "arf.h"
    /*--------------------------------------------------------------------*/
    #define ARF_DEBUG
    #ifdef ARF_DEBUG
    enum {
    ATH_DEBUG_RATE = 0x00000010, /* rate control */
    };
    #define DPRINTF(sc, _fmt, ...) do { \
    if (sc->sc_debug & ATH_DEBUG_RATE) \
    printk(_fmt, __VA_ARGS__); \
    } while (0)
    #else
    #define DPRINTF(sc, _fmt, ...)
    #endif

    /*--------------------------------------------------------------------*/
    /*
     * Default parameters for the rate control algorithm.  These are
     * all tunable with sysctls.  The rate controller runs periodically
     * (each ath_rateinterval ms) analyzing transmit statistics for each
     * neighbor/station (when operating in station mode this is only the AP).
     * If transmits look to be working well over a sampling period then
     * it gives a "raise rate credit".  If transmits look to not be working
     * well than it deducts a credit.  If the credits cross a threshold then
     * the transmit rate is raised.  Various error conditions force the
     * the transmit rate to be dropped.
     *
     * The decision to issue/deduct a credit is based on the errors and
     * retries accumulated over the sampling period.  ath_rate_raise defines
     * the percent of retransmits for which a credit is issued/deducted.
     * ath_rate_raise_threshold defines the threshold on credits at which
     * the transmit rate is increased.
     *
     * XXX this algorithm is flawed.


     */
    /*---------STATIC VARIABLES---------------------------------------------------*/

    static u_int8_t curr_bitrate = 0;
    static u_int8_t old_bitrate = 0;
    u_int8_t signal = 0;
    //static int tries_0 = 0, tries_1 = 0, tries_2 = 0, tries_3 = 0;

    //static int final_idx = 0;

    /*------------------FUNCTION DECLARATION------------------------------*/
    static void ath_rate_update(struct ath_softc *, struct ieee80211_node *, int);
    static void ath_rate_ctl_start(struct ath_softc *, struct ieee80211_node *);
    static void ath_rate_ctl(void *, struct ieee80211_node *);
    //int get_rts_signal(void){return signal;};
    void set_rts_signal(int data){signal = data;};
    int get_rts_signal(void) {return signal;};
    EXPORT_SYMBOL(get_rts_signal);
    EXPORT_SYMBOL(set_rts_signal);

    /*---------------------------------------------------------------------*/



    /*-------------------FUNCTION DEFINATION------------------------------*/

    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_node_init(struct ath_softc *sc, struct ath_node *an)
    *  DESCRIPTION:         initialize the node
    *---------------------------------------------------------------------*/
    void
    ath_rate_node_init(struct ath_softc *sc, struct ath_node *an)
    {
    /* NB: assumed to be zero'd by caller */
    ath_rate_update(sc, &an->an_node, 0);
    }
    EXPORT_SYMBOL(ath_rate_node_init);


    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_node_cleanup(struct ath_softc *sc, struct ath_node *an)
    *  DESCRIPTION:         destroy information for a node
    *---------------------------------------------------------------------*/
    void
    ath_rate_node_cleanup(struct ath_softc *sc, struct ath_node *an)
    {
    }
    EXPORT_SYMBOL(ath_rate_node_cleanup);

    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
    int shortPreamble, size_t frameLen,
    u_int8_t *rix, int *try0, u_int8_t *txrate)
    *  DESCRIPTION:         find bit rate for the current packet tx
    *---------------------------------------------------------------------*/

    void
    ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
    int shortPreamble, size_t frameLen,
    u_int8_t *rix, int *try0, u_int8_t *txrate)
    {
    struct arf_node *on = ATH_NODE_ARF(an);

    *rix = on->on_tx_rix0;
    *try0 = 1;  //no retransmissions configured
    // *try0 = on->on_tx_try0;
    if (shortPreamble)
    *txrate = on->on_tx_rate0sp;
    else
    *txrate = on->on_tx_rate0;
    DPRINTF(sc,  "%s: \n", __func__);
    }

    EXPORT_SYMBOL(ath_rate_findrate);

    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath_node *an,
    struct ath_desc *ds, int shortPreamble, size_t frame_size, u_int8_t rix)
    *  DESCRIPTION:         setup tx descriptor
    *---------------------------------------------------------------------*/
    void
    ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath_node *an,
    struct ath_desc *ds, int shortPreamble, size_t frame_size, u_int8_t rix)
    {
    // struct arf_node *on = ATH_NODE_ARF(an);

    ath_hal_setupxtxdesc(sc->sc_ah, ds
    , 0,0 /*series 0*/
    ,0,0 /*series 1*/
    ,0,0 /*series 2*/
    );
    #if 0
    // retransmission scheme off.
    ath_hal_setupxtxdesc(sc->sc_ah, ds
    , on->on_tx_rate1sp, 2 /* series 1 */
    , on->on_tx_rate2sp, 2 /* series 2 */
    , on->on_tx_rate3sp, 2 /* series 3 */
    );
    #endif
    }
    EXPORT_SYMBOL(ath_rate_setupxtxdesc);


    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_tx_complete(struct ath_softc *sc,
    struct ath_node *an, const struct ath_desc *ds)
    *  DESCRIPTION:         post Tx handling (per packet basis)
    Increment the bit rate if the tx_ok = 10(successive) 
    Decrement the bit rate if tx_err = 2 (successive) 
    *---------------------------------------------------------------------*/

    void
    ath_rate_tx_complete(struct ath_softc *sc,
    struct ath_node *an, const struct ath_desc *ds)
    {
    struct arf_node *on = ATH_NODE_ARF(an);

    #if 0
    const struct ar5212_desc *ads = (const struct ar5212_desc *)&ds->ds_ctl0;
    int rate0, tries0 ;
    int rate1, tries1;
    int rate2, tries2;
    int rate3, tries3;
    int finalTSIdx = ads->final_ts_index;
    #endif
    int final_rate = 0;
    int short_tries = 0;
    int long_tries = 0;

    final_rate = (sc->sc_hwmap[ds->ds_txstat.ts_rate &~ HAL_TXSTAT_ALTRATE].ieeerate)/2;
    short_tries = ds->ds_txstat.ts_shortretry + 1;
    long_tries = ds->ds_txstat.ts_longretry + 1;
    /*FOR DETERMINING THE AVERAGE TX RATE USED*/
    msr.total_pkts++;
    switch(final_rate)
    {
    case 54:
    msr.p54_pkts++;
    break;
    case 48:
    msr.p48_pkts++;
    break;
    case 36:
    msr.p36_pkts++;
    break;
    case 24:
    msr.p24_pkts++;
    break;
    case 18:
    msr.p18_pkts++;
    break;
    case 12:
    msr.p12_pkts++;
    break;
    case 9:
    msr.p9_pkts++;
    break;
    case 6:
    msr.p6_pkts++;
    break;
    default:
    break;
    }


    if(ds->ds_txstat.ts_status == 0)
    {
    on->on_tx_ok++;
    on->on_tx_err = 0;
    }
    else
    {
    on->on_tx_err++;
    on->on_tx_ok = 0;
    }



    /*Increment the bit rate if the tx_ok = 10(successive)  */
    /* Decrement the bit rate if tx_err = 2 (successive) */

    // signal = 0 ;
    DPRINTF(sc, "%s: tx_ok=%d, tx_err = %d\n", __func__,on->on_tx_ok,on->on_tx_err);
    set_rts_signal(signal);   // this is presently not used
    if(on->on_tx_ok == 10 || on->on_tx_err == 2)
    ath_rate_ctl(sc, &an->an_node);
    }


    EXPORT_SYMBOL(ath_rate_tx_complete);

    /*-----------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_newassoc(struct ath_softc *sc, struct ath_node *an, int isnew)

    *  DESCRIPTION:         handle the new association
    *---------------------------------------------------------------------*/
    void
    ath_rate_newassoc(struct ath_softc *sc, struct ath_node *an, int isnew)
    {
    if (isnew)
    ath_rate_ctl_start(sc, &an->an_node);
    }
    EXPORT_SYMBOL(ath_rate_newassoc);

    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_newassoc(struct ath_softc *sc, struct ath_node *an, int isnew)

    *  DESCRIPTION:         handle the new association
    *---------------------------------------------------------------------*/
    static void
    ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate)
    {
    struct ath_node *an = ATH_NODE(ni);
    struct arf_node *on = ATH_NODE_ARF(an);
    const HAL_RATE_TABLE *rt = sc->sc_currates;
    u_int8_t rix;

    KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));

    DPRINTF(sc, "%s: set xmit rate for %s to %dM\n",
    __func__, ether_sprintf(ni->ni_macaddr),
    ni->ni_rates.rs_nrates > 0 ?
    (ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0);

    ni->ni_txrate = rate;
    /*
     * Before associating a node has no rate set setup
     * so we can't calculate any transmit codes to use.
     * This is ok since we should never be sending anything
     * but management frames and those always go at the
     * lowest hardware rate.
     */
    if (ni->ni_rates.rs_nrates == 0)
    goto done;
    on->on_tx_rix0 = sc->sc_rixmap[ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL];
    on->on_tx_rate0 = rt->info[on->on_tx_rix0].rateCode;

    on->on_tx_rate0sp = on->on_tx_rate0 |
    rt->info[on->on_tx_rix0].shortPreamble;
    if (sc->sc_mrretry) {
    /*
     * Hardware supports multi-rate retry; setup two
     * step-down retry rates and make the lowest rate
     * be the ``last chance''.  We use 4, 2, 2, 2 tries
     * respectively (4 is set here, the rest are fixed
     * in the xmit routine).
     */
    on->on_tx_try0 = 1;   /*right now 1 as no retr handled,  4 tries at rate 0 */
    if (--rate >= 0) {
    rix = sc->sc_rixmap[ni->ni_rates.rs_rates[rate]&IEEE80211_RATE_VAL];
    on->on_tx_rate1 = rt->info[rix].rateCode;
    on->on_tx_rate1sp = on->on_tx_rate1 |
    rt->info[rix].shortPreamble;
    } else
    on->on_tx_rate1 = on->on_tx_rate1sp = 0;
    if (--rate >= 0) {
    rix = sc->sc_rixmap[ni->ni_rates.rs_rates[rate]&IEEE80211_RATE_VAL];
    on->on_tx_rate2 = rt->info[rix].rateCode;
    on->on_tx_rate2sp = on->on_tx_rate2 |
    rt->info[rix].shortPreamble;
    } else
    on->on_tx_rate2 = on->on_tx_rate2sp = 0;
    if (rate > 0) {
    /* NB: only do this if we didn't already do it above */
    on->on_tx_rate3 = rt->info[0].rateCode;
    on->on_tx_rate3sp =
    on->on_tx_rate3 | rt->info[0].shortPreamble;
    } else
    on->on_tx_rate3 = on->on_tx_rate3sp = 0;
    } else {
    on->on_tx_try0 = 1; //ATH_TXMAXTRY; /* max tries at rate 0 */
    on->on_tx_rate1 = on->on_tx_rate1sp = 0;
    on->on_tx_rate2 = on->on_tx_rate2sp = 0;
    on->on_tx_rate3 = on->on_tx_rate3sp = 0;
    }
    done:
    on->on_tx_ok = on->on_tx_err = on->on_tx_retr = on->on_tx_upper = 0;
    }

    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_ctl_start(struct ath_softc *sc, struct ieee80211_node *ni)

    *  DESCRIPTION:         Set the starting transmit rate for a node.
    *---------------------------------------------------------------------*/
    static void
    ath_rate_ctl_start(struct ath_softc *sc, struct ieee80211_node *ni)
    {
    #define RATE(_ix) (ni->ni_rates.rs_rates[(_ix)] & IEEE80211_RATE_VAL)
    struct ieee80211vap *vap = ni->ni_vap;
    int srate;

    KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates"));
    if (vap->iv_fixed_rate == IEEE80211_FIXED_RATE_NONE) {
    /*
     * No fixed rate is requested. For 11b start with
     * the highest negotiated rate; otherwise, for 11g
     * and 11a, we start "in the middle" at 24Mb or 36Mb.
     */
    srate = ni->ni_rates.rs_nrates - 1;
    if (sc->sc_curmode != IEEE80211_MODE_11B) {
    /*
     * Scan the negotiated rate set to find the
     * closest rate.
     */
    /* NB: the rate set is assumed sorted */

    /*PROBABLY CHANGE 72 TO 108 FOR STARTING WITH 54M  */
    for (; srate >= 0 && RATE(srate) > 108; srate--);
    KASSERT(srate >= 0, ("bogus rate set"));
    }
    } else {
    /*
     * A fixed rate is to be used; iv_fixed_rate is the
     * 802.11 rate code.  Convert this to the index into
     * the negotiated rate set for the node.  We know the
     * rate is there because the rate set is checked when
     * the station associates.
     */
    /* NB: the rate set is assumed sorted */
    srate = ni->ni_rates.rs_nrates - 1;
    for (; srate >= 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
    KASSERT(srate >= 0,
    ("fixed rate %d not in rate set", vap->iv_fixed_rate));
    }
    ath_rate_update(sc, ni, srate);
    #undef RATE
    }


    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_cb(void *arg, struct ieee80211_node *ni)

    *  DESCRIPTION:         callback function for rate update
    *---------------------------------------------------------------------*/
    static void
    ath_rate_cb(void *arg, struct ieee80211_node *ni)
    {
    ath_rate_update(ni->ni_ic->ic_dev->priv, ni, (long) arg);
    }

    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_newstate(struct ieee80211vap *vap, enum ieee80211_state state)

    *  DESCRIPTION:         Reset the rate control state for each 802.11 state transition.
    *---------------------------------------------------------------------*/
    void
    ath_rate_newstate(struct ieee80211vap *vap, enum ieee80211_state state)
    {
    struct ieee80211com *ic = vap->iv_ic;
    struct ath_softc *sc = ic->ic_dev->priv;
    struct ieee80211_node *ni;

    if (state == IEEE80211_S_INIT)
    return;
    if (vap->iv_opmode == IEEE80211_M_STA) {
    /*
     * Reset local xmit state; this is really only
     * meaningful when operating in station mode.
     */
    ni = vap->iv_bss;
    if (state == IEEE80211_S_RUN) {
    ath_rate_ctl_start(sc, ni);
    } else {
    ath_rate_update(sc, ni, 0);
    }
    } else {
    /*
     * When operating as a station the node table holds
     * the AP's that were discovered during scanning.
     * For any other operating mode we want to reset the
     * tx rate state of each node.
     */
    ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, NULL);
    ath_rate_update(sc, vap->iv_bss, 0);
    }
    }
    EXPORT_SYMBOL(ath_rate_newstate);
    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_ctl(void *arg, struct ieee80211_node *ni)

    *  DESCRIPTION:         Examine and potentially adjust the transmit rate.
    *---------------------------------------------------------------------*/
    static void
    ath_rate_ctl(void *arg, struct ieee80211_node *ni)
    {
    struct ath_softc *sc = arg;
    struct arf_node *on = ATH_NODE_ARF(ATH_NODE(ni));
    struct ieee80211_rateset *rs = &ni->ni_rates;
    int dir = 0, nrate;

    sc->sc_stats.ast_rate_calls++;

    if(on->on_tx_ok == 10)
    dir = 1;  /*increase bit rate*/
    if(on->on_tx_err == 2)
    dir = -1;  /*decrease bit rate*/

    nrate = ni->ni_txrate;  /*Current bit rate*/

    switch(dir)
    {
    case 0:
    {
    /*maintain the same bit rate*/
    break;
    }
    case -1:
    {
    /*decrement the bit rate by one index*/
    if (nrate > 0)
    {
    nrate--;
    sc->sc_stats.ast_rate_drop++;
    }
    break;
    }
    case 1:
    {
    /*Increment the bit rate by one index*/
    if (nrate + 1 < rs->rs_nrates) 
    {
    nrate++;
    sc->sc_stats.ast_rate_raise++;
    }
    break;
    }
    default:
    break;
    }

    DPRINTF(sc, "%s: ok %d err %d retr %d upper %d dir %d\n",
    ether_sprintf(ni->ni_macaddr),
    on->on_tx_ok, on->on_tx_err, on->on_tx_retr,
    on->on_tx_upper, dir);


    if (nrate != ni->ni_txrate) {
    DPRINTF(sc, "%s: %dM -> %dM (%d ok, %d err, %d retr)\n",
        __func__,
        (rs->rs_rates[ni->ni_txrate] & IEEE80211_RATE_VAL) / 2,
        (rs->rs_rates[nrate] & IEEE80211_RATE_VAL) / 2,
        on->on_tx_ok, on->on_tx_err, on->on_tx_retr);
    ath_rate_update(sc, ni, nrate);

    curr_bitrate = (rs->rs_rates[nrate] & IEEE80211_RATE_VAL) / 2;
    old_bitrate = (rs->rs_rates[ni->ni_txrate & IEEE80211_RATE_VAL])/2;
    /*-reset the parameters-*/
     on->on_tx_ok = 0;
     on->on_tx_err = 0;
     on->on_tx_retr = 0;
     on->on_tx_upper = 0;
    }

    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_attach(struct ath_softc *sc)

    *  DESCRIPTION:        
    *---------------------------------------------------------------------*/
    struct ath_ratectrl *
    ath_rate_attach(struct ath_softc *sc)
    {
    struct arf_softc *osc;

    osc = kmalloc(sizeof(struct arf_softc), GFP_ATOMIC);
    if (osc == NULL)
    return NULL;
    osc->arc.arc_space = sizeof(struct arf_node);
    osc->arc.arc_vap_space = 0;

    return &osc->arc;
    }
    EXPORT_SYMBOL(ath_rate_attach);

    /*---------------------------------------------------------------------*
    *  FUNCTION:              ath_rate_detach(struct ath_ratectrl *arc)
    *  DESCRIPTION:        
    *---------------------------------------------------------------------*/
    void
    ath_rate_detach(struct ath_ratectrl *arc)
    {
    struct onoe_softc *osc = (struct onoe_softc *) arc;

    kfree(osc);
    }
    EXPORT_SYMBOL(ath_rate_detach);



    /*---------------------------PROC FILE SYSTEM--------------------------*/
    #ifdef CONFIG_SYSCTL

    static int
    proc_read_nodes(struct ieee80211vap *vap, char *buf, int space)
    {
    char *p = buf;
    // p += sprintf(p, "curr_rate %3d\t Old_rate %3d\t tries_0 %3d\t tries_1 %3d\t tries_2 %3d\t tries_3 %3d\t finaltxind %3d\n",curr_bitrate,old_bitrate,tries_0,tries_1,tries_2,tries_3,final_idx);
    p += sprintf(p ,"total_pkts\t54_pkts\t48_pkts\t36_pkts\t24_pkts\t18_pkts\t12_pkts\t9_pkts\t6_pkts\n");
    p += sprintf(p, "%3d\t%3d\t%3d\t%3d\t%3d\t%3d\t%3d\t%3d\t%3d\n",
    msr.total_pkts,msr.p54_pkts,msr.p48_pkts, msr.p36_pkts,
    msr.p24_pkts, msr.p18_pkts, msr.p12_pkts,
    msr.p9_pkts,msr.p6_pkts);
    return (p - buf);
    }

    int
    proc_ratearf_open(struct inode *inode, struct file *file)
    {
    struct proc_ieee80211_priv *pv = NULL;
    struct proc_dir_entry *dp = PDE(inode);
    struct ieee80211vap *vap = dp->data;

    if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv),
    GFP_KERNEL)))
    return -ENOMEM;

    /* intially allocate both read and write buffers */
    pv = (struct proc_ieee80211_priv *) file->private_data;
    memset(pv, 0, sizeof(struct proc_ieee80211_priv));
    pv->rbuf = vmalloc(MAX_PROC_IEEE80211_SIZE);
    if (!pv->rbuf) {
    kfree(pv);
    return -ENOMEM;
    }
    pv->wbuf = vmalloc(MAX_PROC_IEEE80211_SIZE);
    if (!pv->wbuf) {
    vfree(pv->rbuf);
    kfree(pv);
    return -ENOMEM;
    }
    memset(pv->wbuf, 0, MAX_PROC_IEEE80211_SIZE);
    memset(pv->rbuf, 0, MAX_PROC_IEEE80211_SIZE);
    pv->max_wlen = MAX_PROC_IEEE80211_SIZE;
    pv->max_rlen = MAX_PROC_IEEE80211_SIZE;

    /* now read the data into the buffer */
    pv->rlen = proc_read_nodes(vap, pv->rbuf, MAX_PROC_IEEE80211_SIZE);
    return 0;
    }


    static struct file_operations proc_ratearf_ops = {
    .read = NULL,
    .write = NULL,
    .open = proc_ratearf_open,
    .release = NULL,
    };

    void
    ath_rate_dynamic_proc_register(struct ieee80211vap *vap)
    {
            /* Create proc entries for the rate control algorithm */
    ieee80211_proc_vcreate(vap, &proc_ratearf_ops, "ratestats");

    }

    EXPORT_SYMBOL(ath_rate_dynamic_proc_register);
    #endif /* CONFIG_SYSCTL */



    /*------------------------MODULE DESCRIPTION-----------------------------*/
    //static struct ctl_table_header *ath_sysctl_header;
    #include "release.h"
    static char *version = "1.0 (" RELEASE_VERSION ")";
    static char *dev_info = "ath_rate_arf";

    MODULE_AUTHOR("MWNL, Lochan Verma");
    MODULE_DESCRIPTION("Automatic ratefallback algorithm for Atheros devices");
    #ifdef MODULE_VERSION
    MODULE_VERSION(RELEASE_VERSION);
    #endif
    #ifdef MODULE_LICENSE
    MODULE_LICENSE("Dual BSD/GPL");

    static int __init
    init_ath_rate_arf(void)
    {
    printk(KERN_INFO "%s: %s\n", dev_info, version);
    #if 0
    #ifdef CONFIG_SYSCTL
    ath_sysctl_header = register_sysctl_table(ath_root_table, 1);
    #endif
    #endif
    return (0);
    }
    module_init(init_ath_rate_arf);

    static void __exit
    exit_ath_rate_arf(void)
    {
    #if 0
    #ifdef CONFIG_SYSCTL
    if (ath_sysctl_header != NULL)
    unregister_sysctl_table(ath_sysctl_header);
    #endif
    #endif
    printk(KERN_INFO "%s: unloaded\n", dev_info);
    }
    module_exit(exit_ath_rate_arf);

    #endif
    멋진남자의 꼬릿말입니다

















    이 게시물을 추천한 분들의 목록입니다.
    [1] 2010/03/20 08:25:41  112.162.***.12  검은모래
    [2] 2010/10/27 22:14:14  66.249.***.194  
    푸르딩딩:추천수 3이상 댓글은 배경색이 바뀝니다.
    (단,비공감수가 추천수의 1/3 초과시 해당없음)

    죄송합니다. 댓글 작성은 회원만 가능합니다.

    번호 제 목 이름 날짜 조회 추천
    160
    lockinfo 질문드립니다. [2] 멋진남자 10/06/02 22:08 26 0
    159
    유투브 팁 - 버퍼링 문제 해결 [1] 멋진남자 10/06/01 23:57 46 0
    158
    김태균 성적 [1] 멋진남자 10/06/01 22:07 182 1
    157
    e스포츠협회, 블리자드 강력 비난 “NDA 맺은적 없다” [1] 멋진남자 10/05/31 15:09 137 3
    156
    으흐흐흐 멋진남자 10/05/26 10:16 89 0
    155
    전쟁 때문에 불안하신분 보십시오 [7] 멋진남자 10/05/25 19:54 273 1
    154
    [We rule] 오유인 위룰 아이디 Ver. 2.0 [4] 멋진남자 10/05/23 16:48 137 3
    153
    [We rule] 오유인 위룰 아이디 Ver. 1.0 [4] 멋진남자 10/05/15 01:47 111 2
    152
    EU '左의 몰락' 멋진남자 10/05/13 16:56 140 2
    151
    근데 아이폰은 언제 쯤 FMC 될까요? [2] 멋진남자 10/05/12 17:37 146 1
    150
    당신들 이야기.... [2] 멋진남자 10/05/06 16:52 124 2
    149
    혹시 자동 실행 취소 되는분 있나요? (탈옥후) [2] 멋진남자 10/05/06 06:31 112 0
    148
    플레티넘 가기 [1] 멋진남자 10/05/01 06:40 129 0
    147
    긔여운 감염충 멋진남자 10/04/24 05:39 195 0
    146
    Well-done 고기 먹으면 방광암 위험 2배증가 [1] 멋진남자 10/04/21 15:38 434 4
    145
    옆 학교가 있자나요, 아님 다른과 ~ [6] 멋진남자 10/04/14 18:41 657 10
    144
    혹시 LG 070 SIP해킹 해보신분 있나요? [1] 멋진남자 10/04/11 01:58 116 0
    143
    무법차 (헬리온)의 재발견 (2) [1] 멋진남자 10/03/22 12:23 253 2
    아 다짰다. [6] 멋진남자 10/03/20 07:47 237 1
    141
    탈옥 질문 [1] 멋진남자 10/03/19 00:27 93 0
    140
    노비 구제 방안 나왔네요. [1] 멋진남자 10/03/17 15:50 186 0
    139
    웹디스크 2ndrive [1] 멋진남자 10/03/17 04:53 143 0
    138
    아이폰 배경 색 변경방법? [1] 멋진남자 10/03/12 19:10 84 0
    137
    원도7 비스타등에서 한글 쓰는법 멋진남자 10/03/12 11:46 142 0
    136
    폰바꿀 생각인데 고민이군요. [2] 멋진남자 10/03/05 16:22 162 0
    135
    삼성 안드로이드폰 정보 공유좀 [1] 멋진남자 10/03/03 18:42 93 0
    134
    [NY Times] 김연아 점프의 과학 [2] 멋진남자 10/02/26 15:28 441 5
    133
    지금 실격 준 심판이 [4] 멋진남자 10/02/25 11:59 392 0
    132
    김연아도 대단하지만 이승훈이 더 대박... [2] 멋진남자 10/02/24 13:51 370 5
    131
    친추 해봐요! 멋진남자 10/02/22 23:59 55 0
    [◀이전10개] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [다음10개▶]
    단축키 운영진에게 바란다(삭제요청/제안) 운영게 게시판신청 자료창고 보류 개인정보취급방침 청소년보호정책 모바일홈