From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AC4F91A1E2A for ; Wed, 26 Oct 2016 09:03:00 -0700 (PDT) Received: by mail-it0-x22a.google.com with SMTP id e187so30068129itc.0 for ; Wed, 26 Oct 2016 09:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yVD6wlCBIzypX7wSwtg8qXH+lY8zcDEmg8JGXdUWc18=; b=cjeXczK9dQ/qaLkrZfwTzCYxhebf24jiuPZXn8vLx9sBKfhpkriKBQT6O6dBIOrdIB 1eka06r7OJFAdft06IbJiMnrLCGi5K+LRfgw8oQ1meagyyUL1KZ5l28BxlGyf6BoSIBl tCLE7UPIo7qcJMmDEtBGQbfVvIUrQW6jviLYFCa1Mn6RZMaVCEOEe0jfVqVaNcxx507m StiqS2B9FDI36o/1ibDPgCzs9pejceNYc/AOrOPw1N5l13Ur/7aJFnGCi3r55Ca1Uh0h Csf18V7gmh/tdV5wvlzCR83pkHtiuXrijz6gntRpFToblt3bWMPUNcX/LutsFYI517DG 9xuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yVD6wlCBIzypX7wSwtg8qXH+lY8zcDEmg8JGXdUWc18=; b=gDJC87KQ4QifvGnlFGDDqguKsh4P0uKjhoVP/K1N4E9DkHNO474TXLW8FYoy+458We evFLGAMaEvOZwL5fXlUC1aENZw56bA8ImppcCW5mWGRooE3cUT3xtMg9QcU+5LENS8n1 euuW9Cgn2KMYrhe24/jKSIozr26eEO2a1cieHiMJ7oCSp9GPDYpAASc2/zzPPUr3Ye/f L/M+KHcdcGte8y4PzR4BqdwE7SiFgIQq30+ytvOHj0AHdReBG70NgH8jgYx7gE3A1RPI IuEwhWCVQMAQNXMtLzssS3Ngb+dC0st4eq6qwPK0XkSA85iEoeZ8GZrTb7H00polJq5O 2Bow== X-Gm-Message-State: ABUngveTb63Mjiif4P9YiwwRJqsqVA34t9YSEXQTqxd3pkdC8/DTYTAYzroEprW/5VW+CO61WHNn2XRdwN9/7Q== X-Received: by 10.36.60.80 with SMTP id m77mr7001269ita.13.1477497726196; Wed, 26 Oct 2016 09:02:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.50.131 with HTTP; Wed, 26 Oct 2016 09:02:05 -0700 (PDT) In-Reply-To: <46cc75e7-ea19-a10d-36ea-470d6ef29d62@redhat.com> References: <46cc75e7-ea19-a10d-36ea-470d6ef29d62@redhat.com> From: Marcin Wojtas Date: Wed, 26 Oct 2016 18:02:05 +0200 Message-ID: To: Laszlo Ersek Cc: edk2-devel@ml01.01.org, "Tian, Feng" , Joe Zhou , Leif Lindholm , nadavh@marvell.com, Neta Zur Hershkovits , "Gao, Liming" , "Kinney, Michael D" 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: Wed, 26 Oct 2016 16:03:00 -0000 Content-Type: text/plain; charset=UTF-8 Hi Laszlo, Thank you for your help. It worked finally worked. Best regards, Marcin 2016-10-17 19:00 GMT+02:00 Laszlo Ersek : > 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 >