[dpdk-dev,v3,11/25] virtio: Check for packet headroom at compile time
Commit Message
Better to check at compile time than fail at runtime.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_pmd_virtio/virtio_ethdev.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
@@ -882,11 +882,7 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,
uint32_t offset_conf = sizeof(config->mac);
struct rte_pci_device *pci_dev;
- if (RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr)) {
- PMD_INIT_LOG(ERR,
- "MBUF HEADROOM should be enough to hold virtio net hdr\n");
- return -1;
- }
+ RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr));
eth_dev->dev_ops = &virtio_eth_dev_ops;
eth_dev->tx_pkt_burst = &virtio_xmit_pkts;