You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!mac_rx_frame_list[i].in_use&&mac_rx_frame_list[i].buffersize >= size_required) {
89
+
mac_rx_frame_list[i].in_use= true;
90
+
printf("handing out %d %p\n", i, mac_rx_frame_list[i].buffer);
91
+
returnmac_rx_frame_list[i].buffer;
92
+
}
93
+
}
94
+
returnNULL;
95
+
}
96
+
97
+
/*Called from the Rust MAC stack, to pass a previously obtained data frame buffer to ESP-NETIF. Expects the frame to be in Ethernet format. Does not take ownership of the data*/
98
+
voidrs_rx_mac_frame(uint8_t*frame, size_tlen) {
99
+
openmac_netif_receive(frame, len);
100
+
}
101
+
102
+
/*
103
+
Called from the ESP-NETIF stack to recycle a MAC RX frame after it was sent. Takes ownership of the buffer.
104
+
*/
105
+
voidc_recycle_mac_rx_frame(uint8_t*buffer) {
106
+
printf("recycling %p\n", buffer);
107
+
for (inti=0; i<NUM_RX_BUFFERS; i++) {
108
+
if (mac_rx_frame_list[i].buffer==buffer) {
109
+
mac_rx_frame_list[i].in_use= false;
110
+
return;
111
+
}
112
+
}
113
+
// if we reached this, we somehow recycled a frame that wasn't in the list
114
+
abort();
115
+
}
116
+
64
117
/*Called from the Rust MAC stack, to obtain a smart frame from the hardware, which can then be filled in*/
Called from the hardware stack to recycle a smart frame after it was sent
87
135
*/
@@ -125,18 +173,15 @@ void rs_mark_iface_down() {
125
173
openmac_netif_down();
126
174
}
127
175
128
-
/*Called from the Rust MAC stack, to pass a data frame to the IP stack. Expects the frame to be in Ethernet format. Does not take ownership of the data*/
129
-
voidrs_rx_mac_frame(uint8_t*frame, size_tlen) {
130
-
openmac_netif_receive(frame, len);
131
-
}
132
-
133
-
voidrs_recycle_data_frame(uint8_t*frame) {
134
-
free(frame);
176
+
voidrs_recycle_mac_tx_data(uint8_t*data) {
177
+
free(data);
135
178
}
136
179
137
-
// Called from the C stack to request the Rust MAC stack to TX a frame
180
+
// Called from the C ESP-NETIF stack to request the Rust MAC stack to TX a frame
138
181
// This function does NOT take ownership of the frame, so you're allowed to reuse the buffer directly after this returns
0 commit comments