Skip to content

Commit

Permalink
SMSTCPIP: do not use op-completion signalling if TCPIP core locking i…
Browse files Browse the repository at this point in the history
…s used, as it is redundant.
  • Loading branch information
sp193 committed Feb 12, 2019
1 parent 7df4cdd commit a8630bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 15 additions & 15 deletions modules/network/SMSTCPIP/api_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ do_newconn(struct api_msg_msg *msg)
/* This "new" connection already has a PCB allocated. */
/* Is this an error condition? Should it be deleted?
We currently just are happy and return. */
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
return;
}

Expand Down Expand Up @@ -340,7 +340,7 @@ do_newconn(struct api_msg_msg *msg)
}


sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
}


Expand Down Expand Up @@ -392,7 +392,7 @@ do_delconn(struct api_msg_msg *msg)
}

if (msg->conn->mbox != SYS_MBOX_NULL) {
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
}
}

Expand Down Expand Up @@ -455,7 +455,7 @@ do_bind(struct api_msg_msg *msg)
default:
break;
}
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
}
#if LWIP_TCP

Expand Down Expand Up @@ -495,7 +495,7 @@ do_connect(struct api_msg_msg *msg)
msg->conn->pcb.udp = udp_new();
if (msg->conn->pcb.udp == NULL) {
msg->conn->err = ERR_MEM;
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
return;
}
udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_UDPLITE);
Expand All @@ -505,7 +505,7 @@ do_connect(struct api_msg_msg *msg)
msg->conn->pcb.udp = udp_new();
if (msg->conn->pcb.udp == NULL) {
msg->conn->err = ERR_MEM;
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
return;
}
udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_NOCHKSUM);
Expand All @@ -515,7 +515,7 @@ do_connect(struct api_msg_msg *msg)
msg->conn->pcb.udp = udp_new();
if (msg->conn->pcb.udp == NULL) {
msg->conn->err = ERR_MEM;
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
return;
}
udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
Expand All @@ -526,7 +526,7 @@ do_connect(struct api_msg_msg *msg)
msg->conn->pcb.tcp = tcp_new();
if (msg->conn->pcb.tcp == NULL) {
msg->conn->err = ERR_MEM;
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
return;
}
#endif
Expand All @@ -538,7 +538,7 @@ do_connect(struct api_msg_msg *msg)
#if LWIP_RAW
case NETCONN_RAW:
raw_connect(msg->conn->pcb.raw, msg->msg.bc.ipaddr);
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
break;
#endif
#if LWIP_UDP
Expand All @@ -548,7 +548,7 @@ do_connect(struct api_msg_msg *msg)
/* FALLTHROUGH */
case NETCONN_UDP:
udp_connect(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
break;
#endif
#if LWIP_TCP
Expand Down Expand Up @@ -589,7 +589,7 @@ do_disconnect(struct api_msg_msg *msg)
default:
break;
}
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
}


Expand Down Expand Up @@ -633,7 +633,7 @@ do_listen(struct api_msg_msg *msg)
break;
}
}
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
}

static void
Expand Down Expand Up @@ -688,7 +688,7 @@ do_send(struct api_msg_msg *msg)
break;
}
}
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
}

static void do_recv(struct api_msg_msg *msg)
Expand Down Expand Up @@ -747,7 +747,7 @@ do_write(struct api_msg_msg *msg)
break;
}
}
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
}

static void
Expand Down Expand Up @@ -782,7 +782,7 @@ do_close(struct api_msg_msg *msg)
break;
}
}
sys_mbox_post(msg->conn->mbox, NULL);
TCPIP_APIMSG_ACK(msg->conn->mbox);
}

api_msg_decode __decode__[API_MSG_MAX] = {
Expand Down
2 changes: 2 additions & 0 deletions modules/network/SMSTCPIP/include/lwip/tcpip.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ extern sys_sem_t lock_tcpip_core;
#define LOCK_TCPIP_CORE() sys_sem_wait(lock_tcpip_core)
/** Unlock lwIP core mutex (needs @ref LWIP_TCPIP_CORE_LOCKING 1) */
#define UNLOCK_TCPIP_CORE() sys_sem_signal(lock_tcpip_core)
#define TCPIP_APIMSG_ACK(m)
#else /* LWIP_TCPIP_CORE_LOCKING */
#define LOCK_TCPIP_CORE()
#define UNLOCK_TCPIP_CORE()
#define TCPIP_APIMSG_ACK(m) sys_mbox_post(m, NULL)
#endif /* LWIP_TCPIP_CORE_LOCKING */

void tcpip_init(void (*tcpip_init_done)(void *), void *arg);
Expand Down

0 comments on commit a8630bb

Please sign in to comment.