Rime sniffers must be called for all transmissions, even if they failed, to get energy attribution right. This means that rime output sniffers now also must take the MAC transmission status as an argument.
This commit is contained in:
parent
cae8ef206a
commit
dfaf4afc8e
@ -94,7 +94,7 @@ extern const struct mac_driver *rime_mac;
|
||||
struct rime_sniffer {
|
||||
struct rime_sniffer *next;
|
||||
void (* input_callback)(void);
|
||||
void (* output_callback)(void);
|
||||
void (* output_callback)(int mac_status);
|
||||
};
|
||||
|
||||
#define RIME_SNIFFER(name, input_callback, output_callback) \
|
||||
|
@ -151,7 +151,7 @@ static void
|
||||
packet_sent(void *ptr, int status, int num_tx)
|
||||
{
|
||||
struct channel *c = ptr;
|
||||
|
||||
struct rime_sniffer *s;
|
||||
|
||||
switch(status) {
|
||||
case MAC_TX_COLLISION:
|
||||
@ -167,13 +167,10 @@ packet_sent(void *ptr, int status, int num_tx)
|
||||
PRINTF("rime: error %d after %d tx\n", status, num_tx);
|
||||
}
|
||||
|
||||
if(status == MAC_TX_OK) {
|
||||
struct rime_sniffer *s;
|
||||
/* Call sniffers, but only if the packet was sent. */
|
||||
for(s = list_head(sniffers); s != NULL; s = list_item_next(s)) {
|
||||
if(s->output_callback != NULL) {
|
||||
s->output_callback();
|
||||
}
|
||||
/* Call sniffers, pass along the MAC status code. */
|
||||
for(s = list_head(sniffers); s != NULL; s = list_item_next(s)) {
|
||||
if(s->output_callback != NULL) {
|
||||
s->output_callback(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user