/** * @file include/ActivMiddleware/ActivFramework/KernelBypass/Mode.h * * @brief Header file for kernel bypass mode constants and functions. */ #if (!defined ACTIV_FRAMEWORK_KERNEL_BYPASS_MODE_H) #define ACTIV_FRAMEWORK_KERNEL_BYPASS_MODE_H #include "ActivMiddleware/ActivFramework/External.h" #include "ActivMiddleware/ActivBase/IniFileParser.h" //! Activ namespace. namespace Activ { class ManagedEndPoint; //! KernelBypass namespace. namespace KernelBypass { //! Mode. enum Mode { MODE_NONE, ///< Use default TCP/IP stack. MODE_AUTO, ///< Use ExaNIC/EFVI/DBL_API if available, else fallback to NONE. MODE_AUTO_REQUIRED, ///< Use ExaNIC/EFVI/DBL_API if available, else fail. Note that if the application is onloaded it will be favored over ef_vi. MODE_EFVI, ///< Explicitly use Solarflare EFVI. MODE_DBL, ///< Explicitly use Myricom DBL. MODE_EXANIC, ///< Explicitly use Exablaze ExaNIC. MODE_DPDK, ///< Explicitly use DPDK. // Not configurable but may be set during detection. MODE_ONLOAD, }; /** * @brief Detect supported kernel bypass mode. AUTO and AUTO_REQUIRED will be resolved. * * @param interfaceAddress * @param mode the requested mode. * * @retval The resolved kernel bypass mode to use. * * @throw Exception * @throw std::exception */ ACTIV_FRAMEWORK_API Mode DetectReceiveMode(const String &interfaceAddress, const Mode mode); /** * @brief Detect supported kernel bypass mode optimized using cached info from ManagedEndPoint. * * AUTO and AUTO_REQUIRED will be resolved. * * @param managedEndPoint * @param interfaceAddress * @param mode the requested mode. * * @retval The resolved kernel bypass mode to use. * * @throw Exception * @throw std::exception */ ACTIV_FRAMEWORK_API Mode DetectReceiveMode(ManagedEndPoint &managedEndPoint, const String &interfaceAddress, const Mode mode); /** * @brief Detect supported kernel bypass mode. AUTO and AUTO_REQUIRED will be resolved. * * @param managedEndPoint * @param interfaceAddress * @param mode the requested mode. * * @retval The resolved kernel bypass mode to use. * * @throw Exception * @throw std::exception */ ACTIV_FRAMEWORK_API Mode DetectTransmitMode(ManagedEndPoint &managedEndPoint, const String &interfaceAddress, const Mode mode); /** * @brief Read the kernel bypass mode from an ini file section iterator. * * @param sectionIterator * @param mode the default Mode. * * @retval The kernel bypass mode. */ ACTIV_FRAMEWORK_API Mode ReadSetting(const IniFileParser::ConstSectionIterator §ionIterator, const Mode mode); /** * @brief Get string representation of kernel bypass mode. * * @param kernelBypassMode * * @return kernel bypass mode in string form. */ ACTIV_FRAMEWORK_API String ModeToString(const Mode mode); /** * @brief Get kernel bypass mode from a string. * * @param string the string representation of kernel bypass mode. * * @return kernel bypass mode. */ ACTIV_FRAMEWORK_API Mode StringToMode(const String &string); /** * @brief Whether to create a UdpReceiver for the mode. * * @param mode */ ACTIV_FRAMEWORK_API bool ShouldCreateUdpReceiver(const Mode mode); } // namespace KernelBypass } // namespace Activ #endif // (!defined ACTIV_FRAMEWORK_KERNEL_BYPASS_MODE_H)