Okay so the filters were adjusted to
Code: Select all
typedef struct mii_macaddr_hash_table_t
{
unsigned polys[2];
unsigned num_entries;
mii_macaddr_hash_table_entry_t entries[MII_MACADDR_HASH_TABLE_SIZE];
unsigned wantsAll;
unsigned wantsUnwanted;
} mii_macaddr_hash_table_t;
and
Code: Select all
unsigned mii_macaddr_hash_lookup(mii_macaddr_hash_table_t *table,
unsigned key0,
unsigned key1,
unsigned *appdata)
{
if (key0 == 0 && key1 == 0)
return 0;
// Always perform both lookups to ensure lookup time remains
// relatively constant
unsigned int x = hash(key0, key1, table->polys[0]);
unsigned int y = hash(key0, key1, table->polys[1]);
if (key0 == table->entries[y].id[0] &&
key1 == table->entries[y].id[1]) {
*appdata = table->entries[y].appdata;
return (table->entries[y].result | table->wantsAll);
}
if (key0 == table->entries[x].id[0] &&
key1 == table->entries[x].id[1]) {
*appdata = table->entries[x].appdata;
return (table->entries[x].result | table->wantsAll);
}
printhexln(count++);
return (table->wantsAll | table->wantsUnwanted);
}
both to be found in macaddr_filter_hash.c. Something equivalent was done in macaddr_filter.c.
With additional interface functions for the Config-interface
Code: Select all
case i_cfg[int i].give_all_packets(size_t ifnum):
rgmii_add_client_wants_all(ifnum);
break;
case i_cfg[int i].not_give_all_packets(size_t ifnum):
rgmii_remove_client_wants_all(ifnum);
break;
case i_cfg[int i].give_unwanted_packets(size_t ifnum):
rgmii_add_client_wants_unwanted(ifnum);
break;
case i_cfg[int i].not_give_unwanted_packets(size_t ifnum):
rgmii_remove_client_wants_unwanted(ifnum);
break;
it is possible to register clients for wanting all/unwantend packets:
Code: Select all
// get the tasks RX client index and let CFG know that we want aaaaaaall packets
unsigned int index = ethRx_if.get_index();
ethCfg_if.give_all_packets(index);
by setting a bit in
wantsAll or
wantsUnwantend
Code: Select all
void rgmii_add_client_wants_all(unsigned ifnum){
backup_table->wantsAll |= (1 << ifnum);
swap_tables(0);
backup_table->wantsAll |= (1 << ifnum);
}
void rgmii_remove_client_wants_all(unsigned ifnum){
backup_table->wantsAll &= ~(1 << ifnum);
swap_tables(0);
backup_table->wantsAll &= ~(1 << ifnum);
}
(and the same for 'unwanted' instead of 'all')
It seems like the changes
do not achieve what I wanted. I registered a thread for "wantsAll", b
ut it does never get any packets.
EDIT: It works well, I just had a flaw in my bridge thread that sends ethernet data to a serial interface: On finishing a serial transmit, the serial server notifys the bridge that it is ready to send another packet. On receiving the notification, the bridge needs to acknowledge and then get another ethernet packet. I simply forgot to acknowledge, so no additional packet was sent.