Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1909124lqp; Tue, 16 Apr 2024 01:04:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUr79YkP6MLcWvQkjhsyAieXim8pizgHsqNDXA8BKqGjnepq60cu7RIkVa577HkgCM2CIdG0F+RuBJPyak5c+Fdp0vusScEI2LpJwIO2g== X-Google-Smtp-Source: AGHT+IGLMlHD1bGtciea7nsfwKyLuWHPsrcJLb5iwtCFG+fjuutdOwWosaBFUUCxoCJl6rrBm3Sb X-Received: by 2002:a17:90b:1202:b0:2a5:3438:a31b with SMTP id gl2-20020a17090b120200b002a53438a31bmr9844793pjb.37.1713254696470; Tue, 16 Apr 2024 01:04:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713254696; cv=pass; d=google.com; s=arc-20160816; b=HI0ophGmy6OE/S5PTigrBlM3OYK8aGxr0tIqddnTnGiQKq7q/34/CFpaYP7N5uKSx9 G4fT1i/ZbINUwFs8XwbOY9ndmUIIBh027//zZMLycKnBsB06B8McQZa1kX1LxJUVOV7Y mZ6ZyAQ/ENl2Jt9fCdvoLWjrDnfRMHWJmu9H9yVfcYSt5whR6+TpKBymIsmdKv2KUDgD Qzbd0MUS518MxlkJrwQbD+XDMAq6PHhvJklToKJna8NFsiDkldd5seNkHjCaXGvezeQF DHH2Z8IWMzXqYvB2e6G4yiNC5+6u2GgPsdEj5hSvtccZci9EUxiMjPM3wVg1rd2e7+oG DvhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4mpnmnLcLPbxDi7bNweS52z62pdChPh+H06QF5Sioa0=; fh=z8iP3PWvnKzAYPiFbe/du8t0qec4QKWlM468Kh6ZIpA=; b=f9NuKv7NywXzpcRJSRt4doOJaDJHEoAryigUZ8y+wFUju4fZtuLXZ2jMEMhlSrJaVP oBwXwIGP/2cKjCeeCbzRBSwXg+CqvySKx93wf7BIGtix6A2x5bHoxJOCscXH2O1HLffA sj9unlHf+sKzBsZ0RRMUlEQtgn9sLU2VEa9X3DZrdh0HdmuyS7QB83g7GaaUK+SlGtG8 qL7/uZGZtID5evYdAIr12ZG/Uc/vaAegYTwxREppbsTsNBQ4hROGTVkXeDa8IOY3jSRP D+U7c8on3Ubio4o1/3ntA166tkaXjaIwZRg/CaO93REqJezCzjX4PzqY3ht6ru0c0Ikn Qpgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F2qZYgyj; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-146459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146459-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i91-20020a17090a3de400b002a556bda080si9033773pjc.42.2024.04.16.01.04.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 01:04:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F2qZYgyj; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-146459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146459-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B7108284978 for ; Tue, 16 Apr 2024 08:04:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03FA81581E7; Tue, 16 Apr 2024 08:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F2qZYgyj" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02ECC132492 for ; Tue, 16 Apr 2024 08:04:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713254680; cv=none; b=FcM3xHbpLZ44/B3GlJul4rF9nhohxLJ8yGqUXxVHwl8/2BsVYmM4Rum78GaNni8WrTxDILMpyPz62RJZeF3PMwDyLC/PsGmFMNEW+m7Ze5JJa3jJZn/+R9YMk5N8i7ObNKWJ9muO7wXulyAg0W7/hIOzM739Ph+kxAgXAmJHZlQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713254680; c=relaxed/simple; bh=aFtDoP+ptsA+xiiT/L0BTr1limxkEohlLYO2fK22oWU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eYRWdUytvDTnl4nmkQmGyh2nEE7UGdgn8nIz9i/TIDw3I/xybBDEE/K+wMwwfr6is5I6uSjAYZyesjJJSJ/2u03f+fBx79wFnvOQg+9rfcBaD9SsVBXoa41SV6jJk0huk42FyMdrzcIylROfpIax1ITVbapepTnObkO1/Q/JESw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=F2qZYgyj; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713254674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4mpnmnLcLPbxDi7bNweS52z62pdChPh+H06QF5Sioa0=; b=F2qZYgyjcDR2W5A3YYPrsNiM8JOf/aO8M1CWmBhMZ/5AC2cZxvnFJD6fPewwYjcYQyhH9o o9DjjDpiYHrpYveGsJlUfl35fI6NmvkhskR6lIkgRs/iJGRx/qOTmnZN0qG1n0cW2iB5Nd ryfAV+89BS6a+MI5Ia4wIrfGoLxOU0k= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-264-xJHcP4_rPCO_8-01Z6Gu6A-1; Tue, 16 Apr 2024 04:04:33 -0400 X-MC-Unique: xJHcP4_rPCO_8-01Z6Gu6A-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a51abd0d7c6so332121466b.3 for ; Tue, 16 Apr 2024 01:04:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713254671; x=1713859471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4mpnmnLcLPbxDi7bNweS52z62pdChPh+H06QF5Sioa0=; b=e3PyuHL5L5wDq38Dnp7qSttd/+1z9qUnCBj+NNyFUE3cmOHwwJ6DZaKb1CL+U832Fw tF/xEVZz8ebHkzUqOJvVPGdviu8hstpTPOdjSRwbPnbnsxzT6AT0hVuw95zXbIO+f1WO CX4hQcXnUX0ypRA/T+/m3DXmzVKTRsacBcLNfC1lSfKH5adNhtaJv5ghB54vQknPBLcx dWvoevQpSfcKRc8LQuvyaxEPY/RQHMqkGf9mo1hi+MvxqdbRO4NpG4ox3P0lUsdpK0kg iLpr3121VsdtIQlFNiGZHWn8dpFk4NvxxxN8ueeC/YvqGVTDjpAsVVIIlrRdLUTbfvRa axew== X-Forwarded-Encrypted: i=1; AJvYcCWP2Eq2TRgAiS57HTcjESOeU/5FKn14Rb2Xe32okUlQi+5sv5CmrrblmMuHETaJgAU/YcVADx4xK4dBeGWT89PBNIMt9ezINLBFF+lZ X-Gm-Message-State: AOJu0YyQNXS9BZVJ5dHYNKdwo4SGnFpsNXh459Yh71QftfSX0zD+ejjP JLEUIXtYttIPj+swh8D7Hpi+sOhbuTjFTltwIaQGh8pqAKZL9bo60DNP/BHm7E9lMrt52w1sESr LrIF5IIDae1qTCICy8BJ2572jEAFBELMo++l7rCWpKtzRMFR/APIiQ9yBCQ0j7Crxk4wJkQ== X-Received: by 2002:a17:906:3110:b0:a51:dbd3:5ac4 with SMTP id 16-20020a170906311000b00a51dbd35ac4mr6705423ejx.30.1713254671483; Tue, 16 Apr 2024 01:04:31 -0700 (PDT) X-Received: by 2002:a17:906:3110:b0:a51:dbd3:5ac4 with SMTP id 16-20020a170906311000b00a51dbd35ac4mr6705406ejx.30.1713254671065; Tue, 16 Apr 2024 01:04:31 -0700 (PDT) Received: from [10.39.194.81] (5920ab7b.static.cust.trined.nl. [89.32.171.123]) by smtp.gmail.com with ESMTPSA id s8-20020a170906284800b00a4e07760215sm6503388ejc.69.2024.04.16.01.04.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Apr 2024 01:04:30 -0700 (PDT) From: Eelco Chaudron To: Jun Gu Cc: pshelar@ovn.org, dev@openvswitch.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [ovs-dev] [PATCH] net: openvswitch: Check vport name Date: Tue, 16 Apr 2024 10:04:29 +0200 X-Mailer: MailMate (1.14r6029) Message-ID: <084E7217-6290-46D2-A47A-14ACB60EBBCA@redhat.com> In-Reply-To: <671d3c3b-a5c4-4dbd-800b-fbfec0fbe4dc@easystack.cn> References: <20240413084826.52417-1-jun.gu@easystack.cn> <9D534A61-4CC2-4374-B2D8-761216745EDD@redhat.com> <671d3c3b-a5c4-4dbd-800b-fbfec0fbe4dc@easystack.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 16 Apr 2024, at 9:57, Jun Gu wrote: > Hi Chaudron, thanks for your reply. Considerthe following scenario: > > - set a net device alias name (such as *enpxx*) into ovs. > > - |OVS_VPORT_CMD_NEW -> ||dev_get_by_name can query the net device usin= g *enpxx* name, but the dev->name that return is *ensxx* name. the |net_d= evice|struct including: ``` |struct=C2=A0net_device=C2=A0{ > char name[IFNAMSIZ]; > RH_KABI_REPLACE(struct=C2=A0hlist_node=C2=A0name_hlist, > struct=C2=A0netdev_name_node=C2=A0*name_node) > ... > |``` name_hlist include enpxx and ensxx name and both of them point to = the same net_device, the net_device's name is ensxx. So when using *enpxx= * name to query net device, the ||net device's name that return is *ensxx= * name.| > Then, openvswitch.ko will save the net device that name is*ensxx* to a= hash table. So this will cause the below process: > - ovs can'tobtain the enpxx net device by |OVS_VPORT_CMD_GET.| > -|dpif_netlink_port_poll will get a |notification after |OVS_VPORT_CMD_= NEW|, but the vport's name is ensxx. ovs will query the ensxx net device = from interface table, but nothing. So ovs will run the port_del operation= =2E > - this will cause|OVS_VPORT_CMD_NEW| and OVS_VPORT_CMD_DEL operation t= o run repeatedly. > So the above issue can be avoided by the patch. Thanks for the clarification, I forgot about the alias case. And you are = right, OVS userspace does not support using interface aliases. Maybe you can update the commit message, and add a code comment to clarif= y this in your next revision? Cheers, Eelco > =E5=9C=A8 4/15/24 18:04, Eelco Chaudron =E5=86=99=E9=81=93: >> >> On 13 Apr 2024, at 10:48, jun.gu wrote: >> >>> Check vport name from dev_get_by_name, this can avoid to add and remo= ve >>> NIC repeatedly when NIC rename failed at system startup. >>> >>> Signed-off-by: Jun Gu >>> --- >>> net/openvswitch/vport-netdev.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-n= etdev.c >>> index 903537a5da22..de8977d7f329 100644 >>> --- a/net/openvswitch/vport-netdev.c >>> +++ b/net/openvswitch/vport-netdev.c >>> @@ -78,7 +78,7 @@ struct vport *ovs_netdev_link(struct vport *vport, = const char *name) >>> int err; >>> >>> vport->dev =3D dev_get_by_name(ovs_dp_get_net(vport->dp), name); >>> - if (!vport->dev) { >>> + if (!vport->dev) || strcmp(name, ovs_vport_name(vport)) { >> Hi Jun, not sure if I get the point here, as ovs_vport_name() translat= es into vport->dev->name. >> >> So are we trying to catch the interface rename between the dev_get_by_= name(), and the code below? This rename could happen at any other place, = so this check does not guarantee anything. Or am I missing something? >> >>> err =3D -ENODEV; >>> goto error_free_vport; >>> } >>> -- = >>> 2.25.1 >>> >>> _______________________________________________ >>> dev mailing list >>> dev@openvswitch.org >>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev >>