* [Cluster-devel] [PATCH RESEND dlm-next 0/2] fs: dlm: add support to set skb mark value
@ 2020-06-16 17:47 Alexander Aring
2020-06-16 17:47 ` [Cluster-devel] [PATCH RESEND dlm-next 1/2] fs: dlm: set skb mark for listen socket Alexander Aring
2020-06-16 17:47 ` [Cluster-devel] [PATCH RESEND dlm-next 2/2] fs: dlm: set skb mark per peer socket Alexander Aring
0 siblings, 2 replies; 3+ messages in thread
From: Alexander Aring @ 2020-06-16 17:47 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
this patch series adds support for setting the skb mark value as socket
option. It's not possible yet to change this after the socket is
created, although the mark value can be changed afterwards.
How to test it:
1. Setup mark values
echo 0xcafe > /sys/kernel/config/dlm/cluster/mark
echo 0xbeef > /sys/kernel/config/dlm/cluster/comms/2/mark
Note: setting a mark value for local node has no effect.
2. Add some skb mark classifier:
tc qdisc add dev $DEV root handle 1: htb
tc filter add dev $DEV parent 1: u32 match mark 0xcafe 0xffffffff action ok
tc filter add dev $DEV parent 1: u32 match mark 0xbeef 0xffffffff action ok
3. Mount e.g. gfs2
4. dump stats:
tc -s -d filter show dev $DEV
5. Open e.g. wireshark and check the success rate of stats
I have also patches for dlm user space to set these values via
dlm controld.
- Alex
RESEND the whole series because I don't see them in the archive,
I think because I wasn't subscribed before.
Alexander Aring (2):
fs: dlm: set skb mark for listen socket
fs: dlm: set skb mark per peer socket
fs/dlm/config.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
fs/dlm/config.h | 2 ++
fs/dlm/lowcomms.c | 40 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+)
--
2.26.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH RESEND dlm-next 1/2] fs: dlm: set skb mark for listen socket
2020-06-16 17:47 [Cluster-devel] [PATCH RESEND dlm-next 0/2] fs: dlm: add support to set skb mark value Alexander Aring
@ 2020-06-16 17:47 ` Alexander Aring
2020-06-16 17:47 ` [Cluster-devel] [PATCH RESEND dlm-next 2/2] fs: dlm: set skb mark per peer socket Alexander Aring
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Aring @ 2020-06-16 17:47 UTC (permalink / raw)
To: cluster-devel.redhat.com
This patch adds support to set the skb mark value for the DLM listen
tcp and sctp sockets. The mark value will be offered as cluster
configuration. At creation time of the listen socket it will be set as
socket option.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/dlm/config.c | 6 ++++++
fs/dlm/config.h | 1 +
fs/dlm/lowcomms.c | 16 ++++++++++++++++
3 files changed, 23 insertions(+)
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 3b21082e1b55..d74655cd6cd3 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -73,6 +73,7 @@ struct dlm_cluster {
unsigned int cl_log_debug;
unsigned int cl_log_info;
unsigned int cl_protocol;
+ unsigned int cl_mark;
unsigned int cl_timewarn_cs;
unsigned int cl_waitwarn_us;
unsigned int cl_new_rsb_count;
@@ -96,6 +97,7 @@ enum {
CLUSTER_ATTR_LOG_DEBUG,
CLUSTER_ATTR_LOG_INFO,
CLUSTER_ATTR_PROTOCOL,
+ CLUSTER_ATTR_MARK,
CLUSTER_ATTR_TIMEWARN_CS,
CLUSTER_ATTR_WAITWARN_US,
CLUSTER_ATTR_NEW_RSB_COUNT,
@@ -168,6 +170,7 @@ CLUSTER_ATTR(scan_secs, 1);
CLUSTER_ATTR(log_debug, 0);
CLUSTER_ATTR(log_info, 0);
CLUSTER_ATTR(protocol, 0);
+CLUSTER_ATTR(mark, 0);
CLUSTER_ATTR(timewarn_cs, 1);
CLUSTER_ATTR(waitwarn_us, 0);
CLUSTER_ATTR(new_rsb_count, 0);
@@ -183,6 +186,7 @@ static struct configfs_attribute *cluster_attrs[] = {
[CLUSTER_ATTR_LOG_DEBUG] = &cluster_attr_log_debug,
[CLUSTER_ATTR_LOG_INFO] = &cluster_attr_log_info,
[CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol,
+ [CLUSTER_ATTR_MARK] = &cluster_attr_mark,
[CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs,
[CLUSTER_ATTR_WAITWARN_US] = &cluster_attr_waitwarn_us,
[CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count,
@@ -855,6 +859,7 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)
#define DEFAULT_LOG_DEBUG 0
#define DEFAULT_LOG_INFO 1
#define DEFAULT_PROTOCOL 0
+#define DEFAULT_MARK 0
#define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */
#define DEFAULT_WAITWARN_US 0
#define DEFAULT_NEW_RSB_COUNT 128
@@ -871,6 +876,7 @@ struct dlm_config_info dlm_config = {
.ci_log_debug = DEFAULT_LOG_DEBUG,
.ci_log_info = DEFAULT_LOG_INFO,
.ci_protocol = DEFAULT_PROTOCOL,
+ .ci_mark = DEFAULT_MARK,
.ci_timewarn_cs = DEFAULT_TIMEWARN_CS,
.ci_waitwarn_us = DEFAULT_WAITWARN_US,
.ci_new_rsb_count = DEFAULT_NEW_RSB_COUNT,
diff --git a/fs/dlm/config.h b/fs/dlm/config.h
index 2b471aae4e61..13508ec3ff5e 100644
--- a/fs/dlm/config.h
+++ b/fs/dlm/config.h
@@ -31,6 +31,7 @@ struct dlm_config_info {
int ci_log_debug;
int ci_log_info;
int ci_protocol;
+ int ci_mark;
int ci_timewarn_cs;
int ci_waitwarn_us;
int ci_new_rsb_count;
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index cdfaf4f0e11a..1bc32e728ba4 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1240,6 +1240,14 @@ static struct socket *tcp_create_listen_sock(struct connection *con,
goto create_out;
}
+ /* set skb mark */
+ result = kernel_setsockopt(sock, SOL_SOCKET, SO_MARK,
+ (char *)&dlm_config.ci_mark,
+ sizeof(dlm_config.ci_mark));
+ if (result < 0)
+ log_print("Failed to set SO_MARK value to %u",
+ dlm_config.ci_mark);
+
/* Turn off Nagle's algorithm */
kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, (char *)&one,
sizeof(one));
@@ -1324,6 +1332,14 @@ static int sctp_listen_for_all(void)
goto out;
}
+ /* set skb mark */
+ result = kernel_setsockopt(sock, SOL_SOCKET, SO_MARK,
+ (char *)&dlm_config.ci_mark,
+ sizeof(dlm_config.ci_mark));
+ if (result < 0)
+ log_print("Failed to set SO_MARK value to %u",
+ dlm_config.ci_mark);
+
result = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE,
(char *)&bufsize, sizeof(bufsize));
if (result)
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH RESEND dlm-next 2/2] fs: dlm: set skb mark per peer socket
2020-06-16 17:47 [Cluster-devel] [PATCH RESEND dlm-next 0/2] fs: dlm: add support to set skb mark value Alexander Aring
2020-06-16 17:47 ` [Cluster-devel] [PATCH RESEND dlm-next 1/2] fs: dlm: set skb mark for listen socket Alexander Aring
@ 2020-06-16 17:47 ` Alexander Aring
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Aring @ 2020-06-16 17:47 UTC (permalink / raw)
To: cluster-devel.redhat.com
This patch adds support to set the skb mark value for the DLM tcp and
sctp socket per peer. The mark value will be offered as per comm value
of configfs. At creation time of the peer socket it will be set as
socket option.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/dlm/config.c | 38 ++++++++++++++++++++++++++++++++++++++
fs/dlm/config.h | 1 +
fs/dlm/lowcomms.c | 24 ++++++++++++++++++++++++
3 files changed, 63 insertions(+)
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index d74655cd6cd3..47f0b98b707f 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -200,6 +200,7 @@ enum {
COMM_ATTR_LOCAL,
COMM_ATTR_ADDR,
COMM_ATTR_ADDR_LIST,
+ COMM_ATTR_MARK,
};
enum {
@@ -232,6 +233,7 @@ struct dlm_comm {
int nodeid;
int local;
int addr_count;
+ unsigned int mark;
struct sockaddr_storage *addr[DLM_MAX_ADDR_COUNT];
};
@@ -469,6 +471,7 @@ static struct config_item *make_comm(struct config_group *g, const char *name)
cm->nodeid = -1;
cm->local = 0;
cm->addr_count = 0;
+ cm->mark = 0;
return &cm->item;
}
@@ -664,8 +667,28 @@ static ssize_t comm_addr_list_show(struct config_item *item, char *buf)
return 4096 - allowance;
}
+static ssize_t comm_mark_show(struct config_item *item, char *buf)
+{
+ return sprintf(buf, "%u\n", config_item_to_comm(item)->mark);
+}
+
+static ssize_t comm_mark_store(struct config_item *item, const char *buf,
+ size_t len)
+{
+ unsigned int mark;
+ int rc;
+
+ rc = kstrtouint(buf, 0, &mark);
+ if (rc)
+ return rc;
+
+ config_item_to_comm(item)->mark = mark;
+ return len;
+}
+
CONFIGFS_ATTR(comm_, nodeid);
CONFIGFS_ATTR(comm_, local);
+CONFIGFS_ATTR(comm_, mark);
CONFIGFS_ATTR_WO(comm_, addr);
CONFIGFS_ATTR_RO(comm_, addr_list);
@@ -674,6 +697,7 @@ static struct configfs_attribute *comm_attrs[] = {
[COMM_ATTR_LOCAL] = &comm_attr_local,
[COMM_ATTR_ADDR] = &comm_attr_addr,
[COMM_ATTR_ADDR_LIST] = &comm_attr_addr_list,
+ [COMM_ATTR_MARK] = &comm_attr_mark,
NULL,
};
@@ -833,6 +857,20 @@ int dlm_comm_seq(int nodeid, uint32_t *seq)
return 0;
}
+int dlm_comm_mark(int nodeid, unsigned int *mark)
+{
+ struct dlm_comm *cm;
+
+ cm = get_comm(nodeid);
+ if (!cm)
+ return -ENOENT;
+
+ *mark = cm->mark;
+ put_comm(cm);
+
+ return 0;
+}
+
int dlm_our_nodeid(void)
{
return local_comm ? local_comm->nodeid : 0;
diff --git a/fs/dlm/config.h b/fs/dlm/config.h
index 13508ec3ff5e..f62996cad561 100644
--- a/fs/dlm/config.h
+++ b/fs/dlm/config.h
@@ -46,6 +46,7 @@ void dlm_config_exit(void);
int dlm_config_nodes(char *lsname, struct dlm_config_node **nodes_out,
int *count_out);
int dlm_comm_seq(int nodeid, uint32_t *seq);
+int dlm_comm_mark(int nodeid, unsigned int *mark);
int dlm_our_nodeid(void);
int dlm_our_addr(struct sockaddr_storage *addr, int num);
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 1bc32e728ba4..e00caad63be9 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1035,6 +1035,7 @@ static void sctp_connect_to_sock(struct connection *con)
int result;
int addr_len;
struct socket *sock;
+ unsigned int mark;
struct __kernel_sock_timeval tv = { .tv_sec = 5, .tv_usec = 0 };
if (con->nodeid == 0) {
@@ -1066,6 +1067,17 @@ static void sctp_connect_to_sock(struct connection *con)
if (result < 0)
goto socket_err;
+ /* set skb mark */
+ result = dlm_comm_mark(con->nodeid, &mark);
+ if (result < 0)
+ goto bind_err;
+
+ result = kernel_setsockopt(sock, SOL_SOCKET, SO_MARK,
+ (char *)&mark, sizeof(mark));
+ if (result < 0)
+ log_print("Failed to set SO_MARK value to %u",
+ dlm_config.ci_mark);
+
con->rx_action = receive_from_sock;
con->connect_action = sctp_connect_to_sock;
add_sock(sock, con);
@@ -1132,6 +1144,7 @@ static void tcp_connect_to_sock(struct connection *con)
struct sockaddr_storage saddr, src_addr;
int addr_len;
struct socket *sock = NULL;
+ unsigned int mark;
int one = 1;
int result;
@@ -1154,6 +1167,17 @@ static void tcp_connect_to_sock(struct connection *con)
if (result < 0)
goto out_err;
+ /* set skb mark */
+ result = dlm_comm_mark(con->nodeid, &mark);
+ if (result < 0)
+ goto out_err;
+
+ result = kernel_setsockopt(sock, SOL_SOCKET, SO_MARK,
+ (char *)&mark, sizeof(mark));
+ if (result < 0)
+ log_print("Failed to set SO_MARK value to %u",
+ dlm_config.ci_mark);
+
memset(&saddr, 0, sizeof(saddr));
result = nodeid_to_addr(con->nodeid, &saddr, NULL, false);
if (result < 0) {
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-16 17:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-16 17:47 [Cluster-devel] [PATCH RESEND dlm-next 0/2] fs: dlm: add support to set skb mark value Alexander Aring
2020-06-16 17:47 ` [Cluster-devel] [PATCH RESEND dlm-next 1/2] fs: dlm: set skb mark for listen socket Alexander Aring
2020-06-16 17:47 ` [Cluster-devel] [PATCH RESEND dlm-next 2/2] fs: dlm: set skb mark per peer socket Alexander Aring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).