BridgeIF: Move FDB implementation into a separate file, implementation is easier to understand like this.

This commit is contained in:
Dirk Ziegelmeier
2017-10-18 18:27:35 +02:00
parent 8a46a853d2
commit b3a379c239
5 changed files with 219 additions and 187 deletions

View File

@@ -92,4 +92,28 @@ err_t bridgeif_add_port(struct netif *bridgeif, struct netif *portif);
err_t bridgeif_fdb_add(struct netif *bridgeif, const struct eth_addr *addr, bridgeif_portmask_t ports);
err_t bridgeif_fdb_remove(struct netif *bridgeif, const struct eth_addr *addr);
/* FDB interface, can be replaced by own implementation */
void bridgeif_fdb_update_src(void *fdb_ptr, struct eth_addr *src_addr, u8_t port_idx);
bridgeif_portmask_t bridgeif_fdb_get_dst_ports(void *fdb_ptr, struct eth_addr *dst_addr);
void* bridgeif_fdb_init(u16_t max_fdb_entries);
#if BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
#ifndef BRIDGEIF_DECL_PROTECT
/* define bridgeif protection to sys_arch_protect... */
#include "lwip/sys.h"
#define BRIDGEIF_DECL_PROTECT(lev) SYS_ARCH_DECL_PROTECT(lev)
#define BRIDGEIF_READ_PROTECT(lev) SYS_ARCH_PROTECT(lev)
#define BRIDGEIF_READ_UNPROTECT(lev) SYS_ARCH_UNPROTECT(lev)
#define BRIDGEIF_WRITE_PROTECT(lev)
#define BRIDGEIF_WRITE_UNPROTECT(lev)
#endif
#else /* BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT */
#include "lwip/tcpip.h"
#define BRIDGEIF_DECL_PROTECT(lev)
#define BRIDGEIF_READ_PROTECT(lev)
#define BRIDGEIF_READ_UNPROTECT(lev)
#define BRIDGEIF_WRITE_PROTECT(lev)
#define BRIDGEIF_WRITE_UNPROTECT(lev)
#endif /* BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT */
#endif /* LWIP_HDR_NETIF_BRIDGEIF_H */

View File

@@ -58,14 +58,6 @@
#define BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT NO_SYS
#endif
/** BRIDGEIF_EXTERNAL_FDB==1: use an external implementation for the forwarding
* database which is possibly faster than our example implementation.
* (Watch out for concurrent access!)
*/
#ifndef BRIDGEIF_EXTERNAL_FDB
#define BRIDGEIF_EXTERNAL_FDB 0
#endif
/** BRIDGEIF_MAX_PORTS: this is used to create a typedef used for forwarding
* bit-fields: the number of bits required is this + 1 (for the internal/cpu port)
* (63 is the maximum, resulting in an u64_t for the bit mask)