[Devel] [PATCH RHEL9 COMMIT] ms/openvswitch: add OVS_DP_ATTR_PER_CPU_PIDS to get requests

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 19 20:05:12 MSK 2023


The commit is pushed to "branch-rh9-5.14.0-162.18.1.vz9.19.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-162.18.1.vz9.19.8
------>
commit 80377dab5baa0e8eacefc096da20331955ba802e
Author: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
Date:   Tue Apr 25 13:11:42 2023 +0300

    ms/openvswitch: add OVS_DP_ATTR_PER_CPU_PIDS to get requests
    
    CRIU needs OVS_DP_ATTR_PER_CPU_PIDS to checkpoint/restore newest
    openvswitch versions.
    Add pids to generic datapath reply. Limit exported pids amount to
    nr_cpu_ids.
    
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
    
    Acked-by: Christian Brauner (Microsoft) <brauner at kernel.org>
    Signed-off-by: Jakub Kicinski <kuba at kernel.org>
    
    (cherry picked from ms commit 347541e299d50c154f69ead0fcac2917a63e4481)
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
    
    ======
    Patchset description:
    net/openvswitch: pull ms API
    
    Revert our patch for openvswitch, apply the ones that got accepted
    into mainstream:
    https://lore.kernel.org/all/20220825020450.664147-1-andrey.zhadchenko@virtuozzo.com/
    
    Andrey Zhadchenko (4):
      Revert "net: openvswitch: add capability to specify ifindex of new
        links"
      openvswitch: fix memory leak at failed datapath creation
      openvswitch: allow specifying ifindex of new interfaces
      openvswitch: add OVS_DP_ATTR_PER_CPU_PIDS to get requests
    
    https://jira.vzint.dev/browse/PSBM-147353
    
    Feature: ve: CRIU support
---
 net/openvswitch/datapath.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index be2686a7b93f..2855dcdf6ef1 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1515,6 +1515,7 @@ static size_t ovs_dp_cmd_msg_size(void)
 	msgsize += nla_total_size_64bit(sizeof(struct ovs_dp_megaflow_stats));
 	msgsize += nla_total_size(sizeof(u32)); /* OVS_DP_ATTR_USER_FEATURES */
 	msgsize += nla_total_size(sizeof(u32)); /* OVS_DP_ATTR_MASKS_CACHE_SIZE */
+	msgsize += nla_total_size(sizeof(u32) * nr_cpu_ids); /* OVS_DP_ATTR_PER_CPU_PIDS */
 
 	return msgsize;
 }
@@ -1526,7 +1527,8 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
 	struct ovs_header *ovs_header;
 	struct ovs_dp_stats dp_stats;
 	struct ovs_dp_megaflow_stats dp_megaflow_stats;
-	int err;
+	struct dp_nlsk_pids *pids = ovsl_dereference(dp->upcall_portids);
+	int err, pids_len;
 
 	ovs_header = genlmsg_put(skb, portid, seq, &dp_datapath_genl_family,
 				 flags, cmd);
@@ -1556,6 +1558,12 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
 			ovs_flow_tbl_masks_cache_size(&dp->table)))
 		goto nla_put_failure;
 
+	if (dp->user_features & OVS_DP_F_DISPATCH_UPCALL_PER_CPU && pids) {
+		pids_len = min(pids->n_pids, nr_cpu_ids) * sizeof(u32);
+		if (nla_put(skb, OVS_DP_ATTR_PER_CPU_PIDS, pids_len, &pids->pids))
+			goto nla_put_failure;
+	}
+
 	genlmsg_end(skb, ovs_header);
 	return 0;
 


More information about the Devel mailing list