浏览代码

[iscsi] Eliminate polling while waiting for window to open

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 年前
父节点
当前提交
bce34e87df
共有 1 个文件被更改,包括 26 次插入3 次删除
  1. 26
    3
      src/net/tcp/iscsi.c

+ 26
- 3
src/net/tcp/iscsi.c 查看文件

@@ -1304,6 +1304,24 @@ static int iscsi_rx_login_response ( struct iscsi_session *iscsi,
1304 1304
  *
1305 1305
  */
1306 1306
 
1307
+/**
1308
+ * Pause TX engine
1309
+ *
1310
+ * @v iscsi		iSCSI session
1311
+ */
1312
+static void iscsi_tx_pause ( struct iscsi_session *iscsi ) {
1313
+	process_del ( &iscsi->process );
1314
+}
1315
+
1316
+/**
1317
+ * Resume TX engine
1318
+ *
1319
+ * @v iscsi		iSCSI session
1320
+ */
1321
+static void iscsi_tx_resume ( struct iscsi_session *iscsi ) {
1322
+	process_add ( &iscsi->process );
1323
+}
1324
+
1307 1325
 /**
1308 1326
  * Start up a new TX PDU
1309 1327
  *
@@ -1324,7 +1342,7 @@ static void iscsi_start_tx ( struct iscsi_session *iscsi ) {
1324 1342
 	iscsi->tx_state = ISCSI_TX_BHS;
1325 1343
 
1326 1344
 	/* Start transmission process */
1327
-	process_add ( &iscsi->process );
1345
+	iscsi_tx_resume ( iscsi );
1328 1346
 }
1329 1347
 
1330 1348
 /**
@@ -1405,7 +1423,7 @@ static void iscsi_tx_done ( struct iscsi_session *iscsi ) {
1405 1423
 	struct iscsi_bhs_common *common = &iscsi->tx_bhs.common;
1406 1424
 
1407 1425
 	/* Stop transmission process */
1408
-	process_del ( &iscsi->process );
1426
+	iscsi_tx_pause ( iscsi );
1409 1427
 
1410 1428
 	switch ( common->opcode & ISCSI_OPCODE_MASK ) {
1411 1429
 	case ISCSI_OPCODE_DATA_OUT:
@@ -1468,7 +1486,10 @@ static void iscsi_tx_step ( struct iscsi_session *iscsi ) {
1468 1486
 
1469 1487
 		/* Check for window availability, if needed */
1470 1488
 		if ( tx_len && ( xfer_window ( &iscsi->socket ) == 0 ) ) {
1471
-			/* Cannot transmit at this point; stop processing */
1489
+			/* Cannot transmit at this point; pause
1490
+			 * processing and wait for window to reopen
1491
+			 */
1492
+			iscsi_tx_pause ( iscsi );
1472 1493
 			return;
1473 1494
 		}
1474 1495
 
@@ -1696,6 +1717,8 @@ static int iscsi_vredirect ( struct iscsi_session *iscsi, int type,
1696 1717
 /** iSCSI socket interface operations */
1697 1718
 static struct interface_operation iscsi_socket_operations[] = {
1698 1719
 	INTF_OP ( xfer_deliver, struct iscsi_session *, iscsi_socket_deliver ),
1720
+	INTF_OP ( xfer_window_changed, struct iscsi_session *,
1721
+		  iscsi_tx_resume ),
1699 1722
 	INTF_OP ( xfer_vredirect, struct iscsi_session *, iscsi_vredirect ),
1700 1723
 	INTF_OP ( intf_close, struct iscsi_session *, iscsi_close ),
1701 1724
 };

正在加载...
取消
保存