-/* $OpenBSD: vionet.c,v 1.15 2024/07/09 18:49:05 jan Exp $ */
+/* $OpenBSD: vionet.c,v 1.16 2024/07/12 14:34:08 jan Exp $ */
/*
* Copyright (c) 2023 Dave Voutila <dv@openbsd.org>
}
/* Check if we've got a minimum viable amount of data. */
- if (chain_len < VIONET_MIN_TXLEN) {
- sz = chain_len;
+ if (chain_len < VIONET_MIN_TXLEN)
goto drop;
- }
/*
* Packet inspection for ethernet header (if using a "local"
log_warnx("%s: bad source address %s",
__func__, ether_ntoa((struct ether_addr *)
eh->ether_shost));
- sz = chain_len;
goto drop;
}
}
log_warn("%s", __func__);
goto reset;
}
- sz += sizeof(struct virtio_net_hdr);
+ chain_len += sizeof(struct virtio_net_hdr);
drop:
used->ring[used->idx & VIONET_QUEUE_MASK].id = hdr_idx;
- used->ring[used->idx & VIONET_QUEUE_MASK].len = sz;
+ used->ring[used->idx & VIONET_QUEUE_MASK].len = chain_len;
__sync_synchronize();
used->idx++;
idx++;