public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Force reconnect children from within a DXE driver
@ 2016-10-17 16:05 Marcin Wojtas
  2016-10-17 17:00 ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: Marcin Wojtas @ 2016-10-17 16:05 UTC (permalink / raw)
  To: edk2-devel
  Cc: Tian, Feng, Kinney, Michael D, Gao, Liming, Leif Lindholm,
	Neta Zur Hershkovits, nadavh, Joe Zhou, Yehuda Yitschak,
	semihalf-dabros-jan

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 appreciate any help.

Best regards,
Marcin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Force reconnect children from within a DXE driver
  2016-10-17 16:05 Force reconnect children from within a DXE driver Marcin Wojtas
@ 2016-10-17 17:00 ` Laszlo Ersek
  2016-10-26 16:02   ` Marcin Wojtas
  0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2016-10-17 17:00 UTC (permalink / raw)
  To: Marcin Wojtas
  Cc: edk2-devel, Tian, Feng, Joe Zhou, Leif Lindholm, nadavh,
	Neta Zur Hershkovits, Gao, Liming, Kinney, Michael D

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Force reconnect children from within a DXE driver
  2016-10-17 17:00 ` Laszlo Ersek
@ 2016-10-26 16:02   ` Marcin Wojtas
  2016-10-26 17:40     ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: Marcin Wojtas @ 2016-10-26 16:02 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: edk2-devel, Tian, Feng, Joe Zhou, Leif Lindholm, nadavh,
	Neta Zur Hershkovits, Gao, Liming, Kinney, Michael D

Hi Laszlo,

Thank you for your help. It worked finally worked.

Best regards,
Marcin

2016-10-17 19:00 GMT+02:00 Laszlo Ersek <lersek@redhat.com>:
> 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
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Force reconnect children from within a DXE driver
  2016-10-26 16:02   ` Marcin Wojtas
@ 2016-10-26 17:40     ` Laszlo Ersek
  0 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2016-10-26 17:40 UTC (permalink / raw)
  To: Marcin Wojtas
  Cc: edk2-devel, Tian, Feng, Joe Zhou, Leif Lindholm, nadavh,
	Neta Zur Hershkovits, Gao, Liming, Kinney, Michael D

On 10/26/16 18:02, Marcin Wojtas wrote:
> Hi Laszlo,
> 
> Thank you for your help. It worked finally worked.

Thanks for the feedback! :)
Laszlo

> 2016-10-17 19:00 GMT+02:00 Laszlo Ersek <lersek@redhat.com>:
>> 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
>>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-26 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-17 16:05 Force reconnect children from within a DXE driver Marcin Wojtas
2016-10-17 17:00 ` Laszlo Ersek
2016-10-26 16:02   ` Marcin Wojtas
2016-10-26 17:40     ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox