//! //! This API is invoked when eucanetd catches an USR1 or USR2 signal. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] signal received signal //! //! @return 0 on success, 1 otherwise. //! //! @see //! //! @pre //! - pGni must not be NULL //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static int network_driver_handle_signal(globalNetworkInfo *pGni, int signal) { int rc = 0; LOGTRACE("Handling singal %d for '%s' network driver.\n", signal, DRIVER_NAME()); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to handle signal. Driver '%s' not initialized.\n", DRIVER_NAME()); return (1); } // Is the global network view structure NULL? if (!pGni) { LOGERROR("Failed to handle signal for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (1); } switch (signal) { case SIGUSR1: mido_info_http_count_total(); mido_info_midocache(); break; case SIGUSR2: LOGINFO("Going to invalidate midocache\n"); rc = do_midonet_populate(pMidoConfig); if (rc) { LOGERROR("failed to populate euca VPC models\n"); midocache_invalid = 1; } break; default: break; } return (0); }
//! //! This API is invoked when eucanetd catches an USR1 or USR2 signal. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] signal received signal //! //! @return 0 on success, 1 otherwise. //! //! @see //! //! @pre //! - pGni must not be NULL //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static int network_driver_handle_signal(globalNetworkInfo *pGni, int signal) { LOGTRACE("Handling singal %d for '%s' network driver.\n", signal, DRIVER_NAME()); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to handle signal. Driver '%s' not initialized.\n", DRIVER_NAME()); return (1); } // Is the global network view structure NULL? if (!pGni) { LOGERROR("Failed to handle signal for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (1); } switch (signal) { case SIGUSR1: mido_info_midonetapi(); mido_info_http_count_total(); mido_info_midocache(); char *bgprecovery = NULL; bgprecovery = discover_mido_bgps(pMidoConfig); if (bgprecovery && strlen(bgprecovery)) { LOGINFO("\nmido BGP configuration (for manual recovery):\n%s\n", bgprecovery); } EUCA_FREE(bgprecovery); break; case SIGUSR2: LOGINFO("Going to invalidate midocache\n"); midocache_invalid = 1; break; default: break; } return (0); }
//! //! Maintenance activities to be executed when eucanetd is idle between polls. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] pLni a pointer to the Local Network Information structure //! //! @return 0 on success, 1 otherwise. //! //! @see //! //! @pre //! - pGni must not be NULL. pLni is ignored. //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static int network_driver_system_maint(globalNetworkInfo *pGni, lni_t *pLni) { int rc = 0; struct timeval tv; LOGTRACE("Running maintenance for '%s' network driver.\n", DRIVER_NAME()); eucanetd_timer(&tv); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to run maintenance activities. Driver '%s' not initialized.\n", DRIVER_NAME()); return (1); } // Need a valid global network view if (!pGni) { LOGERROR("Failed to run maintenance for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (1); } // Make sure midoname buffer is available midonet_api_cache_midos_init(); rc = do_midonet_maint(pMidoConfig); return (rc); }
static void carl9170_usb_disconnect(struct usb_interface *intf) { struct ar9170 *ar = usb_get_intfdata(intf); struct usb_device *udev; if (WARN_ON(!ar)) return; udev = ar->udev; wait_for_completion(&ar->fw_load_wait); if (IS_INITIALIZED(ar)) { carl9170_reboot(ar); carl9170_usb_stop(ar); } carl9170_usb_cancel_urbs(ar); carl9170_unregister(ar); usb_set_intfdata(intf, NULL); carl9170_release_firmware(ar); carl9170_free(ar); usb_put_dev(udev); }
//! //! This API checks the new GNI against the system view to decide what really //! needs to be done. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] pLni a pointer to the Local Network Information structure //! //! @return A bitmask indicating what needs to be done. The following bits are //! the ones to look for: EUCANETD_RUN_NETWORK_API, EUCANETD_RUN_SECURITY_GROUP_API //! and EUCANETD_RUN_ADDRESSING_API. //! //! @see //! //! @pre //! - Both pGni and pLni must not be NULL //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static u32 network_driver_system_scrub(globalNetworkInfo * pGni, lni_t * pLni) { u32 ret = EUCANETD_RUN_NO_API; LOGINFO("Scrubbing for '%s' network driver.\n", DRIVER_NAME()); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to scub the system for network artifacts. Driver '%s' not initialized.\n", DRIVER_NAME()); return (EUCANETD_RUN_NO_API); } // Are the global and local network view structures NULL? if (!pGni || !pLni) { LOGERROR("Failed to implement security-group artifacts for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (EUCANETD_RUN_NO_API); } if (PEER_IS_NC(eucanetdPeer)) { } else if (PEER_IS_CC(eucanetdPeer)) { } return (ret); }
//! //! For MIDONET VPC mode, all is done in this driver API. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] pLni a pointer to the Local Network Information structure //! //! @return EUCANETD_RUN_NO_API or EUCANETD_RUN_ERROR_API //! //! @see //! //! @pre //! - Both pGni and pLni must not be NULL //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static u32 network_driver_system_scrub(globalNetworkInfo *pGni, lni_t *pLni) { int rc = 0; u32 ret = EUCANETD_RUN_NO_API; char versionFile[EUCA_MAX_PATH]; struct timeval tv; LOGINFO("Scrubbing for '%s' network driver.\n", DRIVER_NAME()); eucanetd_timer(&tv); bzero(versionFile, EUCA_MAX_PATH); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to scrub the system for network artifacts. Driver '%s' not initialized.\n", DRIVER_NAME()); return (ret); } // Need a valid global network view if (!pGni) { LOGERROR("Failed to scrub the system for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (ret); } LOGDEBUG("midonet_api cache state: %s\n", midonet_api_dirty_cache == 0 ? "CLEAN" : "DIRTY"); if ((rc = do_midonet_update(pGni, pMidoConfig)) != 0) { LOGERROR("could not update midonet: check log for details\n"); ret = EUCANETD_RUN_ERROR_API; } else { LOGINFO("Networking state sync: updated successfully in %.2f ms\n", eucanetd_timer_usec(&tv) / 1000.0); } return (ret); }
//! //! Initialize the network driver. //! //! @param[in] pConfig a pointer to our application configuration //! //! @return 0 on success or 1 if any failure occured. //! //! @see //! //! @pre //! - The core application configuration must be completed prior calling //! - The driver should not be already initialized (if its the case, a no-op will occur) //! - The pConfig parameter must not be NULL //! //! @post //! On success the driver is properly configured. On failure, the state of //! the driver is non-deterministic. If the driver was previously initialized, //! this will result into a no-op. //! //! @note //! static int network_driver_init(eucanetdConfig * pConfig) { int rc = 0; LOGINFO("Initializing '%s' network driver.\n", DRIVER_NAME()); // Make sure our given pointer is valid if (!pConfig) { LOGERROR("Failure to initialize '%s' networking mode. Invalid configuration parameter provided.\n", DRIVER_NAME()); return (1); } // Are we already initialized? if (IS_INITIALIZED()) { LOGERROR("Networking '%s' mode already initialized. Skipping!\n", DRIVER_NAME()); return (0); } // if (PEER_IS_NC(eucanetdPeer)) { if ((pMidoConfig = EUCA_ZALLOC(1, sizeof(mido_config))) == NULL) { LOGERROR("Failed to initialize '%s' networking mode. Out of memory!\n", DRIVER_NAME()); return (1); } rc = initialize_mido(pMidoConfig, pConfig->eucahome, pConfig->midosetupcore, pConfig->midoeucanetdhost, pConfig->midogwhost, pConfig->midogwip, pConfig->midogwiface, pConfig->midopubnw, pConfig->midopubgwip, "169.254.0.0", "17"); if (rc) { LOGERROR("could not initialize mido: please ensure that all required config options for MIDOVPC mode are set in eucalyptus.conf\n"); return (1); } // } // We are now initialize gInitialized = TRUE; return (0); }
//! //! Maintenance activities to be executed when eucanetd is idle between polls. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] pLni a pointer to the Local Network Information structure //! //! @return 0 on success, 1 otherwise. //! //! @see //! //! @pre //! - pGni must not be NULL. pLni is ignored. //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static int network_driver_system_maint(globalNetworkInfo *pGni, lni_t *pLni) { int rc = 0; struct timeval tv; LOGDEBUG("Running maintenance for '%s' network driver.\n", DRIVER_NAME()); eucanetd_timer(&tv); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to run maintenance activities. Driver '%s' not initialized.\n", DRIVER_NAME()); return (1); } // Need a valid global network view if (!pGni) { LOGERROR("Failed to run maintenance for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (1); } if (midonet_api_dirty_cache == 1) { // Cache is invalid. Let's pre-populate mido. rc = do_midonet_maint(pMidoConfig); } return (rc); }
//! //! Responsible for flushing any networking artifacts implemented by this //! network driver. //! //! @param[in] pGni a pointer to the Global Network Information structure //! //! @return 0 on success or 1 if any failure occurred. //! //! @see //! //! @pre //! The driver must be initialized already //! //! @post //! On success, all networking mode artifacts will be flushed from the system. If any //! failure occurred. The system is left in a non-deterministic state and a subsequent //! call to this API may resolve the remaining issues. //! static int network_driver_system_flush(globalNetworkInfo *pGni) { int rc = 0; int ret = 0; LOGINFO("Flushing '%s' network driver artifacts.\n", DRIVER_NAME()); // Is our driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to flush the networking artifacts for '%s' network driver. Driver not initialized.\n", DRIVER_NAME()); return (1); } // if (PEER_IS_NC(eucanetdPeer)) { if (pMidoConfig) { if ((rc = do_midonet_teardown(pMidoConfig)) != 0) { ret = 1; } else { EUCA_FREE(pMidoConfig); pMidoConfig = NULL; gInitialized = FALSE; } } // } return (0); }
/** * Initialize this network driver. * - The core application configuration must be completed prior calling * - The driver should not be already initialized (if its the case, a no-op will occur) * - The pConfig parameter must not be NULL * * @param pConfig [in] a pointer to eucanetd system-wide configuration * @param pGni [in] a pointer to the Global Network Information structure * @return 0 on success. Integer number on failure. */ static int network_driver_init(eucanetdConfig *pConfig, globalNetworkInfo *pGni) { int rc = 0; LOGDEBUG("Initializing '%s' network driver.\n", DRIVER_NAME()); // Make sure our given pointer is valid if (!pConfig) { LOGERROR("Failure to initialize '%s' networking mode. Invalid configuration parameter provided.\n", DRIVER_NAME()); return (1); } // Are we already initialized? if (IS_INITIALIZED()) { LOGERROR("Networking '%s' mode already initialized. Skipping!\n", DRIVER_NAME()); return (0); } if (!pMidoConfig) { pMidoConfig = EUCA_ZALLOC_C(1, sizeof (mido_config)); } pMidoConfig->config = pConfig; rc = initialize_mido(pMidoConfig, pConfig, pGni); if (rc) { LOGERROR("could not initialize mido: please ensure that all required config options for VPCMIDO mode are set\n"); free_mido_config(pMidoConfig); EUCA_FREE(pMidoConfig); return (1); } // We are now initialized gInitialized = TRUE; return (0); }
//! //! Initialize the network driver. //! //! @param[in] pConfig a pointer to our application configuration //! //! @return 0 on success or 1 if any failure occurred. //! //! @see //! //! @pre //! - The core application configuration must be completed prior calling //! - The driver should not be already initialized (if its the case, a no-op will occur) //! - The pConfig parameter must not be NULL //! //! @post //! On success the driver is properly configured. On failure, the state of //! the driver is non-deterministic. If the driver was previously initialized, //! this will result into a no-op. //! //! @note //! static int network_driver_init(eucanetdConfig * pConfig) { int rc = 0; LOGINFO("Initializing '%s' network driver.\n", DRIVER_NAME()); // Make sure our given pointer is valid if (!pConfig) { LOGERROR("Failure to initialize '%s' networking mode. Invalid configuration parameter provided.\n", DRIVER_NAME()); return (1); } // Are we already initialized? if (IS_INITIALIZED()) { LOGERROR("Networking '%s' mode already initialized. Skipping!\n", DRIVER_NAME()); return (0); } pMidoConfig = EUCA_ZALLOC_C(1, sizeof (mido_config)); pMidoConfig->config = pConfig; //rc = initialize_mido(pMidoConfig, pConfig->eucahome, pConfig->flushmode, pConfig->disable_l2_isolation, pConfig->midoeucanetdhost, pConfig->midogwhosts, // pConfig->midopubnw, pConfig->midopubgwip, "169.254.0.0", "17"); rc = initialize_mido(pMidoConfig, pConfig, "169.254.0.0", "17"); if (rc) { LOGERROR("could not initialize mido: please ensure that all required config options for VPCMIDO mode are set\n"); EUCA_FREE(pMidoConfig); return (1); } // We are now initialized gInitialized = TRUE; return (0); }
//! //! For MIDONET VPC mode, all is done in this driver API. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] pLni a pointer to the Local Network Information structure //! //! @return EUCANETD_RUN_NO_API or EUCANETD_RUN_ERROR_API //! //! @see //! //! @pre //! - Both pGni and pLni must not be NULL //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static u32 network_driver_system_scrub(globalNetworkInfo *pGni, globalNetworkInfo *pGniApplied, lni_t *pLni) { int rc = 0; u32 ret = EUCANETD_RUN_NO_API; char versionFile[EUCA_MAX_PATH]; int check_tz_attempts = 30; struct timeval tv; eucanetd_timer(&tv); // Make sure midoname buffer is available midonet_api_cache_midos_init(); if (!gTunnelZoneOk) { LOGINFO("Checking MidoNet tunnel-zone.\n"); rc = 1; } while (!gTunnelZoneOk) { // Check tunnel-zone rc = check_mido_tunnelzone(); if (rc) { if ((--check_tz_attempts) > 0) { sleep(3); } else { LOGERROR("Cannot proceed without a valid tunnel-zone.\n"); return (EUCANETD_RUN_ERROR_API); } } else { gTunnelZoneOk = TRUE; } } bzero(versionFile, EUCA_MAX_PATH); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to scrub the system for network artifacts. Driver '%s' not initialized.\n", DRIVER_NAME()); return (ret); } // Need a valid global network view if (!pGni) { LOGERROR("Failed to scrub the system for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (ret); } LOGTRACE("euca VPCMIDO cache state: %s\n", midonet_api_system_changed == 0 ? "CLEAN" : "DIRTY"); rc = do_midonet_update(pGni, pGniApplied, pMidoConfig); if (rc != 0) { LOGERROR("failed to update midonet: check log for details\n"); // Invalidate mido cache - force repopulate midonet_api_system_changed = 1; ret = EUCANETD_RUN_ERROR_API; } else { LOGTRACE("Networking state sync: updated successfully in %.2f ms\n", eucanetd_timer_usec(&tv) / 1000.0); } return (ret); }
//! //! Initialize the network driver. //! //! @param[in] pConfig a pointer to our application configuration //! //! @return 0 on success or 1 if any failure occurred. //! //! @see //! //! @pre //! - The core application configuration must be completed prior calling //! - The driver should not be already initialized (if its the case, a no-op will occur) //! - The pConfig parameter must not be NULL //! //! @post //! On success the driver is properly configured. On failure, the state of //! the driver is non-deterministic. If the driver was previously initialized, //! this will result into a no-op. //! //! @note //! static int network_driver_init(eucanetdConfig * pConfig) { int rc = 0; LOGINFO("Initializing '%s' network driver.\n", DRIVER_NAME()); // Make sure our given pointer is valid if (!pConfig) { LOGERROR("Failure to initialize '%s' networking mode. Invalid configuration parameter provided.\n", DRIVER_NAME()); return (1); } // Are we already initialized? if (IS_INITIALIZED()) { LOGERROR("Networking '%s' mode already initialized. Skipping!\n", DRIVER_NAME()); return (0); } /* if ((pMidoConfig = EUCA_ZALLOC(1, sizeof (mido_config))) == NULL) { LOGERROR("Failed to initialize '%s' networking mode. Out of memory!\n", DRIVER_NAME()); return (1); } rc = initialize_mido(pMidoConfig, pConfig->eucahome, pConfig->flushmode, pConfig->disable_l2_isolation, pConfig->midoeucanetdhost, pConfig->midogwhosts, pConfig->midopubnw, pConfig->midopubgwip, "169.254.0.0", "17"); if (rc) { LOGERROR("could not initialize mido: please ensure that all required config options for VPCMIDO mode are set in eucalyptus.conf\n"); EUCA_FREE(pMidoConfig); return (1); } */ pMidoConfig = EUCA_ZALLOC_C(1, sizeof (mido_config)); rc = initialize_mido(pMidoConfig, pConfig->eucahome, pConfig->flushmode, pConfig->disable_l2_isolation, pConfig->midoeucanetdhost, pConfig->midogwhosts, pConfig->midopubnw, pConfig->midopubgwip, "169.254.0.0", "17"); if (rc) { LOGERROR("could not initialize mido: please ensure that all required config options for VPCMIDO mode are set\n"); EUCA_FREE(pMidoConfig); return (1); } //pMidoConfig = pMidoConfig_c; // Release unnecessary handlers if (pConfig->ipt) { ipt_handler_close(pConfig->ipt); } if (pConfig->ips) { ips_handler_close(pConfig->ips); } if (pConfig->ebt) { ebt_handler_close(pConfig->ebt); } // We are now initialized gInitialized = TRUE; return (0); }
//! //! For MIDONET VPC mode, all is done in this driver API. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] pLni a pointer to the Local Network Information structure //! //! @return EUCANETD_RUN_NO_API or EUCANETD_RUN_ERROR_API //! //! @see //! //! @pre //! - Both pGni and pLni must not be NULL //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static u32 network_driver_system_scrub(globalNetworkInfo * pGni, lni_t * pLni) { int rc = 0; u32 ret = EUCANETD_RUN_NO_API; char versionFile[EUCA_MAX_PATH]; LOGINFO("Scrubbing for '%s' network driver.\n", DRIVER_NAME()); bzero(versionFile, EUCA_MAX_PATH); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to scub the system for network artifacts. Driver '%s' not initialized.\n", DRIVER_NAME()); return (ret); } // Are the global and local network view structures NULL? if (!pGni || !pLni) { LOGERROR("Failed to implement security-group artifacts for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (ret); } // if (PEER_IS_NC(eucanetdPeer)) { if (pMidoConfig) { free_mido_config(pMidoConfig); bzero(pMidoConfig, sizeof(mido_config)); } rc = initialize_mido(pMidoConfig, config->eucahome, config->flushmode, config->disable_l2_isolation, config->midoeucanetdhost, config->midogwhosts, config->midopubnw, config->midopubgwip, "169.254.0.0", "17"); if (rc) { LOGERROR("could not initialize mido config\n"); ret = EUCANETD_RUN_ERROR_API; } else { if ((rc = do_midonet_update(pGni, pMidoConfig)) != 0) { LOGERROR("could not update midonet: check log for details\n"); ret = EUCANETD_RUN_ERROR_API; } else { LOGINFO("new Eucalyptus/Midonet networking state sync: updated successfully\n"); snprintf(versionFile, EUCA_MAX_PATH, EUCALYPTUS_RUN_DIR "/global_network_info.version", config->eucahome); if (!strlen(pGni->version) || (str2file(pGni->version, versionFile, O_CREAT | O_TRUNC | O_WRONLY, 0644, FALSE) != EUCA_OK) ) { LOGWARN("failed to populate GNI version file '%s': check permissions and disk capacity\n", versionFile); } } } // } // return (EUCANETD_RUN_NO_API); return (ret); }
void sample_display_set_mixer_position (SampleDisplay *s, int offset) { g_return_if_fail(s != NULL); g_return_if_fail(IS_SAMPLE_DISPLAY(s)); if(!s->edit || !IS_INITIALIZED(s)) return; if(offset != s->mixerpos) { s->mixerpos = offset; sample_display_idle_draw(s); } }
int __carl9170_exec_cmd(struct ar9170 *ar, struct carl9170_cmd *cmd, const bool free_buf) { struct urb *urb; int err = 0; if (!IS_INITIALIZED(ar)) { err = -EPERM; goto err_free; } if (WARN_ON(cmd->hdr.len > CARL9170_MAX_CMD_LEN - 4)) { err = -EINVAL; goto err_free; } urb = usb_alloc_urb(0, GFP_ATOMIC); if (!urb) { err = -ENOMEM; goto err_free; } if (ar->usb_ep_cmd_is_bulk) usb_fill_bulk_urb(urb, ar->udev, usb_sndbulkpipe(ar->udev, AR9170_USB_EP_CMD), cmd, cmd->hdr.len + 4, carl9170_usb_cmd_complete, ar); else usb_fill_int_urb(urb, ar->udev, usb_sndintpipe(ar->udev, AR9170_USB_EP_CMD), cmd, cmd->hdr.len + 4, carl9170_usb_cmd_complete, ar, 1); if (free_buf) urb->transfer_flags |= URB_FREE_BUFFER; usb_anchor_urb(urb, &ar->tx_cmd); usb_free_urb(urb); return carl9170_usb_submit_cmd_urb(ar); err_free: if (free_buf) kfree(cmd); return err; }
static void carl9170_usb_tasklet(unsigned long data) { struct ar9170 *ar = (struct ar9170 *) data; if (!IS_INITIALIZED(ar)) return; carl9170_usb_rx_work(ar); /* * Strictly speaking: The tx scheduler is not part of the USB system. * But the rx worker returns frames back to the mac80211-stack and * this is the _perfect_ place to generate the next transmissions. */ if (IS_STARTED(ar)) carl9170_tx_scheduler(ar); }
//! //! Responsible for flushing any networking artifacts implemented by this //! network driver. //! //! @param[in] pGni a pointer to the Global Network Information structure //! //! @return 0 on success or 1 if any failure occured. //! //! @see //! //! @pre //! The driver must be initialized already //! //! @post //! On success, all networking mode artifacts will be flushed from the system. If any //! failure occured. The system is left in a non-deterministic state and a subsequent //! call to this API may resolve the remaining issues. //! static int network_driver_system_flush(globalNetworkInfo * pGni) { LOGINFO("Flushing '%s' network driver artifacts.\n", DRIVER_NAME()); // Is our driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to flush the networking artifacts for '%s' network driver. Driver not initialized.\n", DRIVER_NAME()); return (1); } if (PEER_IS_NC(eucanetdPeer)) { } else if (PEER_IS_CC(eucanetdPeer)) { } return (0); }
//! //! For MIDONET VPC mode, all is done in this driver API. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] pLni a pointer to the Local Network Information structure //! //! @return EUCANETD_RUN_NO_API or EUCANETD_RUN_ERROR_API //! //! @see //! //! @pre //! - Both pGni and pLni must not be NULL //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static u32 network_driver_system_scrub(globalNetworkInfo * pGni, lni_t * pLni) { int rc = 0; u32 ret = EUCANETD_RUN_NO_API; LOGINFO("Scrubbing for '%s' network driver.\n", DRIVER_NAME()); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to scub the system for network artifacts. Driver '%s' not initialized.\n", DRIVER_NAME()); return (EUCANETD_RUN_NO_API); } // Are the global and local network view structures NULL? if (!pGni || !pLni) { LOGERROR("Failed to implement security-group artifacts for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (EUCANETD_RUN_NO_API); } // if (PEER_IS_NC(eucanetdPeer)) { if (pMidoConfig) { free_mido_config(pMidoConfig); bzero(pMidoConfig, sizeof(mido_config)); } rc = initialize_mido(pMidoConfig, config->eucahome, config->midosetupcore, config->midoeucanetdhost, config->midogwhost, config->midogwip, config->midogwiface, config->midopubnw, config->midopubgwip, "169.254.0.0", "17"); if (rc) { LOGERROR("could not initialize mido config\n"); ret = EUCANETD_RUN_ERROR_API; } else { if ((rc = do_midonet_update(pGni, pMidoConfig)) != 0) { LOGERROR("could not update midonet: check log for details\n"); ret = EUCANETD_RUN_ERROR_API; } else { LOGINFO("new Eucalyptus/Midonet networking state sync: updated successfully\n"); } } // } return (EUCANETD_RUN_NO_API); }
void sample_display_set_selection (SampleDisplay *s, int start, int end) { g_return_if_fail(s != NULL); g_return_if_fail(IS_SAMPLE_DISPLAY(s)); if(!s->edit || !IS_INITIALIZED(s)) return; g_return_if_fail(start >= -1 && start < s->datalen); g_return_if_fail(end >= 1 && end <= s->datalen); g_return_if_fail(end > start); s->sel_start = start; s->sel_end = end; sample_display_idle_draw(s); gtk_signal_emit(GTK_OBJECT(s), sample_display_signals[SIG_SELECTION_CHANGED], start, end); }
void sample_display_set_loop (SampleDisplay *s, int start, int end) { g_return_if_fail(s != NULL); g_return_if_fail(IS_SAMPLE_DISPLAY(s)); if(!s->edit || !IS_INITIALIZED(s)) return; g_return_if_fail(start >= -1 && start < s->datalen); g_return_if_fail(end > 0 && end <= s->datalen); g_return_if_fail(end > start); s->loop_start = start; s->loop_end = end; gtk_widget_queue_draw(GTK_WIDGET(s)); gtk_signal_emit(GTK_OBJECT(s), sample_display_signals[SIG_LOOP_CHANGED], start, end); }
//! //! This takes care of implementing the addressing artifacts necessary. This will add or //! remove IP addresses and elastic IPs for each instances. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] pLni a pointer to the Local Network Information structure //! //! @return 0 on success or 1 if any failure occured. //! //! @see update_private_ips(), update_elastic_ips(), update_l2_addressing() //! //! @pre //! - Both pGni and pLni must not be NULL //! - The driver must have been initialized //! //! @post //! On success, the networking artifacts should be implemented. On failure, the //! current state of the system may be left in a non-deterministic state. A //! subsequent call to this API may resolve the left over issues. //! //! @note //! static int network_driver_implement_addressing(globalNetworkInfo * pGni, lni_t * pLni) { LOGINFO("Implementing addressing artifacts for '%s' network driver.\n", DRIVER_NAME()); // Is the driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to implement addressing artifacts for '%s' network driver. Driver not initialized.\n", DRIVER_NAME()); return (1); } // Are the global and local network view structures NULL? if (!pGni || !pLni) { LOGERROR("Failed to implement addressing artifacts for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (1); } if (PEER_IS_NC(eucanetdPeer)) { } else if (PEER_IS_CC(eucanetdPeer)) { } return (0); }
static void carl9170_usb_cmd_complete(struct urb *urb) { struct ar9170 *ar = urb->context; int err = 0; if (WARN_ON_ONCE(!ar)) return; atomic_dec(&ar->tx_cmd_urbs); switch (urb->status) { /* everything is fine */ case 0: break; /* disconnect */ case -ENOENT: case -ECONNRESET: case -ENODEV: case -ESHUTDOWN: return; default: err = urb->status; break; } if (!IS_INITIALIZED(ar)) return; if (err) dev_err(&ar->udev->dev, "submit cmd cb failed (%d).\n", err); err = carl9170_usb_submit_cmd_urb(ar); if (err) dev_err(&ar->udev->dev, "submit cmd failed (%d).\n", err); }
//! //! Initialize the network driver. //! //! @param[in] pConfig a pointer to our application configuration //! //! @return 0 on success or 1 if any failure occured. //! //! @see //! //! @pre //! - The core application configuration must be completed prior calling //! - The driver should not be already initialized (if its the case, a no-op will occur) //! - The pConfig parameter must not be NULL //! //! @post //! On success the driver is properly configured. On failure, the state of //! the driver is non-deterministic. If the driver was previously initialized, //! this will result into a no-op. //! //! @note //! static int network_driver_init(eucanetdConfig * pConfig) { LOGINFO("Initializing '%s' network driver.\n", DRIVER_NAME()); // Make sure our given pointer is valid if (!pConfig) { LOGERROR("Failure to initialize '%s' networking mode. Invalid configuration parameter provided.\n", DRIVER_NAME()); return (1); } // Are we already initialized? if (IS_INITIALIZED()) { LOGERROR("Networking '%s' mode already initialized. Skipping!\n", DRIVER_NAME()); return (0); } if (PEER_IS_NC(eucanetdPeer)) { } else if (PEER_IS_CC(eucanetdPeer)) { } // We are now initialize gInitialized = TRUE; return (0); }
static void carl9170_usb_rx_work(struct ar9170 *ar) { struct urb *urb; int i; for (i = 0; i < AR9170_NUM_RX_URBS_POOL; i++) { urb = usb_get_from_anchor(&ar->rx_work); if (!urb) break; atomic_dec(&ar->rx_work_urbs); if (IS_INITIALIZED(ar)) { carl9170_rx(ar, urb->transfer_buffer, urb->actual_length); } usb_anchor_urb(urb, &ar->rx_pool); atomic_inc(&ar->rx_pool_urbs); usb_free_urb(urb); carl9170_usb_submit_rx_urb(ar, GFP_ATOMIC); } }
//! //! For MIDONET VPC mode, all is done in this driver API. //! //! @param[in] pGni a pointer to the Global Network Information structure //! @param[in] pLni a pointer to the Local Network Information structure //! //! @return EUCANETD_RUN_NO_API or EUCANETD_RUN_ERROR_API //! //! @see //! //! @pre //! - Both pGni and pLni must not be NULL //! - The driver must be initialized prior to calling this API. //! //! @post //! //! @note //! static u32 network_driver_system_scrub(globalNetworkInfo *pGni, globalNetworkInfo *pGniApplied, lni_t *pLni) { int rc = 0; u32 ret = EUCANETD_RUN_NO_API; char versionFile[EUCA_MAX_PATH]; int check_tz_attempts = 30; struct timeval tv; eucanetd_timer(&tv); // Make sure midoname buffer is available midonet_api_cache_midos_init(); if (!gTunnelZoneOk) { LOGDEBUG("Checking MidoNet tunnel-zone.\n"); rc = 1; } while (!gTunnelZoneOk) { // Check tunnel-zone rc = check_mido_tunnelzone(); if (rc) { if ((--check_tz_attempts) > 0) { sleep(3); } else { LOGERROR("Cannot proceed without a valid tunnel-zone.\n"); return (EUCANETD_RUN_ERROR_API); } } else { gTunnelZoneOk = TRUE; } } bzero(versionFile, EUCA_MAX_PATH); // Need a valid global network view if (!pGni) { LOGERROR("Failed to scrub the system for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (ret); } if (!IS_INITIALIZED() || (pGni && pGniApplied && cmp_gni_vpcmido_config(pGni, pGniApplied))) { LOGINFO("(re)initializing %s driver.\n", DRIVER_NAME()); if (pMidoConfig) { eucanetdConfig *configbak = pMidoConfig->config; free_mido_config(pMidoConfig); pMidoConfig->config = configbak; } else { LOGERROR("failed to (re)initialize config options: VPCMIDO driver not initialized\n"); return (EUCANETD_RUN_ERROR_API); } //rc = initialize_mido(pMidoConfig, config->eucahome, config->flushmode, // config->disable_l2_isolation, config->midoeucanetdhost, config->midogwhosts, // config->midopubnw, config->midopubgwip, "169.254.0.0", "17"); rc = initialize_mido(pMidoConfig, pMidoConfig->config, "169.254.0.0", "17"); if (rc) { LOGERROR("failed to (re)initialize config options\n"); return (EUCANETD_RUN_ERROR_API); } pGniApplied = NULL; } LOGTRACE("euca VPCMIDO system state: %s\n", midonet_api_system_changed == 0 ? "CLEAN" : "DIRTY"); rc = do_midonet_update(pGni, pGniApplied, pMidoConfig); if (rc != 0) { LOGERROR("failed to update midonet: check log for details\n"); if (rc < 0) { // Accept errors in instances/interface implementation. ret = EUCANETD_VPCMIDO_IFERROR; } else { ret = EUCANETD_RUN_ERROR_API; } } else { LOGTRACE("Networking state sync: updated successfully in %.2f ms\n", eucanetd_timer_usec(&tv) / 1000.0); } return (ret); }
//! //! Responsible for flushing any networking artifacts implemented by this //! network driver. //! //! @param[in] pGni a pointer to the Global Network Information structure //! //! @return 0 on success or 1 if any failure occurred. //! //! @see //! //! @pre //! The driver must be initialized already //! //! @post //! On success, all networking mode artifacts will be flushed from the system. If any //! failure occurred, the system is left in a non-deterministic state and a subsequent //! call to this API may resolve the remaining issues. //! static int network_driver_system_flush(globalNetworkInfo *pGni) { int rc = 0; int ret = 0; // Is our driver initialized? if (!IS_INITIALIZED()) { LOGERROR("Failed to flush the networking artifacts for '%s' network driver. Driver not initialized.\n", DRIVER_NAME()); return (1); } if (pMidoConfig->config->flushmode) { switch(pMidoConfig->config->flushmode) { case FLUSH_MIDO_DYNAMIC: LOGINFO("Flushing objects in MidoNet (keep the core intact)\n"); rc = do_midonet_teardown(pMidoConfig); if (rc) { ret = 1; } break; case FLUSH_MIDO_ALL: LOGINFO("Flush all objects in MidoNet\n"); rc = do_midonet_teardown(pMidoConfig); if (rc) { ret = 1; } break; case FLUSH_MIDO_CHECKDUPS: LOGINFO("Check for duplicate objects in MidoNet\n"); rc = do_midonet_delete_dups(pMidoConfig, TRUE); if (rc) { ret = 1; } break; case FLUSH_MIDO_DUPS: LOGINFO("Flush duplicate objects in MidoNet\n"); rc = do_midonet_delete_dups(pMidoConfig, FALSE); if (rc) { ret = 1; } break; case FLUSH_MIDO_CHECKUNCONNECTED: LOGINFO("Check for unconnected objects in MidoNet\n"); rc = do_midonet_delete_vpc_object(pMidoConfig, "unconnected", TRUE); if (rc) { ret = 1; } break; case FLUSH_MIDO_UNCONNECTED: LOGINFO("Flush unconnected objects in MidoNet\n"); rc = do_midonet_delete_vpc_object(pMidoConfig, "unconnected", FALSE); if (rc) { ret = 1; } break; case FLUSH_MIDO_CHECKVPC: LOGINFO("Check %s health in MidoNet\n", pMidoConfig->config->flushmodearg); rc = do_midonet_delete_vpc_object(pMidoConfig, pMidoConfig->config->flushmodearg, TRUE); if (rc) { ret = 1; } break; case FLUSH_MIDO_VPC: rc = do_midonet_delete_vpc_object(pMidoConfig, pMidoConfig->config->flushmodearg, FALSE); if (rc) { ret = 1; } break; case FLUSH_MIDO_LISTVPC: rc = do_midonet_delete_vpc_object(pMidoConfig, "list", TRUE); if (rc) { ret = 1; } break; case FLUSH_MIDO_TEST: do_midonet_delete_vpc_object(pMidoConfig, "test", TRUE); break; case FLUSH_NONE: default: LOGERROR("check for eucanetd bug: should never reach this point.\n"); break; } free_mido_config(pMidoConfig); EUCA_FREE(pMidoConfig); pMidoConfig = NULL; gInitialized = FALSE; } return (ret); }
/** * This API checks the new GNI against the system view to decide what really * needs to be done. * For MIDONET VPC mode, all is done in this driver API. * @param pConfig [in] a pointer to eucanetd system-wide configuration * @param pGni [in] a pointer to the Global Network Information structure * @param pGniApplied [in] a pointer to the previously successfully implemented GNI * @return A bitmask indicating what needs to be done. The following bits are * the ones to look for: EUCANETD_RUN_NETWORK_API, EUCANETD_RUN_SECURITY_GROUP_API * and EUCANETD_RUN_ADDRESSING_API. */ static u32 network_driver_system_scrub(eucanetdConfig *pConfig, globalNetworkInfo *pGni, globalNetworkInfo *pGniApplied) { int rc = 0; u32 ret = EUCANETD_RUN_NO_API; struct timeval tv; eucanetd_timer(&tv); // Make sure midoname buffer is available midonet_api_cache_midos_init(); // Need a valid global network view if (!pConfig || !pGni) { LOGERROR("Failed to scrub the system for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME()); return (ret); } int config_changed = cmp_gni_config(pGni, pGniApplied); if (!IS_INITIALIZED() || (pGni && config_changed)) { LOGINFO("(re)initializing %s driver.\n", DRIVER_NAME()); if (pMidoConfig) { free_mido_config(pMidoConfig); gInitialized = FALSE; } else { LOGERROR("failed to (re)initialize config options: VPCMIDO driver not initialized\n"); return (EUCANETD_RUN_ERROR_API); } rc = network_driver_init(pConfig, pGni); if (rc) { LOGERROR("failed to (re)initialize config options\n"); return (EUCANETD_RUN_ERROR_API); } pGniApplied = NULL; } if (config_changed & GNI_CONFIG_DIFF_MIDONODES) { pMidoConfig->midotz_ok = FALSE; } LOGTRACE("euca VPCMIDO system state: %s\n", midonet_api_system_changed == 0 ? "CLEAN" : "DIRTY"); rc = do_midonet_update(pGni, pGniApplied, pMidoConfig); if (rc != 0) { LOGERROR("failed to update midonet: check log for details\n"); switch (rc) { case -2: // Accept errors in instances/interface implementation. ret = EUCANETD_VPCMIDO_IFERROR; break; case -1: // Accept errors in gateway(s) implementation. ret = EUCANETD_VPCMIDO_GWERROR; break; default: ret = EUCANETD_RUN_ERROR_API; } } else { LOGTRACE("Networking state sync: updated successfully in %.2f ms\n", eucanetd_timer_usec(&tv) / 1000.0); pMidoConfig->config->mido_arptable_config_changed = FALSE; } return (ret); }