From 6eee6b8bd1ce6cd43b19a0748e249ce2eac6ca15 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Mon, 6 Aug 2018 07:54:34 +0200 Subject: [PATCH] remove obsolete buffering of TX packets --- caves | 2 +- drivers/net/uhyve-net.c | 38 +++----------------------------------- drivers/net/uhyve-net.h | 8 +------- 3 files changed, 5 insertions(+), 43 deletions(-) diff --git a/caves b/caves index 2a7238cc6..7c7b47f8e 160000 --- a/caves +++ b/caves @@ -1 +1 @@ -Subproject commit 2a7238cc66cf35ac4d67ea7b66d0d24ba94e01c2 +Subproject commit 7c7b47f8e251b09302ed43c18ffcf639d4c0a118 diff --git a/drivers/net/uhyve-net.c b/drivers/net/uhyve-net.c index f82e46c0e..d77760eed 100755 --- a/drivers/net/uhyve-net.c +++ b/drivers/net/uhyve-net.c @@ -125,29 +125,14 @@ static inline uint8_t dehex(char c) static err_t uhyve_netif_output(struct netif* netif, struct pbuf* p) { - uhyve_netif_t* uhyve_netif = netif->state; - uint8_t transmitid = uhyve_netif->tx_queue % TX_BUF_NUM; uint32_t i; struct pbuf *q; - if(BUILTIN_EXPECT((uhyve_netif->tx_queue - uhyve_netif->tx_complete) > (TX_BUF_NUM - 1), 0)) { - LOG_ERROR("uhyve_netif_output: too many packets at once\n"); - return ERR_IF; - } - if(BUILTIN_EXPECT(p->tot_len > 1792, 0)) { LOG_ERROR("uhyve_netif_output: packet (%i bytes) is longer than 1792 bytes\n", p->tot_len); return ERR_IF; } - if(uhyve_netif->tx_inuse[transmitid] == 1) { - LOG_ERROR("uhyve_netif_output: %i already inuse\n", transmitid); - return ERR_IF; - } - - uhyve_netif->tx_queue++; - uhyve_netif->tx_inuse[transmitid] = 1; - #if ETH_PAD_SIZE pbuf_header(p, -ETH_PAD_SIZE); /*drop padding word */ #endif @@ -157,11 +142,10 @@ static err_t uhyve_netif_output(struct netif* netif, struct pbuf* p) * This list MUST consist of a single packet ONLY */ for (q = p, i = 0; q != 0; q = q->next) { - memcpy(uhyve_netif->tx_buf[transmitid] + i, q->payload, q->len); + // send the packet + uhyve_net_write_sync(q->payload, q->len); i += q->len; } - // send the packet - uhyve_net_write_sync(uhyve_netif->tx_buf[transmitid], p->tot_len); #if ETH_PAD_SIZE pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ @@ -169,10 +153,6 @@ static err_t uhyve_netif_output(struct netif* netif, struct pbuf* p) LINK_STATS_INC(link.xmit); - uhyve_netif->tx_complete++; - uhyve_netif->tx_inuse[transmitid] = 0; -// LOG_INFO("Transmit OK | queue = %i, complete = %i \n", uhyve_netif->tx_queue, uhyve_netif->tx_complete); - return ERR_OK; } @@ -259,18 +239,6 @@ err_t uhyve_netif_init (struct netif* netif) } memset(uhyve_netif->rx_buf, 0x00, RX_BUF_LEN + 16); - uhyve_netif->tx_buf[0] = page_alloc(TX_BUF_NUM * TX_BUF_LEN, VMA_READ|VMA_WRITE|VMA_CACHEABLE); - if (!(uhyve_netif->tx_buf[0])) { - LOG_ERROR("uhyve_netif_init: out of memory\n"); - page_free(uhyve_netif->rx_buf, RX_BUF_LEN + 16); - kfree(uhyve_netif); - return ERR_MEM; - } - memset(uhyve_netif->tx_buf[0], 0x00, TX_BUF_NUM * TX_BUF_LEN); - for (int i = 1; i < TX_BUF_NUM; i++) { - uhyve_netif->tx_buf[i] = uhyve_netif->tx_buf[0] + i*TX_BUF_LEN; - } - netif->state = uhyve_netif; mynetif = netif; @@ -306,7 +274,7 @@ err_t uhyve_netif_init (struct netif* netif) netif->output = etharp_output; netif->linkoutput = uhyve_netif_output; /* maximum transfer unit */ - netif->mtu = 1500; + netif->mtu = 32768; /* broadcast capability */ netif->flags |= NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP | NETIF_FLAG_LINK_UP | NETIF_FLAG_MLD6; diff --git a/drivers/net/uhyve-net.h b/drivers/net/uhyve-net.h index c031f0d30..4991752b1 100755 --- a/drivers/net/uhyve-net.h +++ b/drivers/net/uhyve-net.h @@ -35,9 +35,7 @@ #define MIN(a, b) (a) < (b) ? (a) : (b) -#define RX_BUF_LEN 2048 -#define TX_BUF_LEN 2048 -#define TX_BUF_NUM 1 //number of tx buffer +#define RX_BUF_LEN 3276 // UHYVE_PORT_NETINFO typedef struct { @@ -77,10 +75,6 @@ typedef struct { typedef struct uhyve_netif { struct eth_addr *ethaddr; /* Add whatever per-interface state that is needed here. */ - uint8_t* tx_buf[TX_BUF_NUM]; - uint32_t tx_queue; - uint32_t tx_complete; - uint8_t tx_inuse[TX_BUF_NUM]; uint8_t* rx_buf; } uhyve_netif_t;