arch/netdev: try tcp timer in every txavail call
In the current implementation, the first transmission of the new connection handshake is depends entirely by tcp_timer(), which will caused 0.5s - 1s delay each time in connect(). This patch is mainly to improve the performance of TCP handshake. Original: nsh> tcp_client [ 1.536100] TCP connect start. [ 2.000200] TCP connect end. DIFF: tick: 4641, 464ms. [ 3.000300] TCP connect start. [ 4.000400] TCP connect end. DIFF: tick: 10001, 1000ms. [ 5.000500] TCP connect start. [ 6.000600] TCP connect end. DIFF: tick: 10001, 1000ms. [ 7.000700] TCP connect start. [ 8.000800] TCP connect end. DIFF: tick: 10001, 1000ms. Optimized: nsh> tcp_client [ 3.263600] TCP connect start. [ 3.263700] TCP connect end. DIFF: tick: 1, 0ms. [ 4.263800] TCP connect start. [ 4.263800] TCP connect end. DIFF: tick: 0, 0ms. [ 5.263900] TCP connect start. [ 5.263900] TCP connect end. DIFF: tick: 0, 0ms. [ 6.264000] TCP connect start. [ 6.264000] TCP connect end. DIFF: tick: 0, 0ms. [ 7.264100] TCP connect start. [ 7.264100] TCP connect end. DIFF: tick: 0, 0ms. Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
ae5b727580
commit
4a559807a5
@ -2017,7 +2017,7 @@ static void c5471_txavail_work(FAR void *arg)
|
||||
{
|
||||
/* If so, then poll the network for new XMIT data */
|
||||
|
||||
devif_poll(&priv->c_dev, c5471_txpoll);
|
||||
devif_timer(&priv->c_dev, 0, c5471_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1522,7 +1522,7 @@ static void imxrt_txavail_work(FAR void *arg)
|
||||
* new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(&priv->dev, imxrt_txpoll);
|
||||
devif_timer(&priv->dev, 0, imxrt_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1299,7 +1299,7 @@ static void imxrt_txavail_work(FAR void *arg)
|
||||
* new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(&priv->dev, imxrt_txpoll);
|
||||
devif_timer(&priv->dev, 0, imxrt_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1367,7 +1367,7 @@ static void kinetis_txavail_work(FAR void *arg)
|
||||
* new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(&priv->dev, kinetis_txpoll);
|
||||
devif_timer(&priv->dev, 0, kinetis_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1337,7 +1337,7 @@ static void kinetis_txavail_work(FAR void *arg)
|
||||
* new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(&priv->dev, kinetis_txpoll);
|
||||
devif_timer(&priv->dev, 0, kinetis_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1853,7 +1853,7 @@ static void lpc17_40_txavail_work(FAR void *arg)
|
||||
{
|
||||
/* If so, then poll the network layer for new XMIT data */
|
||||
|
||||
devif_poll(&priv->lp_dev, lpc17_40_txpoll);
|
||||
devif_timer(&priv->lp_dev, 0, lpc17_40_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ static void lpc43_dopoll(FAR struct lpc43_ethmac_s *priv)
|
||||
|
||||
if (dev->d_buf)
|
||||
{
|
||||
devif_poll(dev, lpc43_txpoll);
|
||||
devif_timer(dev, 0, lpc43_txpoll);
|
||||
|
||||
/* We will, most likely end up with a buffer to be freed. But it
|
||||
* might not be the same one that we allocated above.
|
||||
|
@ -1807,7 +1807,7 @@ static void lpc54_eth_dopoll(struct lpc54_ethdriver_s *priv)
|
||||
priv->eth_dev.d_buf = (uint8_t *)lpc54_pktbuf_alloc(priv);
|
||||
if (priv->eth_dev.d_buf != NULL)
|
||||
{
|
||||
devif_poll(&priv->eth_dev, lpc54_eth_txpoll);
|
||||
devif_timer(&priv->eth_dev, 0, lpc54_eth_txpoll);
|
||||
|
||||
/* Make sure that the Tx buffer remaining after the poll is
|
||||
* freed.
|
||||
|
@ -1521,7 +1521,7 @@ static void s32k1xx_txavail_work(FAR void *arg)
|
||||
* new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(&priv->dev, s32k1xx_txpoll);
|
||||
devif_timer(&priv->dev, 0, s32k1xx_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1340,7 +1340,7 @@ static void s32k1xx_txavail_work(FAR void *arg)
|
||||
* new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(&priv->dev, s32k1xx_txpoll);
|
||||
devif_timer(&priv->dev, 0, s32k1xx_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -962,7 +962,7 @@ static void sam_dopoll(struct sam_emac_s *priv)
|
||||
* then poll the network for new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(dev, sam_txpoll);
|
||||
devif_timer(dev, 0, sam_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -970,7 +970,7 @@ static void sam_dopoll(struct sam_emac_s *priv)
|
||||
* then poll the network for new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(dev, sam_txpoll);
|
||||
devif_timer(dev, 0, sam_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1311,7 +1311,7 @@ static void sam_dopoll(struct sam_emac_s *priv)
|
||||
* then poll the network for new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(dev, sam_txpoll);
|
||||
devif_timer(dev, 0, sam_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -912,7 +912,7 @@ static void sam_dopoll(struct sam_gmac_s *priv)
|
||||
* then poll the network for new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(dev, sam_txpoll);
|
||||
devif_timer(dev, 0, sam_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -900,7 +900,7 @@ static void sam_dopoll(struct sam_gmac_s *priv)
|
||||
* then poll the network for new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(dev, sam_txpoll);
|
||||
devif_timer(dev, 0, sam_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1618,7 +1618,7 @@ static void sam_dopoll(struct sam_emac_s *priv, int qid)
|
||||
* then poll the network for new XMIT data.
|
||||
*/
|
||||
|
||||
devif_poll(dev, sam_txpoll);
|
||||
devif_timer(dev, 0, sam_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1396,7 +1396,7 @@ static void stm32_dopoll(FAR struct stm32_ethmac_s *priv)
|
||||
|
||||
if (dev->d_buf)
|
||||
{
|
||||
devif_poll(dev, stm32_txpoll);
|
||||
devif_timer(dev, 0, stm32_txpoll);
|
||||
|
||||
/* We will, most likely end up with a buffer to be freed. But it
|
||||
* might not be the same one that we allocated above.
|
||||
|
@ -1435,7 +1435,7 @@ static void stm32_dopoll(struct stm32_ethmac_s *priv)
|
||||
|
||||
if (dev->d_buf)
|
||||
{
|
||||
devif_poll(dev, stm32_txpoll);
|
||||
devif_timer(dev, 0, stm32_txpoll);
|
||||
|
||||
/* We will, most likely end up with a buffer to be freed. But it
|
||||
* might not be the same one that we allocated above.
|
||||
|
@ -1451,7 +1451,7 @@ static void stm32_dopoll(struct stm32_ethmac_s *priv)
|
||||
|
||||
if (dev->d_buf)
|
||||
{
|
||||
devif_poll(dev, stm32_txpoll);
|
||||
devif_timer(dev, 0, stm32_txpoll);
|
||||
|
||||
/* We will, most likely end up with a buffer to be freed. But it
|
||||
* might not be the same one that we allocated above.
|
||||
|
@ -1561,7 +1561,7 @@ static void tiva_txavail_work(void *arg)
|
||||
* network for new Tx data
|
||||
*/
|
||||
|
||||
devif_poll(&priv->ld_dev, tiva_txpoll);
|
||||
devif_timer(&priv->ld_dev, 0, tiva_txpoll);
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
|
@ -1386,7 +1386,7 @@ static void tiva_dopoll(FAR struct tiva_ethmac_s *priv)
|
||||
|
||||
if (dev->d_buf)
|
||||
{
|
||||
devif_poll(dev, tiva_txpoll);
|
||||
devif_timer(dev, 0, tiva_txpoll);
|
||||
|
||||
/* We will, most likely end up with a buffer to be freed. But it
|
||||
* might not be the same one that we allocated above.
|
||||
|
@ -664,7 +664,7 @@ static int emac_txavail(struct net_driver_s *dev)
|
||||
|
||||
/* If so, then poll the network for new XMIT data */
|
||||
|
||||
devif_poll(&priv->d_dev, emac_txpoll);
|
||||
devif_timer(&priv->d_dev, 0, emac_txpoll);
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
@ -1252,7 +1252,7 @@ static void pic32mx_poll(struct pic32mx_driver_s *priv)
|
||||
/* And perform the poll */
|
||||
|
||||
priv->pd_polling = true;
|
||||
devif_poll(&priv->pd_dev, pic32mx_txpoll);
|
||||
devif_timer(&priv->pd_dev, 0, pic32mx_txpoll);
|
||||
|
||||
/* Free any buffer left attached after the poll */
|
||||
|
||||
|
@ -1356,7 +1356,7 @@ static void pic32mz_poll(struct pic32mz_driver_s *priv)
|
||||
/* And perform the poll */
|
||||
|
||||
priv->pd_polling = true;
|
||||
devif_poll(&priv->pd_dev, pic32mz_txpoll);
|
||||
devif_timer(&priv->pd_dev, 0, pic32mz_txpoll);
|
||||
|
||||
/* Free any buffer left attached after the poll */
|
||||
|
||||
|
@ -957,7 +957,7 @@ static void misoc_net_txavail_work(FAR void *arg)
|
||||
{
|
||||
/* If so, then poll the network for new XMIT data */
|
||||
|
||||
devif_poll(&priv->misoc_net_dev, misoc_net_txpoll);
|
||||
devif_timer(&priv->misoc_net_dev, 0, misoc_net_txpoll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1181,7 +1181,7 @@ static void rx65n_dopoll(FAR struct rx65n_ethmac_s *priv)
|
||||
|
||||
if (dev->d_buf)
|
||||
{
|
||||
devif_poll(dev, rx65n_txpoll);
|
||||
devif_timer(dev, 0, rx65n_txpoll);
|
||||
|
||||
/* We will, most likely end up with a buffer to be freed. But it
|
||||
* might not be the same one that we allocated above.
|
||||
|
@ -303,7 +303,7 @@ static void netdriver_txavail_work(FAR void *arg)
|
||||
net_lock();
|
||||
if (IFF_IS_UP(dev->d_flags))
|
||||
{
|
||||
devif_poll(dev, netdriver_txpoll);
|
||||
devif_timer(dev, 0, netdriver_txpoll);
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
|
@ -1693,7 +1693,7 @@ static void emac_dopoll(struct esp32_emac_s *priv)
|
||||
|
||||
dev->d_len = EMAC_BUF_LEN;
|
||||
|
||||
devif_poll(dev, emac_txpoll);
|
||||
devif_timer(dev, 0, emac_txpoll);
|
||||
|
||||
if (dev->d_buf)
|
||||
{
|
||||
|
@ -841,7 +841,7 @@ static void wlan_dopoll(FAR struct wlan_priv_s *priv)
|
||||
|
||||
/* If so, then poll the network for new XMIT data */
|
||||
|
||||
devif_poll(dev, wlan_txpoll);
|
||||
devif_timer(dev, 0, wlan_txpoll);
|
||||
|
||||
dev->d_buf = NULL;
|
||||
}
|
||||
|
@ -2223,7 +2223,7 @@ static void ez80emac_txavail_work(FAR void *arg)
|
||||
|
||||
/* If so, then poll the network for new XMIT data */
|
||||
|
||||
devif_poll(&priv->dev, ez80emac_txpoll);
|
||||
devif_timer(&priv->dev, 0, ez80emac_txpoll);
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
|
Loading…
Reference in New Issue
Block a user