Revision 4f1c942b hw/rtl8139.c
b/hw/rtl8139.c | ||
---|---|---|
812 | 812 |
} |
813 | 813 |
} |
814 | 814 |
|
815 |
static void rtl8139_do_receive(VLANClientState *vc, const uint8_t *buf, int size, int do_interrupt)
|
|
815 |
static ssize_t rtl8139_do_receive(VLANClientState *vc, const uint8_t *buf, size_t size_, int do_interrupt)
|
|
816 | 816 |
{ |
817 | 817 |
RTL8139State *s = vc->opaque; |
818 |
int size = size_; |
|
818 | 819 |
|
819 | 820 |
uint32_t packet_header = 0; |
820 | 821 |
|
... | ... | |
828 | 829 |
if (!s->clock_enabled) |
829 | 830 |
{ |
830 | 831 |
DEBUG_PRINT(("RTL8139: stopped ==========================\n")); |
831 |
return; |
|
832 |
return -1;
|
|
832 | 833 |
} |
833 | 834 |
|
834 | 835 |
/* first check if receiver is enabled */ |
... | ... | |
836 | 837 |
if (!rtl8139_receiver_enabled(s)) |
837 | 838 |
{ |
838 | 839 |
DEBUG_PRINT(("RTL8139: receiver disabled ================\n")); |
839 |
return; |
|
840 |
return -1;
|
|
840 | 841 |
} |
841 | 842 |
|
842 | 843 |
/* XXX: check this */ |
... | ... | |
854 | 855 |
/* update tally counter */ |
855 | 856 |
++s->tally_counters.RxERR; |
856 | 857 |
|
857 |
return; |
|
858 |
return size;
|
|
858 | 859 |
} |
859 | 860 |
|
860 | 861 |
packet_header |= RxBroadcast; |
... | ... | |
873 | 874 |
/* update tally counter */ |
874 | 875 |
++s->tally_counters.RxERR; |
875 | 876 |
|
876 |
return; |
|
877 |
return size;
|
|
877 | 878 |
} |
878 | 879 |
|
879 | 880 |
int mcast_idx = compute_mcast_idx(buf); |
... | ... | |
885 | 886 |
/* update tally counter */ |
886 | 887 |
++s->tally_counters.RxERR; |
887 | 888 |
|
888 |
return; |
|
889 |
return size;
|
|
889 | 890 |
} |
890 | 891 |
|
891 | 892 |
packet_header |= RxMulticast; |
... | ... | |
909 | 910 |
/* update tally counter */ |
910 | 911 |
++s->tally_counters.RxERR; |
911 | 912 |
|
912 |
return; |
|
913 |
return size;
|
|
913 | 914 |
} |
914 | 915 |
|
915 | 916 |
packet_header |= RxPhysical; |
... | ... | |
926 | 927 |
/* update tally counter */ |
927 | 928 |
++s->tally_counters.RxERR; |
928 | 929 |
|
929 |
return; |
|
930 |
return size;
|
|
930 | 931 |
} |
931 | 932 |
} |
932 | 933 |
|
... | ... | |
993 | 994 |
++s->tally_counters.MissPkt; |
994 | 995 |
|
995 | 996 |
rtl8139_update_irq(s); |
996 |
return; |
|
997 |
return size_;
|
|
997 | 998 |
} |
998 | 999 |
|
999 | 1000 |
uint32_t rx_space = rxdw0 & CP_RX_BUFFER_SIZE_MASK; |
... | ... | |
1013 | 1014 |
++s->tally_counters.MissPkt; |
1014 | 1015 |
|
1015 | 1016 |
rtl8139_update_irq(s); |
1016 |
return; |
|
1017 |
return size_;
|
|
1017 | 1018 |
} |
1018 | 1019 |
|
1019 | 1020 |
target_phys_addr_t rx_addr = rtl8139_addr64(rxbufLO, rxbufHI); |
... | ... | |
1118 | 1119 |
s->IntrStatus |= RxOverflow; |
1119 | 1120 |
++s->RxMissed; |
1120 | 1121 |
rtl8139_update_irq(s); |
1121 |
return; |
|
1122 |
return size_;
|
|
1122 | 1123 |
} |
1123 | 1124 |
|
1124 | 1125 |
packet_header |= RxStatusOK; |
... | ... | |
1156 | 1157 |
{ |
1157 | 1158 |
rtl8139_update_irq(s); |
1158 | 1159 |
} |
1160 |
|
|
1161 |
return size_; |
|
1159 | 1162 |
} |
1160 | 1163 |
|
1161 |
static void rtl8139_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
|
|
1164 |
static ssize_t rtl8139_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
|
|
1162 | 1165 |
{ |
1163 |
rtl8139_do_receive(vc, buf, size, 1); |
|
1166 |
return rtl8139_do_receive(vc, buf, size, 1);
|
|
1164 | 1167 |
} |
1165 | 1168 |
|
1166 | 1169 |
static void rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize) |
Also available in: Unified diff