Break srvs. into rsmi & admin srvs. Add VerifyConnection api.

Change-Id: I67567264c37e31f3409062a14e56eba4801cd944


[ROCm/rdc commit: dc6f6f3e9a]
This commit is contained in:
Chris Freehill
2019-12-22 20:30:58 -06:00
والد bc7f01e992
کامیت ba14edbb4d
19فایلهای تغییر یافته به همراه316 افزوده شده و 87 حذف شده
@@ -24,6 +24,8 @@ THE SOFTWARE.
#ifndef CLIENT_INCLUDE_RDC_RDC_CLIENT_H_
#define CLIENT_INCLUDE_RDC_RDC_CLIENT_H_
#include <grpcpp/grpcpp.h>
#include <memory>
#include <string>
#include "rocm_smi/rocm_smi.h"
@@ -192,6 +194,64 @@ typedef uintptr_t rdc_channel_t;
#define RDC_DEFAULT_SERVER_PORT 50051
#define RDC_DEFAULT_SERVER_IP "localhost"
/*****************************************************************************/
/** @defgroup RDCAdmin RDC Administration Functions
* These administrative functions are used to monitor and control, for
* example RDC connectivity.
* @{
*/
/**
* @brief Check the connection status of a channel
*
* @details Given an ::rdc_channel_t @p channel and a boolean @p
* try_to_connect, this function will return the grpc_connectivity_state for
* that channel
*
* @p channel[in] The channel for which the status will be given
*
* @param[in] try_to_connect If the channel is currently IDLE, if the argument
* is true, transition to CONNECTING.
*
* @param[inout] state A pointer to caller provided memory to which an
* the grpc_connectivity_state will be written. grpc_connectivity_state has
* the following possible values:
* GRPC_CHANNEL_IDLE channel is idle
* GRPC_CHANNEL_CONNECTING channel is connecting
* GRPC_CHANNEL_READY channel is ready for work
* GRPC_CHANNEL_TRANSIENT_FAILURE channel has seen a failure but expects to
* recover
* GRPC_CHANNEL_SHUTDOWN channel has seen a failure that it cannot
* recover from
*
* @retval ::RDC_STATUS_SUCCESS is returned upon successful call.
*
*/
rdc_status_t
rdc_channel_state_get(rdc_channel_t channel, bool try_to_connect,
grpc_connectivity_state *state);
/**
* @brief Verify a channel's connection to the server
*
* @details Given an ::rdc_channel_t @p channel, this function will send a
* random number to the server associated with @p channel. The server will send
* the number back. Upon receiving the returned message from the server, the
* number sent to the server is compared to the number received from the
* server. If the 2 numbers are the same, the connection is verified.
* Otherwise, an appropriate error code is returned.
*
* @p channel[in] The channel for which the connection will be verified
*
* @retval ::RDC_STATUS_SUCCESS is returned upon successful call.
*
*/
rdc_status_t
rdc_channel_connection_verify(rdc_channel_t channel);
/** @} */ // end of RDCAdmin
/*****************************************************************************/
/** @defgroup InitShutAdmin Initialization and Shutdown
* These functions are used for initialization of RDC and clean up when
@@ -216,7 +276,7 @@ typedef uintptr_t rdc_channel_t;
*
* @param[in] port A pointer to string containing the port on which the
* RDC server is listening
*
*
* @param[in] secure A bool indicating whether SSL should be used for
* communications (not currently supported)
*
@@ -21,8 +21,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef CLIENT_INCLUDE_RDC_RDC_MAIN_H_
#define CLIENT_INCLUDE_RDC_RDC_MAIN_H_
#ifndef CLIENT_INCLUDE_RDC_RDC_CLIENT_MAIN_H_
#define CLIENT_INCLUDE_RDC_RDC_CLIENT_MAIN_H_
#include <string>
#include <memory>
@@ -48,15 +48,21 @@ class RDCChannel {
std::string server_ip(void) const {return server_ip_;}
std::string server_port(void) const {return server_port_;}
bool secure_channel(void) const {return secure_channel_;}
std::shared_ptr<::rdc::Rsmi::Stub> stub(void) const {return stub_;}
std::shared_ptr<::rdc::Rsmi::Stub> rsmi_stub(void) const {return rsmi_stub_;}
std::shared_ptr<::rdc::RdcAdmin::Stub> rdc_admin_stub(void) const {
return rdc_admin_stub_;}
std::shared_ptr<grpc::Channel> const channel(void) {return channel_;}
private:
std::string server_ip_;
std::string server_port_;
bool secure_channel_;
std::shared_ptr<::rdc::Rsmi::Stub> stub_;
std::shared_ptr<::rdc::Rsmi::Stub> rsmi_stub_;
std::shared_ptr<::rdc::RdcAdmin::Stub> rdc_admin_stub_;
std::shared_ptr<grpc::Channel> channel_;
};
} // namespace rdc
} // namespace amd
#endif // CLIENT_INCLUDE_RDC_RDC_MAIN_H_
#endif // CLIENT_INCLUDE_RDC_RDC_CLIENT_MAIN_H_