void process_fdb_etherflame_from_vxlan (struct vxlan_instance * vins, struct ether_header * ether, struct sockaddr_storage * vtep_addr) { struct fdb_entry * entry; entry = fdb_search_entry (vins->fdb, (u_int8_t *) ether->ether_shost); if (entry == NULL) { EXTRACT_PORT (*vtep_addr) = htons (VXLAN_PORT_BASE); fdb_add_entry (vins->fdb, (u_int8_t *) ether->ether_shost, *vtep_addr); #ifdef LOGGING_FDB_CHANGE syslog (LOG_INFO, "add entry %02x:%02x:%02x:%02x:%02x:%02x", ether->ether_shost[0], ether->ether_shost[1], ether->ether_shost[2], ether->ether_shost[3], ether->ether_shost[4], ether->ether_shost[5]); syslog (LOG_INFO, "Add, Number of FDB entry is %d", vins->fdb->fdb.count); #endif } else { if (MEMCMP_SOCKADDR (*vtep_addr, entry->vtep_addr) == 0) { entry->ttl = vins->fdb->fdb_max_ttl; } else { entry->vtep_addr = * vtep_addr; entry->ttl = vins->fdb->fdb_max_ttl; } } return; }
//**************************************************************************** // //! \brief This function initialise the gpio module, hence necessary if one //! wishes to use GPIOs //! //! \param none //! //! \return 0 if successful, -1 in the case of error // //**************************************************************************** static int gpio_module_init(int *gpios_in_use, int count) { #define EXTRACT_PORT(gpio) (gpio >> 3) #define EXTRACT_PIN(gpio) (gpio & 0x7) #define SETUP_GPIO_PORT_INFO(indx, id, addr, irq, valm, spm) \ { \ gpio_config.port_info[indx].module_id = id; \ gpio_config.port_info[indx].base_addr = addr; \ gpio_config.port_info[indx].irqvec_id = irq; \ gpio_config.port_info[indx].validity_mask = valm; \ gpio_config.port_info[indx].special_purpose_mask = spm; \ } #define GPIO_PORT0_WAKE_SOURCES 0x14 #define GPIO_PORT1_WAKE_SOURCES 0x28 #define GPIO_PORT2_WAKE_SOURCES 0x2 #define GPIO_PORT3_WAKE_SOURCES 0x5 struct cc_gpio_config gpio_config; int retval, loopcnt; unsigned char port0_validity = 0, port1_validity = 0; unsigned char port2_validity = 0, port3_validity = 0; unsigned int port_num = 0; unsigned char pin_num, bitmask_pin; memset(&gpio_config, 0 ,sizeof(struct cc_gpio_config)); /* Setup the GPIO validity mask */ for(loopcnt = 0; loopcnt < count; loopcnt++) { port_num = EXTRACT_PORT(gpios_in_use[loopcnt]); pin_num = EXTRACT_PIN(gpios_in_use[loopcnt]); bitmask_pin = (1 << pin_num); if(0 == port_num) { /* Port 0 */ port0_validity |= bitmask_pin; } else if(1 == port_num) { /* Port 1 */ port1_validity |= bitmask_pin; } else if(2 == port_num) { /* Port 2 */ port2_validity |= bitmask_pin; } else { /* Port 3 */ port3_validity |= bitmask_pin; } } /* Setup the GPIO module configurations */ if(port0_validity) { SETUP_GPIO_PORT_INFO(0, PRCM_GPIOA0, GPIOA0_BASE, INT_GPIOA0, port0_validity, GPIO_PORT0_WAKE_SOURCES); } if(port1_validity) { SETUP_GPIO_PORT_INFO(1, PRCM_GPIOA1, GPIOA1_BASE, INT_GPIOA1, port1_validity, GPIO_PORT1_WAKE_SOURCES); } if(port2_validity) { SETUP_GPIO_PORT_INFO(2, PRCM_GPIOA2, GPIOA2_BASE, INT_GPIOA2, port2_validity, GPIO_PORT2_WAKE_SOURCES); } if(port3_validity) { SETUP_GPIO_PORT_INFO(3, PRCM_GPIOA3, GPIOA3_BASE, INT_GPIOA3, port3_validity, GPIO_PORT3_WAKE_SOURCES); } gpio_config.drv_notify_cb = gpio_intr_hndlr; gpio_config.enbl_irqc = osi_ExitCritical; gpio_config.dsbl_irqc = osi_EnterCritical; retval = cc_gpio_init(&gpio_config); return retval; }