55#include < util/system/types.h>
66#include < util/generic/string.h>
77
8- #include < contrib/libs/ibdrv/include/infiniband/verbs.h>
98
109extern " C" {
1110
1211struct ibv_context ;
1312struct ibv_pd ;
13+ struct ibv_device_attr ;
14+ struct ibv_port_attr ;
15+ union ibv_gid;
1416
1517}
1618
@@ -36,55 +38,38 @@ struct TDeviceCtx : public NNonCopyable::TNonCopyable {
3638class TRdmaCtx : public NNonCopyable ::TNonCopyable {
3739 friend class NLinkMgr ::TRdmaLinkManager;
3840 TRdmaCtx (
39- std::shared_ptr<TDeviceCtx> deviceCtx, ibv_device_attr devAttr, const char * deviceName,
40- ui32 portNum, ibv_port_attr portAttr, int gidIndex, ibv_gid gid
41+ std::shared_ptr<TDeviceCtx> deviceCtx, const ibv_device_attr& devAttr, const char * deviceName,
42+ ui32 portNum, const ibv_port_attr& portAttr, int gidIndex, const ibv_gid& gid
4143 );
4244
45+ struct TImpl ;
4346public:
4447 static std::shared_ptr<TRdmaCtx> Create (std::shared_ptr<TDeviceCtx> deviceCtx, ui32 portNum, int gidIndex);
4548
4649 ~TRdmaCtx () = default ;
4750
48- ibv_context* GetContext () const {
51+ ibv_context* GetContext () const noexcept {
4952 return DeviceCtx->Context ;
5053 }
51- ibv_pd* GetProtDomain () const {
54+
55+ ibv_pd* GetProtDomain () const noexcept {
5256 return DeviceCtx->ProtDomain ;
5357 }
54- const ibv_device_attr& GetDevAttr () const {
55- return DevAttr;
56- }
57- const char * GetDeviceName () const {
58- return DeviceName;
59- }
60- ui32 GetPortNum () const {
61- return PortNum;
62- }
63- const ibv_port_attr& GetPortAttr () const {
64- return PortAttr;
65- }
66- int GetGidIndex () const {
67- return GidIndex;
68- }
69- const ibv_gid& GetGid () const {
70- return Gid;
71- }
72- size_t GetDeviceIndex () const {
73- return DeviceIndex;
74- }
58+
59+ const ibv_device_attr& GetDevAttr () const noexcept ;
60+ const char * GetDeviceName () const noexcept ;
61+ ui32 GetPortNum () const noexcept ;
62+ const ibv_port_attr& GetPortAttr () const noexcept ;
63+ int GetGidIndex () const noexcept ;
64+ const ibv_gid& GetGid () const noexcept ;
65+ size_t GetDeviceIndex () const noexcept ;
7566
7667 void Output (IOutputStream &str) const ;
7768 TString ToString () const ;
7869
7970private:
8071 const std::shared_ptr<TDeviceCtx> DeviceCtx;
81- const ibv_device_attr DevAttr;
82- const char * DeviceName;
83- const ui32 PortNum;
84- const ibv_port_attr PortAttr;
85- const int GidIndex;
86- const ibv_gid Gid;
87- size_t DeviceIndex;
72+ std::unique_ptr<TImpl> Impl;
8873};
8974
9075}
0 commit comments