瀏覽代碼

[efi] Update link state in SNP device mode data

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>
tags/v1.20.1
Michael Brown 12 年之前
父節點
當前提交
d3d87a2d92
共有 1 個文件被更改,包括 15 次插入2 次删除
  1. 15
    2
      src/interface/efi/efi_snp.c

+ 15
- 2
src/interface/efi/efi_snp.c 查看文件

@@ -1282,8 +1282,21 @@ static int efi_snp_probe ( struct net_device *netdev ) {
1282 1282
  *
1283 1283
  * @v netdev		Network device
1284 1284
  */
1285
-static void efi_snp_notify ( struct net_device *netdev __unused ) {
1286
-	/* Nothing to do */
1285
+static void efi_snp_notify ( struct net_device *netdev ) {
1286
+	struct efi_snp_device *snpdev;
1287
+
1288
+	/* Locate SNP device */
1289
+	snpdev = efi_snp_demux ( netdev );
1290
+	if ( ! snpdev ) {
1291
+		DBG ( "SNP skipping non-SNP device %s\n", netdev->name );
1292
+		return;
1293
+	}
1294
+
1295
+	/* Update link state */
1296
+	snpdev->mode.MediaPresent =
1297
+		( netdev_link_ok ( netdev ) ? TRUE : FALSE );
1298
+	DBGC ( snpdev, "SNPDEV %p link is %s\n", snpdev,
1299
+	       ( snpdev->mode.MediaPresent ? "up" : "down" ) );
1287 1300
 }
1288 1301
 
1289 1302
 /**

Loading…
取消
儲存