]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Update link state in SNP device mode data
authorMichael Brown <mcb30@ipxe.org>
Thu, 19 Apr 2012 21:52:09 +0000 (22:52 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 19 Apr 2012 21:54:24 +0000 (22:54 +0100)
There is no explicit SNP API call to determine link state; the SNP
interface user may check the MediaPresent field within the mode data
at any time.

Update the MediaPresent field whenever the link state changes.

Reported-by: Michael R Turner <mikeyt@us.ibm.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_snp.c

index 4c49982672266a29dc0e1eba2cbbd7b5e9d4b17a..4df221c53b71835fb767cdb276ee38e4a64fc5f6 100644 (file)
@@ -1282,8 +1282,21 @@ static int efi_snp_probe ( struct net_device *netdev ) {
  *
  * @v netdev           Network device
  */
-static void efi_snp_notify ( struct net_device *netdev __unused ) {
-       /* Nothing to do */
+static void efi_snp_notify ( struct net_device *netdev ) {
+       struct efi_snp_device *snpdev;
+
+       /* Locate SNP device */
+       snpdev = efi_snp_demux ( netdev );
+       if ( ! snpdev ) {
+               DBG ( "SNP skipping non-SNP device %s\n", netdev->name );
+               return;
+       }
+
+       /* Update link state */
+       snpdev->mode.MediaPresent =
+               ( netdev_link_ok ( netdev ) ? TRUE : FALSE );
+       DBGC ( snpdev, "SNPDEV %p link is %s\n", snpdev,
+              ( snpdev->mode.MediaPresent ? "up" : "down" ) );
 }
 
 /**