소스 검색

[pxe] Update UNDI transmit count before transmitting packet

It is possible that the UNDI ISR may be triggered before netdev_tx()
returns control to pxenv_undi_transmit().  This means that
pxenv_undi_isr() may see a zero undi_tx_count, and so not check for TX
completions.  This is not a significant problem, since it will check
for TX completions on the next call to pxenv_undi_isr() anyway; it
just means that the NBP will see a spurious IRQ that was apparently
caused by nothing.

Fix by updating the undi_tx_count before calling netdev_tx(), so that
pxenv_undi_isr() can decrement it and report the TX completion.
tags/v0.9.8
Michael Brown 15 년 전
부모
커밋
c26a38b313
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8
    4
      src/arch/i386/interface/pxe/pxe_undi.c

+ 8
- 4
src/arch/i386/interface/pxe/pxe_undi.c 파일 보기

@@ -316,18 +316,22 @@ PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
316 316
 		}
317 317
 	}
318 318
 
319
+	/* Flag transmission as in-progress.  Do this before starting
320
+	 * to transmit the packet, because the ISR may trigger before
321
+	 * we return from netdev_tx().
322
+	 */
323
+	undi_tx_count++;
324
+
319 325
 	/* Transmit packet */
320
-	DBG2 ( "\n" ); /* ISR may trigger before we return from netdev_tx() */
326
+	DBG2 ( "\n" );
321 327
 	if ( ( rc = netdev_tx ( pxe_netdev, iobuf ) ) != 0 ) {
322 328
 		DBG2 ( "PXENV_UNDI_TRANSMIT could not transmit: %s\n",
323 329
 		       strerror ( rc ) );
330
+		undi_tx_count--;
324 331
 		undi_transmit->Status = PXENV_STATUS ( rc );
325 332
 		return PXENV_EXIT_FAILURE;
326 333
 	}
327 334
 
328
-	/* Flag transmission as in-progress */
329
-	undi_tx_count++;
330
-
331 335
 	undi_transmit->Status = PXENV_STATUS_SUCCESS;
332 336
 	return PXENV_EXIT_SUCCESS;
333 337
 }

Loading…
취소
저장