[Devel] [PATCH RHEL9 COMMIT] Revert "net: openvswitch: add capability to specify ifindex of new links"

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 19 20:05:11 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 6c4a00a832bd96612cabbfd3e6bbac4ff87d04b4
Author: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
Date:   Tue Apr 25 13:11:39 2023 +0300

    Revert "net: openvswitch: add capability to specify ifindex of new links"
    
    This reverts commit 757ebade1eec8c6a3d1a150c8bd6f564c939c058.
    We should use the version upstream accepted
    
    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           | 16 ++--------------
 net/openvswitch/vport-internal_dev.c |  1 -
 net/openvswitch/vport.h              |  2 --
 3 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 8033c97a8d65..7e8a39a35627 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1739,7 +1739,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
 	struct vport *vport;
 	struct ovs_net *ovs_net;
 	int err;
-	struct ovs_header *ovs_header = info->userhdr;
 
 	err = -EINVAL;
 	if (!a[OVS_DP_ATTR_NAME] || !a[OVS_DP_ATTR_UPCALL_PID])
@@ -1780,7 +1779,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
 	parms.dp = dp;
 	parms.port_no = OVSP_LOCAL;
 	parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID];
-	parms.desired_ifindex = ovs_header->dp_ifindex;
 
 	/* So far only local changes have been made, now need the lock. */
 	ovs_lock();
@@ -2201,10 +2199,7 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
 	if (!a[OVS_VPORT_ATTR_NAME] || !a[OVS_VPORT_ATTR_TYPE] ||
 	    !a[OVS_VPORT_ATTR_UPCALL_PID])
 		return -EINVAL;
-
-	parms.type = nla_get_u32(a[OVS_VPORT_ATTR_TYPE]);
-
-	if (a[OVS_VPORT_ATTR_IFINDEX] && parms.type != OVS_VPORT_TYPE_INTERNAL)
+	if (a[OVS_VPORT_ATTR_IFINDEX])
 		return -EOPNOTSUPP;
 
 	port_no = a[OVS_VPORT_ATTR_PORT_NO]
@@ -2241,19 +2236,12 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
 	}
 
 	parms.name = nla_data(a[OVS_VPORT_ATTR_NAME]);
+	parms.type = nla_get_u32(a[OVS_VPORT_ATTR_TYPE]);
 	parms.options = a[OVS_VPORT_ATTR_OPTIONS];
 	parms.dp = dp;
 	parms.port_no = port_no;
 	parms.upcall_portids = a[OVS_VPORT_ATTR_UPCALL_PID];
 
-	if (parms.type == OVS_VPORT_TYPE_INTERNAL) {
-		if (a[OVS_VPORT_ATTR_IFINDEX])
-			parms.desired_ifindex =
-				nla_get_u32(a[OVS_VPORT_ATTR_IFINDEX]);
-		else
-			parms.desired_ifindex = 0;
-	}
-
 	vport = new_vport(&parms);
 	err = PTR_ERR(vport);
 	if (IS_ERR(vport)) {
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 1c25158fbdf2..1e5468137c88 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -157,7 +157,6 @@ static struct vport *internal_dev_create(const struct vport_parms *parms)
 	if (vport->port_no == OVSP_LOCAL)
 		vport->dev->features |= NETIF_F_NETNS_LOCAL;
 
-	dev->ifindex = parms->desired_ifindex;
 	rtnl_lock();
 	err = register_netdevice(vport->dev);
 	if (err)
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index 24e1cba2f1ac..9de5030d9801 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -98,8 +98,6 @@ struct vport_parms {
 	enum ovs_vport_type type;
 	struct nlattr *options;
 
-	int desired_ifindex;
-
 	/* For ovs_vport_alloc(). */
 	struct datapath *dp;
 	u16 port_no;


More information about the Devel mailing list