|
462 |
{ |
462 |
{ |
463 |
static TypeId tid = TypeId ("ns3::WifiRemoteStation") |
463 |
static TypeId tid = TypeId ("ns3::WifiRemoteStation") |
464 |
.SetParent<Object> () |
464 |
.SetParent<Object> () |
465 |
.AddTraceSource ("Ssrc", "The value of the ssrc counter: indicates the number of retransmissions of RTS.", |
465 |
.AddTraceSource ("Ssrc", "The value of the ssrc counter: indicates the number of retransmissions of RTS for non-QoS packets.", |
466 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_ssrc)) |
466 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_ssrc)) |
467 |
.AddTraceSource ("Slrc", "The value of the slrc counter: indicates the number of retransmissions of DATA.", |
467 |
.AddTraceSource ("Slrc", "The value of the slrc counter: indicates the number of retransmissions of DATA for non-QoS packets.", |
468 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_slrc)) |
468 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_slrc)) |
|
|
469 |
.AddTraceSource ("voSsrc", "The value of the ssrc counter for AC_VO access class: indicates the number of retransmissions of RTS for\ |
470 |
packets belonging to voice access class.", |
471 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_voSsrc)) |
472 |
.AddTraceSource ("voSlrc", "The value of the slrc counter AC_VO access class: indicates the number of retransmissions of DATA packets\ |
473 |
belonging to voice access class.", |
474 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_voSlrc)) |
475 |
.AddTraceSource ("viSsrc", "The value of the ssrc counter for AC_VI access class: indicates the number of retransmissions of RTS for\ |
476 |
packets belonging to voice access class.", |
477 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_viSsrc)) |
478 |
.AddTraceSource ("viSlrc", "The value of the slrc counter AC_VI access class: indicates the number of retransmissions of DATA packets\ |
479 |
belonging to voice access class.", |
480 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_viSlrc)) |
481 |
.AddTraceSource ("beSsrc", "The value of the ssrc counter for AC_BE access class: indicates the number of retransmissions of RTS for\ |
482 |
packets belonging to voice access class.", |
483 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_beSsrc)) |
484 |
.AddTraceSource ("beSlrc", "The value of the slrc counter AC_BE access class: indicates the number of retransmissions of DATA packets\ |
485 |
belonging to voice access class.", |
486 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_beSlrc)) |
487 |
.AddTraceSource ("bkSsrc", "The value of the ssrc counter for AC_BK access class: indicates the number of retransmissions of RTS for\ |
488 |
packets belonging to voice access class.", |
489 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_bkSsrc)) |
490 |
.AddTraceSource ("bkSlrc", "The value of the slrc counter AC_BK access class: indicates the number of retransmissions of DATA packets\ |
491 |
belonging to voice access class.", |
492 |
MakeTraceSourceAccessor (&WifiRemoteStation::m_bkSlrc)) |
469 |
; |
493 |
; |
470 |
return tid; |
494 |
return tid; |
471 |
} |
495 |
} |
|
474 |
: m_state (BRAND_NEW), |
498 |
: m_state (BRAND_NEW), |
475 |
m_ssrc (0), |
499 |
m_ssrc (0), |
476 |
m_slrc (0), |
500 |
m_slrc (0), |
|
|
501 |
m_voSsrc (0), |
502 |
m_voSlrc (0), |
503 |
m_viSsrc (0), |
504 |
m_viSlrc (0), |
505 |
m_beSsrc (0), |
506 |
m_beSlrc (0), |
507 |
m_bkSsrc (0), |
508 |
m_bkSlrc (0), |
477 |
m_avgSlrcCoefficient(0.9), |
509 |
m_avgSlrcCoefficient(0.9), |
478 |
m_avgSlrc (0) |
510 |
m_avgSlrc (0) |
479 |
{} |
511 |
{ |
|
|
512 |
m_qosSsrc.insert (std::make_pair (AC_VO, &m_voSsrc)); |
513 |
m_qosSsrc.insert (std::make_pair (AC_VI, &m_viSsrc)); |
514 |
m_qosSsrc.insert (std::make_pair (AC_BE, &m_beSsrc)); |
515 |
m_qosSsrc.insert (std::make_pair (AC_BK, &m_bkSsrc)); |
516 |
|
517 |
m_qosSlrc.insert (std::make_pair (AC_VO, &m_voSlrc)); |
518 |
m_qosSlrc.insert (std::make_pair (AC_VI, &m_viSlrc)); |
519 |
m_qosSlrc.insert (std::make_pair (AC_BE, &m_beSlrc)); |
520 |
m_qosSlrc.insert (std::make_pair (AC_BK, &m_bkSlrc)); |
521 |
} |
480 |
WifiRemoteStation::~WifiRemoteStation () |
522 |
WifiRemoteStation::~WifiRemoteStation () |
481 |
{} |
523 |
{} |
482 |
|
524 |
|
|
675 |
} |
717 |
} |
676 |
} |
718 |
} |
677 |
bool |
719 |
bool |
678 |
WifiRemoteStation::NeedRtsRetransmission (Ptr<const Packet> packet) |
720 |
WifiRemoteStation::NeedRtsRetransmission (const WifiMacHeader *hdr) |
679 |
{ |
721 |
{ |
680 |
return (m_ssrc < GetManager ()->GetMaxSsrc ()); |
722 |
if (hdr->IsQosData ()) |
|
|
723 |
{ |
724 |
AccessClass ac = QosUtilsMapTidToAc (hdr->GetQosTid ()); |
725 |
return ((*m_qosSsrc.find (ac)->second) < GetManager ()->GetMaxSsrc ()); |
726 |
} |
727 |
else |
728 |
{ |
729 |
return (m_ssrc < GetManager ()->GetMaxSsrc ()); |
730 |
} |
681 |
} |
731 |
} |
682 |
|
732 |
|
683 |
bool |
733 |
bool |
684 |
WifiRemoteStation::NeedDataRetransmission (Ptr<const Packet> packet) |
734 |
WifiRemoteStation::NeedDataRetransmission (const WifiMacHeader *hdr) |
685 |
{ |
735 |
{ |
686 |
return (m_slrc < GetManager ()->GetMaxSlrc ()); |
736 |
if (hdr->IsQosData ()) |
|
|
737 |
{ |
738 |
AccessClass ac = QosUtilsMapTidToAc (hdr->GetQosTid ()); |
739 |
return ((*m_qosSlrc.find (ac)->second) < GetManager ()->GetMaxSlrc ()); |
740 |
} |
741 |
else |
742 |
{ |
743 |
return (m_slrc < GetManager ()->GetMaxSlrc ()); |
744 |
} |
687 |
} |
745 |
} |
688 |
|
746 |
|
689 |
bool |
747 |
bool |
|
745 |
} |
803 |
} |
746 |
|
804 |
|
747 |
void |
805 |
void |
748 |
WifiRemoteStation::ReportRtsFailed (void) |
806 |
WifiRemoteStation::ReportRtsFailed (enum AccessClass ac) |
749 |
{ |
807 |
{ |
750 |
m_ssrc++; |
808 |
if (ac == AC_UNDEF) |
|
|
809 |
{ |
810 |
NS_LOG_INFO ("Access class not supported"); |
811 |
NS_ASSERT (false); |
812 |
} |
813 |
else if (ac == AC_BE_NQOS) |
814 |
{ |
815 |
m_ssrc++; |
816 |
} |
817 |
else |
818 |
{ |
819 |
(*m_qosSsrc.find (ac)->second)++; |
820 |
} |
751 |
GetManager ()->NotifyTxRtsFailed (m_address); |
821 |
GetManager ()->NotifyTxRtsFailed (m_address); |
752 |
DoReportRtsFailed (); |
822 |
DoReportRtsFailed (); |
753 |
} |
823 |
} |
754 |
|
824 |
|
755 |
void |
825 |
void |
756 |
WifiRemoteStation::ReportDataFailed (void) |
826 |
WifiRemoteStation::ReportDataFailed (enum AccessClass ac) |
757 |
{ |
827 |
{ |
758 |
m_slrc++; |
828 |
if (ac == AC_UNDEF) |
|
|
829 |
{ |
830 |
NS_LOG_INFO ("Access class not supported"); |
831 |
NS_ASSERT (false); |
832 |
} |
833 |
else if (ac == AC_BE_NQOS) |
834 |
{ |
835 |
m_slrc++; |
836 |
} |
837 |
else |
838 |
{ |
839 |
(*m_qosSlrc.find (ac)->second)++; |
840 |
} |
759 |
GetManager ()->NotifyTxDataFailed (m_address); |
841 |
GetManager ()->NotifyTxDataFailed (m_address); |
760 |
DoReportDataFailed (); |
842 |
DoReportDataFailed (); |
761 |
} |
843 |
} |
762 |
|
844 |
|
763 |
void |
845 |
void |
764 |
WifiRemoteStation::ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr) |
846 |
WifiRemoteStation::ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr, enum AccessClass ac) |
765 |
{ |
847 |
{ |
766 |
m_ssrc = 0; |
848 |
if (ac == AC_UNDEF) |
|
|
849 |
{ |
850 |
NS_LOG_INFO ("Access class not supported"); |
851 |
NS_ASSERT (false); |
852 |
} |
853 |
else if (ac == AC_BE_NQOS) |
854 |
{ |
855 |
m_ssrc = 0; |
856 |
} |
857 |
else |
858 |
{ |
859 |
*m_qosSsrc.find (ac)->second = 0; |
860 |
} |
767 |
DoReportRtsOk (ctsSnr, ctsMode, rtsSnr); |
861 |
DoReportRtsOk (ctsSnr, ctsMode, rtsSnr); |
768 |
} |
862 |
} |
769 |
|
863 |
|
770 |
void |
864 |
void |
771 |
WifiRemoteStation::ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr) |
865 |
WifiRemoteStation::ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr, enum AccessClass ac) |
772 |
{ |
866 |
{ |
773 |
m_avgSlrc = m_avgSlrc * m_avgSlrcCoefficient + (double) m_slrc * (1 - m_avgSlrcCoefficient); |
867 |
m_avgSlrc = m_avgSlrc * m_avgSlrcCoefficient + (double) m_slrc * (1 - m_avgSlrcCoefficient); |
774 |
m_slrc = 0; |
868 |
if (ac == AC_UNDEF) |
|
|
869 |
{ |
870 |
NS_LOG_INFO ("Access class not supported"); |
871 |
NS_ASSERT (false); |
872 |
} |
873 |
else if (ac == AC_BE_NQOS) |
874 |
{ |
875 |
m_slrc = 0; |
876 |
} |
877 |
else |
878 |
{ |
879 |
*m_qosSlrc.find (ac)->second = 0; |
880 |
} |
775 |
DoReportDataOk (ackSnr, ackMode, dataSnr); |
881 |
DoReportDataOk (ackSnr, ackMode, dataSnr); |
776 |
} |
882 |
} |
777 |
|
883 |
|
778 |
void |
884 |
void |
779 |
WifiRemoteStation::ReportFinalRtsFailed (void) |
885 |
WifiRemoteStation::ReportFinalRtsFailed (enum AccessClass ac) |
780 |
{ |
886 |
{ |
781 |
m_ssrc = 0; |
887 |
if (ac == AC_UNDEF) |
|
|
888 |
{ |
889 |
NS_LOG_INFO ("Access class not supported"); |
890 |
NS_ASSERT (false); |
891 |
} |
892 |
else if (ac == AC_BE_NQOS) |
893 |
{ |
894 |
m_ssrc = 0; |
895 |
} |
896 |
else |
897 |
{ |
898 |
*m_qosSsrc.find (ac)->second = 0; |
899 |
} |
782 |
GetManager ()->NotifyTxFinalRtsFailed (m_address); |
900 |
GetManager ()->NotifyTxFinalRtsFailed (m_address); |
783 |
DoReportFinalRtsFailed (); |
901 |
DoReportFinalRtsFailed (); |
784 |
} |
902 |
} |
785 |
|
903 |
|
786 |
void |
904 |
void |
787 |
WifiRemoteStation::ReportFinalDataFailed (void) |
905 |
WifiRemoteStation::ReportFinalDataFailed (enum AccessClass ac) |
788 |
{ |
906 |
{ |
789 |
m_slrc = 0; |
907 |
if (ac == AC_UNDEF) |
|
|
908 |
{ |
909 |
NS_LOG_INFO ("Access class not supported"); |
910 |
NS_ASSERT (false); |
911 |
} |
912 |
else if (ac == AC_BE_NQOS) |
913 |
{ |
914 |
m_slrc = 0; |
915 |
} |
916 |
else |
917 |
{ |
918 |
*m_qosSlrc.find (ac)->second = 0; |
919 |
} |
790 |
GetManager ()->NotifyTxFinalDataFailed (m_address); |
920 |
GetManager ()->NotifyTxFinalDataFailed (m_address); |
791 |
DoReportFinalDataFailed (); |
921 |
DoReportFinalDataFailed (); |
792 |
} |
922 |
} |
793 |
|
923 |
|
794 |
void |
924 |
void |
795 |
WifiRemoteStation::ReportRxOk (double rxSnr, WifiMode txMode) |
925 |
WifiRemoteStation::ReportRxOk (double rxSnr, WifiMode txMode, enum AccessClass ac) |
796 |
{ |
926 |
{ |
|
|
927 |
//How should we use 'ac' parameter here? |
797 |
DoReportRxOk (rxSnr, txMode); |
928 |
DoReportRxOk (rxSnr, txMode); |
798 |
} |
929 |
} |
799 |
} // namespace ns3 |
930 |
} // namespace ns3 |