From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E0F261A1E10 for ; Mon, 17 Oct 2016 10:00:31 -0700 (PDT) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 270394E4C0; Mon, 17 Oct 2016 17:00:31 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-91.phx2.redhat.com [10.3.116.91]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9HH0Spr017549; Mon, 17 Oct 2016 13:00:29 -0400 To: Marcin Wojtas References: Cc: edk2-devel@ml01.01.org, "Tian, Feng" , Joe Zhou , Leif Lindholm , nadavh@marvell.com, Neta Zur Hershkovits , "Gao, Liming" , "Kinney, Michael D" From: Laszlo Ersek Message-ID: <46cc75e7-ea19-a10d-36ea-470d6ef29d62@redhat.com> Date: Mon, 17 Oct 2016 19:00:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Oct 2016 17:00:31 +0000 (UTC) Subject: Re: Force reconnect children from within a DXE driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 17:00:32 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 10/17/16 18:05, Marcin Wojtas wrote: > Hi, > > Short introduction to the problem I'm facing with EDK2: I implemented > 'ifconfig' command extension allowing to change interface's MAC > address or reset it to the default value. For that I needed to add a > couple of helper functions in DxeNetLib, which parse input string and > one that calls Snp->StationAddress callback from the NIC driver. > > The problem is that the drivers associated to interface device > comprise a copy of SnpMode, not original pointer. It causes an obvious > mismatch, because only the latter got updated with new > Snp->Mode->CurrentAddress. I found out that using 'reconnect' command > after MAC address change from uefi shell helps and the network can > operate properly. > > Hence I have a question - is there a way to force reconnecting all > children drivers from the network controller driver level? I.e. it > would be great if it was possible not to be forced to call 'ifconfig' > command and then 'reconnect', but call some function(s) e.g. from > Snp->StationAddress callback. I would try this: - From the shell command (which is running in the shell application), open the SNP interface in exclusive mode. This should either fail (if there's already an exclusive open on the interface), or succeed and force other drivers to disconnect, recursively. - Call Snp->StationAddress to change the MAC. - Close the protocol interface. - Call gBS->ConnectController() to (re)connect all the drivers, recursively, to the handle with the SNP on it. Thanks Laszlo