zhangyue1818 commented on code in PR #1467:
URL: https://github.com/apache/cloudberry/pull/1467#discussion_r2587800147
##########
contrib/udp2/ic_common/udp2/ic_udp2_internal.hpp:
##########
@@ -63,6 +66,21 @@
namespace {
+/*
+ * Hints to the compiler about the likelihood of a branch. Both likely() and
+ * unlikely() return the boolean value of the contained expression.
+ *
+ * These should only be used sparingly, in very hot code paths. It's very easy
+ * to mis-estimate likelihoods.
+ */
+#if __GNUC__ >= 3
+#define likely(x) __builtin_expect((x) != 0, 1)
+#define unlikely(x) __builtin_expect((x) != 0, 0)
+#else
+#define likely(x) ((x) != 0)
+#define unlikely(x) ((x) != 0)
+#endif
+
Review Comment:
fix it with
[ff38751](https://github.com/apache/cloudberry/pull/1467/commits/ff387512100fe0e86e21ad424945c3431f8f7ad3)
##########
contrib/udp2/ic_common/udp2/ic_udp2_internal.hpp:
##########
@@ -434,6 +455,58 @@ ic_bswap32(uint32 x)
((x >> 24) & 0x000000ff);
}
+#define TIMEOUT_Z
+#define RTT_SHIFT_ALPHA (3) /* srtt (0.125) */
+#define LOSS_THRESH (3) /* Packet loss triggers Karn */
+#define RTO_MIN (5000) /* MIN RTO(ms) */
+#define RTO_MAX (100000) /* MAX RTO(ms) */
+#define UDP_INFINITE_SSTHRESH 0x7fffffff
+
+#define SEC_TO_USEC(t) ((t) * 1000000)
+#define SEC_TO_MSEC(t) ((t) * 1000)
+#define MSEC_TO_USEC(t) ((t) * 1000)
+#define USEC_TO_SEC(t) ((t) / 1000000)
+#define TIME_TICK (1000000/HZ)/* in us */
+
+#define UDP_INITIAL_RTO (MSEC_TO_USEC(200))
+#define UDP_DEFAULT_MSS 1460
+
+#define RTO_HASH (3000)
+
+#define UDP_SEQ_LT(a,b) ((int32_t)((a)-(b)) < 0)
+#define UDP_SEQ_LEQ(a,b) ((int32_t)((a)-(b)) <= 0)
+#define UDP_SEQ_GT(a,b) ((int32_t)((a)-(b)) > 0)
+#define UDP_SEQ_GEQ(a,b) ((int32_t)((a)-(b)) >= 0)
+
+#ifndef MAX
+#define MAX(a, b) ((a)>(b)?(a):(b))
+#endif
+#ifndef MIN
+#define MIN(a, b) ((a)<(b)?(a):(b))
+#endif
Review Comment:
fix it with
[ff38751](https://github.com/apache/cloudberry/pull/1467/commits/ff387512100fe0e86e21ad424945c3431f8f7ad3)
##########
contrib/udp2/ic_common/udp2/ic_udp2_internal.hpp:
##########
@@ -434,6 +455,58 @@ ic_bswap32(uint32 x)
((x >> 24) & 0x000000ff);
}
+#define TIMEOUT_Z
+#define RTT_SHIFT_ALPHA (3) /* srtt (0.125) */
+#define LOSS_THRESH (3) /* Packet loss triggers Karn */
+#define RTO_MIN (5000) /* MIN RTO(ms) */
+#define RTO_MAX (100000) /* MAX RTO(ms) */
+#define UDP_INFINITE_SSTHRESH 0x7fffffff
+
+#define SEC_TO_USEC(t) ((t) * 1000000)
+#define SEC_TO_MSEC(t) ((t) * 1000)
+#define MSEC_TO_USEC(t) ((t) * 1000)
+#define USEC_TO_SEC(t) ((t) / 1000000)
+#define TIME_TICK (1000000/HZ)/* in us */
+
+#define UDP_INITIAL_RTO (MSEC_TO_USEC(200))
+#define UDP_DEFAULT_MSS 1460
+
+#define RTO_HASH (3000)
+
+#define UDP_SEQ_LT(a,b) ((int32_t)((a)-(b)) < 0)
+#define UDP_SEQ_LEQ(a,b) ((int32_t)((a)-(b)) <= 0)
+#define UDP_SEQ_GT(a,b) ((int32_t)((a)-(b)) > 0)
+#define UDP_SEQ_GEQ(a,b) ((int32_t)((a)-(b)) >= 0)
+
+#ifndef MAX
+#define MAX(a, b) ((a)>(b)?(a):(b))
+#endif
+#ifndef MIN
+#define MIN(a, b) ((a)<(b)?(a):(b))
+#endif
+
+#define UDP_RTO_MIN ((unsigned)(HZ/5))
+
+struct UDPConn;
+struct rto_hashstore
+{
+ uint32_t rto_now_idx; /* pointing the hs_table_s index */
+ uint32_t rto_now_ts;
+
+ TAILQ_HEAD(rto_head, UDPConn) rto_list[RTO_HASH + 1];
+};
+
+struct mudp_manager
+{
+ struct rto_hashstore *rto_store; /* lists related to timeout */
+
+ int rto_list_cnt;
+ uint32_t cur_ts;
+};
+
+typedef struct mudp_manager* mudp_manager_t;
+static struct mudp_manager mudp;
Review Comment:
fix it with
[ff38751](https://github.com/apache/cloudberry/pull/1467/commits/ff387512100fe0e86e21ad424945c3431f8f7ad3)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]