Skip to content

Commit

Permalink
Implement support for LRO
Browse files Browse the repository at this point in the history
This requires converting incoming netbuf chains with multiple elements
to the equivalent pbuf.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
  • Loading branch information
mschlumpp committed Mar 18, 2024
1 parent 7c1859a commit 68af7e4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions uknetdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ static void uknetdev_input(struct uk_netdev *dev,
uint16_t queue_id __unused, void *argp)
{
struct netif *nf = (struct netif *) argp;
struct uk_netbuf *nb;
struct pbuf *p;
struct uk_netbuf *nb, *nbi;
struct pbuf *p, *pi;
err_t err;
int ret;

Expand Down Expand Up @@ -251,6 +251,15 @@ static void uknetdev_input(struct uk_netdev *dev,
p = lwip_netbuf_to_pbuf(nb);
p->payload = nb->data;
p->tot_len = p->len = nb->len;
/* Also chain further netbuf segments */
nbi = nb->next;
while (nbi) {
pi = lwip_netbuf_to_pbuf(nbi);
pi->payload = nbi->data;
pi->tot_len = pi->len = nbi->len;
pbuf_cat(p, pi);
nbi = nbi->next;
}
err = nf->input(p, nf);
if (unlikely(err != ERR_OK)) {
#if CONFIG_LWIP_THREADS && CONFIG_LIBUKNETDEV_DISPATCHERTHREADS
Expand Down Expand Up @@ -495,6 +504,7 @@ err_t uknetdev_init(struct netif *nf)
*/
dev_conf.nb_rx_queues = 1;
dev_conf.nb_tx_queues = 1;
dev_conf.lro = !!(lwip_data->dev_info.features & UK_NETDEV_F_LRO);
ret = uk_netdev_configure(dev, &dev_conf);
if (ret < 0) {
LWIP_DEBUGF(NETIF_DEBUG,
Expand Down

0 comments on commit 68af7e4

Please sign in to comment.