Skip to contentSkip to conversation

efi_selftest: Update SIMPLE_NETWORK_PROTOCOL selftest

PATCH In review Masami Hiramatsu 2 participants 11 messages Sep 16, 2021 – Oct 4, 2021

lore
Share & tools
lore
#0 lore raw

cover efi_selftest: Update SIMPLE_NETWORK_PROTOCOL selftest

Hello Heinrich,

Here is a series of patches to update the SIMPLE_NETWORK_PROTOCOL according to the explanation in the previous thread [1].

[1] https://lists.denx.de/pipermail/u-boot/2021-September/460711.html

So basically this seires modifies the SNP testcase as I said in the previous mail [1].

----
net->get_status();
if (!net->mode.MediaPresent) {
error(no link up!)
return;
}

submit_dhcp_discover()
for (;;) {
wait_for_event(net)

   while (net->receive() != EFI_NOT_READY) {
      // check dhcp reply

}
}
----

I removed EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT check because that is just expectation what the received packet avaiability is meaning that the EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT flag bit is set. Of course U-Boot EFI SNP implementation does it, but that is not ensured in the UEFI spec. The spec said that the get_status() should update the MediaPresent flag (which means the network link up or down). So I added the get_status() test case before starting the network test so that it can test the link status.

BTW, actually the mode->media_present is not supported yet. Is there any way to get the network link status?

Thank you,

---

Masami Hiramatsu (3):
efi_selftest: Use EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() for media check
efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT
efi_selftest: Recieve the packets until the receive buffer is empty

 lib/efi_selftest/efi_selftest_snp.c |   90 +++++++++++++++++++----------------
 1 file changed, 49 insertions(+), 41 deletions(-)

--
Masami Hiramatsu <[email protected]>

#5 lore raw

PATCH 3/3 efi_selftest: Recieve the packets until the receive buffer is empty

Repeatedly receive the packets until the receive buffer is empty. If the buffer is empty, EFI_SIMPLE_NETWORK_PROTOCOL::Receive() returns EFI_NOT_READY. We don't need to use the wait_for_event() every time.

---
 lib/efi_selftest/efi_selftest_snp.c |   67 +++++++++++++++++++----------------
 1 file changed, 37 insertions(+), 30 deletions(-)
lib/efi_selftest/efi_selftest_snp.c +37 -30
index c5366c872c..818cbfcacd 100644
@@ -362,39 +362,46 @@ static int execute(void)
 			continue;
 		}
 		/*
-		 * Receive packet
+		 * Receive packets until buffer is empty
 		 */
-		buffer_size = sizeof(buffer);
-		ret = net->receive(net, NULL, &buffer_size, &buffer,
-				   &srcaddr, &destaddr, NULL);
-		if (ret != EFI_SUCCESS) {
-			efi_st_error("Failed to receive packet");
-			return EFI_ST_FAILURE;
+		for (;;) {
+			buffer_size = sizeof(buffer);
+			ret = net->receive(net, NULL, &buffer_size, &buffer,
+					   &srcaddr, &destaddr, NULL);
+			if (ret == EFI_NOT_READY) {
+				/* The received buffer is empty. */
+				break;
+			}
+
+			if (ret != EFI_SUCCESS) {
+				efi_st_error("Failed to receive packet");
+				return EFI_ST_FAILURE;
+			}
+			/*
+			 * Check the packet is meant for this system.
+			 * Unfortunately QEMU ignores the broadcast flag.
+			 * So we have to check for broadcasts too.
+			 */
+			if (memcmp(&destaddr, &net->mode->current_address, ARP_HLEN) &&
+			    memcmp(&destaddr, BROADCAST_MAC, ARP_HLEN))
+				continue;
+			/*
+			 * Check this is a DHCP reply
+			 */
+			if (buffer.p.eth_hdr.et_protlen != ntohs(PROT_IP) ||
+			    buffer.p.ip_udp.ip_hl_v != 0x45 ||
+			    buffer.p.ip_udp.ip_p != IPPROTO_UDP ||
+			    buffer.p.ip_udp.udp_src != ntohs(67) ||
+			    buffer.p.ip_udp.udp_dst != ntohs(68) ||
+			    buffer.p.dhcp_hdr.op != BOOTREPLY)
+				continue;
+			/*
+			 * We successfully received a DHCP reply.
+			 */
+			goto received;
 		}
-		/*
-		 * Check the packet is meant for this system.
-		 * Unfortunately QEMU ignores the broadcast flag.
-		 * So we have to check for broadcasts too.
-		 */
-		if (memcmp(&destaddr, &net->mode->current_address, ARP_HLEN) &&
-		    memcmp(&destaddr, BROADCAST_MAC, ARP_HLEN))
-			continue;
-		/*
-		 * Check this is a DHCP reply
-		 */
-		if (buffer.p.eth_hdr.et_protlen != ntohs(PROT_IP) ||
-		    buffer.p.ip_udp.ip_hl_v != 0x45 ||
-		    buffer.p.ip_udp.ip_p != IPPROTO_UDP ||
-		    buffer.p.ip_udp.udp_src != ntohs(67) ||
-		    buffer.p.ip_udp.udp_dst != ntohs(68) ||
-		    buffer.p.dhcp_hdr.op != BOOTREPLY)
-			continue;
-		/*
-		 * We successfully received a DHCP reply.
-		 */
-		break;
 	}
-
+received:
 	/*
 	 * Write a log message.
 	 */
#2 lore raw

PATCH 2/3 efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT

In reply to Masami Hiramatsu

Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT in packet receiving loop. This depends on the implementation and not related to whether the packet can be received or not.

Whether the received packets are available or not is ensured by wait_for_packet, and that is already done in the loop.

---
 lib/efi_selftest/efi_selftest_snp.c |   11 -----------
 1 file changed, 11 deletions(-)
lib/efi_selftest/efi_selftest_snp.c +0 -11
index cb0db7eea2..c5366c872c 100644
@@ -340,8 +340,6 @@ static int execute(void)
 	events[0] = timer;
 	events[1] = net->wait_for_packet;
 	for (;;) {
-		u32 int_status;
-
 		/*
 		 * Wait for packet to be received or timer event.
 		 */
@@ -367,15 +365,6 @@ static int execute(void)
 		 * Receive packet
 		 */
 		buffer_size = sizeof(buffer);
-		ret = net->get_status(net, &int_status, NULL);
-		if (ret != EFI_SUCCESS) {
-			efi_st_error("Failed to get status");
-			return EFI_ST_FAILURE;
-		}
-		if (!(int_status & EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT)) {
-			efi_st_error("RX interrupt not set");
-			return EFI_ST_FAILURE;
-		}
 		ret = net->receive(net, NULL, &buffer_size, &buffer,
 				   &srcaddr, &destaddr, NULL);
 		if (ret != EFI_SUCCESS) {
#1 lore raw

PATCH 1/3 efi_selftest: Use EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() for media check

In reply to Masami Hiramatsu

According to the UEF specification v2.9, the main purpose of the EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() is for checking the link status via EFI_SIMPLE_NETWORK_MODE::MediaPresent.
So this uses net->get_status() for checking the link status before running network test.

---
 lib/efi_selftest/efi_selftest_snp.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
lib/efi_selftest/efi_selftest_snp.c +12 -0
index 79f0467803..cb0db7eea2 100644
@@ -309,6 +309,18 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 
+	/* Check media connected */
+	ret = net->get_status(net, NULL, NULL);
+	if (ret != EFI_SUCCESS) {
+		efi_st_error("Failed to get status");
+		return EFI_ST_FAILURE;
+	}
+	if (net->mode && net->mode->media_present_supported &&
+	    !net->mode->media_present) {
+		efi_st_error("Network media is not connected");
+		return EFI_ST_FAILURE;
+	}
+
 	/*
 	 * Send DHCP discover message
 	 */
#6 lore raw

Re: [PATCH 3/3] efi_selftest: Recieve the packets until the receive buffer is empty

In reply to Masami Hiramatsu
Quoted 4 lines · Masami Hiramatsu

Repeatedly receive the packets until the receive buffer is empty. If the buffer is empty, EFI_SIMPLE_NETWORK_PROTOCOL::Receive() returns EFI_NOT_READY. We don't need to use the wait_for_event() every time.

Why do you want to make the change?
Was anything not working with the prior version?

Best regards

Heinrich

Quoted 88 lines
---
  lib/efi_selftest/efi_selftest_snp.c |   67 +++++++++++++++++++----------------
  1 file changed, 37 insertions(+), 30 deletions(-)
lib/efi_selftest/efi_selftest_snp.c +37 -30
index c5366c872c..818cbfcacd 100644
@@ -362,39 +362,46 @@ static int execute(void)
  			continue;
  		}
  		/*
-		 * Receive packet
+		 * Receive packets until buffer is empty
  		 */
-		buffer_size = sizeof(buffer);
-		ret = net->receive(net, NULL, &buffer_size, &buffer,
-				   &srcaddr, &destaddr, NULL);
-		if (ret != EFI_SUCCESS) {
-			efi_st_error("Failed to receive packet");
-			return EFI_ST_FAILURE;
+		for (;;) {
+			buffer_size = sizeof(buffer);
+			ret = net->receive(net, NULL, &buffer_size, &buffer,
+					   &srcaddr, &destaddr, NULL);
+			if (ret == EFI_NOT_READY) {
+				/* The received buffer is empty. */
+				break;
+			}
+
+			if (ret != EFI_SUCCESS) {
+				efi_st_error("Failed to receive packet");
+				return EFI_ST_FAILURE;
+			}
+			/*
+			 * Check the packet is meant for this system.
+			 * Unfortunately QEMU ignores the broadcast flag.
+			 * So we have to check for broadcasts too.
+			 */
+			if (memcmp(&destaddr, &net->mode->current_address, ARP_HLEN) &&
+			    memcmp(&destaddr, BROADCAST_MAC, ARP_HLEN))
+				continue;
+			/*
+			 * Check this is a DHCP reply
+			 */
+			if (buffer.p.eth_hdr.et_protlen != ntohs(PROT_IP) ||
+			    buffer.p.ip_udp.ip_hl_v != 0x45 ||
+			    buffer.p.ip_udp.ip_p != IPPROTO_UDP ||
+			    buffer.p.ip_udp.udp_src != ntohs(67) ||
+			    buffer.p.ip_udp.udp_dst != ntohs(68) ||
+			    buffer.p.dhcp_hdr.op != BOOTREPLY)
+				continue;
+			/*
+			 * We successfully received a DHCP reply.
+			 */
+			goto received;
  		}
-		/*
-		 * Check the packet is meant for this system.
-		 * Unfortunately QEMU ignores the broadcast flag.
-		 * So we have to check for broadcasts too.
-		 */
-		if (memcmp(&destaddr, &net->mode->current_address, ARP_HLEN) &&
-		    memcmp(&destaddr, BROADCAST_MAC, ARP_HLEN))
-			continue;
-		/*
-		 * Check this is a DHCP reply
-		 */
-		if (buffer.p.eth_hdr.et_protlen != ntohs(PROT_IP) ||
-		    buffer.p.ip_udp.ip_hl_v != 0x45 ||
-		    buffer.p.ip_udp.ip_p != IPPROTO_UDP ||
-		    buffer.p.ip_udp.udp_src != ntohs(67) ||
-		    buffer.p.ip_udp.udp_dst != ntohs(68) ||
-		    buffer.p.dhcp_hdr.op != BOOTREPLY)
-			continue;
-		/*
-		 * We successfully received a DHCP reply.
-		 */
-		break;
  	}
-
+received:
  	/*
  	 * Write a log message.
  	 */
#3 lore raw

Re: [PATCH 2/3] efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT

In reply to Masami Hiramatsu
Quoted 3 lines · Masami Hiramatsu

Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT in packet receiving loop. This depends on the implementation and not related to whether the packet can be received or not.

Shouldn't EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT always be set if a package needs to be processed?

Best regards

Heinrich

Quoted 39 lines

Whether the received packets are available or not is ensured by wait_for_packet, and that is already done in the loop.

---
  lib/efi_selftest/efi_selftest_snp.c |   11 -----------
  1 file changed, 11 deletions(-)
lib/efi_selftest/efi_selftest_snp.c +0 -11
index cb0db7eea2..c5366c872c 100644
@@ -340,8 +340,6 @@ static int execute(void)
  	events[0] = timer;
  	events[1] = net->wait_for_packet;
  	for (;;) {
-		u32 int_status;
-
  		/*
  		 * Wait for packet to be received or timer event.
  		 */
@@ -367,15 +365,6 @@ static int execute(void)
  		 * Receive packet
  		 */
  		buffer_size = sizeof(buffer);
-		ret = net->get_status(net, &int_status, NULL);
-		if (ret != EFI_SUCCESS) {
-			efi_st_error("Failed to get status");
-			return EFI_ST_FAILURE;
-		}
-		if (!(int_status & EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT)) {
-			efi_st_error("RX interrupt not set");
-			return EFI_ST_FAILURE;
-		}
  		ret = net->receive(net, NULL, &buffer_size, &buffer,
  				   &srcaddr, &destaddr, NULL);
  		if (ret != EFI_SUCCESS) {
#4 lore raw

Re: [PATCH 2/3] efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT

Hi Heinrich,

2021年9月16日(木) 18:30 Heinrich Schuchardt <[email protected]>:

Quoted 10 lines · Masami Hiramatsu
Quoted 3 lines

Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT in packet receiving loop. This depends on the implementation and not related to whether the packet can be received or not.

Shouldn't EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT always be set if a package needs to be processed?

No, that is not promised as far as I can read the specification. It is just a bit flag of the device (Spec says "the interrupt status will be read from the device."). Not ensure the received packet buffer status.

However, the WaitForPacket ensures the packet is received. "Event used with EFI_BOOT_SERVICES.WaitForEvent() to wait for a packet to be received."

So I think it is enough to check the WaitForPacket.

Thank you,

Quoted 36 lines

Best regards

Heinrich

Quoted 31 lines

Whether the received packets are available or not is ensured by wait_for_packet, and that is already done in the loop.

---
  lib/efi_selftest/efi_selftest_snp.c |   11 -----------
  1 file changed, 11 deletions(-)
lib/efi_selftest/efi_selftest_snp.c +0 -7
index cb0db7eea2..c5366c872c 100644
@@ -340,8 +340,6 @@ static int execute(void)
      events[0] = timer;
      events[1] = net->wait_for_packet;
      for (;;) {
-             u32 int_status;
-
              /*
               * Wait for packet to be received or timer event.
               */
@@ -367,15 +365,6 @@ static int execute(void)
               * Receive packet
               */
              buffer_size = sizeof(buffer);
-             ret = net->get_status(net, &int_status, NULL);
-             if (ret != EFI_SUCCESS) {
-                     efi_st_error("Failed to get status");
-                     return EFI_ST_FAILURE;
-             }
Quoted 8 lines

lib/efi_selftest/efi_selftest_snp.c static int execute(void) · line 370

Quoted 8 lines
lib/efi_selftest/efi_selftest_snp.c +0 -4
-             if (!(int_status & EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT)) {
-                     efi_st_error("RX interrupt not set");
-                     return EFI_ST_FAILURE;
-             }
              ret = net->receive(net, NULL, &buffer_size, &buffer,
                                 &srcaddr, &destaddr, NULL);
              if (ret != EFI_SUCCESS) {

--
Masami Hiramatsu

#7 lore raw

Re: [PATCH 3/3] efi_selftest: Recieve the packets until the receive buffer is empty

In reply to Heinrich Schuchardt

Hi Heinrich,

2021年9月16日(木) 18:29 Heinrich Schuchardt <[email protected]>:

Quoted 11 lines · Masami Hiramatsu
Quoted 4 lines

Repeatedly receive the packets until the receive buffer is empty. If the buffer is empty, EFI_SIMPLE_NETWORK_PROTOCOL::Receive() returns EFI_NOT_READY. We don't need to use the wait_for_event() every time.

Why do you want to make the change?
Was anything not working with the prior version?

Actually, if [2/3] is merged, our problem will be solved. :-) So this is optional for me.

This is a kind of optimization. If we run this on the busy network, the interface can receive more than 2 packets until the wait_for_event() returns. This will avoid calling wait_for_event() in such case, and also it can test the net->receive() returns EFI_NOT_READY correctly.

Thank you,

Quoted 85 lines

Best regards

Heinrich

Quoted 80 lines
---
  lib/efi_selftest/efi_selftest_snp.c |   67 +++++++++++++++++++----------------
  1 file changed, 37 insertions(+), 30 deletions(-)
lib/efi_selftest/efi_selftest_snp.c +36 -28
index c5366c872c..818cbfcacd 100644
@@ -362,39 +362,46 @@ static int execute(void)
                      continue;
              }
              /*
-              * Receive packet
+              * Receive packets until buffer is empty
               */
-             buffer_size = sizeof(buffer);
-             ret = net->receive(net, NULL, &buffer_size, &buffer,
-                                &srcaddr, &destaddr, NULL);
-             if (ret != EFI_SUCCESS) {
-                     efi_st_error("Failed to receive packet");
-                     return EFI_ST_FAILURE;
+             for (;;) {
+                     buffer_size = sizeof(buffer);
+                     ret = net->receive(net, NULL, &buffer_size, &buffer,
+                                        &srcaddr, &destaddr, NULL);
+                     if (ret == EFI_NOT_READY) {
+                             /* The received buffer is empty. */
+                             break;
+                     }
+
+                     if (ret != EFI_SUCCESS) {
+                             efi_st_error("Failed to receive packet");
+                             return EFI_ST_FAILURE;
+                     }
+                     /*
+                      * Check the packet is meant for this system.
+                      * Unfortunately QEMU ignores the broadcast flag.
+                      * So we have to check for broadcasts too.
+                      */
+                     if (memcmp(&destaddr, &net->mode->current_address, ARP_HLEN) &&
+                         memcmp(&destaddr, BROADCAST_MAC, ARP_HLEN))
+                             continue;
+                     /*
+                      * Check this is a DHCP reply
+                      */
+                     if (buffer.p.eth_hdr.et_protlen != ntohs(PROT_IP) ||
+                         buffer.p.ip_udp.ip_hl_v != 0x45 ||
+                         buffer.p.ip_udp.ip_p != IPPROTO_UDP ||
+                         buffer.p.ip_udp.udp_src != ntohs(67) ||
+                         buffer.p.ip_udp.udp_dst != ntohs(68) ||
+                         buffer.p.dhcp_hdr.op != BOOTREPLY)
+                             continue;
+                     /*
+                      * We successfully received a DHCP reply.
+                      */
+                     goto received;
              }
-             /*
-              * Check the packet is meant for this system.
-              * Unfortunately QEMU ignores the broadcast flag.
-              * So we have to check for broadcasts too.
-              */
-             if (memcmp(&destaddr, &net->mode->current_address, ARP_HLEN) &&
-                 memcmp(&destaddr, BROADCAST_MAC, ARP_HLEN))
-                     continue;
-             /*
-              * Check this is a DHCP reply
-              */
-             if (buffer.p.eth_hdr.et_protlen != ntohs(PROT_IP) ||
-                 buffer.p.ip_udp.ip_hl_v != 0x45 ||
-                 buffer.p.ip_udp.ip_p != IPPROTO_UDP ||
-                 buffer.p.ip_udp.udp_src != ntohs(67) ||
-                 buffer.p.ip_udp.udp_dst != ntohs(68) ||
-                 buffer.p.dhcp_hdr.op != BOOTREPLY)
-                     continue;
-             /*
-              * We successfully received a DHCP reply.
-              */
Quoted 8 lines

lib/efi_selftest/efi_selftest_snp.c static int execute(void) · line 407

Quoted 8 lines
lib/efi_selftest/efi_selftest_snp.c +1 -2
-             break;
      }
-
+received:
      /*
       * Write a log message.
       */

--
Masami Hiramatsu

#8 lore raw
In reply to Masami Hiramatsu
Quoted 24 lines · Masami Hiramatsu

Hello Heinrich,

Here is a series of patches to update the SIMPLE_NETWORK_PROTOCOL according to the explanation in the previous thread [1].

[1] https://lists.denx.de/pipermail/u-boot/2021-September/460711.html

So basically this seires modifies the SNP testcase as I said in the previous mail [1].

----
net->get_status();
if (!net->mode.MediaPresent) {
error(no link up!)
return;
}

submit_dhcp_discover()

for (;;) {
    wait_for_event(net)
    while (net->receive() != EFI_NOT_READY) {
       // check dhcp reply
    }
}
Quoted 7 lines

----

I removed EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT check because that is just expectation what the received packet avaiability is meaning that the EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT flag bit is set. Of course U-Boot EFI SNP implementation does it, but that is not ensured in the UEFI spec. The spec said that

SN_GetStatus() in edk2-platforms Drivers/ASIX/Bus/Usb/UsbNetworking/Ax88179/SimpleNetwork.c always returns *InterruptStatus = 0.

Quoted 7 lines

the get_status() should update the MediaPresent flag (which means the network link up or down). So I added the get_status() test case before starting the network test so that it can test the link status.

BTW, actually the mode->media_present is not supported yet. Is there any way to get the network link status?

The driver interface struct eth_ops has no method for determining media presence. We have to assume that it is always present.

Best regards

Heinrich

Quoted 17 lines

Thank you,

---

Masami Hiramatsu (3):
efi_selftest: Use EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() for media check
efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT
efi_selftest: Recieve the packets until the receive buffer is empty

  lib/efi_selftest/efi_selftest_snp.c |   90 +++++++++++++++++++----------------
  1 file changed, 49 insertions(+), 41 deletions(-)

--
Masami Hiramatsu <[email protected]>

#9 lore raw

Hi Heinrich,

2021年9月17日(金) 12:54 Heinrich Schuchardt <[email protected]>:

Quoted 34 lines · Masami Hiramatsu
Quoted 24 lines

Hello Heinrich,

Here is a series of patches to update the SIMPLE_NETWORK_PROTOCOL according to the explanation in the previous thread [1].

[1] https://lists.denx.de/pipermail/u-boot/2021-September/460711.html

So basically this seires modifies the SNP testcase as I said in the previous mail [1].

----
net->get_status();
if (!net->mode.MediaPresent) {
error(no link up!)
return;
}

submit_dhcp_discover()

for (;;) {
    wait_for_event(net)
    while (net->receive() != EFI_NOT_READY) {
       // check dhcp reply
    }
}
Quoted 7 lines

----

I removed EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT check because that is just expectation what the received packet avaiability is meaning that the EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT flag bit is set. Of course U-Boot EFI SNP implementation does it, but that is not ensured in the UEFI spec. The spec said that

Quoted 3 lines

SN_GetStatus() in edk2-platforms Drivers/ASIX/Bus/Usb/UsbNetworking/Ax88179/SimpleNetwork.c always returns *InterruptStatus = 0.

Yes, it seems to depend on driver implementation.

Quoted 11 lines
Quoted 8 lines

the get_status() should update the MediaPresent flag (which means the network link up or down). So I added the get_status() test case before starting the network test so that it can test the link status.

BTW, actually the mode->media_present is not supported yet. Is there any way to get the network link status?

The driver interface struct eth_ops has no method for determining media presence. We have to assume that it is always present.

Hmm, OK. So we can not implement it...

Thank you,

Quoted 23 lines

Best regards

Heinrich

Quoted 17 lines

Thank you,

---

Masami Hiramatsu (3):
efi_selftest: Use EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() for media check
efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT
efi_selftest: Recieve the packets until the receive buffer is empty

  lib/efi_selftest/efi_selftest_snp.c |   90 +++++++++++++++++++----------------
  1 file changed, 49 insertions(+), 41 deletions(-)

--
Masami Hiramatsu <[email protected]>

Signature · 1 line
Masami Hiramatsu
#10 lore raw

Hi Heinrich,

What is the current status of this patch series?
Could you give me any comments?

Thank you,

2021年9月17日(金) 13:47 Masami Hiramatsu <[email protected]>:

Quoted 87 lines

Hi Heinrich,

2021年9月17日(金) 12:54 Heinrich Schuchardt <[email protected]>:

Quoted 34 lines · Masami Hiramatsu
Quoted 24 lines

Hello Heinrich,

Here is a series of patches to update the SIMPLE_NETWORK_PROTOCOL according to the explanation in the previous thread [1].

[1] https://lists.denx.de/pipermail/u-boot/2021-September/460711.html

So basically this seires modifies the SNP testcase as I said in the previous mail [1].

----
net->get_status();
if (!net->mode.MediaPresent) {
error(no link up!)
return;
}

submit_dhcp_discover()

for (;;) {
    wait_for_event(net)
    while (net->receive() != EFI_NOT_READY) {
       // check dhcp reply
    }
}
Quoted 7 lines

----

I removed EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT check because that is just expectation what the received packet avaiability is meaning that the EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT flag bit is set. Of course U-Boot EFI SNP implementation does it, but that is not ensured in the UEFI spec. The spec said that

Quoted 3 lines

SN_GetStatus() in edk2-platforms Drivers/ASIX/Bus/Usb/UsbNetworking/Ax88179/SimpleNetwork.c always returns *InterruptStatus = 0.

Yes, it seems to depend on driver implementation.

Quoted 11 lines
Quoted 8 lines

the get_status() should update the MediaPresent flag (which means the network link up or down). So I added the get_status() test case before starting the network test so that it can test the link status.

BTW, actually the mode->media_present is not supported yet. Is there any way to get the network link status?

The driver interface struct eth_ops has no method for determining media presence. We have to assume that it is always present.

Hmm, OK. So we can not implement it...

Thank you,

Quoted 23 lines

Best regards

Heinrich

Quoted 17 lines

Thank you,

---

Masami Hiramatsu (3):
efi_selftest: Use EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() for media check
efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT
efi_selftest: Recieve the packets until the receive buffer is empty

  lib/efi_selftest/efi_selftest_snp.c |   90 +++++++++++++++++++----------------
  1 file changed, 49 insertions(+), 41 deletions(-)

--
Masami Hiramatsu <[email protected]>

--
Masami Hiramatsu

Signature · 1 line
Masami Hiramatsu