[syslinux] [PATCH 4/4] Convert time measurement from jiffies to ms_timer
Julien Viard de Galbert
jviarddegalbert at online.net
Wed May 31 00:56:38 PDT 2017
So now the total timeout for 'stalling on configure with no mapping' is 1 sec
Signed-off-by: Julien Viard de Galbert <jviarddegalbert at online.net>
---
core/fs/pxe/tftp.c | 22 +++++++++++-----------
efi/tcp.c | 6 +++---
efi/udp.c | 14 +++++++-------
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/core/fs/pxe/tftp.c b/core/fs/pxe/tftp.c
index 594152b..b507761 100644
--- a/core/fs/pxe/tftp.c
+++ b/core/fs/pxe/tftp.c
@@ -82,7 +82,7 @@ static void tftp_get_packet(struct inode *inode)
uint8_t timeout;
uint16_t buffersize;
uint16_t serial;
- jiffies_t oldtime;
+ mstime_t oldtime;
struct tftp_packet *pkt = NULL;
uint16_t buf_len;
struct pxe_pvt_inode *socket = PVT(inode);
@@ -96,7 +96,7 @@ static void tftp_get_packet(struct inode *inode)
*/
timeout_ptr = TimeoutTable;
timeout = *timeout_ptr++;
- oldtime = jiffies();
+ oldtime = ms_timer();
ack_again:
ack_packet(inode, socket->tftp_lastpkt);
@@ -106,7 +106,7 @@ static void tftp_get_packet(struct inode *inode)
err = core_udp_recv(socket, socket->tftp_pktbuf, &buf_len,
&src_ip, &src_port);
if (err) {
- jiffies_t now = jiffies();
+ mstime_t now = ms_timer();
if (now-oldtime >= timeout) {
oldtime = now;
@@ -198,8 +198,8 @@ void tftp_open(struct url_info *url, int flags, struct inode *inode,
int buffersize;
int rrq_len;
const uint8_t *timeout_ptr;
- jiffies_t timeout;
- jiffies_t oldtime;
+ mstime_t timeout;
+ mstime_t oldtime;
uint16_t opcode;
uint16_t blk_num;
uint64_t opdata;
@@ -241,7 +241,7 @@ sendreq:
timeout = *timeout_ptr++;
if (!timeout)
return; /* No file available... */
- oldtime = jiffies();
+ oldtime = ms_timer();
core_udp_sendto(socket, rrq_packet_buf, rrq_len, url->ip, url->port);
@@ -253,7 +253,7 @@ wait_pkt:
err = core_udp_recv(socket, reply_packet_buf, &buf_len,
&src_ip, &src_port);
if (err) {
- jiffies_t now = jiffies();
+ mstime_t now = ms_timer();
if (now - oldtime >= timeout)
goto sendreq;
} else {
@@ -448,8 +448,8 @@ __export int tftp_put(struct url_info *url, int flags, struct inode *inode,
int err;
int wrq_len;
const uint8_t *timeout_ptr;
- jiffies_t timeout;
- jiffies_t oldtime;
+ mstime_t timeout;
+ mstime_t oldtime;
uint16_t opcode;
uint16_t src_port = url->port;
uint32_t src_ip;
@@ -493,7 +493,7 @@ sendreq:
timeout = *timeout_ptr++;
if (!timeout)
return return_code; /* No file available... */
- oldtime = jiffies();
+ oldtime = ms_timer();
core_udp_sendto(socket, wrq_packet_buf, wrq_len, url->ip, src_port);
@@ -504,7 +504,7 @@ sendreq:
err = core_udp_recv(socket, reply_packet_buf, &buf_len,
&src_ip, &src_port);
if (err) {
- jiffies_t now = jiffies();
+ mstime_t now = ms_timer();
if (now - oldtime >= timeout)
goto sendreq;
} else {
diff --git a/efi/tcp.c b/efi/tcp.c
index 0e9140e..b252ad0 100644
--- a/efi/tcp.c
+++ b/efi/tcp.c
@@ -57,7 +57,7 @@ int core_tcp_connect(struct pxe_pvt_inode *socket, uint32_t ip, uint16_t port)
EFI_TCP4 *tcp = (EFI_TCP4 *)b->this;
int rv = -1;
int unmapped = 1;
- jiffies_t start, last, cur;
+ mstime_t start, last, cur;
memset(&tdata, 0, sizeof(tdata));
@@ -69,11 +69,11 @@ int core_tcp_connect(struct pxe_pvt_inode *socket, uint32_t ip, uint16_t port)
tdata.TimeToLive = 64;
- last = start = jiffies();
+ last = start = ms_timer();
while (unmapped){
status = uefi_call_wrapper(tcp->Configure, 2, tcp, &tdata);
if (status == EFI_NO_MAPPING) {
- cur = jiffies();
+ cur = ms_timer();
if ( (cur - last) >= EFI_NOMAP_PRINT_DELAY ) {
last = cur;
Print(L"core_tcp_connect: stalling on configure with no mapping\n");
diff --git a/efi/udp.c b/efi/udp.c
index 4032d0b..d23c884 100644
--- a/efi/udp.c
+++ b/efi/udp.c
@@ -28,13 +28,13 @@ EFI_STATUS core_udp_configure(EFI_UDP4 *udp, EFI_UDP4_CONFIG_DATA *udata,
{
EFI_STATUS status;
int unmapped = 1;
- jiffies_t start, last, cur;
+ mstime_t start, last, cur;
- last = start = jiffies();
+ last = start = ms_timer();
while (unmapped){
status = uefi_call_wrapper(udp->Configure, 2, udp, udata);
if (status == EFI_NO_MAPPING) {
- cur = jiffies();
+ cur = ms_timer();
if ( (cur - last) >= EFI_NOMAP_PRINT_DELAY ) {
last = cur;
Print(L"%s: stalling on configure with no mapping\n", f);
@@ -215,7 +215,7 @@ int core_udp_recv(struct pxe_pvt_inode *socket, void *buf, uint16_t *buf_len,
EFI_UDP4 *udp;
size_t size;
int rv = -1;
- jiffies_t start;
+ mstime_t start;
(void)socket;
@@ -232,11 +232,11 @@ int core_udp_recv(struct pxe_pvt_inode *socket, void *buf, uint16_t *buf_len,
if (status != EFI_SUCCESS)
goto bail;
- start = jiffies();
+ start = ms_timer();
while (cb_status == -1) {
/* 15ms receive timeout... */
- if (jiffies() - start >= 15) {
- if (jiffies() - start >= 30)
+ if (ms_timer() - start >= 15) {
+ if (ms_timer() - start >= 30)
dprintf("Failed to cancel UDP\n");
uefi_call_wrapper(udp->Cancel, 2, udp, &token);
--
2.9.3
More information about the Syslinux
mailing list