diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-08-16 22:35:50 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-08-16 22:43:57 +0300 |
commit | 2fcc3532d5bfd8ccb3fb5b884088c01376c7888d (patch) | |
tree | 9040d37b083ba19eed43ffa2dbefcf6b4c70d093 /library | |
parent | 4216b16bbaa20122c440773c8360527e846305cc (diff) | |
download | ydb-2fcc3532d5bfd8ccb3fb5b884088c01376c7888d.tar.gz |
Intermediate changes
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/netliba/socket/packet_queue.h | 6 | ||||
-rw-r--r-- | library/cpp/netliba/socket/socket.h | 4 | ||||
-rw-r--r-- | library/cpp/netliba/socket/udp_recv_packet.h | 2 | ||||
-rw-r--r-- | library/cpp/netliba/v6/block_chain.h | 5 | ||||
-rw-r--r-- | library/cpp/netliba/v6/cpu_affinity.cpp | 2 | ||||
-rw-r--r-- | library/cpp/netliba/v6/ib_buffers.h | 9 | ||||
-rw-r--r-- | library/cpp/netliba/v6/ib_collective.cpp | 4 | ||||
-rw-r--r-- | library/cpp/netliba/v6/ib_low.h | 6 | ||||
-rw-r--r-- | library/cpp/netliba/v6/ib_test.cpp | 5 | ||||
-rw-r--r-- | library/cpp/netliba/v6/udp_client_server.cpp | 10 | ||||
-rw-r--r-- | library/cpp/netliba/v6/udp_socket.h | 4 |
11 files changed, 24 insertions, 33 deletions
diff --git a/library/cpp/netliba/socket/packet_queue.h b/library/cpp/netliba/socket/packet_queue.h index 58a84709c2..a81e956862 100644 --- a/library/cpp/netliba/socket/packet_queue.h +++ b/library/cpp/netliba/socket/packet_queue.h @@ -20,9 +20,9 @@ namespace NNetlibaSocket { template <size_t TTNumWriterThreads> class TLockFreePacketQueue { private: - enum { MAX_PACKETS_IN_QUEUE = INT_MAX, - CMD_QUEUE_RESERVE = 1 << 20, - MAX_DATA_IN_QUEUE = 32 << 20 }; + static constexpr int MAX_PACKETS_IN_QUEUE = INT_MAX; + static constexpr int CMD_QUEUE_RESERVE = 1 << 20; + static constexpr int MAX_DATA_IN_QUEUE = 32 << 20; typedef std::pair<TUdpRecvPacket*, TPacketMeta> TPacket; typedef std::conditional_t<TTNumWriterThreads == 1, NThreading::TOneOneQueue<TPacket>, NThreading::TManyOneQueue<TPacket, TTNumWriterThreads>> TImpl; diff --git a/library/cpp/netliba/socket/socket.h b/library/cpp/netliba/socket/socket.h index c1da3c145f..0b30bd2ccf 100644 --- a/library/cpp/netliba/socket/socket.h +++ b/library/cpp/netliba/socket/socket.h @@ -74,8 +74,8 @@ namespace NNetlibaSocket { /////////////////////////////////////////////////////////////////////////////// // currently netliba v6 version id is any number which's not equal to NETLIBA_V12_VERSION - enum { NETLIBA_ANY_VERSION = -1, - NETLIBA_V12_VERSION = 112 }; + constexpr int NETLIBA_ANY_VERSION = -1; + constexpr int NETLIBA_V12_VERSION = 112; enum EFragFlag { FF_ALLOW_FRAG, diff --git a/library/cpp/netliba/socket/udp_recv_packet.h b/library/cpp/netliba/socket/udp_recv_packet.h index a2777fbcbf..a02e4c9b50 100644 --- a/library/cpp/netliba/socket/udp_recv_packet.h +++ b/library/cpp/netliba/socket/udp_recv_packet.h @@ -7,7 +7,7 @@ #include "allocator.h" namespace NNetlibaSocket { - enum { UDP_MAX_PACKET_SIZE = 8900 }; + constexpr int UDP_MAX_PACKET_SIZE = 8900; class TUdpHostRecvBufAlloc; struct TUdpRecvPacket: public TWithCustomAllocator { diff --git a/library/cpp/netliba/v6/block_chain.h b/library/cpp/netliba/v6/block_chain.h index 25247ec05f..e214d5f603 100644 --- a/library/cpp/netliba/v6/block_chain.h +++ b/library/cpp/netliba/v6/block_chain.h @@ -140,9 +140,8 @@ namespace NNetliba { TIntrusivePtr<TSharedMemory> SharedData; TVector<TIntrusivePtr<TThrRefBase>> AttachedStorage; char DefaultBuf[128]; // prevent allocs in most cases - enum { - N_DEFAULT_BLOCK_SIZE = 1024 - }; + + static constexpr int N_DEFAULT_BLOCK_SIZE = 1024; char* Alloc(int sz) { char* res = nullptr; diff --git a/library/cpp/netliba/v6/cpu_affinity.cpp b/library/cpp/netliba/v6/cpu_affinity.cpp index 7808092a72..55b4c98b71 100644 --- a/library/cpp/netliba/v6/cpu_affinity.cpp +++ b/library/cpp/netliba/v6/cpu_affinity.cpp @@ -13,7 +13,7 @@ namespace NNetliba { class TCPUSet { public: - enum { MAX_SIZE = 128 }; + static constexpr int MAX_SIZE = 128; private: #if defined(__FreeBSD__) && (__FreeBSD__ >= 7) diff --git a/library/cpp/netliba/v6/ib_buffers.h b/library/cpp/netliba/v6/ib_buffers.h index 8847250137..ae1857cdcb 100644 --- a/library/cpp/netliba/v6/ib_buffers.h +++ b/library/cpp/netliba/v6/ib_buffers.h @@ -11,11 +11,10 @@ namespace NNetliba { // single thread version class TIBBufferPool: public TThrRefBase, TNonCopyable { - enum { - BLOCK_SIZE_LN = 11, - BLOCK_SIZE = 1 << BLOCK_SIZE_LN, - BLOCK_COUNT = 1024 - }; + static constexpr int BLOCK_SIZE_LN = 11; + static constexpr int BLOCK_SIZE = 1 << BLOCK_SIZE_LN; + static constexpr int BLOCK_COUNT = 1024; + struct TSingleBlock { TIntrusivePtr<TMemoryRegion> Mem; TVector<ui8> BlkRefCounts; diff --git a/library/cpp/netliba/v6/ib_collective.cpp b/library/cpp/netliba/v6/ib_collective.cpp index af5dd6d284..5251ad2eb1 100644 --- a/library/cpp/netliba/v6/ib_collective.cpp +++ b/library/cpp/netliba/v6/ib_collective.cpp @@ -343,9 +343,7 @@ namespace NNetliba { ////////////////////////////////////////////////////////////////////////// struct TAllDataSync { - enum { - WR_COUNT = 64 * 2 - }; + static constexpr int WR_COUNT = 64 * 2; int CurrentBuffer; TIntrusivePtr<TIBMemBlock> MemBlock[2]; diff --git a/library/cpp/netliba/v6/ib_low.h b/library/cpp/netliba/v6/ib_low.h index 42e11ed941..f75f1e5379 100644 --- a/library/cpp/netliba/v6/ib_low.h +++ b/library/cpp/netliba/v6/ib_low.h @@ -69,9 +69,9 @@ namespace NNetliba { int Port; int LID; TIntrusivePtr<TIBContext> IBCtx; - enum { - MAX_GID = 16 - }; + + static constexpr int MAX_GID = 16; + ibv_gid MyGidArr[MAX_GID]; public: diff --git a/library/cpp/netliba/v6/ib_test.cpp b/library/cpp/netliba/v6/ib_test.cpp index 178691e837..8d1c825a24 100644 --- a/library/cpp/netliba/v6/ib_test.cpp +++ b/library/cpp/netliba/v6/ib_test.cpp @@ -17,9 +17,8 @@ namespace NNetliba { class TIPSocket { TNetSocket s; - enum { - HDR_SIZE = UDP_LOW_LEVEL_HEADER_SIZE - }; + + static constexpr int HDR_SIZE = UDP_LOW_LEVEL_HEADER_SIZE; public: void Init(int port) { diff --git a/library/cpp/netliba/v6/udp_client_server.cpp b/library/cpp/netliba/v6/udp_client_server.cpp index 14f60625f2..200daa387d 100644 --- a/library/cpp/netliba/v6/udp_client_server.cpp +++ b/library/cpp/netliba/v6/udp_client_server.cpp @@ -31,12 +31,10 @@ namespace NNetliba { // тогда на приемнике повиснет пакет. Этот пакет мы зашибем по этому таймауту const float UDP_MAX_INPUT_DATA_WAIT = UDP_TRANSFER_TIMEOUT * 2; - enum { - UDP_PACKET_SIZE_FULL = 8900, // used for ping to detect jumbo-frame support - UDP_PACKET_SIZE = 8800, // max data in packet - UDP_PACKET_SIZE_SMALL = 1350, // 1180 would be better taking into account that 1280 is guaranteed ipv6 minimum MTU - UDP_PACKET_BUF_SIZE = UDP_PACKET_SIZE + 100, - }; + constexpr int UDP_PACKET_SIZE_FULL = 8900; // used for ping to detect jumbo-frame support + constexpr int UDP_PACKET_SIZE = 8800; // max data in packet + constexpr int UDP_PACKET_SIZE_SMALL = 1350; // 1180 would be better taking into account that 1280 is guaranteed ipv6 minimum MTU + constexpr int UDP_PACKET_BUF_SIZE = UDP_PACKET_SIZE + 100; ////////////////////////////////////////////////////////////////////////// struct TUdpCompleteInTransfer { diff --git a/library/cpp/netliba/v6/udp_socket.h b/library/cpp/netliba/v6/udp_socket.h index bd95b8bcd0..5ba047ea2f 100644 --- a/library/cpp/netliba/v6/udp_socket.h +++ b/library/cpp/netliba/v6/udp_socket.h @@ -9,9 +9,7 @@ namespace NNetliba { bool IsLocalIPv6(ui64 network, ui64 iface); bool InitLocalIPList(); - enum { - UDP_LOW_LEVEL_HEADER_SIZE = 4, - }; + constexpr int UDP_LOW_LEVEL_HEADER_SIZE = 4; using NNetlibaSocket::EFragFlag; using NNetlibaSocket::FF_ALLOW_FRAG; |