亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? maintbuf.c

?? Vitual Ring Routing 管你知不知道
?? C
?? 第 1 頁 / 共 3 頁
字號:
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil -*- (for GNU Emacs)
//
// (c) Microsoft Corporation. All rights reserved. 
//
// This file is part of the Microsoft Virtual Ring Routing distribution.
// You should have received a copy of the Microsoft Research Shared Source
// license agreement (MSR-SSLA) for this software; see the file "license.txt".
// If not, please see http://research.microsoft.com/vrr/license.htm,
// or write to Microsoft Research, One Microsoft Way, Redmond, WA 98052-6399.
//
// This file is derived from the Microsoft Research Mesh Connectivity Layer,
// available under the MSR-SSLA license, and downloadable from
// http://research.microsoft.com/mesh/.
//

#include "headers.h"

//* MaintBufAckExpected
//
//  Returns TRUE if we expect to receive an ack, that is,
//  we have any unacknowledged ack requests outstanding.
//
__inline boolint
MaintBufAckExpected(MaintBufNode *MBN)
{
    return (VRRAckId)(MBN->LastAckNum + 1) != MBN->NextAckNum;
}

//* MaintBufValidAck
//
//  Returns TRUE if AckNum is a valid sequence number, that is,
//  corresponds to an unacknowledged ack request.
//
__inline boolint
MaintBufValidAck(
    MaintBufNode *MBN,
    VRRAckId AckNum)
{
    //
    // LastAckNum is the last acknowledged sequence number,
    // and NextAckNum is the next sequence number that will be used.
    // NB: The sequence numbers can wrap.
    //
    return ((0 < (VRRAckId)(AckNum - MBN->LastAckNum)) &&
            ((VRRAckId)(AckNum - MBN->LastAckNum) <
             (VRRAckId)(MBN->NextAckNum - MBN->LastAckNum)));
}

//* MaintBufAckNum
//
//  Returns the most-recently used sequence number.
//
__inline VRRAckId
MaintBufAckNum(MaintBufNode *MBN)
{
    return (VRRAckId)(MBN->NextAckNum - 1);
}

//* MaintBufNew
//
//  Allocates a new maintenance buffer.
//
MaintBuf *
MaintBufNew(void)
{
    MaintBuf *MB;

    MB = ExAllocatePool(NonPagedPool, sizeof *MB);
    if (MB == NULL)
        return NULL;

    KeInitializeSpinLock(&MB->Lock);
    MB->MBN = NULL;

    MB->NumPackets = 0;
    MB->HighWater = 0;

    return MB;
}

//* MaintBufFree
//
//  Frees an existing maintenance buffer.
//
void
MaintBufFree(MiniportAdapter *VA)
{
    MaintBuf *MB = VA->MaintBuf;
    MaintBufNode *MBN;
    MaintBufPacket *MBP;

    //
    // Free the node structures.
    // There can be internally-generated packets waiting to be sent.
    //
    while ((MBN = MB->MBN) != NULL) {
        MB->MBN = MBN->Next;
        VrrKdPrint("Free MBN(s)",MBN->Address,NULL);

        while ((MBP = MBN->MBP) != NULL) {
            SRPacket *SRP = MBP->srp;

            MBN->MBP = MBP->Next;
            VrrKdPrint("MaintBufFree: complete pkt on MBN(s)",MBN->Address,NULL);

            (*SRP->TransmitComplete)(VA, SRP, NDIS_STATUS_SUCCESS);
            ExFreePool(MBP);
        }

        ExFreePool(MBN);
    }

    ExFreePool(MB);
}

//* MaintBufFindNode
//
//  Find a MaintBufNode with specified address and interfaces.
//  If one doesn't exist, creates it.
//
//  Called with the MaintBuf locked.
//
MaintBufNode *
MaintBufFindNode(MaintBuf *MB,
                 const VirtualAddress Address,
                 VRRIf InIf, VRRIf OutIf)  // gregos ToDo: rename InIf=>LocIF OutIf=>RemIF
{
    MaintBufNode *MBN;

    //
    // Search for an existing MaintBufNode.
    //
    for (MBN = MB->MBN; MBN != NULL; MBN = MBN->Next) {
        if (VirtualAddressEqual(MBN->Address, Address) &&
            (MBN->InIf == InIf) &&
            (MBN->OutIf == OutIf))
            return MBN;
    }

    //
    // Create a new MaintBufNode for this node.
    //
    MBN = ExAllocatePool(NonPagedPool, sizeof *MBN);
    if (MBN == NULL)
        return NULL;

    RtlZeroMemory(MBN, sizeof *MBN);
    RtlCopyMemory(MBN->Address, Address, SR_ADDR_LEN);
    MBN->OutIf = OutIf;
    MBN->InIf = InIf;
    MBN->LastAckNum = (VRRAckId)-1;

    //
    // Add the new node to the Maintenance Buffer.
    //
    MBN->Next = MB->MBN;
    MB->MBN = MBN;

    return MBN;
}

//* MaintBufPacketRelease
//
//  Releases a reference for a MaintBufPacket.
//
void
MaintBufPacketRelease(
    MiniportAdapter *VA,
    MaintBufPacket *MBP)
{
    if (InterlockedDecrement((PLONG)&MBP->RefCnt) == 0) {
        SRPacket *srp = MBP->srp;
        //
        // There is no outstanding use of this MaintBufPacket,
        // so deallocate it and complete the packet.
        //
        (*srp->TransmitComplete)(VA, srp, NDIS_STATUS_SUCCESS);
        ExFreePool(MBP);
    }
}

//* MaintBufTransmitComplete
//
//  Called when ProtocolTransmit finishes transmitting a packet that is
//  in the maintenance buffer. Releases a reference to the MBP.
//
void
MaintBufTransmitComplete(
    MiniportAdapter *VA,
    NDIS_PACKET *Packet,
    NDIS_STATUS Status)
{
    MaintBufPacket *MBP = PC(Packet)->MBP;

    UNREFERENCED_PARAMETER(Status);

    NdisFreePacketClone(Packet);

    MaintBufPacketRelease(VA, MBP);
}

//* MaintBufAddPacket
//
//  Adds a MaintBufPacket to a MaintBufNode,
//  returning an NDIS_PACKET to transmit.
//  Adds a reference to the MaintBufPacket
//  when returning non-NULL.
//
//  Our caller must update MBN->FirstAckReq, MBN->LackAckReq,
//  and MBN->NumAckReqs.
//
//  Called with the MaintBuf locked.
//
static NDIS_PACKET *
MaintBufAddPacket(
    MiniportAdapter *VA,
    MaintBufNode *MBN,
    MaintBufPacket *MBP)
{
    MaintBuf *MB = VA->MaintBuf;
    SRPacket *srp = MBP->srp;
    NDIS_PACKET *Packet;
    NDIS_STATUS Status;

    //
    // Get the Ack identifier for this packet.
    //
    MBP->AckNum = srp->ackreq->opt.identification = MBN->NextAckNum++;
    VrrTrace(VA,3,"MB:AR=2Pkt",srp->ackreq->opt.Source,srp->Token.NextVAddress,srp->ackreq->opt.Dest,"SeqNo",srp->ackreq->opt.identification,NULL,0);

    //
    // Add the MaintBufPacket to the MaintBufNode.
    //
    MBP->Next = MBN->MBP;
    MBN->MBP = MBP;

    if (++MBN->NumPackets > MBN->HighWater)
        MBN->HighWater = MBN->NumPackets;
    if (++MB->NumPackets > MB->HighWater)
        MB->HighWater = MB->NumPackets;

    Status = SRPacketToPkt(VA, srp, &Packet);

    if (Status != NDIS_STATUS_SUCCESS) {
        //
        // We do not add a reference to MBP.
        //
        return NULL;
    }
    else {
        //
        // Add a reference to MBP for MaintBufTransmitComplete.
        //
        InterlockedIncrement((PLONG)&MBP->RefCnt);
        return Packet;
    }
}

//* MaintBufTransmit
//
//  If Packet is non-NULL, our caller provides a reference
//  for the MaintBufPacket that we pass through
//  to MaintBufTransmitComplete.
//
//  Called with the MaintBuf locked.
//
static void
MaintBufTransmit(
    MiniportAdapter *VA,
    MaintBufPacket *MBP,
    NDIS_PACKET *Packet)
{
    if (Packet == NULL) {
        //
        // MaintBufAddPacket did not give us a ref for MBP.
        // MaintBufTimer will retransmit.
        //
        return;
    }

#if DBG
    if (MBP->srp == NULL)
        VrrTrace(VA,3,"MB:MP=Tx__",NULL,NULL,NULL,NULL,0,NULL,0);
    else
        VrrTrace(VA,3,"MB:MP=Tx__",MBP->srp->Dest,MBP->srp->Token.NextVAddress,MBP->srp->Token.NextVAddress,
               "FrameSeqNo",MBP->srp->FrameSeqNo,NULL,0);
#endif

    //
    // MaintBufTransmitComplete needs these fields.
    // We have a reference for MBP from MaintBufAddPacket
    // that we pass on to MaintBufTransmitComplete.
    //
    PC(Packet)->TransmitComplete = MaintBufTransmitComplete;
    PC(Packet)->MBP = MBP;

    if (PC(Packet)->PA == NULL) {
        //
        // This means the source route is trying to use a physical adapter
        // that no longer exists. 
        // REVIEW - We know this packet will never transmit successfully,
        // so we could immediately try salvaging instead of letting
        // MaintBufTimer get there eventually. But this is a rare situation.
        //
        VrrKdPrint("MaintBufTransmit PC(Packet)->PA == NULL",MBP->srp->Source, MBP->srp->Dest);
        MaintBufTransmitComplete(VA, Packet, NDIS_STATUS_FAILURE);
        return;
    }
    ProtocolTransmit(PC(Packet)->PA, Packet);
}

//* TxQueueIsFull
//
//  Checks if sending this packet would overflow
//  the transmit queue of the outgoing interface.
//  Returns FALSE to indicate the packet should 
//  be dropped.
//
boolint
TxQueueIsFull(
    MiniportAdapter *VA,
    SRPacket *SRP)
{
    boolint QueueFull;
    //
    // We only want to check for packets that are carrying real payload.
    //
    if (SRP->PacketLength != SRP->PayloadOffset)
        QueueFull = ProtocolQueueFull(VA, SRP->Token.LocIF);
    else
        QueueFull = FALSE;

    return !QueueFull;

}

//* MaintBufCreateAckRequest
//
//  Creates an ack request packet.
//
//  Called with the MaintBuf locked.
//
static SRPacket *
MaintBufCreateAckRequest(
    MiniportAdapter *VA,
    MaintBufNode *MBN)
{
    SRPacket *SRP;
    InternalAcknowledgementRequest *AR;

    //
    // Allocate a packet with which to send the ack request.
    //

    SRP = ExAllocatePool(NonPagedPool, sizeof *SRP);
    if (SRP == NULL)
        return NULL;

    AR = ExAllocatePool(NonPagedPool, sizeof *AR);
    if (AR == NULL) {
        ExFreePool(SRP);
        return NULL;
    }

    //
    // Initialize the packet.
    //
    RtlZeroMemory(SRP, sizeof *SRP);
    RtlCopyMemory(SRP->Dest, MBN->Address, sizeof(VirtualAddress));
    RtlCopyMemory(SRP->Source, VA->Address, sizeof(VirtualAddress));
    SRP->ackreq = AR;

    //
    // Initialize TxToken in the new SRP, taking the IF indices

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品亚洲精品国产欧美| 国产盗摄视频一区二区三区| 蜜桃av一区二区| 国产精品资源在线| 色妞www精品视频| 欧美一级片免费看| 欧美国产激情二区三区 | 国产一区在线不卡| youjizz久久| 91精品国产综合久久精品性色| 亚洲精品一区二区精华| 亚洲少妇30p| 美女视频黄频大全不卡视频在线播放| 丁香婷婷综合激情五月色| 在线观看91精品国产入口| 精品国产乱码久久久久久免费| 亚洲少妇中出一区| 久久精品国产第一区二区三区| 一本大道久久a久久综合婷婷| 日韩午夜激情免费电影| 椎名由奈av一区二区三区| 日韩av午夜在线观看| 91麻豆蜜桃一区二区三区| 欧美电视剧在线看免费| 一区二区三区四区在线播放| 国内精品伊人久久久久av影院 | 亚洲成人资源网| 成人午夜视频在线| 日韩一区二区电影网| 一区二区三区日韩欧美精品| 国产成人亚洲综合a∨婷婷| 欧美日韩1区2区| 亚洲日本成人在线观看| 国产精品一区三区| 欧美一区二区啪啪| 亚洲激情综合网| 成人妖精视频yjsp地址| 欧美r级电影在线观看| 夜夜夜精品看看| 97se亚洲国产综合自在线 | 欧美一区2区视频在线观看| 国产精品理伦片| 精品无人区卡一卡二卡三乱码免费卡| 在线国产电影不卡| 国产精品久久久久aaaa| 国产一区在线观看视频| 日韩一区二区在线观看| 亚洲第一福利一区| 91在线看国产| 国产精品网曝门| 国产一区二区调教| 欧美电影免费观看完整版| 婷婷国产v国产偷v亚洲高清| 欧洲精品一区二区| 亚洲免费在线视频| 成人高清免费观看| 欧美国产国产综合| 国产不卡高清在线观看视频| 日韩欧美国产一区二区三区 | 欧美videossexotv100| 亚洲午夜精品久久久久久久久| 一本大道av一区二区在线播放| 中文字幕欧美一| 成人91在线观看| 亚洲欧洲一区二区三区| 不卡一区在线观看| 国产精品乱子久久久久| 国产不卡免费视频| 最新久久zyz资源站| www.综合网.com| |精品福利一区二区三区| 99国内精品久久| 亚洲精品高清视频在线观看| 91蝌蚪porny| 伊人夜夜躁av伊人久久| 在线观看av不卡| 婷婷激情综合网| 欧美一级黄色录像| 久热成人在线视频| 久久婷婷综合激情| 国产精品456| 中文字幕av一区二区三区高| 成人黄色小视频| 亚洲品质自拍视频| 欧美午夜精品一区二区蜜桃| 午夜欧美视频在线观看| 日韩美一区二区三区| 国产麻豆精品视频| 国产精品另类一区| 一本大道久久a久久精品综合| 亚洲一区成人在线| 日韩一区二区免费视频| 国内精品免费**视频| 国产亚洲欧美一级| 91美女片黄在线观看91美女| 亚洲国产精品麻豆| 日韩精品一区国产麻豆| 粉嫩高潮美女一区二区三区| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 在线观看日韩电影| 免费在线观看精品| 亚洲国产精品成人久久综合一区| 91在线免费播放| 日本亚洲三级在线| 久久成人精品无人区| 国产午夜精品一区二区三区嫩草 | 亚洲日本一区二区| 欧美精品黑人性xxxx| 国产一区二区h| 一区二区日韩av| 精品动漫一区二区三区在线观看| 国产丶欧美丶日本不卡视频| 一区二区日韩电影| 精品国产sm最大网站| 91在线无精精品入口| 日本大胆欧美人术艺术动态| 青青草91视频| 青青草一区二区三区| 99久久精品国产导航| 亚洲视频在线一区二区| 8x福利精品第一导航| 国产乱子伦一区二区三区国色天香 | 亚洲综合视频网| 日韩精品一区二区三区视频在线观看| 成人18视频日本| 美国十次了思思久久精品导航| 国产精品剧情在线亚洲| 日韩一区二区电影网| 色婷婷综合中文久久一本| 久久超级碰视频| 亚洲激情图片小说视频| 久久综合九色欧美综合狠狠| 欧美午夜电影在线播放| 国产精品一区在线观看乱码| 五月综合激情网| 最新日韩av在线| 国产色综合久久| 日韩欧美一级片| 91久久精品一区二区三区| 国产成人精品一区二区三区四区 | 日韩一级片在线观看| 91免费看`日韩一区二区| 黑人精品欧美一区二区蜜桃| 一区二区成人在线| 一色桃子久久精品亚洲| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美日韩在线播放三区四区| gogogo免费视频观看亚洲一| 久久精品99国产精品| 丝袜美腿亚洲一区二区图片| 亚洲欧美二区三区| 国产精品传媒视频| 久久青草欧美一区二区三区| 91精品国产综合久久久久久漫画| 91色porny在线视频| 成人avav在线| 国产成人av电影在线观看| 久久精品国产在热久久| 午夜精品久久久久久久久久久| 亚洲欧美一区二区三区久本道91 | 一本色道久久综合亚洲aⅴ蜜桃| 国产丶欧美丶日本不卡视频| 寂寞少妇一区二区三区| 日韩av网站免费在线| 亚洲二区视频在线| 亚洲精品成人精品456| 中文字幕一区视频| 国产精品理论在线观看| 国产日韩v精品一区二区| 婷婷一区二区三区| 一区二区三区在线视频免费| 亚洲色图欧美偷拍| 亚洲三级小视频| 日韩一区欧美一区| 中文字幕亚洲一区二区av在线| 中文字幕 久热精品 视频在线| 久久精品一区二区三区不卡| 精品国产a毛片| 国产午夜精品一区二区三区四区| 久久精品欧美日韩| 久久精品人人做人人综合 | www.成人在线| 不卡欧美aaaaa| 91在线你懂得| 欧美中文一区二区三区| 欧美日韩视频在线第一区| 欧美日精品一区视频| 欧美日韩高清一区二区三区| 欧美性猛交一区二区三区精品| 在线精品视频免费播放| 欧美久久久一区| 欧美一区二区视频在线观看2020| 日韩欧美高清dvd碟片| 久久蜜桃一区二区| 中文字幕国产一区二区| 国产精品久久一级| 一区二区三区欧美| 日韩综合在线视频| 卡一卡二国产精品 | 亚洲卡通欧美制服中文|