added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,25 @@
From e291d720a7d9576063717969dde82c33bac7eecf Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 11 Apr 2017 14:19:21 -0700
Subject: [PATCH 1/2] include sys/select.h for FD_* definitions
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
demos/inventory_sim/inventory_sim.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/demos/inventory_sim/inventory_sim.c b/demos/inventory_sim/inventory_sim.c
index fadf27b..22c33d1 100644
--- a/demos/inventory_sim/inventory_sim.c
+++ b/demos/inventory_sim/inventory_sim.c
@@ -132,6 +132,7 @@ Examples
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
+#include <sys/select.h>
#include <netinet/in.h>
#include <linux/tipc.h>
--
2.12.2

View File

@@ -0,0 +1,33 @@
From 1ce892749e4f53bd0aeaa4c3ce45f80178799411 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 3 Mar 2018 17:52:51 -0800
Subject: [PATCH] multicast_blast/tipcc: Fix struct type for TIPC_GROUP_JOIN
Kernel defines it as tipc_group_req and not tipc_mreq
this code was not excercised with older kernels so we
never ran into the compiler failures since TIPC_GROUP_JOIN
is only defined in kernel starting 4.15
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending
multicast_blast/tipcc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/multicast_blast/tipcc.c b/multicast_blast/tipcc.c
index 90644d3..911c759 100755
--- a/multicast_blast/tipcc.c
+++ b/multicast_blast/tipcc.c
@@ -213,7 +213,7 @@ int tipc_accept(int sd, struct tipc_addr *src)
int tipc_join(int sd, struct tipc_addr *member)
{
#ifdef TIPC_GROUP_JOIN
- struct tipc_mreq mreq = {
+ struct tipc_group_req mreq = {
.type = member->type,
.instance = member->instance,
.scope = domain2scope(member->domain)
--
2.16.2

View File

@@ -0,0 +1,66 @@
From 4e4c8c7a1cca2125e2bf2a67cbab0bdbd78fdb86 Mon Sep 17 00:00:00 2001
From: He Zhe <zhe.he@windriver.com>
Date: Tue, 30 Jul 2019 13:24:22 +0800
Subject: [PATCH] ptts: Set recv buffer size too max to receive as many
packets as possible
Flooding multicast may make the rcv buffer overrun and is considered
premature messages later and thus cause the following error.
"Ignoring premature msg 16, currently handling 12"
This patch sets SO_RCVBUF the of socket to max int value to receive as many
packets as possible, and give a hint to user when possible overrun occurs. Note
that the value of SO_RCVBUF will be limited up to min(INT_MAX/2,
sysctl_rmem_max) in kernel.
Signed-off-by: He Zhe <zhe.he@windriver.com>
Upstream-Status: Backport
Signed-off-by: Li Zhou <li.zhou@windriver.com>
---
ptts/tipc_ts_server.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/ptts/tipc_ts_server.c b/ptts/tipc_ts_server.c
index a286daa..3a2f96f 100644
--- a/ptts/tipc_ts_server.c
+++ b/ptts/tipc_ts_server.c
@@ -641,8 +641,9 @@ void server_mcast
if (rc < 0)
err("multicast message not received");
if (msgno != *(int*) buf) {
- dbg1("Ignoring premature msg %u, currently handling %u\n",
- *(int*)buf, msgno);
+ dbg1("Ignoring premature msg %u, currently handling %u\n"
+ "You can enlarge /proc/sys/net/core/rmem_max and try again\n",
+ *(int*)buf, msgno);
continue;
}
rc = recvfrom(sd[i], buf, expected_szs[numSubTest],
@@ -687,8 +688,21 @@ void server_test_multicast(void)
FD_ZERO(&readfds);
for (i = 0; i < TIPC_MCAST_SOCKETS; i++) {
+ int optval = (int)(~0U >> 1);
+ socklen_t optlen = sizeof(optval);
+ int rc = 0;
+
sd[i] = createSocketTIPC (SOCK_RDM);
FD_SET(sd[i], &readfds);
+
+ /*
+ * Flooding multicast may make the rcv buffer overrun and considered premature msg later.
+ * Set SO_RCVBUF to max int value to receive as many packets as possible.
+ * Note that it will be limited up to min(INT_MAX/2, sysctl_rmem_max) in kernel.
+ */
+ rc = setsockopt(sd[i], SOL_SOCKET, SO_RCVBUF, (const char*)&optval, optlen);
+ if(rc != 0)
+ printf("Failed to set SO_RCVBUF of %d: %s\n", sd[i], strerror(errno));
}
server_bindMulticast( 0, 99, sd[0]);
--
2.17.1

View File

@@ -0,0 +1,211 @@
From 3d091efa09478d0330be686184ae4793764504e7 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 11 Apr 2017 14:22:23 -0700
Subject: [PATCH 2/2] replace non-standard uint with unsigned int
make it portable on musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
demos/benchmark/client_tipc.c | 34 +++++++++++++++++-----------------
demos/benchmark/common_tipc.h | 2 +-
demos/benchmark/server_tipc.c | 10 +++++-----
demos/inventory_sim/inventory_sim.c | 12 ++++++------
4 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/demos/benchmark/client_tipc.c b/demos/benchmark/client_tipc.c
index 5d889ee..d913e42 100644
--- a/demos/benchmark/client_tipc.c
+++ b/demos/benchmark/client_tipc.c
@@ -65,7 +65,7 @@ static const struct sockaddr_tipc master_clnt_addr = {
static int master_clnt_sd;
static int master_srv_sd;
-static uint client_id;
+static unsigned int client_id;
static unsigned char *buf = NULL;
static int non_blk = 0;
static int select_ip(struct srv_info *sinfo, char *name);
@@ -79,7 +79,7 @@ struct master_client_cmd {
__u32 bounce;
};
-static void master_to_client(uint cmd, uint msglen, uint msgcnt, uint bounce)
+static void master_to_client(unsigned int cmd, unsigned int msglen, unsigned int msgcnt, unsigned int bounce)
{
struct master_client_cmd c;
@@ -93,7 +93,7 @@ static void master_to_client(uint cmd, uint msglen, uint msgcnt, uint bounce)
die("Unable to send cmd %u to clients\n", cmd);
}
-static void client_from_master(uint *cmd, uint *msglen, uint *msgcnt, uint *bounce)
+static void client_from_master(unsigned int *cmd, unsigned int *msglen, unsigned int *msgcnt, unsigned int *bounce)
{
struct master_client_cmd c;
@@ -114,7 +114,7 @@ struct client_master_cmd {
__u32 cmd;
};
-static void client_to_master(uint cmd)
+static void client_to_master(unsigned int cmd)
{
struct client_master_cmd c;
@@ -125,7 +125,7 @@ static void client_to_master(uint cmd)
die("Client: Unable to send msg to master\n");
}
-static void master_from_client(uint *cmd)
+static void master_from_client(unsigned int *cmd)
{
struct client_master_cmd c;
@@ -137,7 +137,7 @@ static void master_from_client(uint *cmd)
*cmd = ntohl(c.cmd);
}
-static void master_to_srv(uint cmd, uint msglen, uint msgcnt, uint echo)
+static void master_to_srv(unsigned int cmd, unsigned int msglen, unsigned int msgcnt, unsigned int echo)
{
struct master_srv_cmd c;
@@ -151,7 +151,7 @@ static void master_to_srv(uint cmd, uint msglen, uint msgcnt, uint echo)
die("Unable to send cmd %u to servers\n", cmd);
}
-static void master_from_srv(uint *cmd, struct srv_info *sinfo, __u32 *tipc_addr)
+static void master_from_srv(unsigned int *cmd, struct srv_info *sinfo, __u32 *tipc_addr)
{
struct srv_to_master_cmd c;
@@ -290,7 +290,7 @@ static void client_main(unsigned int clnt_id, ushort tcp_port, int tcp_addr)
{
int peer_sd, efd = 0;
int imp = clnt_id % 4;
- uint cmd, msglen, msgcnt, echo;
+ unsigned int cmd, msglen, msgcnt, echo;
struct epoll_event event, revents;
struct sockaddr_in tcp_dest;
int rc;
@@ -400,22 +400,22 @@ static void client_main(unsigned int clnt_id, ushort tcp_port, int tcp_addr)
int main(int argc, char *argv[], char *dummy[])
{
int c;
- uint cmd;
- uint latency_transf = DEFAULT_LAT_MSGS;
- uint thruput_transf = DEFAULT_THRU_MSGS;
- uint req_clients = DEFAULT_CLIENTS;
- uint first_msglen = DEFAULT_MSGLEN;
- uint last_msglen = TIPC_MAX_USER_MSG_SIZE;
+ unsigned int cmd;
+ unsigned int latency_transf = DEFAULT_LAT_MSGS;
+ unsigned int thruput_transf = DEFAULT_THRU_MSGS;
+ unsigned int req_clients = DEFAULT_CLIENTS;
+ unsigned int first_msglen = DEFAULT_MSGLEN;
+ unsigned int last_msglen = TIPC_MAX_USER_MSG_SIZE;
unsigned long long msglen;
unsigned long long num_clients;
struct timeval start_time;
unsigned long long elapsed;
unsigned long long msgcnt;
unsigned long long iter;
- uint clnt_id;
- uint conn_typ = TIPC_CONN;
+ unsigned int clnt_id;
+ unsigned int conn_typ = TIPC_CONN;
ushort tcp_port = 0;
- uint tcp_addr = 0;
+ unsigned int tcp_addr = 0;
struct srv_info sinfo;
__u32 peer_tipc_addr;
char ifname[16] = {0,};
diff --git a/demos/benchmark/common_tipc.h b/demos/benchmark/common_tipc.h
index 1765ba1..47947e0 100644
--- a/demos/benchmark/common_tipc.h
+++ b/demos/benchmark/common_tipc.h
@@ -256,7 +256,7 @@ static void get_ip_list(struct srv_info *sinfo, char *ifname)
}
}
-static uint own_node(void)
+static unsigned int own_node(void)
{
struct sockaddr_tipc addr;
socklen_t sz = sizeof(addr);
diff --git a/demos/benchmark/server_tipc.c b/demos/benchmark/server_tipc.c
index 9d0e2be..3cd82b7 100644
--- a/demos/benchmark/server_tipc.c
+++ b/demos/benchmark/server_tipc.c
@@ -45,7 +45,7 @@ static int wait_for_connection(int listener_sd);
static void echo_messages(int peer_sd, int master_sd, int srv_id);
static __u32 own_node_addr;
-static void srv_to_master(uint cmd, struct srv_info *sinfo)
+static void srv_to_master(unsigned int cmd, struct srv_info *sinfo)
{
struct srv_to_master_cmd c;
@@ -62,7 +62,7 @@ static void srv_to_master(uint cmd, struct srv_info *sinfo)
die("Server: unable to send info to master\n");
}
-static void srv_from_master(uint *cmd, uint* msglen, uint *msgcnt, uint *echo)
+static void srv_from_master(unsigned int *cmd, unsigned int* msglen, unsigned int *msgcnt, unsigned int *echo)
{
struct master_srv_cmd c;
@@ -84,8 +84,8 @@ int main(int argc, char *argv[], char *dummy[])
{
ushort tcp_port = 4711;
struct srv_info sinfo;
- uint cmd;
- uint max_msglen;
+ unsigned int cmd;
+ unsigned int max_msglen;
struct sockaddr_in srv_addr;
int lstn_sd, peer_sd;
int srv_id = 0, srv_cnt = 0;;
@@ -221,7 +221,7 @@ static int wait_for_connection(int lstn_sd)
static void echo_messages(int peer_sd, int master_sd, int srv_id)
{
- uint cmd, msglen, msgcnt, echo, rcvd = 0;
+ unsigned int cmd, msglen, msgcnt, echo, rcvd = 0;
do {
/* Get msg length and number to expect, and ack: */
diff --git a/demos/inventory_sim/inventory_sim.c b/demos/inventory_sim/inventory_sim.c
index 22c33d1..9bf5443 100644
--- a/demos/inventory_sim/inventory_sim.c
+++ b/demos/inventory_sim/inventory_sim.c
@@ -940,9 +940,9 @@ int simItem(int itemID, int lagTime, int speed)
char outMsg[MSG_SIZE_MAX];
char *marker;
int msgSize;
- uint zone;
- uint cluster;
- uint node;
+ unsigned int zone;
+ unsigned int cluster;
+ unsigned int node;
char itemName[NAME_SIZE];
int haveItem;
int res;
@@ -1134,9 +1134,9 @@ int simCust(int itemID, int lagTime, int waitTime, int speed, int taskID)
char msg[MSG_SIZE_MAX];
char *marker;
int msgSize;
- uint zone;
- uint cluster;
- uint node;
+ unsigned int zone;
+ unsigned int cluster;
+ unsigned int node;
char custName[NAME_SIZE];
int transactionID;
int needItem;
--
2.12.2

View File

@@ -0,0 +1,49 @@
SUMMARY = "Transparent Inter-Process Communication protocol"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://tipclog/tipc.h;endline=35;md5=985b6ea8735818511d276c1b466cce98"
SRC_URI = "git://git.code.sf.net/p/tipc/tipcutils;branch=master \
file://0001-include-sys-select.h-for-FD_-definitions.patch \
file://0002-replace-non-standard-uint-with-unsigned-int.patch \
file://0001-multicast_blast-tipcc-Fix-struct-type-for-TIPC_GROUP.patch \
file://0001-test-ptts-Set-recv-buffer-size-too-max-to-receive-as.patch \
"
SRCREV = "7ab2211b87414ba240b0b2e4af219c1057c9cf9a"
PV = "2.2.0+git${SRCPV}"
inherit autotools pkgconfig
DEPENDS += "libdaemon"
RDEPENDS:${PN} = "iproute2-tipc"
S = "${WORKDIR}/git"
do_configure:prepend() {
( cd ${S}; ${S}/bootstrap )
}
do_install:append() {
demos="benchmark hello_world topology_subscr_demo connection_demo \
multicast_demo stream_demo"
for i in $demos;do
install -d ${D}/opt/tipcutils/demos/$i
install ${B}/demos/$i/client_tipc ${D}/opt/tipcutils/demos/$i/
install ${B}/demos/$i/server_tipc ${D}/opt/tipcutils/demos/$i/
done
install -d ${D}/opt/tipcutils/demos/inventory_sim
install ${B}/demos/inventory_sim/inventory_sim ${D}/opt/tipcutils/demos/inventory_sim/
install -d ${D}/opt/tipcutils/ptts
install ${B}/ptts/tipcTS ${D}/opt/tipcutils/ptts/
install ${B}/ptts/tipcTC ${D}/opt/tipcutils/ptts/
install -d ${D}${sysconfdir}
cp -R --no-dereference --preserve=mode,links -v ${S}/scripts/etc/* ${D}${sysconfdir}/
chown -R root:root ${D}${sysconfdir}
}
PACKAGES += "${PN}-demos"
FILES:${PN}-dbg += "/opt/tipcutils/demos/*/.debug /opt/tipcutils/ptts/.debug"
FILES:${PN}-demos = "/opt/tipcutils/*"