⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linkcache.h

📁 Vitual Ring Routing 管你知不知道
💻 H
字号:
// -*- 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/.
//

#ifndef __LINKCACHE_H__
#define __LINKCACHE_H__
#include "sr.h"

typedef struct Link Link; 

typedef struct Rtt {
    uint SentProbes;            // Number of probes sent.
    uint LostProbes;            // Count of probes deemed lost.
    uint LateProbes;            // Count of probes received late. 
    uint RawMetric;             // Raw metric. 
    uint LastRTT;               // Last measured RTT.
    LARGE_INTEGER LastProbe;    // When we last probed this link.
    Time ProbeTimeout;          // When does RttSendProbes need to be called?
    Time HysteresisTimeout;     // When does RttUpdateMetric needs to be called?
} Rtt;

// 
// If you change this, remember to change 
// VRR_INFO_MAX_PKTPAIR_HISTORY in ntdvrr.h
//
#define MAX_PKTPAIR_HISTORY 30 

typedef struct MinHistory {
    uint Min; 
    uint Seq;
} MinHistory; 

typedef struct PktPair {
    //
    // Probe sender maintains the following variables. 
    //
    uint ProbeSeq;              // Probe sequence number.
    uint PairsSent;             // Number of pairs sent.
    uint RepliesSent;           // Number of replies sent on this link.
    uint RepliesRcvd;           // Number of replies received on this link.
    uint LostPairs;             // Count of pairs deemed lost.
    Time ProbeTimeout;          // 
    uint Outstanding;           // Sequence number of last otstanding probe. 
    uint Delta;                 // Last update to metric. 
    uint RTT;                   // The RTT metric - we compute for free. 
    uint LastRTT;               // Last RTT sample.  
    uint LastPktPair;           // Last PacketPair sample.
    //
    // Probe receiver maintains these. 
    //
    Time LastProbeTimestamp;    // Timestamp carried in the last probe.
    Time TimeLastProbeRcvd;     // Time last probe was received.  
    uint LastProbeSeq;          // Sequence number of last probe.
    //
    // Min time history. Each entry is a minimum over last two minutes. 
    // The first buffer maintains current data, the second one is for 
    // reading. Ensures that we will read consistently. 
    //
    uint CurrMin;           // Current min.
    Time NextMinTime;       // Next time we copy the current in in History.
    uint NumSamples;        // Total number of samples so far.
    MinHistory MinHistory[MAX_PKTPAIR_HISTORY];  // History.
} PktPair;

typedef struct {   
    Time RcvdTS;                // When was this probe received. 
} ProbeHistory; 

#define MAX_ETX_PROBE_HISTORY 50 

typedef struct Etx {
    uint TotSentProbes;         // Total number of probes sent.
    uint TotRcvdProbes;         // Total number of probes received.
    uint FwdDeliv;              // Number of probes that we sent
                                // that got through in one LossInterval, 
                                // as per last report by this host. 
    uint ProbeHistorySZ;        // Number of probes we have in the history.
                                // This is also the RevDeliv, i.e. the
                                // number the number of probes that
                                // the other node sent that got
                                // through to us in last LossInterval.
    ProbeHistory PH[MAX_ETX_PROBE_HISTORY];
                                // History of last few probes received on
                                // this link. Maintained as a circular queue.
    uint PHStart; 
    uint PHEnd; 
    uint LastProb;
} Etx;

typedef struct Wcett {
    Etx Etx;
    PktPair PktPair;
    uint MaxBandwidth;  // Max Bandwidth, defined by the physical adapter.
    uint NumPktPairValid;
    uint NumPktPairInvalid;
} Wcett;

typedef union MetricInfo {
    Rtt Rtt;
    PktPair PktPair;
    Etx Etx;
    Wcett Wcett;
} MetricInfo;

struct Link {
    Link *NextOut;              // Next link in a Node's AdjOut list.
    Link **PrevOut;             // Prev link in a Node's AdjOut list.

    Link *NextIn;               // Next link in a Node's AdjIn list.
    Link **PrevIn;              // Prev link in a Node's AdjIn list.

    uint RefCnt;                // How many cached routes use this link.
#if DBG
    uint CheckRefCnt;
#endif

    int sourceIndex;            // Index of source node.
    int targetIndex;            // Index of target node.
    VRRIf outif;               // Outgoing interface on source node.
    VRRIf inif;                // Incoming interface on target node.

    Time TimeStamp;             // When was the link last updated.
    union {
        uint Metric;            // Metric to route on.
        WCETTMetric wcett;
    };
    MetricInfo MetricInfo;      // Information that is metric-specific.
    uint Usage;                 // Count of packets traversing this link.
    uint Failures;              // Count of link failures (adj links only).
    uint DropRatio;             // Ratio of packets on link to drop.
    uint ArtificialDrops;       // Count of packets artificially dropped.
    uint QueueDrops;            // Count of packets dropped b/c tx queue full.
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -