91#if LWIP_NUM_NETIF_CLIENT_DATA
97struct bridgeif_private_s;
98typedef struct bridgeif_port_private_s {
99 struct bridgeif_private_s *bridge;
100 struct netif *port_netif;
104typedef struct bridgeif_fdb_static_entry_s {
108} bridgeif_fdb_static_entry_t;
110typedef struct bridgeif_private_s {
115 bridgeif_port_t *ports;
116 u16_t max_fdbs_entries;
117 bridgeif_fdb_static_entry_t *fdbs;
118 u16_t max_fdbd_entries;
123static u8_t bridgeif_netif_client_id = 0xff;
138 bridgeif_private_t *br;
141 br = (bridgeif_private_t *)bridgeif->
state;
145 for (
i = 0;
i < br->max_fdbs_entries;
i++) {
146 if (!br->fdbs[
i].used) {
148 if (!br->fdbs[
i].used) {
149 br->fdbs[
i].used = 1;
150 br->fdbs[
i].dst_ports = ports;
171 bridgeif_private_t *br;
174 br = (bridgeif_private_t *)bridgeif->
state;
178 for (
i = 0;
i < br->max_fdbs_entries;
i++) {
182 memset(&br->fdbs[
i], 0,
sizeof(bridgeif_fdb_static_entry_t));
196bridgeif_find_dst_ports(bridgeif_private_t *br,
struct eth_addr *dst_addr)
202 for (
i = 0;
i < br->max_fdbs_entries;
i++) {
203 if (br->fdbs[
i].used) {
211 if (dst_addr->addr[0] & 1) {
226bridgeif_is_local_mac(bridgeif_private_t *br,
struct eth_addr *
addr)
234 for (
i = 0;
i < br->num_ports;
i++) {
235 struct netif *portif = br->ports[
i].port_netif;
236 if (portif !=
NULL) {
249bridgeif_send_to_port(bridgeif_private_t *br,
struct pbuf *
p,
u8_t dstport_idx)
253 if (dstport_idx < br->max_ports) {
254 struct netif *portif = br->ports[dstport_idx].port_netif;
282 if (dstports &
mask) {
283 err = bridgeif_send_to_port(br,
p,
i);
301 bridgeif_private_t *br = (bridgeif_private_t *)
netif->
state;
305 err = bridgeif_send_to_ports(br,
p, dstports);
308 if (((
u8_t *)
p->payload)[0] & 1) {
331 bridgeif_private_t *br;
332 bridgeif_port_t *
port;
336 port = (bridgeif_port_t *)netif_get_client_data(
netif, bridgeif_netif_client_id);
341 br = (bridgeif_private_t *)
port->bridge;
349 if ((
src->addr[0] & 1) == 0) {
354 if (
dst->addr[0] & 1) {
356 dstports = bridgeif_find_dst_ports(br,
dst);
357 bridgeif_send_to_ports(br,
p, dstports);
361 if (br->netif->input(
p, br->netif) !=
ERR_OK) {
372 if (bridgeif_is_local_mac(br,
dst)) {
375 return br->netif->input(
p, br->netif);
379 dstports = bridgeif_find_dst_ports(br,
dst);
380 bridgeif_send_to_ports(br,
p, dstports);
389#if !BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
416 bridgeif_private_t *br;
417 size_t alloc_len_sizet;
422#if !BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
428 if (bridgeif_netif_client_id == 0xFF) {
429 bridgeif_netif_client_id = netif_alloc_client_data_id();
434 LWIP_ASSERT(
"init_data->max_ports <= BRIDGEIF_MAX_PORTS",
437 alloc_len_sizet =
sizeof(bridgeif_private_t) + (init_data->
max_ports *
sizeof(bridgeif_port_t) + (init_data->
max_fdb_static_entries *
sizeof(bridgeif_fdb_static_entry_t)));
439 LWIP_ASSERT(
"alloc_len == alloc_len_sizet", alloc_len == alloc_len_sizet);
441 br = (bridgeif_private_t *)
mem_calloc(1, alloc_len);
446 memcpy(&br->ethaddr, &init_data->
ethaddr,
sizeof(br->ethaddr));
450 br->ports = (bridgeif_port_t *)(br + 1);
453 br->fdbs = (bridgeif_fdb_static_entry_t *)(((
u8_t *)(br + 1)) + (init_data->
max_ports *
sizeof(bridgeif_port_t)));
457 if (br->fdbd ==
NULL) {
463#if LWIP_NETIF_HOSTNAME
465 netif->hostname =
"lwip";
483 netif->output = etharp_output;
486 netif->output_ip6 = ethip6_output;
503#if LWIP_IPV6 && LWIP_IPV6_MLD
510 ip6_addr_t ip6_allnodes_ll;
511 ip6_addr_set_allnodes_linklocal(&ip6_allnodes_ll);
526 bridgeif_private_t *br;
527 bridgeif_port_t *
port;
538 br = (bridgeif_private_t *)bridgeif->
state;
540 if (br->num_ports >= br->max_ports) {
543 port = &br->ports[br->num_ports];
544 port->port_netif = portif;
545 port->port_num = br->num_ports;
550#if BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
551 portif->
input = bridgeif_input;
553 portif->
input = bridgeif_tcpip_input;
556 netif_set_client_data(portif, bridgeif_netif_client_id,
port);
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
err_t bridgeif_init(struct netif *netif)
#define BRIDGEIF_READ_UNPROTECT(lev)
err_t bridgeif_add_port(struct netif *bridgeif, struct netif *portif)
#define BRIDGEIF_DECL_PROTECT(lev)
err_t bridgeif_fdb_remove(struct netif *bridgeif, const struct eth_addr *addr)
#define BRIDGEIF_READ_PROTECT(lev)
#define BRIDGEIF_WRITE_UNPROTECT(lev)
err_t bridgeif_fdb_add(struct netif *bridgeif, const struct eth_addr *addr, bridgeif_portmask_t ports)
#define BRIDGEIF_WRITE_PROTECT(lev)
#define mem_free(ptr, bsize)
void * mem_calloc(mem_size_t count, mem_size_t size)
#define LWIP_DEBUGF(debug, message)
#define LWIP_ASSERT(message, assertion)
#define MIB2_STATS_NETIF_ADD(n, x, val)
#define MIB2_STATS_NETIF_INC(n, x)
#define MIB2_INIT_NETIF(netif, type, speed)
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
void * bridgeif_fdb_init(u16_t max_fdb_entries)
bridgeif_portmask_t bridgeif_fdb_get_dst_ports(void *fdb_ptr, struct eth_addr *dst_addr)
void bridgeif_fdb_update_src(void *fdb_ptr, struct eth_addr *src_addr, u8_t port_idx)
#define BRIDGEIF_MAX_PORTS
#define BRIDGEIF_FW_DEBUG
err_t tcpip_input(struct pbuf *p, struct netif *inp)
#define NETIF_FLAG_LINK_UP
#define NETIF_FLAG_ETHERNET
#define NETIF_FLAG_ETHARP
#define NETIF_FLAG_BROADCAST
u8_t pbuf_free(struct pbuf *p)
#define memcpy(s1, s2, n)
#define netif_is_link_up(netif)
#define netif_get_index(netif)
#define netif_clear_flags(netif, clr_flags)
#define LINK_STATS_INC(x)
u16_t max_fdb_static_entries
u16_t max_fdb_dynamic_entries
u8_t hwaddr[NETIF_MAX_HWADDR_LEN]
netif_linkoutput_fn linkoutput
err_t tcpip_inpkt(struct pbuf *p, struct netif *inp, netif_input_fn input_fn)